From a48e4fa386ae843d32a73b048ffc49778849dc9d Mon Sep 17 00:00:00 2001 From: Nicolas Dextraze Date: Mon, 30 Jan 2023 15:37:10 -0500 Subject: [PATCH] compatibility for 22.x --- docker-compose-cluster.yaml | 6 +- docker-compose-single.yaml | 2 +- package-lock.json | 180 +- package.json | 4 +- src/messages/messages.js | 27726 +++++++++++++++++----------------- src/messages/messages.proto | 382 +- 6 files changed, 14185 insertions(+), 14115 deletions(-) diff --git a/docker-compose-cluster.yaml b/docker-compose-cluster.yaml index 586e91c..40e4c64 100644 --- a/docker-compose-cluster.yaml +++ b/docker-compose-cluster.yaml @@ -2,7 +2,7 @@ version: '3.7' services: eventstore1: - image: eventstore/eventstore:21.10.9-buster-slim + image: eventstore/eventstore:22.10.0-buster-slim environment: - EVENTSTORE_CLUSTER_SIZE=3 - EVENTSTORE_CLUSTER_DNS=cluster.tests.node-eventstore-client.local @@ -40,7 +40,7 @@ services: - ./certs:/etc/eventstore/certs:ro eventstore2: - image: eventstore/eventstore:21.10.9-buster-slim + image: eventstore/eventstore:22.10.0-buster-slim environment: - EVENTSTORE_CLUSTER_SIZE=3 - EVENTSTORE_CLUSTER_DNS=cluster.tests.node-eventstore-client.local @@ -74,7 +74,7 @@ services: - ./certs:/etc/eventstore/certs:ro eventstore3: - image: eventstore/eventstore:21.10.9-buster-slim + image: eventstore/eventstore:22.10.0-buster-slim environment: - EVENTSTORE_CLUSTER_SIZE=3 - EVENTSTORE_CLUSTER_DNS=cluster.tests.node-eventstore-client.local diff --git a/docker-compose-single.yaml b/docker-compose-single.yaml index 3c123f0..83320cf 100644 --- a/docker-compose-single.yaml +++ b/docker-compose-single.yaml @@ -2,7 +2,7 @@ version: '3.4' services: eventstore: - image: eventstore/eventstore:21.10.9-buster-slim + image: eventstore/eventstore:22.10.0-buster-slim environment: - EVENTSTORE_CLUSTER_SIZE=1 - EVENTSTORE_RUN_PROJECTIONS=All diff --git a/package-lock.json b/package-lock.json index e361352..c7c33b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -266,7 +266,8 @@ "@babel/parser": { "version": "7.20.13", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.13.tgz", - "integrity": "sha512-gFDLKMfpiXCsjt4za2JA9oTMn70CeseCehb11kRZgvd7+F67Hih3OHOK24cRrWECJ/ljfPGac6ygXAs/C8kIvw==" + "integrity": "sha512-gFDLKMfpiXCsjt4za2JA9oTMn70CeseCehb11kRZgvd7+F67Hih3OHOK24cRrWECJ/ljfPGac6ygXAs/C8kIvw==", + "dev": true }, "@babel/plugin-syntax-async-generators": { "version": "7.8.4", @@ -744,6 +745,7 @@ "version": "0.2.3", "resolved": "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.3.tgz", "integrity": "sha512-bbtCxCkxcnWhi50I+4Lj6mdz9w3pOXOgEQrID8TCZ/DF51fW7M9GCQW2y45SpBDdHd1Eirm1X/Cf6CkAAe8HPg==", + "dev": true, "requires": { "lodash": "^4.17.21" } @@ -751,27 +753,32 @@ "@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "dev": true }, "@protobufjs/base64": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "dev": true }, "@protobufjs/codegen": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "dev": true }, "@protobufjs/eventemitter": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "dev": true }, "@protobufjs/fetch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "dev": true, "requires": { "@protobufjs/aspromise": "^1.1.1", "@protobufjs/inquire": "^1.1.0" @@ -780,27 +787,32 @@ "@protobufjs/float": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "dev": true }, "@protobufjs/inquire": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "dev": true }, "@protobufjs/path": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "dev": true }, "@protobufjs/pool": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "dev": true }, "@protobufjs/utf8": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "dev": true }, "@sinclair/typebox": { "version": "0.25.21", @@ -935,12 +947,14 @@ "@types/linkify-it": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz", - "integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==" + "integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==", + "dev": true }, "@types/markdown-it": { "version": "12.2.3", "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz", "integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==", + "dev": true, "requires": { "@types/linkify-it": "*", "@types/mdurl": "*" @@ -949,7 +963,8 @@ "@types/mdurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", - "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==" + "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==", + "dev": true }, "@types/node": { "version": "18.11.18", @@ -1144,7 +1159,8 @@ "acorn": { "version": "8.8.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true }, "acorn-import-assertions": { "version": "1.8.0", @@ -1155,7 +1171,8 @@ "acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==" + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true }, "ajv": { "version": "6.12.6", @@ -1194,6 +1211,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "requires": { "color-convert": "^2.0.1" } @@ -1380,7 +1398,8 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "base": { "version": "0.11.2", @@ -1461,12 +1480,14 @@ "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1606,6 +1627,7 @@ "version": "0.9.0", "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", + "dev": true, "requires": { "lodash": "^4.17.15" } @@ -1614,6 +1636,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1709,6 +1732,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "requires": { "color-name": "~1.1.4" } @@ -1716,7 +1740,8 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "color-support": { "version": "1.1.3", @@ -1754,7 +1779,8 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "convert-source-map": { "version": "2.0.0", @@ -1868,7 +1894,8 @@ "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true }, "deepmerge": { "version": "4.3.0", @@ -2023,7 +2050,8 @@ "entities": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==" + "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "dev": true }, "errno": { "version": "0.1.8", @@ -2071,6 +2099,7 @@ "version": "1.14.3", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", + "dev": true, "requires": { "esprima": "^4.0.1", "estraverse": "^4.2.0", @@ -2092,7 +2121,8 @@ "eslint-visitor-keys": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==" + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true }, "esm": { "version": "3.2.25", @@ -2104,6 +2134,7 @@ "version": "9.4.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "dev": true, "requires": { "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", @@ -2113,7 +2144,8 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true }, "esrecurse": { "version": "4.3.0", @@ -2135,12 +2167,14 @@ "estraverse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true }, "esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true }, "events": { "version": "3.3.0", @@ -2362,7 +2396,8 @@ "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true }, "fb-watchman": { "version": "2.0.2", @@ -2669,7 +2704,8 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "fsevents": { "version": "2.3.2", @@ -2733,6 +2769,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -2812,7 +2849,8 @@ "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true }, "har-schema": { "version": "2.0.0", @@ -2842,7 +2880,8 @@ "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true }, "has-value": { "version": "1.0.0", @@ -2971,6 +3010,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -2979,7 +3019,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "ini": { "version": "1.3.8", @@ -3759,6 +3800,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", + "dev": true, "requires": { "xmlcreate": "^2.0.4" } @@ -3773,6 +3815,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.0.tgz", "integrity": "sha512-tzTgkklbWKrlaQL2+e3NNgLcZu3NaK2vsHRx7tyHQ+H5jcB9Gx0txSd2eJWlMC/xU1+7LQu4s58Ry0RkuaEQVg==", + "dev": true, "requires": { "@babel/parser": "^7.9.4", "@jsdoc/salty": "^0.2.1", @@ -3794,7 +3837,8 @@ "escape-string-regexp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true } } }, @@ -3862,6 +3906,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", + "dev": true, "requires": { "graceful-fs": "^4.1.9" } @@ -3888,6 +3933,7 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", + "dev": true, "requires": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" @@ -3903,6 +3949,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "dev": true, "requires": { "uc.micro": "^1.0.1" } @@ -3983,7 +4030,8 @@ "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "lodash.flattendeep": { "version": "4.4.0", @@ -4054,6 +4102,7 @@ "version": "12.3.2", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "dev": true, "requires": { "argparse": "^2.0.1", "entities": "~2.1.0", @@ -4065,24 +4114,28 @@ "argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true } } }, "markdown-it-anchor": { "version": "8.6.6", "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.6.tgz", - "integrity": "sha512-jRW30YGywD2ESXDc+l17AiritL0uVaSnWsb26f+68qaW9zgbIIr1f4v2Nsvc0+s0Z2N3uX6t/yAw7BwCQ1wMsA==" + "integrity": "sha512-jRW30YGywD2ESXDc+l17AiritL0uVaSnWsb26f+68qaW9zgbIIr1f4v2Nsvc0+s0Z2N3uX6t/yAw7BwCQ1wMsA==", + "dev": true }, "marked": { "version": "4.2.12", "resolved": "https://registry.npmjs.org/marked/-/marked-4.2.12.tgz", - "integrity": "sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==" + "integrity": "sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==", + "dev": true }, "mdurl": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==" + "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", + "dev": true }, "memory-fs": { "version": "0.5.0", @@ -4144,6 +4197,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4151,7 +4205,8 @@ "minimist": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true }, "minipass": { "version": "2.9.0", @@ -4187,7 +4242,8 @@ "mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true }, "ms": { "version": "2.1.2", @@ -4658,6 +4714,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "requires": { "wrappy": "1" } @@ -4681,6 +4738,7 @@ "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, "requires": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", @@ -4780,7 +4838,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true }, "path-key": { "version": "3.1.1", @@ -4859,7 +4918,8 @@ "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==" + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", + "dev": true }, "pretty-format": { "version": "29.4.1", @@ -4900,6 +4960,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.0.tgz", "integrity": "sha512-hYCqTDuII4iJ4stZqiuGCSU8xxWl5JeXYpwARGtn/tWcKCAro6h3WQz+xpsNbXW0UYqpmTQFEyFWO0G0Kjt64g==", + "dev": true, "requires": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -4919,6 +4980,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/protobufjs-cli/-/protobufjs-cli-1.1.0.tgz", "integrity": "sha512-VXMQn+z3yG2WbN2E+mx5vcyIHF7yJSg2jqyqfxcZLWNOSTqUzSSgAE5vu04/JEpwxTI04JGyrZRDHC36wr04uw==", + "dev": true, "requires": { "chalk": "^4.0.0", "escodegen": "^1.13.0", @@ -4936,6 +4998,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, "requires": { "balanced-match": "^1.0.0" } @@ -4943,12 +5006,14 @@ "estraverse": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true }, "glob": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -4961,6 +5026,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, "requires": { "yallist": "^4.0.0" } @@ -4969,6 +5035,7 @@ "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, "requires": { "brace-expansion": "^2.0.1" } @@ -4977,6 +5044,7 @@ "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, "requires": { "lru-cache": "^6.0.0" } @@ -4984,7 +5052,8 @@ "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } } }, @@ -5196,6 +5265,7 @@ "version": "0.2.4", "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.4.tgz", "integrity": "sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==", + "dev": true, "requires": { "lodash": "^4.17.21" } @@ -5516,7 +5586,8 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true }, "source-map-resolve": { "version": "0.5.3", @@ -5750,12 +5821,14 @@ "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "requires": { "has-flag": "^4.0.0" } @@ -5987,6 +6060,7 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, "requires": { "rimraf": "^3.0.0" }, @@ -5995,6 +6069,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, "requires": { "glob": "^7.1.3" } @@ -6126,6 +6201,7 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", + "dev": true, "requires": { "prelude-ls": "~1.1.2" } @@ -6151,17 +6227,20 @@ "uc.micro": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", + "dev": true }, "uglify-js": { "version": "3.17.4", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==" + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "dev": true }, "underscore": { "version": "1.13.6", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", - "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==" + "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", + "dev": true }, "unicode-length": { "version": "1.0.3", @@ -6721,7 +6800,8 @@ "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true }, "wrap-ansi": { "version": "7.0.0", @@ -6737,7 +6817,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "write-file-atomic": { "version": "5.0.0", @@ -6752,7 +6833,8 @@ "xmlcreate": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", - "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==" + "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==", + "dev": true }, "y18n": { "version": "5.0.8", diff --git a/package.json b/package.json index 1dc2fee..22f7a62 100644 --- a/package.json +++ b/package.json @@ -61,8 +61,6 @@ "dependencies": { "@types/node": ">=14", "long": "^5.2.0", - "protobufjs": "^7.1.2", - "protobufjs-cli": "^1.0.2", "strict-event-emitter-types": "^1.2.0", "uuid": "^9.0.0" }, @@ -70,6 +68,8 @@ "jest": "^29.4.1", "jsdoc": "^4.0.0", "nodeunit": "^0.11.3", + "protobufjs": "^7.2.0", + "protobufjs-cli": "^1.1.0", "webpack": "^5.75.0", "webpack-cli": "^3.3.10" } diff --git a/src/messages/messages.js b/src/messages/messages.js index f386ff8..820dd09 100644 --- a/src/messages/messages.js +++ b/src/messages/messages.js @@ -1,5928 +1,5917 @@ /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ -(function(global, factory) { /* global define, require, module */ +"use strict"; - /* AMD */ if (typeof define === 'function' && define.amd) - define(["protobufjs/minimal"], factory); +var $protobuf = require("protobufjs/minimal"); +var $moduleUtil = require("../utils/modules"); - /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("protobufjs/minimal"), require("../utils/modules")); +// This fixes bug #91 by giving us an isolate copy of protobufjs library so any tampering with it doesn't affect us +var old = $moduleUtil.uncache(require.resolve('protobufjs/minimal')); +$protobuf = require('protobufjs/minimal'); +$moduleUtil.recache(old); -})(this, function($protobuf, $moduleUtil) { - "use strict"; +// Common aliases +var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; - // This fixes bug #91 by giving us an isolate copy of protobufjs library so any tampering with it doesn't affect us - var old = $moduleUtil.uncache(require.resolve('protobufjs/minimal')); - $protobuf = require('protobufjs/minimal'); - $moduleUtil.recache(old); +// Exported root namespace +var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); - // Common aliases - var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; +$root.EventStore = (function() { - // Exported root namespace - var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + /** + * Namespace EventStore. + * @exports EventStore + * @namespace + */ + var EventStore = {}; - $root.EventStore = (function() { + EventStore.Client = (function() { /** - * Namespace EventStore. - * @exports EventStore + * Namespace Client. + * @memberof EventStore * @namespace */ - var EventStore = {}; + var Client = {}; - EventStore.Client = (function() { + Client.Messages = (function() { /** - * Namespace Client. - * @memberof EventStore + * Namespace Messages. + * @memberof EventStore.Client * @namespace */ - var Client = {}; + var Messages = {}; - Client.Messages = (function() { + /** + * OperationResult enum. + * @name EventStore.Client.Messages.OperationResult + * @enum {number} + * @property {number} Success=0 Success value + * @property {number} PrepareTimeout=1 PrepareTimeout value + * @property {number} CommitTimeout=2 CommitTimeout value + * @property {number} ForwardTimeout=3 ForwardTimeout value + * @property {number} WrongExpectedVersion=4 WrongExpectedVersion value + * @property {number} StreamDeleted=5 StreamDeleted value + * @property {number} InvalidTransaction=6 InvalidTransaction value + * @property {number} AccessDenied=7 AccessDenied value + */ + Messages.OperationResult = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Success"] = 0; + values[valuesById[1] = "PrepareTimeout"] = 1; + values[valuesById[2] = "CommitTimeout"] = 2; + values[valuesById[3] = "ForwardTimeout"] = 3; + values[valuesById[4] = "WrongExpectedVersion"] = 4; + values[valuesById[5] = "StreamDeleted"] = 5; + values[valuesById[6] = "InvalidTransaction"] = 6; + values[valuesById[7] = "AccessDenied"] = 7; + return values; + })(); + + Messages.NewEvent = (function() { /** - * Namespace Messages. - * @memberof EventStore.Client - * @namespace + * Properties of a NewEvent. + * @memberof EventStore.Client.Messages + * @interface INewEvent + * @property {Uint8Array|null} [eventId] NewEvent eventId + * @property {string|null} [eventType] NewEvent eventType + * @property {number|null} [dataContentType] NewEvent dataContentType + * @property {number|null} [metadataContentType] NewEvent metadataContentType + * @property {Uint8Array|null} [data] NewEvent data + * @property {Uint8Array|null} [metadata] NewEvent metadata */ - var Messages = {}; /** - * OperationResult enum. - * @name EventStore.Client.Messages.OperationResult + * Constructs a new NewEvent. + * @memberof EventStore.Client.Messages + * @classdesc Represents a NewEvent. + * @implements INewEvent + * @constructor + * @param {EventStore.Client.Messages.INewEvent=} [properties] Properties to set + */ + function NewEvent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NewEvent eventId. + * @member {Uint8Array} eventId + * @memberof EventStore.Client.Messages.NewEvent + * @instance + */ + NewEvent.prototype.eventId = $util.newBuffer([]); + + /** + * NewEvent eventType. + * @member {string} eventType + * @memberof EventStore.Client.Messages.NewEvent + * @instance + */ + NewEvent.prototype.eventType = ""; + + /** + * NewEvent dataContentType. + * @member {number} dataContentType + * @memberof EventStore.Client.Messages.NewEvent + * @instance + */ + NewEvent.prototype.dataContentType = 0; + + /** + * NewEvent metadataContentType. + * @member {number} metadataContentType + * @memberof EventStore.Client.Messages.NewEvent + * @instance + */ + NewEvent.prototype.metadataContentType = 0; + + /** + * NewEvent data. + * @member {Uint8Array} data + * @memberof EventStore.Client.Messages.NewEvent + * @instance + */ + NewEvent.prototype.data = $util.newBuffer([]); + + /** + * NewEvent metadata. + * @member {Uint8Array} metadata + * @memberof EventStore.Client.Messages.NewEvent + * @instance + */ + NewEvent.prototype.metadata = $util.newBuffer([]); + + /** + * Creates a new NewEvent instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.NewEvent + * @static + * @param {EventStore.Client.Messages.INewEvent=} [properties] Properties to set + * @returns {EventStore.Client.Messages.NewEvent} NewEvent instance + */ + NewEvent.create = function create(properties) { + return new NewEvent(properties); + }; + + /** + * Encodes the specified NewEvent message. Does not implicitly {@link EventStore.Client.Messages.NewEvent.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.NewEvent + * @static + * @param {EventStore.Client.Messages.INewEvent} message NewEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NewEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventId != null && Object.hasOwnProperty.call(message, "eventId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.eventId); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.eventType); + if (message.dataContentType != null && Object.hasOwnProperty.call(message, "dataContentType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.dataContentType); + if (message.metadataContentType != null && Object.hasOwnProperty.call(message, "metadataContentType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.metadataContentType); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.data); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.metadata); + return writer; + }; + + /** + * Encodes the specified NewEvent message, length delimited. Does not implicitly {@link EventStore.Client.Messages.NewEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.NewEvent + * @static + * @param {EventStore.Client.Messages.INewEvent} message NewEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NewEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NewEvent message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.NewEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.NewEvent} NewEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NewEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.NewEvent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.eventId = reader.bytes(); + break; + } + case 2: { + message.eventType = reader.string(); + break; + } + case 3: { + message.dataContentType = reader.int32(); + break; + } + case 4: { + message.metadataContentType = reader.int32(); + break; + } + case 5: { + message.data = reader.bytes(); + break; + } + case 6: { + message.metadata = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NewEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.NewEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.NewEvent} NewEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NewEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NewEvent message. + * @function verify + * @memberof EventStore.Client.Messages.NewEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NewEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventId != null && message.hasOwnProperty("eventId")) + if (!(message.eventId && typeof message.eventId.length === "number" || $util.isString(message.eventId))) + return "eventId: buffer expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.dataContentType != null && message.hasOwnProperty("dataContentType")) + if (!$util.isInteger(message.dataContentType)) + return "dataContentType: integer expected"; + if (message.metadataContentType != null && message.hasOwnProperty("metadataContentType")) + if (!$util.isInteger(message.metadataContentType)) + return "metadataContentType: integer expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) + if (!(message.metadata && typeof message.metadata.length === "number" || $util.isString(message.metadata))) + return "metadata: buffer expected"; + return null; + }; + + /** + * Creates a NewEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.NewEvent + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.NewEvent} NewEvent + */ + NewEvent.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.NewEvent) + return object; + var message = new $root.EventStore.Client.Messages.NewEvent(); + if (object.eventId != null) + if (typeof object.eventId === "string") + $util.base64.decode(object.eventId, message.eventId = $util.newBuffer($util.base64.length(object.eventId)), 0); + else if (object.eventId.length >= 0) + message.eventId = object.eventId; + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.dataContentType != null) + message.dataContentType = object.dataContentType | 0; + if (object.metadataContentType != null) + message.metadataContentType = object.metadataContentType | 0; + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length >= 0) + message.data = object.data; + if (object.metadata != null) + if (typeof object.metadata === "string") + $util.base64.decode(object.metadata, message.metadata = $util.newBuffer($util.base64.length(object.metadata)), 0); + else if (object.metadata.length >= 0) + message.metadata = object.metadata; + return message; + }; + + /** + * Creates a plain object from a NewEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.NewEvent + * @static + * @param {EventStore.Client.Messages.NewEvent} message NewEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NewEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.eventId = ""; + else { + object.eventId = []; + if (options.bytes !== Array) + object.eventId = $util.newBuffer(object.eventId); + } + object.eventType = ""; + object.dataContentType = 0; + object.metadataContentType = 0; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + if (options.bytes === String) + object.metadata = ""; + else { + object.metadata = []; + if (options.bytes !== Array) + object.metadata = $util.newBuffer(object.metadata); + } + } + if (message.eventId != null && message.hasOwnProperty("eventId")) + object.eventId = options.bytes === String ? $util.base64.encode(message.eventId, 0, message.eventId.length) : options.bytes === Array ? Array.prototype.slice.call(message.eventId) : message.eventId; + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.dataContentType != null && message.hasOwnProperty("dataContentType")) + object.dataContentType = message.dataContentType; + if (message.metadataContentType != null && message.hasOwnProperty("metadataContentType")) + object.metadataContentType = message.metadataContentType; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = options.bytes === String ? $util.base64.encode(message.metadata, 0, message.metadata.length) : options.bytes === Array ? Array.prototype.slice.call(message.metadata) : message.metadata; + return object; + }; + + /** + * Converts this NewEvent to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.NewEvent + * @instance + * @returns {Object.} JSON object + */ + NewEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NewEvent + * @function getTypeUrl + * @memberof EventStore.Client.Messages.NewEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NewEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.NewEvent"; + }; + + return NewEvent; + })(); + + Messages.EventRecord = (function() { + + /** + * Properties of an EventRecord. + * @memberof EventStore.Client.Messages + * @interface IEventRecord + * @property {string|null} [eventStreamId] EventRecord eventStreamId + * @property {Long|null} [eventNumber] EventRecord eventNumber + * @property {Uint8Array|null} [eventId] EventRecord eventId + * @property {string|null} [eventType] EventRecord eventType + * @property {number|null} [dataContentType] EventRecord dataContentType + * @property {number|null} [metadataContentType] EventRecord metadataContentType + * @property {Uint8Array|null} [data] EventRecord data + * @property {Uint8Array|null} [metadata] EventRecord metadata + * @property {Long|null} [created] EventRecord created + * @property {Long|null} [createdEpoch] EventRecord createdEpoch + */ + + /** + * Constructs a new EventRecord. + * @memberof EventStore.Client.Messages + * @classdesc Represents an EventRecord. + * @implements IEventRecord + * @constructor + * @param {EventStore.Client.Messages.IEventRecord=} [properties] Properties to set + */ + function EventRecord(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventRecord eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.EventRecord + * @instance + */ + EventRecord.prototype.eventStreamId = ""; + + /** + * EventRecord eventNumber. + * @member {Long} eventNumber + * @memberof EventStore.Client.Messages.EventRecord + * @instance + */ + EventRecord.prototype.eventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * EventRecord eventId. + * @member {Uint8Array} eventId + * @memberof EventStore.Client.Messages.EventRecord + * @instance + */ + EventRecord.prototype.eventId = $util.newBuffer([]); + + /** + * EventRecord eventType. + * @member {string} eventType + * @memberof EventStore.Client.Messages.EventRecord + * @instance + */ + EventRecord.prototype.eventType = ""; + + /** + * EventRecord dataContentType. + * @member {number} dataContentType + * @memberof EventStore.Client.Messages.EventRecord + * @instance + */ + EventRecord.prototype.dataContentType = 0; + + /** + * EventRecord metadataContentType. + * @member {number} metadataContentType + * @memberof EventStore.Client.Messages.EventRecord + * @instance + */ + EventRecord.prototype.metadataContentType = 0; + + /** + * EventRecord data. + * @member {Uint8Array} data + * @memberof EventStore.Client.Messages.EventRecord + * @instance + */ + EventRecord.prototype.data = $util.newBuffer([]); + + /** + * EventRecord metadata. + * @member {Uint8Array} metadata + * @memberof EventStore.Client.Messages.EventRecord + * @instance + */ + EventRecord.prototype.metadata = $util.newBuffer([]); + + /** + * EventRecord created. + * @member {Long} created + * @memberof EventStore.Client.Messages.EventRecord + * @instance + */ + EventRecord.prototype.created = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * EventRecord createdEpoch. + * @member {Long} createdEpoch + * @memberof EventStore.Client.Messages.EventRecord + * @instance + */ + EventRecord.prototype.createdEpoch = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new EventRecord instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.EventRecord + * @static + * @param {EventStore.Client.Messages.IEventRecord=} [properties] Properties to set + * @returns {EventStore.Client.Messages.EventRecord} EventRecord instance + */ + EventRecord.create = function create(properties) { + return new EventRecord(properties); + }; + + /** + * Encodes the specified EventRecord message. Does not implicitly {@link EventStore.Client.Messages.EventRecord.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.EventRecord + * @static + * @param {EventStore.Client.Messages.IEventRecord} message EventRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); + if (message.eventNumber != null && Object.hasOwnProperty.call(message, "eventNumber")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.eventNumber); + if (message.eventId != null && Object.hasOwnProperty.call(message, "eventId")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.eventId); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.eventType); + if (message.dataContentType != null && Object.hasOwnProperty.call(message, "dataContentType")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.dataContentType); + if (message.metadataContentType != null && Object.hasOwnProperty.call(message, "metadataContentType")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.metadataContentType); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.data); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.metadata); + if (message.created != null && Object.hasOwnProperty.call(message, "created")) + writer.uint32(/* id 9, wireType 0 =*/72).int64(message.created); + if (message.createdEpoch != null && Object.hasOwnProperty.call(message, "createdEpoch")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.createdEpoch); + return writer; + }; + + /** + * Encodes the specified EventRecord message, length delimited. Does not implicitly {@link EventStore.Client.Messages.EventRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.EventRecord + * @static + * @param {EventStore.Client.Messages.IEventRecord} message EventRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventRecord message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.EventRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.EventRecord} EventRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.EventRecord(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.eventStreamId = reader.string(); + break; + } + case 2: { + message.eventNumber = reader.int64(); + break; + } + case 3: { + message.eventId = reader.bytes(); + break; + } + case 4: { + message.eventType = reader.string(); + break; + } + case 5: { + message.dataContentType = reader.int32(); + break; + } + case 6: { + message.metadataContentType = reader.int32(); + break; + } + case 7: { + message.data = reader.bytes(); + break; + } + case 8: { + message.metadata = reader.bytes(); + break; + } + case 9: { + message.created = reader.int64(); + break; + } + case 10: { + message.createdEpoch = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.EventRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.EventRecord} EventRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventRecord message. + * @function verify + * @memberof EventStore.Client.Messages.EventRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + if (!$util.isString(message.eventStreamId)) + return "eventStreamId: string expected"; + if (message.eventNumber != null && message.hasOwnProperty("eventNumber")) + if (!$util.isInteger(message.eventNumber) && !(message.eventNumber && $util.isInteger(message.eventNumber.low) && $util.isInteger(message.eventNumber.high))) + return "eventNumber: integer|Long expected"; + if (message.eventId != null && message.hasOwnProperty("eventId")) + if (!(message.eventId && typeof message.eventId.length === "number" || $util.isString(message.eventId))) + return "eventId: buffer expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.dataContentType != null && message.hasOwnProperty("dataContentType")) + if (!$util.isInteger(message.dataContentType)) + return "dataContentType: integer expected"; + if (message.metadataContentType != null && message.hasOwnProperty("metadataContentType")) + if (!$util.isInteger(message.metadataContentType)) + return "metadataContentType: integer expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) + if (!(message.metadata && typeof message.metadata.length === "number" || $util.isString(message.metadata))) + return "metadata: buffer expected"; + if (message.created != null && message.hasOwnProperty("created")) + if (!$util.isInteger(message.created) && !(message.created && $util.isInteger(message.created.low) && $util.isInteger(message.created.high))) + return "created: integer|Long expected"; + if (message.createdEpoch != null && message.hasOwnProperty("createdEpoch")) + if (!$util.isInteger(message.createdEpoch) && !(message.createdEpoch && $util.isInteger(message.createdEpoch.low) && $util.isInteger(message.createdEpoch.high))) + return "createdEpoch: integer|Long expected"; + return null; + }; + + /** + * Creates an EventRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.EventRecord + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.EventRecord} EventRecord + */ + EventRecord.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.EventRecord) + return object; + var message = new $root.EventStore.Client.Messages.EventRecord(); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.eventNumber != null) + if ($util.Long) + (message.eventNumber = $util.Long.fromValue(object.eventNumber)).unsigned = false; + else if (typeof object.eventNumber === "string") + message.eventNumber = parseInt(object.eventNumber, 10); + else if (typeof object.eventNumber === "number") + message.eventNumber = object.eventNumber; + else if (typeof object.eventNumber === "object") + message.eventNumber = new $util.LongBits(object.eventNumber.low >>> 0, object.eventNumber.high >>> 0).toNumber(); + if (object.eventId != null) + if (typeof object.eventId === "string") + $util.base64.decode(object.eventId, message.eventId = $util.newBuffer($util.base64.length(object.eventId)), 0); + else if (object.eventId.length >= 0) + message.eventId = object.eventId; + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.dataContentType != null) + message.dataContentType = object.dataContentType | 0; + if (object.metadataContentType != null) + message.metadataContentType = object.metadataContentType | 0; + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length >= 0) + message.data = object.data; + if (object.metadata != null) + if (typeof object.metadata === "string") + $util.base64.decode(object.metadata, message.metadata = $util.newBuffer($util.base64.length(object.metadata)), 0); + else if (object.metadata.length >= 0) + message.metadata = object.metadata; + if (object.created != null) + if ($util.Long) + (message.created = $util.Long.fromValue(object.created)).unsigned = false; + else if (typeof object.created === "string") + message.created = parseInt(object.created, 10); + else if (typeof object.created === "number") + message.created = object.created; + else if (typeof object.created === "object") + message.created = new $util.LongBits(object.created.low >>> 0, object.created.high >>> 0).toNumber(); + if (object.createdEpoch != null) + if ($util.Long) + (message.createdEpoch = $util.Long.fromValue(object.createdEpoch)).unsigned = false; + else if (typeof object.createdEpoch === "string") + message.createdEpoch = parseInt(object.createdEpoch, 10); + else if (typeof object.createdEpoch === "number") + message.createdEpoch = object.createdEpoch; + else if (typeof object.createdEpoch === "object") + message.createdEpoch = new $util.LongBits(object.createdEpoch.low >>> 0, object.createdEpoch.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an EventRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.EventRecord + * @static + * @param {EventStore.Client.Messages.EventRecord} message EventRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.eventStreamId = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.eventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.eventNumber = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.eventId = ""; + else { + object.eventId = []; + if (options.bytes !== Array) + object.eventId = $util.newBuffer(object.eventId); + } + object.eventType = ""; + object.dataContentType = 0; + object.metadataContentType = 0; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + if (options.bytes === String) + object.metadata = ""; + else { + object.metadata = []; + if (options.bytes !== Array) + object.metadata = $util.newBuffer(object.metadata); + } + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.created = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.created = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.createdEpoch = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.createdEpoch = options.longs === String ? "0" : 0; + } + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.eventNumber != null && message.hasOwnProperty("eventNumber")) + if (typeof message.eventNumber === "number") + object.eventNumber = options.longs === String ? String(message.eventNumber) : message.eventNumber; + else + object.eventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.eventNumber) : options.longs === Number ? new $util.LongBits(message.eventNumber.low >>> 0, message.eventNumber.high >>> 0).toNumber() : message.eventNumber; + if (message.eventId != null && message.hasOwnProperty("eventId")) + object.eventId = options.bytes === String ? $util.base64.encode(message.eventId, 0, message.eventId.length) : options.bytes === Array ? Array.prototype.slice.call(message.eventId) : message.eventId; + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.dataContentType != null && message.hasOwnProperty("dataContentType")) + object.dataContentType = message.dataContentType; + if (message.metadataContentType != null && message.hasOwnProperty("metadataContentType")) + object.metadataContentType = message.metadataContentType; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = options.bytes === String ? $util.base64.encode(message.metadata, 0, message.metadata.length) : options.bytes === Array ? Array.prototype.slice.call(message.metadata) : message.metadata; + if (message.created != null && message.hasOwnProperty("created")) + if (typeof message.created === "number") + object.created = options.longs === String ? String(message.created) : message.created; + else + object.created = options.longs === String ? $util.Long.prototype.toString.call(message.created) : options.longs === Number ? new $util.LongBits(message.created.low >>> 0, message.created.high >>> 0).toNumber() : message.created; + if (message.createdEpoch != null && message.hasOwnProperty("createdEpoch")) + if (typeof message.createdEpoch === "number") + object.createdEpoch = options.longs === String ? String(message.createdEpoch) : message.createdEpoch; + else + object.createdEpoch = options.longs === String ? $util.Long.prototype.toString.call(message.createdEpoch) : options.longs === Number ? new $util.LongBits(message.createdEpoch.low >>> 0, message.createdEpoch.high >>> 0).toNumber() : message.createdEpoch; + return object; + }; + + /** + * Converts this EventRecord to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.EventRecord + * @instance + * @returns {Object.} JSON object + */ + EventRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EventRecord + * @function getTypeUrl + * @memberof EventStore.Client.Messages.EventRecord + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EventRecord.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.EventRecord"; + }; + + return EventRecord; + })(); + + Messages.ResolvedIndexedEvent = (function() { + + /** + * Properties of a ResolvedIndexedEvent. + * @memberof EventStore.Client.Messages + * @interface IResolvedIndexedEvent + * @property {EventStore.Client.Messages.IEventRecord|null} [event] ResolvedIndexedEvent event + * @property {EventStore.Client.Messages.IEventRecord|null} [link] ResolvedIndexedEvent link + */ + + /** + * Constructs a new ResolvedIndexedEvent. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ResolvedIndexedEvent. + * @implements IResolvedIndexedEvent + * @constructor + * @param {EventStore.Client.Messages.IResolvedIndexedEvent=} [properties] Properties to set + */ + function ResolvedIndexedEvent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResolvedIndexedEvent event. + * @member {EventStore.Client.Messages.IEventRecord|null|undefined} event + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @instance + */ + ResolvedIndexedEvent.prototype.event = null; + + /** + * ResolvedIndexedEvent link. + * @member {EventStore.Client.Messages.IEventRecord|null|undefined} link + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @instance + */ + ResolvedIndexedEvent.prototype.link = null; + + /** + * Creates a new ResolvedIndexedEvent instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @static + * @param {EventStore.Client.Messages.IResolvedIndexedEvent=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ResolvedIndexedEvent} ResolvedIndexedEvent instance + */ + ResolvedIndexedEvent.create = function create(properties) { + return new ResolvedIndexedEvent(properties); + }; + + /** + * Encodes the specified ResolvedIndexedEvent message. Does not implicitly {@link EventStore.Client.Messages.ResolvedIndexedEvent.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @static + * @param {EventStore.Client.Messages.IResolvedIndexedEvent} message ResolvedIndexedEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResolvedIndexedEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + $root.EventStore.Client.Messages.EventRecord.encode(message.event, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.link != null && Object.hasOwnProperty.call(message, "link")) + $root.EventStore.Client.Messages.EventRecord.encode(message.link, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ResolvedIndexedEvent message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ResolvedIndexedEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @static + * @param {EventStore.Client.Messages.IResolvedIndexedEvent} message ResolvedIndexedEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResolvedIndexedEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResolvedIndexedEvent message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ResolvedIndexedEvent} ResolvedIndexedEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResolvedIndexedEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ResolvedIndexedEvent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.event = $root.EventStore.Client.Messages.EventRecord.decode(reader, reader.uint32()); + break; + } + case 2: { + message.link = $root.EventStore.Client.Messages.EventRecord.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResolvedIndexedEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ResolvedIndexedEvent} ResolvedIndexedEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResolvedIndexedEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResolvedIndexedEvent message. + * @function verify + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResolvedIndexedEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.event != null && message.hasOwnProperty("event")) { + var error = $root.EventStore.Client.Messages.EventRecord.verify(message.event); + if (error) + return "event." + error; + } + if (message.link != null && message.hasOwnProperty("link")) { + var error = $root.EventStore.Client.Messages.EventRecord.verify(message.link); + if (error) + return "link." + error; + } + return null; + }; + + /** + * Creates a ResolvedIndexedEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ResolvedIndexedEvent} ResolvedIndexedEvent + */ + ResolvedIndexedEvent.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ResolvedIndexedEvent) + return object; + var message = new $root.EventStore.Client.Messages.ResolvedIndexedEvent(); + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".EventStore.Client.Messages.ResolvedIndexedEvent.event: object expected"); + message.event = $root.EventStore.Client.Messages.EventRecord.fromObject(object.event); + } + if (object.link != null) { + if (typeof object.link !== "object") + throw TypeError(".EventStore.Client.Messages.ResolvedIndexedEvent.link: object expected"); + message.link = $root.EventStore.Client.Messages.EventRecord.fromObject(object.link); + } + return message; + }; + + /** + * Creates a plain object from a ResolvedIndexedEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @static + * @param {EventStore.Client.Messages.ResolvedIndexedEvent} message ResolvedIndexedEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResolvedIndexedEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.event = null; + object.link = null; + } + if (message.event != null && message.hasOwnProperty("event")) + object.event = $root.EventStore.Client.Messages.EventRecord.toObject(message.event, options); + if (message.link != null && message.hasOwnProperty("link")) + object.link = $root.EventStore.Client.Messages.EventRecord.toObject(message.link, options); + return object; + }; + + /** + * Converts this ResolvedIndexedEvent to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @instance + * @returns {Object.} JSON object + */ + ResolvedIndexedEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResolvedIndexedEvent + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ResolvedIndexedEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResolvedIndexedEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ResolvedIndexedEvent"; + }; + + return ResolvedIndexedEvent; + })(); + + Messages.ResolvedEvent = (function() { + + /** + * Properties of a ResolvedEvent. + * @memberof EventStore.Client.Messages + * @interface IResolvedEvent + * @property {EventStore.Client.Messages.IEventRecord|null} [event] ResolvedEvent event + * @property {EventStore.Client.Messages.IEventRecord|null} [link] ResolvedEvent link + * @property {Long|null} [commitPosition] ResolvedEvent commitPosition + * @property {Long|null} [preparePosition] ResolvedEvent preparePosition + */ + + /** + * Constructs a new ResolvedEvent. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ResolvedEvent. + * @implements IResolvedEvent + * @constructor + * @param {EventStore.Client.Messages.IResolvedEvent=} [properties] Properties to set + */ + function ResolvedEvent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResolvedEvent event. + * @member {EventStore.Client.Messages.IEventRecord|null|undefined} event + * @memberof EventStore.Client.Messages.ResolvedEvent + * @instance + */ + ResolvedEvent.prototype.event = null; + + /** + * ResolvedEvent link. + * @member {EventStore.Client.Messages.IEventRecord|null|undefined} link + * @memberof EventStore.Client.Messages.ResolvedEvent + * @instance + */ + ResolvedEvent.prototype.link = null; + + /** + * ResolvedEvent commitPosition. + * @member {Long} commitPosition + * @memberof EventStore.Client.Messages.ResolvedEvent + * @instance + */ + ResolvedEvent.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ResolvedEvent preparePosition. + * @member {Long} preparePosition + * @memberof EventStore.Client.Messages.ResolvedEvent + * @instance + */ + ResolvedEvent.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ResolvedEvent instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ResolvedEvent + * @static + * @param {EventStore.Client.Messages.IResolvedEvent=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ResolvedEvent} ResolvedEvent instance + */ + ResolvedEvent.create = function create(properties) { + return new ResolvedEvent(properties); + }; + + /** + * Encodes the specified ResolvedEvent message. Does not implicitly {@link EventStore.Client.Messages.ResolvedEvent.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ResolvedEvent + * @static + * @param {EventStore.Client.Messages.IResolvedEvent} message ResolvedEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResolvedEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + $root.EventStore.Client.Messages.EventRecord.encode(message.event, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.link != null && Object.hasOwnProperty.call(message, "link")) + $root.EventStore.Client.Messages.EventRecord.encode(message.link, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.commitPosition); + if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.preparePosition); + return writer; + }; + + /** + * Encodes the specified ResolvedEvent message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ResolvedEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ResolvedEvent + * @static + * @param {EventStore.Client.Messages.IResolvedEvent} message ResolvedEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResolvedEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResolvedEvent message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ResolvedEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ResolvedEvent} ResolvedEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResolvedEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ResolvedEvent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.event = $root.EventStore.Client.Messages.EventRecord.decode(reader, reader.uint32()); + break; + } + case 2: { + message.link = $root.EventStore.Client.Messages.EventRecord.decode(reader, reader.uint32()); + break; + } + case 3: { + message.commitPosition = reader.int64(); + break; + } + case 4: { + message.preparePosition = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResolvedEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ResolvedEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ResolvedEvent} ResolvedEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResolvedEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResolvedEvent message. + * @function verify + * @memberof EventStore.Client.Messages.ResolvedEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResolvedEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.event != null && message.hasOwnProperty("event")) { + var error = $root.EventStore.Client.Messages.EventRecord.verify(message.event); + if (error) + return "event." + error; + } + if (message.link != null && message.hasOwnProperty("link")) { + var error = $root.EventStore.Client.Messages.EventRecord.verify(message.link); + if (error) + return "link." + error; + } + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) + return "commitPosition: integer|Long expected"; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) + return "preparePosition: integer|Long expected"; + return null; + }; + + /** + * Creates a ResolvedEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ResolvedEvent + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ResolvedEvent} ResolvedEvent + */ + ResolvedEvent.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ResolvedEvent) + return object; + var message = new $root.EventStore.Client.Messages.ResolvedEvent(); + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".EventStore.Client.Messages.ResolvedEvent.event: object expected"); + message.event = $root.EventStore.Client.Messages.EventRecord.fromObject(object.event); + } + if (object.link != null) { + if (typeof object.link !== "object") + throw TypeError(".EventStore.Client.Messages.ResolvedEvent.link: object expected"); + message.link = $root.EventStore.Client.Messages.EventRecord.fromObject(object.link); + } + if (object.commitPosition != null) + if ($util.Long) + (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; + else if (typeof object.commitPosition === "string") + message.commitPosition = parseInt(object.commitPosition, 10); + else if (typeof object.commitPosition === "number") + message.commitPosition = object.commitPosition; + else if (typeof object.commitPosition === "object") + message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); + if (object.preparePosition != null) + if ($util.Long) + (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; + else if (typeof object.preparePosition === "string") + message.preparePosition = parseInt(object.preparePosition, 10); + else if (typeof object.preparePosition === "number") + message.preparePosition = object.preparePosition; + else if (typeof object.preparePosition === "object") + message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ResolvedEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ResolvedEvent + * @static + * @param {EventStore.Client.Messages.ResolvedEvent} message ResolvedEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResolvedEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.event = null; + object.link = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.commitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.preparePosition = options.longs === String ? "0" : 0; + } + if (message.event != null && message.hasOwnProperty("event")) + object.event = $root.EventStore.Client.Messages.EventRecord.toObject(message.event, options); + if (message.link != null && message.hasOwnProperty("link")) + object.link = $root.EventStore.Client.Messages.EventRecord.toObject(message.link, options); + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (typeof message.commitPosition === "number") + object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; + else + object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (typeof message.preparePosition === "number") + object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; + else + object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; + return object; + }; + + /** + * Converts this ResolvedEvent to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ResolvedEvent + * @instance + * @returns {Object.} JSON object + */ + ResolvedEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResolvedEvent + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ResolvedEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResolvedEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ResolvedEvent"; + }; + + return ResolvedEvent; + })(); + + Messages.WriteEvents = (function() { + + /** + * Properties of a WriteEvents. + * @memberof EventStore.Client.Messages + * @interface IWriteEvents + * @property {string|null} [eventStreamId] WriteEvents eventStreamId + * @property {Long|null} [expectedVersion] WriteEvents expectedVersion + * @property {Array.|null} [events] WriteEvents events + * @property {boolean|null} [requireLeader] WriteEvents requireLeader + */ + + /** + * Constructs a new WriteEvents. + * @memberof EventStore.Client.Messages + * @classdesc Represents a WriteEvents. + * @implements IWriteEvents + * @constructor + * @param {EventStore.Client.Messages.IWriteEvents=} [properties] Properties to set + */ + function WriteEvents(properties) { + this.events = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteEvents eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.WriteEvents + * @instance + */ + WriteEvents.prototype.eventStreamId = ""; + + /** + * WriteEvents expectedVersion. + * @member {Long} expectedVersion + * @memberof EventStore.Client.Messages.WriteEvents + * @instance + */ + WriteEvents.prototype.expectedVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * WriteEvents events. + * @member {Array.} events + * @memberof EventStore.Client.Messages.WriteEvents + * @instance + */ + WriteEvents.prototype.events = $util.emptyArray; + + /** + * WriteEvents requireLeader. + * @member {boolean} requireLeader + * @memberof EventStore.Client.Messages.WriteEvents + * @instance + */ + WriteEvents.prototype.requireLeader = false; + + /** + * Creates a new WriteEvents instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.WriteEvents + * @static + * @param {EventStore.Client.Messages.IWriteEvents=} [properties] Properties to set + * @returns {EventStore.Client.Messages.WriteEvents} WriteEvents instance + */ + WriteEvents.create = function create(properties) { + return new WriteEvents(properties); + }; + + /** + * Encodes the specified WriteEvents message. Does not implicitly {@link EventStore.Client.Messages.WriteEvents.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.WriteEvents + * @static + * @param {EventStore.Client.Messages.IWriteEvents} message WriteEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteEvents.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); + if (message.expectedVersion != null && Object.hasOwnProperty.call(message, "expectedVersion")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.expectedVersion); + if (message.events != null && message.events.length) + for (var i = 0; i < message.events.length; ++i) + $root.EventStore.Client.Messages.NewEvent.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.requireLeader != null && Object.hasOwnProperty.call(message, "requireLeader")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.requireLeader); + return writer; + }; + + /** + * Encodes the specified WriteEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.WriteEvents.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.WriteEvents + * @static + * @param {EventStore.Client.Messages.IWriteEvents} message WriteEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteEvents.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WriteEvents message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.WriteEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.WriteEvents} WriteEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteEvents.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.WriteEvents(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.eventStreamId = reader.string(); + break; + } + case 2: { + message.expectedVersion = reader.int64(); + break; + } + case 3: { + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.EventStore.Client.Messages.NewEvent.decode(reader, reader.uint32())); + break; + } + case 4: { + message.requireLeader = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WriteEvents message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.WriteEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.WriteEvents} WriteEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteEvents.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteEvents message. + * @function verify + * @memberof EventStore.Client.Messages.WriteEvents + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteEvents.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + if (!$util.isString(message.eventStreamId)) + return "eventStreamId: string expected"; + if (message.expectedVersion != null && message.hasOwnProperty("expectedVersion")) + if (!$util.isInteger(message.expectedVersion) && !(message.expectedVersion && $util.isInteger(message.expectedVersion.low) && $util.isInteger(message.expectedVersion.high))) + return "expectedVersion: integer|Long expected"; + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (var i = 0; i < message.events.length; ++i) { + var error = $root.EventStore.Client.Messages.NewEvent.verify(message.events[i]); + if (error) + return "events." + error; + } + } + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + if (typeof message.requireLeader !== "boolean") + return "requireLeader: boolean expected"; + return null; + }; + + /** + * Creates a WriteEvents message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.WriteEvents + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.WriteEvents} WriteEvents + */ + WriteEvents.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.WriteEvents) + return object; + var message = new $root.EventStore.Client.Messages.WriteEvents(); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.expectedVersion != null) + if ($util.Long) + (message.expectedVersion = $util.Long.fromValue(object.expectedVersion)).unsigned = false; + else if (typeof object.expectedVersion === "string") + message.expectedVersion = parseInt(object.expectedVersion, 10); + else if (typeof object.expectedVersion === "number") + message.expectedVersion = object.expectedVersion; + else if (typeof object.expectedVersion === "object") + message.expectedVersion = new $util.LongBits(object.expectedVersion.low >>> 0, object.expectedVersion.high >>> 0).toNumber(); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".EventStore.Client.Messages.WriteEvents.events: array expected"); + message.events = []; + for (var i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".EventStore.Client.Messages.WriteEvents.events: object expected"); + message.events[i] = $root.EventStore.Client.Messages.NewEvent.fromObject(object.events[i]); + } + } + if (object.requireLeader != null) + message.requireLeader = Boolean(object.requireLeader); + return message; + }; + + /** + * Creates a plain object from a WriteEvents message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.WriteEvents + * @static + * @param {EventStore.Client.Messages.WriteEvents} message WriteEvents + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteEvents.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (options.defaults) { + object.eventStreamId = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.expectedVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.expectedVersion = options.longs === String ? "0" : 0; + object.requireLeader = false; + } + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.expectedVersion != null && message.hasOwnProperty("expectedVersion")) + if (typeof message.expectedVersion === "number") + object.expectedVersion = options.longs === String ? String(message.expectedVersion) : message.expectedVersion; + else + object.expectedVersion = options.longs === String ? $util.Long.prototype.toString.call(message.expectedVersion) : options.longs === Number ? new $util.LongBits(message.expectedVersion.low >>> 0, message.expectedVersion.high >>> 0).toNumber() : message.expectedVersion; + if (message.events && message.events.length) { + object.events = []; + for (var j = 0; j < message.events.length; ++j) + object.events[j] = $root.EventStore.Client.Messages.NewEvent.toObject(message.events[j], options); + } + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + object.requireLeader = message.requireLeader; + return object; + }; + + /** + * Converts this WriteEvents to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.WriteEvents + * @instance + * @returns {Object.} JSON object + */ + WriteEvents.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteEvents + * @function getTypeUrl + * @memberof EventStore.Client.Messages.WriteEvents + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.WriteEvents"; + }; + + return WriteEvents; + })(); + + Messages.WriteEventsCompleted = (function() { + + /** + * Properties of a WriteEventsCompleted. + * @memberof EventStore.Client.Messages + * @interface IWriteEventsCompleted + * @property {EventStore.Client.Messages.OperationResult|null} [result] WriteEventsCompleted result + * @property {string|null} [message] WriteEventsCompleted message + * @property {Long|null} [firstEventNumber] WriteEventsCompleted firstEventNumber + * @property {Long|null} [lastEventNumber] WriteEventsCompleted lastEventNumber + * @property {Long|null} [preparePosition] WriteEventsCompleted preparePosition + * @property {Long|null} [commitPosition] WriteEventsCompleted commitPosition + * @property {Long|null} [currentVersion] WriteEventsCompleted currentVersion + */ + + /** + * Constructs a new WriteEventsCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a WriteEventsCompleted. + * @implements IWriteEventsCompleted + * @constructor + * @param {EventStore.Client.Messages.IWriteEventsCompleted=} [properties] Properties to set + */ + function WriteEventsCompleted(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteEventsCompleted result. + * @member {EventStore.Client.Messages.OperationResult} result + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @instance + */ + WriteEventsCompleted.prototype.result = 0; + + /** + * WriteEventsCompleted message. + * @member {string} message + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @instance + */ + WriteEventsCompleted.prototype.message = ""; + + /** + * WriteEventsCompleted firstEventNumber. + * @member {Long} firstEventNumber + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @instance + */ + WriteEventsCompleted.prototype.firstEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * WriteEventsCompleted lastEventNumber. + * @member {Long} lastEventNumber + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @instance + */ + WriteEventsCompleted.prototype.lastEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * WriteEventsCompleted preparePosition. + * @member {Long} preparePosition + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @instance + */ + WriteEventsCompleted.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * WriteEventsCompleted commitPosition. + * @member {Long} commitPosition + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @instance + */ + WriteEventsCompleted.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * WriteEventsCompleted currentVersion. + * @member {Long} currentVersion + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @instance + */ + WriteEventsCompleted.prototype.currentVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new WriteEventsCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @static + * @param {EventStore.Client.Messages.IWriteEventsCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.WriteEventsCompleted} WriteEventsCompleted instance + */ + WriteEventsCompleted.create = function create(properties) { + return new WriteEventsCompleted(properties); + }; + + /** + * Encodes the specified WriteEventsCompleted message. Does not implicitly {@link EventStore.Client.Messages.WriteEventsCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @static + * @param {EventStore.Client.Messages.IWriteEventsCompleted} message WriteEventsCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteEventsCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.firstEventNumber != null && Object.hasOwnProperty.call(message, "firstEventNumber")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.firstEventNumber); + if (message.lastEventNumber != null && Object.hasOwnProperty.call(message, "lastEventNumber")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.lastEventNumber); + if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.preparePosition); + if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.commitPosition); + if (message.currentVersion != null && Object.hasOwnProperty.call(message, "currentVersion")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.currentVersion); + return writer; + }; + + /** + * Encodes the specified WriteEventsCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.WriteEventsCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @static + * @param {EventStore.Client.Messages.IWriteEventsCompleted} message WriteEventsCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteEventsCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WriteEventsCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.WriteEventsCompleted} WriteEventsCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteEventsCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.WriteEventsCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.result = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + message.firstEventNumber = reader.int64(); + break; + } + case 4: { + message.lastEventNumber = reader.int64(); + break; + } + case 5: { + message.preparePosition = reader.int64(); + break; + } + case 6: { + message.commitPosition = reader.int64(); + break; + } + case 7: { + message.currentVersion = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WriteEventsCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.WriteEventsCompleted} WriteEventsCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteEventsCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteEventsCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteEventsCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { + default: + return "result: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.firstEventNumber != null && message.hasOwnProperty("firstEventNumber")) + if (!$util.isInteger(message.firstEventNumber) && !(message.firstEventNumber && $util.isInteger(message.firstEventNumber.low) && $util.isInteger(message.firstEventNumber.high))) + return "firstEventNumber: integer|Long expected"; + if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) + if (!$util.isInteger(message.lastEventNumber) && !(message.lastEventNumber && $util.isInteger(message.lastEventNumber.low) && $util.isInteger(message.lastEventNumber.high))) + return "lastEventNumber: integer|Long expected"; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) + return "preparePosition: integer|Long expected"; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) + return "commitPosition: integer|Long expected"; + if (message.currentVersion != null && message.hasOwnProperty("currentVersion")) + if (!$util.isInteger(message.currentVersion) && !(message.currentVersion && $util.isInteger(message.currentVersion.low) && $util.isInteger(message.currentVersion.high))) + return "currentVersion: integer|Long expected"; + return null; + }; + + /** + * Creates a WriteEventsCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.WriteEventsCompleted} WriteEventsCompleted + */ + WriteEventsCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.WriteEventsCompleted) + return object; + var message = new $root.EventStore.Client.Messages.WriteEventsCompleted(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; + } + break; + case "Success": + case 0: + message.result = 0; + break; + case "PrepareTimeout": + case 1: + message.result = 1; + break; + case "CommitTimeout": + case 2: + message.result = 2; + break; + case "ForwardTimeout": + case 3: + message.result = 3; + break; + case "WrongExpectedVersion": + case 4: + message.result = 4; + break; + case "StreamDeleted": + case 5: + message.result = 5; + break; + case "InvalidTransaction": + case 6: + message.result = 6; + break; + case "AccessDenied": + case 7: + message.result = 7; + break; + } + if (object.message != null) + message.message = String(object.message); + if (object.firstEventNumber != null) + if ($util.Long) + (message.firstEventNumber = $util.Long.fromValue(object.firstEventNumber)).unsigned = false; + else if (typeof object.firstEventNumber === "string") + message.firstEventNumber = parseInt(object.firstEventNumber, 10); + else if (typeof object.firstEventNumber === "number") + message.firstEventNumber = object.firstEventNumber; + else if (typeof object.firstEventNumber === "object") + message.firstEventNumber = new $util.LongBits(object.firstEventNumber.low >>> 0, object.firstEventNumber.high >>> 0).toNumber(); + if (object.lastEventNumber != null) + if ($util.Long) + (message.lastEventNumber = $util.Long.fromValue(object.lastEventNumber)).unsigned = false; + else if (typeof object.lastEventNumber === "string") + message.lastEventNumber = parseInt(object.lastEventNumber, 10); + else if (typeof object.lastEventNumber === "number") + message.lastEventNumber = object.lastEventNumber; + else if (typeof object.lastEventNumber === "object") + message.lastEventNumber = new $util.LongBits(object.lastEventNumber.low >>> 0, object.lastEventNumber.high >>> 0).toNumber(); + if (object.preparePosition != null) + if ($util.Long) + (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; + else if (typeof object.preparePosition === "string") + message.preparePosition = parseInt(object.preparePosition, 10); + else if (typeof object.preparePosition === "number") + message.preparePosition = object.preparePosition; + else if (typeof object.preparePosition === "object") + message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); + if (object.commitPosition != null) + if ($util.Long) + (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; + else if (typeof object.commitPosition === "string") + message.commitPosition = parseInt(object.commitPosition, 10); + else if (typeof object.commitPosition === "number") + message.commitPosition = object.commitPosition; + else if (typeof object.commitPosition === "object") + message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); + if (object.currentVersion != null) + if ($util.Long) + (message.currentVersion = $util.Long.fromValue(object.currentVersion)).unsigned = false; + else if (typeof object.currentVersion === "string") + message.currentVersion = parseInt(object.currentVersion, 10); + else if (typeof object.currentVersion === "number") + message.currentVersion = object.currentVersion; + else if (typeof object.currentVersion === "object") + message.currentVersion = new $util.LongBits(object.currentVersion.low >>> 0, object.currentVersion.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a WriteEventsCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @static + * @param {EventStore.Client.Messages.WriteEventsCompleted} message WriteEventsCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteEventsCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.result = options.enums === String ? "Success" : 0; + object.message = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.firstEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.firstEventNumber = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastEventNumber = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.preparePosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.commitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.currentVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.currentVersion = options.longs === String ? "0" : 0; + } + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.OperationResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.OperationResult[message.result] : message.result; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.firstEventNumber != null && message.hasOwnProperty("firstEventNumber")) + if (typeof message.firstEventNumber === "number") + object.firstEventNumber = options.longs === String ? String(message.firstEventNumber) : message.firstEventNumber; + else + object.firstEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.firstEventNumber) : options.longs === Number ? new $util.LongBits(message.firstEventNumber.low >>> 0, message.firstEventNumber.high >>> 0).toNumber() : message.firstEventNumber; + if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) + if (typeof message.lastEventNumber === "number") + object.lastEventNumber = options.longs === String ? String(message.lastEventNumber) : message.lastEventNumber; + else + object.lastEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.lastEventNumber) : options.longs === Number ? new $util.LongBits(message.lastEventNumber.low >>> 0, message.lastEventNumber.high >>> 0).toNumber() : message.lastEventNumber; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (typeof message.preparePosition === "number") + object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; + else + object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (typeof message.commitPosition === "number") + object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; + else + object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; + if (message.currentVersion != null && message.hasOwnProperty("currentVersion")) + if (typeof message.currentVersion === "number") + object.currentVersion = options.longs === String ? String(message.currentVersion) : message.currentVersion; + else + object.currentVersion = options.longs === String ? $util.Long.prototype.toString.call(message.currentVersion) : options.longs === Number ? new $util.LongBits(message.currentVersion.low >>> 0, message.currentVersion.high >>> 0).toNumber() : message.currentVersion; + return object; + }; + + /** + * Converts this WriteEventsCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @instance + * @returns {Object.} JSON object + */ + WriteEventsCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteEventsCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.WriteEventsCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteEventsCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.WriteEventsCompleted"; + }; + + return WriteEventsCompleted; + })(); + + Messages.DeleteStream = (function() { + + /** + * Properties of a DeleteStream. + * @memberof EventStore.Client.Messages + * @interface IDeleteStream + * @property {string|null} [eventStreamId] DeleteStream eventStreamId + * @property {Long|null} [expectedVersion] DeleteStream expectedVersion + * @property {boolean|null} [requireLeader] DeleteStream requireLeader + * @property {boolean|null} [hardDelete] DeleteStream hardDelete + */ + + /** + * Constructs a new DeleteStream. + * @memberof EventStore.Client.Messages + * @classdesc Represents a DeleteStream. + * @implements IDeleteStream + * @constructor + * @param {EventStore.Client.Messages.IDeleteStream=} [properties] Properties to set + */ + function DeleteStream(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteStream eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.DeleteStream + * @instance + */ + DeleteStream.prototype.eventStreamId = ""; + + /** + * DeleteStream expectedVersion. + * @member {Long} expectedVersion + * @memberof EventStore.Client.Messages.DeleteStream + * @instance + */ + DeleteStream.prototype.expectedVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * DeleteStream requireLeader. + * @member {boolean} requireLeader + * @memberof EventStore.Client.Messages.DeleteStream + * @instance + */ + DeleteStream.prototype.requireLeader = false; + + /** + * DeleteStream hardDelete. + * @member {boolean} hardDelete + * @memberof EventStore.Client.Messages.DeleteStream + * @instance + */ + DeleteStream.prototype.hardDelete = false; + + /** + * Creates a new DeleteStream instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.DeleteStream + * @static + * @param {EventStore.Client.Messages.IDeleteStream=} [properties] Properties to set + * @returns {EventStore.Client.Messages.DeleteStream} DeleteStream instance + */ + DeleteStream.create = function create(properties) { + return new DeleteStream(properties); + }; + + /** + * Encodes the specified DeleteStream message. Does not implicitly {@link EventStore.Client.Messages.DeleteStream.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.DeleteStream + * @static + * @param {EventStore.Client.Messages.IDeleteStream} message DeleteStream message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteStream.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); + if (message.expectedVersion != null && Object.hasOwnProperty.call(message, "expectedVersion")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.expectedVersion); + if (message.requireLeader != null && Object.hasOwnProperty.call(message, "requireLeader")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.requireLeader); + if (message.hardDelete != null && Object.hasOwnProperty.call(message, "hardDelete")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.hardDelete); + return writer; + }; + + /** + * Encodes the specified DeleteStream message, length delimited. Does not implicitly {@link EventStore.Client.Messages.DeleteStream.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.DeleteStream + * @static + * @param {EventStore.Client.Messages.IDeleteStream} message DeleteStream message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteStream.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteStream message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.DeleteStream + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.DeleteStream} DeleteStream + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteStream.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.DeleteStream(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.eventStreamId = reader.string(); + break; + } + case 2: { + message.expectedVersion = reader.int64(); + break; + } + case 3: { + message.requireLeader = reader.bool(); + break; + } + case 4: { + message.hardDelete = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteStream message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.DeleteStream + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.DeleteStream} DeleteStream + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteStream.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteStream message. + * @function verify + * @memberof EventStore.Client.Messages.DeleteStream + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteStream.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + if (!$util.isString(message.eventStreamId)) + return "eventStreamId: string expected"; + if (message.expectedVersion != null && message.hasOwnProperty("expectedVersion")) + if (!$util.isInteger(message.expectedVersion) && !(message.expectedVersion && $util.isInteger(message.expectedVersion.low) && $util.isInteger(message.expectedVersion.high))) + return "expectedVersion: integer|Long expected"; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + if (typeof message.requireLeader !== "boolean") + return "requireLeader: boolean expected"; + if (message.hardDelete != null && message.hasOwnProperty("hardDelete")) + if (typeof message.hardDelete !== "boolean") + return "hardDelete: boolean expected"; + return null; + }; + + /** + * Creates a DeleteStream message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.DeleteStream + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.DeleteStream} DeleteStream + */ + DeleteStream.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.DeleteStream) + return object; + var message = new $root.EventStore.Client.Messages.DeleteStream(); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.expectedVersion != null) + if ($util.Long) + (message.expectedVersion = $util.Long.fromValue(object.expectedVersion)).unsigned = false; + else if (typeof object.expectedVersion === "string") + message.expectedVersion = parseInt(object.expectedVersion, 10); + else if (typeof object.expectedVersion === "number") + message.expectedVersion = object.expectedVersion; + else if (typeof object.expectedVersion === "object") + message.expectedVersion = new $util.LongBits(object.expectedVersion.low >>> 0, object.expectedVersion.high >>> 0).toNumber(); + if (object.requireLeader != null) + message.requireLeader = Boolean(object.requireLeader); + if (object.hardDelete != null) + message.hardDelete = Boolean(object.hardDelete); + return message; + }; + + /** + * Creates a plain object from a DeleteStream message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.DeleteStream + * @static + * @param {EventStore.Client.Messages.DeleteStream} message DeleteStream + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteStream.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.eventStreamId = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.expectedVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.expectedVersion = options.longs === String ? "0" : 0; + object.requireLeader = false; + object.hardDelete = false; + } + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.expectedVersion != null && message.hasOwnProperty("expectedVersion")) + if (typeof message.expectedVersion === "number") + object.expectedVersion = options.longs === String ? String(message.expectedVersion) : message.expectedVersion; + else + object.expectedVersion = options.longs === String ? $util.Long.prototype.toString.call(message.expectedVersion) : options.longs === Number ? new $util.LongBits(message.expectedVersion.low >>> 0, message.expectedVersion.high >>> 0).toNumber() : message.expectedVersion; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + object.requireLeader = message.requireLeader; + if (message.hardDelete != null && message.hasOwnProperty("hardDelete")) + object.hardDelete = message.hardDelete; + return object; + }; + + /** + * Converts this DeleteStream to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.DeleteStream + * @instance + * @returns {Object.} JSON object + */ + DeleteStream.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteStream + * @function getTypeUrl + * @memberof EventStore.Client.Messages.DeleteStream + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteStream.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.DeleteStream"; + }; + + return DeleteStream; + })(); + + Messages.DeleteStreamCompleted = (function() { + + /** + * Properties of a DeleteStreamCompleted. + * @memberof EventStore.Client.Messages + * @interface IDeleteStreamCompleted + * @property {EventStore.Client.Messages.OperationResult|null} [result] DeleteStreamCompleted result + * @property {string|null} [message] DeleteStreamCompleted message + * @property {Long|null} [preparePosition] DeleteStreamCompleted preparePosition + * @property {Long|null} [commitPosition] DeleteStreamCompleted commitPosition + * @property {Long|null} [currentVersion] DeleteStreamCompleted currentVersion + */ + + /** + * Constructs a new DeleteStreamCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a DeleteStreamCompleted. + * @implements IDeleteStreamCompleted + * @constructor + * @param {EventStore.Client.Messages.IDeleteStreamCompleted=} [properties] Properties to set + */ + function DeleteStreamCompleted(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteStreamCompleted result. + * @member {EventStore.Client.Messages.OperationResult} result + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @instance + */ + DeleteStreamCompleted.prototype.result = 0; + + /** + * DeleteStreamCompleted message. + * @member {string} message + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @instance + */ + DeleteStreamCompleted.prototype.message = ""; + + /** + * DeleteStreamCompleted preparePosition. + * @member {Long} preparePosition + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @instance + */ + DeleteStreamCompleted.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * DeleteStreamCompleted commitPosition. + * @member {Long} commitPosition + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @instance + */ + DeleteStreamCompleted.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * DeleteStreamCompleted currentVersion. + * @member {Long} currentVersion + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @instance + */ + DeleteStreamCompleted.prototype.currentVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new DeleteStreamCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @static + * @param {EventStore.Client.Messages.IDeleteStreamCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.DeleteStreamCompleted} DeleteStreamCompleted instance + */ + DeleteStreamCompleted.create = function create(properties) { + return new DeleteStreamCompleted(properties); + }; + + /** + * Encodes the specified DeleteStreamCompleted message. Does not implicitly {@link EventStore.Client.Messages.DeleteStreamCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @static + * @param {EventStore.Client.Messages.IDeleteStreamCompleted} message DeleteStreamCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteStreamCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.preparePosition); + if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.commitPosition); + if (message.currentVersion != null && Object.hasOwnProperty.call(message, "currentVersion")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.currentVersion); + return writer; + }; + + /** + * Encodes the specified DeleteStreamCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.DeleteStreamCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @static + * @param {EventStore.Client.Messages.IDeleteStreamCompleted} message DeleteStreamCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteStreamCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteStreamCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.DeleteStreamCompleted} DeleteStreamCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteStreamCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.DeleteStreamCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.result = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + message.preparePosition = reader.int64(); + break; + } + case 4: { + message.commitPosition = reader.int64(); + break; + } + case 5: { + message.currentVersion = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteStreamCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.DeleteStreamCompleted} DeleteStreamCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteStreamCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteStreamCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteStreamCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { + default: + return "result: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) + return "preparePosition: integer|Long expected"; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) + return "commitPosition: integer|Long expected"; + if (message.currentVersion != null && message.hasOwnProperty("currentVersion")) + if (!$util.isInteger(message.currentVersion) && !(message.currentVersion && $util.isInteger(message.currentVersion.low) && $util.isInteger(message.currentVersion.high))) + return "currentVersion: integer|Long expected"; + return null; + }; + + /** + * Creates a DeleteStreamCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.DeleteStreamCompleted} DeleteStreamCompleted + */ + DeleteStreamCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.DeleteStreamCompleted) + return object; + var message = new $root.EventStore.Client.Messages.DeleteStreamCompleted(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; + } + break; + case "Success": + case 0: + message.result = 0; + break; + case "PrepareTimeout": + case 1: + message.result = 1; + break; + case "CommitTimeout": + case 2: + message.result = 2; + break; + case "ForwardTimeout": + case 3: + message.result = 3; + break; + case "WrongExpectedVersion": + case 4: + message.result = 4; + break; + case "StreamDeleted": + case 5: + message.result = 5; + break; + case "InvalidTransaction": + case 6: + message.result = 6; + break; + case "AccessDenied": + case 7: + message.result = 7; + break; + } + if (object.message != null) + message.message = String(object.message); + if (object.preparePosition != null) + if ($util.Long) + (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; + else if (typeof object.preparePosition === "string") + message.preparePosition = parseInt(object.preparePosition, 10); + else if (typeof object.preparePosition === "number") + message.preparePosition = object.preparePosition; + else if (typeof object.preparePosition === "object") + message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); + if (object.commitPosition != null) + if ($util.Long) + (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; + else if (typeof object.commitPosition === "string") + message.commitPosition = parseInt(object.commitPosition, 10); + else if (typeof object.commitPosition === "number") + message.commitPosition = object.commitPosition; + else if (typeof object.commitPosition === "object") + message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); + if (object.currentVersion != null) + if ($util.Long) + (message.currentVersion = $util.Long.fromValue(object.currentVersion)).unsigned = false; + else if (typeof object.currentVersion === "string") + message.currentVersion = parseInt(object.currentVersion, 10); + else if (typeof object.currentVersion === "number") + message.currentVersion = object.currentVersion; + else if (typeof object.currentVersion === "object") + message.currentVersion = new $util.LongBits(object.currentVersion.low >>> 0, object.currentVersion.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a DeleteStreamCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @static + * @param {EventStore.Client.Messages.DeleteStreamCompleted} message DeleteStreamCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteStreamCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.result = options.enums === String ? "Success" : 0; + object.message = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.preparePosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.commitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.currentVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.currentVersion = options.longs === String ? "0" : 0; + } + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.OperationResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.OperationResult[message.result] : message.result; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (typeof message.preparePosition === "number") + object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; + else + object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (typeof message.commitPosition === "number") + object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; + else + object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; + if (message.currentVersion != null && message.hasOwnProperty("currentVersion")) + if (typeof message.currentVersion === "number") + object.currentVersion = options.longs === String ? String(message.currentVersion) : message.currentVersion; + else + object.currentVersion = options.longs === String ? $util.Long.prototype.toString.call(message.currentVersion) : options.longs === Number ? new $util.LongBits(message.currentVersion.low >>> 0, message.currentVersion.high >>> 0).toNumber() : message.currentVersion; + return object; + }; + + /** + * Converts this DeleteStreamCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @instance + * @returns {Object.} JSON object + */ + DeleteStreamCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteStreamCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.DeleteStreamCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteStreamCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.DeleteStreamCompleted"; + }; + + return DeleteStreamCompleted; + })(); + + Messages.TransactionStart = (function() { + + /** + * Properties of a TransactionStart. + * @memberof EventStore.Client.Messages + * @interface ITransactionStart + * @property {string|null} [eventStreamId] TransactionStart eventStreamId + * @property {Long|null} [expectedVersion] TransactionStart expectedVersion + * @property {boolean|null} [requireLeader] TransactionStart requireLeader + */ + + /** + * Constructs a new TransactionStart. + * @memberof EventStore.Client.Messages + * @classdesc Represents a TransactionStart. + * @implements ITransactionStart + * @constructor + * @param {EventStore.Client.Messages.ITransactionStart=} [properties] Properties to set + */ + function TransactionStart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TransactionStart eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.TransactionStart + * @instance + */ + TransactionStart.prototype.eventStreamId = ""; + + /** + * TransactionStart expectedVersion. + * @member {Long} expectedVersion + * @memberof EventStore.Client.Messages.TransactionStart + * @instance + */ + TransactionStart.prototype.expectedVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TransactionStart requireLeader. + * @member {boolean} requireLeader + * @memberof EventStore.Client.Messages.TransactionStart + * @instance + */ + TransactionStart.prototype.requireLeader = false; + + /** + * Creates a new TransactionStart instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.TransactionStart + * @static + * @param {EventStore.Client.Messages.ITransactionStart=} [properties] Properties to set + * @returns {EventStore.Client.Messages.TransactionStart} TransactionStart instance + */ + TransactionStart.create = function create(properties) { + return new TransactionStart(properties); + }; + + /** + * Encodes the specified TransactionStart message. Does not implicitly {@link EventStore.Client.Messages.TransactionStart.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.TransactionStart + * @static + * @param {EventStore.Client.Messages.ITransactionStart} message TransactionStart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionStart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); + if (message.expectedVersion != null && Object.hasOwnProperty.call(message, "expectedVersion")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.expectedVersion); + if (message.requireLeader != null && Object.hasOwnProperty.call(message, "requireLeader")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.requireLeader); + return writer; + }; + + /** + * Encodes the specified TransactionStart message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionStart.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.TransactionStart + * @static + * @param {EventStore.Client.Messages.ITransactionStart} message TransactionStart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionStart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TransactionStart message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.TransactionStart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.TransactionStart} TransactionStart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionStart.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionStart(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.eventStreamId = reader.string(); + break; + } + case 2: { + message.expectedVersion = reader.int64(); + break; + } + case 3: { + message.requireLeader = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TransactionStart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.TransactionStart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.TransactionStart} TransactionStart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionStart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TransactionStart message. + * @function verify + * @memberof EventStore.Client.Messages.TransactionStart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TransactionStart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + if (!$util.isString(message.eventStreamId)) + return "eventStreamId: string expected"; + if (message.expectedVersion != null && message.hasOwnProperty("expectedVersion")) + if (!$util.isInteger(message.expectedVersion) && !(message.expectedVersion && $util.isInteger(message.expectedVersion.low) && $util.isInteger(message.expectedVersion.high))) + return "expectedVersion: integer|Long expected"; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + if (typeof message.requireLeader !== "boolean") + return "requireLeader: boolean expected"; + return null; + }; + + /** + * Creates a TransactionStart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.TransactionStart + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.TransactionStart} TransactionStart + */ + TransactionStart.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.TransactionStart) + return object; + var message = new $root.EventStore.Client.Messages.TransactionStart(); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.expectedVersion != null) + if ($util.Long) + (message.expectedVersion = $util.Long.fromValue(object.expectedVersion)).unsigned = false; + else if (typeof object.expectedVersion === "string") + message.expectedVersion = parseInt(object.expectedVersion, 10); + else if (typeof object.expectedVersion === "number") + message.expectedVersion = object.expectedVersion; + else if (typeof object.expectedVersion === "object") + message.expectedVersion = new $util.LongBits(object.expectedVersion.low >>> 0, object.expectedVersion.high >>> 0).toNumber(); + if (object.requireLeader != null) + message.requireLeader = Boolean(object.requireLeader); + return message; + }; + + /** + * Creates a plain object from a TransactionStart message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.TransactionStart + * @static + * @param {EventStore.Client.Messages.TransactionStart} message TransactionStart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TransactionStart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.eventStreamId = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.expectedVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.expectedVersion = options.longs === String ? "0" : 0; + object.requireLeader = false; + } + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.expectedVersion != null && message.hasOwnProperty("expectedVersion")) + if (typeof message.expectedVersion === "number") + object.expectedVersion = options.longs === String ? String(message.expectedVersion) : message.expectedVersion; + else + object.expectedVersion = options.longs === String ? $util.Long.prototype.toString.call(message.expectedVersion) : options.longs === Number ? new $util.LongBits(message.expectedVersion.low >>> 0, message.expectedVersion.high >>> 0).toNumber() : message.expectedVersion; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + object.requireLeader = message.requireLeader; + return object; + }; + + /** + * Converts this TransactionStart to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.TransactionStart + * @instance + * @returns {Object.} JSON object + */ + TransactionStart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TransactionStart + * @function getTypeUrl + * @memberof EventStore.Client.Messages.TransactionStart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TransactionStart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.TransactionStart"; + }; + + return TransactionStart; + })(); + + Messages.TransactionStartCompleted = (function() { + + /** + * Properties of a TransactionStartCompleted. + * @memberof EventStore.Client.Messages + * @interface ITransactionStartCompleted + * @property {Long|null} [transactionId] TransactionStartCompleted transactionId + * @property {EventStore.Client.Messages.OperationResult|null} [result] TransactionStartCompleted result + * @property {string|null} [message] TransactionStartCompleted message + */ + + /** + * Constructs a new TransactionStartCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a TransactionStartCompleted. + * @implements ITransactionStartCompleted + * @constructor + * @param {EventStore.Client.Messages.ITransactionStartCompleted=} [properties] Properties to set + */ + function TransactionStartCompleted(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TransactionStartCompleted transactionId. + * @member {Long} transactionId + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @instance + */ + TransactionStartCompleted.prototype.transactionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TransactionStartCompleted result. + * @member {EventStore.Client.Messages.OperationResult} result + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @instance + */ + TransactionStartCompleted.prototype.result = 0; + + /** + * TransactionStartCompleted message. + * @member {string} message + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @instance + */ + TransactionStartCompleted.prototype.message = ""; + + /** + * Creates a new TransactionStartCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @static + * @param {EventStore.Client.Messages.ITransactionStartCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.TransactionStartCompleted} TransactionStartCompleted instance + */ + TransactionStartCompleted.create = function create(properties) { + return new TransactionStartCompleted(properties); + }; + + /** + * Encodes the specified TransactionStartCompleted message. Does not implicitly {@link EventStore.Client.Messages.TransactionStartCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @static + * @param {EventStore.Client.Messages.ITransactionStartCompleted} message TransactionStartCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionStartCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.transactionId != null && Object.hasOwnProperty.call(message, "transactionId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.transactionId); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + return writer; + }; + + /** + * Encodes the specified TransactionStartCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionStartCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @static + * @param {EventStore.Client.Messages.ITransactionStartCompleted} message TransactionStartCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionStartCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TransactionStartCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.TransactionStartCompleted} TransactionStartCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionStartCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionStartCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.transactionId = reader.int64(); + break; + } + case 2: { + message.result = reader.int32(); + break; + } + case 3: { + message.message = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TransactionStartCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.TransactionStartCompleted} TransactionStartCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionStartCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TransactionStartCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TransactionStartCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.transactionId != null && message.hasOwnProperty("transactionId")) + if (!$util.isInteger(message.transactionId) && !(message.transactionId && $util.isInteger(message.transactionId.low) && $util.isInteger(message.transactionId.high))) + return "transactionId: integer|Long expected"; + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { + default: + return "result: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a TransactionStartCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.TransactionStartCompleted} TransactionStartCompleted + */ + TransactionStartCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.TransactionStartCompleted) + return object; + var message = new $root.EventStore.Client.Messages.TransactionStartCompleted(); + if (object.transactionId != null) + if ($util.Long) + (message.transactionId = $util.Long.fromValue(object.transactionId)).unsigned = false; + else if (typeof object.transactionId === "string") + message.transactionId = parseInt(object.transactionId, 10); + else if (typeof object.transactionId === "number") + message.transactionId = object.transactionId; + else if (typeof object.transactionId === "object") + message.transactionId = new $util.LongBits(object.transactionId.low >>> 0, object.transactionId.high >>> 0).toNumber(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; + } + break; + case "Success": + case 0: + message.result = 0; + break; + case "PrepareTimeout": + case 1: + message.result = 1; + break; + case "CommitTimeout": + case 2: + message.result = 2; + break; + case "ForwardTimeout": + case 3: + message.result = 3; + break; + case "WrongExpectedVersion": + case 4: + message.result = 4; + break; + case "StreamDeleted": + case 5: + message.result = 5; + break; + case "InvalidTransaction": + case 6: + message.result = 6; + break; + case "AccessDenied": + case 7: + message.result = 7; + break; + } + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a TransactionStartCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @static + * @param {EventStore.Client.Messages.TransactionStartCompleted} message TransactionStartCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TransactionStartCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.transactionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.transactionId = options.longs === String ? "0" : 0; + object.result = options.enums === String ? "Success" : 0; + object.message = ""; + } + if (message.transactionId != null && message.hasOwnProperty("transactionId")) + if (typeof message.transactionId === "number") + object.transactionId = options.longs === String ? String(message.transactionId) : message.transactionId; + else + object.transactionId = options.longs === String ? $util.Long.prototype.toString.call(message.transactionId) : options.longs === Number ? new $util.LongBits(message.transactionId.low >>> 0, message.transactionId.high >>> 0).toNumber() : message.transactionId; + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.OperationResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.OperationResult[message.result] : message.result; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this TransactionStartCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @instance + * @returns {Object.} JSON object + */ + TransactionStartCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TransactionStartCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.TransactionStartCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TransactionStartCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.TransactionStartCompleted"; + }; + + return TransactionStartCompleted; + })(); + + Messages.TransactionWrite = (function() { + + /** + * Properties of a TransactionWrite. + * @memberof EventStore.Client.Messages + * @interface ITransactionWrite + * @property {Long|null} [transactionId] TransactionWrite transactionId + * @property {Array.|null} [events] TransactionWrite events + * @property {boolean|null} [requireLeader] TransactionWrite requireLeader + */ + + /** + * Constructs a new TransactionWrite. + * @memberof EventStore.Client.Messages + * @classdesc Represents a TransactionWrite. + * @implements ITransactionWrite + * @constructor + * @param {EventStore.Client.Messages.ITransactionWrite=} [properties] Properties to set + */ + function TransactionWrite(properties) { + this.events = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TransactionWrite transactionId. + * @member {Long} transactionId + * @memberof EventStore.Client.Messages.TransactionWrite + * @instance + */ + TransactionWrite.prototype.transactionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TransactionWrite events. + * @member {Array.} events + * @memberof EventStore.Client.Messages.TransactionWrite + * @instance + */ + TransactionWrite.prototype.events = $util.emptyArray; + + /** + * TransactionWrite requireLeader. + * @member {boolean} requireLeader + * @memberof EventStore.Client.Messages.TransactionWrite + * @instance + */ + TransactionWrite.prototype.requireLeader = false; + + /** + * Creates a new TransactionWrite instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.TransactionWrite + * @static + * @param {EventStore.Client.Messages.ITransactionWrite=} [properties] Properties to set + * @returns {EventStore.Client.Messages.TransactionWrite} TransactionWrite instance + */ + TransactionWrite.create = function create(properties) { + return new TransactionWrite(properties); + }; + + /** + * Encodes the specified TransactionWrite message. Does not implicitly {@link EventStore.Client.Messages.TransactionWrite.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.TransactionWrite + * @static + * @param {EventStore.Client.Messages.ITransactionWrite} message TransactionWrite message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionWrite.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.transactionId != null && Object.hasOwnProperty.call(message, "transactionId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.transactionId); + if (message.events != null && message.events.length) + for (var i = 0; i < message.events.length; ++i) + $root.EventStore.Client.Messages.NewEvent.encode(message.events[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.requireLeader != null && Object.hasOwnProperty.call(message, "requireLeader")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.requireLeader); + return writer; + }; + + /** + * Encodes the specified TransactionWrite message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionWrite.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.TransactionWrite + * @static + * @param {EventStore.Client.Messages.ITransactionWrite} message TransactionWrite message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionWrite.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TransactionWrite message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.TransactionWrite + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.TransactionWrite} TransactionWrite + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionWrite.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionWrite(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.transactionId = reader.int64(); + break; + } + case 2: { + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.EventStore.Client.Messages.NewEvent.decode(reader, reader.uint32())); + break; + } + case 3: { + message.requireLeader = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TransactionWrite message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.TransactionWrite + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.TransactionWrite} TransactionWrite + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionWrite.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TransactionWrite message. + * @function verify + * @memberof EventStore.Client.Messages.TransactionWrite + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TransactionWrite.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.transactionId != null && message.hasOwnProperty("transactionId")) + if (!$util.isInteger(message.transactionId) && !(message.transactionId && $util.isInteger(message.transactionId.low) && $util.isInteger(message.transactionId.high))) + return "transactionId: integer|Long expected"; + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (var i = 0; i < message.events.length; ++i) { + var error = $root.EventStore.Client.Messages.NewEvent.verify(message.events[i]); + if (error) + return "events." + error; + } + } + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + if (typeof message.requireLeader !== "boolean") + return "requireLeader: boolean expected"; + return null; + }; + + /** + * Creates a TransactionWrite message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.TransactionWrite + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.TransactionWrite} TransactionWrite + */ + TransactionWrite.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.TransactionWrite) + return object; + var message = new $root.EventStore.Client.Messages.TransactionWrite(); + if (object.transactionId != null) + if ($util.Long) + (message.transactionId = $util.Long.fromValue(object.transactionId)).unsigned = false; + else if (typeof object.transactionId === "string") + message.transactionId = parseInt(object.transactionId, 10); + else if (typeof object.transactionId === "number") + message.transactionId = object.transactionId; + else if (typeof object.transactionId === "object") + message.transactionId = new $util.LongBits(object.transactionId.low >>> 0, object.transactionId.high >>> 0).toNumber(); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".EventStore.Client.Messages.TransactionWrite.events: array expected"); + message.events = []; + for (var i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".EventStore.Client.Messages.TransactionWrite.events: object expected"); + message.events[i] = $root.EventStore.Client.Messages.NewEvent.fromObject(object.events[i]); + } + } + if (object.requireLeader != null) + message.requireLeader = Boolean(object.requireLeader); + return message; + }; + + /** + * Creates a plain object from a TransactionWrite message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.TransactionWrite + * @static + * @param {EventStore.Client.Messages.TransactionWrite} message TransactionWrite + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TransactionWrite.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.transactionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.transactionId = options.longs === String ? "0" : 0; + object.requireLeader = false; + } + if (message.transactionId != null && message.hasOwnProperty("transactionId")) + if (typeof message.transactionId === "number") + object.transactionId = options.longs === String ? String(message.transactionId) : message.transactionId; + else + object.transactionId = options.longs === String ? $util.Long.prototype.toString.call(message.transactionId) : options.longs === Number ? new $util.LongBits(message.transactionId.low >>> 0, message.transactionId.high >>> 0).toNumber() : message.transactionId; + if (message.events && message.events.length) { + object.events = []; + for (var j = 0; j < message.events.length; ++j) + object.events[j] = $root.EventStore.Client.Messages.NewEvent.toObject(message.events[j], options); + } + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + object.requireLeader = message.requireLeader; + return object; + }; + + /** + * Converts this TransactionWrite to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.TransactionWrite + * @instance + * @returns {Object.} JSON object + */ + TransactionWrite.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TransactionWrite + * @function getTypeUrl + * @memberof EventStore.Client.Messages.TransactionWrite + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TransactionWrite.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.TransactionWrite"; + }; + + return TransactionWrite; + })(); + + Messages.TransactionWriteCompleted = (function() { + + /** + * Properties of a TransactionWriteCompleted. + * @memberof EventStore.Client.Messages + * @interface ITransactionWriteCompleted + * @property {Long|null} [transactionId] TransactionWriteCompleted transactionId + * @property {EventStore.Client.Messages.OperationResult|null} [result] TransactionWriteCompleted result + * @property {string|null} [message] TransactionWriteCompleted message + */ + + /** + * Constructs a new TransactionWriteCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a TransactionWriteCompleted. + * @implements ITransactionWriteCompleted + * @constructor + * @param {EventStore.Client.Messages.ITransactionWriteCompleted=} [properties] Properties to set + */ + function TransactionWriteCompleted(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TransactionWriteCompleted transactionId. + * @member {Long} transactionId + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @instance + */ + TransactionWriteCompleted.prototype.transactionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TransactionWriteCompleted result. + * @member {EventStore.Client.Messages.OperationResult} result + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @instance + */ + TransactionWriteCompleted.prototype.result = 0; + + /** + * TransactionWriteCompleted message. + * @member {string} message + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @instance + */ + TransactionWriteCompleted.prototype.message = ""; + + /** + * Creates a new TransactionWriteCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @static + * @param {EventStore.Client.Messages.ITransactionWriteCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.TransactionWriteCompleted} TransactionWriteCompleted instance + */ + TransactionWriteCompleted.create = function create(properties) { + return new TransactionWriteCompleted(properties); + }; + + /** + * Encodes the specified TransactionWriteCompleted message. Does not implicitly {@link EventStore.Client.Messages.TransactionWriteCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @static + * @param {EventStore.Client.Messages.ITransactionWriteCompleted} message TransactionWriteCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionWriteCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.transactionId != null && Object.hasOwnProperty.call(message, "transactionId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.transactionId); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + return writer; + }; + + /** + * Encodes the specified TransactionWriteCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionWriteCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @static + * @param {EventStore.Client.Messages.ITransactionWriteCompleted} message TransactionWriteCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionWriteCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TransactionWriteCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.TransactionWriteCompleted} TransactionWriteCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionWriteCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionWriteCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.transactionId = reader.int64(); + break; + } + case 2: { + message.result = reader.int32(); + break; + } + case 3: { + message.message = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TransactionWriteCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.TransactionWriteCompleted} TransactionWriteCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionWriteCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TransactionWriteCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TransactionWriteCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.transactionId != null && message.hasOwnProperty("transactionId")) + if (!$util.isInteger(message.transactionId) && !(message.transactionId && $util.isInteger(message.transactionId.low) && $util.isInteger(message.transactionId.high))) + return "transactionId: integer|Long expected"; + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { + default: + return "result: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a TransactionWriteCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.TransactionWriteCompleted} TransactionWriteCompleted + */ + TransactionWriteCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.TransactionWriteCompleted) + return object; + var message = new $root.EventStore.Client.Messages.TransactionWriteCompleted(); + if (object.transactionId != null) + if ($util.Long) + (message.transactionId = $util.Long.fromValue(object.transactionId)).unsigned = false; + else if (typeof object.transactionId === "string") + message.transactionId = parseInt(object.transactionId, 10); + else if (typeof object.transactionId === "number") + message.transactionId = object.transactionId; + else if (typeof object.transactionId === "object") + message.transactionId = new $util.LongBits(object.transactionId.low >>> 0, object.transactionId.high >>> 0).toNumber(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; + } + break; + case "Success": + case 0: + message.result = 0; + break; + case "PrepareTimeout": + case 1: + message.result = 1; + break; + case "CommitTimeout": + case 2: + message.result = 2; + break; + case "ForwardTimeout": + case 3: + message.result = 3; + break; + case "WrongExpectedVersion": + case 4: + message.result = 4; + break; + case "StreamDeleted": + case 5: + message.result = 5; + break; + case "InvalidTransaction": + case 6: + message.result = 6; + break; + case "AccessDenied": + case 7: + message.result = 7; + break; + } + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a TransactionWriteCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @static + * @param {EventStore.Client.Messages.TransactionWriteCompleted} message TransactionWriteCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TransactionWriteCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.transactionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.transactionId = options.longs === String ? "0" : 0; + object.result = options.enums === String ? "Success" : 0; + object.message = ""; + } + if (message.transactionId != null && message.hasOwnProperty("transactionId")) + if (typeof message.transactionId === "number") + object.transactionId = options.longs === String ? String(message.transactionId) : message.transactionId; + else + object.transactionId = options.longs === String ? $util.Long.prototype.toString.call(message.transactionId) : options.longs === Number ? new $util.LongBits(message.transactionId.low >>> 0, message.transactionId.high >>> 0).toNumber() : message.transactionId; + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.OperationResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.OperationResult[message.result] : message.result; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this TransactionWriteCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @instance + * @returns {Object.} JSON object + */ + TransactionWriteCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TransactionWriteCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.TransactionWriteCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TransactionWriteCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.TransactionWriteCompleted"; + }; + + return TransactionWriteCompleted; + })(); + + Messages.TransactionCommit = (function() { + + /** + * Properties of a TransactionCommit. + * @memberof EventStore.Client.Messages + * @interface ITransactionCommit + * @property {Long|null} [transactionId] TransactionCommit transactionId + * @property {boolean|null} [requireLeader] TransactionCommit requireLeader + */ + + /** + * Constructs a new TransactionCommit. + * @memberof EventStore.Client.Messages + * @classdesc Represents a TransactionCommit. + * @implements ITransactionCommit + * @constructor + * @param {EventStore.Client.Messages.ITransactionCommit=} [properties] Properties to set + */ + function TransactionCommit(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TransactionCommit transactionId. + * @member {Long} transactionId + * @memberof EventStore.Client.Messages.TransactionCommit + * @instance + */ + TransactionCommit.prototype.transactionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TransactionCommit requireLeader. + * @member {boolean} requireLeader + * @memberof EventStore.Client.Messages.TransactionCommit + * @instance + */ + TransactionCommit.prototype.requireLeader = false; + + /** + * Creates a new TransactionCommit instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.TransactionCommit + * @static + * @param {EventStore.Client.Messages.ITransactionCommit=} [properties] Properties to set + * @returns {EventStore.Client.Messages.TransactionCommit} TransactionCommit instance + */ + TransactionCommit.create = function create(properties) { + return new TransactionCommit(properties); + }; + + /** + * Encodes the specified TransactionCommit message. Does not implicitly {@link EventStore.Client.Messages.TransactionCommit.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.TransactionCommit + * @static + * @param {EventStore.Client.Messages.ITransactionCommit} message TransactionCommit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionCommit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.transactionId != null && Object.hasOwnProperty.call(message, "transactionId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.transactionId); + if (message.requireLeader != null && Object.hasOwnProperty.call(message, "requireLeader")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.requireLeader); + return writer; + }; + + /** + * Encodes the specified TransactionCommit message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionCommit.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.TransactionCommit + * @static + * @param {EventStore.Client.Messages.ITransactionCommit} message TransactionCommit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionCommit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TransactionCommit message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.TransactionCommit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.TransactionCommit} TransactionCommit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionCommit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionCommit(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.transactionId = reader.int64(); + break; + } + case 2: { + message.requireLeader = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TransactionCommit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.TransactionCommit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.TransactionCommit} TransactionCommit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionCommit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TransactionCommit message. + * @function verify + * @memberof EventStore.Client.Messages.TransactionCommit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TransactionCommit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.transactionId != null && message.hasOwnProperty("transactionId")) + if (!$util.isInteger(message.transactionId) && !(message.transactionId && $util.isInteger(message.transactionId.low) && $util.isInteger(message.transactionId.high))) + return "transactionId: integer|Long expected"; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + if (typeof message.requireLeader !== "boolean") + return "requireLeader: boolean expected"; + return null; + }; + + /** + * Creates a TransactionCommit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.TransactionCommit + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.TransactionCommit} TransactionCommit + */ + TransactionCommit.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.TransactionCommit) + return object; + var message = new $root.EventStore.Client.Messages.TransactionCommit(); + if (object.transactionId != null) + if ($util.Long) + (message.transactionId = $util.Long.fromValue(object.transactionId)).unsigned = false; + else if (typeof object.transactionId === "string") + message.transactionId = parseInt(object.transactionId, 10); + else if (typeof object.transactionId === "number") + message.transactionId = object.transactionId; + else if (typeof object.transactionId === "object") + message.transactionId = new $util.LongBits(object.transactionId.low >>> 0, object.transactionId.high >>> 0).toNumber(); + if (object.requireLeader != null) + message.requireLeader = Boolean(object.requireLeader); + return message; + }; + + /** + * Creates a plain object from a TransactionCommit message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.TransactionCommit + * @static + * @param {EventStore.Client.Messages.TransactionCommit} message TransactionCommit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TransactionCommit.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.transactionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.transactionId = options.longs === String ? "0" : 0; + object.requireLeader = false; + } + if (message.transactionId != null && message.hasOwnProperty("transactionId")) + if (typeof message.transactionId === "number") + object.transactionId = options.longs === String ? String(message.transactionId) : message.transactionId; + else + object.transactionId = options.longs === String ? $util.Long.prototype.toString.call(message.transactionId) : options.longs === Number ? new $util.LongBits(message.transactionId.low >>> 0, message.transactionId.high >>> 0).toNumber() : message.transactionId; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + object.requireLeader = message.requireLeader; + return object; + }; + + /** + * Converts this TransactionCommit to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.TransactionCommit + * @instance + * @returns {Object.} JSON object + */ + TransactionCommit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TransactionCommit + * @function getTypeUrl + * @memberof EventStore.Client.Messages.TransactionCommit + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TransactionCommit.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.TransactionCommit"; + }; + + return TransactionCommit; + })(); + + Messages.TransactionCommitCompleted = (function() { + + /** + * Properties of a TransactionCommitCompleted. + * @memberof EventStore.Client.Messages + * @interface ITransactionCommitCompleted + * @property {Long|null} [transactionId] TransactionCommitCompleted transactionId + * @property {EventStore.Client.Messages.OperationResult|null} [result] TransactionCommitCompleted result + * @property {string|null} [message] TransactionCommitCompleted message + * @property {Long|null} [firstEventNumber] TransactionCommitCompleted firstEventNumber + * @property {Long|null} [lastEventNumber] TransactionCommitCompleted lastEventNumber + * @property {Long|null} [preparePosition] TransactionCommitCompleted preparePosition + * @property {Long|null} [commitPosition] TransactionCommitCompleted commitPosition + */ + + /** + * Constructs a new TransactionCommitCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a TransactionCommitCompleted. + * @implements ITransactionCommitCompleted + * @constructor + * @param {EventStore.Client.Messages.ITransactionCommitCompleted=} [properties] Properties to set + */ + function TransactionCommitCompleted(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TransactionCommitCompleted transactionId. + * @member {Long} transactionId + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @instance + */ + TransactionCommitCompleted.prototype.transactionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TransactionCommitCompleted result. + * @member {EventStore.Client.Messages.OperationResult} result + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @instance + */ + TransactionCommitCompleted.prototype.result = 0; + + /** + * TransactionCommitCompleted message. + * @member {string} message + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @instance + */ + TransactionCommitCompleted.prototype.message = ""; + + /** + * TransactionCommitCompleted firstEventNumber. + * @member {Long} firstEventNumber + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @instance + */ + TransactionCommitCompleted.prototype.firstEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TransactionCommitCompleted lastEventNumber. + * @member {Long} lastEventNumber + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @instance + */ + TransactionCommitCompleted.prototype.lastEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TransactionCommitCompleted preparePosition. + * @member {Long} preparePosition + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @instance + */ + TransactionCommitCompleted.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TransactionCommitCompleted commitPosition. + * @member {Long} commitPosition + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @instance + */ + TransactionCommitCompleted.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new TransactionCommitCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @static + * @param {EventStore.Client.Messages.ITransactionCommitCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.TransactionCommitCompleted} TransactionCommitCompleted instance + */ + TransactionCommitCompleted.create = function create(properties) { + return new TransactionCommitCompleted(properties); + }; + + /** + * Encodes the specified TransactionCommitCompleted message. Does not implicitly {@link EventStore.Client.Messages.TransactionCommitCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @static + * @param {EventStore.Client.Messages.ITransactionCommitCompleted} message TransactionCommitCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionCommitCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.transactionId != null && Object.hasOwnProperty.call(message, "transactionId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.transactionId); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + if (message.firstEventNumber != null && Object.hasOwnProperty.call(message, "firstEventNumber")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.firstEventNumber); + if (message.lastEventNumber != null && Object.hasOwnProperty.call(message, "lastEventNumber")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.lastEventNumber); + if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.preparePosition); + if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.commitPosition); + return writer; + }; + + /** + * Encodes the specified TransactionCommitCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionCommitCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @static + * @param {EventStore.Client.Messages.ITransactionCommitCompleted} message TransactionCommitCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransactionCommitCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TransactionCommitCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.TransactionCommitCompleted} TransactionCommitCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionCommitCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionCommitCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.transactionId = reader.int64(); + break; + } + case 2: { + message.result = reader.int32(); + break; + } + case 3: { + message.message = reader.string(); + break; + } + case 4: { + message.firstEventNumber = reader.int64(); + break; + } + case 5: { + message.lastEventNumber = reader.int64(); + break; + } + case 6: { + message.preparePosition = reader.int64(); + break; + } + case 7: { + message.commitPosition = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TransactionCommitCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.TransactionCommitCompleted} TransactionCommitCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransactionCommitCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TransactionCommitCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TransactionCommitCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.transactionId != null && message.hasOwnProperty("transactionId")) + if (!$util.isInteger(message.transactionId) && !(message.transactionId && $util.isInteger(message.transactionId.low) && $util.isInteger(message.transactionId.high))) + return "transactionId: integer|Long expected"; + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { + default: + return "result: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.firstEventNumber != null && message.hasOwnProperty("firstEventNumber")) + if (!$util.isInteger(message.firstEventNumber) && !(message.firstEventNumber && $util.isInteger(message.firstEventNumber.low) && $util.isInteger(message.firstEventNumber.high))) + return "firstEventNumber: integer|Long expected"; + if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) + if (!$util.isInteger(message.lastEventNumber) && !(message.lastEventNumber && $util.isInteger(message.lastEventNumber.low) && $util.isInteger(message.lastEventNumber.high))) + return "lastEventNumber: integer|Long expected"; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) + return "preparePosition: integer|Long expected"; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) + return "commitPosition: integer|Long expected"; + return null; + }; + + /** + * Creates a TransactionCommitCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.TransactionCommitCompleted} TransactionCommitCompleted + */ + TransactionCommitCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.TransactionCommitCompleted) + return object; + var message = new $root.EventStore.Client.Messages.TransactionCommitCompleted(); + if (object.transactionId != null) + if ($util.Long) + (message.transactionId = $util.Long.fromValue(object.transactionId)).unsigned = false; + else if (typeof object.transactionId === "string") + message.transactionId = parseInt(object.transactionId, 10); + else if (typeof object.transactionId === "number") + message.transactionId = object.transactionId; + else if (typeof object.transactionId === "object") + message.transactionId = new $util.LongBits(object.transactionId.low >>> 0, object.transactionId.high >>> 0).toNumber(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; + } + break; + case "Success": + case 0: + message.result = 0; + break; + case "PrepareTimeout": + case 1: + message.result = 1; + break; + case "CommitTimeout": + case 2: + message.result = 2; + break; + case "ForwardTimeout": + case 3: + message.result = 3; + break; + case "WrongExpectedVersion": + case 4: + message.result = 4; + break; + case "StreamDeleted": + case 5: + message.result = 5; + break; + case "InvalidTransaction": + case 6: + message.result = 6; + break; + case "AccessDenied": + case 7: + message.result = 7; + break; + } + if (object.message != null) + message.message = String(object.message); + if (object.firstEventNumber != null) + if ($util.Long) + (message.firstEventNumber = $util.Long.fromValue(object.firstEventNumber)).unsigned = false; + else if (typeof object.firstEventNumber === "string") + message.firstEventNumber = parseInt(object.firstEventNumber, 10); + else if (typeof object.firstEventNumber === "number") + message.firstEventNumber = object.firstEventNumber; + else if (typeof object.firstEventNumber === "object") + message.firstEventNumber = new $util.LongBits(object.firstEventNumber.low >>> 0, object.firstEventNumber.high >>> 0).toNumber(); + if (object.lastEventNumber != null) + if ($util.Long) + (message.lastEventNumber = $util.Long.fromValue(object.lastEventNumber)).unsigned = false; + else if (typeof object.lastEventNumber === "string") + message.lastEventNumber = parseInt(object.lastEventNumber, 10); + else if (typeof object.lastEventNumber === "number") + message.lastEventNumber = object.lastEventNumber; + else if (typeof object.lastEventNumber === "object") + message.lastEventNumber = new $util.LongBits(object.lastEventNumber.low >>> 0, object.lastEventNumber.high >>> 0).toNumber(); + if (object.preparePosition != null) + if ($util.Long) + (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; + else if (typeof object.preparePosition === "string") + message.preparePosition = parseInt(object.preparePosition, 10); + else if (typeof object.preparePosition === "number") + message.preparePosition = object.preparePosition; + else if (typeof object.preparePosition === "object") + message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); + if (object.commitPosition != null) + if ($util.Long) + (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; + else if (typeof object.commitPosition === "string") + message.commitPosition = parseInt(object.commitPosition, 10); + else if (typeof object.commitPosition === "number") + message.commitPosition = object.commitPosition; + else if (typeof object.commitPosition === "object") + message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a TransactionCommitCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @static + * @param {EventStore.Client.Messages.TransactionCommitCompleted} message TransactionCommitCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TransactionCommitCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.transactionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.transactionId = options.longs === String ? "0" : 0; + object.result = options.enums === String ? "Success" : 0; + object.message = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.firstEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.firstEventNumber = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastEventNumber = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.preparePosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.commitPosition = options.longs === String ? "0" : 0; + } + if (message.transactionId != null && message.hasOwnProperty("transactionId")) + if (typeof message.transactionId === "number") + object.transactionId = options.longs === String ? String(message.transactionId) : message.transactionId; + else + object.transactionId = options.longs === String ? $util.Long.prototype.toString.call(message.transactionId) : options.longs === Number ? new $util.LongBits(message.transactionId.low >>> 0, message.transactionId.high >>> 0).toNumber() : message.transactionId; + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.OperationResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.OperationResult[message.result] : message.result; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.firstEventNumber != null && message.hasOwnProperty("firstEventNumber")) + if (typeof message.firstEventNumber === "number") + object.firstEventNumber = options.longs === String ? String(message.firstEventNumber) : message.firstEventNumber; + else + object.firstEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.firstEventNumber) : options.longs === Number ? new $util.LongBits(message.firstEventNumber.low >>> 0, message.firstEventNumber.high >>> 0).toNumber() : message.firstEventNumber; + if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) + if (typeof message.lastEventNumber === "number") + object.lastEventNumber = options.longs === String ? String(message.lastEventNumber) : message.lastEventNumber; + else + object.lastEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.lastEventNumber) : options.longs === Number ? new $util.LongBits(message.lastEventNumber.low >>> 0, message.lastEventNumber.high >>> 0).toNumber() : message.lastEventNumber; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (typeof message.preparePosition === "number") + object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; + else + object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (typeof message.commitPosition === "number") + object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; + else + object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; + return object; + }; + + /** + * Converts this TransactionCommitCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @instance + * @returns {Object.} JSON object + */ + TransactionCommitCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TransactionCommitCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.TransactionCommitCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TransactionCommitCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.TransactionCommitCompleted"; + }; + + return TransactionCommitCompleted; + })(); + + Messages.ReadEvent = (function() { + + /** + * Properties of a ReadEvent. + * @memberof EventStore.Client.Messages + * @interface IReadEvent + * @property {string|null} [eventStreamId] ReadEvent eventStreamId + * @property {Long|null} [eventNumber] ReadEvent eventNumber + * @property {boolean|null} [resolveLinkTos] ReadEvent resolveLinkTos + * @property {boolean|null} [requireLeader] ReadEvent requireLeader + */ + + /** + * Constructs a new ReadEvent. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ReadEvent. + * @implements IReadEvent + * @constructor + * @param {EventStore.Client.Messages.IReadEvent=} [properties] Properties to set + */ + function ReadEvent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReadEvent eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.ReadEvent + * @instance + */ + ReadEvent.prototype.eventStreamId = ""; + + /** + * ReadEvent eventNumber. + * @member {Long} eventNumber + * @memberof EventStore.Client.Messages.ReadEvent + * @instance + */ + ReadEvent.prototype.eventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ReadEvent resolveLinkTos. + * @member {boolean} resolveLinkTos + * @memberof EventStore.Client.Messages.ReadEvent + * @instance + */ + ReadEvent.prototype.resolveLinkTos = false; + + /** + * ReadEvent requireLeader. + * @member {boolean} requireLeader + * @memberof EventStore.Client.Messages.ReadEvent + * @instance + */ + ReadEvent.prototype.requireLeader = false; + + /** + * Creates a new ReadEvent instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ReadEvent + * @static + * @param {EventStore.Client.Messages.IReadEvent=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ReadEvent} ReadEvent instance + */ + ReadEvent.create = function create(properties) { + return new ReadEvent(properties); + }; + + /** + * Encodes the specified ReadEvent message. Does not implicitly {@link EventStore.Client.Messages.ReadEvent.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ReadEvent + * @static + * @param {EventStore.Client.Messages.IReadEvent} message ReadEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); + if (message.eventNumber != null && Object.hasOwnProperty.call(message, "eventNumber")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.eventNumber); + if (message.resolveLinkTos != null && Object.hasOwnProperty.call(message, "resolveLinkTos")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.resolveLinkTos); + if (message.requireLeader != null && Object.hasOwnProperty.call(message, "requireLeader")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.requireLeader); + return writer; + }; + + /** + * Encodes the specified ReadEvent message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ReadEvent + * @static + * @param {EventStore.Client.Messages.IReadEvent} message ReadEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReadEvent message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ReadEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ReadEvent} ReadEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadEvent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.eventStreamId = reader.string(); + break; + } + case 2: { + message.eventNumber = reader.int64(); + break; + } + case 3: { + message.resolveLinkTos = reader.bool(); + break; + } + case 4: { + message.requireLeader = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReadEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ReadEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ReadEvent} ReadEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReadEvent message. + * @function verify + * @memberof EventStore.Client.Messages.ReadEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + if (!$util.isString(message.eventStreamId)) + return "eventStreamId: string expected"; + if (message.eventNumber != null && message.hasOwnProperty("eventNumber")) + if (!$util.isInteger(message.eventNumber) && !(message.eventNumber && $util.isInteger(message.eventNumber.low) && $util.isInteger(message.eventNumber.high))) + return "eventNumber: integer|Long expected"; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) + if (typeof message.resolveLinkTos !== "boolean") + return "resolveLinkTos: boolean expected"; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + if (typeof message.requireLeader !== "boolean") + return "requireLeader: boolean expected"; + return null; + }; + + /** + * Creates a ReadEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ReadEvent + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ReadEvent} ReadEvent + */ + ReadEvent.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ReadEvent) + return object; + var message = new $root.EventStore.Client.Messages.ReadEvent(); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.eventNumber != null) + if ($util.Long) + (message.eventNumber = $util.Long.fromValue(object.eventNumber)).unsigned = false; + else if (typeof object.eventNumber === "string") + message.eventNumber = parseInt(object.eventNumber, 10); + else if (typeof object.eventNumber === "number") + message.eventNumber = object.eventNumber; + else if (typeof object.eventNumber === "object") + message.eventNumber = new $util.LongBits(object.eventNumber.low >>> 0, object.eventNumber.high >>> 0).toNumber(); + if (object.resolveLinkTos != null) + message.resolveLinkTos = Boolean(object.resolveLinkTos); + if (object.requireLeader != null) + message.requireLeader = Boolean(object.requireLeader); + return message; + }; + + /** + * Creates a plain object from a ReadEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ReadEvent + * @static + * @param {EventStore.Client.Messages.ReadEvent} message ReadEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.eventStreamId = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.eventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.eventNumber = options.longs === String ? "0" : 0; + object.resolveLinkTos = false; + object.requireLeader = false; + } + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.eventNumber != null && message.hasOwnProperty("eventNumber")) + if (typeof message.eventNumber === "number") + object.eventNumber = options.longs === String ? String(message.eventNumber) : message.eventNumber; + else + object.eventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.eventNumber) : options.longs === Number ? new $util.LongBits(message.eventNumber.low >>> 0, message.eventNumber.high >>> 0).toNumber() : message.eventNumber; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) + object.resolveLinkTos = message.resolveLinkTos; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + object.requireLeader = message.requireLeader; + return object; + }; + + /** + * Converts this ReadEvent to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ReadEvent + * @instance + * @returns {Object.} JSON object + */ + ReadEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReadEvent + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ReadEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ReadEvent"; + }; + + return ReadEvent; + })(); + + Messages.ReadEventCompleted = (function() { + + /** + * Properties of a ReadEventCompleted. + * @memberof EventStore.Client.Messages + * @interface IReadEventCompleted + * @property {EventStore.Client.Messages.ReadEventCompleted.ReadEventResult|null} [result] ReadEventCompleted result + * @property {EventStore.Client.Messages.IResolvedIndexedEvent|null} [event] ReadEventCompleted event + * @property {string|null} [error] ReadEventCompleted error + */ + + /** + * Constructs a new ReadEventCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ReadEventCompleted. + * @implements IReadEventCompleted + * @constructor + * @param {EventStore.Client.Messages.IReadEventCompleted=} [properties] Properties to set + */ + function ReadEventCompleted(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReadEventCompleted result. + * @member {EventStore.Client.Messages.ReadEventCompleted.ReadEventResult} result + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @instance + */ + ReadEventCompleted.prototype.result = 0; + + /** + * ReadEventCompleted event. + * @member {EventStore.Client.Messages.IResolvedIndexedEvent|null|undefined} event + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @instance + */ + ReadEventCompleted.prototype.event = null; + + /** + * ReadEventCompleted error. + * @member {string} error + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @instance + */ + ReadEventCompleted.prototype.error = ""; + + /** + * Creates a new ReadEventCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @static + * @param {EventStore.Client.Messages.IReadEventCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ReadEventCompleted} ReadEventCompleted instance + */ + ReadEventCompleted.create = function create(properties) { + return new ReadEventCompleted(properties); + }; + + /** + * Encodes the specified ReadEventCompleted message. Does not implicitly {@link EventStore.Client.Messages.ReadEventCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @static + * @param {EventStore.Client.Messages.IReadEventCompleted} message ReadEventCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadEventCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + $root.EventStore.Client.Messages.ResolvedIndexedEvent.encode(message.event, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.error); + return writer; + }; + + /** + * Encodes the specified ReadEventCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadEventCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @static + * @param {EventStore.Client.Messages.IReadEventCompleted} message ReadEventCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadEventCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReadEventCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ReadEventCompleted} ReadEventCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadEventCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadEventCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.result = reader.int32(); + break; + } + case 2: { + message.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.decode(reader, reader.uint32()); + break; + } + case 3: { + message.error = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReadEventCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ReadEventCompleted} ReadEventCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadEventCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReadEventCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadEventCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { + default: + return "result: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.event != null && message.hasOwnProperty("event")) { + var error = $root.EventStore.Client.Messages.ResolvedIndexedEvent.verify(message.event); + if (error) + return "event." + error; + } + if (message.error != null && message.hasOwnProperty("error")) + if (!$util.isString(message.error)) + return "error: string expected"; + return null; + }; + + /** + * Creates a ReadEventCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ReadEventCompleted} ReadEventCompleted + */ + ReadEventCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ReadEventCompleted) + return object; + var message = new $root.EventStore.Client.Messages.ReadEventCompleted(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; + } + break; + case "Success": + case 0: + message.result = 0; + break; + case "NotFound": + case 1: + message.result = 1; + break; + case "NoStream": + case 2: + message.result = 2; + break; + case "StreamDeleted": + case 3: + message.result = 3; + break; + case "Error": + case 4: + message.result = 4; + break; + case "AccessDenied": + case 5: + message.result = 5; + break; + } + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".EventStore.Client.Messages.ReadEventCompleted.event: object expected"); + message.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.fromObject(object.event); + } + if (object.error != null) + message.error = String(object.error); + return message; + }; + + /** + * Creates a plain object from a ReadEventCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @static + * @param {EventStore.Client.Messages.ReadEventCompleted} message ReadEventCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadEventCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.result = options.enums === String ? "Success" : 0; + object.event = null; + object.error = ""; + } + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.ReadEventCompleted.ReadEventResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.ReadEventCompleted.ReadEventResult[message.result] : message.result; + if (message.event != null && message.hasOwnProperty("event")) + object.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.toObject(message.event, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = message.error; + return object; + }; + + /** + * Converts this ReadEventCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @instance + * @returns {Object.} JSON object + */ + ReadEventCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReadEventCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ReadEventCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadEventCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ReadEventCompleted"; + }; + + /** + * ReadEventResult enum. + * @name EventStore.Client.Messages.ReadEventCompleted.ReadEventResult * @enum {number} * @property {number} Success=0 Success value - * @property {number} PrepareTimeout=1 PrepareTimeout value - * @property {number} CommitTimeout=2 CommitTimeout value - * @property {number} ForwardTimeout=3 ForwardTimeout value - * @property {number} WrongExpectedVersion=4 WrongExpectedVersion value - * @property {number} StreamDeleted=5 StreamDeleted value - * @property {number} InvalidTransaction=6 InvalidTransaction value - * @property {number} AccessDenied=7 AccessDenied value + * @property {number} NotFound=1 NotFound value + * @property {number} NoStream=2 NoStream value + * @property {number} StreamDeleted=3 StreamDeleted value + * @property {number} Error=4 Error value + * @property {number} AccessDenied=5 AccessDenied value */ - Messages.OperationResult = (function() { + ReadEventCompleted.ReadEventResult = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "Success"] = 0; - values[valuesById[1] = "PrepareTimeout"] = 1; - values[valuesById[2] = "CommitTimeout"] = 2; - values[valuesById[3] = "ForwardTimeout"] = 3; - values[valuesById[4] = "WrongExpectedVersion"] = 4; - values[valuesById[5] = "StreamDeleted"] = 5; - values[valuesById[6] = "InvalidTransaction"] = 6; - values[valuesById[7] = "AccessDenied"] = 7; + values[valuesById[1] = "NotFound"] = 1; + values[valuesById[2] = "NoStream"] = 2; + values[valuesById[3] = "StreamDeleted"] = 3; + values[valuesById[4] = "Error"] = 4; + values[valuesById[5] = "AccessDenied"] = 5; return values; })(); - Messages.NewEvent = (function() { + return ReadEventCompleted; + })(); - /** - * Properties of a NewEvent. - * @memberof EventStore.Client.Messages - * @interface INewEvent - * @property {Uint8Array} eventId NewEvent eventId - * @property {string} eventType NewEvent eventType - * @property {number} dataContentType NewEvent dataContentType - * @property {number} metadataContentType NewEvent metadataContentType - * @property {Uint8Array} data NewEvent data - * @property {Uint8Array|null} [metadata] NewEvent metadata - */ + Messages.ReadStreamEvents = (function() { - /** - * Constructs a new NewEvent. - * @memberof EventStore.Client.Messages - * @classdesc Represents a NewEvent. - * @implements INewEvent - * @constructor - * @param {EventStore.Client.Messages.INewEvent=} [properties] Properties to set - */ - function NewEvent(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a ReadStreamEvents. + * @memberof EventStore.Client.Messages + * @interface IReadStreamEvents + * @property {string|null} [eventStreamId] ReadStreamEvents eventStreamId + * @property {Long|null} [fromEventNumber] ReadStreamEvents fromEventNumber + * @property {number|null} [maxCount] ReadStreamEvents maxCount + * @property {boolean|null} [resolveLinkTos] ReadStreamEvents resolveLinkTos + * @property {boolean|null} [requireLeader] ReadStreamEvents requireLeader + */ - /** - * NewEvent eventId. - * @member {Uint8Array} eventId - * @memberof EventStore.Client.Messages.NewEvent - * @instance - */ - NewEvent.prototype.eventId = $util.newBuffer([]); + /** + * Constructs a new ReadStreamEvents. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ReadStreamEvents. + * @implements IReadStreamEvents + * @constructor + * @param {EventStore.Client.Messages.IReadStreamEvents=} [properties] Properties to set + */ + function ReadStreamEvents(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * NewEvent eventType. - * @member {string} eventType - * @memberof EventStore.Client.Messages.NewEvent - * @instance - */ - NewEvent.prototype.eventType = ""; + /** + * ReadStreamEvents eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @instance + */ + ReadStreamEvents.prototype.eventStreamId = ""; - /** - * NewEvent dataContentType. - * @member {number} dataContentType - * @memberof EventStore.Client.Messages.NewEvent - * @instance - */ - NewEvent.prototype.dataContentType = 0; + /** + * ReadStreamEvents fromEventNumber. + * @member {Long} fromEventNumber + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @instance + */ + ReadStreamEvents.prototype.fromEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * NewEvent metadataContentType. - * @member {number} metadataContentType - * @memberof EventStore.Client.Messages.NewEvent - * @instance - */ - NewEvent.prototype.metadataContentType = 0; + /** + * ReadStreamEvents maxCount. + * @member {number} maxCount + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @instance + */ + ReadStreamEvents.prototype.maxCount = 0; - /** - * NewEvent data. - * @member {Uint8Array} data - * @memberof EventStore.Client.Messages.NewEvent - * @instance - */ - NewEvent.prototype.data = $util.newBuffer([]); + /** + * ReadStreamEvents resolveLinkTos. + * @member {boolean} resolveLinkTos + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @instance + */ + ReadStreamEvents.prototype.resolveLinkTos = false; - /** - * NewEvent metadata. - * @member {Uint8Array} metadata - * @memberof EventStore.Client.Messages.NewEvent - * @instance - */ - NewEvent.prototype.metadata = $util.newBuffer([]); + /** + * ReadStreamEvents requireLeader. + * @member {boolean} requireLeader + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @instance + */ + ReadStreamEvents.prototype.requireLeader = false; - /** - * Creates a new NewEvent instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.NewEvent - * @static - * @param {EventStore.Client.Messages.INewEvent=} [properties] Properties to set - * @returns {EventStore.Client.Messages.NewEvent} NewEvent instance - */ - NewEvent.create = function create(properties) { - return new NewEvent(properties); - }; + /** + * Creates a new ReadStreamEvents instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @static + * @param {EventStore.Client.Messages.IReadStreamEvents=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ReadStreamEvents} ReadStreamEvents instance + */ + ReadStreamEvents.create = function create(properties) { + return new ReadStreamEvents(properties); + }; - /** - * Encodes the specified NewEvent message. Does not implicitly {@link EventStore.Client.Messages.NewEvent.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.NewEvent - * @static - * @param {EventStore.Client.Messages.INewEvent} message NewEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NewEvent.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.eventId); - writer.uint32(/* id 2, wireType 2 =*/18).string(message.eventType); - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.dataContentType); - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.metadataContentType); - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.data); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.metadata); - return writer; - }; - - /** - * Encodes the specified NewEvent message, length delimited. Does not implicitly {@link EventStore.Client.Messages.NewEvent.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.NewEvent - * @static - * @param {EventStore.Client.Messages.INewEvent} message NewEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NewEvent.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NewEvent message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.NewEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.NewEvent} NewEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NewEvent.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.NewEvent(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.eventId = reader.bytes(); - break; - } - case 2: { - message.eventType = reader.string(); - break; - } - case 3: { - message.dataContentType = reader.int32(); - break; - } - case 4: { - message.metadataContentType = reader.int32(); - break; - } - case 5: { - message.data = reader.bytes(); - break; - } - case 6: { - message.metadata = reader.bytes(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("eventId")) - throw $util.ProtocolError("missing required 'eventId'", { instance: message }); - if (!message.hasOwnProperty("eventType")) - throw $util.ProtocolError("missing required 'eventType'", { instance: message }); - if (!message.hasOwnProperty("dataContentType")) - throw $util.ProtocolError("missing required 'dataContentType'", { instance: message }); - if (!message.hasOwnProperty("metadataContentType")) - throw $util.ProtocolError("missing required 'metadataContentType'", { instance: message }); - if (!message.hasOwnProperty("data")) - throw $util.ProtocolError("missing required 'data'", { instance: message }); - return message; - }; - - /** - * Decodes a NewEvent message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.NewEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.NewEvent} NewEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NewEvent.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NewEvent message. - * @function verify - * @memberof EventStore.Client.Messages.NewEvent - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NewEvent.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!(message.eventId && typeof message.eventId.length === "number" || $util.isString(message.eventId))) - return "eventId: buffer expected"; - if (!$util.isString(message.eventType)) - return "eventType: string expected"; - if (!$util.isInteger(message.dataContentType)) - return "dataContentType: integer expected"; - if (!$util.isInteger(message.metadataContentType)) - return "metadataContentType: integer expected"; - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) - if (!(message.metadata && typeof message.metadata.length === "number" || $util.isString(message.metadata))) - return "metadata: buffer expected"; - return null; - }; - - /** - * Creates a NewEvent message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.NewEvent - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.NewEvent} NewEvent - */ - NewEvent.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.NewEvent) - return object; - var message = new $root.EventStore.Client.Messages.NewEvent(); - if (object.eventId != null) - if (typeof object.eventId === "string") - $util.base64.decode(object.eventId, message.eventId = $util.newBuffer($util.base64.length(object.eventId)), 0); - else if (object.eventId.length >= 0) - message.eventId = object.eventId; - if (object.eventType != null) - message.eventType = String(object.eventType); - if (object.dataContentType != null) - message.dataContentType = object.dataContentType | 0; - if (object.metadataContentType != null) - message.metadataContentType = object.metadataContentType | 0; - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length >= 0) - message.data = object.data; - if (object.metadata != null) - if (typeof object.metadata === "string") - $util.base64.decode(object.metadata, message.metadata = $util.newBuffer($util.base64.length(object.metadata)), 0); - else if (object.metadata.length >= 0) - message.metadata = object.metadata; - return message; - }; - - /** - * Creates a plain object from a NewEvent message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.NewEvent - * @static - * @param {EventStore.Client.Messages.NewEvent} message NewEvent - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NewEvent.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.eventId = ""; - else { - object.eventId = []; - if (options.bytes !== Array) - object.eventId = $util.newBuffer(object.eventId); - } - object.eventType = ""; - object.dataContentType = 0; - object.metadataContentType = 0; - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - if (options.bytes === String) - object.metadata = ""; - else { - object.metadata = []; - if (options.bytes !== Array) - object.metadata = $util.newBuffer(object.metadata); - } - } - if (message.eventId != null && message.hasOwnProperty("eventId")) - object.eventId = options.bytes === String ? $util.base64.encode(message.eventId, 0, message.eventId.length) : options.bytes === Array ? Array.prototype.slice.call(message.eventId) : message.eventId; - if (message.eventType != null && message.hasOwnProperty("eventType")) - object.eventType = message.eventType; - if (message.dataContentType != null && message.hasOwnProperty("dataContentType")) - object.dataContentType = message.dataContentType; - if (message.metadataContentType != null && message.hasOwnProperty("metadataContentType")) - object.metadataContentType = message.metadataContentType; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = options.bytes === String ? $util.base64.encode(message.metadata, 0, message.metadata.length) : options.bytes === Array ? Array.prototype.slice.call(message.metadata) : message.metadata; - return object; - }; - - /** - * Converts this NewEvent to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.NewEvent - * @instance - * @returns {Object.} JSON object - */ - NewEvent.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for NewEvent - * @function getTypeUrl - * @memberof EventStore.Client.Messages.NewEvent - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NewEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.NewEvent"; - }; - - return NewEvent; - })(); - - Messages.EventRecord = (function() { - - /** - * Properties of an EventRecord. - * @memberof EventStore.Client.Messages - * @interface IEventRecord - * @property {string} eventStreamId EventRecord eventStreamId - * @property {Long} eventNumber EventRecord eventNumber - * @property {Uint8Array} eventId EventRecord eventId - * @property {string} eventType EventRecord eventType - * @property {number} dataContentType EventRecord dataContentType - * @property {number} metadataContentType EventRecord metadataContentType - * @property {Uint8Array} data EventRecord data - * @property {Uint8Array|null} [metadata] EventRecord metadata - * @property {Long|null} [created] EventRecord created - * @property {Long|null} [createdEpoch] EventRecord createdEpoch - */ - - /** - * Constructs a new EventRecord. - * @memberof EventStore.Client.Messages - * @classdesc Represents an EventRecord. - * @implements IEventRecord - * @constructor - * @param {EventStore.Client.Messages.IEventRecord=} [properties] Properties to set - */ - function EventRecord(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EventRecord eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.EventRecord - * @instance - */ - EventRecord.prototype.eventStreamId = ""; - - /** - * EventRecord eventNumber. - * @member {Long} eventNumber - * @memberof EventStore.Client.Messages.EventRecord - * @instance - */ - EventRecord.prototype.eventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * EventRecord eventId. - * @member {Uint8Array} eventId - * @memberof EventStore.Client.Messages.EventRecord - * @instance - */ - EventRecord.prototype.eventId = $util.newBuffer([]); - - /** - * EventRecord eventType. - * @member {string} eventType - * @memberof EventStore.Client.Messages.EventRecord - * @instance - */ - EventRecord.prototype.eventType = ""; - - /** - * EventRecord dataContentType. - * @member {number} dataContentType - * @memberof EventStore.Client.Messages.EventRecord - * @instance - */ - EventRecord.prototype.dataContentType = 0; - - /** - * EventRecord metadataContentType. - * @member {number} metadataContentType - * @memberof EventStore.Client.Messages.EventRecord - * @instance - */ - EventRecord.prototype.metadataContentType = 0; - - /** - * EventRecord data. - * @member {Uint8Array} data - * @memberof EventStore.Client.Messages.EventRecord - * @instance - */ - EventRecord.prototype.data = $util.newBuffer([]); - - /** - * EventRecord metadata. - * @member {Uint8Array} metadata - * @memberof EventStore.Client.Messages.EventRecord - * @instance - */ - EventRecord.prototype.metadata = $util.newBuffer([]); - - /** - * EventRecord created. - * @member {Long} created - * @memberof EventStore.Client.Messages.EventRecord - * @instance - */ - EventRecord.prototype.created = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * EventRecord createdEpoch. - * @member {Long} createdEpoch - * @memberof EventStore.Client.Messages.EventRecord - * @instance - */ - EventRecord.prototype.createdEpoch = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new EventRecord instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.EventRecord - * @static - * @param {EventStore.Client.Messages.IEventRecord=} [properties] Properties to set - * @returns {EventStore.Client.Messages.EventRecord} EventRecord instance - */ - EventRecord.create = function create(properties) { - return new EventRecord(properties); - }; - - /** - * Encodes the specified EventRecord message. Does not implicitly {@link EventStore.Client.Messages.EventRecord.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.EventRecord - * @static - * @param {EventStore.Client.Messages.IEventRecord} message EventRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EventRecord.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.eventNumber); - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.eventId); - writer.uint32(/* id 4, wireType 2 =*/34).string(message.eventType); - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.dataContentType); - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.metadataContentType); - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.data); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.metadata); - if (message.created != null && Object.hasOwnProperty.call(message, "created")) - writer.uint32(/* id 9, wireType 0 =*/72).int64(message.created); - if (message.createdEpoch != null && Object.hasOwnProperty.call(message, "createdEpoch")) - writer.uint32(/* id 10, wireType 0 =*/80).int64(message.createdEpoch); - return writer; - }; - - /** - * Encodes the specified EventRecord message, length delimited. Does not implicitly {@link EventStore.Client.Messages.EventRecord.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.EventRecord - * @static - * @param {EventStore.Client.Messages.IEventRecord} message EventRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EventRecord.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EventRecord message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.EventRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.EventRecord} EventRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EventRecord.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.EventRecord(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.eventStreamId = reader.string(); - break; - } - case 2: { - message.eventNumber = reader.int64(); - break; - } - case 3: { - message.eventId = reader.bytes(); - break; - } - case 4: { - message.eventType = reader.string(); - break; - } - case 5: { - message.dataContentType = reader.int32(); - break; - } - case 6: { - message.metadataContentType = reader.int32(); - break; - } - case 7: { - message.data = reader.bytes(); - break; - } - case 8: { - message.metadata = reader.bytes(); - break; - } - case 9: { - message.created = reader.int64(); - break; - } - case 10: { - message.createdEpoch = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("eventNumber")) - throw $util.ProtocolError("missing required 'eventNumber'", { instance: message }); - if (!message.hasOwnProperty("eventId")) - throw $util.ProtocolError("missing required 'eventId'", { instance: message }); - if (!message.hasOwnProperty("eventType")) - throw $util.ProtocolError("missing required 'eventType'", { instance: message }); - if (!message.hasOwnProperty("dataContentType")) - throw $util.ProtocolError("missing required 'dataContentType'", { instance: message }); - if (!message.hasOwnProperty("metadataContentType")) - throw $util.ProtocolError("missing required 'metadataContentType'", { instance: message }); - if (!message.hasOwnProperty("data")) - throw $util.ProtocolError("missing required 'data'", { instance: message }); - return message; - }; - - /** - * Decodes an EventRecord message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.EventRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.EventRecord} EventRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EventRecord.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EventRecord message. - * @function verify - * @memberof EventStore.Client.Messages.EventRecord - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EventRecord.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isString(message.eventStreamId)) - return "eventStreamId: string expected"; - if (!$util.isInteger(message.eventNumber) && !(message.eventNumber && $util.isInteger(message.eventNumber.low) && $util.isInteger(message.eventNumber.high))) - return "eventNumber: integer|Long expected"; - if (!(message.eventId && typeof message.eventId.length === "number" || $util.isString(message.eventId))) - return "eventId: buffer expected"; - if (!$util.isString(message.eventType)) - return "eventType: string expected"; - if (!$util.isInteger(message.dataContentType)) - return "dataContentType: integer expected"; - if (!$util.isInteger(message.metadataContentType)) - return "metadataContentType: integer expected"; - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) - if (!(message.metadata && typeof message.metadata.length === "number" || $util.isString(message.metadata))) - return "metadata: buffer expected"; - if (message.created != null && message.hasOwnProperty("created")) - if (!$util.isInteger(message.created) && !(message.created && $util.isInteger(message.created.low) && $util.isInteger(message.created.high))) - return "created: integer|Long expected"; - if (message.createdEpoch != null && message.hasOwnProperty("createdEpoch")) - if (!$util.isInteger(message.createdEpoch) && !(message.createdEpoch && $util.isInteger(message.createdEpoch.low) && $util.isInteger(message.createdEpoch.high))) - return "createdEpoch: integer|Long expected"; - return null; - }; - - /** - * Creates an EventRecord message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.EventRecord - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.EventRecord} EventRecord - */ - EventRecord.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.EventRecord) - return object; - var message = new $root.EventStore.Client.Messages.EventRecord(); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.eventNumber != null) - if ($util.Long) - (message.eventNumber = $util.Long.fromValue(object.eventNumber)).unsigned = false; - else if (typeof object.eventNumber === "string") - message.eventNumber = parseInt(object.eventNumber, 10); - else if (typeof object.eventNumber === "number") - message.eventNumber = object.eventNumber; - else if (typeof object.eventNumber === "object") - message.eventNumber = new $util.LongBits(object.eventNumber.low >>> 0, object.eventNumber.high >>> 0).toNumber(); - if (object.eventId != null) - if (typeof object.eventId === "string") - $util.base64.decode(object.eventId, message.eventId = $util.newBuffer($util.base64.length(object.eventId)), 0); - else if (object.eventId.length >= 0) - message.eventId = object.eventId; - if (object.eventType != null) - message.eventType = String(object.eventType); - if (object.dataContentType != null) - message.dataContentType = object.dataContentType | 0; - if (object.metadataContentType != null) - message.metadataContentType = object.metadataContentType | 0; - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length >= 0) - message.data = object.data; - if (object.metadata != null) - if (typeof object.metadata === "string") - $util.base64.decode(object.metadata, message.metadata = $util.newBuffer($util.base64.length(object.metadata)), 0); - else if (object.metadata.length >= 0) - message.metadata = object.metadata; - if (object.created != null) - if ($util.Long) - (message.created = $util.Long.fromValue(object.created)).unsigned = false; - else if (typeof object.created === "string") - message.created = parseInt(object.created, 10); - else if (typeof object.created === "number") - message.created = object.created; - else if (typeof object.created === "object") - message.created = new $util.LongBits(object.created.low >>> 0, object.created.high >>> 0).toNumber(); - if (object.createdEpoch != null) - if ($util.Long) - (message.createdEpoch = $util.Long.fromValue(object.createdEpoch)).unsigned = false; - else if (typeof object.createdEpoch === "string") - message.createdEpoch = parseInt(object.createdEpoch, 10); - else if (typeof object.createdEpoch === "number") - message.createdEpoch = object.createdEpoch; - else if (typeof object.createdEpoch === "object") - message.createdEpoch = new $util.LongBits(object.createdEpoch.low >>> 0, object.createdEpoch.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from an EventRecord message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.EventRecord - * @static - * @param {EventStore.Client.Messages.EventRecord} message EventRecord - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EventRecord.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.eventStreamId = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.eventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.eventNumber = options.longs === String ? "0" : 0; - if (options.bytes === String) - object.eventId = ""; - else { - object.eventId = []; - if (options.bytes !== Array) - object.eventId = $util.newBuffer(object.eventId); - } - object.eventType = ""; - object.dataContentType = 0; - object.metadataContentType = 0; - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - if (options.bytes === String) - object.metadata = ""; - else { - object.metadata = []; - if (options.bytes !== Array) - object.metadata = $util.newBuffer(object.metadata); - } - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.created = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.created = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.createdEpoch = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.createdEpoch = options.longs === String ? "0" : 0; - } - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.eventNumber != null && message.hasOwnProperty("eventNumber")) - if (typeof message.eventNumber === "number") - object.eventNumber = options.longs === String ? String(message.eventNumber) : message.eventNumber; - else - object.eventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.eventNumber) : options.longs === Number ? new $util.LongBits(message.eventNumber.low >>> 0, message.eventNumber.high >>> 0).toNumber() : message.eventNumber; - if (message.eventId != null && message.hasOwnProperty("eventId")) - object.eventId = options.bytes === String ? $util.base64.encode(message.eventId, 0, message.eventId.length) : options.bytes === Array ? Array.prototype.slice.call(message.eventId) : message.eventId; - if (message.eventType != null && message.hasOwnProperty("eventType")) - object.eventType = message.eventType; - if (message.dataContentType != null && message.hasOwnProperty("dataContentType")) - object.dataContentType = message.dataContentType; - if (message.metadataContentType != null && message.hasOwnProperty("metadataContentType")) - object.metadataContentType = message.metadataContentType; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = options.bytes === String ? $util.base64.encode(message.metadata, 0, message.metadata.length) : options.bytes === Array ? Array.prototype.slice.call(message.metadata) : message.metadata; - if (message.created != null && message.hasOwnProperty("created")) - if (typeof message.created === "number") - object.created = options.longs === String ? String(message.created) : message.created; - else - object.created = options.longs === String ? $util.Long.prototype.toString.call(message.created) : options.longs === Number ? new $util.LongBits(message.created.low >>> 0, message.created.high >>> 0).toNumber() : message.created; - if (message.createdEpoch != null && message.hasOwnProperty("createdEpoch")) - if (typeof message.createdEpoch === "number") - object.createdEpoch = options.longs === String ? String(message.createdEpoch) : message.createdEpoch; - else - object.createdEpoch = options.longs === String ? $util.Long.prototype.toString.call(message.createdEpoch) : options.longs === Number ? new $util.LongBits(message.createdEpoch.low >>> 0, message.createdEpoch.high >>> 0).toNumber() : message.createdEpoch; - return object; - }; - - /** - * Converts this EventRecord to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.EventRecord - * @instance - * @returns {Object.} JSON object - */ - EventRecord.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EventRecord - * @function getTypeUrl - * @memberof EventStore.Client.Messages.EventRecord - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EventRecord.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.EventRecord"; - }; - - return EventRecord; - })(); - - Messages.ResolvedIndexedEvent = (function() { - - /** - * Properties of a ResolvedIndexedEvent. - * @memberof EventStore.Client.Messages - * @interface IResolvedIndexedEvent - * @property {EventStore.Client.Messages.IEventRecord|null} [event] ResolvedIndexedEvent event - * @property {EventStore.Client.Messages.IEventRecord|null} [link] ResolvedIndexedEvent link - */ - - /** - * Constructs a new ResolvedIndexedEvent. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ResolvedIndexedEvent. - * @implements IResolvedIndexedEvent - * @constructor - * @param {EventStore.Client.Messages.IResolvedIndexedEvent=} [properties] Properties to set - */ - function ResolvedIndexedEvent(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResolvedIndexedEvent event. - * @member {EventStore.Client.Messages.IEventRecord|null|undefined} event - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @instance - */ - ResolvedIndexedEvent.prototype.event = null; - - /** - * ResolvedIndexedEvent link. - * @member {EventStore.Client.Messages.IEventRecord|null|undefined} link - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @instance - */ - ResolvedIndexedEvent.prototype.link = null; - - /** - * Creates a new ResolvedIndexedEvent instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @static - * @param {EventStore.Client.Messages.IResolvedIndexedEvent=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ResolvedIndexedEvent} ResolvedIndexedEvent instance - */ - ResolvedIndexedEvent.create = function create(properties) { - return new ResolvedIndexedEvent(properties); - }; - - /** - * Encodes the specified ResolvedIndexedEvent message. Does not implicitly {@link EventStore.Client.Messages.ResolvedIndexedEvent.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @static - * @param {EventStore.Client.Messages.IResolvedIndexedEvent} message ResolvedIndexedEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResolvedIndexedEvent.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.event != null && Object.hasOwnProperty.call(message, "event")) - $root.EventStore.Client.Messages.EventRecord.encode(message.event, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.link != null && Object.hasOwnProperty.call(message, "link")) - $root.EventStore.Client.Messages.EventRecord.encode(message.link, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ResolvedIndexedEvent message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ResolvedIndexedEvent.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @static - * @param {EventStore.Client.Messages.IResolvedIndexedEvent} message ResolvedIndexedEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResolvedIndexedEvent.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResolvedIndexedEvent message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ResolvedIndexedEvent} ResolvedIndexedEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResolvedIndexedEvent.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ResolvedIndexedEvent(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.event = $root.EventStore.Client.Messages.EventRecord.decode(reader, reader.uint32()); - break; - } - case 2: { - message.link = $root.EventStore.Client.Messages.EventRecord.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResolvedIndexedEvent message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ResolvedIndexedEvent} ResolvedIndexedEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResolvedIndexedEvent.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResolvedIndexedEvent message. - * @function verify - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResolvedIndexedEvent.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.event != null && message.hasOwnProperty("event")) { - var error = $root.EventStore.Client.Messages.EventRecord.verify(message.event); - if (error) - return "event." + error; - } - if (message.link != null && message.hasOwnProperty("link")) { - var error = $root.EventStore.Client.Messages.EventRecord.verify(message.link); - if (error) - return "link." + error; - } - return null; - }; - - /** - * Creates a ResolvedIndexedEvent message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ResolvedIndexedEvent} ResolvedIndexedEvent - */ - ResolvedIndexedEvent.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ResolvedIndexedEvent) - return object; - var message = new $root.EventStore.Client.Messages.ResolvedIndexedEvent(); - if (object.event != null) { - if (typeof object.event !== "object") - throw TypeError(".EventStore.Client.Messages.ResolvedIndexedEvent.event: object expected"); - message.event = $root.EventStore.Client.Messages.EventRecord.fromObject(object.event); - } - if (object.link != null) { - if (typeof object.link !== "object") - throw TypeError(".EventStore.Client.Messages.ResolvedIndexedEvent.link: object expected"); - message.link = $root.EventStore.Client.Messages.EventRecord.fromObject(object.link); - } - return message; - }; - - /** - * Creates a plain object from a ResolvedIndexedEvent message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @static - * @param {EventStore.Client.Messages.ResolvedIndexedEvent} message ResolvedIndexedEvent - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResolvedIndexedEvent.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.event = null; - object.link = null; - } - if (message.event != null && message.hasOwnProperty("event")) - object.event = $root.EventStore.Client.Messages.EventRecord.toObject(message.event, options); - if (message.link != null && message.hasOwnProperty("link")) - object.link = $root.EventStore.Client.Messages.EventRecord.toObject(message.link, options); - return object; - }; - - /** - * Converts this ResolvedIndexedEvent to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @instance - * @returns {Object.} JSON object - */ - ResolvedIndexedEvent.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ResolvedIndexedEvent - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ResolvedIndexedEvent - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ResolvedIndexedEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.ResolvedIndexedEvent"; - }; - - return ResolvedIndexedEvent; - })(); - - Messages.ResolvedEvent = (function() { - - /** - * Properties of a ResolvedEvent. - * @memberof EventStore.Client.Messages - * @interface IResolvedEvent - * @property {EventStore.Client.Messages.IEventRecord|null} [event] ResolvedEvent event - * @property {EventStore.Client.Messages.IEventRecord|null} [link] ResolvedEvent link - * @property {Long} commitPosition ResolvedEvent commitPosition - * @property {Long} preparePosition ResolvedEvent preparePosition - */ - - /** - * Constructs a new ResolvedEvent. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ResolvedEvent. - * @implements IResolvedEvent - * @constructor - * @param {EventStore.Client.Messages.IResolvedEvent=} [properties] Properties to set - */ - function ResolvedEvent(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResolvedEvent event. - * @member {EventStore.Client.Messages.IEventRecord|null|undefined} event - * @memberof EventStore.Client.Messages.ResolvedEvent - * @instance - */ - ResolvedEvent.prototype.event = null; - - /** - * ResolvedEvent link. - * @member {EventStore.Client.Messages.IEventRecord|null|undefined} link - * @memberof EventStore.Client.Messages.ResolvedEvent - * @instance - */ - ResolvedEvent.prototype.link = null; - - /** - * ResolvedEvent commitPosition. - * @member {Long} commitPosition - * @memberof EventStore.Client.Messages.ResolvedEvent - * @instance - */ - ResolvedEvent.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ResolvedEvent preparePosition. - * @member {Long} preparePosition - * @memberof EventStore.Client.Messages.ResolvedEvent - * @instance - */ - ResolvedEvent.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new ResolvedEvent instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ResolvedEvent - * @static - * @param {EventStore.Client.Messages.IResolvedEvent=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ResolvedEvent} ResolvedEvent instance - */ - ResolvedEvent.create = function create(properties) { - return new ResolvedEvent(properties); - }; - - /** - * Encodes the specified ResolvedEvent message. Does not implicitly {@link EventStore.Client.Messages.ResolvedEvent.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ResolvedEvent - * @static - * @param {EventStore.Client.Messages.IResolvedEvent} message ResolvedEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResolvedEvent.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.event != null && Object.hasOwnProperty.call(message, "event")) - $root.EventStore.Client.Messages.EventRecord.encode(message.event, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.link != null && Object.hasOwnProperty.call(message, "link")) - $root.EventStore.Client.Messages.EventRecord.encode(message.link, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.commitPosition); - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.preparePosition); - return writer; - }; - - /** - * Encodes the specified ResolvedEvent message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ResolvedEvent.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ResolvedEvent - * @static - * @param {EventStore.Client.Messages.IResolvedEvent} message ResolvedEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResolvedEvent.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResolvedEvent message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ResolvedEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ResolvedEvent} ResolvedEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResolvedEvent.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ResolvedEvent(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.event = $root.EventStore.Client.Messages.EventRecord.decode(reader, reader.uint32()); - break; - } - case 2: { - message.link = $root.EventStore.Client.Messages.EventRecord.decode(reader, reader.uint32()); - break; - } - case 3: { - message.commitPosition = reader.int64(); - break; - } - case 4: { - message.preparePosition = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("commitPosition")) - throw $util.ProtocolError("missing required 'commitPosition'", { instance: message }); - if (!message.hasOwnProperty("preparePosition")) - throw $util.ProtocolError("missing required 'preparePosition'", { instance: message }); - return message; - }; - - /** - * Decodes a ResolvedEvent message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ResolvedEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ResolvedEvent} ResolvedEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResolvedEvent.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResolvedEvent message. - * @function verify - * @memberof EventStore.Client.Messages.ResolvedEvent - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResolvedEvent.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.event != null && message.hasOwnProperty("event")) { - var error = $root.EventStore.Client.Messages.EventRecord.verify(message.event); - if (error) - return "event." + error; - } - if (message.link != null && message.hasOwnProperty("link")) { - var error = $root.EventStore.Client.Messages.EventRecord.verify(message.link); - if (error) - return "link." + error; - } - if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) - return "commitPosition: integer|Long expected"; - if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) - return "preparePosition: integer|Long expected"; - return null; - }; - - /** - * Creates a ResolvedEvent message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ResolvedEvent - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ResolvedEvent} ResolvedEvent - */ - ResolvedEvent.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ResolvedEvent) - return object; - var message = new $root.EventStore.Client.Messages.ResolvedEvent(); - if (object.event != null) { - if (typeof object.event !== "object") - throw TypeError(".EventStore.Client.Messages.ResolvedEvent.event: object expected"); - message.event = $root.EventStore.Client.Messages.EventRecord.fromObject(object.event); - } - if (object.link != null) { - if (typeof object.link !== "object") - throw TypeError(".EventStore.Client.Messages.ResolvedEvent.link: object expected"); - message.link = $root.EventStore.Client.Messages.EventRecord.fromObject(object.link); - } - if (object.commitPosition != null) - if ($util.Long) - (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; - else if (typeof object.commitPosition === "string") - message.commitPosition = parseInt(object.commitPosition, 10); - else if (typeof object.commitPosition === "number") - message.commitPosition = object.commitPosition; - else if (typeof object.commitPosition === "object") - message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); - if (object.preparePosition != null) - if ($util.Long) - (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; - else if (typeof object.preparePosition === "string") - message.preparePosition = parseInt(object.preparePosition, 10); - else if (typeof object.preparePosition === "number") - message.preparePosition = object.preparePosition; - else if (typeof object.preparePosition === "object") - message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a ResolvedEvent message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ResolvedEvent - * @static - * @param {EventStore.Client.Messages.ResolvedEvent} message ResolvedEvent - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResolvedEvent.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.event = null; - object.link = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.commitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.preparePosition = options.longs === String ? "0" : 0; - } - if (message.event != null && message.hasOwnProperty("event")) - object.event = $root.EventStore.Client.Messages.EventRecord.toObject(message.event, options); - if (message.link != null && message.hasOwnProperty("link")) - object.link = $root.EventStore.Client.Messages.EventRecord.toObject(message.link, options); - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (typeof message.commitPosition === "number") - object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; - else - object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (typeof message.preparePosition === "number") - object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; - else - object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; - return object; - }; - - /** - * Converts this ResolvedEvent to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ResolvedEvent - * @instance - * @returns {Object.} JSON object - */ - ResolvedEvent.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ResolvedEvent - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ResolvedEvent - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ResolvedEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.ResolvedEvent"; - }; - - return ResolvedEvent; - })(); - - Messages.WriteEvents = (function() { - - /** - * Properties of a WriteEvents. - * @memberof EventStore.Client.Messages - * @interface IWriteEvents - * @property {string} eventStreamId WriteEvents eventStreamId - * @property {Long} expectedVersion WriteEvents expectedVersion - * @property {Array.|null} [events] WriteEvents events - * @property {boolean} requireLeader WriteEvents requireLeader - */ - - /** - * Constructs a new WriteEvents. - * @memberof EventStore.Client.Messages - * @classdesc Represents a WriteEvents. - * @implements IWriteEvents - * @constructor - * @param {EventStore.Client.Messages.IWriteEvents=} [properties] Properties to set - */ - function WriteEvents(properties) { - this.events = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * WriteEvents eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.WriteEvents - * @instance - */ - WriteEvents.prototype.eventStreamId = ""; - - /** - * WriteEvents expectedVersion. - * @member {Long} expectedVersion - * @memberof EventStore.Client.Messages.WriteEvents - * @instance - */ - WriteEvents.prototype.expectedVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * WriteEvents events. - * @member {Array.} events - * @memberof EventStore.Client.Messages.WriteEvents - * @instance - */ - WriteEvents.prototype.events = $util.emptyArray; - - /** - * WriteEvents requireLeader. - * @member {boolean} requireLeader - * @memberof EventStore.Client.Messages.WriteEvents - * @instance - */ - WriteEvents.prototype.requireLeader = false; - - /** - * Creates a new WriteEvents instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.WriteEvents - * @static - * @param {EventStore.Client.Messages.IWriteEvents=} [properties] Properties to set - * @returns {EventStore.Client.Messages.WriteEvents} WriteEvents instance - */ - WriteEvents.create = function create(properties) { - return new WriteEvents(properties); - }; - - /** - * Encodes the specified WriteEvents message. Does not implicitly {@link EventStore.Client.Messages.WriteEvents.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.WriteEvents - * @static - * @param {EventStore.Client.Messages.IWriteEvents} message WriteEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WriteEvents.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.expectedVersion); - if (message.events != null && message.events.length) - for (var i = 0; i < message.events.length; ++i) - $root.EventStore.Client.Messages.NewEvent.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.requireLeader); - return writer; - }; - - /** - * Encodes the specified WriteEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.WriteEvents.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.WriteEvents - * @static - * @param {EventStore.Client.Messages.IWriteEvents} message WriteEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WriteEvents.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WriteEvents message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.WriteEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.WriteEvents} WriteEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WriteEvents.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.WriteEvents(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.eventStreamId = reader.string(); - break; - } - case 2: { - message.expectedVersion = reader.int64(); - break; - } - case 3: { - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.EventStore.Client.Messages.NewEvent.decode(reader, reader.uint32())); - break; - } - case 4: { - message.requireLeader = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("expectedVersion")) - throw $util.ProtocolError("missing required 'expectedVersion'", { instance: message }); - if (!message.hasOwnProperty("requireLeader")) - throw $util.ProtocolError("missing required 'requireLeader'", { instance: message }); - return message; - }; - - /** - * Decodes a WriteEvents message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.WriteEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.WriteEvents} WriteEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WriteEvents.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WriteEvents message. - * @function verify - * @memberof EventStore.Client.Messages.WriteEvents - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WriteEvents.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isString(message.eventStreamId)) - return "eventStreamId: string expected"; - if (!$util.isInteger(message.expectedVersion) && !(message.expectedVersion && $util.isInteger(message.expectedVersion.low) && $util.isInteger(message.expectedVersion.high))) - return "expectedVersion: integer|Long expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (var i = 0; i < message.events.length; ++i) { - var error = $root.EventStore.Client.Messages.NewEvent.verify(message.events[i]); - if (error) - return "events." + error; - } - } - if (typeof message.requireLeader !== "boolean") - return "requireLeader: boolean expected"; - return null; - }; - - /** - * Creates a WriteEvents message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.WriteEvents - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.WriteEvents} WriteEvents - */ - WriteEvents.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.WriteEvents) - return object; - var message = new $root.EventStore.Client.Messages.WriteEvents(); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.expectedVersion != null) - if ($util.Long) - (message.expectedVersion = $util.Long.fromValue(object.expectedVersion)).unsigned = false; - else if (typeof object.expectedVersion === "string") - message.expectedVersion = parseInt(object.expectedVersion, 10); - else if (typeof object.expectedVersion === "number") - message.expectedVersion = object.expectedVersion; - else if (typeof object.expectedVersion === "object") - message.expectedVersion = new $util.LongBits(object.expectedVersion.low >>> 0, object.expectedVersion.high >>> 0).toNumber(); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".EventStore.Client.Messages.WriteEvents.events: array expected"); - message.events = []; - for (var i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".EventStore.Client.Messages.WriteEvents.events: object expected"); - message.events[i] = $root.EventStore.Client.Messages.NewEvent.fromObject(object.events[i]); - } - } - if (object.requireLeader != null) - message.requireLeader = Boolean(object.requireLeader); - return message; - }; - - /** - * Creates a plain object from a WriteEvents message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.WriteEvents - * @static - * @param {EventStore.Client.Messages.WriteEvents} message WriteEvents - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WriteEvents.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (options.defaults) { - object.eventStreamId = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.expectedVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.expectedVersion = options.longs === String ? "0" : 0; - object.requireLeader = false; - } - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.expectedVersion != null && message.hasOwnProperty("expectedVersion")) - if (typeof message.expectedVersion === "number") - object.expectedVersion = options.longs === String ? String(message.expectedVersion) : message.expectedVersion; - else - object.expectedVersion = options.longs === String ? $util.Long.prototype.toString.call(message.expectedVersion) : options.longs === Number ? new $util.LongBits(message.expectedVersion.low >>> 0, message.expectedVersion.high >>> 0).toNumber() : message.expectedVersion; - if (message.events && message.events.length) { - object.events = []; - for (var j = 0; j < message.events.length; ++j) - object.events[j] = $root.EventStore.Client.Messages.NewEvent.toObject(message.events[j], options); - } - if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) - object.requireLeader = message.requireLeader; - return object; - }; - - /** - * Converts this WriteEvents to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.WriteEvents - * @instance - * @returns {Object.} JSON object - */ - WriteEvents.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WriteEvents - * @function getTypeUrl - * @memberof EventStore.Client.Messages.WriteEvents - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WriteEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.WriteEvents"; - }; - - return WriteEvents; - })(); - - Messages.WriteEventsCompleted = (function() { - - /** - * Properties of a WriteEventsCompleted. - * @memberof EventStore.Client.Messages - * @interface IWriteEventsCompleted - * @property {EventStore.Client.Messages.OperationResult} result WriteEventsCompleted result - * @property {string|null} [message] WriteEventsCompleted message - * @property {Long} firstEventNumber WriteEventsCompleted firstEventNumber - * @property {Long} lastEventNumber WriteEventsCompleted lastEventNumber - * @property {Long|null} [preparePosition] WriteEventsCompleted preparePosition - * @property {Long|null} [commitPosition] WriteEventsCompleted commitPosition - * @property {Long|null} [currentVersion] WriteEventsCompleted currentVersion - */ - - /** - * Constructs a new WriteEventsCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a WriteEventsCompleted. - * @implements IWriteEventsCompleted - * @constructor - * @param {EventStore.Client.Messages.IWriteEventsCompleted=} [properties] Properties to set - */ - function WriteEventsCompleted(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * WriteEventsCompleted result. - * @member {EventStore.Client.Messages.OperationResult} result - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @instance - */ - WriteEventsCompleted.prototype.result = 0; - - /** - * WriteEventsCompleted message. - * @member {string} message - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @instance - */ - WriteEventsCompleted.prototype.message = ""; - - /** - * WriteEventsCompleted firstEventNumber. - * @member {Long} firstEventNumber - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @instance - */ - WriteEventsCompleted.prototype.firstEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * WriteEventsCompleted lastEventNumber. - * @member {Long} lastEventNumber - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @instance - */ - WriteEventsCompleted.prototype.lastEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * WriteEventsCompleted preparePosition. - * @member {Long} preparePosition - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @instance - */ - WriteEventsCompleted.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * WriteEventsCompleted commitPosition. - * @member {Long} commitPosition - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @instance - */ - WriteEventsCompleted.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * WriteEventsCompleted currentVersion. - * @member {Long} currentVersion - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @instance - */ - WriteEventsCompleted.prototype.currentVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new WriteEventsCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @static - * @param {EventStore.Client.Messages.IWriteEventsCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.WriteEventsCompleted} WriteEventsCompleted instance - */ - WriteEventsCompleted.create = function create(properties) { - return new WriteEventsCompleted(properties); - }; - - /** - * Encodes the specified WriteEventsCompleted message. Does not implicitly {@link EventStore.Client.Messages.WriteEventsCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @static - * @param {EventStore.Client.Messages.IWriteEventsCompleted} message WriteEventsCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WriteEventsCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.firstEventNumber); - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.lastEventNumber); - if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.preparePosition); - if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) - writer.uint32(/* id 6, wireType 0 =*/48).int64(message.commitPosition); - if (message.currentVersion != null && Object.hasOwnProperty.call(message, "currentVersion")) - writer.uint32(/* id 7, wireType 0 =*/56).int64(message.currentVersion); - return writer; - }; - - /** - * Encodes the specified WriteEventsCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.WriteEventsCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @static - * @param {EventStore.Client.Messages.IWriteEventsCompleted} message WriteEventsCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WriteEventsCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WriteEventsCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.WriteEventsCompleted} WriteEventsCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WriteEventsCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.WriteEventsCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.result = reader.int32(); - break; - } - case 2: { - message.message = reader.string(); - break; - } - case 3: { - message.firstEventNumber = reader.int64(); - break; - } - case 4: { - message.lastEventNumber = reader.int64(); - break; - } - case 5: { - message.preparePosition = reader.int64(); - break; - } - case 6: { - message.commitPosition = reader.int64(); - break; - } - case 7: { - message.currentVersion = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); - if (!message.hasOwnProperty("firstEventNumber")) - throw $util.ProtocolError("missing required 'firstEventNumber'", { instance: message }); - if (!message.hasOwnProperty("lastEventNumber")) - throw $util.ProtocolError("missing required 'lastEventNumber'", { instance: message }); - return message; - }; - - /** - * Decodes a WriteEventsCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.WriteEventsCompleted} WriteEventsCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WriteEventsCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WriteEventsCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WriteEventsCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - switch (message.result) { - default: - return "result: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (!$util.isInteger(message.firstEventNumber) && !(message.firstEventNumber && $util.isInteger(message.firstEventNumber.low) && $util.isInteger(message.firstEventNumber.high))) - return "firstEventNumber: integer|Long expected"; - if (!$util.isInteger(message.lastEventNumber) && !(message.lastEventNumber && $util.isInteger(message.lastEventNumber.low) && $util.isInteger(message.lastEventNumber.high))) - return "lastEventNumber: integer|Long expected"; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) - return "preparePosition: integer|Long expected"; - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) - return "commitPosition: integer|Long expected"; - if (message.currentVersion != null && message.hasOwnProperty("currentVersion")) - if (!$util.isInteger(message.currentVersion) && !(message.currentVersion && $util.isInteger(message.currentVersion.low) && $util.isInteger(message.currentVersion.high))) - return "currentVersion: integer|Long expected"; - return null; - }; - - /** - * Creates a WriteEventsCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.WriteEventsCompleted} WriteEventsCompleted - */ - WriteEventsCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.WriteEventsCompleted) - return object; - var message = new $root.EventStore.Client.Messages.WriteEventsCompleted(); - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": - case 0: - message.result = 0; - break; - case "PrepareTimeout": - case 1: - message.result = 1; - break; - case "CommitTimeout": - case 2: - message.result = 2; - break; - case "ForwardTimeout": - case 3: - message.result = 3; - break; - case "WrongExpectedVersion": - case 4: - message.result = 4; - break; - case "StreamDeleted": - case 5: - message.result = 5; - break; - case "InvalidTransaction": - case 6: - message.result = 6; - break; - case "AccessDenied": - case 7: - message.result = 7; - break; - } - if (object.message != null) - message.message = String(object.message); - if (object.firstEventNumber != null) - if ($util.Long) - (message.firstEventNumber = $util.Long.fromValue(object.firstEventNumber)).unsigned = false; - else if (typeof object.firstEventNumber === "string") - message.firstEventNumber = parseInt(object.firstEventNumber, 10); - else if (typeof object.firstEventNumber === "number") - message.firstEventNumber = object.firstEventNumber; - else if (typeof object.firstEventNumber === "object") - message.firstEventNumber = new $util.LongBits(object.firstEventNumber.low >>> 0, object.firstEventNumber.high >>> 0).toNumber(); - if (object.lastEventNumber != null) - if ($util.Long) - (message.lastEventNumber = $util.Long.fromValue(object.lastEventNumber)).unsigned = false; - else if (typeof object.lastEventNumber === "string") - message.lastEventNumber = parseInt(object.lastEventNumber, 10); - else if (typeof object.lastEventNumber === "number") - message.lastEventNumber = object.lastEventNumber; - else if (typeof object.lastEventNumber === "object") - message.lastEventNumber = new $util.LongBits(object.lastEventNumber.low >>> 0, object.lastEventNumber.high >>> 0).toNumber(); - if (object.preparePosition != null) - if ($util.Long) - (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; - else if (typeof object.preparePosition === "string") - message.preparePosition = parseInt(object.preparePosition, 10); - else if (typeof object.preparePosition === "number") - message.preparePosition = object.preparePosition; - else if (typeof object.preparePosition === "object") - message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); - if (object.commitPosition != null) - if ($util.Long) - (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; - else if (typeof object.commitPosition === "string") - message.commitPosition = parseInt(object.commitPosition, 10); - else if (typeof object.commitPosition === "number") - message.commitPosition = object.commitPosition; - else if (typeof object.commitPosition === "object") - message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); - if (object.currentVersion != null) - if ($util.Long) - (message.currentVersion = $util.Long.fromValue(object.currentVersion)).unsigned = false; - else if (typeof object.currentVersion === "string") - message.currentVersion = parseInt(object.currentVersion, 10); - else if (typeof object.currentVersion === "number") - message.currentVersion = object.currentVersion; - else if (typeof object.currentVersion === "object") - message.currentVersion = new $util.LongBits(object.currentVersion.low >>> 0, object.currentVersion.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a WriteEventsCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @static - * @param {EventStore.Client.Messages.WriteEventsCompleted} message WriteEventsCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WriteEventsCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.result = options.enums === String ? "Success" : 0; - object.message = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.firstEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.firstEventNumber = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.lastEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.lastEventNumber = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.preparePosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.commitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.currentVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.currentVersion = options.longs === String ? "0" : 0; - } - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.OperationResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.OperationResult[message.result] : message.result; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.firstEventNumber != null && message.hasOwnProperty("firstEventNumber")) - if (typeof message.firstEventNumber === "number") - object.firstEventNumber = options.longs === String ? String(message.firstEventNumber) : message.firstEventNumber; - else - object.firstEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.firstEventNumber) : options.longs === Number ? new $util.LongBits(message.firstEventNumber.low >>> 0, message.firstEventNumber.high >>> 0).toNumber() : message.firstEventNumber; - if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) - if (typeof message.lastEventNumber === "number") - object.lastEventNumber = options.longs === String ? String(message.lastEventNumber) : message.lastEventNumber; - else - object.lastEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.lastEventNumber) : options.longs === Number ? new $util.LongBits(message.lastEventNumber.low >>> 0, message.lastEventNumber.high >>> 0).toNumber() : message.lastEventNumber; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (typeof message.preparePosition === "number") - object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; - else - object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (typeof message.commitPosition === "number") - object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; - else - object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; - if (message.currentVersion != null && message.hasOwnProperty("currentVersion")) - if (typeof message.currentVersion === "number") - object.currentVersion = options.longs === String ? String(message.currentVersion) : message.currentVersion; - else - object.currentVersion = options.longs === String ? $util.Long.prototype.toString.call(message.currentVersion) : options.longs === Number ? new $util.LongBits(message.currentVersion.low >>> 0, message.currentVersion.high >>> 0).toNumber() : message.currentVersion; - return object; - }; - - /** - * Converts this WriteEventsCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @instance - * @returns {Object.} JSON object - */ - WriteEventsCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WriteEventsCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.WriteEventsCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WriteEventsCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.WriteEventsCompleted"; - }; - - return WriteEventsCompleted; - })(); - - Messages.DeleteStream = (function() { - - /** - * Properties of a DeleteStream. - * @memberof EventStore.Client.Messages - * @interface IDeleteStream - * @property {string} eventStreamId DeleteStream eventStreamId - * @property {Long} expectedVersion DeleteStream expectedVersion - * @property {boolean} requireLeader DeleteStream requireLeader - * @property {boolean|null} [hardDelete] DeleteStream hardDelete - */ - - /** - * Constructs a new DeleteStream. - * @memberof EventStore.Client.Messages - * @classdesc Represents a DeleteStream. - * @implements IDeleteStream - * @constructor - * @param {EventStore.Client.Messages.IDeleteStream=} [properties] Properties to set - */ - function DeleteStream(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DeleteStream eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.DeleteStream - * @instance - */ - DeleteStream.prototype.eventStreamId = ""; - - /** - * DeleteStream expectedVersion. - * @member {Long} expectedVersion - * @memberof EventStore.Client.Messages.DeleteStream - * @instance - */ - DeleteStream.prototype.expectedVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * DeleteStream requireLeader. - * @member {boolean} requireLeader - * @memberof EventStore.Client.Messages.DeleteStream - * @instance - */ - DeleteStream.prototype.requireLeader = false; - - /** - * DeleteStream hardDelete. - * @member {boolean} hardDelete - * @memberof EventStore.Client.Messages.DeleteStream - * @instance - */ - DeleteStream.prototype.hardDelete = false; - - /** - * Creates a new DeleteStream instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.DeleteStream - * @static - * @param {EventStore.Client.Messages.IDeleteStream=} [properties] Properties to set - * @returns {EventStore.Client.Messages.DeleteStream} DeleteStream instance - */ - DeleteStream.create = function create(properties) { - return new DeleteStream(properties); - }; - - /** - * Encodes the specified DeleteStream message. Does not implicitly {@link EventStore.Client.Messages.DeleteStream.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.DeleteStream - * @static - * @param {EventStore.Client.Messages.IDeleteStream} message DeleteStream message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteStream.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.expectedVersion); - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.requireLeader); - if (message.hardDelete != null && Object.hasOwnProperty.call(message, "hardDelete")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.hardDelete); - return writer; - }; - - /** - * Encodes the specified DeleteStream message, length delimited. Does not implicitly {@link EventStore.Client.Messages.DeleteStream.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.DeleteStream - * @static - * @param {EventStore.Client.Messages.IDeleteStream} message DeleteStream message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteStream.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteStream message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.DeleteStream - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.DeleteStream} DeleteStream - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteStream.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.DeleteStream(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.eventStreamId = reader.string(); - break; - } - case 2: { - message.expectedVersion = reader.int64(); - break; - } - case 3: { - message.requireLeader = reader.bool(); - break; - } - case 4: { - message.hardDelete = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("expectedVersion")) - throw $util.ProtocolError("missing required 'expectedVersion'", { instance: message }); - if (!message.hasOwnProperty("requireLeader")) - throw $util.ProtocolError("missing required 'requireLeader'", { instance: message }); - return message; - }; - - /** - * Decodes a DeleteStream message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.DeleteStream - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.DeleteStream} DeleteStream - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteStream.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteStream message. - * @function verify - * @memberof EventStore.Client.Messages.DeleteStream - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteStream.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isString(message.eventStreamId)) - return "eventStreamId: string expected"; - if (!$util.isInteger(message.expectedVersion) && !(message.expectedVersion && $util.isInteger(message.expectedVersion.low) && $util.isInteger(message.expectedVersion.high))) - return "expectedVersion: integer|Long expected"; - if (typeof message.requireLeader !== "boolean") - return "requireLeader: boolean expected"; - if (message.hardDelete != null && message.hasOwnProperty("hardDelete")) - if (typeof message.hardDelete !== "boolean") - return "hardDelete: boolean expected"; - return null; - }; - - /** - * Creates a DeleteStream message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.DeleteStream - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.DeleteStream} DeleteStream - */ - DeleteStream.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.DeleteStream) - return object; - var message = new $root.EventStore.Client.Messages.DeleteStream(); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.expectedVersion != null) - if ($util.Long) - (message.expectedVersion = $util.Long.fromValue(object.expectedVersion)).unsigned = false; - else if (typeof object.expectedVersion === "string") - message.expectedVersion = parseInt(object.expectedVersion, 10); - else if (typeof object.expectedVersion === "number") - message.expectedVersion = object.expectedVersion; - else if (typeof object.expectedVersion === "object") - message.expectedVersion = new $util.LongBits(object.expectedVersion.low >>> 0, object.expectedVersion.high >>> 0).toNumber(); - if (object.requireLeader != null) - message.requireLeader = Boolean(object.requireLeader); - if (object.hardDelete != null) - message.hardDelete = Boolean(object.hardDelete); - return message; - }; - - /** - * Creates a plain object from a DeleteStream message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.DeleteStream - * @static - * @param {EventStore.Client.Messages.DeleteStream} message DeleteStream - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteStream.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.eventStreamId = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.expectedVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.expectedVersion = options.longs === String ? "0" : 0; - object.requireLeader = false; - object.hardDelete = false; - } - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.expectedVersion != null && message.hasOwnProperty("expectedVersion")) - if (typeof message.expectedVersion === "number") - object.expectedVersion = options.longs === String ? String(message.expectedVersion) : message.expectedVersion; - else - object.expectedVersion = options.longs === String ? $util.Long.prototype.toString.call(message.expectedVersion) : options.longs === Number ? new $util.LongBits(message.expectedVersion.low >>> 0, message.expectedVersion.high >>> 0).toNumber() : message.expectedVersion; - if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) - object.requireLeader = message.requireLeader; - if (message.hardDelete != null && message.hasOwnProperty("hardDelete")) - object.hardDelete = message.hardDelete; - return object; - }; - - /** - * Converts this DeleteStream to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.DeleteStream - * @instance - * @returns {Object.} JSON object - */ - DeleteStream.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteStream - * @function getTypeUrl - * @memberof EventStore.Client.Messages.DeleteStream - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteStream.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.DeleteStream"; - }; - - return DeleteStream; - })(); - - Messages.DeleteStreamCompleted = (function() { - - /** - * Properties of a DeleteStreamCompleted. - * @memberof EventStore.Client.Messages - * @interface IDeleteStreamCompleted - * @property {EventStore.Client.Messages.OperationResult} result DeleteStreamCompleted result - * @property {string|null} [message] DeleteStreamCompleted message - * @property {Long|null} [preparePosition] DeleteStreamCompleted preparePosition - * @property {Long|null} [commitPosition] DeleteStreamCompleted commitPosition - * @property {Long|null} [currentVersion] DeleteStreamCompleted currentVersion - */ - - /** - * Constructs a new DeleteStreamCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a DeleteStreamCompleted. - * @implements IDeleteStreamCompleted - * @constructor - * @param {EventStore.Client.Messages.IDeleteStreamCompleted=} [properties] Properties to set - */ - function DeleteStreamCompleted(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DeleteStreamCompleted result. - * @member {EventStore.Client.Messages.OperationResult} result - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @instance - */ - DeleteStreamCompleted.prototype.result = 0; - - /** - * DeleteStreamCompleted message. - * @member {string} message - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @instance - */ - DeleteStreamCompleted.prototype.message = ""; - - /** - * DeleteStreamCompleted preparePosition. - * @member {Long} preparePosition - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @instance - */ - DeleteStreamCompleted.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * DeleteStreamCompleted commitPosition. - * @member {Long} commitPosition - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @instance - */ - DeleteStreamCompleted.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * DeleteStreamCompleted currentVersion. - * @member {Long} currentVersion - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @instance - */ - DeleteStreamCompleted.prototype.currentVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new DeleteStreamCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @static - * @param {EventStore.Client.Messages.IDeleteStreamCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.DeleteStreamCompleted} DeleteStreamCompleted instance - */ - DeleteStreamCompleted.create = function create(properties) { - return new DeleteStreamCompleted(properties); - }; - - /** - * Encodes the specified DeleteStreamCompleted message. Does not implicitly {@link EventStore.Client.Messages.DeleteStreamCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @static - * @param {EventStore.Client.Messages.IDeleteStreamCompleted} message DeleteStreamCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteStreamCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); - if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.preparePosition); - if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.commitPosition); - if (message.currentVersion != null && Object.hasOwnProperty.call(message, "currentVersion")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.currentVersion); - return writer; - }; - - /** - * Encodes the specified DeleteStreamCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.DeleteStreamCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @static - * @param {EventStore.Client.Messages.IDeleteStreamCompleted} message DeleteStreamCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteStreamCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteStreamCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.DeleteStreamCompleted} DeleteStreamCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteStreamCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.DeleteStreamCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.result = reader.int32(); - break; - } - case 2: { - message.message = reader.string(); - break; - } - case 3: { - message.preparePosition = reader.int64(); - break; - } - case 4: { - message.commitPosition = reader.int64(); - break; - } - case 5: { - message.currentVersion = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); - return message; - }; - - /** - * Decodes a DeleteStreamCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.DeleteStreamCompleted} DeleteStreamCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteStreamCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteStreamCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteStreamCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - switch (message.result) { - default: - return "result: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) - return "preparePosition: integer|Long expected"; - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) - return "commitPosition: integer|Long expected"; - if (message.currentVersion != null && message.hasOwnProperty("currentVersion")) - if (!$util.isInteger(message.currentVersion) && !(message.currentVersion && $util.isInteger(message.currentVersion.low) && $util.isInteger(message.currentVersion.high))) - return "currentVersion: integer|Long expected"; - return null; - }; - - /** - * Creates a DeleteStreamCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.DeleteStreamCompleted} DeleteStreamCompleted - */ - DeleteStreamCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.DeleteStreamCompleted) - return object; - var message = new $root.EventStore.Client.Messages.DeleteStreamCompleted(); - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": - case 0: - message.result = 0; - break; - case "PrepareTimeout": - case 1: - message.result = 1; - break; - case "CommitTimeout": - case 2: - message.result = 2; - break; - case "ForwardTimeout": - case 3: - message.result = 3; - break; - case "WrongExpectedVersion": - case 4: - message.result = 4; - break; - case "StreamDeleted": - case 5: - message.result = 5; - break; - case "InvalidTransaction": - case 6: - message.result = 6; - break; - case "AccessDenied": - case 7: - message.result = 7; - break; - } - if (object.message != null) - message.message = String(object.message); - if (object.preparePosition != null) - if ($util.Long) - (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; - else if (typeof object.preparePosition === "string") - message.preparePosition = parseInt(object.preparePosition, 10); - else if (typeof object.preparePosition === "number") - message.preparePosition = object.preparePosition; - else if (typeof object.preparePosition === "object") - message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); - if (object.commitPosition != null) - if ($util.Long) - (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; - else if (typeof object.commitPosition === "string") - message.commitPosition = parseInt(object.commitPosition, 10); - else if (typeof object.commitPosition === "number") - message.commitPosition = object.commitPosition; - else if (typeof object.commitPosition === "object") - message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); - if (object.currentVersion != null) - if ($util.Long) - (message.currentVersion = $util.Long.fromValue(object.currentVersion)).unsigned = false; - else if (typeof object.currentVersion === "string") - message.currentVersion = parseInt(object.currentVersion, 10); - else if (typeof object.currentVersion === "number") - message.currentVersion = object.currentVersion; - else if (typeof object.currentVersion === "object") - message.currentVersion = new $util.LongBits(object.currentVersion.low >>> 0, object.currentVersion.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a DeleteStreamCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @static - * @param {EventStore.Client.Messages.DeleteStreamCompleted} message DeleteStreamCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteStreamCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.result = options.enums === String ? "Success" : 0; - object.message = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.preparePosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.commitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.currentVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.currentVersion = options.longs === String ? "0" : 0; - } - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.OperationResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.OperationResult[message.result] : message.result; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (typeof message.preparePosition === "number") - object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; - else - object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (typeof message.commitPosition === "number") - object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; - else - object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; - if (message.currentVersion != null && message.hasOwnProperty("currentVersion")) - if (typeof message.currentVersion === "number") - object.currentVersion = options.longs === String ? String(message.currentVersion) : message.currentVersion; - else - object.currentVersion = options.longs === String ? $util.Long.prototype.toString.call(message.currentVersion) : options.longs === Number ? new $util.LongBits(message.currentVersion.low >>> 0, message.currentVersion.high >>> 0).toNumber() : message.currentVersion; - return object; - }; - - /** - * Converts this DeleteStreamCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @instance - * @returns {Object.} JSON object - */ - DeleteStreamCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteStreamCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.DeleteStreamCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteStreamCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.DeleteStreamCompleted"; - }; - - return DeleteStreamCompleted; - })(); - - Messages.TransactionStart = (function() { - - /** - * Properties of a TransactionStart. - * @memberof EventStore.Client.Messages - * @interface ITransactionStart - * @property {string} eventStreamId TransactionStart eventStreamId - * @property {Long} expectedVersion TransactionStart expectedVersion - * @property {boolean} requireLeader TransactionStart requireLeader - */ - - /** - * Constructs a new TransactionStart. - * @memberof EventStore.Client.Messages - * @classdesc Represents a TransactionStart. - * @implements ITransactionStart - * @constructor - * @param {EventStore.Client.Messages.ITransactionStart=} [properties] Properties to set - */ - function TransactionStart(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TransactionStart eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.TransactionStart - * @instance - */ - TransactionStart.prototype.eventStreamId = ""; - - /** - * TransactionStart expectedVersion. - * @member {Long} expectedVersion - * @memberof EventStore.Client.Messages.TransactionStart - * @instance - */ - TransactionStart.prototype.expectedVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TransactionStart requireLeader. - * @member {boolean} requireLeader - * @memberof EventStore.Client.Messages.TransactionStart - * @instance - */ - TransactionStart.prototype.requireLeader = false; - - /** - * Creates a new TransactionStart instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.TransactionStart - * @static - * @param {EventStore.Client.Messages.ITransactionStart=} [properties] Properties to set - * @returns {EventStore.Client.Messages.TransactionStart} TransactionStart instance - */ - TransactionStart.create = function create(properties) { - return new TransactionStart(properties); - }; - - /** - * Encodes the specified TransactionStart message. Does not implicitly {@link EventStore.Client.Messages.TransactionStart.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.TransactionStart - * @static - * @param {EventStore.Client.Messages.ITransactionStart} message TransactionStart message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionStart.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.expectedVersion); - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.requireLeader); - return writer; - }; - - /** - * Encodes the specified TransactionStart message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionStart.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.TransactionStart - * @static - * @param {EventStore.Client.Messages.ITransactionStart} message TransactionStart message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionStart.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TransactionStart message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.TransactionStart - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.TransactionStart} TransactionStart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionStart.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionStart(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.eventStreamId = reader.string(); - break; - } - case 2: { - message.expectedVersion = reader.int64(); - break; - } - case 3: { - message.requireLeader = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("expectedVersion")) - throw $util.ProtocolError("missing required 'expectedVersion'", { instance: message }); - if (!message.hasOwnProperty("requireLeader")) - throw $util.ProtocolError("missing required 'requireLeader'", { instance: message }); - return message; - }; - - /** - * Decodes a TransactionStart message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.TransactionStart - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.TransactionStart} TransactionStart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionStart.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TransactionStart message. - * @function verify - * @memberof EventStore.Client.Messages.TransactionStart - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TransactionStart.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isString(message.eventStreamId)) - return "eventStreamId: string expected"; - if (!$util.isInteger(message.expectedVersion) && !(message.expectedVersion && $util.isInteger(message.expectedVersion.low) && $util.isInteger(message.expectedVersion.high))) - return "expectedVersion: integer|Long expected"; - if (typeof message.requireLeader !== "boolean") - return "requireLeader: boolean expected"; - return null; - }; - - /** - * Creates a TransactionStart message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.TransactionStart - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.TransactionStart} TransactionStart - */ - TransactionStart.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.TransactionStart) - return object; - var message = new $root.EventStore.Client.Messages.TransactionStart(); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.expectedVersion != null) - if ($util.Long) - (message.expectedVersion = $util.Long.fromValue(object.expectedVersion)).unsigned = false; - else if (typeof object.expectedVersion === "string") - message.expectedVersion = parseInt(object.expectedVersion, 10); - else if (typeof object.expectedVersion === "number") - message.expectedVersion = object.expectedVersion; - else if (typeof object.expectedVersion === "object") - message.expectedVersion = new $util.LongBits(object.expectedVersion.low >>> 0, object.expectedVersion.high >>> 0).toNumber(); - if (object.requireLeader != null) - message.requireLeader = Boolean(object.requireLeader); - return message; - }; - - /** - * Creates a plain object from a TransactionStart message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.TransactionStart - * @static - * @param {EventStore.Client.Messages.TransactionStart} message TransactionStart - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TransactionStart.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.eventStreamId = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.expectedVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.expectedVersion = options.longs === String ? "0" : 0; - object.requireLeader = false; - } - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.expectedVersion != null && message.hasOwnProperty("expectedVersion")) - if (typeof message.expectedVersion === "number") - object.expectedVersion = options.longs === String ? String(message.expectedVersion) : message.expectedVersion; - else - object.expectedVersion = options.longs === String ? $util.Long.prototype.toString.call(message.expectedVersion) : options.longs === Number ? new $util.LongBits(message.expectedVersion.low >>> 0, message.expectedVersion.high >>> 0).toNumber() : message.expectedVersion; - if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) - object.requireLeader = message.requireLeader; - return object; - }; - - /** - * Converts this TransactionStart to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.TransactionStart - * @instance - * @returns {Object.} JSON object - */ - TransactionStart.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TransactionStart - * @function getTypeUrl - * @memberof EventStore.Client.Messages.TransactionStart - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TransactionStart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.TransactionStart"; - }; - - return TransactionStart; - })(); - - Messages.TransactionStartCompleted = (function() { - - /** - * Properties of a TransactionStartCompleted. - * @memberof EventStore.Client.Messages - * @interface ITransactionStartCompleted - * @property {Long} transactionId TransactionStartCompleted transactionId - * @property {EventStore.Client.Messages.OperationResult} result TransactionStartCompleted result - * @property {string|null} [message] TransactionStartCompleted message - */ - - /** - * Constructs a new TransactionStartCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a TransactionStartCompleted. - * @implements ITransactionStartCompleted - * @constructor - * @param {EventStore.Client.Messages.ITransactionStartCompleted=} [properties] Properties to set - */ - function TransactionStartCompleted(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TransactionStartCompleted transactionId. - * @member {Long} transactionId - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @instance - */ - TransactionStartCompleted.prototype.transactionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TransactionStartCompleted result. - * @member {EventStore.Client.Messages.OperationResult} result - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @instance - */ - TransactionStartCompleted.prototype.result = 0; - - /** - * TransactionStartCompleted message. - * @member {string} message - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @instance - */ - TransactionStartCompleted.prototype.message = ""; - - /** - * Creates a new TransactionStartCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @static - * @param {EventStore.Client.Messages.ITransactionStartCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.TransactionStartCompleted} TransactionStartCompleted instance - */ - TransactionStartCompleted.create = function create(properties) { - return new TransactionStartCompleted(properties); - }; - - /** - * Encodes the specified TransactionStartCompleted message. Does not implicitly {@link EventStore.Client.Messages.TransactionStartCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @static - * @param {EventStore.Client.Messages.ITransactionStartCompleted} message TransactionStartCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionStartCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.transactionId); - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); - return writer; - }; - - /** - * Encodes the specified TransactionStartCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionStartCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @static - * @param {EventStore.Client.Messages.ITransactionStartCompleted} message TransactionStartCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionStartCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TransactionStartCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.TransactionStartCompleted} TransactionStartCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionStartCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionStartCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.transactionId = reader.int64(); - break; - } - case 2: { - message.result = reader.int32(); - break; - } - case 3: { - message.message = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("transactionId")) - throw $util.ProtocolError("missing required 'transactionId'", { instance: message }); - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); - return message; - }; - - /** - * Decodes a TransactionStartCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.TransactionStartCompleted} TransactionStartCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionStartCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TransactionStartCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TransactionStartCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isInteger(message.transactionId) && !(message.transactionId && $util.isInteger(message.transactionId.low) && $util.isInteger(message.transactionId.high))) - return "transactionId: integer|Long expected"; - switch (message.result) { - default: - return "result: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - return null; - }; - - /** - * Creates a TransactionStartCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.TransactionStartCompleted} TransactionStartCompleted - */ - TransactionStartCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.TransactionStartCompleted) - return object; - var message = new $root.EventStore.Client.Messages.TransactionStartCompleted(); - if (object.transactionId != null) - if ($util.Long) - (message.transactionId = $util.Long.fromValue(object.transactionId)).unsigned = false; - else if (typeof object.transactionId === "string") - message.transactionId = parseInt(object.transactionId, 10); - else if (typeof object.transactionId === "number") - message.transactionId = object.transactionId; - else if (typeof object.transactionId === "object") - message.transactionId = new $util.LongBits(object.transactionId.low >>> 0, object.transactionId.high >>> 0).toNumber(); - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": - case 0: - message.result = 0; - break; - case "PrepareTimeout": - case 1: - message.result = 1; - break; - case "CommitTimeout": - case 2: - message.result = 2; - break; - case "ForwardTimeout": - case 3: - message.result = 3; - break; - case "WrongExpectedVersion": - case 4: - message.result = 4; - break; - case "StreamDeleted": - case 5: - message.result = 5; - break; - case "InvalidTransaction": - case 6: - message.result = 6; - break; - case "AccessDenied": - case 7: - message.result = 7; - break; - } - if (object.message != null) - message.message = String(object.message); - return message; - }; - - /** - * Creates a plain object from a TransactionStartCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @static - * @param {EventStore.Client.Messages.TransactionStartCompleted} message TransactionStartCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TransactionStartCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.transactionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.transactionId = options.longs === String ? "0" : 0; - object.result = options.enums === String ? "Success" : 0; - object.message = ""; - } - if (message.transactionId != null && message.hasOwnProperty("transactionId")) - if (typeof message.transactionId === "number") - object.transactionId = options.longs === String ? String(message.transactionId) : message.transactionId; - else - object.transactionId = options.longs === String ? $util.Long.prototype.toString.call(message.transactionId) : options.longs === Number ? new $util.LongBits(message.transactionId.low >>> 0, message.transactionId.high >>> 0).toNumber() : message.transactionId; - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.OperationResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.OperationResult[message.result] : message.result; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - return object; - }; - - /** - * Converts this TransactionStartCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @instance - * @returns {Object.} JSON object - */ - TransactionStartCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TransactionStartCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.TransactionStartCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TransactionStartCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.TransactionStartCompleted"; - }; - - return TransactionStartCompleted; - })(); - - Messages.TransactionWrite = (function() { - - /** - * Properties of a TransactionWrite. - * @memberof EventStore.Client.Messages - * @interface ITransactionWrite - * @property {Long} transactionId TransactionWrite transactionId - * @property {Array.|null} [events] TransactionWrite events - * @property {boolean} requireLeader TransactionWrite requireLeader - */ - - /** - * Constructs a new TransactionWrite. - * @memberof EventStore.Client.Messages - * @classdesc Represents a TransactionWrite. - * @implements ITransactionWrite - * @constructor - * @param {EventStore.Client.Messages.ITransactionWrite=} [properties] Properties to set - */ - function TransactionWrite(properties) { - this.events = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TransactionWrite transactionId. - * @member {Long} transactionId - * @memberof EventStore.Client.Messages.TransactionWrite - * @instance - */ - TransactionWrite.prototype.transactionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TransactionWrite events. - * @member {Array.} events - * @memberof EventStore.Client.Messages.TransactionWrite - * @instance - */ - TransactionWrite.prototype.events = $util.emptyArray; - - /** - * TransactionWrite requireLeader. - * @member {boolean} requireLeader - * @memberof EventStore.Client.Messages.TransactionWrite - * @instance - */ - TransactionWrite.prototype.requireLeader = false; - - /** - * Creates a new TransactionWrite instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.TransactionWrite - * @static - * @param {EventStore.Client.Messages.ITransactionWrite=} [properties] Properties to set - * @returns {EventStore.Client.Messages.TransactionWrite} TransactionWrite instance - */ - TransactionWrite.create = function create(properties) { - return new TransactionWrite(properties); - }; - - /** - * Encodes the specified TransactionWrite message. Does not implicitly {@link EventStore.Client.Messages.TransactionWrite.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.TransactionWrite - * @static - * @param {EventStore.Client.Messages.ITransactionWrite} message TransactionWrite message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionWrite.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.transactionId); - if (message.events != null && message.events.length) - for (var i = 0; i < message.events.length; ++i) - $root.EventStore.Client.Messages.NewEvent.encode(message.events[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.requireLeader); - return writer; - }; - - /** - * Encodes the specified TransactionWrite message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionWrite.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.TransactionWrite - * @static - * @param {EventStore.Client.Messages.ITransactionWrite} message TransactionWrite message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionWrite.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TransactionWrite message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.TransactionWrite - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.TransactionWrite} TransactionWrite - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionWrite.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionWrite(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.transactionId = reader.int64(); - break; - } - case 2: { - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.EventStore.Client.Messages.NewEvent.decode(reader, reader.uint32())); - break; - } - case 3: { - message.requireLeader = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("transactionId")) - throw $util.ProtocolError("missing required 'transactionId'", { instance: message }); - if (!message.hasOwnProperty("requireLeader")) - throw $util.ProtocolError("missing required 'requireLeader'", { instance: message }); - return message; - }; - - /** - * Decodes a TransactionWrite message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.TransactionWrite - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.TransactionWrite} TransactionWrite - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionWrite.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TransactionWrite message. - * @function verify - * @memberof EventStore.Client.Messages.TransactionWrite - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TransactionWrite.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isInteger(message.transactionId) && !(message.transactionId && $util.isInteger(message.transactionId.low) && $util.isInteger(message.transactionId.high))) - return "transactionId: integer|Long expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (var i = 0; i < message.events.length; ++i) { - var error = $root.EventStore.Client.Messages.NewEvent.verify(message.events[i]); - if (error) - return "events." + error; - } - } - if (typeof message.requireLeader !== "boolean") - return "requireLeader: boolean expected"; - return null; - }; - - /** - * Creates a TransactionWrite message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.TransactionWrite - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.TransactionWrite} TransactionWrite - */ - TransactionWrite.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.TransactionWrite) - return object; - var message = new $root.EventStore.Client.Messages.TransactionWrite(); - if (object.transactionId != null) - if ($util.Long) - (message.transactionId = $util.Long.fromValue(object.transactionId)).unsigned = false; - else if (typeof object.transactionId === "string") - message.transactionId = parseInt(object.transactionId, 10); - else if (typeof object.transactionId === "number") - message.transactionId = object.transactionId; - else if (typeof object.transactionId === "object") - message.transactionId = new $util.LongBits(object.transactionId.low >>> 0, object.transactionId.high >>> 0).toNumber(); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".EventStore.Client.Messages.TransactionWrite.events: array expected"); - message.events = []; - for (var i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".EventStore.Client.Messages.TransactionWrite.events: object expected"); - message.events[i] = $root.EventStore.Client.Messages.NewEvent.fromObject(object.events[i]); - } - } - if (object.requireLeader != null) - message.requireLeader = Boolean(object.requireLeader); - return message; - }; - - /** - * Creates a plain object from a TransactionWrite message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.TransactionWrite - * @static - * @param {EventStore.Client.Messages.TransactionWrite} message TransactionWrite - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TransactionWrite.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.transactionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.transactionId = options.longs === String ? "0" : 0; - object.requireLeader = false; - } - if (message.transactionId != null && message.hasOwnProperty("transactionId")) - if (typeof message.transactionId === "number") - object.transactionId = options.longs === String ? String(message.transactionId) : message.transactionId; - else - object.transactionId = options.longs === String ? $util.Long.prototype.toString.call(message.transactionId) : options.longs === Number ? new $util.LongBits(message.transactionId.low >>> 0, message.transactionId.high >>> 0).toNumber() : message.transactionId; - if (message.events && message.events.length) { - object.events = []; - for (var j = 0; j < message.events.length; ++j) - object.events[j] = $root.EventStore.Client.Messages.NewEvent.toObject(message.events[j], options); - } - if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) - object.requireLeader = message.requireLeader; - return object; - }; - - /** - * Converts this TransactionWrite to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.TransactionWrite - * @instance - * @returns {Object.} JSON object - */ - TransactionWrite.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TransactionWrite - * @function getTypeUrl - * @memberof EventStore.Client.Messages.TransactionWrite - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TransactionWrite.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.TransactionWrite"; - }; - - return TransactionWrite; - })(); - - Messages.TransactionWriteCompleted = (function() { - - /** - * Properties of a TransactionWriteCompleted. - * @memberof EventStore.Client.Messages - * @interface ITransactionWriteCompleted - * @property {Long} transactionId TransactionWriteCompleted transactionId - * @property {EventStore.Client.Messages.OperationResult} result TransactionWriteCompleted result - * @property {string|null} [message] TransactionWriteCompleted message - */ - - /** - * Constructs a new TransactionWriteCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a TransactionWriteCompleted. - * @implements ITransactionWriteCompleted - * @constructor - * @param {EventStore.Client.Messages.ITransactionWriteCompleted=} [properties] Properties to set - */ - function TransactionWriteCompleted(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TransactionWriteCompleted transactionId. - * @member {Long} transactionId - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @instance - */ - TransactionWriteCompleted.prototype.transactionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TransactionWriteCompleted result. - * @member {EventStore.Client.Messages.OperationResult} result - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @instance - */ - TransactionWriteCompleted.prototype.result = 0; - - /** - * TransactionWriteCompleted message. - * @member {string} message - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @instance - */ - TransactionWriteCompleted.prototype.message = ""; - - /** - * Creates a new TransactionWriteCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @static - * @param {EventStore.Client.Messages.ITransactionWriteCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.TransactionWriteCompleted} TransactionWriteCompleted instance - */ - TransactionWriteCompleted.create = function create(properties) { - return new TransactionWriteCompleted(properties); - }; - - /** - * Encodes the specified TransactionWriteCompleted message. Does not implicitly {@link EventStore.Client.Messages.TransactionWriteCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @static - * @param {EventStore.Client.Messages.ITransactionWriteCompleted} message TransactionWriteCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionWriteCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.transactionId); - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); - return writer; - }; - - /** - * Encodes the specified TransactionWriteCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionWriteCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @static - * @param {EventStore.Client.Messages.ITransactionWriteCompleted} message TransactionWriteCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionWriteCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TransactionWriteCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.TransactionWriteCompleted} TransactionWriteCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionWriteCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionWriteCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.transactionId = reader.int64(); - break; - } - case 2: { - message.result = reader.int32(); - break; - } - case 3: { - message.message = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("transactionId")) - throw $util.ProtocolError("missing required 'transactionId'", { instance: message }); - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); - return message; - }; - - /** - * Decodes a TransactionWriteCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.TransactionWriteCompleted} TransactionWriteCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionWriteCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TransactionWriteCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TransactionWriteCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isInteger(message.transactionId) && !(message.transactionId && $util.isInteger(message.transactionId.low) && $util.isInteger(message.transactionId.high))) - return "transactionId: integer|Long expected"; - switch (message.result) { - default: - return "result: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - return null; - }; - - /** - * Creates a TransactionWriteCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.TransactionWriteCompleted} TransactionWriteCompleted - */ - TransactionWriteCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.TransactionWriteCompleted) - return object; - var message = new $root.EventStore.Client.Messages.TransactionWriteCompleted(); - if (object.transactionId != null) - if ($util.Long) - (message.transactionId = $util.Long.fromValue(object.transactionId)).unsigned = false; - else if (typeof object.transactionId === "string") - message.transactionId = parseInt(object.transactionId, 10); - else if (typeof object.transactionId === "number") - message.transactionId = object.transactionId; - else if (typeof object.transactionId === "object") - message.transactionId = new $util.LongBits(object.transactionId.low >>> 0, object.transactionId.high >>> 0).toNumber(); - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": - case 0: - message.result = 0; - break; - case "PrepareTimeout": - case 1: - message.result = 1; - break; - case "CommitTimeout": - case 2: - message.result = 2; - break; - case "ForwardTimeout": - case 3: - message.result = 3; - break; - case "WrongExpectedVersion": - case 4: - message.result = 4; - break; - case "StreamDeleted": - case 5: - message.result = 5; - break; - case "InvalidTransaction": - case 6: - message.result = 6; - break; - case "AccessDenied": - case 7: - message.result = 7; - break; - } - if (object.message != null) - message.message = String(object.message); - return message; - }; - - /** - * Creates a plain object from a TransactionWriteCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @static - * @param {EventStore.Client.Messages.TransactionWriteCompleted} message TransactionWriteCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TransactionWriteCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.transactionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.transactionId = options.longs === String ? "0" : 0; - object.result = options.enums === String ? "Success" : 0; - object.message = ""; - } - if (message.transactionId != null && message.hasOwnProperty("transactionId")) - if (typeof message.transactionId === "number") - object.transactionId = options.longs === String ? String(message.transactionId) : message.transactionId; - else - object.transactionId = options.longs === String ? $util.Long.prototype.toString.call(message.transactionId) : options.longs === Number ? new $util.LongBits(message.transactionId.low >>> 0, message.transactionId.high >>> 0).toNumber() : message.transactionId; - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.OperationResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.OperationResult[message.result] : message.result; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - return object; - }; - - /** - * Converts this TransactionWriteCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @instance - * @returns {Object.} JSON object - */ - TransactionWriteCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TransactionWriteCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.TransactionWriteCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TransactionWriteCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.TransactionWriteCompleted"; - }; - - return TransactionWriteCompleted; - })(); - - Messages.TransactionCommit = (function() { - - /** - * Properties of a TransactionCommit. - * @memberof EventStore.Client.Messages - * @interface ITransactionCommit - * @property {Long} transactionId TransactionCommit transactionId - * @property {boolean} requireLeader TransactionCommit requireLeader - */ - - /** - * Constructs a new TransactionCommit. - * @memberof EventStore.Client.Messages - * @classdesc Represents a TransactionCommit. - * @implements ITransactionCommit - * @constructor - * @param {EventStore.Client.Messages.ITransactionCommit=} [properties] Properties to set - */ - function TransactionCommit(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TransactionCommit transactionId. - * @member {Long} transactionId - * @memberof EventStore.Client.Messages.TransactionCommit - * @instance - */ - TransactionCommit.prototype.transactionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TransactionCommit requireLeader. - * @member {boolean} requireLeader - * @memberof EventStore.Client.Messages.TransactionCommit - * @instance - */ - TransactionCommit.prototype.requireLeader = false; - - /** - * Creates a new TransactionCommit instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.TransactionCommit - * @static - * @param {EventStore.Client.Messages.ITransactionCommit=} [properties] Properties to set - * @returns {EventStore.Client.Messages.TransactionCommit} TransactionCommit instance - */ - TransactionCommit.create = function create(properties) { - return new TransactionCommit(properties); - }; - - /** - * Encodes the specified TransactionCommit message. Does not implicitly {@link EventStore.Client.Messages.TransactionCommit.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.TransactionCommit - * @static - * @param {EventStore.Client.Messages.ITransactionCommit} message TransactionCommit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionCommit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.transactionId); - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.requireLeader); - return writer; - }; - - /** - * Encodes the specified TransactionCommit message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionCommit.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.TransactionCommit - * @static - * @param {EventStore.Client.Messages.ITransactionCommit} message TransactionCommit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionCommit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TransactionCommit message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.TransactionCommit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.TransactionCommit} TransactionCommit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionCommit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionCommit(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.transactionId = reader.int64(); - break; - } - case 2: { - message.requireLeader = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("transactionId")) - throw $util.ProtocolError("missing required 'transactionId'", { instance: message }); - if (!message.hasOwnProperty("requireLeader")) - throw $util.ProtocolError("missing required 'requireLeader'", { instance: message }); - return message; - }; - - /** - * Decodes a TransactionCommit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.TransactionCommit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.TransactionCommit} TransactionCommit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionCommit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TransactionCommit message. - * @function verify - * @memberof EventStore.Client.Messages.TransactionCommit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TransactionCommit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isInteger(message.transactionId) && !(message.transactionId && $util.isInteger(message.transactionId.low) && $util.isInteger(message.transactionId.high))) - return "transactionId: integer|Long expected"; - if (typeof message.requireLeader !== "boolean") - return "requireLeader: boolean expected"; - return null; - }; - - /** - * Creates a TransactionCommit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.TransactionCommit - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.TransactionCommit} TransactionCommit - */ - TransactionCommit.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.TransactionCommit) - return object; - var message = new $root.EventStore.Client.Messages.TransactionCommit(); - if (object.transactionId != null) - if ($util.Long) - (message.transactionId = $util.Long.fromValue(object.transactionId)).unsigned = false; - else if (typeof object.transactionId === "string") - message.transactionId = parseInt(object.transactionId, 10); - else if (typeof object.transactionId === "number") - message.transactionId = object.transactionId; - else if (typeof object.transactionId === "object") - message.transactionId = new $util.LongBits(object.transactionId.low >>> 0, object.transactionId.high >>> 0).toNumber(); - if (object.requireLeader != null) - message.requireLeader = Boolean(object.requireLeader); - return message; - }; - - /** - * Creates a plain object from a TransactionCommit message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.TransactionCommit - * @static - * @param {EventStore.Client.Messages.TransactionCommit} message TransactionCommit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TransactionCommit.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.transactionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.transactionId = options.longs === String ? "0" : 0; - object.requireLeader = false; - } - if (message.transactionId != null && message.hasOwnProperty("transactionId")) - if (typeof message.transactionId === "number") - object.transactionId = options.longs === String ? String(message.transactionId) : message.transactionId; - else - object.transactionId = options.longs === String ? $util.Long.prototype.toString.call(message.transactionId) : options.longs === Number ? new $util.LongBits(message.transactionId.low >>> 0, message.transactionId.high >>> 0).toNumber() : message.transactionId; - if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) - object.requireLeader = message.requireLeader; - return object; - }; - - /** - * Converts this TransactionCommit to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.TransactionCommit - * @instance - * @returns {Object.} JSON object - */ - TransactionCommit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TransactionCommit - * @function getTypeUrl - * @memberof EventStore.Client.Messages.TransactionCommit - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TransactionCommit.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.TransactionCommit"; - }; - - return TransactionCommit; - })(); - - Messages.TransactionCommitCompleted = (function() { - - /** - * Properties of a TransactionCommitCompleted. - * @memberof EventStore.Client.Messages - * @interface ITransactionCommitCompleted - * @property {Long} transactionId TransactionCommitCompleted transactionId - * @property {EventStore.Client.Messages.OperationResult} result TransactionCommitCompleted result - * @property {string|null} [message] TransactionCommitCompleted message - * @property {Long} firstEventNumber TransactionCommitCompleted firstEventNumber - * @property {Long} lastEventNumber TransactionCommitCompleted lastEventNumber - * @property {Long|null} [preparePosition] TransactionCommitCompleted preparePosition - * @property {Long|null} [commitPosition] TransactionCommitCompleted commitPosition - */ - - /** - * Constructs a new TransactionCommitCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a TransactionCommitCompleted. - * @implements ITransactionCommitCompleted - * @constructor - * @param {EventStore.Client.Messages.ITransactionCommitCompleted=} [properties] Properties to set - */ - function TransactionCommitCompleted(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TransactionCommitCompleted transactionId. - * @member {Long} transactionId - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @instance - */ - TransactionCommitCompleted.prototype.transactionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TransactionCommitCompleted result. - * @member {EventStore.Client.Messages.OperationResult} result - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @instance - */ - TransactionCommitCompleted.prototype.result = 0; - - /** - * TransactionCommitCompleted message. - * @member {string} message - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @instance - */ - TransactionCommitCompleted.prototype.message = ""; - - /** - * TransactionCommitCompleted firstEventNumber. - * @member {Long} firstEventNumber - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @instance - */ - TransactionCommitCompleted.prototype.firstEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TransactionCommitCompleted lastEventNumber. - * @member {Long} lastEventNumber - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @instance - */ - TransactionCommitCompleted.prototype.lastEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TransactionCommitCompleted preparePosition. - * @member {Long} preparePosition - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @instance - */ - TransactionCommitCompleted.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TransactionCommitCompleted commitPosition. - * @member {Long} commitPosition - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @instance - */ - TransactionCommitCompleted.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new TransactionCommitCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @static - * @param {EventStore.Client.Messages.ITransactionCommitCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.TransactionCommitCompleted} TransactionCommitCompleted instance - */ - TransactionCommitCompleted.create = function create(properties) { - return new TransactionCommitCompleted(properties); - }; - - /** - * Encodes the specified TransactionCommitCompleted message. Does not implicitly {@link EventStore.Client.Messages.TransactionCommitCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @static - * @param {EventStore.Client.Messages.ITransactionCommitCompleted} message TransactionCommitCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionCommitCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.transactionId); - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.firstEventNumber); - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.lastEventNumber); - if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) - writer.uint32(/* id 6, wireType 0 =*/48).int64(message.preparePosition); - if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) - writer.uint32(/* id 7, wireType 0 =*/56).int64(message.commitPosition); - return writer; - }; - - /** - * Encodes the specified TransactionCommitCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.TransactionCommitCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @static - * @param {EventStore.Client.Messages.ITransactionCommitCompleted} message TransactionCommitCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TransactionCommitCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TransactionCommitCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.TransactionCommitCompleted} TransactionCommitCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionCommitCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.TransactionCommitCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.transactionId = reader.int64(); - break; - } - case 2: { - message.result = reader.int32(); - break; - } - case 3: { - message.message = reader.string(); - break; - } - case 4: { - message.firstEventNumber = reader.int64(); - break; - } - case 5: { - message.lastEventNumber = reader.int64(); - break; - } - case 6: { - message.preparePosition = reader.int64(); - break; - } - case 7: { - message.commitPosition = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("transactionId")) - throw $util.ProtocolError("missing required 'transactionId'", { instance: message }); - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); - if (!message.hasOwnProperty("firstEventNumber")) - throw $util.ProtocolError("missing required 'firstEventNumber'", { instance: message }); - if (!message.hasOwnProperty("lastEventNumber")) - throw $util.ProtocolError("missing required 'lastEventNumber'", { instance: message }); - return message; - }; - - /** - * Decodes a TransactionCommitCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.TransactionCommitCompleted} TransactionCommitCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TransactionCommitCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TransactionCommitCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TransactionCommitCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isInteger(message.transactionId) && !(message.transactionId && $util.isInteger(message.transactionId.low) && $util.isInteger(message.transactionId.high))) - return "transactionId: integer|Long expected"; - switch (message.result) { - default: - return "result: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (!$util.isInteger(message.firstEventNumber) && !(message.firstEventNumber && $util.isInteger(message.firstEventNumber.low) && $util.isInteger(message.firstEventNumber.high))) - return "firstEventNumber: integer|Long expected"; - if (!$util.isInteger(message.lastEventNumber) && !(message.lastEventNumber && $util.isInteger(message.lastEventNumber.low) && $util.isInteger(message.lastEventNumber.high))) - return "lastEventNumber: integer|Long expected"; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) - return "preparePosition: integer|Long expected"; - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) - return "commitPosition: integer|Long expected"; - return null; - }; - - /** - * Creates a TransactionCommitCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.TransactionCommitCompleted} TransactionCommitCompleted - */ - TransactionCommitCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.TransactionCommitCompleted) - return object; - var message = new $root.EventStore.Client.Messages.TransactionCommitCompleted(); - if (object.transactionId != null) - if ($util.Long) - (message.transactionId = $util.Long.fromValue(object.transactionId)).unsigned = false; - else if (typeof object.transactionId === "string") - message.transactionId = parseInt(object.transactionId, 10); - else if (typeof object.transactionId === "number") - message.transactionId = object.transactionId; - else if (typeof object.transactionId === "object") - message.transactionId = new $util.LongBits(object.transactionId.low >>> 0, object.transactionId.high >>> 0).toNumber(); - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": - case 0: - message.result = 0; - break; - case "PrepareTimeout": - case 1: - message.result = 1; - break; - case "CommitTimeout": - case 2: - message.result = 2; - break; - case "ForwardTimeout": - case 3: - message.result = 3; - break; - case "WrongExpectedVersion": - case 4: - message.result = 4; - break; - case "StreamDeleted": - case 5: - message.result = 5; - break; - case "InvalidTransaction": - case 6: - message.result = 6; - break; - case "AccessDenied": - case 7: - message.result = 7; - break; - } - if (object.message != null) - message.message = String(object.message); - if (object.firstEventNumber != null) - if ($util.Long) - (message.firstEventNumber = $util.Long.fromValue(object.firstEventNumber)).unsigned = false; - else if (typeof object.firstEventNumber === "string") - message.firstEventNumber = parseInt(object.firstEventNumber, 10); - else if (typeof object.firstEventNumber === "number") - message.firstEventNumber = object.firstEventNumber; - else if (typeof object.firstEventNumber === "object") - message.firstEventNumber = new $util.LongBits(object.firstEventNumber.low >>> 0, object.firstEventNumber.high >>> 0).toNumber(); - if (object.lastEventNumber != null) - if ($util.Long) - (message.lastEventNumber = $util.Long.fromValue(object.lastEventNumber)).unsigned = false; - else if (typeof object.lastEventNumber === "string") - message.lastEventNumber = parseInt(object.lastEventNumber, 10); - else if (typeof object.lastEventNumber === "number") - message.lastEventNumber = object.lastEventNumber; - else if (typeof object.lastEventNumber === "object") - message.lastEventNumber = new $util.LongBits(object.lastEventNumber.low >>> 0, object.lastEventNumber.high >>> 0).toNumber(); - if (object.preparePosition != null) - if ($util.Long) - (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; - else if (typeof object.preparePosition === "string") - message.preparePosition = parseInt(object.preparePosition, 10); - else if (typeof object.preparePosition === "number") - message.preparePosition = object.preparePosition; - else if (typeof object.preparePosition === "object") - message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); - if (object.commitPosition != null) - if ($util.Long) - (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; - else if (typeof object.commitPosition === "string") - message.commitPosition = parseInt(object.commitPosition, 10); - else if (typeof object.commitPosition === "number") - message.commitPosition = object.commitPosition; - else if (typeof object.commitPosition === "object") - message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a TransactionCommitCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @static - * @param {EventStore.Client.Messages.TransactionCommitCompleted} message TransactionCommitCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TransactionCommitCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.transactionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.transactionId = options.longs === String ? "0" : 0; - object.result = options.enums === String ? "Success" : 0; - object.message = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.firstEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.firstEventNumber = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.lastEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.lastEventNumber = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.preparePosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.commitPosition = options.longs === String ? "0" : 0; - } - if (message.transactionId != null && message.hasOwnProperty("transactionId")) - if (typeof message.transactionId === "number") - object.transactionId = options.longs === String ? String(message.transactionId) : message.transactionId; - else - object.transactionId = options.longs === String ? $util.Long.prototype.toString.call(message.transactionId) : options.longs === Number ? new $util.LongBits(message.transactionId.low >>> 0, message.transactionId.high >>> 0).toNumber() : message.transactionId; - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.OperationResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.OperationResult[message.result] : message.result; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.firstEventNumber != null && message.hasOwnProperty("firstEventNumber")) - if (typeof message.firstEventNumber === "number") - object.firstEventNumber = options.longs === String ? String(message.firstEventNumber) : message.firstEventNumber; - else - object.firstEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.firstEventNumber) : options.longs === Number ? new $util.LongBits(message.firstEventNumber.low >>> 0, message.firstEventNumber.high >>> 0).toNumber() : message.firstEventNumber; - if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) - if (typeof message.lastEventNumber === "number") - object.lastEventNumber = options.longs === String ? String(message.lastEventNumber) : message.lastEventNumber; - else - object.lastEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.lastEventNumber) : options.longs === Number ? new $util.LongBits(message.lastEventNumber.low >>> 0, message.lastEventNumber.high >>> 0).toNumber() : message.lastEventNumber; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (typeof message.preparePosition === "number") - object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; - else - object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (typeof message.commitPosition === "number") - object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; - else - object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; - return object; - }; - - /** - * Converts this TransactionCommitCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @instance - * @returns {Object.} JSON object - */ - TransactionCommitCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TransactionCommitCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.TransactionCommitCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TransactionCommitCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.TransactionCommitCompleted"; - }; - - return TransactionCommitCompleted; - })(); - - Messages.ReadEvent = (function() { - - /** - * Properties of a ReadEvent. - * @memberof EventStore.Client.Messages - * @interface IReadEvent - * @property {string} eventStreamId ReadEvent eventStreamId - * @property {Long} eventNumber ReadEvent eventNumber - * @property {boolean} resolveLinkTos ReadEvent resolveLinkTos - * @property {boolean} requireLeader ReadEvent requireLeader - */ - - /** - * Constructs a new ReadEvent. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ReadEvent. - * @implements IReadEvent - * @constructor - * @param {EventStore.Client.Messages.IReadEvent=} [properties] Properties to set - */ - function ReadEvent(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReadEvent eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.ReadEvent - * @instance - */ - ReadEvent.prototype.eventStreamId = ""; - - /** - * ReadEvent eventNumber. - * @member {Long} eventNumber - * @memberof EventStore.Client.Messages.ReadEvent - * @instance - */ - ReadEvent.prototype.eventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ReadEvent resolveLinkTos. - * @member {boolean} resolveLinkTos - * @memberof EventStore.Client.Messages.ReadEvent - * @instance - */ - ReadEvent.prototype.resolveLinkTos = false; - - /** - * ReadEvent requireLeader. - * @member {boolean} requireLeader - * @memberof EventStore.Client.Messages.ReadEvent - * @instance - */ - ReadEvent.prototype.requireLeader = false; - - /** - * Creates a new ReadEvent instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ReadEvent - * @static - * @param {EventStore.Client.Messages.IReadEvent=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ReadEvent} ReadEvent instance - */ - ReadEvent.create = function create(properties) { - return new ReadEvent(properties); - }; - - /** - * Encodes the specified ReadEvent message. Does not implicitly {@link EventStore.Client.Messages.ReadEvent.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ReadEvent - * @static - * @param {EventStore.Client.Messages.IReadEvent} message ReadEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadEvent.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.eventNumber); - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.resolveLinkTos); - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.requireLeader); - return writer; - }; - - /** - * Encodes the specified ReadEvent message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadEvent.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ReadEvent - * @static - * @param {EventStore.Client.Messages.IReadEvent} message ReadEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadEvent.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReadEvent message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ReadEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ReadEvent} ReadEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadEvent.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadEvent(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.eventStreamId = reader.string(); - break; - } - case 2: { - message.eventNumber = reader.int64(); - break; - } - case 3: { - message.resolveLinkTos = reader.bool(); - break; - } - case 4: { - message.requireLeader = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("eventNumber")) - throw $util.ProtocolError("missing required 'eventNumber'", { instance: message }); - if (!message.hasOwnProperty("resolveLinkTos")) - throw $util.ProtocolError("missing required 'resolveLinkTos'", { instance: message }); - if (!message.hasOwnProperty("requireLeader")) - throw $util.ProtocolError("missing required 'requireLeader'", { instance: message }); - return message; - }; - - /** - * Decodes a ReadEvent message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ReadEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ReadEvent} ReadEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadEvent.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReadEvent message. - * @function verify - * @memberof EventStore.Client.Messages.ReadEvent - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReadEvent.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isString(message.eventStreamId)) - return "eventStreamId: string expected"; - if (!$util.isInteger(message.eventNumber) && !(message.eventNumber && $util.isInteger(message.eventNumber.low) && $util.isInteger(message.eventNumber.high))) - return "eventNumber: integer|Long expected"; - if (typeof message.resolveLinkTos !== "boolean") - return "resolveLinkTos: boolean expected"; - if (typeof message.requireLeader !== "boolean") - return "requireLeader: boolean expected"; - return null; - }; - - /** - * Creates a ReadEvent message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ReadEvent - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ReadEvent} ReadEvent - */ - ReadEvent.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ReadEvent) - return object; - var message = new $root.EventStore.Client.Messages.ReadEvent(); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.eventNumber != null) - if ($util.Long) - (message.eventNumber = $util.Long.fromValue(object.eventNumber)).unsigned = false; - else if (typeof object.eventNumber === "string") - message.eventNumber = parseInt(object.eventNumber, 10); - else if (typeof object.eventNumber === "number") - message.eventNumber = object.eventNumber; - else if (typeof object.eventNumber === "object") - message.eventNumber = new $util.LongBits(object.eventNumber.low >>> 0, object.eventNumber.high >>> 0).toNumber(); - if (object.resolveLinkTos != null) - message.resolveLinkTos = Boolean(object.resolveLinkTos); - if (object.requireLeader != null) - message.requireLeader = Boolean(object.requireLeader); - return message; - }; - - /** - * Creates a plain object from a ReadEvent message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ReadEvent - * @static - * @param {EventStore.Client.Messages.ReadEvent} message ReadEvent - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReadEvent.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.eventStreamId = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.eventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.eventNumber = options.longs === String ? "0" : 0; - object.resolveLinkTos = false; - object.requireLeader = false; - } - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.eventNumber != null && message.hasOwnProperty("eventNumber")) - if (typeof message.eventNumber === "number") - object.eventNumber = options.longs === String ? String(message.eventNumber) : message.eventNumber; - else - object.eventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.eventNumber) : options.longs === Number ? new $util.LongBits(message.eventNumber.low >>> 0, message.eventNumber.high >>> 0).toNumber() : message.eventNumber; - if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) - object.resolveLinkTos = message.resolveLinkTos; - if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) - object.requireLeader = message.requireLeader; - return object; - }; - - /** - * Converts this ReadEvent to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ReadEvent - * @instance - * @returns {Object.} JSON object - */ - ReadEvent.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReadEvent - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ReadEvent - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReadEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.ReadEvent"; - }; - - return ReadEvent; - })(); - - Messages.ReadEventCompleted = (function() { - - /** - * Properties of a ReadEventCompleted. - * @memberof EventStore.Client.Messages - * @interface IReadEventCompleted - * @property {EventStore.Client.Messages.ReadEventCompleted.ReadEventResult} result ReadEventCompleted result - * @property {EventStore.Client.Messages.IResolvedIndexedEvent} event ReadEventCompleted event - * @property {string|null} [error] ReadEventCompleted error - */ - - /** - * Constructs a new ReadEventCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ReadEventCompleted. - * @implements IReadEventCompleted - * @constructor - * @param {EventStore.Client.Messages.IReadEventCompleted=} [properties] Properties to set - */ - function ReadEventCompleted(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReadEventCompleted result. - * @member {EventStore.Client.Messages.ReadEventCompleted.ReadEventResult} result - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @instance - */ - ReadEventCompleted.prototype.result = 0; - - /** - * ReadEventCompleted event. - * @member {EventStore.Client.Messages.IResolvedIndexedEvent} event - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @instance - */ - ReadEventCompleted.prototype.event = null; - - /** - * ReadEventCompleted error. - * @member {string} error - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @instance - */ - ReadEventCompleted.prototype.error = ""; - - /** - * Creates a new ReadEventCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @static - * @param {EventStore.Client.Messages.IReadEventCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ReadEventCompleted} ReadEventCompleted instance - */ - ReadEventCompleted.create = function create(properties) { - return new ReadEventCompleted(properties); - }; - - /** - * Encodes the specified ReadEventCompleted message. Does not implicitly {@link EventStore.Client.Messages.ReadEventCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @static - * @param {EventStore.Client.Messages.IReadEventCompleted} message ReadEventCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadEventCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); - $root.EventStore.Client.Messages.ResolvedIndexedEvent.encode(message.event, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.error); - return writer; - }; - - /** - * Encodes the specified ReadEventCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadEventCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @static - * @param {EventStore.Client.Messages.IReadEventCompleted} message ReadEventCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadEventCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReadEventCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ReadEventCompleted} ReadEventCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadEventCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadEventCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.result = reader.int32(); - break; - } - case 2: { - message.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.decode(reader, reader.uint32()); - break; - } - case 3: { - message.error = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); - if (!message.hasOwnProperty("event")) - throw $util.ProtocolError("missing required 'event'", { instance: message }); - return message; - }; - - /** - * Decodes a ReadEventCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ReadEventCompleted} ReadEventCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadEventCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReadEventCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReadEventCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - switch (message.result) { - default: - return "result: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - { - var error = $root.EventStore.Client.Messages.ResolvedIndexedEvent.verify(message.event); - if (error) - return "event." + error; - } - if (message.error != null && message.hasOwnProperty("error")) - if (!$util.isString(message.error)) - return "error: string expected"; - return null; - }; - - /** - * Creates a ReadEventCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ReadEventCompleted} ReadEventCompleted - */ - ReadEventCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ReadEventCompleted) - return object; - var message = new $root.EventStore.Client.Messages.ReadEventCompleted(); - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": - case 0: - message.result = 0; - break; - case "NotFound": - case 1: - message.result = 1; - break; - case "NoStream": - case 2: - message.result = 2; - break; - case "StreamDeleted": - case 3: - message.result = 3; - break; - case "Error": - case 4: - message.result = 4; - break; - case "AccessDenied": - case 5: - message.result = 5; - break; - } - if (object.event != null) { - if (typeof object.event !== "object") - throw TypeError(".EventStore.Client.Messages.ReadEventCompleted.event: object expected"); - message.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.fromObject(object.event); - } - if (object.error != null) - message.error = String(object.error); - return message; - }; - - /** - * Creates a plain object from a ReadEventCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @static - * @param {EventStore.Client.Messages.ReadEventCompleted} message ReadEventCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReadEventCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.result = options.enums === String ? "Success" : 0; - object.event = null; - object.error = ""; - } - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.ReadEventCompleted.ReadEventResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.ReadEventCompleted.ReadEventResult[message.result] : message.result; - if (message.event != null && message.hasOwnProperty("event")) - object.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.toObject(message.event, options); - if (message.error != null && message.hasOwnProperty("error")) - object.error = message.error; - return object; - }; - - /** - * Converts this ReadEventCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @instance - * @returns {Object.} JSON object - */ - ReadEventCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReadEventCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ReadEventCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReadEventCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.ReadEventCompleted"; - }; - - /** - * ReadEventResult enum. - * @name EventStore.Client.Messages.ReadEventCompleted.ReadEventResult - * @enum {number} - * @property {number} Success=0 Success value - * @property {number} NotFound=1 NotFound value - * @property {number} NoStream=2 NoStream value - * @property {number} StreamDeleted=3 StreamDeleted value - * @property {number} Error=4 Error value - * @property {number} AccessDenied=5 AccessDenied value - */ - ReadEventCompleted.ReadEventResult = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Success"] = 0; - values[valuesById[1] = "NotFound"] = 1; - values[valuesById[2] = "NoStream"] = 2; - values[valuesById[3] = "StreamDeleted"] = 3; - values[valuesById[4] = "Error"] = 4; - values[valuesById[5] = "AccessDenied"] = 5; - return values; - })(); - - return ReadEventCompleted; - })(); - - Messages.ReadStreamEvents = (function() { - - /** - * Properties of a ReadStreamEvents. - * @memberof EventStore.Client.Messages - * @interface IReadStreamEvents - * @property {string} eventStreamId ReadStreamEvents eventStreamId - * @property {Long} fromEventNumber ReadStreamEvents fromEventNumber - * @property {number} maxCount ReadStreamEvents maxCount - * @property {boolean} resolveLinkTos ReadStreamEvents resolveLinkTos - * @property {boolean} requireLeader ReadStreamEvents requireLeader - */ - - /** - * Constructs a new ReadStreamEvents. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ReadStreamEvents. - * @implements IReadStreamEvents - * @constructor - * @param {EventStore.Client.Messages.IReadStreamEvents=} [properties] Properties to set - */ - function ReadStreamEvents(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReadStreamEvents eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @instance - */ - ReadStreamEvents.prototype.eventStreamId = ""; - - /** - * ReadStreamEvents fromEventNumber. - * @member {Long} fromEventNumber - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @instance - */ - ReadStreamEvents.prototype.fromEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ReadStreamEvents maxCount. - * @member {number} maxCount - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @instance - */ - ReadStreamEvents.prototype.maxCount = 0; - - /** - * ReadStreamEvents resolveLinkTos. - * @member {boolean} resolveLinkTos - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @instance - */ - ReadStreamEvents.prototype.resolveLinkTos = false; - - /** - * ReadStreamEvents requireLeader. - * @member {boolean} requireLeader - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @instance - */ - ReadStreamEvents.prototype.requireLeader = false; - - /** - * Creates a new ReadStreamEvents instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @static - * @param {EventStore.Client.Messages.IReadStreamEvents=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ReadStreamEvents} ReadStreamEvents instance - */ - ReadStreamEvents.create = function create(properties) { - return new ReadStreamEvents(properties); - }; - - /** - * Encodes the specified ReadStreamEvents message. Does not implicitly {@link EventStore.Client.Messages.ReadStreamEvents.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @static - * @param {EventStore.Client.Messages.IReadStreamEvents} message ReadStreamEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadStreamEvents.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Encodes the specified ReadStreamEvents message. Does not implicitly {@link EventStore.Client.Messages.ReadStreamEvents.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @static + * @param {EventStore.Client.Messages.IReadStreamEvents} message ReadStreamEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadStreamEvents.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); + if (message.fromEventNumber != null && Object.hasOwnProperty.call(message, "fromEventNumber")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.fromEventNumber); + if (message.maxCount != null && Object.hasOwnProperty.call(message, "maxCount")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxCount); + if (message.resolveLinkTos != null && Object.hasOwnProperty.call(message, "resolveLinkTos")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.resolveLinkTos); + if (message.requireLeader != null && Object.hasOwnProperty.call(message, "requireLeader")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.requireLeader); - return writer; - }; + return writer; + }; - /** - * Encodes the specified ReadStreamEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadStreamEvents.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @static - * @param {EventStore.Client.Messages.IReadStreamEvents} message ReadStreamEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadStreamEvents.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ReadStreamEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadStreamEvents.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @static + * @param {EventStore.Client.Messages.IReadStreamEvents} message ReadStreamEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadStreamEvents.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ReadStreamEvents message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ReadStreamEvents} ReadStreamEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadStreamEvents.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadStreamEvents(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.eventStreamId = reader.string(); - break; - } - case 2: { - message.fromEventNumber = reader.int64(); - break; - } - case 3: { - message.maxCount = reader.int32(); - break; - } - case 4: { - message.resolveLinkTos = reader.bool(); - break; - } - case 5: { - message.requireLeader = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a ReadStreamEvents message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ReadStreamEvents} ReadStreamEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadStreamEvents.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadStreamEvents(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.eventStreamId = reader.string(); break; } + case 2: { + message.fromEventNumber = reader.int64(); + break; + } + case 3: { + message.maxCount = reader.int32(); + break; + } + case 4: { + message.resolveLinkTos = reader.bool(); + break; + } + case 5: { + message.requireLeader = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("fromEventNumber")) - throw $util.ProtocolError("missing required 'fromEventNumber'", { instance: message }); - if (!message.hasOwnProperty("maxCount")) - throw $util.ProtocolError("missing required 'maxCount'", { instance: message }); - if (!message.hasOwnProperty("resolveLinkTos")) - throw $util.ProtocolError("missing required 'resolveLinkTos'", { instance: message }); - if (!message.hasOwnProperty("requireLeader")) - throw $util.ProtocolError("missing required 'requireLeader'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a ReadStreamEvents message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ReadStreamEvents} ReadStreamEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadStreamEvents.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ReadStreamEvents message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ReadStreamEvents} ReadStreamEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadStreamEvents.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a ReadStreamEvents message. - * @function verify - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReadStreamEvents.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a ReadStreamEvents message. + * @function verify + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadStreamEvents.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) if (!$util.isString(message.eventStreamId)) return "eventStreamId: string expected"; + if (message.fromEventNumber != null && message.hasOwnProperty("fromEventNumber")) if (!$util.isInteger(message.fromEventNumber) && !(message.fromEventNumber && $util.isInteger(message.fromEventNumber.low) && $util.isInteger(message.fromEventNumber.high))) return "fromEventNumber: integer|Long expected"; + if (message.maxCount != null && message.hasOwnProperty("maxCount")) if (!$util.isInteger(message.maxCount)) return "maxCount: integer expected"; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) if (typeof message.resolveLinkTos !== "boolean") return "resolveLinkTos: boolean expected"; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) if (typeof message.requireLeader !== "boolean") return "requireLeader: boolean expected"; - return null; - }; + return null; + }; - /** - * Creates a ReadStreamEvents message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ReadStreamEvents} ReadStreamEvents - */ - ReadStreamEvents.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ReadStreamEvents) - return object; - var message = new $root.EventStore.Client.Messages.ReadStreamEvents(); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.fromEventNumber != null) - if ($util.Long) - (message.fromEventNumber = $util.Long.fromValue(object.fromEventNumber)).unsigned = false; - else if (typeof object.fromEventNumber === "string") - message.fromEventNumber = parseInt(object.fromEventNumber, 10); - else if (typeof object.fromEventNumber === "number") - message.fromEventNumber = object.fromEventNumber; - else if (typeof object.fromEventNumber === "object") - message.fromEventNumber = new $util.LongBits(object.fromEventNumber.low >>> 0, object.fromEventNumber.high >>> 0).toNumber(); - if (object.maxCount != null) - message.maxCount = object.maxCount | 0; - if (object.resolveLinkTos != null) - message.resolveLinkTos = Boolean(object.resolveLinkTos); - if (object.requireLeader != null) - message.requireLeader = Boolean(object.requireLeader); - return message; - }; - - /** - * Creates a plain object from a ReadStreamEvents message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @static - * @param {EventStore.Client.Messages.ReadStreamEvents} message ReadStreamEvents - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReadStreamEvents.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.eventStreamId = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.fromEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.fromEventNumber = options.longs === String ? "0" : 0; - object.maxCount = 0; - object.resolveLinkTos = false; - object.requireLeader = false; - } - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.fromEventNumber != null && message.hasOwnProperty("fromEventNumber")) - if (typeof message.fromEventNumber === "number") - object.fromEventNumber = options.longs === String ? String(message.fromEventNumber) : message.fromEventNumber; - else - object.fromEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.fromEventNumber) : options.longs === Number ? new $util.LongBits(message.fromEventNumber.low >>> 0, message.fromEventNumber.high >>> 0).toNumber() : message.fromEventNumber; - if (message.maxCount != null && message.hasOwnProperty("maxCount")) - object.maxCount = message.maxCount; - if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) - object.resolveLinkTos = message.resolveLinkTos; - if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) - object.requireLeader = message.requireLeader; + /** + * Creates a ReadStreamEvents message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ReadStreamEvents} ReadStreamEvents + */ + ReadStreamEvents.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ReadStreamEvents) return object; - }; + var message = new $root.EventStore.Client.Messages.ReadStreamEvents(); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.fromEventNumber != null) + if ($util.Long) + (message.fromEventNumber = $util.Long.fromValue(object.fromEventNumber)).unsigned = false; + else if (typeof object.fromEventNumber === "string") + message.fromEventNumber = parseInt(object.fromEventNumber, 10); + else if (typeof object.fromEventNumber === "number") + message.fromEventNumber = object.fromEventNumber; + else if (typeof object.fromEventNumber === "object") + message.fromEventNumber = new $util.LongBits(object.fromEventNumber.low >>> 0, object.fromEventNumber.high >>> 0).toNumber(); + if (object.maxCount != null) + message.maxCount = object.maxCount | 0; + if (object.resolveLinkTos != null) + message.resolveLinkTos = Boolean(object.resolveLinkTos); + if (object.requireLeader != null) + message.requireLeader = Boolean(object.requireLeader); + return message; + }; - /** - * Converts this ReadStreamEvents to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @instance - * @returns {Object.} JSON object - */ - ReadStreamEvents.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReadStreamEvents - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ReadStreamEvents - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReadStreamEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.ReadStreamEvents"; - }; - - return ReadStreamEvents; - })(); - - Messages.ReadStreamEventsCompleted = (function() { - - /** - * Properties of a ReadStreamEventsCompleted. - * @memberof EventStore.Client.Messages - * @interface IReadStreamEventsCompleted - * @property {Array.|null} [events] ReadStreamEventsCompleted events - * @property {EventStore.Client.Messages.ReadStreamEventsCompleted.ReadStreamResult} result ReadStreamEventsCompleted result - * @property {Long} nextEventNumber ReadStreamEventsCompleted nextEventNumber - * @property {Long} lastEventNumber ReadStreamEventsCompleted lastEventNumber - * @property {boolean} isEndOfStream ReadStreamEventsCompleted isEndOfStream - * @property {Long} lastCommitPosition ReadStreamEventsCompleted lastCommitPosition - * @property {string|null} [error] ReadStreamEventsCompleted error - */ - - /** - * Constructs a new ReadStreamEventsCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ReadStreamEventsCompleted. - * @implements IReadStreamEventsCompleted - * @constructor - * @param {EventStore.Client.Messages.IReadStreamEventsCompleted=} [properties] Properties to set - */ - function ReadStreamEventsCompleted(properties) { - this.events = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a ReadStreamEvents message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @static + * @param {EventStore.Client.Messages.ReadStreamEvents} message ReadStreamEvents + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadStreamEvents.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.eventStreamId = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.fromEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fromEventNumber = options.longs === String ? "0" : 0; + object.maxCount = 0; + object.resolveLinkTos = false; + object.requireLeader = false; } + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.fromEventNumber != null && message.hasOwnProperty("fromEventNumber")) + if (typeof message.fromEventNumber === "number") + object.fromEventNumber = options.longs === String ? String(message.fromEventNumber) : message.fromEventNumber; + else + object.fromEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.fromEventNumber) : options.longs === Number ? new $util.LongBits(message.fromEventNumber.low >>> 0, message.fromEventNumber.high >>> 0).toNumber() : message.fromEventNumber; + if (message.maxCount != null && message.hasOwnProperty("maxCount")) + object.maxCount = message.maxCount; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) + object.resolveLinkTos = message.resolveLinkTos; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + object.requireLeader = message.requireLeader; + return object; + }; - /** - * ReadStreamEventsCompleted events. - * @member {Array.} events - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @instance - */ - ReadStreamEventsCompleted.prototype.events = $util.emptyArray; + /** + * Converts this ReadStreamEvents to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @instance + * @returns {Object.} JSON object + */ + ReadStreamEvents.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * ReadStreamEventsCompleted result. - * @member {EventStore.Client.Messages.ReadStreamEventsCompleted.ReadStreamResult} result - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @instance - */ - ReadStreamEventsCompleted.prototype.result = 0; + /** + * Gets the default type url for ReadStreamEvents + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ReadStreamEvents + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadStreamEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ReadStreamEvents"; + }; - /** - * ReadStreamEventsCompleted nextEventNumber. - * @member {Long} nextEventNumber - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @instance - */ - ReadStreamEventsCompleted.prototype.nextEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + return ReadStreamEvents; + })(); - /** - * ReadStreamEventsCompleted lastEventNumber. - * @member {Long} lastEventNumber - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @instance - */ - ReadStreamEventsCompleted.prototype.lastEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Messages.ReadStreamEventsCompleted = (function() { - /** - * ReadStreamEventsCompleted isEndOfStream. - * @member {boolean} isEndOfStream - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @instance - */ - ReadStreamEventsCompleted.prototype.isEndOfStream = false; + /** + * Properties of a ReadStreamEventsCompleted. + * @memberof EventStore.Client.Messages + * @interface IReadStreamEventsCompleted + * @property {Array.|null} [events] ReadStreamEventsCompleted events + * @property {EventStore.Client.Messages.ReadStreamEventsCompleted.ReadStreamResult|null} [result] ReadStreamEventsCompleted result + * @property {Long|null} [nextEventNumber] ReadStreamEventsCompleted nextEventNumber + * @property {Long|null} [lastEventNumber] ReadStreamEventsCompleted lastEventNumber + * @property {boolean|null} [isEndOfStream] ReadStreamEventsCompleted isEndOfStream + * @property {Long|null} [lastCommitPosition] ReadStreamEventsCompleted lastCommitPosition + * @property {string|null} [error] ReadStreamEventsCompleted error + */ - /** - * ReadStreamEventsCompleted lastCommitPosition. - * @member {Long} lastCommitPosition - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @instance - */ - ReadStreamEventsCompleted.prototype.lastCommitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Constructs a new ReadStreamEventsCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ReadStreamEventsCompleted. + * @implements IReadStreamEventsCompleted + * @constructor + * @param {EventStore.Client.Messages.IReadStreamEventsCompleted=} [properties] Properties to set + */ + function ReadStreamEventsCompleted(properties) { + this.events = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ReadStreamEventsCompleted error. - * @member {string} error - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @instance - */ - ReadStreamEventsCompleted.prototype.error = ""; + /** + * ReadStreamEventsCompleted events. + * @member {Array.} events + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @instance + */ + ReadStreamEventsCompleted.prototype.events = $util.emptyArray; - /** - * Creates a new ReadStreamEventsCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @static - * @param {EventStore.Client.Messages.IReadStreamEventsCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ReadStreamEventsCompleted} ReadStreamEventsCompleted instance - */ - ReadStreamEventsCompleted.create = function create(properties) { - return new ReadStreamEventsCompleted(properties); - }; + /** + * ReadStreamEventsCompleted result. + * @member {EventStore.Client.Messages.ReadStreamEventsCompleted.ReadStreamResult} result + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @instance + */ + ReadStreamEventsCompleted.prototype.result = 0; - /** - * Encodes the specified ReadStreamEventsCompleted message. Does not implicitly {@link EventStore.Client.Messages.ReadStreamEventsCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @static - * @param {EventStore.Client.Messages.IReadStreamEventsCompleted} message ReadStreamEventsCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadStreamEventsCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.events != null && message.events.length) - for (var i = 0; i < message.events.length; ++i) - $root.EventStore.Client.Messages.ResolvedIndexedEvent.encode(message.events[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + /** + * ReadStreamEventsCompleted nextEventNumber. + * @member {Long} nextEventNumber + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @instance + */ + ReadStreamEventsCompleted.prototype.nextEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ReadStreamEventsCompleted lastEventNumber. + * @member {Long} lastEventNumber + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @instance + */ + ReadStreamEventsCompleted.prototype.lastEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ReadStreamEventsCompleted isEndOfStream. + * @member {boolean} isEndOfStream + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @instance + */ + ReadStreamEventsCompleted.prototype.isEndOfStream = false; + + /** + * ReadStreamEventsCompleted lastCommitPosition. + * @member {Long} lastCommitPosition + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @instance + */ + ReadStreamEventsCompleted.prototype.lastCommitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ReadStreamEventsCompleted error. + * @member {string} error + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @instance + */ + ReadStreamEventsCompleted.prototype.error = ""; + + /** + * Creates a new ReadStreamEventsCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @static + * @param {EventStore.Client.Messages.IReadStreamEventsCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ReadStreamEventsCompleted} ReadStreamEventsCompleted instance + */ + ReadStreamEventsCompleted.create = function create(properties) { + return new ReadStreamEventsCompleted(properties); + }; + + /** + * Encodes the specified ReadStreamEventsCompleted message. Does not implicitly {@link EventStore.Client.Messages.ReadStreamEventsCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @static + * @param {EventStore.Client.Messages.IReadStreamEventsCompleted} message ReadStreamEventsCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadStreamEventsCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.events != null && message.events.length) + for (var i = 0; i < message.events.length; ++i) + $root.EventStore.Client.Messages.ResolvedIndexedEvent.encode(message.events[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result); + if (message.nextEventNumber != null && Object.hasOwnProperty.call(message, "nextEventNumber")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.nextEventNumber); + if (message.lastEventNumber != null && Object.hasOwnProperty.call(message, "lastEventNumber")) writer.uint32(/* id 4, wireType 0 =*/32).int64(message.lastEventNumber); + if (message.isEndOfStream != null && Object.hasOwnProperty.call(message, "isEndOfStream")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.isEndOfStream); + if (message.lastCommitPosition != null && Object.hasOwnProperty.call(message, "lastCommitPosition")) writer.uint32(/* id 6, wireType 0 =*/48).int64(message.lastCommitPosition); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.error); - return writer; - }; + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.error); + return writer; + }; - /** - * Encodes the specified ReadStreamEventsCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadStreamEventsCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @static - * @param {EventStore.Client.Messages.IReadStreamEventsCompleted} message ReadStreamEventsCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadStreamEventsCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ReadStreamEventsCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadStreamEventsCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @static + * @param {EventStore.Client.Messages.IReadStreamEventsCompleted} message ReadStreamEventsCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadStreamEventsCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ReadStreamEventsCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ReadStreamEventsCompleted} ReadStreamEventsCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadStreamEventsCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadStreamEventsCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.EventStore.Client.Messages.ResolvedIndexedEvent.decode(reader, reader.uint32())); - break; - } - case 2: { - message.result = reader.int32(); - break; - } - case 3: { - message.nextEventNumber = reader.int64(); - break; - } - case 4: { - message.lastEventNumber = reader.int64(); - break; - } - case 5: { - message.isEndOfStream = reader.bool(); - break; - } - case 6: { - message.lastCommitPosition = reader.int64(); - break; - } - case 7: { - message.error = reader.string(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a ReadStreamEventsCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ReadStreamEventsCompleted} ReadStreamEventsCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadStreamEventsCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadStreamEventsCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.EventStore.Client.Messages.ResolvedIndexedEvent.decode(reader, reader.uint32())); break; } - } - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); - if (!message.hasOwnProperty("nextEventNumber")) - throw $util.ProtocolError("missing required 'nextEventNumber'", { instance: message }); - if (!message.hasOwnProperty("lastEventNumber")) - throw $util.ProtocolError("missing required 'lastEventNumber'", { instance: message }); - if (!message.hasOwnProperty("isEndOfStream")) - throw $util.ProtocolError("missing required 'isEndOfStream'", { instance: message }); - if (!message.hasOwnProperty("lastCommitPosition")) - throw $util.ProtocolError("missing required 'lastCommitPosition'", { instance: message }); - return message; - }; - - /** - * Decodes a ReadStreamEventsCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ReadStreamEventsCompleted} ReadStreamEventsCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadStreamEventsCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReadStreamEventsCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReadStreamEventsCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (var i = 0; i < message.events.length; ++i) { - var error = $root.EventStore.Client.Messages.ResolvedIndexedEvent.verify(message.events[i]); - if (error) - return "events." + error; + case 2: { + message.result = reader.int32(); + break; } + case 3: { + message.nextEventNumber = reader.int64(); + break; + } + case 4: { + message.lastEventNumber = reader.int64(); + break; + } + case 5: { + message.isEndOfStream = reader.bool(); + break; + } + case 6: { + message.lastCommitPosition = reader.int64(); + break; + } + case 7: { + message.error = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } + } + return message; + }; + + /** + * Decodes a ReadStreamEventsCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ReadStreamEventsCompleted} ReadStreamEventsCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadStreamEventsCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReadStreamEventsCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadStreamEventsCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (var i = 0; i < message.events.length; ++i) { + var error = $root.EventStore.Client.Messages.ResolvedIndexedEvent.verify(message.events[i]); + if (error) + return "events." + error; + } + } + if (message.result != null && message.hasOwnProperty("result")) switch (message.result) { default: return "result: enum value expected"; @@ -5934,1181 +5923,1184 @@ case 5: break; } + if (message.nextEventNumber != null && message.hasOwnProperty("nextEventNumber")) if (!$util.isInteger(message.nextEventNumber) && !(message.nextEventNumber && $util.isInteger(message.nextEventNumber.low) && $util.isInteger(message.nextEventNumber.high))) return "nextEventNumber: integer|Long expected"; + if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) if (!$util.isInteger(message.lastEventNumber) && !(message.lastEventNumber && $util.isInteger(message.lastEventNumber.low) && $util.isInteger(message.lastEventNumber.high))) return "lastEventNumber: integer|Long expected"; + if (message.isEndOfStream != null && message.hasOwnProperty("isEndOfStream")) if (typeof message.isEndOfStream !== "boolean") return "isEndOfStream: boolean expected"; + if (message.lastCommitPosition != null && message.hasOwnProperty("lastCommitPosition")) if (!$util.isInteger(message.lastCommitPosition) && !(message.lastCommitPosition && $util.isInteger(message.lastCommitPosition.low) && $util.isInteger(message.lastCommitPosition.high))) return "lastCommitPosition: integer|Long expected"; - if (message.error != null && message.hasOwnProperty("error")) - if (!$util.isString(message.error)) - return "error: string expected"; - return null; - }; + if (message.error != null && message.hasOwnProperty("error")) + if (!$util.isString(message.error)) + return "error: string expected"; + return null; + }; - /** - * Creates a ReadStreamEventsCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ReadStreamEventsCompleted} ReadStreamEventsCompleted - */ - ReadStreamEventsCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ReadStreamEventsCompleted) - return object; - var message = new $root.EventStore.Client.Messages.ReadStreamEventsCompleted(); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".EventStore.Client.Messages.ReadStreamEventsCompleted.events: array expected"); - message.events = []; - for (var i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".EventStore.Client.Messages.ReadStreamEventsCompleted.events: object expected"); - message.events[i] = $root.EventStore.Client.Messages.ResolvedIndexedEvent.fromObject(object.events[i]); - } - } - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": - case 0: - message.result = 0; - break; - case "NoStream": - case 1: - message.result = 1; - break; - case "StreamDeleted": - case 2: - message.result = 2; - break; - case "NotModified": - case 3: - message.result = 3; - break; - case "Error": - case 4: - message.result = 4; - break; - case "AccessDenied": - case 5: - message.result = 5; - break; - } - if (object.nextEventNumber != null) - if ($util.Long) - (message.nextEventNumber = $util.Long.fromValue(object.nextEventNumber)).unsigned = false; - else if (typeof object.nextEventNumber === "string") - message.nextEventNumber = parseInt(object.nextEventNumber, 10); - else if (typeof object.nextEventNumber === "number") - message.nextEventNumber = object.nextEventNumber; - else if (typeof object.nextEventNumber === "object") - message.nextEventNumber = new $util.LongBits(object.nextEventNumber.low >>> 0, object.nextEventNumber.high >>> 0).toNumber(); - if (object.lastEventNumber != null) - if ($util.Long) - (message.lastEventNumber = $util.Long.fromValue(object.lastEventNumber)).unsigned = false; - else if (typeof object.lastEventNumber === "string") - message.lastEventNumber = parseInt(object.lastEventNumber, 10); - else if (typeof object.lastEventNumber === "number") - message.lastEventNumber = object.lastEventNumber; - else if (typeof object.lastEventNumber === "object") - message.lastEventNumber = new $util.LongBits(object.lastEventNumber.low >>> 0, object.lastEventNumber.high >>> 0).toNumber(); - if (object.isEndOfStream != null) - message.isEndOfStream = Boolean(object.isEndOfStream); - if (object.lastCommitPosition != null) - if ($util.Long) - (message.lastCommitPosition = $util.Long.fromValue(object.lastCommitPosition)).unsigned = false; - else if (typeof object.lastCommitPosition === "string") - message.lastCommitPosition = parseInt(object.lastCommitPosition, 10); - else if (typeof object.lastCommitPosition === "number") - message.lastCommitPosition = object.lastCommitPosition; - else if (typeof object.lastCommitPosition === "object") - message.lastCommitPosition = new $util.LongBits(object.lastCommitPosition.low >>> 0, object.lastCommitPosition.high >>> 0).toNumber(); - if (object.error != null) - message.error = String(object.error); - return message; - }; - - /** - * Creates a plain object from a ReadStreamEventsCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @static - * @param {EventStore.Client.Messages.ReadStreamEventsCompleted} message ReadStreamEventsCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReadStreamEventsCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (options.defaults) { - object.result = options.enums === String ? "Success" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.nextEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.nextEventNumber = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.lastEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.lastEventNumber = options.longs === String ? "0" : 0; - object.isEndOfStream = false; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.lastCommitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.lastCommitPosition = options.longs === String ? "0" : 0; - object.error = ""; - } - if (message.events && message.events.length) { - object.events = []; - for (var j = 0; j < message.events.length; ++j) - object.events[j] = $root.EventStore.Client.Messages.ResolvedIndexedEvent.toObject(message.events[j], options); - } - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.ReadStreamEventsCompleted.ReadStreamResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.ReadStreamEventsCompleted.ReadStreamResult[message.result] : message.result; - if (message.nextEventNumber != null && message.hasOwnProperty("nextEventNumber")) - if (typeof message.nextEventNumber === "number") - object.nextEventNumber = options.longs === String ? String(message.nextEventNumber) : message.nextEventNumber; - else - object.nextEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.nextEventNumber) : options.longs === Number ? new $util.LongBits(message.nextEventNumber.low >>> 0, message.nextEventNumber.high >>> 0).toNumber() : message.nextEventNumber; - if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) - if (typeof message.lastEventNumber === "number") - object.lastEventNumber = options.longs === String ? String(message.lastEventNumber) : message.lastEventNumber; - else - object.lastEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.lastEventNumber) : options.longs === Number ? new $util.LongBits(message.lastEventNumber.low >>> 0, message.lastEventNumber.high >>> 0).toNumber() : message.lastEventNumber; - if (message.isEndOfStream != null && message.hasOwnProperty("isEndOfStream")) - object.isEndOfStream = message.isEndOfStream; - if (message.lastCommitPosition != null && message.hasOwnProperty("lastCommitPosition")) - if (typeof message.lastCommitPosition === "number") - object.lastCommitPosition = options.longs === String ? String(message.lastCommitPosition) : message.lastCommitPosition; - else - object.lastCommitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.lastCommitPosition) : options.longs === Number ? new $util.LongBits(message.lastCommitPosition.low >>> 0, message.lastCommitPosition.high >>> 0).toNumber() : message.lastCommitPosition; - if (message.error != null && message.hasOwnProperty("error")) - object.error = message.error; + /** + * Creates a ReadStreamEventsCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ReadStreamEventsCompleted} ReadStreamEventsCompleted + */ + ReadStreamEventsCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ReadStreamEventsCompleted) return object; - }; - - /** - * Converts this ReadStreamEventsCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @instance - * @returns {Object.} JSON object - */ - ReadStreamEventsCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReadStreamEventsCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReadStreamEventsCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + var message = new $root.EventStore.Client.Messages.ReadStreamEventsCompleted(); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".EventStore.Client.Messages.ReadStreamEventsCompleted.events: array expected"); + message.events = []; + for (var i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".EventStore.Client.Messages.ReadStreamEventsCompleted.events: object expected"); + message.events[i] = $root.EventStore.Client.Messages.ResolvedIndexedEvent.fromObject(object.events[i]); } - return typeUrlPrefix + "/EventStore.Client.Messages.ReadStreamEventsCompleted"; - }; + } + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; + } + break; + case "Success": + case 0: + message.result = 0; + break; + case "NoStream": + case 1: + message.result = 1; + break; + case "StreamDeleted": + case 2: + message.result = 2; + break; + case "NotModified": + case 3: + message.result = 3; + break; + case "Error": + case 4: + message.result = 4; + break; + case "AccessDenied": + case 5: + message.result = 5; + break; + } + if (object.nextEventNumber != null) + if ($util.Long) + (message.nextEventNumber = $util.Long.fromValue(object.nextEventNumber)).unsigned = false; + else if (typeof object.nextEventNumber === "string") + message.nextEventNumber = parseInt(object.nextEventNumber, 10); + else if (typeof object.nextEventNumber === "number") + message.nextEventNumber = object.nextEventNumber; + else if (typeof object.nextEventNumber === "object") + message.nextEventNumber = new $util.LongBits(object.nextEventNumber.low >>> 0, object.nextEventNumber.high >>> 0).toNumber(); + if (object.lastEventNumber != null) + if ($util.Long) + (message.lastEventNumber = $util.Long.fromValue(object.lastEventNumber)).unsigned = false; + else if (typeof object.lastEventNumber === "string") + message.lastEventNumber = parseInt(object.lastEventNumber, 10); + else if (typeof object.lastEventNumber === "number") + message.lastEventNumber = object.lastEventNumber; + else if (typeof object.lastEventNumber === "object") + message.lastEventNumber = new $util.LongBits(object.lastEventNumber.low >>> 0, object.lastEventNumber.high >>> 0).toNumber(); + if (object.isEndOfStream != null) + message.isEndOfStream = Boolean(object.isEndOfStream); + if (object.lastCommitPosition != null) + if ($util.Long) + (message.lastCommitPosition = $util.Long.fromValue(object.lastCommitPosition)).unsigned = false; + else if (typeof object.lastCommitPosition === "string") + message.lastCommitPosition = parseInt(object.lastCommitPosition, 10); + else if (typeof object.lastCommitPosition === "number") + message.lastCommitPosition = object.lastCommitPosition; + else if (typeof object.lastCommitPosition === "object") + message.lastCommitPosition = new $util.LongBits(object.lastCommitPosition.low >>> 0, object.lastCommitPosition.high >>> 0).toNumber(); + if (object.error != null) + message.error = String(object.error); + return message; + }; - /** - * ReadStreamResult enum. - * @name EventStore.Client.Messages.ReadStreamEventsCompleted.ReadStreamResult - * @enum {number} - * @property {number} Success=0 Success value - * @property {number} NoStream=1 NoStream value - * @property {number} StreamDeleted=2 StreamDeleted value - * @property {number} NotModified=3 NotModified value - * @property {number} Error=4 Error value - * @property {number} AccessDenied=5 AccessDenied value - */ - ReadStreamEventsCompleted.ReadStreamResult = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Success"] = 0; - values[valuesById[1] = "NoStream"] = 1; - values[valuesById[2] = "StreamDeleted"] = 2; - values[valuesById[3] = "NotModified"] = 3; - values[valuesById[4] = "Error"] = 4; - values[valuesById[5] = "AccessDenied"] = 5; - return values; - })(); + /** + * Creates a plain object from a ReadStreamEventsCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @static + * @param {EventStore.Client.Messages.ReadStreamEventsCompleted} message ReadStreamEventsCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadStreamEventsCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (options.defaults) { + object.result = options.enums === String ? "Success" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.nextEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.nextEventNumber = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastEventNumber = options.longs === String ? "0" : 0; + object.isEndOfStream = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastCommitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastCommitPosition = options.longs === String ? "0" : 0; + object.error = ""; + } + if (message.events && message.events.length) { + object.events = []; + for (var j = 0; j < message.events.length; ++j) + object.events[j] = $root.EventStore.Client.Messages.ResolvedIndexedEvent.toObject(message.events[j], options); + } + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.ReadStreamEventsCompleted.ReadStreamResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.ReadStreamEventsCompleted.ReadStreamResult[message.result] : message.result; + if (message.nextEventNumber != null && message.hasOwnProperty("nextEventNumber")) + if (typeof message.nextEventNumber === "number") + object.nextEventNumber = options.longs === String ? String(message.nextEventNumber) : message.nextEventNumber; + else + object.nextEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.nextEventNumber) : options.longs === Number ? new $util.LongBits(message.nextEventNumber.low >>> 0, message.nextEventNumber.high >>> 0).toNumber() : message.nextEventNumber; + if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) + if (typeof message.lastEventNumber === "number") + object.lastEventNumber = options.longs === String ? String(message.lastEventNumber) : message.lastEventNumber; + else + object.lastEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.lastEventNumber) : options.longs === Number ? new $util.LongBits(message.lastEventNumber.low >>> 0, message.lastEventNumber.high >>> 0).toNumber() : message.lastEventNumber; + if (message.isEndOfStream != null && message.hasOwnProperty("isEndOfStream")) + object.isEndOfStream = message.isEndOfStream; + if (message.lastCommitPosition != null && message.hasOwnProperty("lastCommitPosition")) + if (typeof message.lastCommitPosition === "number") + object.lastCommitPosition = options.longs === String ? String(message.lastCommitPosition) : message.lastCommitPosition; + else + object.lastCommitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.lastCommitPosition) : options.longs === Number ? new $util.LongBits(message.lastCommitPosition.low >>> 0, message.lastCommitPosition.high >>> 0).toNumber() : message.lastCommitPosition; + if (message.error != null && message.hasOwnProperty("error")) + object.error = message.error; + return object; + }; - return ReadStreamEventsCompleted; + /** + * Converts this ReadStreamEventsCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @instance + * @returns {Object.} JSON object + */ + ReadStreamEventsCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReadStreamEventsCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ReadStreamEventsCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadStreamEventsCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ReadStreamEventsCompleted"; + }; + + /** + * ReadStreamResult enum. + * @name EventStore.Client.Messages.ReadStreamEventsCompleted.ReadStreamResult + * @enum {number} + * @property {number} Success=0 Success value + * @property {number} NoStream=1 NoStream value + * @property {number} StreamDeleted=2 StreamDeleted value + * @property {number} NotModified=3 NotModified value + * @property {number} Error=4 Error value + * @property {number} AccessDenied=5 AccessDenied value + */ + ReadStreamEventsCompleted.ReadStreamResult = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Success"] = 0; + values[valuesById[1] = "NoStream"] = 1; + values[valuesById[2] = "StreamDeleted"] = 2; + values[valuesById[3] = "NotModified"] = 3; + values[valuesById[4] = "Error"] = 4; + values[valuesById[5] = "AccessDenied"] = 5; + return values; })(); - Messages.ReadAllEvents = (function() { + return ReadStreamEventsCompleted; + })(); - /** - * Properties of a ReadAllEvents. - * @memberof EventStore.Client.Messages - * @interface IReadAllEvents - * @property {Long} commitPosition ReadAllEvents commitPosition - * @property {Long} preparePosition ReadAllEvents preparePosition - * @property {number} maxCount ReadAllEvents maxCount - * @property {boolean} resolveLinkTos ReadAllEvents resolveLinkTos - * @property {boolean} requireLeader ReadAllEvents requireLeader - */ + Messages.ReadAllEvents = (function() { - /** - * Constructs a new ReadAllEvents. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ReadAllEvents. - * @implements IReadAllEvents - * @constructor - * @param {EventStore.Client.Messages.IReadAllEvents=} [properties] Properties to set - */ - function ReadAllEvents(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a ReadAllEvents. + * @memberof EventStore.Client.Messages + * @interface IReadAllEvents + * @property {Long|null} [commitPosition] ReadAllEvents commitPosition + * @property {Long|null} [preparePosition] ReadAllEvents preparePosition + * @property {number|null} [maxCount] ReadAllEvents maxCount + * @property {boolean|null} [resolveLinkTos] ReadAllEvents resolveLinkTos + * @property {boolean|null} [requireLeader] ReadAllEvents requireLeader + */ - /** - * ReadAllEvents commitPosition. - * @member {Long} commitPosition - * @memberof EventStore.Client.Messages.ReadAllEvents - * @instance - */ - ReadAllEvents.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Constructs a new ReadAllEvents. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ReadAllEvents. + * @implements IReadAllEvents + * @constructor + * @param {EventStore.Client.Messages.IReadAllEvents=} [properties] Properties to set + */ + function ReadAllEvents(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ReadAllEvents preparePosition. - * @member {Long} preparePosition - * @memberof EventStore.Client.Messages.ReadAllEvents - * @instance - */ - ReadAllEvents.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * ReadAllEvents commitPosition. + * @member {Long} commitPosition + * @memberof EventStore.Client.Messages.ReadAllEvents + * @instance + */ + ReadAllEvents.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * ReadAllEvents maxCount. - * @member {number} maxCount - * @memberof EventStore.Client.Messages.ReadAllEvents - * @instance - */ - ReadAllEvents.prototype.maxCount = 0; + /** + * ReadAllEvents preparePosition. + * @member {Long} preparePosition + * @memberof EventStore.Client.Messages.ReadAllEvents + * @instance + */ + ReadAllEvents.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * ReadAllEvents resolveLinkTos. - * @member {boolean} resolveLinkTos - * @memberof EventStore.Client.Messages.ReadAllEvents - * @instance - */ - ReadAllEvents.prototype.resolveLinkTos = false; + /** + * ReadAllEvents maxCount. + * @member {number} maxCount + * @memberof EventStore.Client.Messages.ReadAllEvents + * @instance + */ + ReadAllEvents.prototype.maxCount = 0; - /** - * ReadAllEvents requireLeader. - * @member {boolean} requireLeader - * @memberof EventStore.Client.Messages.ReadAllEvents - * @instance - */ - ReadAllEvents.prototype.requireLeader = false; + /** + * ReadAllEvents resolveLinkTos. + * @member {boolean} resolveLinkTos + * @memberof EventStore.Client.Messages.ReadAllEvents + * @instance + */ + ReadAllEvents.prototype.resolveLinkTos = false; - /** - * Creates a new ReadAllEvents instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ReadAllEvents - * @static - * @param {EventStore.Client.Messages.IReadAllEvents=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ReadAllEvents} ReadAllEvents instance - */ - ReadAllEvents.create = function create(properties) { - return new ReadAllEvents(properties); - }; + /** + * ReadAllEvents requireLeader. + * @member {boolean} requireLeader + * @memberof EventStore.Client.Messages.ReadAllEvents + * @instance + */ + ReadAllEvents.prototype.requireLeader = false; - /** - * Encodes the specified ReadAllEvents message. Does not implicitly {@link EventStore.Client.Messages.ReadAllEvents.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ReadAllEvents - * @static - * @param {EventStore.Client.Messages.IReadAllEvents} message ReadAllEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadAllEvents.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Creates a new ReadAllEvents instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ReadAllEvents + * @static + * @param {EventStore.Client.Messages.IReadAllEvents=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ReadAllEvents} ReadAllEvents instance + */ + ReadAllEvents.create = function create(properties) { + return new ReadAllEvents(properties); + }; + + /** + * Encodes the specified ReadAllEvents message. Does not implicitly {@link EventStore.Client.Messages.ReadAllEvents.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ReadAllEvents + * @static + * @param {EventStore.Client.Messages.IReadAllEvents} message ReadAllEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadAllEvents.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.commitPosition); + if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.preparePosition); + if (message.maxCount != null && Object.hasOwnProperty.call(message, "maxCount")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxCount); + if (message.resolveLinkTos != null && Object.hasOwnProperty.call(message, "resolveLinkTos")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.resolveLinkTos); + if (message.requireLeader != null && Object.hasOwnProperty.call(message, "requireLeader")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.requireLeader); - return writer; - }; + return writer; + }; - /** - * Encodes the specified ReadAllEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadAllEvents.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ReadAllEvents - * @static - * @param {EventStore.Client.Messages.IReadAllEvents} message ReadAllEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadAllEvents.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ReadAllEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadAllEvents.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ReadAllEvents + * @static + * @param {EventStore.Client.Messages.IReadAllEvents} message ReadAllEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadAllEvents.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ReadAllEvents message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ReadAllEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ReadAllEvents} ReadAllEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadAllEvents.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadAllEvents(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.commitPosition = reader.int64(); - break; - } - case 2: { - message.preparePosition = reader.int64(); - break; - } - case 3: { - message.maxCount = reader.int32(); - break; - } - case 4: { - message.resolveLinkTos = reader.bool(); - break; - } - case 5: { - message.requireLeader = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a ReadAllEvents message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ReadAllEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ReadAllEvents} ReadAllEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadAllEvents.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadAllEvents(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.commitPosition = reader.int64(); break; } + case 2: { + message.preparePosition = reader.int64(); + break; + } + case 3: { + message.maxCount = reader.int32(); + break; + } + case 4: { + message.resolveLinkTos = reader.bool(); + break; + } + case 5: { + message.requireLeader = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("commitPosition")) - throw $util.ProtocolError("missing required 'commitPosition'", { instance: message }); - if (!message.hasOwnProperty("preparePosition")) - throw $util.ProtocolError("missing required 'preparePosition'", { instance: message }); - if (!message.hasOwnProperty("maxCount")) - throw $util.ProtocolError("missing required 'maxCount'", { instance: message }); - if (!message.hasOwnProperty("resolveLinkTos")) - throw $util.ProtocolError("missing required 'resolveLinkTos'", { instance: message }); - if (!message.hasOwnProperty("requireLeader")) - throw $util.ProtocolError("missing required 'requireLeader'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a ReadAllEvents message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ReadAllEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ReadAllEvents} ReadAllEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadAllEvents.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ReadAllEvents message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ReadAllEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ReadAllEvents} ReadAllEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadAllEvents.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a ReadAllEvents message. - * @function verify - * @memberof EventStore.Client.Messages.ReadAllEvents - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReadAllEvents.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a ReadAllEvents message. + * @function verify + * @memberof EventStore.Client.Messages.ReadAllEvents + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadAllEvents.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) return "commitPosition: integer|Long expected"; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) return "preparePosition: integer|Long expected"; + if (message.maxCount != null && message.hasOwnProperty("maxCount")) if (!$util.isInteger(message.maxCount)) return "maxCount: integer expected"; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) if (typeof message.resolveLinkTos !== "boolean") return "resolveLinkTos: boolean expected"; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) if (typeof message.requireLeader !== "boolean") return "requireLeader: boolean expected"; - return null; - }; + return null; + }; - /** - * Creates a ReadAllEvents message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ReadAllEvents - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ReadAllEvents} ReadAllEvents - */ - ReadAllEvents.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ReadAllEvents) - return object; - var message = new $root.EventStore.Client.Messages.ReadAllEvents(); - if (object.commitPosition != null) - if ($util.Long) - (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; - else if (typeof object.commitPosition === "string") - message.commitPosition = parseInt(object.commitPosition, 10); - else if (typeof object.commitPosition === "number") - message.commitPosition = object.commitPosition; - else if (typeof object.commitPosition === "object") - message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); - if (object.preparePosition != null) - if ($util.Long) - (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; - else if (typeof object.preparePosition === "string") - message.preparePosition = parseInt(object.preparePosition, 10); - else if (typeof object.preparePosition === "number") - message.preparePosition = object.preparePosition; - else if (typeof object.preparePosition === "object") - message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); - if (object.maxCount != null) - message.maxCount = object.maxCount | 0; - if (object.resolveLinkTos != null) - message.resolveLinkTos = Boolean(object.resolveLinkTos); - if (object.requireLeader != null) - message.requireLeader = Boolean(object.requireLeader); - return message; - }; - - /** - * Creates a plain object from a ReadAllEvents message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ReadAllEvents - * @static - * @param {EventStore.Client.Messages.ReadAllEvents} message ReadAllEvents - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReadAllEvents.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.commitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.preparePosition = options.longs === String ? "0" : 0; - object.maxCount = 0; - object.resolveLinkTos = false; - object.requireLeader = false; - } - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (typeof message.commitPosition === "number") - object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; - else - object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (typeof message.preparePosition === "number") - object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; - else - object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; - if (message.maxCount != null && message.hasOwnProperty("maxCount")) - object.maxCount = message.maxCount; - if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) - object.resolveLinkTos = message.resolveLinkTos; - if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) - object.requireLeader = message.requireLeader; + /** + * Creates a ReadAllEvents message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ReadAllEvents + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ReadAllEvents} ReadAllEvents + */ + ReadAllEvents.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ReadAllEvents) return object; - }; + var message = new $root.EventStore.Client.Messages.ReadAllEvents(); + if (object.commitPosition != null) + if ($util.Long) + (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; + else if (typeof object.commitPosition === "string") + message.commitPosition = parseInt(object.commitPosition, 10); + else if (typeof object.commitPosition === "number") + message.commitPosition = object.commitPosition; + else if (typeof object.commitPosition === "object") + message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); + if (object.preparePosition != null) + if ($util.Long) + (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; + else if (typeof object.preparePosition === "string") + message.preparePosition = parseInt(object.preparePosition, 10); + else if (typeof object.preparePosition === "number") + message.preparePosition = object.preparePosition; + else if (typeof object.preparePosition === "object") + message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); + if (object.maxCount != null) + message.maxCount = object.maxCount | 0; + if (object.resolveLinkTos != null) + message.resolveLinkTos = Boolean(object.resolveLinkTos); + if (object.requireLeader != null) + message.requireLeader = Boolean(object.requireLeader); + return message; + }; - /** - * Converts this ReadAllEvents to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ReadAllEvents - * @instance - * @returns {Object.} JSON object - */ - ReadAllEvents.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReadAllEvents - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ReadAllEvents - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReadAllEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.ReadAllEvents"; - }; - - return ReadAllEvents; - })(); - - Messages.ReadAllEventsCompleted = (function() { - - /** - * Properties of a ReadAllEventsCompleted. - * @memberof EventStore.Client.Messages - * @interface IReadAllEventsCompleted - * @property {Long} commitPosition ReadAllEventsCompleted commitPosition - * @property {Long} preparePosition ReadAllEventsCompleted preparePosition - * @property {Array.|null} [events] ReadAllEventsCompleted events - * @property {Long} nextCommitPosition ReadAllEventsCompleted nextCommitPosition - * @property {Long} nextPreparePosition ReadAllEventsCompleted nextPreparePosition - * @property {EventStore.Client.Messages.ReadAllEventsCompleted.ReadAllResult|null} [result] ReadAllEventsCompleted result - * @property {string|null} [error] ReadAllEventsCompleted error - */ - - /** - * Constructs a new ReadAllEventsCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ReadAllEventsCompleted. - * @implements IReadAllEventsCompleted - * @constructor - * @param {EventStore.Client.Messages.IReadAllEventsCompleted=} [properties] Properties to set - */ - function ReadAllEventsCompleted(properties) { - this.events = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a ReadAllEvents message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ReadAllEvents + * @static + * @param {EventStore.Client.Messages.ReadAllEvents} message ReadAllEvents + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadAllEvents.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.commitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.preparePosition = options.longs === String ? "0" : 0; + object.maxCount = 0; + object.resolveLinkTos = false; + object.requireLeader = false; } + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (typeof message.commitPosition === "number") + object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; + else + object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (typeof message.preparePosition === "number") + object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; + else + object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; + if (message.maxCount != null && message.hasOwnProperty("maxCount")) + object.maxCount = message.maxCount; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) + object.resolveLinkTos = message.resolveLinkTos; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + object.requireLeader = message.requireLeader; + return object; + }; - /** - * ReadAllEventsCompleted commitPosition. - * @member {Long} commitPosition - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @instance - */ - ReadAllEventsCompleted.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Converts this ReadAllEvents to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ReadAllEvents + * @instance + * @returns {Object.} JSON object + */ + ReadAllEvents.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * ReadAllEventsCompleted preparePosition. - * @member {Long} preparePosition - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @instance - */ - ReadAllEventsCompleted.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Gets the default type url for ReadAllEvents + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ReadAllEvents + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadAllEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ReadAllEvents"; + }; - /** - * ReadAllEventsCompleted events. - * @member {Array.} events - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @instance - */ - ReadAllEventsCompleted.prototype.events = $util.emptyArray; + return ReadAllEvents; + })(); - /** - * ReadAllEventsCompleted nextCommitPosition. - * @member {Long} nextCommitPosition - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @instance - */ - ReadAllEventsCompleted.prototype.nextCommitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Messages.ReadAllEventsCompleted = (function() { - /** - * ReadAllEventsCompleted nextPreparePosition. - * @member {Long} nextPreparePosition - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @instance - */ - ReadAllEventsCompleted.prototype.nextPreparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Properties of a ReadAllEventsCompleted. + * @memberof EventStore.Client.Messages + * @interface IReadAllEventsCompleted + * @property {Long|null} [commitPosition] ReadAllEventsCompleted commitPosition + * @property {Long|null} [preparePosition] ReadAllEventsCompleted preparePosition + * @property {Array.|null} [events] ReadAllEventsCompleted events + * @property {Long|null} [nextCommitPosition] ReadAllEventsCompleted nextCommitPosition + * @property {Long|null} [nextPreparePosition] ReadAllEventsCompleted nextPreparePosition + * @property {EventStore.Client.Messages.ReadAllEventsCompleted.ReadAllResult|null} [result] ReadAllEventsCompleted result + * @property {string|null} [error] ReadAllEventsCompleted error + */ - /** - * ReadAllEventsCompleted result. - * @member {EventStore.Client.Messages.ReadAllEventsCompleted.ReadAllResult} result - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @instance - */ - ReadAllEventsCompleted.prototype.result = 0; + /** + * Constructs a new ReadAllEventsCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ReadAllEventsCompleted. + * @implements IReadAllEventsCompleted + * @constructor + * @param {EventStore.Client.Messages.IReadAllEventsCompleted=} [properties] Properties to set + */ + function ReadAllEventsCompleted(properties) { + this.events = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ReadAllEventsCompleted error. - * @member {string} error - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @instance - */ - ReadAllEventsCompleted.prototype.error = ""; + /** + * ReadAllEventsCompleted commitPosition. + * @member {Long} commitPosition + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @instance + */ + ReadAllEventsCompleted.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Creates a new ReadAllEventsCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @static - * @param {EventStore.Client.Messages.IReadAllEventsCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ReadAllEventsCompleted} ReadAllEventsCompleted instance - */ - ReadAllEventsCompleted.create = function create(properties) { - return new ReadAllEventsCompleted(properties); - }; + /** + * ReadAllEventsCompleted preparePosition. + * @member {Long} preparePosition + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @instance + */ + ReadAllEventsCompleted.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Encodes the specified ReadAllEventsCompleted message. Does not implicitly {@link EventStore.Client.Messages.ReadAllEventsCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @static - * @param {EventStore.Client.Messages.IReadAllEventsCompleted} message ReadAllEventsCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadAllEventsCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * ReadAllEventsCompleted events. + * @member {Array.} events + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @instance + */ + ReadAllEventsCompleted.prototype.events = $util.emptyArray; + + /** + * ReadAllEventsCompleted nextCommitPosition. + * @member {Long} nextCommitPosition + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @instance + */ + ReadAllEventsCompleted.prototype.nextCommitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ReadAllEventsCompleted nextPreparePosition. + * @member {Long} nextPreparePosition + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @instance + */ + ReadAllEventsCompleted.prototype.nextPreparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ReadAllEventsCompleted result. + * @member {EventStore.Client.Messages.ReadAllEventsCompleted.ReadAllResult} result + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @instance + */ + ReadAllEventsCompleted.prototype.result = 0; + + /** + * ReadAllEventsCompleted error. + * @member {string} error + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @instance + */ + ReadAllEventsCompleted.prototype.error = ""; + + /** + * Creates a new ReadAllEventsCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @static + * @param {EventStore.Client.Messages.IReadAllEventsCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ReadAllEventsCompleted} ReadAllEventsCompleted instance + */ + ReadAllEventsCompleted.create = function create(properties) { + return new ReadAllEventsCompleted(properties); + }; + + /** + * Encodes the specified ReadAllEventsCompleted message. Does not implicitly {@link EventStore.Client.Messages.ReadAllEventsCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @static + * @param {EventStore.Client.Messages.IReadAllEventsCompleted} message ReadAllEventsCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadAllEventsCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.commitPosition); + if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.preparePosition); - if (message.events != null && message.events.length) - for (var i = 0; i < message.events.length; ++i) - $root.EventStore.Client.Messages.ResolvedEvent.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.events != null && message.events.length) + for (var i = 0; i < message.events.length; ++i) + $root.EventStore.Client.Messages.ResolvedEvent.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.nextCommitPosition != null && Object.hasOwnProperty.call(message, "nextCommitPosition")) writer.uint32(/* id 4, wireType 0 =*/32).int64(message.nextCommitPosition); + if (message.nextPreparePosition != null && Object.hasOwnProperty.call(message, "nextPreparePosition")) writer.uint32(/* id 5, wireType 0 =*/40).int64(message.nextPreparePosition); - if (message.result != null && Object.hasOwnProperty.call(message, "result")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.result); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.error); - return writer; - }; + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.result); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.error); + return writer; + }; - /** - * Encodes the specified ReadAllEventsCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadAllEventsCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @static - * @param {EventStore.Client.Messages.IReadAllEventsCompleted} message ReadAllEventsCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadAllEventsCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ReadAllEventsCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ReadAllEventsCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @static + * @param {EventStore.Client.Messages.IReadAllEventsCompleted} message ReadAllEventsCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadAllEventsCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ReadAllEventsCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ReadAllEventsCompleted} ReadAllEventsCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadAllEventsCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadAllEventsCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.commitPosition = reader.int64(); - break; - } - case 2: { - message.preparePosition = reader.int64(); - break; - } - case 3: { - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.EventStore.Client.Messages.ResolvedEvent.decode(reader, reader.uint32())); - break; - } - case 4: { - message.nextCommitPosition = reader.int64(); - break; - } - case 5: { - message.nextPreparePosition = reader.int64(); - break; - } - case 6: { - message.result = reader.int32(); - break; - } - case 7: { - message.error = reader.string(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a ReadAllEventsCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ReadAllEventsCompleted} ReadAllEventsCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadAllEventsCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ReadAllEventsCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.commitPosition = reader.int64(); break; } + case 2: { + message.preparePosition = reader.int64(); + break; + } + case 3: { + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.EventStore.Client.Messages.ResolvedEvent.decode(reader, reader.uint32())); + break; + } + case 4: { + message.nextCommitPosition = reader.int64(); + break; + } + case 5: { + message.nextPreparePosition = reader.int64(); + break; + } + case 6: { + message.result = reader.int32(); + break; + } + case 7: { + message.error = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("commitPosition")) - throw $util.ProtocolError("missing required 'commitPosition'", { instance: message }); - if (!message.hasOwnProperty("preparePosition")) - throw $util.ProtocolError("missing required 'preparePosition'", { instance: message }); - if (!message.hasOwnProperty("nextCommitPosition")) - throw $util.ProtocolError("missing required 'nextCommitPosition'", { instance: message }); - if (!message.hasOwnProperty("nextPreparePosition")) - throw $util.ProtocolError("missing required 'nextPreparePosition'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a ReadAllEventsCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ReadAllEventsCompleted} ReadAllEventsCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadAllEventsCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ReadAllEventsCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ReadAllEventsCompleted} ReadAllEventsCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadAllEventsCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a ReadAllEventsCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReadAllEventsCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a ReadAllEventsCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadAllEventsCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) return "commitPosition: integer|Long expected"; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) return "preparePosition: integer|Long expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (var i = 0; i < message.events.length; ++i) { - var error = $root.EventStore.Client.Messages.ResolvedEvent.verify(message.events[i]); - if (error) - return "events." + error; - } + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (var i = 0; i < message.events.length; ++i) { + var error = $root.EventStore.Client.Messages.ResolvedEvent.verify(message.events[i]); + if (error) + return "events." + error; } + } + if (message.nextCommitPosition != null && message.hasOwnProperty("nextCommitPosition")) if (!$util.isInteger(message.nextCommitPosition) && !(message.nextCommitPosition && $util.isInteger(message.nextCommitPosition.low) && $util.isInteger(message.nextCommitPosition.high))) return "nextCommitPosition: integer|Long expected"; + if (message.nextPreparePosition != null && message.hasOwnProperty("nextPreparePosition")) if (!$util.isInteger(message.nextPreparePosition) && !(message.nextPreparePosition && $util.isInteger(message.nextPreparePosition.low) && $util.isInteger(message.nextPreparePosition.high))) return "nextPreparePosition: integer|Long expected"; - if (message.result != null && message.hasOwnProperty("result")) - switch (message.result) { - default: - return "result: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.error != null && message.hasOwnProperty("error")) - if (!$util.isString(message.error)) - return "error: string expected"; - return null; - }; - - /** - * Creates a ReadAllEventsCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ReadAllEventsCompleted} ReadAllEventsCompleted - */ - ReadAllEventsCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ReadAllEventsCompleted) - return object; - var message = new $root.EventStore.Client.Messages.ReadAllEventsCompleted(); - if (object.commitPosition != null) - if ($util.Long) - (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; - else if (typeof object.commitPosition === "string") - message.commitPosition = parseInt(object.commitPosition, 10); - else if (typeof object.commitPosition === "number") - message.commitPosition = object.commitPosition; - else if (typeof object.commitPosition === "object") - message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); - if (object.preparePosition != null) - if ($util.Long) - (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; - else if (typeof object.preparePosition === "string") - message.preparePosition = parseInt(object.preparePosition, 10); - else if (typeof object.preparePosition === "number") - message.preparePosition = object.preparePosition; - else if (typeof object.preparePosition === "object") - message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".EventStore.Client.Messages.ReadAllEventsCompleted.events: array expected"); - message.events = []; - for (var i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".EventStore.Client.Messages.ReadAllEventsCompleted.events: object expected"); - message.events[i] = $root.EventStore.Client.Messages.ResolvedEvent.fromObject(object.events[i]); - } - } - if (object.nextCommitPosition != null) - if ($util.Long) - (message.nextCommitPosition = $util.Long.fromValue(object.nextCommitPosition)).unsigned = false; - else if (typeof object.nextCommitPosition === "string") - message.nextCommitPosition = parseInt(object.nextCommitPosition, 10); - else if (typeof object.nextCommitPosition === "number") - message.nextCommitPosition = object.nextCommitPosition; - else if (typeof object.nextCommitPosition === "object") - message.nextCommitPosition = new $util.LongBits(object.nextCommitPosition.low >>> 0, object.nextCommitPosition.high >>> 0).toNumber(); - if (object.nextPreparePosition != null) - if ($util.Long) - (message.nextPreparePosition = $util.Long.fromValue(object.nextPreparePosition)).unsigned = false; - else if (typeof object.nextPreparePosition === "string") - message.nextPreparePosition = parseInt(object.nextPreparePosition, 10); - else if (typeof object.nextPreparePosition === "number") - message.nextPreparePosition = object.nextPreparePosition; - else if (typeof object.nextPreparePosition === "object") - message.nextPreparePosition = new $util.LongBits(object.nextPreparePosition.low >>> 0, object.nextPreparePosition.high >>> 0).toNumber(); - switch (object.result) { + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": + return "result: enum value expected"; case 0: - message.result = 0; - break; - case "NotModified": case 1: - message.result = 1; - break; - case "Error": case 2: - message.result = 2; - break; - case "AccessDenied": case 3: - message.result = 3; break; } - if (object.error != null) - message.error = String(object.error); - return message; - }; + if (message.error != null && message.hasOwnProperty("error")) + if (!$util.isString(message.error)) + return "error: string expected"; + return null; + }; - /** - * Creates a plain object from a ReadAllEventsCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @static - * @param {EventStore.Client.Messages.ReadAllEventsCompleted} message ReadAllEventsCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReadAllEventsCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.commitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.preparePosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.nextCommitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.nextCommitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.nextPreparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.nextPreparePosition = options.longs === String ? "0" : 0; - object.result = options.enums === String ? "Success" : 0; - object.error = ""; - } - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (typeof message.commitPosition === "number") - object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; - else - object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (typeof message.preparePosition === "number") - object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; - else - object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; - if (message.events && message.events.length) { - object.events = []; - for (var j = 0; j < message.events.length; ++j) - object.events[j] = $root.EventStore.Client.Messages.ResolvedEvent.toObject(message.events[j], options); - } - if (message.nextCommitPosition != null && message.hasOwnProperty("nextCommitPosition")) - if (typeof message.nextCommitPosition === "number") - object.nextCommitPosition = options.longs === String ? String(message.nextCommitPosition) : message.nextCommitPosition; - else - object.nextCommitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.nextCommitPosition) : options.longs === Number ? new $util.LongBits(message.nextCommitPosition.low >>> 0, message.nextCommitPosition.high >>> 0).toNumber() : message.nextCommitPosition; - if (message.nextPreparePosition != null && message.hasOwnProperty("nextPreparePosition")) - if (typeof message.nextPreparePosition === "number") - object.nextPreparePosition = options.longs === String ? String(message.nextPreparePosition) : message.nextPreparePosition; - else - object.nextPreparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.nextPreparePosition) : options.longs === Number ? new $util.LongBits(message.nextPreparePosition.low >>> 0, message.nextPreparePosition.high >>> 0).toNumber() : message.nextPreparePosition; - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.ReadAllEventsCompleted.ReadAllResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.ReadAllEventsCompleted.ReadAllResult[message.result] : message.result; - if (message.error != null && message.hasOwnProperty("error")) - object.error = message.error; + /** + * Creates a ReadAllEventsCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ReadAllEventsCompleted} ReadAllEventsCompleted + */ + ReadAllEventsCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ReadAllEventsCompleted) return object; - }; - - /** - * Converts this ReadAllEventsCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @instance - * @returns {Object.} JSON object - */ - ReadAllEventsCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReadAllEventsCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ReadAllEventsCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReadAllEventsCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + var message = new $root.EventStore.Client.Messages.ReadAllEventsCompleted(); + if (object.commitPosition != null) + if ($util.Long) + (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; + else if (typeof object.commitPosition === "string") + message.commitPosition = parseInt(object.commitPosition, 10); + else if (typeof object.commitPosition === "number") + message.commitPosition = object.commitPosition; + else if (typeof object.commitPosition === "object") + message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); + if (object.preparePosition != null) + if ($util.Long) + (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; + else if (typeof object.preparePosition === "string") + message.preparePosition = parseInt(object.preparePosition, 10); + else if (typeof object.preparePosition === "number") + message.preparePosition = object.preparePosition; + else if (typeof object.preparePosition === "object") + message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".EventStore.Client.Messages.ReadAllEventsCompleted.events: array expected"); + message.events = []; + for (var i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".EventStore.Client.Messages.ReadAllEventsCompleted.events: object expected"); + message.events[i] = $root.EventStore.Client.Messages.ResolvedEvent.fromObject(object.events[i]); } - return typeUrlPrefix + "/EventStore.Client.Messages.ReadAllEventsCompleted"; - }; + } + if (object.nextCommitPosition != null) + if ($util.Long) + (message.nextCommitPosition = $util.Long.fromValue(object.nextCommitPosition)).unsigned = false; + else if (typeof object.nextCommitPosition === "string") + message.nextCommitPosition = parseInt(object.nextCommitPosition, 10); + else if (typeof object.nextCommitPosition === "number") + message.nextCommitPosition = object.nextCommitPosition; + else if (typeof object.nextCommitPosition === "object") + message.nextCommitPosition = new $util.LongBits(object.nextCommitPosition.low >>> 0, object.nextCommitPosition.high >>> 0).toNumber(); + if (object.nextPreparePosition != null) + if ($util.Long) + (message.nextPreparePosition = $util.Long.fromValue(object.nextPreparePosition)).unsigned = false; + else if (typeof object.nextPreparePosition === "string") + message.nextPreparePosition = parseInt(object.nextPreparePosition, 10); + else if (typeof object.nextPreparePosition === "number") + message.nextPreparePosition = object.nextPreparePosition; + else if (typeof object.nextPreparePosition === "object") + message.nextPreparePosition = new $util.LongBits(object.nextPreparePosition.low >>> 0, object.nextPreparePosition.high >>> 0).toNumber(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; + } + break; + case "Success": + case 0: + message.result = 0; + break; + case "NotModified": + case 1: + message.result = 1; + break; + case "Error": + case 2: + message.result = 2; + break; + case "AccessDenied": + case 3: + message.result = 3; + break; + } + if (object.error != null) + message.error = String(object.error); + return message; + }; - /** - * ReadAllResult enum. - * @name EventStore.Client.Messages.ReadAllEventsCompleted.ReadAllResult - * @enum {number} - * @property {number} Success=0 Success value - * @property {number} NotModified=1 NotModified value - * @property {number} Error=2 Error value - * @property {number} AccessDenied=3 AccessDenied value - */ - ReadAllEventsCompleted.ReadAllResult = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Success"] = 0; - values[valuesById[1] = "NotModified"] = 1; - values[valuesById[2] = "Error"] = 2; - values[valuesById[3] = "AccessDenied"] = 3; - return values; - })(); + /** + * Creates a plain object from a ReadAllEventsCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @static + * @param {EventStore.Client.Messages.ReadAllEventsCompleted} message ReadAllEventsCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadAllEventsCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.commitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.preparePosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.nextCommitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.nextCommitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.nextPreparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.nextPreparePosition = options.longs === String ? "0" : 0; + object.result = options.enums === String ? "Success" : 0; + object.error = ""; + } + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (typeof message.commitPosition === "number") + object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; + else + object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (typeof message.preparePosition === "number") + object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; + else + object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; + if (message.events && message.events.length) { + object.events = []; + for (var j = 0; j < message.events.length; ++j) + object.events[j] = $root.EventStore.Client.Messages.ResolvedEvent.toObject(message.events[j], options); + } + if (message.nextCommitPosition != null && message.hasOwnProperty("nextCommitPosition")) + if (typeof message.nextCommitPosition === "number") + object.nextCommitPosition = options.longs === String ? String(message.nextCommitPosition) : message.nextCommitPosition; + else + object.nextCommitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.nextCommitPosition) : options.longs === Number ? new $util.LongBits(message.nextCommitPosition.low >>> 0, message.nextCommitPosition.high >>> 0).toNumber() : message.nextCommitPosition; + if (message.nextPreparePosition != null && message.hasOwnProperty("nextPreparePosition")) + if (typeof message.nextPreparePosition === "number") + object.nextPreparePosition = options.longs === String ? String(message.nextPreparePosition) : message.nextPreparePosition; + else + object.nextPreparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.nextPreparePosition) : options.longs === Number ? new $util.LongBits(message.nextPreparePosition.low >>> 0, message.nextPreparePosition.high >>> 0).toNumber() : message.nextPreparePosition; + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.ReadAllEventsCompleted.ReadAllResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.ReadAllEventsCompleted.ReadAllResult[message.result] : message.result; + if (message.error != null && message.hasOwnProperty("error")) + object.error = message.error; + return object; + }; - return ReadAllEventsCompleted; + /** + * Converts this ReadAllEventsCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @instance + * @returns {Object.} JSON object + */ + ReadAllEventsCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReadAllEventsCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ReadAllEventsCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadAllEventsCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ReadAllEventsCompleted"; + }; + + /** + * ReadAllResult enum. + * @name EventStore.Client.Messages.ReadAllEventsCompleted.ReadAllResult + * @enum {number} + * @property {number} Success=0 Success value + * @property {number} NotModified=1 NotModified value + * @property {number} Error=2 Error value + * @property {number} AccessDenied=3 AccessDenied value + */ + ReadAllEventsCompleted.ReadAllResult = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Success"] = 0; + values[valuesById[1] = "NotModified"] = 1; + values[valuesById[2] = "Error"] = 2; + values[valuesById[3] = "AccessDenied"] = 3; + return values; })(); - Messages.Filter = (function() { + return ReadAllEventsCompleted; + })(); - /** - * Properties of a Filter. - * @memberof EventStore.Client.Messages - * @interface IFilter - * @property {EventStore.Client.Messages.Filter.FilterContext} context Filter context - * @property {EventStore.Client.Messages.Filter.FilterType} type Filter type - * @property {Array.|null} [data] Filter data - */ + Messages.Filter = (function() { - /** - * Constructs a new Filter. - * @memberof EventStore.Client.Messages - * @classdesc Represents a Filter. - * @implements IFilter - * @constructor - * @param {EventStore.Client.Messages.IFilter=} [properties] Properties to set - */ - function Filter(properties) { - this.data = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a Filter. + * @memberof EventStore.Client.Messages + * @interface IFilter + * @property {EventStore.Client.Messages.Filter.FilterContext|null} [context] Filter context + * @property {EventStore.Client.Messages.Filter.FilterType|null} [type] Filter type + * @property {Array.|null} [data] Filter data + */ - /** - * Filter context. - * @member {EventStore.Client.Messages.Filter.FilterContext} context - * @memberof EventStore.Client.Messages.Filter - * @instance - */ - Filter.prototype.context = 0; + /** + * Constructs a new Filter. + * @memberof EventStore.Client.Messages + * @classdesc Represents a Filter. + * @implements IFilter + * @constructor + * @param {EventStore.Client.Messages.IFilter=} [properties] Properties to set + */ + function Filter(properties) { + this.data = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Filter type. - * @member {EventStore.Client.Messages.Filter.FilterType} type - * @memberof EventStore.Client.Messages.Filter - * @instance - */ - Filter.prototype.type = 0; + /** + * Filter context. + * @member {EventStore.Client.Messages.Filter.FilterContext} context + * @memberof EventStore.Client.Messages.Filter + * @instance + */ + Filter.prototype.context = 0; - /** - * Filter data. - * @member {Array.} data - * @memberof EventStore.Client.Messages.Filter - * @instance - */ - Filter.prototype.data = $util.emptyArray; + /** + * Filter type. + * @member {EventStore.Client.Messages.Filter.FilterType} type + * @memberof EventStore.Client.Messages.Filter + * @instance + */ + Filter.prototype.type = 0; - /** - * Creates a new Filter instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.Filter - * @static - * @param {EventStore.Client.Messages.IFilter=} [properties] Properties to set - * @returns {EventStore.Client.Messages.Filter} Filter instance - */ - Filter.create = function create(properties) { - return new Filter(properties); - }; + /** + * Filter data. + * @member {Array.} data + * @memberof EventStore.Client.Messages.Filter + * @instance + */ + Filter.prototype.data = $util.emptyArray; - /** - * Encodes the specified Filter message. Does not implicitly {@link EventStore.Client.Messages.Filter.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.Filter - * @static - * @param {EventStore.Client.Messages.IFilter} message Filter message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Filter.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Creates a new Filter instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.Filter + * @static + * @param {EventStore.Client.Messages.IFilter=} [properties] Properties to set + * @returns {EventStore.Client.Messages.Filter} Filter instance + */ + Filter.create = function create(properties) { + return new Filter(properties); + }; + + /** + * Encodes the specified Filter message. Does not implicitly {@link EventStore.Client.Messages.Filter.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.Filter + * @static + * @param {EventStore.Client.Messages.IFilter} message Filter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Filter.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.context != null && Object.hasOwnProperty.call(message, "context")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.context); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); - if (message.data != null && message.data.length) - for (var i = 0; i < message.data.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.data[i]); - return writer; - }; + if (message.data != null && message.data.length) + for (var i = 0; i < message.data.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.data[i]); + return writer; + }; - /** - * Encodes the specified Filter message, length delimited. Does not implicitly {@link EventStore.Client.Messages.Filter.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.Filter - * @static - * @param {EventStore.Client.Messages.IFilter} message Filter message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Filter.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified Filter message, length delimited. Does not implicitly {@link EventStore.Client.Messages.Filter.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.Filter + * @static + * @param {EventStore.Client.Messages.IFilter} message Filter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Filter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a Filter message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.Filter - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.Filter} Filter - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Filter.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.Filter(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.context = reader.int32(); - break; - } - case 2: { - message.type = reader.int32(); - break; - } - case 3: { - if (!(message.data && message.data.length)) - message.data = []; - message.data.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a Filter message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.Filter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.Filter} Filter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Filter.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.Filter(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.context = reader.int32(); break; } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + if (!(message.data && message.data.length)) + message.data = []; + message.data.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("context")) - throw $util.ProtocolError("missing required 'context'", { instance: message }); - if (!message.hasOwnProperty("type")) - throw $util.ProtocolError("missing required 'type'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a Filter message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.Filter - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.Filter} Filter - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Filter.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a Filter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.Filter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.Filter} Filter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Filter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a Filter message. - * @function verify - * @memberof EventStore.Client.Messages.Filter - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Filter.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a Filter message. + * @function verify + * @memberof EventStore.Client.Messages.Filter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Filter.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.context != null && message.hasOwnProperty("context")) switch (message.context) { default: return "context: enum value expected"; @@ -7116,6 +7108,7 @@ case 1: break; } + if (message.type != null && message.hasOwnProperty("type")) switch (message.type) { default: return "type: enum value expected"; @@ -7123,2524 +7116,2523 @@ case 1: break; } - if (message.data != null && message.hasOwnProperty("data")) { - if (!Array.isArray(message.data)) - return "data: array expected"; - for (var i = 0; i < message.data.length; ++i) - if (!$util.isString(message.data[i])) - return "data: string[] expected"; - } - return null; - }; + if (message.data != null && message.hasOwnProperty("data")) { + if (!Array.isArray(message.data)) + return "data: array expected"; + for (var i = 0; i < message.data.length; ++i) + if (!$util.isString(message.data[i])) + return "data: string[] expected"; + } + return null; + }; - /** - * Creates a Filter message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.Filter - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.Filter} Filter - */ - Filter.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.Filter) - return object; - var message = new $root.EventStore.Client.Messages.Filter(); - switch (object.context) { - default: - if (typeof object.context === "number") { - message.context = object.context; - break; - } - break; - case "StreamId": - case 0: - message.context = 0; - break; - case "EventType": - case 1: - message.context = 1; - break; - } - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "Regex": - case 0: - message.type = 0; - break; - case "Prefix": - case 1: - message.type = 1; - break; - } - if (object.data) { - if (!Array.isArray(object.data)) - throw TypeError(".EventStore.Client.Messages.Filter.data: array expected"); - message.data = []; - for (var i = 0; i < object.data.length; ++i) - message.data[i] = String(object.data[i]); - } - return message; - }; - - /** - * Creates a plain object from a Filter message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.Filter - * @static - * @param {EventStore.Client.Messages.Filter} message Filter - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Filter.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.data = []; - if (options.defaults) { - object.context = options.enums === String ? "StreamId" : 0; - object.type = options.enums === String ? "Regex" : 0; - } - if (message.context != null && message.hasOwnProperty("context")) - object.context = options.enums === String ? $root.EventStore.Client.Messages.Filter.FilterContext[message.context] === undefined ? message.context : $root.EventStore.Client.Messages.Filter.FilterContext[message.context] : message.context; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.EventStore.Client.Messages.Filter.FilterType[message.type] === undefined ? message.type : $root.EventStore.Client.Messages.Filter.FilterType[message.type] : message.type; - if (message.data && message.data.length) { - object.data = []; - for (var j = 0; j < message.data.length; ++j) - object.data[j] = message.data[j]; - } + /** + * Creates a Filter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.Filter + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.Filter} Filter + */ + Filter.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.Filter) return object; - }; - - /** - * Converts this Filter to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.Filter - * @instance - * @returns {Object.} JSON object - */ - Filter.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Filter - * @function getTypeUrl - * @memberof EventStore.Client.Messages.Filter - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Filter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + var message = new $root.EventStore.Client.Messages.Filter(); + switch (object.context) { + default: + if (typeof object.context === "number") { + message.context = object.context; + break; } - return typeUrlPrefix + "/EventStore.Client.Messages.Filter"; - }; + break; + case "StreamId": + case 0: + message.context = 0; + break; + case "EventType": + case 1: + message.context = 1; + break; + } + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "Regex": + case 0: + message.type = 0; + break; + case "Prefix": + case 1: + message.type = 1; + break; + } + if (object.data) { + if (!Array.isArray(object.data)) + throw TypeError(".EventStore.Client.Messages.Filter.data: array expected"); + message.data = []; + for (var i = 0; i < object.data.length; ++i) + message.data[i] = String(object.data[i]); + } + return message; + }; - /** - * FilterContext enum. - * @name EventStore.Client.Messages.Filter.FilterContext - * @enum {number} - * @property {number} StreamId=0 StreamId value - * @property {number} EventType=1 EventType value - */ - Filter.FilterContext = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "StreamId"] = 0; - values[valuesById[1] = "EventType"] = 1; - return values; - })(); + /** + * Creates a plain object from a Filter message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.Filter + * @static + * @param {EventStore.Client.Messages.Filter} message Filter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Filter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.data = []; + if (options.defaults) { + object.context = options.enums === String ? "StreamId" : 0; + object.type = options.enums === String ? "Regex" : 0; + } + if (message.context != null && message.hasOwnProperty("context")) + object.context = options.enums === String ? $root.EventStore.Client.Messages.Filter.FilterContext[message.context] === undefined ? message.context : $root.EventStore.Client.Messages.Filter.FilterContext[message.context] : message.context; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.EventStore.Client.Messages.Filter.FilterType[message.type] === undefined ? message.type : $root.EventStore.Client.Messages.Filter.FilterType[message.type] : message.type; + if (message.data && message.data.length) { + object.data = []; + for (var j = 0; j < message.data.length; ++j) + object.data[j] = message.data[j]; + } + return object; + }; - /** - * FilterType enum. - * @name EventStore.Client.Messages.Filter.FilterType - * @enum {number} - * @property {number} Regex=0 Regex value - * @property {number} Prefix=1 Prefix value - */ - Filter.FilterType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Regex"] = 0; - values[valuesById[1] = "Prefix"] = 1; - return values; - })(); + /** + * Converts this Filter to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.Filter + * @instance + * @returns {Object.} JSON object + */ + Filter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Filter; + /** + * Gets the default type url for Filter + * @function getTypeUrl + * @memberof EventStore.Client.Messages.Filter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Filter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.Filter"; + }; + + /** + * FilterContext enum. + * @name EventStore.Client.Messages.Filter.FilterContext + * @enum {number} + * @property {number} StreamId=0 StreamId value + * @property {number} EventType=1 EventType value + */ + Filter.FilterContext = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "StreamId"] = 0; + values[valuesById[1] = "EventType"] = 1; + return values; })(); - Messages.FilteredReadAllEvents = (function() { + /** + * FilterType enum. + * @name EventStore.Client.Messages.Filter.FilterType + * @enum {number} + * @property {number} Regex=0 Regex value + * @property {number} Prefix=1 Prefix value + */ + Filter.FilterType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Regex"] = 0; + values[valuesById[1] = "Prefix"] = 1; + return values; + })(); - /** - * Properties of a FilteredReadAllEvents. - * @memberof EventStore.Client.Messages - * @interface IFilteredReadAllEvents - * @property {Long} commitPosition FilteredReadAllEvents commitPosition - * @property {Long} preparePosition FilteredReadAllEvents preparePosition - * @property {number} maxCount FilteredReadAllEvents maxCount - * @property {number|null} [maxSearchWindow] FilteredReadAllEvents maxSearchWindow - * @property {boolean} resolveLinkTos FilteredReadAllEvents resolveLinkTos - * @property {boolean} requireLeader FilteredReadAllEvents requireLeader - * @property {EventStore.Client.Messages.IFilter} filter FilteredReadAllEvents filter - */ + return Filter; + })(); - /** - * Constructs a new FilteredReadAllEvents. - * @memberof EventStore.Client.Messages - * @classdesc Represents a FilteredReadAllEvents. - * @implements IFilteredReadAllEvents - * @constructor - * @param {EventStore.Client.Messages.IFilteredReadAllEvents=} [properties] Properties to set - */ - function FilteredReadAllEvents(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Messages.FilteredReadAllEvents = (function() { - /** - * FilteredReadAllEvents commitPosition. - * @member {Long} commitPosition - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @instance - */ - FilteredReadAllEvents.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Properties of a FilteredReadAllEvents. + * @memberof EventStore.Client.Messages + * @interface IFilteredReadAllEvents + * @property {Long|null} [commitPosition] FilteredReadAllEvents commitPosition + * @property {Long|null} [preparePosition] FilteredReadAllEvents preparePosition + * @property {number|null} [maxCount] FilteredReadAllEvents maxCount + * @property {number|null} [maxSearchWindow] FilteredReadAllEvents maxSearchWindow + * @property {boolean|null} [resolveLinkTos] FilteredReadAllEvents resolveLinkTos + * @property {boolean|null} [requireLeader] FilteredReadAllEvents requireLeader + * @property {EventStore.Client.Messages.IFilter|null} [filter] FilteredReadAllEvents filter + */ - /** - * FilteredReadAllEvents preparePosition. - * @member {Long} preparePosition - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @instance - */ - FilteredReadAllEvents.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Constructs a new FilteredReadAllEvents. + * @memberof EventStore.Client.Messages + * @classdesc Represents a FilteredReadAllEvents. + * @implements IFilteredReadAllEvents + * @constructor + * @param {EventStore.Client.Messages.IFilteredReadAllEvents=} [properties] Properties to set + */ + function FilteredReadAllEvents(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * FilteredReadAllEvents maxCount. - * @member {number} maxCount - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @instance - */ - FilteredReadAllEvents.prototype.maxCount = 0; + /** + * FilteredReadAllEvents commitPosition. + * @member {Long} commitPosition + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @instance + */ + FilteredReadAllEvents.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * FilteredReadAllEvents maxSearchWindow. - * @member {number} maxSearchWindow - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @instance - */ - FilteredReadAllEvents.prototype.maxSearchWindow = 0; + /** + * FilteredReadAllEvents preparePosition. + * @member {Long} preparePosition + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @instance + */ + FilteredReadAllEvents.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * FilteredReadAllEvents resolveLinkTos. - * @member {boolean} resolveLinkTos - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @instance - */ - FilteredReadAllEvents.prototype.resolveLinkTos = false; + /** + * FilteredReadAllEvents maxCount. + * @member {number} maxCount + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @instance + */ + FilteredReadAllEvents.prototype.maxCount = 0; - /** - * FilteredReadAllEvents requireLeader. - * @member {boolean} requireLeader - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @instance - */ - FilteredReadAllEvents.prototype.requireLeader = false; + /** + * FilteredReadAllEvents maxSearchWindow. + * @member {number} maxSearchWindow + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @instance + */ + FilteredReadAllEvents.prototype.maxSearchWindow = 0; - /** - * FilteredReadAllEvents filter. - * @member {EventStore.Client.Messages.IFilter} filter - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @instance - */ - FilteredReadAllEvents.prototype.filter = null; + /** + * FilteredReadAllEvents resolveLinkTos. + * @member {boolean} resolveLinkTos + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @instance + */ + FilteredReadAllEvents.prototype.resolveLinkTos = false; - /** - * Creates a new FilteredReadAllEvents instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @static - * @param {EventStore.Client.Messages.IFilteredReadAllEvents=} [properties] Properties to set - * @returns {EventStore.Client.Messages.FilteredReadAllEvents} FilteredReadAllEvents instance - */ - FilteredReadAllEvents.create = function create(properties) { - return new FilteredReadAllEvents(properties); - }; + /** + * FilteredReadAllEvents requireLeader. + * @member {boolean} requireLeader + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @instance + */ + FilteredReadAllEvents.prototype.requireLeader = false; - /** - * Encodes the specified FilteredReadAllEvents message. Does not implicitly {@link EventStore.Client.Messages.FilteredReadAllEvents.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @static - * @param {EventStore.Client.Messages.IFilteredReadAllEvents} message FilteredReadAllEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FilteredReadAllEvents.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * FilteredReadAllEvents filter. + * @member {EventStore.Client.Messages.IFilter|null|undefined} filter + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @instance + */ + FilteredReadAllEvents.prototype.filter = null; + + /** + * Creates a new FilteredReadAllEvents instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @static + * @param {EventStore.Client.Messages.IFilteredReadAllEvents=} [properties] Properties to set + * @returns {EventStore.Client.Messages.FilteredReadAllEvents} FilteredReadAllEvents instance + */ + FilteredReadAllEvents.create = function create(properties) { + return new FilteredReadAllEvents(properties); + }; + + /** + * Encodes the specified FilteredReadAllEvents message. Does not implicitly {@link EventStore.Client.Messages.FilteredReadAllEvents.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @static + * @param {EventStore.Client.Messages.IFilteredReadAllEvents} message FilteredReadAllEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilteredReadAllEvents.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.commitPosition); + if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.preparePosition); + if (message.maxCount != null && Object.hasOwnProperty.call(message, "maxCount")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxCount); - if (message.maxSearchWindow != null && Object.hasOwnProperty.call(message, "maxSearchWindow")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.maxSearchWindow); + if (message.maxSearchWindow != null && Object.hasOwnProperty.call(message, "maxSearchWindow")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.maxSearchWindow); + if (message.resolveLinkTos != null && Object.hasOwnProperty.call(message, "resolveLinkTos")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.resolveLinkTos); + if (message.requireLeader != null && Object.hasOwnProperty.call(message, "requireLeader")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.requireLeader); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) $root.EventStore.Client.Messages.Filter.encode(message.filter, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - return writer; - }; + return writer; + }; - /** - * Encodes the specified FilteredReadAllEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.FilteredReadAllEvents.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @static - * @param {EventStore.Client.Messages.IFilteredReadAllEvents} message FilteredReadAllEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FilteredReadAllEvents.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified FilteredReadAllEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.FilteredReadAllEvents.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @static + * @param {EventStore.Client.Messages.IFilteredReadAllEvents} message FilteredReadAllEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilteredReadAllEvents.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a FilteredReadAllEvents message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.FilteredReadAllEvents} FilteredReadAllEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FilteredReadAllEvents.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.FilteredReadAllEvents(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.commitPosition = reader.int64(); - break; - } - case 2: { - message.preparePosition = reader.int64(); - break; - } - case 3: { - message.maxCount = reader.int32(); - break; - } - case 4: { - message.maxSearchWindow = reader.int32(); - break; - } - case 5: { - message.resolveLinkTos = reader.bool(); - break; - } - case 6: { - message.requireLeader = reader.bool(); - break; - } - case 7: { - message.filter = $root.EventStore.Client.Messages.Filter.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a FilteredReadAllEvents message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.FilteredReadAllEvents} FilteredReadAllEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilteredReadAllEvents.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.FilteredReadAllEvents(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.commitPosition = reader.int64(); break; } + case 2: { + message.preparePosition = reader.int64(); + break; + } + case 3: { + message.maxCount = reader.int32(); + break; + } + case 4: { + message.maxSearchWindow = reader.int32(); + break; + } + case 5: { + message.resolveLinkTos = reader.bool(); + break; + } + case 6: { + message.requireLeader = reader.bool(); + break; + } + case 7: { + message.filter = $root.EventStore.Client.Messages.Filter.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("commitPosition")) - throw $util.ProtocolError("missing required 'commitPosition'", { instance: message }); - if (!message.hasOwnProperty("preparePosition")) - throw $util.ProtocolError("missing required 'preparePosition'", { instance: message }); - if (!message.hasOwnProperty("maxCount")) - throw $util.ProtocolError("missing required 'maxCount'", { instance: message }); - if (!message.hasOwnProperty("resolveLinkTos")) - throw $util.ProtocolError("missing required 'resolveLinkTos'", { instance: message }); - if (!message.hasOwnProperty("requireLeader")) - throw $util.ProtocolError("missing required 'requireLeader'", { instance: message }); - if (!message.hasOwnProperty("filter")) - throw $util.ProtocolError("missing required 'filter'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a FilteredReadAllEvents message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.FilteredReadAllEvents} FilteredReadAllEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FilteredReadAllEvents.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a FilteredReadAllEvents message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.FilteredReadAllEvents} FilteredReadAllEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilteredReadAllEvents.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a FilteredReadAllEvents message. - * @function verify - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FilteredReadAllEvents.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a FilteredReadAllEvents message. + * @function verify + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FilteredReadAllEvents.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) return "commitPosition: integer|Long expected"; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) return "preparePosition: integer|Long expected"; + if (message.maxCount != null && message.hasOwnProperty("maxCount")) if (!$util.isInteger(message.maxCount)) return "maxCount: integer expected"; - if (message.maxSearchWindow != null && message.hasOwnProperty("maxSearchWindow")) - if (!$util.isInteger(message.maxSearchWindow)) - return "maxSearchWindow: integer expected"; + if (message.maxSearchWindow != null && message.hasOwnProperty("maxSearchWindow")) + if (!$util.isInteger(message.maxSearchWindow)) + return "maxSearchWindow: integer expected"; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) if (typeof message.resolveLinkTos !== "boolean") return "resolveLinkTos: boolean expected"; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) if (typeof message.requireLeader !== "boolean") return "requireLeader: boolean expected"; - { - var error = $root.EventStore.Client.Messages.Filter.verify(message.filter); - if (error) - return "filter." + error; - } - return null; - }; - - /** - * Creates a FilteredReadAllEvents message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.FilteredReadAllEvents} FilteredReadAllEvents - */ - FilteredReadAllEvents.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.FilteredReadAllEvents) - return object; - var message = new $root.EventStore.Client.Messages.FilteredReadAllEvents(); - if (object.commitPosition != null) - if ($util.Long) - (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; - else if (typeof object.commitPosition === "string") - message.commitPosition = parseInt(object.commitPosition, 10); - else if (typeof object.commitPosition === "number") - message.commitPosition = object.commitPosition; - else if (typeof object.commitPosition === "object") - message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); - if (object.preparePosition != null) - if ($util.Long) - (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; - else if (typeof object.preparePosition === "string") - message.preparePosition = parseInt(object.preparePosition, 10); - else if (typeof object.preparePosition === "number") - message.preparePosition = object.preparePosition; - else if (typeof object.preparePosition === "object") - message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); - if (object.maxCount != null) - message.maxCount = object.maxCount | 0; - if (object.maxSearchWindow != null) - message.maxSearchWindow = object.maxSearchWindow | 0; - if (object.resolveLinkTos != null) - message.resolveLinkTos = Boolean(object.resolveLinkTos); - if (object.requireLeader != null) - message.requireLeader = Boolean(object.requireLeader); - if (object.filter != null) { - if (typeof object.filter !== "object") - throw TypeError(".EventStore.Client.Messages.FilteredReadAllEvents.filter: object expected"); - message.filter = $root.EventStore.Client.Messages.Filter.fromObject(object.filter); - } - return message; - }; - - /** - * Creates a plain object from a FilteredReadAllEvents message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @static - * @param {EventStore.Client.Messages.FilteredReadAllEvents} message FilteredReadAllEvents - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FilteredReadAllEvents.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.commitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.preparePosition = options.longs === String ? "0" : 0; - object.maxCount = 0; - object.maxSearchWindow = 0; - object.resolveLinkTos = false; - object.requireLeader = false; - object.filter = null; - } - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (typeof message.commitPosition === "number") - object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; - else - object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (typeof message.preparePosition === "number") - object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; - else - object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; - if (message.maxCount != null && message.hasOwnProperty("maxCount")) - object.maxCount = message.maxCount; - if (message.maxSearchWindow != null && message.hasOwnProperty("maxSearchWindow")) - object.maxSearchWindow = message.maxSearchWindow; - if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) - object.resolveLinkTos = message.resolveLinkTos; - if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) - object.requireLeader = message.requireLeader; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = $root.EventStore.Client.Messages.Filter.toObject(message.filter, options); - return object; - }; - - /** - * Converts this FilteredReadAllEvents to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @instance - * @returns {Object.} JSON object - */ - FilteredReadAllEvents.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FilteredReadAllEvents - * @function getTypeUrl - * @memberof EventStore.Client.Messages.FilteredReadAllEvents - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FilteredReadAllEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.FilteredReadAllEvents"; - }; - - return FilteredReadAllEvents; - })(); - - Messages.FilteredReadAllEventsCompleted = (function() { - - /** - * Properties of a FilteredReadAllEventsCompleted. - * @memberof EventStore.Client.Messages - * @interface IFilteredReadAllEventsCompleted - * @property {Long} commitPosition FilteredReadAllEventsCompleted commitPosition - * @property {Long} preparePosition FilteredReadAllEventsCompleted preparePosition - * @property {Array.|null} [events] FilteredReadAllEventsCompleted events - * @property {Long} nextCommitPosition FilteredReadAllEventsCompleted nextCommitPosition - * @property {Long} nextPreparePosition FilteredReadAllEventsCompleted nextPreparePosition - * @property {boolean} isEndOfStream FilteredReadAllEventsCompleted isEndOfStream - * @property {EventStore.Client.Messages.FilteredReadAllEventsCompleted.FilteredReadAllResult|null} [result] FilteredReadAllEventsCompleted result - * @property {string|null} [error] FilteredReadAllEventsCompleted error - */ - - /** - * Constructs a new FilteredReadAllEventsCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a FilteredReadAllEventsCompleted. - * @implements IFilteredReadAllEventsCompleted - * @constructor - * @param {EventStore.Client.Messages.IFilteredReadAllEventsCompleted=} [properties] Properties to set - */ - function FilteredReadAllEventsCompleted(properties) { - this.events = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (message.filter != null && message.hasOwnProperty("filter")) { + var error = $root.EventStore.Client.Messages.Filter.verify(message.filter); + if (error) + return "filter." + error; } + return null; + }; - /** - * FilteredReadAllEventsCompleted commitPosition. - * @member {Long} commitPosition - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @instance - */ - FilteredReadAllEventsCompleted.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Creates a FilteredReadAllEvents message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.FilteredReadAllEvents} FilteredReadAllEvents + */ + FilteredReadAllEvents.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.FilteredReadAllEvents) + return object; + var message = new $root.EventStore.Client.Messages.FilteredReadAllEvents(); + if (object.commitPosition != null) + if ($util.Long) + (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; + else if (typeof object.commitPosition === "string") + message.commitPosition = parseInt(object.commitPosition, 10); + else if (typeof object.commitPosition === "number") + message.commitPosition = object.commitPosition; + else if (typeof object.commitPosition === "object") + message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); + if (object.preparePosition != null) + if ($util.Long) + (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; + else if (typeof object.preparePosition === "string") + message.preparePosition = parseInt(object.preparePosition, 10); + else if (typeof object.preparePosition === "number") + message.preparePosition = object.preparePosition; + else if (typeof object.preparePosition === "object") + message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); + if (object.maxCount != null) + message.maxCount = object.maxCount | 0; + if (object.maxSearchWindow != null) + message.maxSearchWindow = object.maxSearchWindow | 0; + if (object.resolveLinkTos != null) + message.resolveLinkTos = Boolean(object.resolveLinkTos); + if (object.requireLeader != null) + message.requireLeader = Boolean(object.requireLeader); + if (object.filter != null) { + if (typeof object.filter !== "object") + throw TypeError(".EventStore.Client.Messages.FilteredReadAllEvents.filter: object expected"); + message.filter = $root.EventStore.Client.Messages.Filter.fromObject(object.filter); + } + return message; + }; - /** - * FilteredReadAllEventsCompleted preparePosition. - * @member {Long} preparePosition - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @instance - */ - FilteredReadAllEventsCompleted.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Creates a plain object from a FilteredReadAllEvents message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @static + * @param {EventStore.Client.Messages.FilteredReadAllEvents} message FilteredReadAllEvents + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FilteredReadAllEvents.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.commitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.preparePosition = options.longs === String ? "0" : 0; + object.maxCount = 0; + object.maxSearchWindow = 0; + object.resolveLinkTos = false; + object.requireLeader = false; + object.filter = null; + } + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (typeof message.commitPosition === "number") + object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; + else + object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (typeof message.preparePosition === "number") + object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; + else + object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; + if (message.maxCount != null && message.hasOwnProperty("maxCount")) + object.maxCount = message.maxCount; + if (message.maxSearchWindow != null && message.hasOwnProperty("maxSearchWindow")) + object.maxSearchWindow = message.maxSearchWindow; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) + object.resolveLinkTos = message.resolveLinkTos; + if (message.requireLeader != null && message.hasOwnProperty("requireLeader")) + object.requireLeader = message.requireLeader; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = $root.EventStore.Client.Messages.Filter.toObject(message.filter, options); + return object; + }; - /** - * FilteredReadAllEventsCompleted events. - * @member {Array.} events - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @instance - */ - FilteredReadAllEventsCompleted.prototype.events = $util.emptyArray; + /** + * Converts this FilteredReadAllEvents to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @instance + * @returns {Object.} JSON object + */ + FilteredReadAllEvents.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * FilteredReadAllEventsCompleted nextCommitPosition. - * @member {Long} nextCommitPosition - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @instance - */ - FilteredReadAllEventsCompleted.prototype.nextCommitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Gets the default type url for FilteredReadAllEvents + * @function getTypeUrl + * @memberof EventStore.Client.Messages.FilteredReadAllEvents + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FilteredReadAllEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.FilteredReadAllEvents"; + }; - /** - * FilteredReadAllEventsCompleted nextPreparePosition. - * @member {Long} nextPreparePosition - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @instance - */ - FilteredReadAllEventsCompleted.prototype.nextPreparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + return FilteredReadAllEvents; + })(); - /** - * FilteredReadAllEventsCompleted isEndOfStream. - * @member {boolean} isEndOfStream - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @instance - */ - FilteredReadAllEventsCompleted.prototype.isEndOfStream = false; + Messages.FilteredReadAllEventsCompleted = (function() { - /** - * FilteredReadAllEventsCompleted result. - * @member {EventStore.Client.Messages.FilteredReadAllEventsCompleted.FilteredReadAllResult} result - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @instance - */ - FilteredReadAllEventsCompleted.prototype.result = 0; + /** + * Properties of a FilteredReadAllEventsCompleted. + * @memberof EventStore.Client.Messages + * @interface IFilteredReadAllEventsCompleted + * @property {Long|null} [commitPosition] FilteredReadAllEventsCompleted commitPosition + * @property {Long|null} [preparePosition] FilteredReadAllEventsCompleted preparePosition + * @property {Array.|null} [events] FilteredReadAllEventsCompleted events + * @property {Long|null} [nextCommitPosition] FilteredReadAllEventsCompleted nextCommitPosition + * @property {Long|null} [nextPreparePosition] FilteredReadAllEventsCompleted nextPreparePosition + * @property {boolean|null} [isEndOfStream] FilteredReadAllEventsCompleted isEndOfStream + * @property {EventStore.Client.Messages.FilteredReadAllEventsCompleted.FilteredReadAllResult|null} [result] FilteredReadAllEventsCompleted result + * @property {string|null} [error] FilteredReadAllEventsCompleted error + */ - /** - * FilteredReadAllEventsCompleted error. - * @member {string} error - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @instance - */ - FilteredReadAllEventsCompleted.prototype.error = ""; + /** + * Constructs a new FilteredReadAllEventsCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a FilteredReadAllEventsCompleted. + * @implements IFilteredReadAllEventsCompleted + * @constructor + * @param {EventStore.Client.Messages.IFilteredReadAllEventsCompleted=} [properties] Properties to set + */ + function FilteredReadAllEventsCompleted(properties) { + this.events = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new FilteredReadAllEventsCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @static - * @param {EventStore.Client.Messages.IFilteredReadAllEventsCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.FilteredReadAllEventsCompleted} FilteredReadAllEventsCompleted instance - */ - FilteredReadAllEventsCompleted.create = function create(properties) { - return new FilteredReadAllEventsCompleted(properties); - }; + /** + * FilteredReadAllEventsCompleted commitPosition. + * @member {Long} commitPosition + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @instance + */ + FilteredReadAllEventsCompleted.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Encodes the specified FilteredReadAllEventsCompleted message. Does not implicitly {@link EventStore.Client.Messages.FilteredReadAllEventsCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @static - * @param {EventStore.Client.Messages.IFilteredReadAllEventsCompleted} message FilteredReadAllEventsCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FilteredReadAllEventsCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * FilteredReadAllEventsCompleted preparePosition. + * @member {Long} preparePosition + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @instance + */ + FilteredReadAllEventsCompleted.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * FilteredReadAllEventsCompleted events. + * @member {Array.} events + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @instance + */ + FilteredReadAllEventsCompleted.prototype.events = $util.emptyArray; + + /** + * FilteredReadAllEventsCompleted nextCommitPosition. + * @member {Long} nextCommitPosition + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @instance + */ + FilteredReadAllEventsCompleted.prototype.nextCommitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * FilteredReadAllEventsCompleted nextPreparePosition. + * @member {Long} nextPreparePosition + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @instance + */ + FilteredReadAllEventsCompleted.prototype.nextPreparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * FilteredReadAllEventsCompleted isEndOfStream. + * @member {boolean} isEndOfStream + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @instance + */ + FilteredReadAllEventsCompleted.prototype.isEndOfStream = false; + + /** + * FilteredReadAllEventsCompleted result. + * @member {EventStore.Client.Messages.FilteredReadAllEventsCompleted.FilteredReadAllResult} result + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @instance + */ + FilteredReadAllEventsCompleted.prototype.result = 0; + + /** + * FilteredReadAllEventsCompleted error. + * @member {string} error + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @instance + */ + FilteredReadAllEventsCompleted.prototype.error = ""; + + /** + * Creates a new FilteredReadAllEventsCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @static + * @param {EventStore.Client.Messages.IFilteredReadAllEventsCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.FilteredReadAllEventsCompleted} FilteredReadAllEventsCompleted instance + */ + FilteredReadAllEventsCompleted.create = function create(properties) { + return new FilteredReadAllEventsCompleted(properties); + }; + + /** + * Encodes the specified FilteredReadAllEventsCompleted message. Does not implicitly {@link EventStore.Client.Messages.FilteredReadAllEventsCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @static + * @param {EventStore.Client.Messages.IFilteredReadAllEventsCompleted} message FilteredReadAllEventsCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilteredReadAllEventsCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.commitPosition); + if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.preparePosition); - if (message.events != null && message.events.length) - for (var i = 0; i < message.events.length; ++i) - $root.EventStore.Client.Messages.ResolvedEvent.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.events != null && message.events.length) + for (var i = 0; i < message.events.length; ++i) + $root.EventStore.Client.Messages.ResolvedEvent.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.nextCommitPosition != null && Object.hasOwnProperty.call(message, "nextCommitPosition")) writer.uint32(/* id 4, wireType 0 =*/32).int64(message.nextCommitPosition); + if (message.nextPreparePosition != null && Object.hasOwnProperty.call(message, "nextPreparePosition")) writer.uint32(/* id 5, wireType 0 =*/40).int64(message.nextPreparePosition); + if (message.isEndOfStream != null && Object.hasOwnProperty.call(message, "isEndOfStream")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.isEndOfStream); - if (message.result != null && Object.hasOwnProperty.call(message, "result")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.result); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.error); - return writer; - }; + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.result); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.error); + return writer; + }; - /** - * Encodes the specified FilteredReadAllEventsCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.FilteredReadAllEventsCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @static - * @param {EventStore.Client.Messages.IFilteredReadAllEventsCompleted} message FilteredReadAllEventsCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FilteredReadAllEventsCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified FilteredReadAllEventsCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.FilteredReadAllEventsCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @static + * @param {EventStore.Client.Messages.IFilteredReadAllEventsCompleted} message FilteredReadAllEventsCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilteredReadAllEventsCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a FilteredReadAllEventsCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.FilteredReadAllEventsCompleted} FilteredReadAllEventsCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FilteredReadAllEventsCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.FilteredReadAllEventsCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.commitPosition = reader.int64(); - break; - } - case 2: { - message.preparePosition = reader.int64(); - break; - } - case 3: { - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.EventStore.Client.Messages.ResolvedEvent.decode(reader, reader.uint32())); - break; - } - case 4: { - message.nextCommitPosition = reader.int64(); - break; - } - case 5: { - message.nextPreparePosition = reader.int64(); - break; - } - case 6: { - message.isEndOfStream = reader.bool(); - break; - } - case 7: { - message.result = reader.int32(); - break; - } - case 8: { - message.error = reader.string(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a FilteredReadAllEventsCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.FilteredReadAllEventsCompleted} FilteredReadAllEventsCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilteredReadAllEventsCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.FilteredReadAllEventsCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.commitPosition = reader.int64(); break; } + case 2: { + message.preparePosition = reader.int64(); + break; + } + case 3: { + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.EventStore.Client.Messages.ResolvedEvent.decode(reader, reader.uint32())); + break; + } + case 4: { + message.nextCommitPosition = reader.int64(); + break; + } + case 5: { + message.nextPreparePosition = reader.int64(); + break; + } + case 6: { + message.isEndOfStream = reader.bool(); + break; + } + case 7: { + message.result = reader.int32(); + break; + } + case 8: { + message.error = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("commitPosition")) - throw $util.ProtocolError("missing required 'commitPosition'", { instance: message }); - if (!message.hasOwnProperty("preparePosition")) - throw $util.ProtocolError("missing required 'preparePosition'", { instance: message }); - if (!message.hasOwnProperty("nextCommitPosition")) - throw $util.ProtocolError("missing required 'nextCommitPosition'", { instance: message }); - if (!message.hasOwnProperty("nextPreparePosition")) - throw $util.ProtocolError("missing required 'nextPreparePosition'", { instance: message }); - if (!message.hasOwnProperty("isEndOfStream")) - throw $util.ProtocolError("missing required 'isEndOfStream'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a FilteredReadAllEventsCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.FilteredReadAllEventsCompleted} FilteredReadAllEventsCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FilteredReadAllEventsCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a FilteredReadAllEventsCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.FilteredReadAllEventsCompleted} FilteredReadAllEventsCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilteredReadAllEventsCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a FilteredReadAllEventsCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FilteredReadAllEventsCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a FilteredReadAllEventsCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FilteredReadAllEventsCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) return "commitPosition: integer|Long expected"; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) return "preparePosition: integer|Long expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (var i = 0; i < message.events.length; ++i) { - var error = $root.EventStore.Client.Messages.ResolvedEvent.verify(message.events[i]); - if (error) - return "events." + error; - } + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (var i = 0; i < message.events.length; ++i) { + var error = $root.EventStore.Client.Messages.ResolvedEvent.verify(message.events[i]); + if (error) + return "events." + error; } + } + if (message.nextCommitPosition != null && message.hasOwnProperty("nextCommitPosition")) if (!$util.isInteger(message.nextCommitPosition) && !(message.nextCommitPosition && $util.isInteger(message.nextCommitPosition.low) && $util.isInteger(message.nextCommitPosition.high))) return "nextCommitPosition: integer|Long expected"; + if (message.nextPreparePosition != null && message.hasOwnProperty("nextPreparePosition")) if (!$util.isInteger(message.nextPreparePosition) && !(message.nextPreparePosition && $util.isInteger(message.nextPreparePosition.low) && $util.isInteger(message.nextPreparePosition.high))) return "nextPreparePosition: integer|Long expected"; + if (message.isEndOfStream != null && message.hasOwnProperty("isEndOfStream")) if (typeof message.isEndOfStream !== "boolean") return "isEndOfStream: boolean expected"; - if (message.result != null && message.hasOwnProperty("result")) - switch (message.result) { - default: - return "result: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.error != null && message.hasOwnProperty("error")) - if (!$util.isString(message.error)) - return "error: string expected"; - return null; - }; - - /** - * Creates a FilteredReadAllEventsCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.FilteredReadAllEventsCompleted} FilteredReadAllEventsCompleted - */ - FilteredReadAllEventsCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.FilteredReadAllEventsCompleted) - return object; - var message = new $root.EventStore.Client.Messages.FilteredReadAllEventsCompleted(); - if (object.commitPosition != null) - if ($util.Long) - (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; - else if (typeof object.commitPosition === "string") - message.commitPosition = parseInt(object.commitPosition, 10); - else if (typeof object.commitPosition === "number") - message.commitPosition = object.commitPosition; - else if (typeof object.commitPosition === "object") - message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); - if (object.preparePosition != null) - if ($util.Long) - (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; - else if (typeof object.preparePosition === "string") - message.preparePosition = parseInt(object.preparePosition, 10); - else if (typeof object.preparePosition === "number") - message.preparePosition = object.preparePosition; - else if (typeof object.preparePosition === "object") - message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".EventStore.Client.Messages.FilteredReadAllEventsCompleted.events: array expected"); - message.events = []; - for (var i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".EventStore.Client.Messages.FilteredReadAllEventsCompleted.events: object expected"); - message.events[i] = $root.EventStore.Client.Messages.ResolvedEvent.fromObject(object.events[i]); - } - } - if (object.nextCommitPosition != null) - if ($util.Long) - (message.nextCommitPosition = $util.Long.fromValue(object.nextCommitPosition)).unsigned = false; - else if (typeof object.nextCommitPosition === "string") - message.nextCommitPosition = parseInt(object.nextCommitPosition, 10); - else if (typeof object.nextCommitPosition === "number") - message.nextCommitPosition = object.nextCommitPosition; - else if (typeof object.nextCommitPosition === "object") - message.nextCommitPosition = new $util.LongBits(object.nextCommitPosition.low >>> 0, object.nextCommitPosition.high >>> 0).toNumber(); - if (object.nextPreparePosition != null) - if ($util.Long) - (message.nextPreparePosition = $util.Long.fromValue(object.nextPreparePosition)).unsigned = false; - else if (typeof object.nextPreparePosition === "string") - message.nextPreparePosition = parseInt(object.nextPreparePosition, 10); - else if (typeof object.nextPreparePosition === "number") - message.nextPreparePosition = object.nextPreparePosition; - else if (typeof object.nextPreparePosition === "object") - message.nextPreparePosition = new $util.LongBits(object.nextPreparePosition.low >>> 0, object.nextPreparePosition.high >>> 0).toNumber(); - if (object.isEndOfStream != null) - message.isEndOfStream = Boolean(object.isEndOfStream); - switch (object.result) { + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": + return "result: enum value expected"; case 0: - message.result = 0; - break; - case "NotModified": case 1: - message.result = 1; - break; - case "Error": case 2: - message.result = 2; - break; - case "AccessDenied": case 3: - message.result = 3; break; } - if (object.error != null) - message.error = String(object.error); - return message; - }; + if (message.error != null && message.hasOwnProperty("error")) + if (!$util.isString(message.error)) + return "error: string expected"; + return null; + }; - /** - * Creates a plain object from a FilteredReadAllEventsCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @static - * @param {EventStore.Client.Messages.FilteredReadAllEventsCompleted} message FilteredReadAllEventsCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FilteredReadAllEventsCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.commitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.preparePosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.nextCommitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.nextCommitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.nextPreparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.nextPreparePosition = options.longs === String ? "0" : 0; - object.isEndOfStream = false; - object.result = options.enums === String ? "Success" : 0; - object.error = ""; - } - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (typeof message.commitPosition === "number") - object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; - else - object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (typeof message.preparePosition === "number") - object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; - else - object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; - if (message.events && message.events.length) { - object.events = []; - for (var j = 0; j < message.events.length; ++j) - object.events[j] = $root.EventStore.Client.Messages.ResolvedEvent.toObject(message.events[j], options); - } - if (message.nextCommitPosition != null && message.hasOwnProperty("nextCommitPosition")) - if (typeof message.nextCommitPosition === "number") - object.nextCommitPosition = options.longs === String ? String(message.nextCommitPosition) : message.nextCommitPosition; - else - object.nextCommitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.nextCommitPosition) : options.longs === Number ? new $util.LongBits(message.nextCommitPosition.low >>> 0, message.nextCommitPosition.high >>> 0).toNumber() : message.nextCommitPosition; - if (message.nextPreparePosition != null && message.hasOwnProperty("nextPreparePosition")) - if (typeof message.nextPreparePosition === "number") - object.nextPreparePosition = options.longs === String ? String(message.nextPreparePosition) : message.nextPreparePosition; - else - object.nextPreparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.nextPreparePosition) : options.longs === Number ? new $util.LongBits(message.nextPreparePosition.low >>> 0, message.nextPreparePosition.high >>> 0).toNumber() : message.nextPreparePosition; - if (message.isEndOfStream != null && message.hasOwnProperty("isEndOfStream")) - object.isEndOfStream = message.isEndOfStream; - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.FilteredReadAllEventsCompleted.FilteredReadAllResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.FilteredReadAllEventsCompleted.FilteredReadAllResult[message.result] : message.result; - if (message.error != null && message.hasOwnProperty("error")) - object.error = message.error; + /** + * Creates a FilteredReadAllEventsCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.FilteredReadAllEventsCompleted} FilteredReadAllEventsCompleted + */ + FilteredReadAllEventsCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.FilteredReadAllEventsCompleted) return object; - }; - - /** - * Converts this FilteredReadAllEventsCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @instance - * @returns {Object.} JSON object - */ - FilteredReadAllEventsCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FilteredReadAllEventsCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FilteredReadAllEventsCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + var message = new $root.EventStore.Client.Messages.FilteredReadAllEventsCompleted(); + if (object.commitPosition != null) + if ($util.Long) + (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; + else if (typeof object.commitPosition === "string") + message.commitPosition = parseInt(object.commitPosition, 10); + else if (typeof object.commitPosition === "number") + message.commitPosition = object.commitPosition; + else if (typeof object.commitPosition === "object") + message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); + if (object.preparePosition != null) + if ($util.Long) + (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; + else if (typeof object.preparePosition === "string") + message.preparePosition = parseInt(object.preparePosition, 10); + else if (typeof object.preparePosition === "number") + message.preparePosition = object.preparePosition; + else if (typeof object.preparePosition === "object") + message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".EventStore.Client.Messages.FilteredReadAllEventsCompleted.events: array expected"); + message.events = []; + for (var i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".EventStore.Client.Messages.FilteredReadAllEventsCompleted.events: object expected"); + message.events[i] = $root.EventStore.Client.Messages.ResolvedEvent.fromObject(object.events[i]); } - return typeUrlPrefix + "/EventStore.Client.Messages.FilteredReadAllEventsCompleted"; - }; + } + if (object.nextCommitPosition != null) + if ($util.Long) + (message.nextCommitPosition = $util.Long.fromValue(object.nextCommitPosition)).unsigned = false; + else if (typeof object.nextCommitPosition === "string") + message.nextCommitPosition = parseInt(object.nextCommitPosition, 10); + else if (typeof object.nextCommitPosition === "number") + message.nextCommitPosition = object.nextCommitPosition; + else if (typeof object.nextCommitPosition === "object") + message.nextCommitPosition = new $util.LongBits(object.nextCommitPosition.low >>> 0, object.nextCommitPosition.high >>> 0).toNumber(); + if (object.nextPreparePosition != null) + if ($util.Long) + (message.nextPreparePosition = $util.Long.fromValue(object.nextPreparePosition)).unsigned = false; + else if (typeof object.nextPreparePosition === "string") + message.nextPreparePosition = parseInt(object.nextPreparePosition, 10); + else if (typeof object.nextPreparePosition === "number") + message.nextPreparePosition = object.nextPreparePosition; + else if (typeof object.nextPreparePosition === "object") + message.nextPreparePosition = new $util.LongBits(object.nextPreparePosition.low >>> 0, object.nextPreparePosition.high >>> 0).toNumber(); + if (object.isEndOfStream != null) + message.isEndOfStream = Boolean(object.isEndOfStream); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; + } + break; + case "Success": + case 0: + message.result = 0; + break; + case "NotModified": + case 1: + message.result = 1; + break; + case "Error": + case 2: + message.result = 2; + break; + case "AccessDenied": + case 3: + message.result = 3; + break; + } + if (object.error != null) + message.error = String(object.error); + return message; + }; - /** - * FilteredReadAllResult enum. - * @name EventStore.Client.Messages.FilteredReadAllEventsCompleted.FilteredReadAllResult - * @enum {number} - * @property {number} Success=0 Success value - * @property {number} NotModified=1 NotModified value - * @property {number} Error=2 Error value - * @property {number} AccessDenied=3 AccessDenied value - */ - FilteredReadAllEventsCompleted.FilteredReadAllResult = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Success"] = 0; - values[valuesById[1] = "NotModified"] = 1; - values[valuesById[2] = "Error"] = 2; - values[valuesById[3] = "AccessDenied"] = 3; - return values; - })(); + /** + * Creates a plain object from a FilteredReadAllEventsCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @static + * @param {EventStore.Client.Messages.FilteredReadAllEventsCompleted} message FilteredReadAllEventsCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FilteredReadAllEventsCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.commitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.preparePosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.nextCommitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.nextCommitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.nextPreparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.nextPreparePosition = options.longs === String ? "0" : 0; + object.isEndOfStream = false; + object.result = options.enums === String ? "Success" : 0; + object.error = ""; + } + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (typeof message.commitPosition === "number") + object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; + else + object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (typeof message.preparePosition === "number") + object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; + else + object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; + if (message.events && message.events.length) { + object.events = []; + for (var j = 0; j < message.events.length; ++j) + object.events[j] = $root.EventStore.Client.Messages.ResolvedEvent.toObject(message.events[j], options); + } + if (message.nextCommitPosition != null && message.hasOwnProperty("nextCommitPosition")) + if (typeof message.nextCommitPosition === "number") + object.nextCommitPosition = options.longs === String ? String(message.nextCommitPosition) : message.nextCommitPosition; + else + object.nextCommitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.nextCommitPosition) : options.longs === Number ? new $util.LongBits(message.nextCommitPosition.low >>> 0, message.nextCommitPosition.high >>> 0).toNumber() : message.nextCommitPosition; + if (message.nextPreparePosition != null && message.hasOwnProperty("nextPreparePosition")) + if (typeof message.nextPreparePosition === "number") + object.nextPreparePosition = options.longs === String ? String(message.nextPreparePosition) : message.nextPreparePosition; + else + object.nextPreparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.nextPreparePosition) : options.longs === Number ? new $util.LongBits(message.nextPreparePosition.low >>> 0, message.nextPreparePosition.high >>> 0).toNumber() : message.nextPreparePosition; + if (message.isEndOfStream != null && message.hasOwnProperty("isEndOfStream")) + object.isEndOfStream = message.isEndOfStream; + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.FilteredReadAllEventsCompleted.FilteredReadAllResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.FilteredReadAllEventsCompleted.FilteredReadAllResult[message.result] : message.result; + if (message.error != null && message.hasOwnProperty("error")) + object.error = message.error; + return object; + }; - return FilteredReadAllEventsCompleted; + /** + * Converts this FilteredReadAllEventsCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @instance + * @returns {Object.} JSON object + */ + FilteredReadAllEventsCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FilteredReadAllEventsCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.FilteredReadAllEventsCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FilteredReadAllEventsCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.FilteredReadAllEventsCompleted"; + }; + + /** + * FilteredReadAllResult enum. + * @name EventStore.Client.Messages.FilteredReadAllEventsCompleted.FilteredReadAllResult + * @enum {number} + * @property {number} Success=0 Success value + * @property {number} NotModified=1 NotModified value + * @property {number} Error=2 Error value + * @property {number} AccessDenied=3 AccessDenied value + */ + FilteredReadAllEventsCompleted.FilteredReadAllResult = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Success"] = 0; + values[valuesById[1] = "NotModified"] = 1; + values[valuesById[2] = "Error"] = 2; + values[valuesById[3] = "AccessDenied"] = 3; + return values; })(); - Messages.CreatePersistentSubscription = (function() { + return FilteredReadAllEventsCompleted; + })(); - /** - * Properties of a CreatePersistentSubscription. - * @memberof EventStore.Client.Messages - * @interface ICreatePersistentSubscription - * @property {string} subscriptionGroupName CreatePersistentSubscription subscriptionGroupName - * @property {string} eventStreamId CreatePersistentSubscription eventStreamId - * @property {boolean} resolveLinkTos CreatePersistentSubscription resolveLinkTos - * @property {Long} startFrom CreatePersistentSubscription startFrom - * @property {number} messageTimeoutMilliseconds CreatePersistentSubscription messageTimeoutMilliseconds - * @property {boolean} recordStatistics CreatePersistentSubscription recordStatistics - * @property {number} liveBufferSize CreatePersistentSubscription liveBufferSize - * @property {number} readBatchSize CreatePersistentSubscription readBatchSize - * @property {number} bufferSize CreatePersistentSubscription bufferSize - * @property {number} maxRetryCount CreatePersistentSubscription maxRetryCount - * @property {boolean} preferRoundRobin CreatePersistentSubscription preferRoundRobin - * @property {number} checkpointAfterTime CreatePersistentSubscription checkpointAfterTime - * @property {number} checkpointMaxCount CreatePersistentSubscription checkpointMaxCount - * @property {number} checkpointMinCount CreatePersistentSubscription checkpointMinCount - * @property {number} subscriberMaxCount CreatePersistentSubscription subscriberMaxCount - * @property {string|null} [namedConsumerStrategy] CreatePersistentSubscription namedConsumerStrategy - */ + Messages.CreatePersistentSubscription = (function() { - /** - * Constructs a new CreatePersistentSubscription. - * @memberof EventStore.Client.Messages - * @classdesc Represents a CreatePersistentSubscription. - * @implements ICreatePersistentSubscription - * @constructor - * @param {EventStore.Client.Messages.ICreatePersistentSubscription=} [properties] Properties to set - */ - function CreatePersistentSubscription(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a CreatePersistentSubscription. + * @memberof EventStore.Client.Messages + * @interface ICreatePersistentSubscription + * @property {string|null} [subscriptionGroupName] CreatePersistentSubscription subscriptionGroupName + * @property {string|null} [eventStreamId] CreatePersistentSubscription eventStreamId + * @property {boolean|null} [resolveLinkTos] CreatePersistentSubscription resolveLinkTos + * @property {Long|null} [startFrom] CreatePersistentSubscription startFrom + * @property {number|null} [messageTimeoutMilliseconds] CreatePersistentSubscription messageTimeoutMilliseconds + * @property {boolean|null} [recordStatistics] CreatePersistentSubscription recordStatistics + * @property {number|null} [liveBufferSize] CreatePersistentSubscription liveBufferSize + * @property {number|null} [readBatchSize] CreatePersistentSubscription readBatchSize + * @property {number|null} [bufferSize] CreatePersistentSubscription bufferSize + * @property {number|null} [maxRetryCount] CreatePersistentSubscription maxRetryCount + * @property {boolean|null} [preferRoundRobin] CreatePersistentSubscription preferRoundRobin + * @property {number|null} [checkpointAfterTime] CreatePersistentSubscription checkpointAfterTime + * @property {number|null} [checkpointMaxCount] CreatePersistentSubscription checkpointMaxCount + * @property {number|null} [checkpointMinCount] CreatePersistentSubscription checkpointMinCount + * @property {number|null} [subscriberMaxCount] CreatePersistentSubscription subscriberMaxCount + * @property {string|null} [namedConsumerStrategy] CreatePersistentSubscription namedConsumerStrategy + */ - /** - * CreatePersistentSubscription subscriptionGroupName. - * @member {string} subscriptionGroupName - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.subscriptionGroupName = ""; + /** + * Constructs a new CreatePersistentSubscription. + * @memberof EventStore.Client.Messages + * @classdesc Represents a CreatePersistentSubscription. + * @implements ICreatePersistentSubscription + * @constructor + * @param {EventStore.Client.Messages.ICreatePersistentSubscription=} [properties] Properties to set + */ + function CreatePersistentSubscription(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * CreatePersistentSubscription eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.eventStreamId = ""; + /** + * CreatePersistentSubscription subscriptionGroupName. + * @member {string} subscriptionGroupName + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.subscriptionGroupName = ""; - /** - * CreatePersistentSubscription resolveLinkTos. - * @member {boolean} resolveLinkTos - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.resolveLinkTos = false; + /** + * CreatePersistentSubscription eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.eventStreamId = ""; - /** - * CreatePersistentSubscription startFrom. - * @member {Long} startFrom - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.startFrom = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * CreatePersistentSubscription resolveLinkTos. + * @member {boolean} resolveLinkTos + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.resolveLinkTos = false; - /** - * CreatePersistentSubscription messageTimeoutMilliseconds. - * @member {number} messageTimeoutMilliseconds - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.messageTimeoutMilliseconds = 0; + /** + * CreatePersistentSubscription startFrom. + * @member {Long} startFrom + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.startFrom = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * CreatePersistentSubscription recordStatistics. - * @member {boolean} recordStatistics - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.recordStatistics = false; + /** + * CreatePersistentSubscription messageTimeoutMilliseconds. + * @member {number} messageTimeoutMilliseconds + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.messageTimeoutMilliseconds = 0; - /** - * CreatePersistentSubscription liveBufferSize. - * @member {number} liveBufferSize - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.liveBufferSize = 0; + /** + * CreatePersistentSubscription recordStatistics. + * @member {boolean} recordStatistics + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.recordStatistics = false; - /** - * CreatePersistentSubscription readBatchSize. - * @member {number} readBatchSize - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.readBatchSize = 0; + /** + * CreatePersistentSubscription liveBufferSize. + * @member {number} liveBufferSize + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.liveBufferSize = 0; - /** - * CreatePersistentSubscription bufferSize. - * @member {number} bufferSize - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.bufferSize = 0; + /** + * CreatePersistentSubscription readBatchSize. + * @member {number} readBatchSize + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.readBatchSize = 0; - /** - * CreatePersistentSubscription maxRetryCount. - * @member {number} maxRetryCount - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.maxRetryCount = 0; + /** + * CreatePersistentSubscription bufferSize. + * @member {number} bufferSize + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.bufferSize = 0; - /** - * CreatePersistentSubscription preferRoundRobin. - * @member {boolean} preferRoundRobin - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.preferRoundRobin = false; + /** + * CreatePersistentSubscription maxRetryCount. + * @member {number} maxRetryCount + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.maxRetryCount = 0; - /** - * CreatePersistentSubscription checkpointAfterTime. - * @member {number} checkpointAfterTime - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.checkpointAfterTime = 0; + /** + * CreatePersistentSubscription preferRoundRobin. + * @member {boolean} preferRoundRobin + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.preferRoundRobin = false; - /** - * CreatePersistentSubscription checkpointMaxCount. - * @member {number} checkpointMaxCount - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.checkpointMaxCount = 0; + /** + * CreatePersistentSubscription checkpointAfterTime. + * @member {number} checkpointAfterTime + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.checkpointAfterTime = 0; - /** - * CreatePersistentSubscription checkpointMinCount. - * @member {number} checkpointMinCount - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.checkpointMinCount = 0; + /** + * CreatePersistentSubscription checkpointMaxCount. + * @member {number} checkpointMaxCount + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.checkpointMaxCount = 0; - /** - * CreatePersistentSubscription subscriberMaxCount. - * @member {number} subscriberMaxCount - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.subscriberMaxCount = 0; + /** + * CreatePersistentSubscription checkpointMinCount. + * @member {number} checkpointMinCount + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.checkpointMinCount = 0; - /** - * CreatePersistentSubscription namedConsumerStrategy. - * @member {string} namedConsumerStrategy - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - */ - CreatePersistentSubscription.prototype.namedConsumerStrategy = ""; + /** + * CreatePersistentSubscription subscriberMaxCount. + * @member {number} subscriberMaxCount + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.subscriberMaxCount = 0; - /** - * Creates a new CreatePersistentSubscription instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @static - * @param {EventStore.Client.Messages.ICreatePersistentSubscription=} [properties] Properties to set - * @returns {EventStore.Client.Messages.CreatePersistentSubscription} CreatePersistentSubscription instance - */ - CreatePersistentSubscription.create = function create(properties) { - return new CreatePersistentSubscription(properties); - }; + /** + * CreatePersistentSubscription namedConsumerStrategy. + * @member {string} namedConsumerStrategy + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + */ + CreatePersistentSubscription.prototype.namedConsumerStrategy = ""; - /** - * Encodes the specified CreatePersistentSubscription message. Does not implicitly {@link EventStore.Client.Messages.CreatePersistentSubscription.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @static - * @param {EventStore.Client.Messages.ICreatePersistentSubscription} message CreatePersistentSubscription message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreatePersistentSubscription.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Creates a new CreatePersistentSubscription instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @static + * @param {EventStore.Client.Messages.ICreatePersistentSubscription=} [properties] Properties to set + * @returns {EventStore.Client.Messages.CreatePersistentSubscription} CreatePersistentSubscription instance + */ + CreatePersistentSubscription.create = function create(properties) { + return new CreatePersistentSubscription(properties); + }; + + /** + * Encodes the specified CreatePersistentSubscription message. Does not implicitly {@link EventStore.Client.Messages.CreatePersistentSubscription.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @static + * @param {EventStore.Client.Messages.ICreatePersistentSubscription} message CreatePersistentSubscription message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreatePersistentSubscription.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subscriptionGroupName != null && Object.hasOwnProperty.call(message, "subscriptionGroupName")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscriptionGroupName); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.eventStreamId); + if (message.resolveLinkTos != null && Object.hasOwnProperty.call(message, "resolveLinkTos")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.resolveLinkTos); + if (message.startFrom != null && Object.hasOwnProperty.call(message, "startFrom")) writer.uint32(/* id 4, wireType 0 =*/32).int64(message.startFrom); + if (message.messageTimeoutMilliseconds != null && Object.hasOwnProperty.call(message, "messageTimeoutMilliseconds")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageTimeoutMilliseconds); + if (message.recordStatistics != null && Object.hasOwnProperty.call(message, "recordStatistics")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.recordStatistics); + if (message.liveBufferSize != null && Object.hasOwnProperty.call(message, "liveBufferSize")) writer.uint32(/* id 7, wireType 0 =*/56).int32(message.liveBufferSize); + if (message.readBatchSize != null && Object.hasOwnProperty.call(message, "readBatchSize")) writer.uint32(/* id 8, wireType 0 =*/64).int32(message.readBatchSize); + if (message.bufferSize != null && Object.hasOwnProperty.call(message, "bufferSize")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.bufferSize); + if (message.maxRetryCount != null && Object.hasOwnProperty.call(message, "maxRetryCount")) writer.uint32(/* id 10, wireType 0 =*/80).int32(message.maxRetryCount); + if (message.preferRoundRobin != null && Object.hasOwnProperty.call(message, "preferRoundRobin")) writer.uint32(/* id 11, wireType 0 =*/88).bool(message.preferRoundRobin); + if (message.checkpointAfterTime != null && Object.hasOwnProperty.call(message, "checkpointAfterTime")) writer.uint32(/* id 12, wireType 0 =*/96).int32(message.checkpointAfterTime); + if (message.checkpointMaxCount != null && Object.hasOwnProperty.call(message, "checkpointMaxCount")) writer.uint32(/* id 13, wireType 0 =*/104).int32(message.checkpointMaxCount); + if (message.checkpointMinCount != null && Object.hasOwnProperty.call(message, "checkpointMinCount")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.checkpointMinCount); + if (message.subscriberMaxCount != null && Object.hasOwnProperty.call(message, "subscriberMaxCount")) writer.uint32(/* id 15, wireType 0 =*/120).int32(message.subscriberMaxCount); - if (message.namedConsumerStrategy != null && Object.hasOwnProperty.call(message, "namedConsumerStrategy")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.namedConsumerStrategy); - return writer; - }; + if (message.namedConsumerStrategy != null && Object.hasOwnProperty.call(message, "namedConsumerStrategy")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.namedConsumerStrategy); + return writer; + }; - /** - * Encodes the specified CreatePersistentSubscription message, length delimited. Does not implicitly {@link EventStore.Client.Messages.CreatePersistentSubscription.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @static - * @param {EventStore.Client.Messages.ICreatePersistentSubscription} message CreatePersistentSubscription message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreatePersistentSubscription.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified CreatePersistentSubscription message, length delimited. Does not implicitly {@link EventStore.Client.Messages.CreatePersistentSubscription.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @static + * @param {EventStore.Client.Messages.ICreatePersistentSubscription} message CreatePersistentSubscription message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreatePersistentSubscription.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a CreatePersistentSubscription message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.CreatePersistentSubscription} CreatePersistentSubscription - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreatePersistentSubscription.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.CreatePersistentSubscription(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.subscriptionGroupName = reader.string(); - break; - } - case 2: { - message.eventStreamId = reader.string(); - break; - } - case 3: { - message.resolveLinkTos = reader.bool(); - break; - } - case 4: { - message.startFrom = reader.int64(); - break; - } - case 5: { - message.messageTimeoutMilliseconds = reader.int32(); - break; - } - case 6: { - message.recordStatistics = reader.bool(); - break; - } - case 7: { - message.liveBufferSize = reader.int32(); - break; - } - case 8: { - message.readBatchSize = reader.int32(); - break; - } - case 9: { - message.bufferSize = reader.int32(); - break; - } - case 10: { - message.maxRetryCount = reader.int32(); - break; - } - case 11: { - message.preferRoundRobin = reader.bool(); - break; - } - case 12: { - message.checkpointAfterTime = reader.int32(); - break; - } - case 13: { - message.checkpointMaxCount = reader.int32(); - break; - } - case 14: { - message.checkpointMinCount = reader.int32(); - break; - } - case 15: { - message.subscriberMaxCount = reader.int32(); - break; - } - case 16: { - message.namedConsumerStrategy = reader.string(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a CreatePersistentSubscription message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.CreatePersistentSubscription} CreatePersistentSubscription + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreatePersistentSubscription.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.CreatePersistentSubscription(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.subscriptionGroupName = reader.string(); break; } + case 2: { + message.eventStreamId = reader.string(); + break; + } + case 3: { + message.resolveLinkTos = reader.bool(); + break; + } + case 4: { + message.startFrom = reader.int64(); + break; + } + case 5: { + message.messageTimeoutMilliseconds = reader.int32(); + break; + } + case 6: { + message.recordStatistics = reader.bool(); + break; + } + case 7: { + message.liveBufferSize = reader.int32(); + break; + } + case 8: { + message.readBatchSize = reader.int32(); + break; + } + case 9: { + message.bufferSize = reader.int32(); + break; + } + case 10: { + message.maxRetryCount = reader.int32(); + break; + } + case 11: { + message.preferRoundRobin = reader.bool(); + break; + } + case 12: { + message.checkpointAfterTime = reader.int32(); + break; + } + case 13: { + message.checkpointMaxCount = reader.int32(); + break; + } + case 14: { + message.checkpointMinCount = reader.int32(); + break; + } + case 15: { + message.subscriberMaxCount = reader.int32(); + break; + } + case 16: { + message.namedConsumerStrategy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("subscriptionGroupName")) - throw $util.ProtocolError("missing required 'subscriptionGroupName'", { instance: message }); - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("resolveLinkTos")) - throw $util.ProtocolError("missing required 'resolveLinkTos'", { instance: message }); - if (!message.hasOwnProperty("startFrom")) - throw $util.ProtocolError("missing required 'startFrom'", { instance: message }); - if (!message.hasOwnProperty("messageTimeoutMilliseconds")) - throw $util.ProtocolError("missing required 'messageTimeoutMilliseconds'", { instance: message }); - if (!message.hasOwnProperty("recordStatistics")) - throw $util.ProtocolError("missing required 'recordStatistics'", { instance: message }); - if (!message.hasOwnProperty("liveBufferSize")) - throw $util.ProtocolError("missing required 'liveBufferSize'", { instance: message }); - if (!message.hasOwnProperty("readBatchSize")) - throw $util.ProtocolError("missing required 'readBatchSize'", { instance: message }); - if (!message.hasOwnProperty("bufferSize")) - throw $util.ProtocolError("missing required 'bufferSize'", { instance: message }); - if (!message.hasOwnProperty("maxRetryCount")) - throw $util.ProtocolError("missing required 'maxRetryCount'", { instance: message }); - if (!message.hasOwnProperty("preferRoundRobin")) - throw $util.ProtocolError("missing required 'preferRoundRobin'", { instance: message }); - if (!message.hasOwnProperty("checkpointAfterTime")) - throw $util.ProtocolError("missing required 'checkpointAfterTime'", { instance: message }); - if (!message.hasOwnProperty("checkpointMaxCount")) - throw $util.ProtocolError("missing required 'checkpointMaxCount'", { instance: message }); - if (!message.hasOwnProperty("checkpointMinCount")) - throw $util.ProtocolError("missing required 'checkpointMinCount'", { instance: message }); - if (!message.hasOwnProperty("subscriberMaxCount")) - throw $util.ProtocolError("missing required 'subscriberMaxCount'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a CreatePersistentSubscription message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.CreatePersistentSubscription} CreatePersistentSubscription - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreatePersistentSubscription.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a CreatePersistentSubscription message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.CreatePersistentSubscription} CreatePersistentSubscription + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreatePersistentSubscription.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a CreatePersistentSubscription message. - * @function verify - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreatePersistentSubscription.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a CreatePersistentSubscription message. + * @function verify + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreatePersistentSubscription.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subscriptionGroupName != null && message.hasOwnProperty("subscriptionGroupName")) if (!$util.isString(message.subscriptionGroupName)) return "subscriptionGroupName: string expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) if (!$util.isString(message.eventStreamId)) return "eventStreamId: string expected"; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) if (typeof message.resolveLinkTos !== "boolean") return "resolveLinkTos: boolean expected"; + if (message.startFrom != null && message.hasOwnProperty("startFrom")) if (!$util.isInteger(message.startFrom) && !(message.startFrom && $util.isInteger(message.startFrom.low) && $util.isInteger(message.startFrom.high))) return "startFrom: integer|Long expected"; + if (message.messageTimeoutMilliseconds != null && message.hasOwnProperty("messageTimeoutMilliseconds")) if (!$util.isInteger(message.messageTimeoutMilliseconds)) return "messageTimeoutMilliseconds: integer expected"; + if (message.recordStatistics != null && message.hasOwnProperty("recordStatistics")) if (typeof message.recordStatistics !== "boolean") return "recordStatistics: boolean expected"; + if (message.liveBufferSize != null && message.hasOwnProperty("liveBufferSize")) if (!$util.isInteger(message.liveBufferSize)) return "liveBufferSize: integer expected"; + if (message.readBatchSize != null && message.hasOwnProperty("readBatchSize")) if (!$util.isInteger(message.readBatchSize)) return "readBatchSize: integer expected"; + if (message.bufferSize != null && message.hasOwnProperty("bufferSize")) if (!$util.isInteger(message.bufferSize)) return "bufferSize: integer expected"; + if (message.maxRetryCount != null && message.hasOwnProperty("maxRetryCount")) if (!$util.isInteger(message.maxRetryCount)) return "maxRetryCount: integer expected"; + if (message.preferRoundRobin != null && message.hasOwnProperty("preferRoundRobin")) if (typeof message.preferRoundRobin !== "boolean") return "preferRoundRobin: boolean expected"; + if (message.checkpointAfterTime != null && message.hasOwnProperty("checkpointAfterTime")) if (!$util.isInteger(message.checkpointAfterTime)) return "checkpointAfterTime: integer expected"; + if (message.checkpointMaxCount != null && message.hasOwnProperty("checkpointMaxCount")) if (!$util.isInteger(message.checkpointMaxCount)) return "checkpointMaxCount: integer expected"; + if (message.checkpointMinCount != null && message.hasOwnProperty("checkpointMinCount")) if (!$util.isInteger(message.checkpointMinCount)) return "checkpointMinCount: integer expected"; + if (message.subscriberMaxCount != null && message.hasOwnProperty("subscriberMaxCount")) if (!$util.isInteger(message.subscriberMaxCount)) return "subscriberMaxCount: integer expected"; - if (message.namedConsumerStrategy != null && message.hasOwnProperty("namedConsumerStrategy")) - if (!$util.isString(message.namedConsumerStrategy)) - return "namedConsumerStrategy: string expected"; - return null; - }; + if (message.namedConsumerStrategy != null && message.hasOwnProperty("namedConsumerStrategy")) + if (!$util.isString(message.namedConsumerStrategy)) + return "namedConsumerStrategy: string expected"; + return null; + }; - /** - * Creates a CreatePersistentSubscription message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.CreatePersistentSubscription} CreatePersistentSubscription - */ - CreatePersistentSubscription.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.CreatePersistentSubscription) - return object; - var message = new $root.EventStore.Client.Messages.CreatePersistentSubscription(); - if (object.subscriptionGroupName != null) - message.subscriptionGroupName = String(object.subscriptionGroupName); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.resolveLinkTos != null) - message.resolveLinkTos = Boolean(object.resolveLinkTos); - if (object.startFrom != null) - if ($util.Long) - (message.startFrom = $util.Long.fromValue(object.startFrom)).unsigned = false; - else if (typeof object.startFrom === "string") - message.startFrom = parseInt(object.startFrom, 10); - else if (typeof object.startFrom === "number") - message.startFrom = object.startFrom; - else if (typeof object.startFrom === "object") - message.startFrom = new $util.LongBits(object.startFrom.low >>> 0, object.startFrom.high >>> 0).toNumber(); - if (object.messageTimeoutMilliseconds != null) - message.messageTimeoutMilliseconds = object.messageTimeoutMilliseconds | 0; - if (object.recordStatistics != null) - message.recordStatistics = Boolean(object.recordStatistics); - if (object.liveBufferSize != null) - message.liveBufferSize = object.liveBufferSize | 0; - if (object.readBatchSize != null) - message.readBatchSize = object.readBatchSize | 0; - if (object.bufferSize != null) - message.bufferSize = object.bufferSize | 0; - if (object.maxRetryCount != null) - message.maxRetryCount = object.maxRetryCount | 0; - if (object.preferRoundRobin != null) - message.preferRoundRobin = Boolean(object.preferRoundRobin); - if (object.checkpointAfterTime != null) - message.checkpointAfterTime = object.checkpointAfterTime | 0; - if (object.checkpointMaxCount != null) - message.checkpointMaxCount = object.checkpointMaxCount | 0; - if (object.checkpointMinCount != null) - message.checkpointMinCount = object.checkpointMinCount | 0; - if (object.subscriberMaxCount != null) - message.subscriberMaxCount = object.subscriberMaxCount | 0; - if (object.namedConsumerStrategy != null) - message.namedConsumerStrategy = String(object.namedConsumerStrategy); - return message; - }; - - /** - * Creates a plain object from a CreatePersistentSubscription message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @static - * @param {EventStore.Client.Messages.CreatePersistentSubscription} message CreatePersistentSubscription - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreatePersistentSubscription.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.subscriptionGroupName = ""; - object.eventStreamId = ""; - object.resolveLinkTos = false; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.startFrom = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.startFrom = options.longs === String ? "0" : 0; - object.messageTimeoutMilliseconds = 0; - object.recordStatistics = false; - object.liveBufferSize = 0; - object.readBatchSize = 0; - object.bufferSize = 0; - object.maxRetryCount = 0; - object.preferRoundRobin = false; - object.checkpointAfterTime = 0; - object.checkpointMaxCount = 0; - object.checkpointMinCount = 0; - object.subscriberMaxCount = 0; - object.namedConsumerStrategy = ""; - } - if (message.subscriptionGroupName != null && message.hasOwnProperty("subscriptionGroupName")) - object.subscriptionGroupName = message.subscriptionGroupName; - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) - object.resolveLinkTos = message.resolveLinkTos; - if (message.startFrom != null && message.hasOwnProperty("startFrom")) - if (typeof message.startFrom === "number") - object.startFrom = options.longs === String ? String(message.startFrom) : message.startFrom; - else - object.startFrom = options.longs === String ? $util.Long.prototype.toString.call(message.startFrom) : options.longs === Number ? new $util.LongBits(message.startFrom.low >>> 0, message.startFrom.high >>> 0).toNumber() : message.startFrom; - if (message.messageTimeoutMilliseconds != null && message.hasOwnProperty("messageTimeoutMilliseconds")) - object.messageTimeoutMilliseconds = message.messageTimeoutMilliseconds; - if (message.recordStatistics != null && message.hasOwnProperty("recordStatistics")) - object.recordStatistics = message.recordStatistics; - if (message.liveBufferSize != null && message.hasOwnProperty("liveBufferSize")) - object.liveBufferSize = message.liveBufferSize; - if (message.readBatchSize != null && message.hasOwnProperty("readBatchSize")) - object.readBatchSize = message.readBatchSize; - if (message.bufferSize != null && message.hasOwnProperty("bufferSize")) - object.bufferSize = message.bufferSize; - if (message.maxRetryCount != null && message.hasOwnProperty("maxRetryCount")) - object.maxRetryCount = message.maxRetryCount; - if (message.preferRoundRobin != null && message.hasOwnProperty("preferRoundRobin")) - object.preferRoundRobin = message.preferRoundRobin; - if (message.checkpointAfterTime != null && message.hasOwnProperty("checkpointAfterTime")) - object.checkpointAfterTime = message.checkpointAfterTime; - if (message.checkpointMaxCount != null && message.hasOwnProperty("checkpointMaxCount")) - object.checkpointMaxCount = message.checkpointMaxCount; - if (message.checkpointMinCount != null && message.hasOwnProperty("checkpointMinCount")) - object.checkpointMinCount = message.checkpointMinCount; - if (message.subscriberMaxCount != null && message.hasOwnProperty("subscriberMaxCount")) - object.subscriberMaxCount = message.subscriberMaxCount; - if (message.namedConsumerStrategy != null && message.hasOwnProperty("namedConsumerStrategy")) - object.namedConsumerStrategy = message.namedConsumerStrategy; + /** + * Creates a CreatePersistentSubscription message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.CreatePersistentSubscription} CreatePersistentSubscription + */ + CreatePersistentSubscription.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.CreatePersistentSubscription) return object; - }; + var message = new $root.EventStore.Client.Messages.CreatePersistentSubscription(); + if (object.subscriptionGroupName != null) + message.subscriptionGroupName = String(object.subscriptionGroupName); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.resolveLinkTos != null) + message.resolveLinkTos = Boolean(object.resolveLinkTos); + if (object.startFrom != null) + if ($util.Long) + (message.startFrom = $util.Long.fromValue(object.startFrom)).unsigned = false; + else if (typeof object.startFrom === "string") + message.startFrom = parseInt(object.startFrom, 10); + else if (typeof object.startFrom === "number") + message.startFrom = object.startFrom; + else if (typeof object.startFrom === "object") + message.startFrom = new $util.LongBits(object.startFrom.low >>> 0, object.startFrom.high >>> 0).toNumber(); + if (object.messageTimeoutMilliseconds != null) + message.messageTimeoutMilliseconds = object.messageTimeoutMilliseconds | 0; + if (object.recordStatistics != null) + message.recordStatistics = Boolean(object.recordStatistics); + if (object.liveBufferSize != null) + message.liveBufferSize = object.liveBufferSize | 0; + if (object.readBatchSize != null) + message.readBatchSize = object.readBatchSize | 0; + if (object.bufferSize != null) + message.bufferSize = object.bufferSize | 0; + if (object.maxRetryCount != null) + message.maxRetryCount = object.maxRetryCount | 0; + if (object.preferRoundRobin != null) + message.preferRoundRobin = Boolean(object.preferRoundRobin); + if (object.checkpointAfterTime != null) + message.checkpointAfterTime = object.checkpointAfterTime | 0; + if (object.checkpointMaxCount != null) + message.checkpointMaxCount = object.checkpointMaxCount | 0; + if (object.checkpointMinCount != null) + message.checkpointMinCount = object.checkpointMinCount | 0; + if (object.subscriberMaxCount != null) + message.subscriberMaxCount = object.subscriberMaxCount | 0; + if (object.namedConsumerStrategy != null) + message.namedConsumerStrategy = String(object.namedConsumerStrategy); + return message; + }; - /** - * Converts this CreatePersistentSubscription to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @instance - * @returns {Object.} JSON object - */ - CreatePersistentSubscription.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreatePersistentSubscription - * @function getTypeUrl - * @memberof EventStore.Client.Messages.CreatePersistentSubscription - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreatePersistentSubscription.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.CreatePersistentSubscription"; - }; - - return CreatePersistentSubscription; - })(); - - Messages.DeletePersistentSubscription = (function() { - - /** - * Properties of a DeletePersistentSubscription. - * @memberof EventStore.Client.Messages - * @interface IDeletePersistentSubscription - * @property {string} subscriptionGroupName DeletePersistentSubscription subscriptionGroupName - * @property {string} eventStreamId DeletePersistentSubscription eventStreamId - */ - - /** - * Constructs a new DeletePersistentSubscription. - * @memberof EventStore.Client.Messages - * @classdesc Represents a DeletePersistentSubscription. - * @implements IDeletePersistentSubscription - * @constructor - * @param {EventStore.Client.Messages.IDeletePersistentSubscription=} [properties] Properties to set - */ - function DeletePersistentSubscription(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a CreatePersistentSubscription message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @static + * @param {EventStore.Client.Messages.CreatePersistentSubscription} message CreatePersistentSubscription + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreatePersistentSubscription.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.subscriptionGroupName = ""; + object.eventStreamId = ""; + object.resolveLinkTos = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.startFrom = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startFrom = options.longs === String ? "0" : 0; + object.messageTimeoutMilliseconds = 0; + object.recordStatistics = false; + object.liveBufferSize = 0; + object.readBatchSize = 0; + object.bufferSize = 0; + object.maxRetryCount = 0; + object.preferRoundRobin = false; + object.checkpointAfterTime = 0; + object.checkpointMaxCount = 0; + object.checkpointMinCount = 0; + object.subscriberMaxCount = 0; + object.namedConsumerStrategy = ""; } + if (message.subscriptionGroupName != null && message.hasOwnProperty("subscriptionGroupName")) + object.subscriptionGroupName = message.subscriptionGroupName; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) + object.resolveLinkTos = message.resolveLinkTos; + if (message.startFrom != null && message.hasOwnProperty("startFrom")) + if (typeof message.startFrom === "number") + object.startFrom = options.longs === String ? String(message.startFrom) : message.startFrom; + else + object.startFrom = options.longs === String ? $util.Long.prototype.toString.call(message.startFrom) : options.longs === Number ? new $util.LongBits(message.startFrom.low >>> 0, message.startFrom.high >>> 0).toNumber() : message.startFrom; + if (message.messageTimeoutMilliseconds != null && message.hasOwnProperty("messageTimeoutMilliseconds")) + object.messageTimeoutMilliseconds = message.messageTimeoutMilliseconds; + if (message.recordStatistics != null && message.hasOwnProperty("recordStatistics")) + object.recordStatistics = message.recordStatistics; + if (message.liveBufferSize != null && message.hasOwnProperty("liveBufferSize")) + object.liveBufferSize = message.liveBufferSize; + if (message.readBatchSize != null && message.hasOwnProperty("readBatchSize")) + object.readBatchSize = message.readBatchSize; + if (message.bufferSize != null && message.hasOwnProperty("bufferSize")) + object.bufferSize = message.bufferSize; + if (message.maxRetryCount != null && message.hasOwnProperty("maxRetryCount")) + object.maxRetryCount = message.maxRetryCount; + if (message.preferRoundRobin != null && message.hasOwnProperty("preferRoundRobin")) + object.preferRoundRobin = message.preferRoundRobin; + if (message.checkpointAfterTime != null && message.hasOwnProperty("checkpointAfterTime")) + object.checkpointAfterTime = message.checkpointAfterTime; + if (message.checkpointMaxCount != null && message.hasOwnProperty("checkpointMaxCount")) + object.checkpointMaxCount = message.checkpointMaxCount; + if (message.checkpointMinCount != null && message.hasOwnProperty("checkpointMinCount")) + object.checkpointMinCount = message.checkpointMinCount; + if (message.subscriberMaxCount != null && message.hasOwnProperty("subscriberMaxCount")) + object.subscriberMaxCount = message.subscriberMaxCount; + if (message.namedConsumerStrategy != null && message.hasOwnProperty("namedConsumerStrategy")) + object.namedConsumerStrategy = message.namedConsumerStrategy; + return object; + }; - /** - * DeletePersistentSubscription subscriptionGroupName. - * @member {string} subscriptionGroupName - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @instance - */ - DeletePersistentSubscription.prototype.subscriptionGroupName = ""; + /** + * Converts this CreatePersistentSubscription to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @instance + * @returns {Object.} JSON object + */ + CreatePersistentSubscription.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * DeletePersistentSubscription eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @instance - */ - DeletePersistentSubscription.prototype.eventStreamId = ""; + /** + * Gets the default type url for CreatePersistentSubscription + * @function getTypeUrl + * @memberof EventStore.Client.Messages.CreatePersistentSubscription + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreatePersistentSubscription.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.CreatePersistentSubscription"; + }; - /** - * Creates a new DeletePersistentSubscription instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @static - * @param {EventStore.Client.Messages.IDeletePersistentSubscription=} [properties] Properties to set - * @returns {EventStore.Client.Messages.DeletePersistentSubscription} DeletePersistentSubscription instance - */ - DeletePersistentSubscription.create = function create(properties) { - return new DeletePersistentSubscription(properties); - }; + return CreatePersistentSubscription; + })(); - /** - * Encodes the specified DeletePersistentSubscription message. Does not implicitly {@link EventStore.Client.Messages.DeletePersistentSubscription.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @static - * @param {EventStore.Client.Messages.IDeletePersistentSubscription} message DeletePersistentSubscription message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeletePersistentSubscription.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + Messages.DeletePersistentSubscription = (function() { + + /** + * Properties of a DeletePersistentSubscription. + * @memberof EventStore.Client.Messages + * @interface IDeletePersistentSubscription + * @property {string|null} [subscriptionGroupName] DeletePersistentSubscription subscriptionGroupName + * @property {string|null} [eventStreamId] DeletePersistentSubscription eventStreamId + */ + + /** + * Constructs a new DeletePersistentSubscription. + * @memberof EventStore.Client.Messages + * @classdesc Represents a DeletePersistentSubscription. + * @implements IDeletePersistentSubscription + * @constructor + * @param {EventStore.Client.Messages.IDeletePersistentSubscription=} [properties] Properties to set + */ + function DeletePersistentSubscription(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeletePersistentSubscription subscriptionGroupName. + * @member {string} subscriptionGroupName + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @instance + */ + DeletePersistentSubscription.prototype.subscriptionGroupName = ""; + + /** + * DeletePersistentSubscription eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @instance + */ + DeletePersistentSubscription.prototype.eventStreamId = ""; + + /** + * Creates a new DeletePersistentSubscription instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @static + * @param {EventStore.Client.Messages.IDeletePersistentSubscription=} [properties] Properties to set + * @returns {EventStore.Client.Messages.DeletePersistentSubscription} DeletePersistentSubscription instance + */ + DeletePersistentSubscription.create = function create(properties) { + return new DeletePersistentSubscription(properties); + }; + + /** + * Encodes the specified DeletePersistentSubscription message. Does not implicitly {@link EventStore.Client.Messages.DeletePersistentSubscription.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @static + * @param {EventStore.Client.Messages.IDeletePersistentSubscription} message DeletePersistentSubscription message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeletePersistentSubscription.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subscriptionGroupName != null && Object.hasOwnProperty.call(message, "subscriptionGroupName")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscriptionGroupName); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.eventStreamId); - return writer; - }; + return writer; + }; - /** - * Encodes the specified DeletePersistentSubscription message, length delimited. Does not implicitly {@link EventStore.Client.Messages.DeletePersistentSubscription.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @static - * @param {EventStore.Client.Messages.IDeletePersistentSubscription} message DeletePersistentSubscription message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeletePersistentSubscription.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified DeletePersistentSubscription message, length delimited. Does not implicitly {@link EventStore.Client.Messages.DeletePersistentSubscription.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @static + * @param {EventStore.Client.Messages.IDeletePersistentSubscription} message DeletePersistentSubscription message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeletePersistentSubscription.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a DeletePersistentSubscription message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.DeletePersistentSubscription} DeletePersistentSubscription - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeletePersistentSubscription.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.DeletePersistentSubscription(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.subscriptionGroupName = reader.string(); - break; - } - case 2: { - message.eventStreamId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a DeletePersistentSubscription message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.DeletePersistentSubscription} DeletePersistentSubscription + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeletePersistentSubscription.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.DeletePersistentSubscription(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.subscriptionGroupName = reader.string(); break; } + case 2: { + message.eventStreamId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("subscriptionGroupName")) - throw $util.ProtocolError("missing required 'subscriptionGroupName'", { instance: message }); - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a DeletePersistentSubscription message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.DeletePersistentSubscription} DeletePersistentSubscription - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeletePersistentSubscription.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a DeletePersistentSubscription message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.DeletePersistentSubscription} DeletePersistentSubscription + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeletePersistentSubscription.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a DeletePersistentSubscription message. - * @function verify - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeletePersistentSubscription.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a DeletePersistentSubscription message. + * @function verify + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeletePersistentSubscription.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subscriptionGroupName != null && message.hasOwnProperty("subscriptionGroupName")) if (!$util.isString(message.subscriptionGroupName)) return "subscriptionGroupName: string expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) if (!$util.isString(message.eventStreamId)) return "eventStreamId: string expected"; - return null; - }; + return null; + }; - /** - * Creates a DeletePersistentSubscription message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.DeletePersistentSubscription} DeletePersistentSubscription - */ - DeletePersistentSubscription.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.DeletePersistentSubscription) - return object; - var message = new $root.EventStore.Client.Messages.DeletePersistentSubscription(); - if (object.subscriptionGroupName != null) - message.subscriptionGroupName = String(object.subscriptionGroupName); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - return message; - }; - - /** - * Creates a plain object from a DeletePersistentSubscription message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @static - * @param {EventStore.Client.Messages.DeletePersistentSubscription} message DeletePersistentSubscription - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeletePersistentSubscription.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.subscriptionGroupName = ""; - object.eventStreamId = ""; - } - if (message.subscriptionGroupName != null && message.hasOwnProperty("subscriptionGroupName")) - object.subscriptionGroupName = message.subscriptionGroupName; - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; + /** + * Creates a DeletePersistentSubscription message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.DeletePersistentSubscription} DeletePersistentSubscription + */ + DeletePersistentSubscription.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.DeletePersistentSubscription) return object; - }; + var message = new $root.EventStore.Client.Messages.DeletePersistentSubscription(); + if (object.subscriptionGroupName != null) + message.subscriptionGroupName = String(object.subscriptionGroupName); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + return message; + }; - /** - * Converts this DeletePersistentSubscription to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @instance - * @returns {Object.} JSON object - */ - DeletePersistentSubscription.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeletePersistentSubscription - * @function getTypeUrl - * @memberof EventStore.Client.Messages.DeletePersistentSubscription - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeletePersistentSubscription.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.DeletePersistentSubscription"; - }; - - return DeletePersistentSubscription; - })(); - - Messages.UpdatePersistentSubscription = (function() { - - /** - * Properties of an UpdatePersistentSubscription. - * @memberof EventStore.Client.Messages - * @interface IUpdatePersistentSubscription - * @property {string} subscriptionGroupName UpdatePersistentSubscription subscriptionGroupName - * @property {string} eventStreamId UpdatePersistentSubscription eventStreamId - * @property {boolean} resolveLinkTos UpdatePersistentSubscription resolveLinkTos - * @property {Long} startFrom UpdatePersistentSubscription startFrom - * @property {number} messageTimeoutMilliseconds UpdatePersistentSubscription messageTimeoutMilliseconds - * @property {boolean} recordStatistics UpdatePersistentSubscription recordStatistics - * @property {number} liveBufferSize UpdatePersistentSubscription liveBufferSize - * @property {number} readBatchSize UpdatePersistentSubscription readBatchSize - * @property {number} bufferSize UpdatePersistentSubscription bufferSize - * @property {number} maxRetryCount UpdatePersistentSubscription maxRetryCount - * @property {boolean} preferRoundRobin UpdatePersistentSubscription preferRoundRobin - * @property {number} checkpointAfterTime UpdatePersistentSubscription checkpointAfterTime - * @property {number} checkpointMaxCount UpdatePersistentSubscription checkpointMaxCount - * @property {number} checkpointMinCount UpdatePersistentSubscription checkpointMinCount - * @property {number} subscriberMaxCount UpdatePersistentSubscription subscriberMaxCount - * @property {string|null} [namedConsumerStrategy] UpdatePersistentSubscription namedConsumerStrategy - */ - - /** - * Constructs a new UpdatePersistentSubscription. - * @memberof EventStore.Client.Messages - * @classdesc Represents an UpdatePersistentSubscription. - * @implements IUpdatePersistentSubscription - * @constructor - * @param {EventStore.Client.Messages.IUpdatePersistentSubscription=} [properties] Properties to set - */ - function UpdatePersistentSubscription(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a DeletePersistentSubscription message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @static + * @param {EventStore.Client.Messages.DeletePersistentSubscription} message DeletePersistentSubscription + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeletePersistentSubscription.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.subscriptionGroupName = ""; + object.eventStreamId = ""; } + if (message.subscriptionGroupName != null && message.hasOwnProperty("subscriptionGroupName")) + object.subscriptionGroupName = message.subscriptionGroupName; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + return object; + }; - /** - * UpdatePersistentSubscription subscriptionGroupName. - * @member {string} subscriptionGroupName - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.subscriptionGroupName = ""; + /** + * Converts this DeletePersistentSubscription to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @instance + * @returns {Object.} JSON object + */ + DeletePersistentSubscription.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * UpdatePersistentSubscription eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.eventStreamId = ""; + /** + * Gets the default type url for DeletePersistentSubscription + * @function getTypeUrl + * @memberof EventStore.Client.Messages.DeletePersistentSubscription + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeletePersistentSubscription.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.DeletePersistentSubscription"; + }; - /** - * UpdatePersistentSubscription resolveLinkTos. - * @member {boolean} resolveLinkTos - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.resolveLinkTos = false; + return DeletePersistentSubscription; + })(); - /** - * UpdatePersistentSubscription startFrom. - * @member {Long} startFrom - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.startFrom = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Messages.UpdatePersistentSubscription = (function() { - /** - * UpdatePersistentSubscription messageTimeoutMilliseconds. - * @member {number} messageTimeoutMilliseconds - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.messageTimeoutMilliseconds = 0; + /** + * Properties of an UpdatePersistentSubscription. + * @memberof EventStore.Client.Messages + * @interface IUpdatePersistentSubscription + * @property {string|null} [subscriptionGroupName] UpdatePersistentSubscription subscriptionGroupName + * @property {string|null} [eventStreamId] UpdatePersistentSubscription eventStreamId + * @property {boolean|null} [resolveLinkTos] UpdatePersistentSubscription resolveLinkTos + * @property {Long|null} [startFrom] UpdatePersistentSubscription startFrom + * @property {number|null} [messageTimeoutMilliseconds] UpdatePersistentSubscription messageTimeoutMilliseconds + * @property {boolean|null} [recordStatistics] UpdatePersistentSubscription recordStatistics + * @property {number|null} [liveBufferSize] UpdatePersistentSubscription liveBufferSize + * @property {number|null} [readBatchSize] UpdatePersistentSubscription readBatchSize + * @property {number|null} [bufferSize] UpdatePersistentSubscription bufferSize + * @property {number|null} [maxRetryCount] UpdatePersistentSubscription maxRetryCount + * @property {boolean|null} [preferRoundRobin] UpdatePersistentSubscription preferRoundRobin + * @property {number|null} [checkpointAfterTime] UpdatePersistentSubscription checkpointAfterTime + * @property {number|null} [checkpointMaxCount] UpdatePersistentSubscription checkpointMaxCount + * @property {number|null} [checkpointMinCount] UpdatePersistentSubscription checkpointMinCount + * @property {number|null} [subscriberMaxCount] UpdatePersistentSubscription subscriberMaxCount + * @property {string|null} [namedConsumerStrategy] UpdatePersistentSubscription namedConsumerStrategy + */ - /** - * UpdatePersistentSubscription recordStatistics. - * @member {boolean} recordStatistics - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.recordStatistics = false; + /** + * Constructs a new UpdatePersistentSubscription. + * @memberof EventStore.Client.Messages + * @classdesc Represents an UpdatePersistentSubscription. + * @implements IUpdatePersistentSubscription + * @constructor + * @param {EventStore.Client.Messages.IUpdatePersistentSubscription=} [properties] Properties to set + */ + function UpdatePersistentSubscription(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * UpdatePersistentSubscription liveBufferSize. - * @member {number} liveBufferSize - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.liveBufferSize = 0; + /** + * UpdatePersistentSubscription subscriptionGroupName. + * @member {string} subscriptionGroupName + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.subscriptionGroupName = ""; - /** - * UpdatePersistentSubscription readBatchSize. - * @member {number} readBatchSize - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.readBatchSize = 0; + /** + * UpdatePersistentSubscription eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.eventStreamId = ""; - /** - * UpdatePersistentSubscription bufferSize. - * @member {number} bufferSize - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.bufferSize = 0; + /** + * UpdatePersistentSubscription resolveLinkTos. + * @member {boolean} resolveLinkTos + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.resolveLinkTos = false; - /** - * UpdatePersistentSubscription maxRetryCount. - * @member {number} maxRetryCount - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.maxRetryCount = 0; + /** + * UpdatePersistentSubscription startFrom. + * @member {Long} startFrom + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.startFrom = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * UpdatePersistentSubscription preferRoundRobin. - * @member {boolean} preferRoundRobin - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.preferRoundRobin = false; + /** + * UpdatePersistentSubscription messageTimeoutMilliseconds. + * @member {number} messageTimeoutMilliseconds + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.messageTimeoutMilliseconds = 0; - /** - * UpdatePersistentSubscription checkpointAfterTime. - * @member {number} checkpointAfterTime - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.checkpointAfterTime = 0; + /** + * UpdatePersistentSubscription recordStatistics. + * @member {boolean} recordStatistics + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.recordStatistics = false; - /** - * UpdatePersistentSubscription checkpointMaxCount. - * @member {number} checkpointMaxCount - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.checkpointMaxCount = 0; + /** + * UpdatePersistentSubscription liveBufferSize. + * @member {number} liveBufferSize + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.liveBufferSize = 0; - /** - * UpdatePersistentSubscription checkpointMinCount. - * @member {number} checkpointMinCount - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.checkpointMinCount = 0; + /** + * UpdatePersistentSubscription readBatchSize. + * @member {number} readBatchSize + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.readBatchSize = 0; - /** - * UpdatePersistentSubscription subscriberMaxCount. - * @member {number} subscriberMaxCount - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.subscriberMaxCount = 0; + /** + * UpdatePersistentSubscription bufferSize. + * @member {number} bufferSize + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.bufferSize = 0; - /** - * UpdatePersistentSubscription namedConsumerStrategy. - * @member {string} namedConsumerStrategy - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - */ - UpdatePersistentSubscription.prototype.namedConsumerStrategy = ""; + /** + * UpdatePersistentSubscription maxRetryCount. + * @member {number} maxRetryCount + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.maxRetryCount = 0; - /** - * Creates a new UpdatePersistentSubscription instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @static - * @param {EventStore.Client.Messages.IUpdatePersistentSubscription=} [properties] Properties to set - * @returns {EventStore.Client.Messages.UpdatePersistentSubscription} UpdatePersistentSubscription instance - */ - UpdatePersistentSubscription.create = function create(properties) { - return new UpdatePersistentSubscription(properties); - }; + /** + * UpdatePersistentSubscription preferRoundRobin. + * @member {boolean} preferRoundRobin + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.preferRoundRobin = false; - /** - * Encodes the specified UpdatePersistentSubscription message. Does not implicitly {@link EventStore.Client.Messages.UpdatePersistentSubscription.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @static - * @param {EventStore.Client.Messages.IUpdatePersistentSubscription} message UpdatePersistentSubscription message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdatePersistentSubscription.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * UpdatePersistentSubscription checkpointAfterTime. + * @member {number} checkpointAfterTime + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.checkpointAfterTime = 0; + + /** + * UpdatePersistentSubscription checkpointMaxCount. + * @member {number} checkpointMaxCount + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.checkpointMaxCount = 0; + + /** + * UpdatePersistentSubscription checkpointMinCount. + * @member {number} checkpointMinCount + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.checkpointMinCount = 0; + + /** + * UpdatePersistentSubscription subscriberMaxCount. + * @member {number} subscriberMaxCount + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.subscriberMaxCount = 0; + + /** + * UpdatePersistentSubscription namedConsumerStrategy. + * @member {string} namedConsumerStrategy + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + */ + UpdatePersistentSubscription.prototype.namedConsumerStrategy = ""; + + /** + * Creates a new UpdatePersistentSubscription instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @static + * @param {EventStore.Client.Messages.IUpdatePersistentSubscription=} [properties] Properties to set + * @returns {EventStore.Client.Messages.UpdatePersistentSubscription} UpdatePersistentSubscription instance + */ + UpdatePersistentSubscription.create = function create(properties) { + return new UpdatePersistentSubscription(properties); + }; + + /** + * Encodes the specified UpdatePersistentSubscription message. Does not implicitly {@link EventStore.Client.Messages.UpdatePersistentSubscription.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @static + * @param {EventStore.Client.Messages.IUpdatePersistentSubscription} message UpdatePersistentSubscription message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdatePersistentSubscription.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subscriptionGroupName != null && Object.hasOwnProperty.call(message, "subscriptionGroupName")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscriptionGroupName); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.eventStreamId); + if (message.resolveLinkTos != null && Object.hasOwnProperty.call(message, "resolveLinkTos")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.resolveLinkTos); + if (message.startFrom != null && Object.hasOwnProperty.call(message, "startFrom")) writer.uint32(/* id 4, wireType 0 =*/32).int64(message.startFrom); + if (message.messageTimeoutMilliseconds != null && Object.hasOwnProperty.call(message, "messageTimeoutMilliseconds")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageTimeoutMilliseconds); + if (message.recordStatistics != null && Object.hasOwnProperty.call(message, "recordStatistics")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.recordStatistics); + if (message.liveBufferSize != null && Object.hasOwnProperty.call(message, "liveBufferSize")) writer.uint32(/* id 7, wireType 0 =*/56).int32(message.liveBufferSize); + if (message.readBatchSize != null && Object.hasOwnProperty.call(message, "readBatchSize")) writer.uint32(/* id 8, wireType 0 =*/64).int32(message.readBatchSize); + if (message.bufferSize != null && Object.hasOwnProperty.call(message, "bufferSize")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.bufferSize); + if (message.maxRetryCount != null && Object.hasOwnProperty.call(message, "maxRetryCount")) writer.uint32(/* id 10, wireType 0 =*/80).int32(message.maxRetryCount); + if (message.preferRoundRobin != null && Object.hasOwnProperty.call(message, "preferRoundRobin")) writer.uint32(/* id 11, wireType 0 =*/88).bool(message.preferRoundRobin); + if (message.checkpointAfterTime != null && Object.hasOwnProperty.call(message, "checkpointAfterTime")) writer.uint32(/* id 12, wireType 0 =*/96).int32(message.checkpointAfterTime); + if (message.checkpointMaxCount != null && Object.hasOwnProperty.call(message, "checkpointMaxCount")) writer.uint32(/* id 13, wireType 0 =*/104).int32(message.checkpointMaxCount); + if (message.checkpointMinCount != null && Object.hasOwnProperty.call(message, "checkpointMinCount")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.checkpointMinCount); + if (message.subscriberMaxCount != null && Object.hasOwnProperty.call(message, "subscriberMaxCount")) writer.uint32(/* id 15, wireType 0 =*/120).int32(message.subscriberMaxCount); - if (message.namedConsumerStrategy != null && Object.hasOwnProperty.call(message, "namedConsumerStrategy")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.namedConsumerStrategy); - return writer; - }; + if (message.namedConsumerStrategy != null && Object.hasOwnProperty.call(message, "namedConsumerStrategy")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.namedConsumerStrategy); + return writer; + }; - /** - * Encodes the specified UpdatePersistentSubscription message, length delimited. Does not implicitly {@link EventStore.Client.Messages.UpdatePersistentSubscription.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @static - * @param {EventStore.Client.Messages.IUpdatePersistentSubscription} message UpdatePersistentSubscription message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdatePersistentSubscription.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified UpdatePersistentSubscription message, length delimited. Does not implicitly {@link EventStore.Client.Messages.UpdatePersistentSubscription.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @static + * @param {EventStore.Client.Messages.IUpdatePersistentSubscription} message UpdatePersistentSubscription message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdatePersistentSubscription.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes an UpdatePersistentSubscription message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.UpdatePersistentSubscription} UpdatePersistentSubscription - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdatePersistentSubscription.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.UpdatePersistentSubscription(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.subscriptionGroupName = reader.string(); - break; - } - case 2: { - message.eventStreamId = reader.string(); - break; - } - case 3: { - message.resolveLinkTos = reader.bool(); - break; - } - case 4: { - message.startFrom = reader.int64(); - break; - } - case 5: { - message.messageTimeoutMilliseconds = reader.int32(); - break; - } - case 6: { - message.recordStatistics = reader.bool(); - break; - } - case 7: { - message.liveBufferSize = reader.int32(); - break; - } - case 8: { - message.readBatchSize = reader.int32(); - break; - } - case 9: { - message.bufferSize = reader.int32(); - break; - } - case 10: { - message.maxRetryCount = reader.int32(); - break; - } - case 11: { - message.preferRoundRobin = reader.bool(); - break; - } - case 12: { - message.checkpointAfterTime = reader.int32(); - break; - } - case 13: { - message.checkpointMaxCount = reader.int32(); - break; - } - case 14: { - message.checkpointMinCount = reader.int32(); - break; - } - case 15: { - message.subscriberMaxCount = reader.int32(); - break; - } - case 16: { - message.namedConsumerStrategy = reader.string(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes an UpdatePersistentSubscription message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.UpdatePersistentSubscription} UpdatePersistentSubscription + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdatePersistentSubscription.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.UpdatePersistentSubscription(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.subscriptionGroupName = reader.string(); break; } + case 2: { + message.eventStreamId = reader.string(); + break; + } + case 3: { + message.resolveLinkTos = reader.bool(); + break; + } + case 4: { + message.startFrom = reader.int64(); + break; + } + case 5: { + message.messageTimeoutMilliseconds = reader.int32(); + break; + } + case 6: { + message.recordStatistics = reader.bool(); + break; + } + case 7: { + message.liveBufferSize = reader.int32(); + break; + } + case 8: { + message.readBatchSize = reader.int32(); + break; + } + case 9: { + message.bufferSize = reader.int32(); + break; + } + case 10: { + message.maxRetryCount = reader.int32(); + break; + } + case 11: { + message.preferRoundRobin = reader.bool(); + break; + } + case 12: { + message.checkpointAfterTime = reader.int32(); + break; + } + case 13: { + message.checkpointMaxCount = reader.int32(); + break; + } + case 14: { + message.checkpointMinCount = reader.int32(); + break; + } + case 15: { + message.subscriberMaxCount = reader.int32(); + break; + } + case 16: { + message.namedConsumerStrategy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("subscriptionGroupName")) - throw $util.ProtocolError("missing required 'subscriptionGroupName'", { instance: message }); - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("resolveLinkTos")) - throw $util.ProtocolError("missing required 'resolveLinkTos'", { instance: message }); - if (!message.hasOwnProperty("startFrom")) - throw $util.ProtocolError("missing required 'startFrom'", { instance: message }); - if (!message.hasOwnProperty("messageTimeoutMilliseconds")) - throw $util.ProtocolError("missing required 'messageTimeoutMilliseconds'", { instance: message }); - if (!message.hasOwnProperty("recordStatistics")) - throw $util.ProtocolError("missing required 'recordStatistics'", { instance: message }); - if (!message.hasOwnProperty("liveBufferSize")) - throw $util.ProtocolError("missing required 'liveBufferSize'", { instance: message }); - if (!message.hasOwnProperty("readBatchSize")) - throw $util.ProtocolError("missing required 'readBatchSize'", { instance: message }); - if (!message.hasOwnProperty("bufferSize")) - throw $util.ProtocolError("missing required 'bufferSize'", { instance: message }); - if (!message.hasOwnProperty("maxRetryCount")) - throw $util.ProtocolError("missing required 'maxRetryCount'", { instance: message }); - if (!message.hasOwnProperty("preferRoundRobin")) - throw $util.ProtocolError("missing required 'preferRoundRobin'", { instance: message }); - if (!message.hasOwnProperty("checkpointAfterTime")) - throw $util.ProtocolError("missing required 'checkpointAfterTime'", { instance: message }); - if (!message.hasOwnProperty("checkpointMaxCount")) - throw $util.ProtocolError("missing required 'checkpointMaxCount'", { instance: message }); - if (!message.hasOwnProperty("checkpointMinCount")) - throw $util.ProtocolError("missing required 'checkpointMinCount'", { instance: message }); - if (!message.hasOwnProperty("subscriberMaxCount")) - throw $util.ProtocolError("missing required 'subscriberMaxCount'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes an UpdatePersistentSubscription message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.UpdatePersistentSubscription} UpdatePersistentSubscription - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdatePersistentSubscription.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes an UpdatePersistentSubscription message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.UpdatePersistentSubscription} UpdatePersistentSubscription + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdatePersistentSubscription.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an UpdatePersistentSubscription message. - * @function verify - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdatePersistentSubscription.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies an UpdatePersistentSubscription message. + * @function verify + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdatePersistentSubscription.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subscriptionGroupName != null && message.hasOwnProperty("subscriptionGroupName")) if (!$util.isString(message.subscriptionGroupName)) return "subscriptionGroupName: string expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) if (!$util.isString(message.eventStreamId)) return "eventStreamId: string expected"; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) if (typeof message.resolveLinkTos !== "boolean") return "resolveLinkTos: boolean expected"; + if (message.startFrom != null && message.hasOwnProperty("startFrom")) if (!$util.isInteger(message.startFrom) && !(message.startFrom && $util.isInteger(message.startFrom.low) && $util.isInteger(message.startFrom.high))) return "startFrom: integer|Long expected"; + if (message.messageTimeoutMilliseconds != null && message.hasOwnProperty("messageTimeoutMilliseconds")) if (!$util.isInteger(message.messageTimeoutMilliseconds)) return "messageTimeoutMilliseconds: integer expected"; + if (message.recordStatistics != null && message.hasOwnProperty("recordStatistics")) if (typeof message.recordStatistics !== "boolean") return "recordStatistics: boolean expected"; + if (message.liveBufferSize != null && message.hasOwnProperty("liveBufferSize")) if (!$util.isInteger(message.liveBufferSize)) return "liveBufferSize: integer expected"; + if (message.readBatchSize != null && message.hasOwnProperty("readBatchSize")) if (!$util.isInteger(message.readBatchSize)) return "readBatchSize: integer expected"; + if (message.bufferSize != null && message.hasOwnProperty("bufferSize")) if (!$util.isInteger(message.bufferSize)) return "bufferSize: integer expected"; + if (message.maxRetryCount != null && message.hasOwnProperty("maxRetryCount")) if (!$util.isInteger(message.maxRetryCount)) return "maxRetryCount: integer expected"; + if (message.preferRoundRobin != null && message.hasOwnProperty("preferRoundRobin")) if (typeof message.preferRoundRobin !== "boolean") return "preferRoundRobin: boolean expected"; + if (message.checkpointAfterTime != null && message.hasOwnProperty("checkpointAfterTime")) if (!$util.isInteger(message.checkpointAfterTime)) return "checkpointAfterTime: integer expected"; + if (message.checkpointMaxCount != null && message.hasOwnProperty("checkpointMaxCount")) if (!$util.isInteger(message.checkpointMaxCount)) return "checkpointMaxCount: integer expected"; + if (message.checkpointMinCount != null && message.hasOwnProperty("checkpointMinCount")) if (!$util.isInteger(message.checkpointMinCount)) return "checkpointMinCount: integer expected"; + if (message.subscriberMaxCount != null && message.hasOwnProperty("subscriberMaxCount")) if (!$util.isInteger(message.subscriberMaxCount)) return "subscriberMaxCount: integer expected"; - if (message.namedConsumerStrategy != null && message.hasOwnProperty("namedConsumerStrategy")) - if (!$util.isString(message.namedConsumerStrategy)) - return "namedConsumerStrategy: string expected"; - return null; - }; + if (message.namedConsumerStrategy != null && message.hasOwnProperty("namedConsumerStrategy")) + if (!$util.isString(message.namedConsumerStrategy)) + return "namedConsumerStrategy: string expected"; + return null; + }; - /** - * Creates an UpdatePersistentSubscription message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.UpdatePersistentSubscription} UpdatePersistentSubscription - */ - UpdatePersistentSubscription.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.UpdatePersistentSubscription) - return object; - var message = new $root.EventStore.Client.Messages.UpdatePersistentSubscription(); - if (object.subscriptionGroupName != null) - message.subscriptionGroupName = String(object.subscriptionGroupName); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.resolveLinkTos != null) - message.resolveLinkTos = Boolean(object.resolveLinkTos); - if (object.startFrom != null) - if ($util.Long) - (message.startFrom = $util.Long.fromValue(object.startFrom)).unsigned = false; - else if (typeof object.startFrom === "string") - message.startFrom = parseInt(object.startFrom, 10); - else if (typeof object.startFrom === "number") - message.startFrom = object.startFrom; - else if (typeof object.startFrom === "object") - message.startFrom = new $util.LongBits(object.startFrom.low >>> 0, object.startFrom.high >>> 0).toNumber(); - if (object.messageTimeoutMilliseconds != null) - message.messageTimeoutMilliseconds = object.messageTimeoutMilliseconds | 0; - if (object.recordStatistics != null) - message.recordStatistics = Boolean(object.recordStatistics); - if (object.liveBufferSize != null) - message.liveBufferSize = object.liveBufferSize | 0; - if (object.readBatchSize != null) - message.readBatchSize = object.readBatchSize | 0; - if (object.bufferSize != null) - message.bufferSize = object.bufferSize | 0; - if (object.maxRetryCount != null) - message.maxRetryCount = object.maxRetryCount | 0; - if (object.preferRoundRobin != null) - message.preferRoundRobin = Boolean(object.preferRoundRobin); - if (object.checkpointAfterTime != null) - message.checkpointAfterTime = object.checkpointAfterTime | 0; - if (object.checkpointMaxCount != null) - message.checkpointMaxCount = object.checkpointMaxCount | 0; - if (object.checkpointMinCount != null) - message.checkpointMinCount = object.checkpointMinCount | 0; - if (object.subscriberMaxCount != null) - message.subscriberMaxCount = object.subscriberMaxCount | 0; - if (object.namedConsumerStrategy != null) - message.namedConsumerStrategy = String(object.namedConsumerStrategy); - return message; - }; - - /** - * Creates a plain object from an UpdatePersistentSubscription message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @static - * @param {EventStore.Client.Messages.UpdatePersistentSubscription} message UpdatePersistentSubscription - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdatePersistentSubscription.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.subscriptionGroupName = ""; - object.eventStreamId = ""; - object.resolveLinkTos = false; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.startFrom = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.startFrom = options.longs === String ? "0" : 0; - object.messageTimeoutMilliseconds = 0; - object.recordStatistics = false; - object.liveBufferSize = 0; - object.readBatchSize = 0; - object.bufferSize = 0; - object.maxRetryCount = 0; - object.preferRoundRobin = false; - object.checkpointAfterTime = 0; - object.checkpointMaxCount = 0; - object.checkpointMinCount = 0; - object.subscriberMaxCount = 0; - object.namedConsumerStrategy = ""; - } - if (message.subscriptionGroupName != null && message.hasOwnProperty("subscriptionGroupName")) - object.subscriptionGroupName = message.subscriptionGroupName; - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) - object.resolveLinkTos = message.resolveLinkTos; - if (message.startFrom != null && message.hasOwnProperty("startFrom")) - if (typeof message.startFrom === "number") - object.startFrom = options.longs === String ? String(message.startFrom) : message.startFrom; - else - object.startFrom = options.longs === String ? $util.Long.prototype.toString.call(message.startFrom) : options.longs === Number ? new $util.LongBits(message.startFrom.low >>> 0, message.startFrom.high >>> 0).toNumber() : message.startFrom; - if (message.messageTimeoutMilliseconds != null && message.hasOwnProperty("messageTimeoutMilliseconds")) - object.messageTimeoutMilliseconds = message.messageTimeoutMilliseconds; - if (message.recordStatistics != null && message.hasOwnProperty("recordStatistics")) - object.recordStatistics = message.recordStatistics; - if (message.liveBufferSize != null && message.hasOwnProperty("liveBufferSize")) - object.liveBufferSize = message.liveBufferSize; - if (message.readBatchSize != null && message.hasOwnProperty("readBatchSize")) - object.readBatchSize = message.readBatchSize; - if (message.bufferSize != null && message.hasOwnProperty("bufferSize")) - object.bufferSize = message.bufferSize; - if (message.maxRetryCount != null && message.hasOwnProperty("maxRetryCount")) - object.maxRetryCount = message.maxRetryCount; - if (message.preferRoundRobin != null && message.hasOwnProperty("preferRoundRobin")) - object.preferRoundRobin = message.preferRoundRobin; - if (message.checkpointAfterTime != null && message.hasOwnProperty("checkpointAfterTime")) - object.checkpointAfterTime = message.checkpointAfterTime; - if (message.checkpointMaxCount != null && message.hasOwnProperty("checkpointMaxCount")) - object.checkpointMaxCount = message.checkpointMaxCount; - if (message.checkpointMinCount != null && message.hasOwnProperty("checkpointMinCount")) - object.checkpointMinCount = message.checkpointMinCount; - if (message.subscriberMaxCount != null && message.hasOwnProperty("subscriberMaxCount")) - object.subscriberMaxCount = message.subscriberMaxCount; - if (message.namedConsumerStrategy != null && message.hasOwnProperty("namedConsumerStrategy")) - object.namedConsumerStrategy = message.namedConsumerStrategy; + /** + * Creates an UpdatePersistentSubscription message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.UpdatePersistentSubscription} UpdatePersistentSubscription + */ + UpdatePersistentSubscription.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.UpdatePersistentSubscription) return object; - }; + var message = new $root.EventStore.Client.Messages.UpdatePersistentSubscription(); + if (object.subscriptionGroupName != null) + message.subscriptionGroupName = String(object.subscriptionGroupName); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.resolveLinkTos != null) + message.resolveLinkTos = Boolean(object.resolveLinkTos); + if (object.startFrom != null) + if ($util.Long) + (message.startFrom = $util.Long.fromValue(object.startFrom)).unsigned = false; + else if (typeof object.startFrom === "string") + message.startFrom = parseInt(object.startFrom, 10); + else if (typeof object.startFrom === "number") + message.startFrom = object.startFrom; + else if (typeof object.startFrom === "object") + message.startFrom = new $util.LongBits(object.startFrom.low >>> 0, object.startFrom.high >>> 0).toNumber(); + if (object.messageTimeoutMilliseconds != null) + message.messageTimeoutMilliseconds = object.messageTimeoutMilliseconds | 0; + if (object.recordStatistics != null) + message.recordStatistics = Boolean(object.recordStatistics); + if (object.liveBufferSize != null) + message.liveBufferSize = object.liveBufferSize | 0; + if (object.readBatchSize != null) + message.readBatchSize = object.readBatchSize | 0; + if (object.bufferSize != null) + message.bufferSize = object.bufferSize | 0; + if (object.maxRetryCount != null) + message.maxRetryCount = object.maxRetryCount | 0; + if (object.preferRoundRobin != null) + message.preferRoundRobin = Boolean(object.preferRoundRobin); + if (object.checkpointAfterTime != null) + message.checkpointAfterTime = object.checkpointAfterTime | 0; + if (object.checkpointMaxCount != null) + message.checkpointMaxCount = object.checkpointMaxCount | 0; + if (object.checkpointMinCount != null) + message.checkpointMinCount = object.checkpointMinCount | 0; + if (object.subscriberMaxCount != null) + message.subscriberMaxCount = object.subscriberMaxCount | 0; + if (object.namedConsumerStrategy != null) + message.namedConsumerStrategy = String(object.namedConsumerStrategy); + return message; + }; - /** - * Converts this UpdatePersistentSubscription to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @instance - * @returns {Object.} JSON object - */ - UpdatePersistentSubscription.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UpdatePersistentSubscription - * @function getTypeUrl - * @memberof EventStore.Client.Messages.UpdatePersistentSubscription - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UpdatePersistentSubscription.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.UpdatePersistentSubscription"; - }; - - return UpdatePersistentSubscription; - })(); - - Messages.UpdatePersistentSubscriptionCompleted = (function() { - - /** - * Properties of an UpdatePersistentSubscriptionCompleted. - * @memberof EventStore.Client.Messages - * @interface IUpdatePersistentSubscriptionCompleted - * @property {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult} result UpdatePersistentSubscriptionCompleted result - * @property {string|null} [reason] UpdatePersistentSubscriptionCompleted reason - */ - - /** - * Constructs a new UpdatePersistentSubscriptionCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents an UpdatePersistentSubscriptionCompleted. - * @implements IUpdatePersistentSubscriptionCompleted - * @constructor - * @param {EventStore.Client.Messages.IUpdatePersistentSubscriptionCompleted=} [properties] Properties to set - */ - function UpdatePersistentSubscriptionCompleted(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from an UpdatePersistentSubscription message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @static + * @param {EventStore.Client.Messages.UpdatePersistentSubscription} message UpdatePersistentSubscription + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdatePersistentSubscription.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.subscriptionGroupName = ""; + object.eventStreamId = ""; + object.resolveLinkTos = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.startFrom = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.startFrom = options.longs === String ? "0" : 0; + object.messageTimeoutMilliseconds = 0; + object.recordStatistics = false; + object.liveBufferSize = 0; + object.readBatchSize = 0; + object.bufferSize = 0; + object.maxRetryCount = 0; + object.preferRoundRobin = false; + object.checkpointAfterTime = 0; + object.checkpointMaxCount = 0; + object.checkpointMinCount = 0; + object.subscriberMaxCount = 0; + object.namedConsumerStrategy = ""; } + if (message.subscriptionGroupName != null && message.hasOwnProperty("subscriptionGroupName")) + object.subscriptionGroupName = message.subscriptionGroupName; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) + object.resolveLinkTos = message.resolveLinkTos; + if (message.startFrom != null && message.hasOwnProperty("startFrom")) + if (typeof message.startFrom === "number") + object.startFrom = options.longs === String ? String(message.startFrom) : message.startFrom; + else + object.startFrom = options.longs === String ? $util.Long.prototype.toString.call(message.startFrom) : options.longs === Number ? new $util.LongBits(message.startFrom.low >>> 0, message.startFrom.high >>> 0).toNumber() : message.startFrom; + if (message.messageTimeoutMilliseconds != null && message.hasOwnProperty("messageTimeoutMilliseconds")) + object.messageTimeoutMilliseconds = message.messageTimeoutMilliseconds; + if (message.recordStatistics != null && message.hasOwnProperty("recordStatistics")) + object.recordStatistics = message.recordStatistics; + if (message.liveBufferSize != null && message.hasOwnProperty("liveBufferSize")) + object.liveBufferSize = message.liveBufferSize; + if (message.readBatchSize != null && message.hasOwnProperty("readBatchSize")) + object.readBatchSize = message.readBatchSize; + if (message.bufferSize != null && message.hasOwnProperty("bufferSize")) + object.bufferSize = message.bufferSize; + if (message.maxRetryCount != null && message.hasOwnProperty("maxRetryCount")) + object.maxRetryCount = message.maxRetryCount; + if (message.preferRoundRobin != null && message.hasOwnProperty("preferRoundRobin")) + object.preferRoundRobin = message.preferRoundRobin; + if (message.checkpointAfterTime != null && message.hasOwnProperty("checkpointAfterTime")) + object.checkpointAfterTime = message.checkpointAfterTime; + if (message.checkpointMaxCount != null && message.hasOwnProperty("checkpointMaxCount")) + object.checkpointMaxCount = message.checkpointMaxCount; + if (message.checkpointMinCount != null && message.hasOwnProperty("checkpointMinCount")) + object.checkpointMinCount = message.checkpointMinCount; + if (message.subscriberMaxCount != null && message.hasOwnProperty("subscriberMaxCount")) + object.subscriberMaxCount = message.subscriberMaxCount; + if (message.namedConsumerStrategy != null && message.hasOwnProperty("namedConsumerStrategy")) + object.namedConsumerStrategy = message.namedConsumerStrategy; + return object; + }; - /** - * UpdatePersistentSubscriptionCompleted result. - * @member {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult} result - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @instance - */ - UpdatePersistentSubscriptionCompleted.prototype.result = 0; + /** + * Converts this UpdatePersistentSubscription to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @instance + * @returns {Object.} JSON object + */ + UpdatePersistentSubscription.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * UpdatePersistentSubscriptionCompleted reason. - * @member {string} reason - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @instance - */ - UpdatePersistentSubscriptionCompleted.prototype.reason = ""; + /** + * Gets the default type url for UpdatePersistentSubscription + * @function getTypeUrl + * @memberof EventStore.Client.Messages.UpdatePersistentSubscription + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdatePersistentSubscription.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.UpdatePersistentSubscription"; + }; - /** - * Creates a new UpdatePersistentSubscriptionCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.IUpdatePersistentSubscriptionCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted} UpdatePersistentSubscriptionCompleted instance - */ - UpdatePersistentSubscriptionCompleted.create = function create(properties) { - return new UpdatePersistentSubscriptionCompleted(properties); - }; + return UpdatePersistentSubscription; + })(); - /** - * Encodes the specified UpdatePersistentSubscriptionCompleted message. Does not implicitly {@link EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.IUpdatePersistentSubscriptionCompleted} message UpdatePersistentSubscriptionCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdatePersistentSubscriptionCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + Messages.UpdatePersistentSubscriptionCompleted = (function() { + + /** + * Properties of an UpdatePersistentSubscriptionCompleted. + * @memberof EventStore.Client.Messages + * @interface IUpdatePersistentSubscriptionCompleted + * @property {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult|null} [result] UpdatePersistentSubscriptionCompleted result + * @property {string|null} [reason] UpdatePersistentSubscriptionCompleted reason + */ + + /** + * Constructs a new UpdatePersistentSubscriptionCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents an UpdatePersistentSubscriptionCompleted. + * @implements IUpdatePersistentSubscriptionCompleted + * @constructor + * @param {EventStore.Client.Messages.IUpdatePersistentSubscriptionCompleted=} [properties] Properties to set + */ + function UpdatePersistentSubscriptionCompleted(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdatePersistentSubscriptionCompleted result. + * @member {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult} result + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @instance + */ + UpdatePersistentSubscriptionCompleted.prototype.result = 0; + + /** + * UpdatePersistentSubscriptionCompleted reason. + * @member {string} reason + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @instance + */ + UpdatePersistentSubscriptionCompleted.prototype.reason = ""; + + /** + * Creates a new UpdatePersistentSubscriptionCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.IUpdatePersistentSubscriptionCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted} UpdatePersistentSubscriptionCompleted instance + */ + UpdatePersistentSubscriptionCompleted.create = function create(properties) { + return new UpdatePersistentSubscriptionCompleted(properties); + }; + + /** + * Encodes the specified UpdatePersistentSubscriptionCompleted message. Does not implicitly {@link EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.IUpdatePersistentSubscriptionCompleted} message UpdatePersistentSubscriptionCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdatePersistentSubscriptionCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); - if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.reason); - return writer; - }; + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.reason); + return writer; + }; - /** - * Encodes the specified UpdatePersistentSubscriptionCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.IUpdatePersistentSubscriptionCompleted} message UpdatePersistentSubscriptionCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdatePersistentSubscriptionCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified UpdatePersistentSubscriptionCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.IUpdatePersistentSubscriptionCompleted} message UpdatePersistentSubscriptionCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdatePersistentSubscriptionCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes an UpdatePersistentSubscriptionCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted} UpdatePersistentSubscriptionCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdatePersistentSubscriptionCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.result = reader.int32(); - break; - } - case 2: { - message.reason = reader.string(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes an UpdatePersistentSubscriptionCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted} UpdatePersistentSubscriptionCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdatePersistentSubscriptionCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.result = reader.int32(); break; } + case 2: { + message.reason = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes an UpdatePersistentSubscriptionCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted} UpdatePersistentSubscriptionCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdatePersistentSubscriptionCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes an UpdatePersistentSubscriptionCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted} UpdatePersistentSubscriptionCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdatePersistentSubscriptionCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an UpdatePersistentSubscriptionCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdatePersistentSubscriptionCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies an UpdatePersistentSubscriptionCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdatePersistentSubscriptionCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.result != null && message.hasOwnProperty("result")) switch (message.result) { default: return "result: enum value expected"; @@ -9650,271 +9642,271 @@ case 3: break; } - if (message.reason != null && message.hasOwnProperty("reason")) - if (!$util.isString(message.reason)) - return "reason: string expected"; - return null; - }; + if (message.reason != null && message.hasOwnProperty("reason")) + if (!$util.isString(message.reason)) + return "reason: string expected"; + return null; + }; - /** - * Creates an UpdatePersistentSubscriptionCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted} UpdatePersistentSubscriptionCompleted - */ - UpdatePersistentSubscriptionCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted) - return object; - var message = new $root.EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted(); - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": - case 0: - message.result = 0; - break; - case "DoesNotExist": - case 1: - message.result = 1; - break; - case "Fail": - case 2: - message.result = 2; - break; - case "AccessDenied": - case 3: - message.result = 3; - break; - } - if (object.reason != null) - message.reason = String(object.reason); - return message; - }; - - /** - * Creates a plain object from an UpdatePersistentSubscriptionCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted} message UpdatePersistentSubscriptionCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdatePersistentSubscriptionCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.result = options.enums === String ? "Success" : 0; - object.reason = ""; - } - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult[message.result] : message.result; - if (message.reason != null && message.hasOwnProperty("reason")) - object.reason = message.reason; + /** + * Creates an UpdatePersistentSubscriptionCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted} UpdatePersistentSubscriptionCompleted + */ + UpdatePersistentSubscriptionCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted) return object; - }; - - /** - * Converts this UpdatePersistentSubscriptionCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @instance - * @returns {Object.} JSON object - */ - UpdatePersistentSubscriptionCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UpdatePersistentSubscriptionCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UpdatePersistentSubscriptionCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + var message = new $root.EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; } - return typeUrlPrefix + "/EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted"; - }; + break; + case "Success": + case 0: + message.result = 0; + break; + case "DoesNotExist": + case 1: + message.result = 1; + break; + case "Fail": + case 2: + message.result = 2; + break; + case "AccessDenied": + case 3: + message.result = 3; + break; + } + if (object.reason != null) + message.reason = String(object.reason); + return message; + }; - /** - * UpdatePersistentSubscriptionResult enum. - * @name EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult - * @enum {number} - * @property {number} Success=0 Success value - * @property {number} DoesNotExist=1 DoesNotExist value - * @property {number} Fail=2 Fail value - * @property {number} AccessDenied=3 AccessDenied value - */ - UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Success"] = 0; - values[valuesById[1] = "DoesNotExist"] = 1; - values[valuesById[2] = "Fail"] = 2; - values[valuesById[3] = "AccessDenied"] = 3; - return values; - })(); + /** + * Creates a plain object from an UpdatePersistentSubscriptionCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted} message UpdatePersistentSubscriptionCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdatePersistentSubscriptionCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.result = options.enums === String ? "Success" : 0; + object.reason = ""; + } + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult[message.result] : message.result; + if (message.reason != null && message.hasOwnProperty("reason")) + object.reason = message.reason; + return object; + }; - return UpdatePersistentSubscriptionCompleted; + /** + * Converts this UpdatePersistentSubscriptionCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @instance + * @returns {Object.} JSON object + */ + UpdatePersistentSubscriptionCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdatePersistentSubscriptionCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdatePersistentSubscriptionCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted"; + }; + + /** + * UpdatePersistentSubscriptionResult enum. + * @name EventStore.Client.Messages.UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult + * @enum {number} + * @property {number} Success=0 Success value + * @property {number} DoesNotExist=1 DoesNotExist value + * @property {number} Fail=2 Fail value + * @property {number} AccessDenied=3 AccessDenied value + */ + UpdatePersistentSubscriptionCompleted.UpdatePersistentSubscriptionResult = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Success"] = 0; + values[valuesById[1] = "DoesNotExist"] = 1; + values[valuesById[2] = "Fail"] = 2; + values[valuesById[3] = "AccessDenied"] = 3; + return values; })(); - Messages.CreatePersistentSubscriptionCompleted = (function() { + return UpdatePersistentSubscriptionCompleted; + })(); - /** - * Properties of a CreatePersistentSubscriptionCompleted. - * @memberof EventStore.Client.Messages - * @interface ICreatePersistentSubscriptionCompleted - * @property {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult} result CreatePersistentSubscriptionCompleted result - * @property {string|null} [reason] CreatePersistentSubscriptionCompleted reason - */ + Messages.CreatePersistentSubscriptionCompleted = (function() { - /** - * Constructs a new CreatePersistentSubscriptionCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a CreatePersistentSubscriptionCompleted. - * @implements ICreatePersistentSubscriptionCompleted - * @constructor - * @param {EventStore.Client.Messages.ICreatePersistentSubscriptionCompleted=} [properties] Properties to set - */ - function CreatePersistentSubscriptionCompleted(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a CreatePersistentSubscriptionCompleted. + * @memberof EventStore.Client.Messages + * @interface ICreatePersistentSubscriptionCompleted + * @property {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult|null} [result] CreatePersistentSubscriptionCompleted result + * @property {string|null} [reason] CreatePersistentSubscriptionCompleted reason + */ - /** - * CreatePersistentSubscriptionCompleted result. - * @member {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult} result - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @instance - */ - CreatePersistentSubscriptionCompleted.prototype.result = 0; + /** + * Constructs a new CreatePersistentSubscriptionCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a CreatePersistentSubscriptionCompleted. + * @implements ICreatePersistentSubscriptionCompleted + * @constructor + * @param {EventStore.Client.Messages.ICreatePersistentSubscriptionCompleted=} [properties] Properties to set + */ + function CreatePersistentSubscriptionCompleted(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * CreatePersistentSubscriptionCompleted reason. - * @member {string} reason - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @instance - */ - CreatePersistentSubscriptionCompleted.prototype.reason = ""; + /** + * CreatePersistentSubscriptionCompleted result. + * @member {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult} result + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @instance + */ + CreatePersistentSubscriptionCompleted.prototype.result = 0; - /** - * Creates a new CreatePersistentSubscriptionCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.ICreatePersistentSubscriptionCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted} CreatePersistentSubscriptionCompleted instance - */ - CreatePersistentSubscriptionCompleted.create = function create(properties) { - return new CreatePersistentSubscriptionCompleted(properties); - }; + /** + * CreatePersistentSubscriptionCompleted reason. + * @member {string} reason + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @instance + */ + CreatePersistentSubscriptionCompleted.prototype.reason = ""; - /** - * Encodes the specified CreatePersistentSubscriptionCompleted message. Does not implicitly {@link EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.ICreatePersistentSubscriptionCompleted} message CreatePersistentSubscriptionCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreatePersistentSubscriptionCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Creates a new CreatePersistentSubscriptionCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.ICreatePersistentSubscriptionCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted} CreatePersistentSubscriptionCompleted instance + */ + CreatePersistentSubscriptionCompleted.create = function create(properties) { + return new CreatePersistentSubscriptionCompleted(properties); + }; + + /** + * Encodes the specified CreatePersistentSubscriptionCompleted message. Does not implicitly {@link EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.ICreatePersistentSubscriptionCompleted} message CreatePersistentSubscriptionCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreatePersistentSubscriptionCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); - if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.reason); - return writer; - }; + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.reason); + return writer; + }; - /** - * Encodes the specified CreatePersistentSubscriptionCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.ICreatePersistentSubscriptionCompleted} message CreatePersistentSubscriptionCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreatePersistentSubscriptionCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified CreatePersistentSubscriptionCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.ICreatePersistentSubscriptionCompleted} message CreatePersistentSubscriptionCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreatePersistentSubscriptionCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a CreatePersistentSubscriptionCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted} CreatePersistentSubscriptionCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreatePersistentSubscriptionCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.CreatePersistentSubscriptionCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.result = reader.int32(); - break; - } - case 2: { - message.reason = reader.string(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a CreatePersistentSubscriptionCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted} CreatePersistentSubscriptionCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreatePersistentSubscriptionCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.CreatePersistentSubscriptionCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.result = reader.int32(); break; } + case 2: { + message.reason = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a CreatePersistentSubscriptionCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted} CreatePersistentSubscriptionCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreatePersistentSubscriptionCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a CreatePersistentSubscriptionCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted} CreatePersistentSubscriptionCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreatePersistentSubscriptionCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a CreatePersistentSubscriptionCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreatePersistentSubscriptionCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a CreatePersistentSubscriptionCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreatePersistentSubscriptionCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.result != null && message.hasOwnProperty("result")) switch (message.result) { default: return "result: enum value expected"; @@ -9924,271 +9916,271 @@ case 3: break; } - if (message.reason != null && message.hasOwnProperty("reason")) - if (!$util.isString(message.reason)) - return "reason: string expected"; - return null; - }; + if (message.reason != null && message.hasOwnProperty("reason")) + if (!$util.isString(message.reason)) + return "reason: string expected"; + return null; + }; - /** - * Creates a CreatePersistentSubscriptionCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted} CreatePersistentSubscriptionCompleted - */ - CreatePersistentSubscriptionCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.CreatePersistentSubscriptionCompleted) - return object; - var message = new $root.EventStore.Client.Messages.CreatePersistentSubscriptionCompleted(); - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": - case 0: - message.result = 0; - break; - case "AlreadyExists": - case 1: - message.result = 1; - break; - case "Fail": - case 2: - message.result = 2; - break; - case "AccessDenied": - case 3: - message.result = 3; - break; - } - if (object.reason != null) - message.reason = String(object.reason); - return message; - }; - - /** - * Creates a plain object from a CreatePersistentSubscriptionCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted} message CreatePersistentSubscriptionCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreatePersistentSubscriptionCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.result = options.enums === String ? "Success" : 0; - object.reason = ""; - } - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult[message.result] : message.result; - if (message.reason != null && message.hasOwnProperty("reason")) - object.reason = message.reason; + /** + * Creates a CreatePersistentSubscriptionCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted} CreatePersistentSubscriptionCompleted + */ + CreatePersistentSubscriptionCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.CreatePersistentSubscriptionCompleted) return object; - }; - - /** - * Converts this CreatePersistentSubscriptionCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @instance - * @returns {Object.} JSON object - */ - CreatePersistentSubscriptionCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreatePersistentSubscriptionCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreatePersistentSubscriptionCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + var message = new $root.EventStore.Client.Messages.CreatePersistentSubscriptionCompleted(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; } - return typeUrlPrefix + "/EventStore.Client.Messages.CreatePersistentSubscriptionCompleted"; - }; + break; + case "Success": + case 0: + message.result = 0; + break; + case "AlreadyExists": + case 1: + message.result = 1; + break; + case "Fail": + case 2: + message.result = 2; + break; + case "AccessDenied": + case 3: + message.result = 3; + break; + } + if (object.reason != null) + message.reason = String(object.reason); + return message; + }; - /** - * CreatePersistentSubscriptionResult enum. - * @name EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult - * @enum {number} - * @property {number} Success=0 Success value - * @property {number} AlreadyExists=1 AlreadyExists value - * @property {number} Fail=2 Fail value - * @property {number} AccessDenied=3 AccessDenied value - */ - CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Success"] = 0; - values[valuesById[1] = "AlreadyExists"] = 1; - values[valuesById[2] = "Fail"] = 2; - values[valuesById[3] = "AccessDenied"] = 3; - return values; - })(); + /** + * Creates a plain object from a CreatePersistentSubscriptionCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.CreatePersistentSubscriptionCompleted} message CreatePersistentSubscriptionCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreatePersistentSubscriptionCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.result = options.enums === String ? "Success" : 0; + object.reason = ""; + } + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult[message.result] : message.result; + if (message.reason != null && message.hasOwnProperty("reason")) + object.reason = message.reason; + return object; + }; - return CreatePersistentSubscriptionCompleted; + /** + * Converts this CreatePersistentSubscriptionCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @instance + * @returns {Object.} JSON object + */ + CreatePersistentSubscriptionCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreatePersistentSubscriptionCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.CreatePersistentSubscriptionCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreatePersistentSubscriptionCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.CreatePersistentSubscriptionCompleted"; + }; + + /** + * CreatePersistentSubscriptionResult enum. + * @name EventStore.Client.Messages.CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult + * @enum {number} + * @property {number} Success=0 Success value + * @property {number} AlreadyExists=1 AlreadyExists value + * @property {number} Fail=2 Fail value + * @property {number} AccessDenied=3 AccessDenied value + */ + CreatePersistentSubscriptionCompleted.CreatePersistentSubscriptionResult = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Success"] = 0; + values[valuesById[1] = "AlreadyExists"] = 1; + values[valuesById[2] = "Fail"] = 2; + values[valuesById[3] = "AccessDenied"] = 3; + return values; })(); - Messages.DeletePersistentSubscriptionCompleted = (function() { + return CreatePersistentSubscriptionCompleted; + })(); - /** - * Properties of a DeletePersistentSubscriptionCompleted. - * @memberof EventStore.Client.Messages - * @interface IDeletePersistentSubscriptionCompleted - * @property {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult} result DeletePersistentSubscriptionCompleted result - * @property {string|null} [reason] DeletePersistentSubscriptionCompleted reason - */ + Messages.DeletePersistentSubscriptionCompleted = (function() { - /** - * Constructs a new DeletePersistentSubscriptionCompleted. - * @memberof EventStore.Client.Messages - * @classdesc Represents a DeletePersistentSubscriptionCompleted. - * @implements IDeletePersistentSubscriptionCompleted - * @constructor - * @param {EventStore.Client.Messages.IDeletePersistentSubscriptionCompleted=} [properties] Properties to set - */ - function DeletePersistentSubscriptionCompleted(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a DeletePersistentSubscriptionCompleted. + * @memberof EventStore.Client.Messages + * @interface IDeletePersistentSubscriptionCompleted + * @property {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult|null} [result] DeletePersistentSubscriptionCompleted result + * @property {string|null} [reason] DeletePersistentSubscriptionCompleted reason + */ - /** - * DeletePersistentSubscriptionCompleted result. - * @member {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult} result - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @instance - */ - DeletePersistentSubscriptionCompleted.prototype.result = 0; + /** + * Constructs a new DeletePersistentSubscriptionCompleted. + * @memberof EventStore.Client.Messages + * @classdesc Represents a DeletePersistentSubscriptionCompleted. + * @implements IDeletePersistentSubscriptionCompleted + * @constructor + * @param {EventStore.Client.Messages.IDeletePersistentSubscriptionCompleted=} [properties] Properties to set + */ + function DeletePersistentSubscriptionCompleted(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * DeletePersistentSubscriptionCompleted reason. - * @member {string} reason - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @instance - */ - DeletePersistentSubscriptionCompleted.prototype.reason = ""; + /** + * DeletePersistentSubscriptionCompleted result. + * @member {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult} result + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @instance + */ + DeletePersistentSubscriptionCompleted.prototype.result = 0; - /** - * Creates a new DeletePersistentSubscriptionCompleted instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.IDeletePersistentSubscriptionCompleted=} [properties] Properties to set - * @returns {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted} DeletePersistentSubscriptionCompleted instance - */ - DeletePersistentSubscriptionCompleted.create = function create(properties) { - return new DeletePersistentSubscriptionCompleted(properties); - }; + /** + * DeletePersistentSubscriptionCompleted reason. + * @member {string} reason + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @instance + */ + DeletePersistentSubscriptionCompleted.prototype.reason = ""; - /** - * Encodes the specified DeletePersistentSubscriptionCompleted message. Does not implicitly {@link EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.IDeletePersistentSubscriptionCompleted} message DeletePersistentSubscriptionCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeletePersistentSubscriptionCompleted.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Creates a new DeletePersistentSubscriptionCompleted instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.IDeletePersistentSubscriptionCompleted=} [properties] Properties to set + * @returns {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted} DeletePersistentSubscriptionCompleted instance + */ + DeletePersistentSubscriptionCompleted.create = function create(properties) { + return new DeletePersistentSubscriptionCompleted(properties); + }; + + /** + * Encodes the specified DeletePersistentSubscriptionCompleted message. Does not implicitly {@link EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.IDeletePersistentSubscriptionCompleted} message DeletePersistentSubscriptionCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeletePersistentSubscriptionCompleted.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); - if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.reason); - return writer; - }; + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.reason); + return writer; + }; - /** - * Encodes the specified DeletePersistentSubscriptionCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.IDeletePersistentSubscriptionCompleted} message DeletePersistentSubscriptionCompleted message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeletePersistentSubscriptionCompleted.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified DeletePersistentSubscriptionCompleted message, length delimited. Does not implicitly {@link EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.IDeletePersistentSubscriptionCompleted} message DeletePersistentSubscriptionCompleted message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeletePersistentSubscriptionCompleted.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a DeletePersistentSubscriptionCompleted message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted} DeletePersistentSubscriptionCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeletePersistentSubscriptionCompleted.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.DeletePersistentSubscriptionCompleted(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.result = reader.int32(); - break; - } - case 2: { - message.reason = reader.string(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a DeletePersistentSubscriptionCompleted message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted} DeletePersistentSubscriptionCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeletePersistentSubscriptionCompleted.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.DeletePersistentSubscriptionCompleted(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.result = reader.int32(); break; } + case 2: { + message.reason = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a DeletePersistentSubscriptionCompleted message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted} DeletePersistentSubscriptionCompleted - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeletePersistentSubscriptionCompleted.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a DeletePersistentSubscriptionCompleted message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted} DeletePersistentSubscriptionCompleted + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeletePersistentSubscriptionCompleted.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a DeletePersistentSubscriptionCompleted message. - * @function verify - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeletePersistentSubscriptionCompleted.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a DeletePersistentSubscriptionCompleted message. + * @function verify + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeletePersistentSubscriptionCompleted.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.result != null && message.hasOwnProperty("result")) switch (message.result) { default: return "result: enum value expected"; @@ -10198,814 +10190,814 @@ case 3: break; } - if (message.reason != null && message.hasOwnProperty("reason")) - if (!$util.isString(message.reason)) - return "reason: string expected"; - return null; - }; + if (message.reason != null && message.hasOwnProperty("reason")) + if (!$util.isString(message.reason)) + return "reason: string expected"; + return null; + }; - /** - * Creates a DeletePersistentSubscriptionCompleted message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted} DeletePersistentSubscriptionCompleted - */ - DeletePersistentSubscriptionCompleted.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.DeletePersistentSubscriptionCompleted) - return object; - var message = new $root.EventStore.Client.Messages.DeletePersistentSubscriptionCompleted(); - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Success": - case 0: - message.result = 0; - break; - case "DoesNotExist": - case 1: - message.result = 1; - break; - case "Fail": - case 2: - message.result = 2; - break; - case "AccessDenied": - case 3: - message.result = 3; - break; - } - if (object.reason != null) - message.reason = String(object.reason); - return message; - }; - - /** - * Creates a plain object from a DeletePersistentSubscriptionCompleted message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @static - * @param {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted} message DeletePersistentSubscriptionCompleted - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeletePersistentSubscriptionCompleted.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.result = options.enums === String ? "Success" : 0; - object.reason = ""; - } - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult[message.result] : message.result; - if (message.reason != null && message.hasOwnProperty("reason")) - object.reason = message.reason; + /** + * Creates a DeletePersistentSubscriptionCompleted message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted} DeletePersistentSubscriptionCompleted + */ + DeletePersistentSubscriptionCompleted.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.DeletePersistentSubscriptionCompleted) return object; - }; - - /** - * Converts this DeletePersistentSubscriptionCompleted to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @instance - * @returns {Object.} JSON object - */ - DeletePersistentSubscriptionCompleted.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeletePersistentSubscriptionCompleted - * @function getTypeUrl - * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeletePersistentSubscriptionCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + var message = new $root.EventStore.Client.Messages.DeletePersistentSubscriptionCompleted(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; } - return typeUrlPrefix + "/EventStore.Client.Messages.DeletePersistentSubscriptionCompleted"; - }; + break; + case "Success": + case 0: + message.result = 0; + break; + case "DoesNotExist": + case 1: + message.result = 1; + break; + case "Fail": + case 2: + message.result = 2; + break; + case "AccessDenied": + case 3: + message.result = 3; + break; + } + if (object.reason != null) + message.reason = String(object.reason); + return message; + }; - /** - * DeletePersistentSubscriptionResult enum. - * @name EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult - * @enum {number} - * @property {number} Success=0 Success value - * @property {number} DoesNotExist=1 DoesNotExist value - * @property {number} Fail=2 Fail value - * @property {number} AccessDenied=3 AccessDenied value - */ - DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Success"] = 0; - values[valuesById[1] = "DoesNotExist"] = 1; - values[valuesById[2] = "Fail"] = 2; - values[valuesById[3] = "AccessDenied"] = 3; - return values; - })(); + /** + * Creates a plain object from a DeletePersistentSubscriptionCompleted message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @static + * @param {EventStore.Client.Messages.DeletePersistentSubscriptionCompleted} message DeletePersistentSubscriptionCompleted + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeletePersistentSubscriptionCompleted.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.result = options.enums === String ? "Success" : 0; + object.reason = ""; + } + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult[message.result] : message.result; + if (message.reason != null && message.hasOwnProperty("reason")) + object.reason = message.reason; + return object; + }; - return DeletePersistentSubscriptionCompleted; + /** + * Converts this DeletePersistentSubscriptionCompleted to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @instance + * @returns {Object.} JSON object + */ + DeletePersistentSubscriptionCompleted.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeletePersistentSubscriptionCompleted + * @function getTypeUrl + * @memberof EventStore.Client.Messages.DeletePersistentSubscriptionCompleted + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeletePersistentSubscriptionCompleted.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.DeletePersistentSubscriptionCompleted"; + }; + + /** + * DeletePersistentSubscriptionResult enum. + * @name EventStore.Client.Messages.DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult + * @enum {number} + * @property {number} Success=0 Success value + * @property {number} DoesNotExist=1 DoesNotExist value + * @property {number} Fail=2 Fail value + * @property {number} AccessDenied=3 AccessDenied value + */ + DeletePersistentSubscriptionCompleted.DeletePersistentSubscriptionResult = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Success"] = 0; + values[valuesById[1] = "DoesNotExist"] = 1; + values[valuesById[2] = "Fail"] = 2; + values[valuesById[3] = "AccessDenied"] = 3; + return values; })(); - Messages.ConnectToPersistentSubscription = (function() { + return DeletePersistentSubscriptionCompleted; + })(); - /** - * Properties of a ConnectToPersistentSubscription. - * @memberof EventStore.Client.Messages - * @interface IConnectToPersistentSubscription - * @property {string} subscriptionId ConnectToPersistentSubscription subscriptionId - * @property {string} eventStreamId ConnectToPersistentSubscription eventStreamId - * @property {number} allowedInFlightMessages ConnectToPersistentSubscription allowedInFlightMessages - */ + Messages.ConnectToPersistentSubscription = (function() { - /** - * Constructs a new ConnectToPersistentSubscription. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ConnectToPersistentSubscription. - * @implements IConnectToPersistentSubscription - * @constructor - * @param {EventStore.Client.Messages.IConnectToPersistentSubscription=} [properties] Properties to set - */ - function ConnectToPersistentSubscription(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a ConnectToPersistentSubscription. + * @memberof EventStore.Client.Messages + * @interface IConnectToPersistentSubscription + * @property {string|null} [subscriptionId] ConnectToPersistentSubscription subscriptionId + * @property {string|null} [eventStreamId] ConnectToPersistentSubscription eventStreamId + * @property {number|null} [allowedInFlightMessages] ConnectToPersistentSubscription allowedInFlightMessages + */ - /** - * ConnectToPersistentSubscription subscriptionId. - * @member {string} subscriptionId - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @instance - */ - ConnectToPersistentSubscription.prototype.subscriptionId = ""; + /** + * Constructs a new ConnectToPersistentSubscription. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ConnectToPersistentSubscription. + * @implements IConnectToPersistentSubscription + * @constructor + * @param {EventStore.Client.Messages.IConnectToPersistentSubscription=} [properties] Properties to set + */ + function ConnectToPersistentSubscription(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ConnectToPersistentSubscription eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @instance - */ - ConnectToPersistentSubscription.prototype.eventStreamId = ""; + /** + * ConnectToPersistentSubscription subscriptionId. + * @member {string} subscriptionId + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @instance + */ + ConnectToPersistentSubscription.prototype.subscriptionId = ""; - /** - * ConnectToPersistentSubscription allowedInFlightMessages. - * @member {number} allowedInFlightMessages - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @instance - */ - ConnectToPersistentSubscription.prototype.allowedInFlightMessages = 0; + /** + * ConnectToPersistentSubscription eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @instance + */ + ConnectToPersistentSubscription.prototype.eventStreamId = ""; - /** - * Creates a new ConnectToPersistentSubscription instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @static - * @param {EventStore.Client.Messages.IConnectToPersistentSubscription=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ConnectToPersistentSubscription} ConnectToPersistentSubscription instance - */ - ConnectToPersistentSubscription.create = function create(properties) { - return new ConnectToPersistentSubscription(properties); - }; + /** + * ConnectToPersistentSubscription allowedInFlightMessages. + * @member {number} allowedInFlightMessages + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @instance + */ + ConnectToPersistentSubscription.prototype.allowedInFlightMessages = 0; - /** - * Encodes the specified ConnectToPersistentSubscription message. Does not implicitly {@link EventStore.Client.Messages.ConnectToPersistentSubscription.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @static - * @param {EventStore.Client.Messages.IConnectToPersistentSubscription} message ConnectToPersistentSubscription message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectToPersistentSubscription.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Creates a new ConnectToPersistentSubscription instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @static + * @param {EventStore.Client.Messages.IConnectToPersistentSubscription=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ConnectToPersistentSubscription} ConnectToPersistentSubscription instance + */ + ConnectToPersistentSubscription.create = function create(properties) { + return new ConnectToPersistentSubscription(properties); + }; + + /** + * Encodes the specified ConnectToPersistentSubscription message. Does not implicitly {@link EventStore.Client.Messages.ConnectToPersistentSubscription.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @static + * @param {EventStore.Client.Messages.IConnectToPersistentSubscription} message ConnectToPersistentSubscription message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectToPersistentSubscription.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subscriptionId != null && Object.hasOwnProperty.call(message, "subscriptionId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscriptionId); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.eventStreamId); + if (message.allowedInFlightMessages != null && Object.hasOwnProperty.call(message, "allowedInFlightMessages")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.allowedInFlightMessages); - return writer; - }; + return writer; + }; - /** - * Encodes the specified ConnectToPersistentSubscription message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ConnectToPersistentSubscription.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @static - * @param {EventStore.Client.Messages.IConnectToPersistentSubscription} message ConnectToPersistentSubscription message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectToPersistentSubscription.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ConnectToPersistentSubscription message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ConnectToPersistentSubscription.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @static + * @param {EventStore.Client.Messages.IConnectToPersistentSubscription} message ConnectToPersistentSubscription message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectToPersistentSubscription.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ConnectToPersistentSubscription message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ConnectToPersistentSubscription} ConnectToPersistentSubscription - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectToPersistentSubscription.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ConnectToPersistentSubscription(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.subscriptionId = reader.string(); - break; - } - case 2: { - message.eventStreamId = reader.string(); - break; - } - case 3: { - message.allowedInFlightMessages = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a ConnectToPersistentSubscription message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ConnectToPersistentSubscription} ConnectToPersistentSubscription + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectToPersistentSubscription.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ConnectToPersistentSubscription(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.subscriptionId = reader.string(); break; } + case 2: { + message.eventStreamId = reader.string(); + break; + } + case 3: { + message.allowedInFlightMessages = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("subscriptionId")) - throw $util.ProtocolError("missing required 'subscriptionId'", { instance: message }); - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("allowedInFlightMessages")) - throw $util.ProtocolError("missing required 'allowedInFlightMessages'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a ConnectToPersistentSubscription message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ConnectToPersistentSubscription} ConnectToPersistentSubscription - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectToPersistentSubscription.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ConnectToPersistentSubscription message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ConnectToPersistentSubscription} ConnectToPersistentSubscription + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectToPersistentSubscription.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a ConnectToPersistentSubscription message. - * @function verify - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectToPersistentSubscription.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a ConnectToPersistentSubscription message. + * @function verify + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectToPersistentSubscription.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) if (!$util.isString(message.subscriptionId)) return "subscriptionId: string expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) if (!$util.isString(message.eventStreamId)) return "eventStreamId: string expected"; + if (message.allowedInFlightMessages != null && message.hasOwnProperty("allowedInFlightMessages")) if (!$util.isInteger(message.allowedInFlightMessages)) return "allowedInFlightMessages: integer expected"; - return null; - }; + return null; + }; - /** - * Creates a ConnectToPersistentSubscription message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ConnectToPersistentSubscription} ConnectToPersistentSubscription - */ - ConnectToPersistentSubscription.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ConnectToPersistentSubscription) - return object; - var message = new $root.EventStore.Client.Messages.ConnectToPersistentSubscription(); - if (object.subscriptionId != null) - message.subscriptionId = String(object.subscriptionId); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.allowedInFlightMessages != null) - message.allowedInFlightMessages = object.allowedInFlightMessages | 0; - return message; - }; - - /** - * Creates a plain object from a ConnectToPersistentSubscription message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @static - * @param {EventStore.Client.Messages.ConnectToPersistentSubscription} message ConnectToPersistentSubscription - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectToPersistentSubscription.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.subscriptionId = ""; - object.eventStreamId = ""; - object.allowedInFlightMessages = 0; - } - if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) - object.subscriptionId = message.subscriptionId; - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.allowedInFlightMessages != null && message.hasOwnProperty("allowedInFlightMessages")) - object.allowedInFlightMessages = message.allowedInFlightMessages; + /** + * Creates a ConnectToPersistentSubscription message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ConnectToPersistentSubscription} ConnectToPersistentSubscription + */ + ConnectToPersistentSubscription.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ConnectToPersistentSubscription) return object; - }; + var message = new $root.EventStore.Client.Messages.ConnectToPersistentSubscription(); + if (object.subscriptionId != null) + message.subscriptionId = String(object.subscriptionId); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.allowedInFlightMessages != null) + message.allowedInFlightMessages = object.allowedInFlightMessages | 0; + return message; + }; - /** - * Converts this ConnectToPersistentSubscription to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @instance - * @returns {Object.} JSON object - */ - ConnectToPersistentSubscription.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ConnectToPersistentSubscription - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ConnectToPersistentSubscription.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.ConnectToPersistentSubscription"; - }; - - return ConnectToPersistentSubscription; - })(); - - Messages.PersistentSubscriptionAckEvents = (function() { - - /** - * Properties of a PersistentSubscriptionAckEvents. - * @memberof EventStore.Client.Messages - * @interface IPersistentSubscriptionAckEvents - * @property {string} subscriptionId PersistentSubscriptionAckEvents subscriptionId - * @property {Array.|null} [processedEventIds] PersistentSubscriptionAckEvents processedEventIds - */ - - /** - * Constructs a new PersistentSubscriptionAckEvents. - * @memberof EventStore.Client.Messages - * @classdesc Represents a PersistentSubscriptionAckEvents. - * @implements IPersistentSubscriptionAckEvents - * @constructor - * @param {EventStore.Client.Messages.IPersistentSubscriptionAckEvents=} [properties] Properties to set - */ - function PersistentSubscriptionAckEvents(properties) { - this.processedEventIds = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a ConnectToPersistentSubscription message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @static + * @param {EventStore.Client.Messages.ConnectToPersistentSubscription} message ConnectToPersistentSubscription + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectToPersistentSubscription.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.subscriptionId = ""; + object.eventStreamId = ""; + object.allowedInFlightMessages = 0; } + if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) + object.subscriptionId = message.subscriptionId; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.allowedInFlightMessages != null && message.hasOwnProperty("allowedInFlightMessages")) + object.allowedInFlightMessages = message.allowedInFlightMessages; + return object; + }; - /** - * PersistentSubscriptionAckEvents subscriptionId. - * @member {string} subscriptionId - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @instance - */ - PersistentSubscriptionAckEvents.prototype.subscriptionId = ""; + /** + * Converts this ConnectToPersistentSubscription to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @instance + * @returns {Object.} JSON object + */ + ConnectToPersistentSubscription.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * PersistentSubscriptionAckEvents processedEventIds. - * @member {Array.} processedEventIds - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @instance - */ - PersistentSubscriptionAckEvents.prototype.processedEventIds = $util.emptyArray; + /** + * Gets the default type url for ConnectToPersistentSubscription + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ConnectToPersistentSubscription + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConnectToPersistentSubscription.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ConnectToPersistentSubscription"; + }; - /** - * Creates a new PersistentSubscriptionAckEvents instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionAckEvents=} [properties] Properties to set - * @returns {EventStore.Client.Messages.PersistentSubscriptionAckEvents} PersistentSubscriptionAckEvents instance - */ - PersistentSubscriptionAckEvents.create = function create(properties) { - return new PersistentSubscriptionAckEvents(properties); - }; + return ConnectToPersistentSubscription; + })(); - /** - * Encodes the specified PersistentSubscriptionAckEvents message. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionAckEvents.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionAckEvents} message PersistentSubscriptionAckEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PersistentSubscriptionAckEvents.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + Messages.PersistentSubscriptionAckEvents = (function() { + + /** + * Properties of a PersistentSubscriptionAckEvents. + * @memberof EventStore.Client.Messages + * @interface IPersistentSubscriptionAckEvents + * @property {string|null} [subscriptionId] PersistentSubscriptionAckEvents subscriptionId + * @property {Array.|null} [processedEventIds] PersistentSubscriptionAckEvents processedEventIds + */ + + /** + * Constructs a new PersistentSubscriptionAckEvents. + * @memberof EventStore.Client.Messages + * @classdesc Represents a PersistentSubscriptionAckEvents. + * @implements IPersistentSubscriptionAckEvents + * @constructor + * @param {EventStore.Client.Messages.IPersistentSubscriptionAckEvents=} [properties] Properties to set + */ + function PersistentSubscriptionAckEvents(properties) { + this.processedEventIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PersistentSubscriptionAckEvents subscriptionId. + * @member {string} subscriptionId + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @instance + */ + PersistentSubscriptionAckEvents.prototype.subscriptionId = ""; + + /** + * PersistentSubscriptionAckEvents processedEventIds. + * @member {Array.} processedEventIds + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @instance + */ + PersistentSubscriptionAckEvents.prototype.processedEventIds = $util.emptyArray; + + /** + * Creates a new PersistentSubscriptionAckEvents instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionAckEvents=} [properties] Properties to set + * @returns {EventStore.Client.Messages.PersistentSubscriptionAckEvents} PersistentSubscriptionAckEvents instance + */ + PersistentSubscriptionAckEvents.create = function create(properties) { + return new PersistentSubscriptionAckEvents(properties); + }; + + /** + * Encodes the specified PersistentSubscriptionAckEvents message. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionAckEvents.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionAckEvents} message PersistentSubscriptionAckEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersistentSubscriptionAckEvents.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subscriptionId != null && Object.hasOwnProperty.call(message, "subscriptionId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscriptionId); - if (message.processedEventIds != null && message.processedEventIds.length) - for (var i = 0; i < message.processedEventIds.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.processedEventIds[i]); - return writer; - }; + if (message.processedEventIds != null && message.processedEventIds.length) + for (var i = 0; i < message.processedEventIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.processedEventIds[i]); + return writer; + }; - /** - * Encodes the specified PersistentSubscriptionAckEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionAckEvents.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionAckEvents} message PersistentSubscriptionAckEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PersistentSubscriptionAckEvents.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified PersistentSubscriptionAckEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionAckEvents.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionAckEvents} message PersistentSubscriptionAckEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersistentSubscriptionAckEvents.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a PersistentSubscriptionAckEvents message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.PersistentSubscriptionAckEvents} PersistentSubscriptionAckEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PersistentSubscriptionAckEvents.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.PersistentSubscriptionAckEvents(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.subscriptionId = reader.string(); - break; - } - case 2: { - if (!(message.processedEventIds && message.processedEventIds.length)) - message.processedEventIds = []; - message.processedEventIds.push(reader.bytes()); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a PersistentSubscriptionAckEvents message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.PersistentSubscriptionAckEvents} PersistentSubscriptionAckEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersistentSubscriptionAckEvents.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.PersistentSubscriptionAckEvents(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.subscriptionId = reader.string(); break; } + case 2: { + if (!(message.processedEventIds && message.processedEventIds.length)) + message.processedEventIds = []; + message.processedEventIds.push(reader.bytes()); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("subscriptionId")) - throw $util.ProtocolError("missing required 'subscriptionId'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a PersistentSubscriptionAckEvents message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.PersistentSubscriptionAckEvents} PersistentSubscriptionAckEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PersistentSubscriptionAckEvents.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a PersistentSubscriptionAckEvents message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.PersistentSubscriptionAckEvents} PersistentSubscriptionAckEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersistentSubscriptionAckEvents.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a PersistentSubscriptionAckEvents message. - * @function verify - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PersistentSubscriptionAckEvents.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a PersistentSubscriptionAckEvents message. + * @function verify + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PersistentSubscriptionAckEvents.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) if (!$util.isString(message.subscriptionId)) return "subscriptionId: string expected"; - if (message.processedEventIds != null && message.hasOwnProperty("processedEventIds")) { - if (!Array.isArray(message.processedEventIds)) - return "processedEventIds: array expected"; - for (var i = 0; i < message.processedEventIds.length; ++i) - if (!(message.processedEventIds[i] && typeof message.processedEventIds[i].length === "number" || $util.isString(message.processedEventIds[i]))) - return "processedEventIds: buffer[] expected"; - } - return null; - }; - - /** - * Creates a PersistentSubscriptionAckEvents message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.PersistentSubscriptionAckEvents} PersistentSubscriptionAckEvents - */ - PersistentSubscriptionAckEvents.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.PersistentSubscriptionAckEvents) - return object; - var message = new $root.EventStore.Client.Messages.PersistentSubscriptionAckEvents(); - if (object.subscriptionId != null) - message.subscriptionId = String(object.subscriptionId); - if (object.processedEventIds) { - if (!Array.isArray(object.processedEventIds)) - throw TypeError(".EventStore.Client.Messages.PersistentSubscriptionAckEvents.processedEventIds: array expected"); - message.processedEventIds = []; - for (var i = 0; i < object.processedEventIds.length; ++i) - if (typeof object.processedEventIds[i] === "string") - $util.base64.decode(object.processedEventIds[i], message.processedEventIds[i] = $util.newBuffer($util.base64.length(object.processedEventIds[i])), 0); - else if (object.processedEventIds[i].length >= 0) - message.processedEventIds[i] = object.processedEventIds[i]; - } - return message; - }; - - /** - * Creates a plain object from a PersistentSubscriptionAckEvents message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @static - * @param {EventStore.Client.Messages.PersistentSubscriptionAckEvents} message PersistentSubscriptionAckEvents - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PersistentSubscriptionAckEvents.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.processedEventIds = []; - if (options.defaults) - object.subscriptionId = ""; - if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) - object.subscriptionId = message.subscriptionId; - if (message.processedEventIds && message.processedEventIds.length) { - object.processedEventIds = []; - for (var j = 0; j < message.processedEventIds.length; ++j) - object.processedEventIds[j] = options.bytes === String ? $util.base64.encode(message.processedEventIds[j], 0, message.processedEventIds[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.processedEventIds[j]) : message.processedEventIds[j]; - } - return object; - }; - - /** - * Converts this PersistentSubscriptionAckEvents to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @instance - * @returns {Object.} JSON object - */ - PersistentSubscriptionAckEvents.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PersistentSubscriptionAckEvents - * @function getTypeUrl - * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PersistentSubscriptionAckEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.PersistentSubscriptionAckEvents"; - }; - - return PersistentSubscriptionAckEvents; - })(); - - Messages.PersistentSubscriptionNakEvents = (function() { - - /** - * Properties of a PersistentSubscriptionNakEvents. - * @memberof EventStore.Client.Messages - * @interface IPersistentSubscriptionNakEvents - * @property {string} subscriptionId PersistentSubscriptionNakEvents subscriptionId - * @property {Array.|null} [processedEventIds] PersistentSubscriptionNakEvents processedEventIds - * @property {string|null} [message] PersistentSubscriptionNakEvents message - * @property {EventStore.Client.Messages.PersistentSubscriptionNakEvents.NakAction} action PersistentSubscriptionNakEvents action - */ - - /** - * Constructs a new PersistentSubscriptionNakEvents. - * @memberof EventStore.Client.Messages - * @classdesc Represents a PersistentSubscriptionNakEvents. - * @implements IPersistentSubscriptionNakEvents - * @constructor - * @param {EventStore.Client.Messages.IPersistentSubscriptionNakEvents=} [properties] Properties to set - */ - function PersistentSubscriptionNakEvents(properties) { - this.processedEventIds = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + if (message.processedEventIds != null && message.hasOwnProperty("processedEventIds")) { + if (!Array.isArray(message.processedEventIds)) + return "processedEventIds: array expected"; + for (var i = 0; i < message.processedEventIds.length; ++i) + if (!(message.processedEventIds[i] && typeof message.processedEventIds[i].length === "number" || $util.isString(message.processedEventIds[i]))) + return "processedEventIds: buffer[] expected"; } + return null; + }; - /** - * PersistentSubscriptionNakEvents subscriptionId. - * @member {string} subscriptionId - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @instance - */ - PersistentSubscriptionNakEvents.prototype.subscriptionId = ""; + /** + * Creates a PersistentSubscriptionAckEvents message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.PersistentSubscriptionAckEvents} PersistentSubscriptionAckEvents + */ + PersistentSubscriptionAckEvents.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.PersistentSubscriptionAckEvents) + return object; + var message = new $root.EventStore.Client.Messages.PersistentSubscriptionAckEvents(); + if (object.subscriptionId != null) + message.subscriptionId = String(object.subscriptionId); + if (object.processedEventIds) { + if (!Array.isArray(object.processedEventIds)) + throw TypeError(".EventStore.Client.Messages.PersistentSubscriptionAckEvents.processedEventIds: array expected"); + message.processedEventIds = []; + for (var i = 0; i < object.processedEventIds.length; ++i) + if (typeof object.processedEventIds[i] === "string") + $util.base64.decode(object.processedEventIds[i], message.processedEventIds[i] = $util.newBuffer($util.base64.length(object.processedEventIds[i])), 0); + else if (object.processedEventIds[i].length >= 0) + message.processedEventIds[i] = object.processedEventIds[i]; + } + return message; + }; - /** - * PersistentSubscriptionNakEvents processedEventIds. - * @member {Array.} processedEventIds - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @instance - */ - PersistentSubscriptionNakEvents.prototype.processedEventIds = $util.emptyArray; + /** + * Creates a plain object from a PersistentSubscriptionAckEvents message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @static + * @param {EventStore.Client.Messages.PersistentSubscriptionAckEvents} message PersistentSubscriptionAckEvents + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PersistentSubscriptionAckEvents.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.processedEventIds = []; + if (options.defaults) + object.subscriptionId = ""; + if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) + object.subscriptionId = message.subscriptionId; + if (message.processedEventIds && message.processedEventIds.length) { + object.processedEventIds = []; + for (var j = 0; j < message.processedEventIds.length; ++j) + object.processedEventIds[j] = options.bytes === String ? $util.base64.encode(message.processedEventIds[j], 0, message.processedEventIds[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.processedEventIds[j]) : message.processedEventIds[j]; + } + return object; + }; - /** - * PersistentSubscriptionNakEvents message. - * @member {string} message - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @instance - */ - PersistentSubscriptionNakEvents.prototype.message = ""; + /** + * Converts this PersistentSubscriptionAckEvents to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @instance + * @returns {Object.} JSON object + */ + PersistentSubscriptionAckEvents.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * PersistentSubscriptionNakEvents action. - * @member {EventStore.Client.Messages.PersistentSubscriptionNakEvents.NakAction} action - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @instance - */ - PersistentSubscriptionNakEvents.prototype.action = 0; + /** + * Gets the default type url for PersistentSubscriptionAckEvents + * @function getTypeUrl + * @memberof EventStore.Client.Messages.PersistentSubscriptionAckEvents + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PersistentSubscriptionAckEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.PersistentSubscriptionAckEvents"; + }; - /** - * Creates a new PersistentSubscriptionNakEvents instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionNakEvents=} [properties] Properties to set - * @returns {EventStore.Client.Messages.PersistentSubscriptionNakEvents} PersistentSubscriptionNakEvents instance - */ - PersistentSubscriptionNakEvents.create = function create(properties) { - return new PersistentSubscriptionNakEvents(properties); - }; + return PersistentSubscriptionAckEvents; + })(); - /** - * Encodes the specified PersistentSubscriptionNakEvents message. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionNakEvents.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionNakEvents} message PersistentSubscriptionNakEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PersistentSubscriptionNakEvents.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + Messages.PersistentSubscriptionNakEvents = (function() { + + /** + * Properties of a PersistentSubscriptionNakEvents. + * @memberof EventStore.Client.Messages + * @interface IPersistentSubscriptionNakEvents + * @property {string|null} [subscriptionId] PersistentSubscriptionNakEvents subscriptionId + * @property {Array.|null} [processedEventIds] PersistentSubscriptionNakEvents processedEventIds + * @property {string|null} [message] PersistentSubscriptionNakEvents message + * @property {EventStore.Client.Messages.PersistentSubscriptionNakEvents.NakAction|null} [action] PersistentSubscriptionNakEvents action + */ + + /** + * Constructs a new PersistentSubscriptionNakEvents. + * @memberof EventStore.Client.Messages + * @classdesc Represents a PersistentSubscriptionNakEvents. + * @implements IPersistentSubscriptionNakEvents + * @constructor + * @param {EventStore.Client.Messages.IPersistentSubscriptionNakEvents=} [properties] Properties to set + */ + function PersistentSubscriptionNakEvents(properties) { + this.processedEventIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PersistentSubscriptionNakEvents subscriptionId. + * @member {string} subscriptionId + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @instance + */ + PersistentSubscriptionNakEvents.prototype.subscriptionId = ""; + + /** + * PersistentSubscriptionNakEvents processedEventIds. + * @member {Array.} processedEventIds + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @instance + */ + PersistentSubscriptionNakEvents.prototype.processedEventIds = $util.emptyArray; + + /** + * PersistentSubscriptionNakEvents message. + * @member {string} message + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @instance + */ + PersistentSubscriptionNakEvents.prototype.message = ""; + + /** + * PersistentSubscriptionNakEvents action. + * @member {EventStore.Client.Messages.PersistentSubscriptionNakEvents.NakAction} action + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @instance + */ + PersistentSubscriptionNakEvents.prototype.action = 0; + + /** + * Creates a new PersistentSubscriptionNakEvents instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionNakEvents=} [properties] Properties to set + * @returns {EventStore.Client.Messages.PersistentSubscriptionNakEvents} PersistentSubscriptionNakEvents instance + */ + PersistentSubscriptionNakEvents.create = function create(properties) { + return new PersistentSubscriptionNakEvents(properties); + }; + + /** + * Encodes the specified PersistentSubscriptionNakEvents message. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionNakEvents.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionNakEvents} message PersistentSubscriptionNakEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersistentSubscriptionNakEvents.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subscriptionId != null && Object.hasOwnProperty.call(message, "subscriptionId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscriptionId); - if (message.processedEventIds != null && message.processedEventIds.length) - for (var i = 0; i < message.processedEventIds.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.processedEventIds[i]); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + if (message.processedEventIds != null && message.processedEventIds.length) + for (var i = 0; i < message.processedEventIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.processedEventIds[i]); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.action); - return writer; - }; + return writer; + }; - /** - * Encodes the specified PersistentSubscriptionNakEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionNakEvents.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionNakEvents} message PersistentSubscriptionNakEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PersistentSubscriptionNakEvents.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified PersistentSubscriptionNakEvents message, length delimited. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionNakEvents.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionNakEvents} message PersistentSubscriptionNakEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersistentSubscriptionNakEvents.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a PersistentSubscriptionNakEvents message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.PersistentSubscriptionNakEvents} PersistentSubscriptionNakEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PersistentSubscriptionNakEvents.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.PersistentSubscriptionNakEvents(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.subscriptionId = reader.string(); - break; - } - case 2: { - if (!(message.processedEventIds && message.processedEventIds.length)) - message.processedEventIds = []; - message.processedEventIds.push(reader.bytes()); - break; - } - case 3: { - message.message = reader.string(); - break; - } - case 4: { - message.action = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a PersistentSubscriptionNakEvents message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.PersistentSubscriptionNakEvents} PersistentSubscriptionNakEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersistentSubscriptionNakEvents.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.PersistentSubscriptionNakEvents(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.subscriptionId = reader.string(); break; } + case 2: { + if (!(message.processedEventIds && message.processedEventIds.length)) + message.processedEventIds = []; + message.processedEventIds.push(reader.bytes()); + break; + } + case 3: { + message.message = reader.string(); + break; + } + case 4: { + message.action = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("subscriptionId")) - throw $util.ProtocolError("missing required 'subscriptionId'", { instance: message }); - if (!message.hasOwnProperty("action")) - throw $util.ProtocolError("missing required 'action'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a PersistentSubscriptionNakEvents message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.PersistentSubscriptionNakEvents} PersistentSubscriptionNakEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PersistentSubscriptionNakEvents.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a PersistentSubscriptionNakEvents message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.PersistentSubscriptionNakEvents} PersistentSubscriptionNakEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersistentSubscriptionNakEvents.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a PersistentSubscriptionNakEvents message. - * @function verify - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PersistentSubscriptionNakEvents.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a PersistentSubscriptionNakEvents message. + * @function verify + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PersistentSubscriptionNakEvents.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) if (!$util.isString(message.subscriptionId)) return "subscriptionId: string expected"; - if (message.processedEventIds != null && message.hasOwnProperty("processedEventIds")) { - if (!Array.isArray(message.processedEventIds)) - return "processedEventIds: array expected"; - for (var i = 0; i < message.processedEventIds.length; ++i) - if (!(message.processedEventIds[i] && typeof message.processedEventIds[i].length === "number" || $util.isString(message.processedEventIds[i]))) - return "processedEventIds: buffer[] expected"; - } - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; + if (message.processedEventIds != null && message.hasOwnProperty("processedEventIds")) { + if (!Array.isArray(message.processedEventIds)) + return "processedEventIds: array expected"; + for (var i = 0; i < message.processedEventIds.length; ++i) + if (!(message.processedEventIds[i] && typeof message.processedEventIds[i].length === "number" || $util.isString(message.processedEventIds[i]))) + return "processedEventIds: buffer[] expected"; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.action != null && message.hasOwnProperty("action")) switch (message.action) { default: return "action: enum value expected"; @@ -11016,2464 +11008,2461 @@ case 4: break; } - return null; - }; + return null; + }; - /** - * Creates a PersistentSubscriptionNakEvents message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.PersistentSubscriptionNakEvents} PersistentSubscriptionNakEvents - */ - PersistentSubscriptionNakEvents.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.PersistentSubscriptionNakEvents) - return object; - var message = new $root.EventStore.Client.Messages.PersistentSubscriptionNakEvents(); - if (object.subscriptionId != null) - message.subscriptionId = String(object.subscriptionId); - if (object.processedEventIds) { - if (!Array.isArray(object.processedEventIds)) - throw TypeError(".EventStore.Client.Messages.PersistentSubscriptionNakEvents.processedEventIds: array expected"); - message.processedEventIds = []; - for (var i = 0; i < object.processedEventIds.length; ++i) - if (typeof object.processedEventIds[i] === "string") - $util.base64.decode(object.processedEventIds[i], message.processedEventIds[i] = $util.newBuffer($util.base64.length(object.processedEventIds[i])), 0); - else if (object.processedEventIds[i].length >= 0) - message.processedEventIds[i] = object.processedEventIds[i]; - } - if (object.message != null) - message.message = String(object.message); - switch (object.action) { - default: - if (typeof object.action === "number") { - message.action = object.action; - break; - } - break; - case "Unknown": - case 0: - message.action = 0; - break; - case "Park": - case 1: - message.action = 1; - break; - case "Retry": - case 2: - message.action = 2; - break; - case "Skip": - case 3: - message.action = 3; - break; - case "Stop": - case 4: - message.action = 4; - break; - } - return message; - }; - - /** - * Creates a plain object from a PersistentSubscriptionNakEvents message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @static - * @param {EventStore.Client.Messages.PersistentSubscriptionNakEvents} message PersistentSubscriptionNakEvents - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PersistentSubscriptionNakEvents.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.processedEventIds = []; - if (options.defaults) { - object.subscriptionId = ""; - object.message = ""; - object.action = options.enums === String ? "Unknown" : 0; - } - if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) - object.subscriptionId = message.subscriptionId; - if (message.processedEventIds && message.processedEventIds.length) { - object.processedEventIds = []; - for (var j = 0; j < message.processedEventIds.length; ++j) - object.processedEventIds[j] = options.bytes === String ? $util.base64.encode(message.processedEventIds[j], 0, message.processedEventIds[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.processedEventIds[j]) : message.processedEventIds[j]; - } - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.action != null && message.hasOwnProperty("action")) - object.action = options.enums === String ? $root.EventStore.Client.Messages.PersistentSubscriptionNakEvents.NakAction[message.action] === undefined ? message.action : $root.EventStore.Client.Messages.PersistentSubscriptionNakEvents.NakAction[message.action] : message.action; + /** + * Creates a PersistentSubscriptionNakEvents message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.PersistentSubscriptionNakEvents} PersistentSubscriptionNakEvents + */ + PersistentSubscriptionNakEvents.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.PersistentSubscriptionNakEvents) return object; - }; - - /** - * Converts this PersistentSubscriptionNakEvents to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @instance - * @returns {Object.} JSON object - */ - PersistentSubscriptionNakEvents.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PersistentSubscriptionNakEvents - * @function getTypeUrl - * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PersistentSubscriptionNakEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + var message = new $root.EventStore.Client.Messages.PersistentSubscriptionNakEvents(); + if (object.subscriptionId != null) + message.subscriptionId = String(object.subscriptionId); + if (object.processedEventIds) { + if (!Array.isArray(object.processedEventIds)) + throw TypeError(".EventStore.Client.Messages.PersistentSubscriptionNakEvents.processedEventIds: array expected"); + message.processedEventIds = []; + for (var i = 0; i < object.processedEventIds.length; ++i) + if (typeof object.processedEventIds[i] === "string") + $util.base64.decode(object.processedEventIds[i], message.processedEventIds[i] = $util.newBuffer($util.base64.length(object.processedEventIds[i])), 0); + else if (object.processedEventIds[i].length >= 0) + message.processedEventIds[i] = object.processedEventIds[i]; + } + if (object.message != null) + message.message = String(object.message); + switch (object.action) { + default: + if (typeof object.action === "number") { + message.action = object.action; + break; } - return typeUrlPrefix + "/EventStore.Client.Messages.PersistentSubscriptionNakEvents"; - }; + break; + case "Unknown": + case 0: + message.action = 0; + break; + case "Park": + case 1: + message.action = 1; + break; + case "Retry": + case 2: + message.action = 2; + break; + case "Skip": + case 3: + message.action = 3; + break; + case "Stop": + case 4: + message.action = 4; + break; + } + return message; + }; - /** - * NakAction enum. - * @name EventStore.Client.Messages.PersistentSubscriptionNakEvents.NakAction - * @enum {number} - * @property {number} Unknown=0 Unknown value - * @property {number} Park=1 Park value - * @property {number} Retry=2 Retry value - * @property {number} Skip=3 Skip value - * @property {number} Stop=4 Stop value - */ - PersistentSubscriptionNakEvents.NakAction = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Unknown"] = 0; - values[valuesById[1] = "Park"] = 1; - values[valuesById[2] = "Retry"] = 2; - values[valuesById[3] = "Skip"] = 3; - values[valuesById[4] = "Stop"] = 4; - return values; - })(); + /** + * Creates a plain object from a PersistentSubscriptionNakEvents message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @static + * @param {EventStore.Client.Messages.PersistentSubscriptionNakEvents} message PersistentSubscriptionNakEvents + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PersistentSubscriptionNakEvents.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.processedEventIds = []; + if (options.defaults) { + object.subscriptionId = ""; + object.message = ""; + object.action = options.enums === String ? "Unknown" : 0; + } + if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) + object.subscriptionId = message.subscriptionId; + if (message.processedEventIds && message.processedEventIds.length) { + object.processedEventIds = []; + for (var j = 0; j < message.processedEventIds.length; ++j) + object.processedEventIds[j] = options.bytes === String ? $util.base64.encode(message.processedEventIds[j], 0, message.processedEventIds[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.processedEventIds[j]) : message.processedEventIds[j]; + } + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.action != null && message.hasOwnProperty("action")) + object.action = options.enums === String ? $root.EventStore.Client.Messages.PersistentSubscriptionNakEvents.NakAction[message.action] === undefined ? message.action : $root.EventStore.Client.Messages.PersistentSubscriptionNakEvents.NakAction[message.action] : message.action; + return object; + }; - return PersistentSubscriptionNakEvents; + /** + * Converts this PersistentSubscriptionNakEvents to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @instance + * @returns {Object.} JSON object + */ + PersistentSubscriptionNakEvents.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PersistentSubscriptionNakEvents + * @function getTypeUrl + * @memberof EventStore.Client.Messages.PersistentSubscriptionNakEvents + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PersistentSubscriptionNakEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.PersistentSubscriptionNakEvents"; + }; + + /** + * NakAction enum. + * @name EventStore.Client.Messages.PersistentSubscriptionNakEvents.NakAction + * @enum {number} + * @property {number} Unknown=0 Unknown value + * @property {number} Park=1 Park value + * @property {number} Retry=2 Retry value + * @property {number} Skip=3 Skip value + * @property {number} Stop=4 Stop value + */ + PersistentSubscriptionNakEvents.NakAction = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Unknown"] = 0; + values[valuesById[1] = "Park"] = 1; + values[valuesById[2] = "Retry"] = 2; + values[valuesById[3] = "Skip"] = 3; + values[valuesById[4] = "Stop"] = 4; + return values; })(); - Messages.PersistentSubscriptionConfirmation = (function() { + return PersistentSubscriptionNakEvents; + })(); - /** - * Properties of a PersistentSubscriptionConfirmation. - * @memberof EventStore.Client.Messages - * @interface IPersistentSubscriptionConfirmation - * @property {Long} lastCommitPosition PersistentSubscriptionConfirmation lastCommitPosition - * @property {string} subscriptionId PersistentSubscriptionConfirmation subscriptionId - * @property {Long|null} [lastEventNumber] PersistentSubscriptionConfirmation lastEventNumber - */ + Messages.PersistentSubscriptionConfirmation = (function() { - /** - * Constructs a new PersistentSubscriptionConfirmation. - * @memberof EventStore.Client.Messages - * @classdesc Represents a PersistentSubscriptionConfirmation. - * @implements IPersistentSubscriptionConfirmation - * @constructor - * @param {EventStore.Client.Messages.IPersistentSubscriptionConfirmation=} [properties] Properties to set - */ - function PersistentSubscriptionConfirmation(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a PersistentSubscriptionConfirmation. + * @memberof EventStore.Client.Messages + * @interface IPersistentSubscriptionConfirmation + * @property {Long|null} [lastCommitPosition] PersistentSubscriptionConfirmation lastCommitPosition + * @property {string|null} [subscriptionId] PersistentSubscriptionConfirmation subscriptionId + * @property {Long|null} [lastEventNumber] PersistentSubscriptionConfirmation lastEventNumber + */ - /** - * PersistentSubscriptionConfirmation lastCommitPosition. - * @member {Long} lastCommitPosition - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @instance - */ - PersistentSubscriptionConfirmation.prototype.lastCommitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Constructs a new PersistentSubscriptionConfirmation. + * @memberof EventStore.Client.Messages + * @classdesc Represents a PersistentSubscriptionConfirmation. + * @implements IPersistentSubscriptionConfirmation + * @constructor + * @param {EventStore.Client.Messages.IPersistentSubscriptionConfirmation=} [properties] Properties to set + */ + function PersistentSubscriptionConfirmation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * PersistentSubscriptionConfirmation subscriptionId. - * @member {string} subscriptionId - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @instance - */ - PersistentSubscriptionConfirmation.prototype.subscriptionId = ""; + /** + * PersistentSubscriptionConfirmation lastCommitPosition. + * @member {Long} lastCommitPosition + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @instance + */ + PersistentSubscriptionConfirmation.prototype.lastCommitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * PersistentSubscriptionConfirmation lastEventNumber. - * @member {Long} lastEventNumber - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @instance - */ - PersistentSubscriptionConfirmation.prototype.lastEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * PersistentSubscriptionConfirmation subscriptionId. + * @member {string} subscriptionId + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @instance + */ + PersistentSubscriptionConfirmation.prototype.subscriptionId = ""; - /** - * Creates a new PersistentSubscriptionConfirmation instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionConfirmation=} [properties] Properties to set - * @returns {EventStore.Client.Messages.PersistentSubscriptionConfirmation} PersistentSubscriptionConfirmation instance - */ - PersistentSubscriptionConfirmation.create = function create(properties) { - return new PersistentSubscriptionConfirmation(properties); - }; + /** + * PersistentSubscriptionConfirmation lastEventNumber. + * @member {Long} lastEventNumber + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @instance + */ + PersistentSubscriptionConfirmation.prototype.lastEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Encodes the specified PersistentSubscriptionConfirmation message. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionConfirmation.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionConfirmation} message PersistentSubscriptionConfirmation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PersistentSubscriptionConfirmation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Creates a new PersistentSubscriptionConfirmation instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionConfirmation=} [properties] Properties to set + * @returns {EventStore.Client.Messages.PersistentSubscriptionConfirmation} PersistentSubscriptionConfirmation instance + */ + PersistentSubscriptionConfirmation.create = function create(properties) { + return new PersistentSubscriptionConfirmation(properties); + }; + + /** + * Encodes the specified PersistentSubscriptionConfirmation message. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionConfirmation.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionConfirmation} message PersistentSubscriptionConfirmation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersistentSubscriptionConfirmation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.lastCommitPosition != null && Object.hasOwnProperty.call(message, "lastCommitPosition")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.lastCommitPosition); + if (message.subscriptionId != null && Object.hasOwnProperty.call(message, "subscriptionId")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.subscriptionId); - if (message.lastEventNumber != null && Object.hasOwnProperty.call(message, "lastEventNumber")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.lastEventNumber); - return writer; - }; + if (message.lastEventNumber != null && Object.hasOwnProperty.call(message, "lastEventNumber")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.lastEventNumber); + return writer; + }; - /** - * Encodes the specified PersistentSubscriptionConfirmation message, length delimited. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionConfirmation.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionConfirmation} message PersistentSubscriptionConfirmation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PersistentSubscriptionConfirmation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified PersistentSubscriptionConfirmation message, length delimited. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionConfirmation.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionConfirmation} message PersistentSubscriptionConfirmation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersistentSubscriptionConfirmation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a PersistentSubscriptionConfirmation message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.PersistentSubscriptionConfirmation} PersistentSubscriptionConfirmation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PersistentSubscriptionConfirmation.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.PersistentSubscriptionConfirmation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.lastCommitPosition = reader.int64(); - break; - } - case 2: { - message.subscriptionId = reader.string(); - break; - } - case 3: { - message.lastEventNumber = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a PersistentSubscriptionConfirmation message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.PersistentSubscriptionConfirmation} PersistentSubscriptionConfirmation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersistentSubscriptionConfirmation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.PersistentSubscriptionConfirmation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.lastCommitPosition = reader.int64(); break; } + case 2: { + message.subscriptionId = reader.string(); + break; + } + case 3: { + message.lastEventNumber = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("lastCommitPosition")) - throw $util.ProtocolError("missing required 'lastCommitPosition'", { instance: message }); - if (!message.hasOwnProperty("subscriptionId")) - throw $util.ProtocolError("missing required 'subscriptionId'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a PersistentSubscriptionConfirmation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.PersistentSubscriptionConfirmation} PersistentSubscriptionConfirmation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PersistentSubscriptionConfirmation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a PersistentSubscriptionConfirmation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.PersistentSubscriptionConfirmation} PersistentSubscriptionConfirmation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersistentSubscriptionConfirmation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a PersistentSubscriptionConfirmation message. - * @function verify - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PersistentSubscriptionConfirmation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a PersistentSubscriptionConfirmation message. + * @function verify + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PersistentSubscriptionConfirmation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.lastCommitPosition != null && message.hasOwnProperty("lastCommitPosition")) if (!$util.isInteger(message.lastCommitPosition) && !(message.lastCommitPosition && $util.isInteger(message.lastCommitPosition.low) && $util.isInteger(message.lastCommitPosition.high))) return "lastCommitPosition: integer|Long expected"; + if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) if (!$util.isString(message.subscriptionId)) return "subscriptionId: string expected"; - if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) - if (!$util.isInteger(message.lastEventNumber) && !(message.lastEventNumber && $util.isInteger(message.lastEventNumber.low) && $util.isInteger(message.lastEventNumber.high))) - return "lastEventNumber: integer|Long expected"; - return null; - }; + if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) + if (!$util.isInteger(message.lastEventNumber) && !(message.lastEventNumber && $util.isInteger(message.lastEventNumber.low) && $util.isInteger(message.lastEventNumber.high))) + return "lastEventNumber: integer|Long expected"; + return null; + }; - /** - * Creates a PersistentSubscriptionConfirmation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.PersistentSubscriptionConfirmation} PersistentSubscriptionConfirmation - */ - PersistentSubscriptionConfirmation.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.PersistentSubscriptionConfirmation) - return object; - var message = new $root.EventStore.Client.Messages.PersistentSubscriptionConfirmation(); - if (object.lastCommitPosition != null) - if ($util.Long) - (message.lastCommitPosition = $util.Long.fromValue(object.lastCommitPosition)).unsigned = false; - else if (typeof object.lastCommitPosition === "string") - message.lastCommitPosition = parseInt(object.lastCommitPosition, 10); - else if (typeof object.lastCommitPosition === "number") - message.lastCommitPosition = object.lastCommitPosition; - else if (typeof object.lastCommitPosition === "object") - message.lastCommitPosition = new $util.LongBits(object.lastCommitPosition.low >>> 0, object.lastCommitPosition.high >>> 0).toNumber(); - if (object.subscriptionId != null) - message.subscriptionId = String(object.subscriptionId); - if (object.lastEventNumber != null) - if ($util.Long) - (message.lastEventNumber = $util.Long.fromValue(object.lastEventNumber)).unsigned = false; - else if (typeof object.lastEventNumber === "string") - message.lastEventNumber = parseInt(object.lastEventNumber, 10); - else if (typeof object.lastEventNumber === "number") - message.lastEventNumber = object.lastEventNumber; - else if (typeof object.lastEventNumber === "object") - message.lastEventNumber = new $util.LongBits(object.lastEventNumber.low >>> 0, object.lastEventNumber.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a PersistentSubscriptionConfirmation message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @static - * @param {EventStore.Client.Messages.PersistentSubscriptionConfirmation} message PersistentSubscriptionConfirmation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PersistentSubscriptionConfirmation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.lastCommitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.lastCommitPosition = options.longs === String ? "0" : 0; - object.subscriptionId = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.lastEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.lastEventNumber = options.longs === String ? "0" : 0; - } - if (message.lastCommitPosition != null && message.hasOwnProperty("lastCommitPosition")) - if (typeof message.lastCommitPosition === "number") - object.lastCommitPosition = options.longs === String ? String(message.lastCommitPosition) : message.lastCommitPosition; - else - object.lastCommitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.lastCommitPosition) : options.longs === Number ? new $util.LongBits(message.lastCommitPosition.low >>> 0, message.lastCommitPosition.high >>> 0).toNumber() : message.lastCommitPosition; - if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) - object.subscriptionId = message.subscriptionId; - if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) - if (typeof message.lastEventNumber === "number") - object.lastEventNumber = options.longs === String ? String(message.lastEventNumber) : message.lastEventNumber; - else - object.lastEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.lastEventNumber) : options.longs === Number ? new $util.LongBits(message.lastEventNumber.low >>> 0, message.lastEventNumber.high >>> 0).toNumber() : message.lastEventNumber; + /** + * Creates a PersistentSubscriptionConfirmation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.PersistentSubscriptionConfirmation} PersistentSubscriptionConfirmation + */ + PersistentSubscriptionConfirmation.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.PersistentSubscriptionConfirmation) return object; - }; + var message = new $root.EventStore.Client.Messages.PersistentSubscriptionConfirmation(); + if (object.lastCommitPosition != null) + if ($util.Long) + (message.lastCommitPosition = $util.Long.fromValue(object.lastCommitPosition)).unsigned = false; + else if (typeof object.lastCommitPosition === "string") + message.lastCommitPosition = parseInt(object.lastCommitPosition, 10); + else if (typeof object.lastCommitPosition === "number") + message.lastCommitPosition = object.lastCommitPosition; + else if (typeof object.lastCommitPosition === "object") + message.lastCommitPosition = new $util.LongBits(object.lastCommitPosition.low >>> 0, object.lastCommitPosition.high >>> 0).toNumber(); + if (object.subscriptionId != null) + message.subscriptionId = String(object.subscriptionId); + if (object.lastEventNumber != null) + if ($util.Long) + (message.lastEventNumber = $util.Long.fromValue(object.lastEventNumber)).unsigned = false; + else if (typeof object.lastEventNumber === "string") + message.lastEventNumber = parseInt(object.lastEventNumber, 10); + else if (typeof object.lastEventNumber === "number") + message.lastEventNumber = object.lastEventNumber; + else if (typeof object.lastEventNumber === "object") + message.lastEventNumber = new $util.LongBits(object.lastEventNumber.low >>> 0, object.lastEventNumber.high >>> 0).toNumber(); + return message; + }; - /** - * Converts this PersistentSubscriptionConfirmation to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @instance - * @returns {Object.} JSON object - */ - PersistentSubscriptionConfirmation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PersistentSubscriptionConfirmation - * @function getTypeUrl - * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PersistentSubscriptionConfirmation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.PersistentSubscriptionConfirmation"; - }; - - return PersistentSubscriptionConfirmation; - })(); - - Messages.PersistentSubscriptionStreamEventAppeared = (function() { - - /** - * Properties of a PersistentSubscriptionStreamEventAppeared. - * @memberof EventStore.Client.Messages - * @interface IPersistentSubscriptionStreamEventAppeared - * @property {EventStore.Client.Messages.IResolvedIndexedEvent} event PersistentSubscriptionStreamEventAppeared event - * @property {number|null} [retryCount] PersistentSubscriptionStreamEventAppeared retryCount - */ - - /** - * Constructs a new PersistentSubscriptionStreamEventAppeared. - * @memberof EventStore.Client.Messages - * @classdesc Represents a PersistentSubscriptionStreamEventAppeared. - * @implements IPersistentSubscriptionStreamEventAppeared - * @constructor - * @param {EventStore.Client.Messages.IPersistentSubscriptionStreamEventAppeared=} [properties] Properties to set - */ - function PersistentSubscriptionStreamEventAppeared(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a PersistentSubscriptionConfirmation message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @static + * @param {EventStore.Client.Messages.PersistentSubscriptionConfirmation} message PersistentSubscriptionConfirmation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PersistentSubscriptionConfirmation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastCommitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastCommitPosition = options.longs === String ? "0" : 0; + object.subscriptionId = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastEventNumber = options.longs === String ? "0" : 0; } + if (message.lastCommitPosition != null && message.hasOwnProperty("lastCommitPosition")) + if (typeof message.lastCommitPosition === "number") + object.lastCommitPosition = options.longs === String ? String(message.lastCommitPosition) : message.lastCommitPosition; + else + object.lastCommitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.lastCommitPosition) : options.longs === Number ? new $util.LongBits(message.lastCommitPosition.low >>> 0, message.lastCommitPosition.high >>> 0).toNumber() : message.lastCommitPosition; + if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) + object.subscriptionId = message.subscriptionId; + if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) + if (typeof message.lastEventNumber === "number") + object.lastEventNumber = options.longs === String ? String(message.lastEventNumber) : message.lastEventNumber; + else + object.lastEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.lastEventNumber) : options.longs === Number ? new $util.LongBits(message.lastEventNumber.low >>> 0, message.lastEventNumber.high >>> 0).toNumber() : message.lastEventNumber; + return object; + }; - /** - * PersistentSubscriptionStreamEventAppeared event. - * @member {EventStore.Client.Messages.IResolvedIndexedEvent} event - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @instance - */ - PersistentSubscriptionStreamEventAppeared.prototype.event = null; + /** + * Converts this PersistentSubscriptionConfirmation to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @instance + * @returns {Object.} JSON object + */ + PersistentSubscriptionConfirmation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * PersistentSubscriptionStreamEventAppeared retryCount. - * @member {number} retryCount - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @instance - */ - PersistentSubscriptionStreamEventAppeared.prototype.retryCount = 0; + /** + * Gets the default type url for PersistentSubscriptionConfirmation + * @function getTypeUrl + * @memberof EventStore.Client.Messages.PersistentSubscriptionConfirmation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PersistentSubscriptionConfirmation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.PersistentSubscriptionConfirmation"; + }; - /** - * Creates a new PersistentSubscriptionStreamEventAppeared instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionStreamEventAppeared=} [properties] Properties to set - * @returns {EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared} PersistentSubscriptionStreamEventAppeared instance - */ - PersistentSubscriptionStreamEventAppeared.create = function create(properties) { - return new PersistentSubscriptionStreamEventAppeared(properties); - }; + return PersistentSubscriptionConfirmation; + })(); - /** - * Encodes the specified PersistentSubscriptionStreamEventAppeared message. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionStreamEventAppeared} message PersistentSubscriptionStreamEventAppeared message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PersistentSubscriptionStreamEventAppeared.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + Messages.PersistentSubscriptionStreamEventAppeared = (function() { + + /** + * Properties of a PersistentSubscriptionStreamEventAppeared. + * @memberof EventStore.Client.Messages + * @interface IPersistentSubscriptionStreamEventAppeared + * @property {EventStore.Client.Messages.IResolvedIndexedEvent|null} [event] PersistentSubscriptionStreamEventAppeared event + * @property {number|null} [retryCount] PersistentSubscriptionStreamEventAppeared retryCount + */ + + /** + * Constructs a new PersistentSubscriptionStreamEventAppeared. + * @memberof EventStore.Client.Messages + * @classdesc Represents a PersistentSubscriptionStreamEventAppeared. + * @implements IPersistentSubscriptionStreamEventAppeared + * @constructor + * @param {EventStore.Client.Messages.IPersistentSubscriptionStreamEventAppeared=} [properties] Properties to set + */ + function PersistentSubscriptionStreamEventAppeared(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PersistentSubscriptionStreamEventAppeared event. + * @member {EventStore.Client.Messages.IResolvedIndexedEvent|null|undefined} event + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @instance + */ + PersistentSubscriptionStreamEventAppeared.prototype.event = null; + + /** + * PersistentSubscriptionStreamEventAppeared retryCount. + * @member {number} retryCount + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @instance + */ + PersistentSubscriptionStreamEventAppeared.prototype.retryCount = 0; + + /** + * Creates a new PersistentSubscriptionStreamEventAppeared instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionStreamEventAppeared=} [properties] Properties to set + * @returns {EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared} PersistentSubscriptionStreamEventAppeared instance + */ + PersistentSubscriptionStreamEventAppeared.create = function create(properties) { + return new PersistentSubscriptionStreamEventAppeared(properties); + }; + + /** + * Encodes the specified PersistentSubscriptionStreamEventAppeared message. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionStreamEventAppeared} message PersistentSubscriptionStreamEventAppeared message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersistentSubscriptionStreamEventAppeared.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) $root.EventStore.Client.Messages.ResolvedIndexedEvent.encode(message.event, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.retryCount != null && Object.hasOwnProperty.call(message, "retryCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.retryCount); - return writer; - }; + if (message.retryCount != null && Object.hasOwnProperty.call(message, "retryCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.retryCount); + return writer; + }; - /** - * Encodes the specified PersistentSubscriptionStreamEventAppeared message, length delimited. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @static - * @param {EventStore.Client.Messages.IPersistentSubscriptionStreamEventAppeared} message PersistentSubscriptionStreamEventAppeared message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PersistentSubscriptionStreamEventAppeared.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified PersistentSubscriptionStreamEventAppeared message, length delimited. Does not implicitly {@link EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @static + * @param {EventStore.Client.Messages.IPersistentSubscriptionStreamEventAppeared} message PersistentSubscriptionStreamEventAppeared message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersistentSubscriptionStreamEventAppeared.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a PersistentSubscriptionStreamEventAppeared message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared} PersistentSubscriptionStreamEventAppeared - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PersistentSubscriptionStreamEventAppeared.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.decode(reader, reader.uint32()); - break; - } - case 2: { - message.retryCount = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a PersistentSubscriptionStreamEventAppeared message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared} PersistentSubscriptionStreamEventAppeared + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersistentSubscriptionStreamEventAppeared.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.decode(reader, reader.uint32()); break; } + case 2: { + message.retryCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("event")) - throw $util.ProtocolError("missing required 'event'", { instance: message }); - return message; - }; - - /** - * Decodes a PersistentSubscriptionStreamEventAppeared message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared} PersistentSubscriptionStreamEventAppeared - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PersistentSubscriptionStreamEventAppeared.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PersistentSubscriptionStreamEventAppeared message. - * @function verify - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PersistentSubscriptionStreamEventAppeared.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - { - var error = $root.EventStore.Client.Messages.ResolvedIndexedEvent.verify(message.event); - if (error) - return "event." + error; - } - if (message.retryCount != null && message.hasOwnProperty("retryCount")) - if (!$util.isInteger(message.retryCount)) - return "retryCount: integer expected"; - return null; - }; - - /** - * Creates a PersistentSubscriptionStreamEventAppeared message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared} PersistentSubscriptionStreamEventAppeared - */ - PersistentSubscriptionStreamEventAppeared.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared) - return object; - var message = new $root.EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared(); - if (object.event != null) { - if (typeof object.event !== "object") - throw TypeError(".EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared.event: object expected"); - message.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.fromObject(object.event); - } - if (object.retryCount != null) - message.retryCount = object.retryCount | 0; - return message; - }; - - /** - * Creates a plain object from a PersistentSubscriptionStreamEventAppeared message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @static - * @param {EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared} message PersistentSubscriptionStreamEventAppeared - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PersistentSubscriptionStreamEventAppeared.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.event = null; - object.retryCount = 0; - } - if (message.event != null && message.hasOwnProperty("event")) - object.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.toObject(message.event, options); - if (message.retryCount != null && message.hasOwnProperty("retryCount")) - object.retryCount = message.retryCount; - return object; - }; - - /** - * Converts this PersistentSubscriptionStreamEventAppeared to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @instance - * @returns {Object.} JSON object - */ - PersistentSubscriptionStreamEventAppeared.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PersistentSubscriptionStreamEventAppeared - * @function getTypeUrl - * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PersistentSubscriptionStreamEventAppeared.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared"; - }; - - return PersistentSubscriptionStreamEventAppeared; - })(); - - Messages.SubscribeToStream = (function() { - - /** - * Properties of a SubscribeToStream. - * @memberof EventStore.Client.Messages - * @interface ISubscribeToStream - * @property {string} eventStreamId SubscribeToStream eventStreamId - * @property {boolean} resolveLinkTos SubscribeToStream resolveLinkTos - */ - - /** - * Constructs a new SubscribeToStream. - * @memberof EventStore.Client.Messages - * @classdesc Represents a SubscribeToStream. - * @implements ISubscribeToStream - * @constructor - * @param {EventStore.Client.Messages.ISubscribeToStream=} [properties] Properties to set - */ - function SubscribeToStream(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; } + return message; + }; - /** - * SubscribeToStream eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.SubscribeToStream - * @instance - */ - SubscribeToStream.prototype.eventStreamId = ""; + /** + * Decodes a PersistentSubscriptionStreamEventAppeared message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared} PersistentSubscriptionStreamEventAppeared + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersistentSubscriptionStreamEventAppeared.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * SubscribeToStream resolveLinkTos. - * @member {boolean} resolveLinkTos - * @memberof EventStore.Client.Messages.SubscribeToStream - * @instance - */ - SubscribeToStream.prototype.resolveLinkTos = false; + /** + * Verifies a PersistentSubscriptionStreamEventAppeared message. + * @function verify + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PersistentSubscriptionStreamEventAppeared.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.event != null && message.hasOwnProperty("event")) { + var error = $root.EventStore.Client.Messages.ResolvedIndexedEvent.verify(message.event); + if (error) + return "event." + error; + } + if (message.retryCount != null && message.hasOwnProperty("retryCount")) + if (!$util.isInteger(message.retryCount)) + return "retryCount: integer expected"; + return null; + }; - /** - * Creates a new SubscribeToStream instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.SubscribeToStream - * @static - * @param {EventStore.Client.Messages.ISubscribeToStream=} [properties] Properties to set - * @returns {EventStore.Client.Messages.SubscribeToStream} SubscribeToStream instance - */ - SubscribeToStream.create = function create(properties) { - return new SubscribeToStream(properties); - }; + /** + * Creates a PersistentSubscriptionStreamEventAppeared message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared} PersistentSubscriptionStreamEventAppeared + */ + PersistentSubscriptionStreamEventAppeared.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared) + return object; + var message = new $root.EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared(); + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared.event: object expected"); + message.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.fromObject(object.event); + } + if (object.retryCount != null) + message.retryCount = object.retryCount | 0; + return message; + }; - /** - * Encodes the specified SubscribeToStream message. Does not implicitly {@link EventStore.Client.Messages.SubscribeToStream.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.SubscribeToStream - * @static - * @param {EventStore.Client.Messages.ISubscribeToStream} message SubscribeToStream message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SubscribeToStream.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Creates a plain object from a PersistentSubscriptionStreamEventAppeared message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @static + * @param {EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared} message PersistentSubscriptionStreamEventAppeared + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PersistentSubscriptionStreamEventAppeared.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.event = null; + object.retryCount = 0; + } + if (message.event != null && message.hasOwnProperty("event")) + object.event = $root.EventStore.Client.Messages.ResolvedIndexedEvent.toObject(message.event, options); + if (message.retryCount != null && message.hasOwnProperty("retryCount")) + object.retryCount = message.retryCount; + return object; + }; + + /** + * Converts this PersistentSubscriptionStreamEventAppeared to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @instance + * @returns {Object.} JSON object + */ + PersistentSubscriptionStreamEventAppeared.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PersistentSubscriptionStreamEventAppeared + * @function getTypeUrl + * @memberof EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PersistentSubscriptionStreamEventAppeared.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.PersistentSubscriptionStreamEventAppeared"; + }; + + return PersistentSubscriptionStreamEventAppeared; + })(); + + Messages.SubscribeToStream = (function() { + + /** + * Properties of a SubscribeToStream. + * @memberof EventStore.Client.Messages + * @interface ISubscribeToStream + * @property {string|null} [eventStreamId] SubscribeToStream eventStreamId + * @property {boolean|null} [resolveLinkTos] SubscribeToStream resolveLinkTos + */ + + /** + * Constructs a new SubscribeToStream. + * @memberof EventStore.Client.Messages + * @classdesc Represents a SubscribeToStream. + * @implements ISubscribeToStream + * @constructor + * @param {EventStore.Client.Messages.ISubscribeToStream=} [properties] Properties to set + */ + function SubscribeToStream(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SubscribeToStream eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.SubscribeToStream + * @instance + */ + SubscribeToStream.prototype.eventStreamId = ""; + + /** + * SubscribeToStream resolveLinkTos. + * @member {boolean} resolveLinkTos + * @memberof EventStore.Client.Messages.SubscribeToStream + * @instance + */ + SubscribeToStream.prototype.resolveLinkTos = false; + + /** + * Creates a new SubscribeToStream instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.SubscribeToStream + * @static + * @param {EventStore.Client.Messages.ISubscribeToStream=} [properties] Properties to set + * @returns {EventStore.Client.Messages.SubscribeToStream} SubscribeToStream instance + */ + SubscribeToStream.create = function create(properties) { + return new SubscribeToStream(properties); + }; + + /** + * Encodes the specified SubscribeToStream message. Does not implicitly {@link EventStore.Client.Messages.SubscribeToStream.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.SubscribeToStream + * @static + * @param {EventStore.Client.Messages.ISubscribeToStream} message SubscribeToStream message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubscribeToStream.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); + if (message.resolveLinkTos != null && Object.hasOwnProperty.call(message, "resolveLinkTos")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.resolveLinkTos); - return writer; - }; + return writer; + }; - /** - * Encodes the specified SubscribeToStream message, length delimited. Does not implicitly {@link EventStore.Client.Messages.SubscribeToStream.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.SubscribeToStream - * @static - * @param {EventStore.Client.Messages.ISubscribeToStream} message SubscribeToStream message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SubscribeToStream.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified SubscribeToStream message, length delimited. Does not implicitly {@link EventStore.Client.Messages.SubscribeToStream.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.SubscribeToStream + * @static + * @param {EventStore.Client.Messages.ISubscribeToStream} message SubscribeToStream message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubscribeToStream.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a SubscribeToStream message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.SubscribeToStream - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.SubscribeToStream} SubscribeToStream - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SubscribeToStream.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.SubscribeToStream(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.eventStreamId = reader.string(); - break; - } - case 2: { - message.resolveLinkTos = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a SubscribeToStream message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.SubscribeToStream + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.SubscribeToStream} SubscribeToStream + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubscribeToStream.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.SubscribeToStream(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.eventStreamId = reader.string(); break; } + case 2: { + message.resolveLinkTos = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("resolveLinkTos")) - throw $util.ProtocolError("missing required 'resolveLinkTos'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a SubscribeToStream message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.SubscribeToStream - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.SubscribeToStream} SubscribeToStream - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SubscribeToStream.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a SubscribeToStream message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.SubscribeToStream + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.SubscribeToStream} SubscribeToStream + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubscribeToStream.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a SubscribeToStream message. - * @function verify - * @memberof EventStore.Client.Messages.SubscribeToStream - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SubscribeToStream.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a SubscribeToStream message. + * @function verify + * @memberof EventStore.Client.Messages.SubscribeToStream + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SubscribeToStream.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) if (!$util.isString(message.eventStreamId)) return "eventStreamId: string expected"; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) if (typeof message.resolveLinkTos !== "boolean") return "resolveLinkTos: boolean expected"; - return null; - }; + return null; + }; - /** - * Creates a SubscribeToStream message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.SubscribeToStream - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.SubscribeToStream} SubscribeToStream - */ - SubscribeToStream.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.SubscribeToStream) - return object; - var message = new $root.EventStore.Client.Messages.SubscribeToStream(); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.resolveLinkTos != null) - message.resolveLinkTos = Boolean(object.resolveLinkTos); - return message; - }; - - /** - * Creates a plain object from a SubscribeToStream message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.SubscribeToStream - * @static - * @param {EventStore.Client.Messages.SubscribeToStream} message SubscribeToStream - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SubscribeToStream.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.eventStreamId = ""; - object.resolveLinkTos = false; - } - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) - object.resolveLinkTos = message.resolveLinkTos; + /** + * Creates a SubscribeToStream message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.SubscribeToStream + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.SubscribeToStream} SubscribeToStream + */ + SubscribeToStream.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.SubscribeToStream) return object; - }; + var message = new $root.EventStore.Client.Messages.SubscribeToStream(); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.resolveLinkTos != null) + message.resolveLinkTos = Boolean(object.resolveLinkTos); + return message; + }; - /** - * Converts this SubscribeToStream to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.SubscribeToStream - * @instance - * @returns {Object.} JSON object - */ - SubscribeToStream.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SubscribeToStream - * @function getTypeUrl - * @memberof EventStore.Client.Messages.SubscribeToStream - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SubscribeToStream.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.SubscribeToStream"; - }; - - return SubscribeToStream; - })(); - - Messages.FilteredSubscribeToStream = (function() { - - /** - * Properties of a FilteredSubscribeToStream. - * @memberof EventStore.Client.Messages - * @interface IFilteredSubscribeToStream - * @property {string} eventStreamId FilteredSubscribeToStream eventStreamId - * @property {boolean} resolveLinkTos FilteredSubscribeToStream resolveLinkTos - * @property {EventStore.Client.Messages.IFilter} filter FilteredSubscribeToStream filter - * @property {number} checkpointInterval FilteredSubscribeToStream checkpointInterval - */ - - /** - * Constructs a new FilteredSubscribeToStream. - * @memberof EventStore.Client.Messages - * @classdesc Represents a FilteredSubscribeToStream. - * @implements IFilteredSubscribeToStream - * @constructor - * @param {EventStore.Client.Messages.IFilteredSubscribeToStream=} [properties] Properties to set - */ - function FilteredSubscribeToStream(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a SubscribeToStream message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.SubscribeToStream + * @static + * @param {EventStore.Client.Messages.SubscribeToStream} message SubscribeToStream + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SubscribeToStream.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.eventStreamId = ""; + object.resolveLinkTos = false; } + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) + object.resolveLinkTos = message.resolveLinkTos; + return object; + }; - /** - * FilteredSubscribeToStream eventStreamId. - * @member {string} eventStreamId - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @instance - */ - FilteredSubscribeToStream.prototype.eventStreamId = ""; + /** + * Converts this SubscribeToStream to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.SubscribeToStream + * @instance + * @returns {Object.} JSON object + */ + SubscribeToStream.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * FilteredSubscribeToStream resolveLinkTos. - * @member {boolean} resolveLinkTos - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @instance - */ - FilteredSubscribeToStream.prototype.resolveLinkTos = false; + /** + * Gets the default type url for SubscribeToStream + * @function getTypeUrl + * @memberof EventStore.Client.Messages.SubscribeToStream + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SubscribeToStream.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.SubscribeToStream"; + }; - /** - * FilteredSubscribeToStream filter. - * @member {EventStore.Client.Messages.IFilter} filter - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @instance - */ - FilteredSubscribeToStream.prototype.filter = null; + return SubscribeToStream; + })(); - /** - * FilteredSubscribeToStream checkpointInterval. - * @member {number} checkpointInterval - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @instance - */ - FilteredSubscribeToStream.prototype.checkpointInterval = 0; + Messages.FilteredSubscribeToStream = (function() { - /** - * Creates a new FilteredSubscribeToStream instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @static - * @param {EventStore.Client.Messages.IFilteredSubscribeToStream=} [properties] Properties to set - * @returns {EventStore.Client.Messages.FilteredSubscribeToStream} FilteredSubscribeToStream instance - */ - FilteredSubscribeToStream.create = function create(properties) { - return new FilteredSubscribeToStream(properties); - }; + /** + * Properties of a FilteredSubscribeToStream. + * @memberof EventStore.Client.Messages + * @interface IFilteredSubscribeToStream + * @property {string|null} [eventStreamId] FilteredSubscribeToStream eventStreamId + * @property {boolean|null} [resolveLinkTos] FilteredSubscribeToStream resolveLinkTos + * @property {EventStore.Client.Messages.IFilter|null} [filter] FilteredSubscribeToStream filter + * @property {number|null} [checkpointInterval] FilteredSubscribeToStream checkpointInterval + */ - /** - * Encodes the specified FilteredSubscribeToStream message. Does not implicitly {@link EventStore.Client.Messages.FilteredSubscribeToStream.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @static - * @param {EventStore.Client.Messages.IFilteredSubscribeToStream} message FilteredSubscribeToStream message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FilteredSubscribeToStream.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Constructs a new FilteredSubscribeToStream. + * @memberof EventStore.Client.Messages + * @classdesc Represents a FilteredSubscribeToStream. + * @implements IFilteredSubscribeToStream + * @constructor + * @param {EventStore.Client.Messages.IFilteredSubscribeToStream=} [properties] Properties to set + */ + function FilteredSubscribeToStream(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FilteredSubscribeToStream eventStreamId. + * @member {string} eventStreamId + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @instance + */ + FilteredSubscribeToStream.prototype.eventStreamId = ""; + + /** + * FilteredSubscribeToStream resolveLinkTos. + * @member {boolean} resolveLinkTos + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @instance + */ + FilteredSubscribeToStream.prototype.resolveLinkTos = false; + + /** + * FilteredSubscribeToStream filter. + * @member {EventStore.Client.Messages.IFilter|null|undefined} filter + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @instance + */ + FilteredSubscribeToStream.prototype.filter = null; + + /** + * FilteredSubscribeToStream checkpointInterval. + * @member {number} checkpointInterval + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @instance + */ + FilteredSubscribeToStream.prototype.checkpointInterval = 0; + + /** + * Creates a new FilteredSubscribeToStream instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @static + * @param {EventStore.Client.Messages.IFilteredSubscribeToStream=} [properties] Properties to set + * @returns {EventStore.Client.Messages.FilteredSubscribeToStream} FilteredSubscribeToStream instance + */ + FilteredSubscribeToStream.create = function create(properties) { + return new FilteredSubscribeToStream(properties); + }; + + /** + * Encodes the specified FilteredSubscribeToStream message. Does not implicitly {@link EventStore.Client.Messages.FilteredSubscribeToStream.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @static + * @param {EventStore.Client.Messages.IFilteredSubscribeToStream} message FilteredSubscribeToStream message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilteredSubscribeToStream.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventStreamId != null && Object.hasOwnProperty.call(message, "eventStreamId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventStreamId); + if (message.resolveLinkTos != null && Object.hasOwnProperty.call(message, "resolveLinkTos")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.resolveLinkTos); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) $root.EventStore.Client.Messages.Filter.encode(message.filter, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.checkpointInterval != null && Object.hasOwnProperty.call(message, "checkpointInterval")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.checkpointInterval); - return writer; - }; + return writer; + }; - /** - * Encodes the specified FilteredSubscribeToStream message, length delimited. Does not implicitly {@link EventStore.Client.Messages.FilteredSubscribeToStream.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @static - * @param {EventStore.Client.Messages.IFilteredSubscribeToStream} message FilteredSubscribeToStream message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FilteredSubscribeToStream.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified FilteredSubscribeToStream message, length delimited. Does not implicitly {@link EventStore.Client.Messages.FilteredSubscribeToStream.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @static + * @param {EventStore.Client.Messages.IFilteredSubscribeToStream} message FilteredSubscribeToStream message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilteredSubscribeToStream.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a FilteredSubscribeToStream message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.FilteredSubscribeToStream} FilteredSubscribeToStream - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FilteredSubscribeToStream.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.FilteredSubscribeToStream(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.eventStreamId = reader.string(); - break; - } - case 2: { - message.resolveLinkTos = reader.bool(); - break; - } - case 3: { - message.filter = $root.EventStore.Client.Messages.Filter.decode(reader, reader.uint32()); - break; - } - case 4: { - message.checkpointInterval = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a FilteredSubscribeToStream message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.FilteredSubscribeToStream} FilteredSubscribeToStream + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilteredSubscribeToStream.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.FilteredSubscribeToStream(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.eventStreamId = reader.string(); break; } + case 2: { + message.resolveLinkTos = reader.bool(); + break; + } + case 3: { + message.filter = $root.EventStore.Client.Messages.Filter.decode(reader, reader.uint32()); + break; + } + case 4: { + message.checkpointInterval = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("eventStreamId")) - throw $util.ProtocolError("missing required 'eventStreamId'", { instance: message }); - if (!message.hasOwnProperty("resolveLinkTos")) - throw $util.ProtocolError("missing required 'resolveLinkTos'", { instance: message }); - if (!message.hasOwnProperty("filter")) - throw $util.ProtocolError("missing required 'filter'", { instance: message }); - if (!message.hasOwnProperty("checkpointInterval")) - throw $util.ProtocolError("missing required 'checkpointInterval'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a FilteredSubscribeToStream message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.FilteredSubscribeToStream} FilteredSubscribeToStream - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FilteredSubscribeToStream.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a FilteredSubscribeToStream message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.FilteredSubscribeToStream} FilteredSubscribeToStream + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilteredSubscribeToStream.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a FilteredSubscribeToStream message. - * @function verify - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FilteredSubscribeToStream.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a FilteredSubscribeToStream message. + * @function verify + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FilteredSubscribeToStream.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) if (!$util.isString(message.eventStreamId)) return "eventStreamId: string expected"; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) if (typeof message.resolveLinkTos !== "boolean") return "resolveLinkTos: boolean expected"; - { - var error = $root.EventStore.Client.Messages.Filter.verify(message.filter); - if (error) - return "filter." + error; - } + if (message.filter != null && message.hasOwnProperty("filter")) { + var error = $root.EventStore.Client.Messages.Filter.verify(message.filter); + if (error) + return "filter." + error; + } + if (message.checkpointInterval != null && message.hasOwnProperty("checkpointInterval")) if (!$util.isInteger(message.checkpointInterval)) return "checkpointInterval: integer expected"; - return null; - }; + return null; + }; - /** - * Creates a FilteredSubscribeToStream message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.FilteredSubscribeToStream} FilteredSubscribeToStream - */ - FilteredSubscribeToStream.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.FilteredSubscribeToStream) - return object; - var message = new $root.EventStore.Client.Messages.FilteredSubscribeToStream(); - if (object.eventStreamId != null) - message.eventStreamId = String(object.eventStreamId); - if (object.resolveLinkTos != null) - message.resolveLinkTos = Boolean(object.resolveLinkTos); - if (object.filter != null) { - if (typeof object.filter !== "object") - throw TypeError(".EventStore.Client.Messages.FilteredSubscribeToStream.filter: object expected"); - message.filter = $root.EventStore.Client.Messages.Filter.fromObject(object.filter); - } - if (object.checkpointInterval != null) - message.checkpointInterval = object.checkpointInterval | 0; - return message; - }; - - /** - * Creates a plain object from a FilteredSubscribeToStream message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @static - * @param {EventStore.Client.Messages.FilteredSubscribeToStream} message FilteredSubscribeToStream - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FilteredSubscribeToStream.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.eventStreamId = ""; - object.resolveLinkTos = false; - object.filter = null; - object.checkpointInterval = 0; - } - if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) - object.eventStreamId = message.eventStreamId; - if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) - object.resolveLinkTos = message.resolveLinkTos; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = $root.EventStore.Client.Messages.Filter.toObject(message.filter, options); - if (message.checkpointInterval != null && message.hasOwnProperty("checkpointInterval")) - object.checkpointInterval = message.checkpointInterval; + /** + * Creates a FilteredSubscribeToStream message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.FilteredSubscribeToStream} FilteredSubscribeToStream + */ + FilteredSubscribeToStream.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.FilteredSubscribeToStream) return object; - }; - - /** - * Converts this FilteredSubscribeToStream to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @instance - * @returns {Object.} JSON object - */ - FilteredSubscribeToStream.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FilteredSubscribeToStream - * @function getTypeUrl - * @memberof EventStore.Client.Messages.FilteredSubscribeToStream - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FilteredSubscribeToStream.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.FilteredSubscribeToStream"; - }; - - return FilteredSubscribeToStream; - })(); - - Messages.CheckpointReached = (function() { - - /** - * Properties of a CheckpointReached. - * @memberof EventStore.Client.Messages - * @interface ICheckpointReached - * @property {Long} commitPosition CheckpointReached commitPosition - * @property {Long} preparePosition CheckpointReached preparePosition - */ - - /** - * Constructs a new CheckpointReached. - * @memberof EventStore.Client.Messages - * @classdesc Represents a CheckpointReached. - * @implements ICheckpointReached - * @constructor - * @param {EventStore.Client.Messages.ICheckpointReached=} [properties] Properties to set - */ - function CheckpointReached(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + var message = new $root.EventStore.Client.Messages.FilteredSubscribeToStream(); + if (object.eventStreamId != null) + message.eventStreamId = String(object.eventStreamId); + if (object.resolveLinkTos != null) + message.resolveLinkTos = Boolean(object.resolveLinkTos); + if (object.filter != null) { + if (typeof object.filter !== "object") + throw TypeError(".EventStore.Client.Messages.FilteredSubscribeToStream.filter: object expected"); + message.filter = $root.EventStore.Client.Messages.Filter.fromObject(object.filter); } + if (object.checkpointInterval != null) + message.checkpointInterval = object.checkpointInterval | 0; + return message; + }; - /** - * CheckpointReached commitPosition. - * @member {Long} commitPosition - * @memberof EventStore.Client.Messages.CheckpointReached - * @instance - */ - CheckpointReached.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Creates a plain object from a FilteredSubscribeToStream message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @static + * @param {EventStore.Client.Messages.FilteredSubscribeToStream} message FilteredSubscribeToStream + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FilteredSubscribeToStream.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.eventStreamId = ""; + object.resolveLinkTos = false; + object.filter = null; + object.checkpointInterval = 0; + } + if (message.eventStreamId != null && message.hasOwnProperty("eventStreamId")) + object.eventStreamId = message.eventStreamId; + if (message.resolveLinkTos != null && message.hasOwnProperty("resolveLinkTos")) + object.resolveLinkTos = message.resolveLinkTos; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = $root.EventStore.Client.Messages.Filter.toObject(message.filter, options); + if (message.checkpointInterval != null && message.hasOwnProperty("checkpointInterval")) + object.checkpointInterval = message.checkpointInterval; + return object; + }; - /** - * CheckpointReached preparePosition. - * @member {Long} preparePosition - * @memberof EventStore.Client.Messages.CheckpointReached - * @instance - */ - CheckpointReached.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Converts this FilteredSubscribeToStream to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @instance + * @returns {Object.} JSON object + */ + FilteredSubscribeToStream.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a new CheckpointReached instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.CheckpointReached - * @static - * @param {EventStore.Client.Messages.ICheckpointReached=} [properties] Properties to set - * @returns {EventStore.Client.Messages.CheckpointReached} CheckpointReached instance - */ - CheckpointReached.create = function create(properties) { - return new CheckpointReached(properties); - }; + /** + * Gets the default type url for FilteredSubscribeToStream + * @function getTypeUrl + * @memberof EventStore.Client.Messages.FilteredSubscribeToStream + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FilteredSubscribeToStream.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.FilteredSubscribeToStream"; + }; - /** - * Encodes the specified CheckpointReached message. Does not implicitly {@link EventStore.Client.Messages.CheckpointReached.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.CheckpointReached - * @static - * @param {EventStore.Client.Messages.ICheckpointReached} message CheckpointReached message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CheckpointReached.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + return FilteredSubscribeToStream; + })(); + + Messages.CheckpointReached = (function() { + + /** + * Properties of a CheckpointReached. + * @memberof EventStore.Client.Messages + * @interface ICheckpointReached + * @property {Long|null} [commitPosition] CheckpointReached commitPosition + * @property {Long|null} [preparePosition] CheckpointReached preparePosition + */ + + /** + * Constructs a new CheckpointReached. + * @memberof EventStore.Client.Messages + * @classdesc Represents a CheckpointReached. + * @implements ICheckpointReached + * @constructor + * @param {EventStore.Client.Messages.ICheckpointReached=} [properties] Properties to set + */ + function CheckpointReached(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CheckpointReached commitPosition. + * @member {Long} commitPosition + * @memberof EventStore.Client.Messages.CheckpointReached + * @instance + */ + CheckpointReached.prototype.commitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * CheckpointReached preparePosition. + * @member {Long} preparePosition + * @memberof EventStore.Client.Messages.CheckpointReached + * @instance + */ + CheckpointReached.prototype.preparePosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new CheckpointReached instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.CheckpointReached + * @static + * @param {EventStore.Client.Messages.ICheckpointReached=} [properties] Properties to set + * @returns {EventStore.Client.Messages.CheckpointReached} CheckpointReached instance + */ + CheckpointReached.create = function create(properties) { + return new CheckpointReached(properties); + }; + + /** + * Encodes the specified CheckpointReached message. Does not implicitly {@link EventStore.Client.Messages.CheckpointReached.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.CheckpointReached + * @static + * @param {EventStore.Client.Messages.ICheckpointReached} message CheckpointReached message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CheckpointReached.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commitPosition != null && Object.hasOwnProperty.call(message, "commitPosition")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.commitPosition); + if (message.preparePosition != null && Object.hasOwnProperty.call(message, "preparePosition")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.preparePosition); - return writer; - }; + return writer; + }; - /** - * Encodes the specified CheckpointReached message, length delimited. Does not implicitly {@link EventStore.Client.Messages.CheckpointReached.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.CheckpointReached - * @static - * @param {EventStore.Client.Messages.ICheckpointReached} message CheckpointReached message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CheckpointReached.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified CheckpointReached message, length delimited. Does not implicitly {@link EventStore.Client.Messages.CheckpointReached.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.CheckpointReached + * @static + * @param {EventStore.Client.Messages.ICheckpointReached} message CheckpointReached message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CheckpointReached.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a CheckpointReached message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.CheckpointReached - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.CheckpointReached} CheckpointReached - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CheckpointReached.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.CheckpointReached(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.commitPosition = reader.int64(); - break; - } - case 2: { - message.preparePosition = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a CheckpointReached message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.CheckpointReached + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.CheckpointReached} CheckpointReached + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CheckpointReached.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.CheckpointReached(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.commitPosition = reader.int64(); break; } + case 2: { + message.preparePosition = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("commitPosition")) - throw $util.ProtocolError("missing required 'commitPosition'", { instance: message }); - if (!message.hasOwnProperty("preparePosition")) - throw $util.ProtocolError("missing required 'preparePosition'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a CheckpointReached message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.CheckpointReached - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.CheckpointReached} CheckpointReached - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CheckpointReached.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a CheckpointReached message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.CheckpointReached + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.CheckpointReached} CheckpointReached + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CheckpointReached.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a CheckpointReached message. - * @function verify - * @memberof EventStore.Client.Messages.CheckpointReached - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CheckpointReached.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a CheckpointReached message. + * @function verify + * @memberof EventStore.Client.Messages.CheckpointReached + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CheckpointReached.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) if (!$util.isInteger(message.commitPosition) && !(message.commitPosition && $util.isInteger(message.commitPosition.low) && $util.isInteger(message.commitPosition.high))) return "commitPosition: integer|Long expected"; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) if (!$util.isInteger(message.preparePosition) && !(message.preparePosition && $util.isInteger(message.preparePosition.low) && $util.isInteger(message.preparePosition.high))) return "preparePosition: integer|Long expected"; - return null; - }; + return null; + }; - /** - * Creates a CheckpointReached message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.CheckpointReached - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.CheckpointReached} CheckpointReached - */ - CheckpointReached.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.CheckpointReached) - return object; - var message = new $root.EventStore.Client.Messages.CheckpointReached(); - if (object.commitPosition != null) - if ($util.Long) - (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; - else if (typeof object.commitPosition === "string") - message.commitPosition = parseInt(object.commitPosition, 10); - else if (typeof object.commitPosition === "number") - message.commitPosition = object.commitPosition; - else if (typeof object.commitPosition === "object") - message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); - if (object.preparePosition != null) - if ($util.Long) - (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; - else if (typeof object.preparePosition === "string") - message.preparePosition = parseInt(object.preparePosition, 10); - else if (typeof object.preparePosition === "number") - message.preparePosition = object.preparePosition; - else if (typeof object.preparePosition === "object") - message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a CheckpointReached message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.CheckpointReached - * @static - * @param {EventStore.Client.Messages.CheckpointReached} message CheckpointReached - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CheckpointReached.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.commitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.preparePosition = options.longs === String ? "0" : 0; - } - if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) - if (typeof message.commitPosition === "number") - object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; - else - object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; - if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) - if (typeof message.preparePosition === "number") - object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; - else - object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; + /** + * Creates a CheckpointReached message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.CheckpointReached + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.CheckpointReached} CheckpointReached + */ + CheckpointReached.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.CheckpointReached) return object; - }; + var message = new $root.EventStore.Client.Messages.CheckpointReached(); + if (object.commitPosition != null) + if ($util.Long) + (message.commitPosition = $util.Long.fromValue(object.commitPosition)).unsigned = false; + else if (typeof object.commitPosition === "string") + message.commitPosition = parseInt(object.commitPosition, 10); + else if (typeof object.commitPosition === "number") + message.commitPosition = object.commitPosition; + else if (typeof object.commitPosition === "object") + message.commitPosition = new $util.LongBits(object.commitPosition.low >>> 0, object.commitPosition.high >>> 0).toNumber(); + if (object.preparePosition != null) + if ($util.Long) + (message.preparePosition = $util.Long.fromValue(object.preparePosition)).unsigned = false; + else if (typeof object.preparePosition === "string") + message.preparePosition = parseInt(object.preparePosition, 10); + else if (typeof object.preparePosition === "number") + message.preparePosition = object.preparePosition; + else if (typeof object.preparePosition === "object") + message.preparePosition = new $util.LongBits(object.preparePosition.low >>> 0, object.preparePosition.high >>> 0).toNumber(); + return message; + }; - /** - * Converts this CheckpointReached to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.CheckpointReached - * @instance - * @returns {Object.} JSON object - */ - CheckpointReached.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CheckpointReached - * @function getTypeUrl - * @memberof EventStore.Client.Messages.CheckpointReached - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CheckpointReached.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.CheckpointReached"; - }; - - return CheckpointReached; - })(); - - Messages.SubscriptionConfirmation = (function() { - - /** - * Properties of a SubscriptionConfirmation. - * @memberof EventStore.Client.Messages - * @interface ISubscriptionConfirmation - * @property {Long} lastCommitPosition SubscriptionConfirmation lastCommitPosition - * @property {Long|null} [lastEventNumber] SubscriptionConfirmation lastEventNumber - */ - - /** - * Constructs a new SubscriptionConfirmation. - * @memberof EventStore.Client.Messages - * @classdesc Represents a SubscriptionConfirmation. - * @implements ISubscriptionConfirmation - * @constructor - * @param {EventStore.Client.Messages.ISubscriptionConfirmation=} [properties] Properties to set - */ - function SubscriptionConfirmation(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a CheckpointReached message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.CheckpointReached + * @static + * @param {EventStore.Client.Messages.CheckpointReached} message CheckpointReached + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CheckpointReached.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.commitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.commitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.preparePosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.preparePosition = options.longs === String ? "0" : 0; } + if (message.commitPosition != null && message.hasOwnProperty("commitPosition")) + if (typeof message.commitPosition === "number") + object.commitPosition = options.longs === String ? String(message.commitPosition) : message.commitPosition; + else + object.commitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.commitPosition) : options.longs === Number ? new $util.LongBits(message.commitPosition.low >>> 0, message.commitPosition.high >>> 0).toNumber() : message.commitPosition; + if (message.preparePosition != null && message.hasOwnProperty("preparePosition")) + if (typeof message.preparePosition === "number") + object.preparePosition = options.longs === String ? String(message.preparePosition) : message.preparePosition; + else + object.preparePosition = options.longs === String ? $util.Long.prototype.toString.call(message.preparePosition) : options.longs === Number ? new $util.LongBits(message.preparePosition.low >>> 0, message.preparePosition.high >>> 0).toNumber() : message.preparePosition; + return object; + }; - /** - * SubscriptionConfirmation lastCommitPosition. - * @member {Long} lastCommitPosition - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @instance - */ - SubscriptionConfirmation.prototype.lastCommitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Converts this CheckpointReached to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.CheckpointReached + * @instance + * @returns {Object.} JSON object + */ + CheckpointReached.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * SubscriptionConfirmation lastEventNumber. - * @member {Long} lastEventNumber - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @instance - */ - SubscriptionConfirmation.prototype.lastEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Gets the default type url for CheckpointReached + * @function getTypeUrl + * @memberof EventStore.Client.Messages.CheckpointReached + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CheckpointReached.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.CheckpointReached"; + }; - /** - * Creates a new SubscriptionConfirmation instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @static - * @param {EventStore.Client.Messages.ISubscriptionConfirmation=} [properties] Properties to set - * @returns {EventStore.Client.Messages.SubscriptionConfirmation} SubscriptionConfirmation instance - */ - SubscriptionConfirmation.create = function create(properties) { - return new SubscriptionConfirmation(properties); - }; + return CheckpointReached; + })(); - /** - * Encodes the specified SubscriptionConfirmation message. Does not implicitly {@link EventStore.Client.Messages.SubscriptionConfirmation.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @static - * @param {EventStore.Client.Messages.ISubscriptionConfirmation} message SubscriptionConfirmation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SubscriptionConfirmation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + Messages.SubscriptionConfirmation = (function() { + + /** + * Properties of a SubscriptionConfirmation. + * @memberof EventStore.Client.Messages + * @interface ISubscriptionConfirmation + * @property {Long|null} [lastCommitPosition] SubscriptionConfirmation lastCommitPosition + * @property {Long|null} [lastEventNumber] SubscriptionConfirmation lastEventNumber + */ + + /** + * Constructs a new SubscriptionConfirmation. + * @memberof EventStore.Client.Messages + * @classdesc Represents a SubscriptionConfirmation. + * @implements ISubscriptionConfirmation + * @constructor + * @param {EventStore.Client.Messages.ISubscriptionConfirmation=} [properties] Properties to set + */ + function SubscriptionConfirmation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SubscriptionConfirmation lastCommitPosition. + * @member {Long} lastCommitPosition + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @instance + */ + SubscriptionConfirmation.prototype.lastCommitPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SubscriptionConfirmation lastEventNumber. + * @member {Long} lastEventNumber + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @instance + */ + SubscriptionConfirmation.prototype.lastEventNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new SubscriptionConfirmation instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @static + * @param {EventStore.Client.Messages.ISubscriptionConfirmation=} [properties] Properties to set + * @returns {EventStore.Client.Messages.SubscriptionConfirmation} SubscriptionConfirmation instance + */ + SubscriptionConfirmation.create = function create(properties) { + return new SubscriptionConfirmation(properties); + }; + + /** + * Encodes the specified SubscriptionConfirmation message. Does not implicitly {@link EventStore.Client.Messages.SubscriptionConfirmation.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @static + * @param {EventStore.Client.Messages.ISubscriptionConfirmation} message SubscriptionConfirmation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubscriptionConfirmation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.lastCommitPosition != null && Object.hasOwnProperty.call(message, "lastCommitPosition")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.lastCommitPosition); - if (message.lastEventNumber != null && Object.hasOwnProperty.call(message, "lastEventNumber")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.lastEventNumber); - return writer; - }; + if (message.lastEventNumber != null && Object.hasOwnProperty.call(message, "lastEventNumber")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.lastEventNumber); + return writer; + }; - /** - * Encodes the specified SubscriptionConfirmation message, length delimited. Does not implicitly {@link EventStore.Client.Messages.SubscriptionConfirmation.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @static - * @param {EventStore.Client.Messages.ISubscriptionConfirmation} message SubscriptionConfirmation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SubscriptionConfirmation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified SubscriptionConfirmation message, length delimited. Does not implicitly {@link EventStore.Client.Messages.SubscriptionConfirmation.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @static + * @param {EventStore.Client.Messages.ISubscriptionConfirmation} message SubscriptionConfirmation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubscriptionConfirmation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a SubscriptionConfirmation message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.SubscriptionConfirmation} SubscriptionConfirmation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SubscriptionConfirmation.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.SubscriptionConfirmation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.lastCommitPosition = reader.int64(); - break; - } - case 2: { - message.lastEventNumber = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a SubscriptionConfirmation message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.SubscriptionConfirmation} SubscriptionConfirmation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubscriptionConfirmation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.SubscriptionConfirmation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.lastCommitPosition = reader.int64(); break; } + case 2: { + message.lastEventNumber = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("lastCommitPosition")) - throw $util.ProtocolError("missing required 'lastCommitPosition'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a SubscriptionConfirmation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.SubscriptionConfirmation} SubscriptionConfirmation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SubscriptionConfirmation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a SubscriptionConfirmation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.SubscriptionConfirmation} SubscriptionConfirmation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubscriptionConfirmation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a SubscriptionConfirmation message. - * @function verify - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SubscriptionConfirmation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a SubscriptionConfirmation message. + * @function verify + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SubscriptionConfirmation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.lastCommitPosition != null && message.hasOwnProperty("lastCommitPosition")) if (!$util.isInteger(message.lastCommitPosition) && !(message.lastCommitPosition && $util.isInteger(message.lastCommitPosition.low) && $util.isInteger(message.lastCommitPosition.high))) return "lastCommitPosition: integer|Long expected"; - if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) - if (!$util.isInteger(message.lastEventNumber) && !(message.lastEventNumber && $util.isInteger(message.lastEventNumber.low) && $util.isInteger(message.lastEventNumber.high))) - return "lastEventNumber: integer|Long expected"; - return null; - }; + if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) + if (!$util.isInteger(message.lastEventNumber) && !(message.lastEventNumber && $util.isInteger(message.lastEventNumber.low) && $util.isInteger(message.lastEventNumber.high))) + return "lastEventNumber: integer|Long expected"; + return null; + }; - /** - * Creates a SubscriptionConfirmation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.SubscriptionConfirmation} SubscriptionConfirmation - */ - SubscriptionConfirmation.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.SubscriptionConfirmation) - return object; - var message = new $root.EventStore.Client.Messages.SubscriptionConfirmation(); - if (object.lastCommitPosition != null) - if ($util.Long) - (message.lastCommitPosition = $util.Long.fromValue(object.lastCommitPosition)).unsigned = false; - else if (typeof object.lastCommitPosition === "string") - message.lastCommitPosition = parseInt(object.lastCommitPosition, 10); - else if (typeof object.lastCommitPosition === "number") - message.lastCommitPosition = object.lastCommitPosition; - else if (typeof object.lastCommitPosition === "object") - message.lastCommitPosition = new $util.LongBits(object.lastCommitPosition.low >>> 0, object.lastCommitPosition.high >>> 0).toNumber(); - if (object.lastEventNumber != null) - if ($util.Long) - (message.lastEventNumber = $util.Long.fromValue(object.lastEventNumber)).unsigned = false; - else if (typeof object.lastEventNumber === "string") - message.lastEventNumber = parseInt(object.lastEventNumber, 10); - else if (typeof object.lastEventNumber === "number") - message.lastEventNumber = object.lastEventNumber; - else if (typeof object.lastEventNumber === "object") - message.lastEventNumber = new $util.LongBits(object.lastEventNumber.low >>> 0, object.lastEventNumber.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a SubscriptionConfirmation message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @static - * @param {EventStore.Client.Messages.SubscriptionConfirmation} message SubscriptionConfirmation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SubscriptionConfirmation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.lastCommitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.lastCommitPosition = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.lastEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.lastEventNumber = options.longs === String ? "0" : 0; - } - if (message.lastCommitPosition != null && message.hasOwnProperty("lastCommitPosition")) - if (typeof message.lastCommitPosition === "number") - object.lastCommitPosition = options.longs === String ? String(message.lastCommitPosition) : message.lastCommitPosition; - else - object.lastCommitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.lastCommitPosition) : options.longs === Number ? new $util.LongBits(message.lastCommitPosition.low >>> 0, message.lastCommitPosition.high >>> 0).toNumber() : message.lastCommitPosition; - if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) - if (typeof message.lastEventNumber === "number") - object.lastEventNumber = options.longs === String ? String(message.lastEventNumber) : message.lastEventNumber; - else - object.lastEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.lastEventNumber) : options.longs === Number ? new $util.LongBits(message.lastEventNumber.low >>> 0, message.lastEventNumber.high >>> 0).toNumber() : message.lastEventNumber; + /** + * Creates a SubscriptionConfirmation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.SubscriptionConfirmation} SubscriptionConfirmation + */ + SubscriptionConfirmation.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.SubscriptionConfirmation) return object; - }; + var message = new $root.EventStore.Client.Messages.SubscriptionConfirmation(); + if (object.lastCommitPosition != null) + if ($util.Long) + (message.lastCommitPosition = $util.Long.fromValue(object.lastCommitPosition)).unsigned = false; + else if (typeof object.lastCommitPosition === "string") + message.lastCommitPosition = parseInt(object.lastCommitPosition, 10); + else if (typeof object.lastCommitPosition === "number") + message.lastCommitPosition = object.lastCommitPosition; + else if (typeof object.lastCommitPosition === "object") + message.lastCommitPosition = new $util.LongBits(object.lastCommitPosition.low >>> 0, object.lastCommitPosition.high >>> 0).toNumber(); + if (object.lastEventNumber != null) + if ($util.Long) + (message.lastEventNumber = $util.Long.fromValue(object.lastEventNumber)).unsigned = false; + else if (typeof object.lastEventNumber === "string") + message.lastEventNumber = parseInt(object.lastEventNumber, 10); + else if (typeof object.lastEventNumber === "number") + message.lastEventNumber = object.lastEventNumber; + else if (typeof object.lastEventNumber === "object") + message.lastEventNumber = new $util.LongBits(object.lastEventNumber.low >>> 0, object.lastEventNumber.high >>> 0).toNumber(); + return message; + }; - /** - * Converts this SubscriptionConfirmation to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @instance - * @returns {Object.} JSON object - */ - SubscriptionConfirmation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SubscriptionConfirmation - * @function getTypeUrl - * @memberof EventStore.Client.Messages.SubscriptionConfirmation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SubscriptionConfirmation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.SubscriptionConfirmation"; - }; - - return SubscriptionConfirmation; - })(); - - Messages.StreamEventAppeared = (function() { - - /** - * Properties of a StreamEventAppeared. - * @memberof EventStore.Client.Messages - * @interface IStreamEventAppeared - * @property {EventStore.Client.Messages.IResolvedEvent} event StreamEventAppeared event - */ - - /** - * Constructs a new StreamEventAppeared. - * @memberof EventStore.Client.Messages - * @classdesc Represents a StreamEventAppeared. - * @implements IStreamEventAppeared - * @constructor - * @param {EventStore.Client.Messages.IStreamEventAppeared=} [properties] Properties to set - */ - function StreamEventAppeared(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a SubscriptionConfirmation message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @static + * @param {EventStore.Client.Messages.SubscriptionConfirmation} message SubscriptionConfirmation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SubscriptionConfirmation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastCommitPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastCommitPosition = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastEventNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastEventNumber = options.longs === String ? "0" : 0; } + if (message.lastCommitPosition != null && message.hasOwnProperty("lastCommitPosition")) + if (typeof message.lastCommitPosition === "number") + object.lastCommitPosition = options.longs === String ? String(message.lastCommitPosition) : message.lastCommitPosition; + else + object.lastCommitPosition = options.longs === String ? $util.Long.prototype.toString.call(message.lastCommitPosition) : options.longs === Number ? new $util.LongBits(message.lastCommitPosition.low >>> 0, message.lastCommitPosition.high >>> 0).toNumber() : message.lastCommitPosition; + if (message.lastEventNumber != null && message.hasOwnProperty("lastEventNumber")) + if (typeof message.lastEventNumber === "number") + object.lastEventNumber = options.longs === String ? String(message.lastEventNumber) : message.lastEventNumber; + else + object.lastEventNumber = options.longs === String ? $util.Long.prototype.toString.call(message.lastEventNumber) : options.longs === Number ? new $util.LongBits(message.lastEventNumber.low >>> 0, message.lastEventNumber.high >>> 0).toNumber() : message.lastEventNumber; + return object; + }; - /** - * StreamEventAppeared event. - * @member {EventStore.Client.Messages.IResolvedEvent} event - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @instance - */ - StreamEventAppeared.prototype.event = null; + /** + * Converts this SubscriptionConfirmation to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @instance + * @returns {Object.} JSON object + */ + SubscriptionConfirmation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a new StreamEventAppeared instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @static - * @param {EventStore.Client.Messages.IStreamEventAppeared=} [properties] Properties to set - * @returns {EventStore.Client.Messages.StreamEventAppeared} StreamEventAppeared instance - */ - StreamEventAppeared.create = function create(properties) { - return new StreamEventAppeared(properties); - }; + /** + * Gets the default type url for SubscriptionConfirmation + * @function getTypeUrl + * @memberof EventStore.Client.Messages.SubscriptionConfirmation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SubscriptionConfirmation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.SubscriptionConfirmation"; + }; - /** - * Encodes the specified StreamEventAppeared message. Does not implicitly {@link EventStore.Client.Messages.StreamEventAppeared.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @static - * @param {EventStore.Client.Messages.IStreamEventAppeared} message StreamEventAppeared message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - StreamEventAppeared.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + return SubscriptionConfirmation; + })(); + + Messages.StreamEventAppeared = (function() { + + /** + * Properties of a StreamEventAppeared. + * @memberof EventStore.Client.Messages + * @interface IStreamEventAppeared + * @property {EventStore.Client.Messages.IResolvedEvent|null} [event] StreamEventAppeared event + */ + + /** + * Constructs a new StreamEventAppeared. + * @memberof EventStore.Client.Messages + * @classdesc Represents a StreamEventAppeared. + * @implements IStreamEventAppeared + * @constructor + * @param {EventStore.Client.Messages.IStreamEventAppeared=} [properties] Properties to set + */ + function StreamEventAppeared(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamEventAppeared event. + * @member {EventStore.Client.Messages.IResolvedEvent|null|undefined} event + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @instance + */ + StreamEventAppeared.prototype.event = null; + + /** + * Creates a new StreamEventAppeared instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @static + * @param {EventStore.Client.Messages.IStreamEventAppeared=} [properties] Properties to set + * @returns {EventStore.Client.Messages.StreamEventAppeared} StreamEventAppeared instance + */ + StreamEventAppeared.create = function create(properties) { + return new StreamEventAppeared(properties); + }; + + /** + * Encodes the specified StreamEventAppeared message. Does not implicitly {@link EventStore.Client.Messages.StreamEventAppeared.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @static + * @param {EventStore.Client.Messages.IStreamEventAppeared} message StreamEventAppeared message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamEventAppeared.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) $root.EventStore.Client.Messages.ResolvedEvent.encode(message.event, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + return writer; + }; - /** - * Encodes the specified StreamEventAppeared message, length delimited. Does not implicitly {@link EventStore.Client.Messages.StreamEventAppeared.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @static - * @param {EventStore.Client.Messages.IStreamEventAppeared} message StreamEventAppeared message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - StreamEventAppeared.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified StreamEventAppeared message, length delimited. Does not implicitly {@link EventStore.Client.Messages.StreamEventAppeared.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @static + * @param {EventStore.Client.Messages.IStreamEventAppeared} message StreamEventAppeared message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamEventAppeared.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a StreamEventAppeared message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.StreamEventAppeared} StreamEventAppeared - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - StreamEventAppeared.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.StreamEventAppeared(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.event = $root.EventStore.Client.Messages.ResolvedEvent.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a StreamEventAppeared message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.StreamEventAppeared} StreamEventAppeared + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamEventAppeared.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.StreamEventAppeared(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.event = $root.EventStore.Client.Messages.ResolvedEvent.decode(reader, reader.uint32()); break; } - } - if (!message.hasOwnProperty("event")) - throw $util.ProtocolError("missing required 'event'", { instance: message }); - return message; - }; - - /** - * Decodes a StreamEventAppeared message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.StreamEventAppeared} StreamEventAppeared - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - StreamEventAppeared.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a StreamEventAppeared message. - * @function verify - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - StreamEventAppeared.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - { - var error = $root.EventStore.Client.Messages.ResolvedEvent.verify(message.event); - if (error) - return "event." + error; - } - return null; - }; - - /** - * Creates a StreamEventAppeared message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.StreamEventAppeared} StreamEventAppeared - */ - StreamEventAppeared.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.StreamEventAppeared) - return object; - var message = new $root.EventStore.Client.Messages.StreamEventAppeared(); - if (object.event != null) { - if (typeof object.event !== "object") - throw TypeError(".EventStore.Client.Messages.StreamEventAppeared.event: object expected"); - message.event = $root.EventStore.Client.Messages.ResolvedEvent.fromObject(object.event); - } - return message; - }; - - /** - * Creates a plain object from a StreamEventAppeared message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @static - * @param {EventStore.Client.Messages.StreamEventAppeared} message StreamEventAppeared - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - StreamEventAppeared.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.event = null; - if (message.event != null && message.hasOwnProperty("event")) - object.event = $root.EventStore.Client.Messages.ResolvedEvent.toObject(message.event, options); - return object; - }; - - /** - * Converts this StreamEventAppeared to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @instance - * @returns {Object.} JSON object - */ - StreamEventAppeared.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for StreamEventAppeared - * @function getTypeUrl - * @memberof EventStore.Client.Messages.StreamEventAppeared - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - StreamEventAppeared.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.StreamEventAppeared"; - }; - - return StreamEventAppeared; - })(); - - Messages.UnsubscribeFromStream = (function() { - - /** - * Properties of an UnsubscribeFromStream. - * @memberof EventStore.Client.Messages - * @interface IUnsubscribeFromStream - */ - - /** - * Constructs a new UnsubscribeFromStream. - * @memberof EventStore.Client.Messages - * @classdesc Represents an UnsubscribeFromStream. - * @implements IUnsubscribeFromStream - * @constructor - * @param {EventStore.Client.Messages.IUnsubscribeFromStream=} [properties] Properties to set - */ - function UnsubscribeFromStream(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Creates a new UnsubscribeFromStream instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.UnsubscribeFromStream - * @static - * @param {EventStore.Client.Messages.IUnsubscribeFromStream=} [properties] Properties to set - * @returns {EventStore.Client.Messages.UnsubscribeFromStream} UnsubscribeFromStream instance - */ - UnsubscribeFromStream.create = function create(properties) { - return new UnsubscribeFromStream(properties); - }; - - /** - * Encodes the specified UnsubscribeFromStream message. Does not implicitly {@link EventStore.Client.Messages.UnsubscribeFromStream.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.UnsubscribeFromStream - * @static - * @param {EventStore.Client.Messages.IUnsubscribeFromStream} message UnsubscribeFromStream message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UnsubscribeFromStream.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified UnsubscribeFromStream message, length delimited. Does not implicitly {@link EventStore.Client.Messages.UnsubscribeFromStream.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.UnsubscribeFromStream - * @static - * @param {EventStore.Client.Messages.IUnsubscribeFromStream} message UnsubscribeFromStream message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UnsubscribeFromStream.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UnsubscribeFromStream message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.UnsubscribeFromStream - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.UnsubscribeFromStream} UnsubscribeFromStream - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UnsubscribeFromStream.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.UnsubscribeFromStream(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UnsubscribeFromStream message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.UnsubscribeFromStream - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.UnsubscribeFromStream} UnsubscribeFromStream - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UnsubscribeFromStream.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UnsubscribeFromStream message. - * @function verify - * @memberof EventStore.Client.Messages.UnsubscribeFromStream - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UnsubscribeFromStream.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates an UnsubscribeFromStream message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.UnsubscribeFromStream - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.UnsubscribeFromStream} UnsubscribeFromStream - */ - UnsubscribeFromStream.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.UnsubscribeFromStream) - return object; - return new $root.EventStore.Client.Messages.UnsubscribeFromStream(); - }; - - /** - * Creates a plain object from an UnsubscribeFromStream message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.UnsubscribeFromStream - * @static - * @param {EventStore.Client.Messages.UnsubscribeFromStream} message UnsubscribeFromStream - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UnsubscribeFromStream.toObject = function toObject() { - return {}; - }; - - /** - * Converts this UnsubscribeFromStream to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.UnsubscribeFromStream - * @instance - * @returns {Object.} JSON object - */ - UnsubscribeFromStream.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UnsubscribeFromStream - * @function getTypeUrl - * @memberof EventStore.Client.Messages.UnsubscribeFromStream - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UnsubscribeFromStream.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.UnsubscribeFromStream"; - }; - - return UnsubscribeFromStream; - })(); - - Messages.SubscriptionDropped = (function() { - - /** - * Properties of a SubscriptionDropped. - * @memberof EventStore.Client.Messages - * @interface ISubscriptionDropped - * @property {EventStore.Client.Messages.SubscriptionDropped.SubscriptionDropReason|null} [reason] SubscriptionDropped reason - */ - - /** - * Constructs a new SubscriptionDropped. - * @memberof EventStore.Client.Messages - * @classdesc Represents a SubscriptionDropped. - * @implements ISubscriptionDropped - * @constructor - * @param {EventStore.Client.Messages.ISubscriptionDropped=} [properties] Properties to set - */ - function SubscriptionDropped(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SubscriptionDropped reason. - * @member {EventStore.Client.Messages.SubscriptionDropped.SubscriptionDropReason} reason - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @instance - */ - SubscriptionDropped.prototype.reason = 0; - - /** - * Creates a new SubscriptionDropped instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @static - * @param {EventStore.Client.Messages.ISubscriptionDropped=} [properties] Properties to set - * @returns {EventStore.Client.Messages.SubscriptionDropped} SubscriptionDropped instance - */ - SubscriptionDropped.create = function create(properties) { - return new SubscriptionDropped(properties); - }; - - /** - * Encodes the specified SubscriptionDropped message. Does not implicitly {@link EventStore.Client.Messages.SubscriptionDropped.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @static - * @param {EventStore.Client.Messages.ISubscriptionDropped} message SubscriptionDropped message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SubscriptionDropped.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.reason); - return writer; - }; - - /** - * Encodes the specified SubscriptionDropped message, length delimited. Does not implicitly {@link EventStore.Client.Messages.SubscriptionDropped.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @static - * @param {EventStore.Client.Messages.ISubscriptionDropped} message SubscriptionDropped message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SubscriptionDropped.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SubscriptionDropped message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.SubscriptionDropped} SubscriptionDropped - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SubscriptionDropped.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.SubscriptionDropped(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.reason = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SubscriptionDropped message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.SubscriptionDropped} SubscriptionDropped - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SubscriptionDropped.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SubscriptionDropped message. - * @function verify - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SubscriptionDropped.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.reason != null && message.hasOwnProperty("reason")) - switch (message.reason) { - default: - return "reason: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - return null; - }; - - /** - * Creates a SubscriptionDropped message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.SubscriptionDropped} SubscriptionDropped - */ - SubscriptionDropped.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.SubscriptionDropped) - return object; - var message = new $root.EventStore.Client.Messages.SubscriptionDropped(); - switch (object.reason) { default: - if (typeof object.reason === "number") { - message.reason = object.reason; + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamEventAppeared message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.StreamEventAppeared} StreamEventAppeared + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamEventAppeared.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamEventAppeared message. + * @function verify + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamEventAppeared.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.event != null && message.hasOwnProperty("event")) { + var error = $root.EventStore.Client.Messages.ResolvedEvent.verify(message.event); + if (error) + return "event." + error; + } + return null; + }; + + /** + * Creates a StreamEventAppeared message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.StreamEventAppeared} StreamEventAppeared + */ + StreamEventAppeared.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.StreamEventAppeared) + return object; + var message = new $root.EventStore.Client.Messages.StreamEventAppeared(); + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".EventStore.Client.Messages.StreamEventAppeared.event: object expected"); + message.event = $root.EventStore.Client.Messages.ResolvedEvent.fromObject(object.event); + } + return message; + }; + + /** + * Creates a plain object from a StreamEventAppeared message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @static + * @param {EventStore.Client.Messages.StreamEventAppeared} message StreamEventAppeared + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamEventAppeared.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.event = null; + if (message.event != null && message.hasOwnProperty("event")) + object.event = $root.EventStore.Client.Messages.ResolvedEvent.toObject(message.event, options); + return object; + }; + + /** + * Converts this StreamEventAppeared to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @instance + * @returns {Object.} JSON object + */ + StreamEventAppeared.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamEventAppeared + * @function getTypeUrl + * @memberof EventStore.Client.Messages.StreamEventAppeared + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamEventAppeared.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.StreamEventAppeared"; + }; + + return StreamEventAppeared; + })(); + + Messages.UnsubscribeFromStream = (function() { + + /** + * Properties of an UnsubscribeFromStream. + * @memberof EventStore.Client.Messages + * @interface IUnsubscribeFromStream + */ + + /** + * Constructs a new UnsubscribeFromStream. + * @memberof EventStore.Client.Messages + * @classdesc Represents an UnsubscribeFromStream. + * @implements IUnsubscribeFromStream + * @constructor + * @param {EventStore.Client.Messages.IUnsubscribeFromStream=} [properties] Properties to set + */ + function UnsubscribeFromStream(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new UnsubscribeFromStream instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.UnsubscribeFromStream + * @static + * @param {EventStore.Client.Messages.IUnsubscribeFromStream=} [properties] Properties to set + * @returns {EventStore.Client.Messages.UnsubscribeFromStream} UnsubscribeFromStream instance + */ + UnsubscribeFromStream.create = function create(properties) { + return new UnsubscribeFromStream(properties); + }; + + /** + * Encodes the specified UnsubscribeFromStream message. Does not implicitly {@link EventStore.Client.Messages.UnsubscribeFromStream.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.UnsubscribeFromStream + * @static + * @param {EventStore.Client.Messages.IUnsubscribeFromStream} message UnsubscribeFromStream message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnsubscribeFromStream.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified UnsubscribeFromStream message, length delimited. Does not implicitly {@link EventStore.Client.Messages.UnsubscribeFromStream.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.UnsubscribeFromStream + * @static + * @param {EventStore.Client.Messages.IUnsubscribeFromStream} message UnsubscribeFromStream message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnsubscribeFromStream.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UnsubscribeFromStream message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.UnsubscribeFromStream + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.UnsubscribeFromStream} UnsubscribeFromStream + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnsubscribeFromStream.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.UnsubscribeFromStream(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UnsubscribeFromStream message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.UnsubscribeFromStream + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.UnsubscribeFromStream} UnsubscribeFromStream + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnsubscribeFromStream.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UnsubscribeFromStream message. + * @function verify + * @memberof EventStore.Client.Messages.UnsubscribeFromStream + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UnsubscribeFromStream.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an UnsubscribeFromStream message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.UnsubscribeFromStream + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.UnsubscribeFromStream} UnsubscribeFromStream + */ + UnsubscribeFromStream.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.UnsubscribeFromStream) + return object; + return new $root.EventStore.Client.Messages.UnsubscribeFromStream(); + }; + + /** + * Creates a plain object from an UnsubscribeFromStream message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.UnsubscribeFromStream + * @static + * @param {EventStore.Client.Messages.UnsubscribeFromStream} message UnsubscribeFromStream + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UnsubscribeFromStream.toObject = function toObject() { + return {}; + }; + + /** + * Converts this UnsubscribeFromStream to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.UnsubscribeFromStream + * @instance + * @returns {Object.} JSON object + */ + UnsubscribeFromStream.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UnsubscribeFromStream + * @function getTypeUrl + * @memberof EventStore.Client.Messages.UnsubscribeFromStream + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UnsubscribeFromStream.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.UnsubscribeFromStream"; + }; + + return UnsubscribeFromStream; + })(); + + Messages.SubscriptionDropped = (function() { + + /** + * Properties of a SubscriptionDropped. + * @memberof EventStore.Client.Messages + * @interface ISubscriptionDropped + * @property {EventStore.Client.Messages.SubscriptionDropped.SubscriptionDropReason|null} [reason] SubscriptionDropped reason + */ + + /** + * Constructs a new SubscriptionDropped. + * @memberof EventStore.Client.Messages + * @classdesc Represents a SubscriptionDropped. + * @implements ISubscriptionDropped + * @constructor + * @param {EventStore.Client.Messages.ISubscriptionDropped=} [properties] Properties to set + */ + function SubscriptionDropped(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SubscriptionDropped reason. + * @member {EventStore.Client.Messages.SubscriptionDropped.SubscriptionDropReason} reason + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @instance + */ + SubscriptionDropped.prototype.reason = 0; + + /** + * Creates a new SubscriptionDropped instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @static + * @param {EventStore.Client.Messages.ISubscriptionDropped=} [properties] Properties to set + * @returns {EventStore.Client.Messages.SubscriptionDropped} SubscriptionDropped instance + */ + SubscriptionDropped.create = function create(properties) { + return new SubscriptionDropped(properties); + }; + + /** + * Encodes the specified SubscriptionDropped message. Does not implicitly {@link EventStore.Client.Messages.SubscriptionDropped.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @static + * @param {EventStore.Client.Messages.ISubscriptionDropped} message SubscriptionDropped message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubscriptionDropped.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.reason); + return writer; + }; + + /** + * Encodes the specified SubscriptionDropped message, length delimited. Does not implicitly {@link EventStore.Client.Messages.SubscriptionDropped.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @static + * @param {EventStore.Client.Messages.ISubscriptionDropped} message SubscriptionDropped message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubscriptionDropped.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SubscriptionDropped message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.SubscriptionDropped} SubscriptionDropped + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubscriptionDropped.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.SubscriptionDropped(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.reason = reader.int32(); break; } + default: + reader.skipType(tag & 7); break; - case "Unsubscribed": + } + } + return message; + }; + + /** + * Decodes a SubscriptionDropped message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.SubscriptionDropped} SubscriptionDropped + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubscriptionDropped.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SubscriptionDropped message. + * @function verify + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SubscriptionDropped.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.reason != null && message.hasOwnProperty("reason")) + switch (message.reason) { + default: + return "reason: enum value expected"; case 0: - message.reason = 0; - break; - case "AccessDenied": case 1: - message.reason = 1; - break; - case "NotFound": case 2: - message.reason = 2; - break; - case "PersistentSubscriptionDeleted": case 3: - message.reason = 3; - break; - case "SubscriberMaxCountReached": case 4: - message.reason = 4; break; } - return message; - }; + return null; + }; - /** - * Creates a plain object from a SubscriptionDropped message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @static - * @param {EventStore.Client.Messages.SubscriptionDropped} message SubscriptionDropped - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SubscriptionDropped.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.reason = options.enums === String ? "Unsubscribed" : 0; - if (message.reason != null && message.hasOwnProperty("reason")) - object.reason = options.enums === String ? $root.EventStore.Client.Messages.SubscriptionDropped.SubscriptionDropReason[message.reason] === undefined ? message.reason : $root.EventStore.Client.Messages.SubscriptionDropped.SubscriptionDropReason[message.reason] : message.reason; + /** + * Creates a SubscriptionDropped message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.SubscriptionDropped} SubscriptionDropped + */ + SubscriptionDropped.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.SubscriptionDropped) return object; - }; - - /** - * Converts this SubscriptionDropped to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @instance - * @returns {Object.} JSON object - */ - SubscriptionDropped.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SubscriptionDropped - * @function getTypeUrl - * @memberof EventStore.Client.Messages.SubscriptionDropped - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SubscriptionDropped.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + var message = new $root.EventStore.Client.Messages.SubscriptionDropped(); + switch (object.reason) { + default: + if (typeof object.reason === "number") { + message.reason = object.reason; + break; } - return typeUrlPrefix + "/EventStore.Client.Messages.SubscriptionDropped"; - }; + break; + case "Unsubscribed": + case 0: + message.reason = 0; + break; + case "AccessDenied": + case 1: + message.reason = 1; + break; + case "NotFound": + case 2: + message.reason = 2; + break; + case "PersistentSubscriptionDeleted": + case 3: + message.reason = 3; + break; + case "SubscriberMaxCountReached": + case 4: + message.reason = 4; + break; + } + return message; + }; - /** - * SubscriptionDropReason enum. - * @name EventStore.Client.Messages.SubscriptionDropped.SubscriptionDropReason - * @enum {number} - * @property {number} Unsubscribed=0 Unsubscribed value - * @property {number} AccessDenied=1 AccessDenied value - * @property {number} NotFound=2 NotFound value - * @property {number} PersistentSubscriptionDeleted=3 PersistentSubscriptionDeleted value - * @property {number} SubscriberMaxCountReached=4 SubscriberMaxCountReached value - */ - SubscriptionDropped.SubscriptionDropReason = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Unsubscribed"] = 0; - values[valuesById[1] = "AccessDenied"] = 1; - values[valuesById[2] = "NotFound"] = 2; - values[valuesById[3] = "PersistentSubscriptionDeleted"] = 3; - values[valuesById[4] = "SubscriberMaxCountReached"] = 4; - return values; - })(); + /** + * Creates a plain object from a SubscriptionDropped message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @static + * @param {EventStore.Client.Messages.SubscriptionDropped} message SubscriptionDropped + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SubscriptionDropped.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.reason = options.enums === String ? "Unsubscribed" : 0; + if (message.reason != null && message.hasOwnProperty("reason")) + object.reason = options.enums === String ? $root.EventStore.Client.Messages.SubscriptionDropped.SubscriptionDropReason[message.reason] === undefined ? message.reason : $root.EventStore.Client.Messages.SubscriptionDropped.SubscriptionDropReason[message.reason] : message.reason; + return object; + }; - return SubscriptionDropped; + /** + * Converts this SubscriptionDropped to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @instance + * @returns {Object.} JSON object + */ + SubscriptionDropped.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SubscriptionDropped + * @function getTypeUrl + * @memberof EventStore.Client.Messages.SubscriptionDropped + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SubscriptionDropped.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.SubscriptionDropped"; + }; + + /** + * SubscriptionDropReason enum. + * @name EventStore.Client.Messages.SubscriptionDropped.SubscriptionDropReason + * @enum {number} + * @property {number} Unsubscribed=0 Unsubscribed value + * @property {number} AccessDenied=1 AccessDenied value + * @property {number} NotFound=2 NotFound value + * @property {number} PersistentSubscriptionDeleted=3 PersistentSubscriptionDeleted value + * @property {number} SubscriberMaxCountReached=4 SubscriberMaxCountReached value + */ + SubscriptionDropped.SubscriptionDropReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Unsubscribed"] = 0; + values[valuesById[1] = "AccessDenied"] = 1; + values[valuesById[2] = "NotFound"] = 2; + values[valuesById[3] = "PersistentSubscriptionDeleted"] = 3; + values[valuesById[4] = "SubscriberMaxCountReached"] = 4; + return values; })(); - Messages.NotHandled = (function() { + return SubscriptionDropped; + })(); - /** - * Properties of a NotHandled. - * @memberof EventStore.Client.Messages - * @interface INotHandled - * @property {EventStore.Client.Messages.NotHandled.NotHandledReason} reason NotHandled reason - * @property {Uint8Array|null} [additionalInfo] NotHandled additionalInfo - */ + Messages.NotHandled = (function() { - /** - * Constructs a new NotHandled. - * @memberof EventStore.Client.Messages - * @classdesc Represents a NotHandled. - * @implements INotHandled - * @constructor - * @param {EventStore.Client.Messages.INotHandled=} [properties] Properties to set - */ - function NotHandled(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a NotHandled. + * @memberof EventStore.Client.Messages + * @interface INotHandled + * @property {EventStore.Client.Messages.NotHandled.NotHandledReason|null} [reason] NotHandled reason + * @property {Uint8Array|null} [additionalInfo] NotHandled additionalInfo + */ - /** - * NotHandled reason. - * @member {EventStore.Client.Messages.NotHandled.NotHandledReason} reason - * @memberof EventStore.Client.Messages.NotHandled - * @instance - */ - NotHandled.prototype.reason = 0; + /** + * Constructs a new NotHandled. + * @memberof EventStore.Client.Messages + * @classdesc Represents a NotHandled. + * @implements INotHandled + * @constructor + * @param {EventStore.Client.Messages.INotHandled=} [properties] Properties to set + */ + function NotHandled(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * NotHandled additionalInfo. - * @member {Uint8Array} additionalInfo - * @memberof EventStore.Client.Messages.NotHandled - * @instance - */ - NotHandled.prototype.additionalInfo = $util.newBuffer([]); + /** + * NotHandled reason. + * @member {EventStore.Client.Messages.NotHandled.NotHandledReason} reason + * @memberof EventStore.Client.Messages.NotHandled + * @instance + */ + NotHandled.prototype.reason = 0; - /** - * Creates a new NotHandled instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.NotHandled - * @static - * @param {EventStore.Client.Messages.INotHandled=} [properties] Properties to set - * @returns {EventStore.Client.Messages.NotHandled} NotHandled instance - */ - NotHandled.create = function create(properties) { - return new NotHandled(properties); - }; + /** + * NotHandled additionalInfo. + * @member {Uint8Array} additionalInfo + * @memberof EventStore.Client.Messages.NotHandled + * @instance + */ + NotHandled.prototype.additionalInfo = $util.newBuffer([]); - /** - * Encodes the specified NotHandled message. Does not implicitly {@link EventStore.Client.Messages.NotHandled.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.NotHandled - * @static - * @param {EventStore.Client.Messages.INotHandled} message NotHandled message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NotHandled.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + /** + * Creates a new NotHandled instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.NotHandled + * @static + * @param {EventStore.Client.Messages.INotHandled=} [properties] Properties to set + * @returns {EventStore.Client.Messages.NotHandled} NotHandled instance + */ + NotHandled.create = function create(properties) { + return new NotHandled(properties); + }; + + /** + * Encodes the specified NotHandled message. Does not implicitly {@link EventStore.Client.Messages.NotHandled.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.NotHandled + * @static + * @param {EventStore.Client.Messages.INotHandled} message NotHandled message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotHandled.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.reason); - if (message.additionalInfo != null && Object.hasOwnProperty.call(message, "additionalInfo")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.additionalInfo); - return writer; - }; + if (message.additionalInfo != null && Object.hasOwnProperty.call(message, "additionalInfo")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.additionalInfo); + return writer; + }; - /** - * Encodes the specified NotHandled message, length delimited. Does not implicitly {@link EventStore.Client.Messages.NotHandled.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.NotHandled - * @static - * @param {EventStore.Client.Messages.INotHandled} message NotHandled message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NotHandled.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified NotHandled message, length delimited. Does not implicitly {@link EventStore.Client.Messages.NotHandled.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.NotHandled + * @static + * @param {EventStore.Client.Messages.INotHandled} message NotHandled message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotHandled.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a NotHandled message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.NotHandled - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.NotHandled} NotHandled - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NotHandled.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.NotHandled(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.reason = reader.int32(); - break; - } - case 2: { - message.additionalInfo = reader.bytes(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a NotHandled message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.NotHandled + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.NotHandled} NotHandled + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotHandled.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.NotHandled(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.reason = reader.int32(); break; } + case 2: { + message.additionalInfo = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; } - if (!message.hasOwnProperty("reason")) - throw $util.ProtocolError("missing required 'reason'", { instance: message }); - return message; - }; + } + return message; + }; - /** - * Decodes a NotHandled message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.NotHandled - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.NotHandled} NotHandled - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NotHandled.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a NotHandled message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.NotHandled + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.NotHandled} NotHandled + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotHandled.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a NotHandled message. - * @function verify - * @memberof EventStore.Client.Messages.NotHandled - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NotHandled.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; + /** + * Verifies a NotHandled message. + * @function verify + * @memberof EventStore.Client.Messages.NotHandled + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NotHandled.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.reason != null && message.hasOwnProperty("reason")) switch (message.reason) { default: return "reason: enum value expected"; @@ -13483,735 +13472,299 @@ case 3: break; } - if (message.additionalInfo != null && message.hasOwnProperty("additionalInfo")) - if (!(message.additionalInfo && typeof message.additionalInfo.length === "number" || $util.isString(message.additionalInfo))) - return "additionalInfo: buffer expected"; - return null; - }; + if (message.additionalInfo != null && message.hasOwnProperty("additionalInfo")) + if (!(message.additionalInfo && typeof message.additionalInfo.length === "number" || $util.isString(message.additionalInfo))) + return "additionalInfo: buffer expected"; + return null; + }; - /** - * Creates a NotHandled message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.NotHandled - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.NotHandled} NotHandled - */ - NotHandled.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.NotHandled) - return object; - var message = new $root.EventStore.Client.Messages.NotHandled(); - switch (object.reason) { - default: - if (typeof object.reason === "number") { - message.reason = object.reason; - break; - } - break; - case "NotReady": - case 0: - message.reason = 0; - break; - case "TooBusy": - case 1: - message.reason = 1; - break; - case "NotLeader": - case 2: - message.reason = 2; - break; - case "IsReadOnly": - case 3: - message.reason = 3; - break; - } - if (object.additionalInfo != null) - if (typeof object.additionalInfo === "string") - $util.base64.decode(object.additionalInfo, message.additionalInfo = $util.newBuffer($util.base64.length(object.additionalInfo)), 0); - else if (object.additionalInfo.length >= 0) - message.additionalInfo = object.additionalInfo; - return message; - }; - - /** - * Creates a plain object from a NotHandled message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.NotHandled - * @static - * @param {EventStore.Client.Messages.NotHandled} message NotHandled - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NotHandled.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.reason = options.enums === String ? "NotReady" : 0; - if (options.bytes === String) - object.additionalInfo = ""; - else { - object.additionalInfo = []; - if (options.bytes !== Array) - object.additionalInfo = $util.newBuffer(object.additionalInfo); - } - } - if (message.reason != null && message.hasOwnProperty("reason")) - object.reason = options.enums === String ? $root.EventStore.Client.Messages.NotHandled.NotHandledReason[message.reason] === undefined ? message.reason : $root.EventStore.Client.Messages.NotHandled.NotHandledReason[message.reason] : message.reason; - if (message.additionalInfo != null && message.hasOwnProperty("additionalInfo")) - object.additionalInfo = options.bytes === String ? $util.base64.encode(message.additionalInfo, 0, message.additionalInfo.length) : options.bytes === Array ? Array.prototype.slice.call(message.additionalInfo) : message.additionalInfo; + /** + * Creates a NotHandled message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.NotHandled + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.NotHandled} NotHandled + */ + NotHandled.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.NotHandled) return object; - }; + var message = new $root.EventStore.Client.Messages.NotHandled(); + switch (object.reason) { + default: + if (typeof object.reason === "number") { + message.reason = object.reason; + break; + } + break; + case "NotReady": + case 0: + message.reason = 0; + break; + case "TooBusy": + case 1: + message.reason = 1; + break; + case "NotLeader": + case 2: + message.reason = 2; + break; + case "IsReadOnly": + case 3: + message.reason = 3; + break; + } + if (object.additionalInfo != null) + if (typeof object.additionalInfo === "string") + $util.base64.decode(object.additionalInfo, message.additionalInfo = $util.newBuffer($util.base64.length(object.additionalInfo)), 0); + else if (object.additionalInfo.length >= 0) + message.additionalInfo = object.additionalInfo; + return message; + }; + + /** + * Creates a plain object from a NotHandled message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.NotHandled + * @static + * @param {EventStore.Client.Messages.NotHandled} message NotHandled + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NotHandled.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.reason = options.enums === String ? "NotReady" : 0; + if (options.bytes === String) + object.additionalInfo = ""; + else { + object.additionalInfo = []; + if (options.bytes !== Array) + object.additionalInfo = $util.newBuffer(object.additionalInfo); + } + } + if (message.reason != null && message.hasOwnProperty("reason")) + object.reason = options.enums === String ? $root.EventStore.Client.Messages.NotHandled.NotHandledReason[message.reason] === undefined ? message.reason : $root.EventStore.Client.Messages.NotHandled.NotHandledReason[message.reason] : message.reason; + if (message.additionalInfo != null && message.hasOwnProperty("additionalInfo")) + object.additionalInfo = options.bytes === String ? $util.base64.encode(message.additionalInfo, 0, message.additionalInfo.length) : options.bytes === Array ? Array.prototype.slice.call(message.additionalInfo) : message.additionalInfo; + return object; + }; + + /** + * Converts this NotHandled to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.NotHandled + * @instance + * @returns {Object.} JSON object + */ + NotHandled.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NotHandled + * @function getTypeUrl + * @memberof EventStore.Client.Messages.NotHandled + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NotHandled.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.NotHandled"; + }; + + /** + * NotHandledReason enum. + * @name EventStore.Client.Messages.NotHandled.NotHandledReason + * @enum {number} + * @property {number} NotReady=0 NotReady value + * @property {number} TooBusy=1 TooBusy value + * @property {number} NotLeader=2 NotLeader value + * @property {number} IsReadOnly=3 IsReadOnly value + */ + NotHandled.NotHandledReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NotReady"] = 0; + values[valuesById[1] = "TooBusy"] = 1; + values[valuesById[2] = "NotLeader"] = 2; + values[valuesById[3] = "IsReadOnly"] = 3; + return values; + })(); + + NotHandled.LeaderInfo = (function() { /** - * Converts this NotHandled to JSON. - * @function toJSON + * Properties of a LeaderInfo. * @memberof EventStore.Client.Messages.NotHandled + * @interface ILeaderInfo + * @property {string|null} [externalTcpAddress] LeaderInfo externalTcpAddress + * @property {number|null} [externalTcpPort] LeaderInfo externalTcpPort + * @property {string|null} [httpAddress] LeaderInfo httpAddress + * @property {number|null} [httpPort] LeaderInfo httpPort + * @property {string|null} [externalSecureTcpAddress] LeaderInfo externalSecureTcpAddress + * @property {number|null} [externalSecureTcpPort] LeaderInfo externalSecureTcpPort + */ + + /** + * Constructs a new LeaderInfo. + * @memberof EventStore.Client.Messages.NotHandled + * @classdesc Represents a LeaderInfo. + * @implements ILeaderInfo + * @constructor + * @param {EventStore.Client.Messages.NotHandled.ILeaderInfo=} [properties] Properties to set + */ + function LeaderInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LeaderInfo externalTcpAddress. + * @member {string} externalTcpAddress + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo * @instance - * @returns {Object.} JSON object */ - NotHandled.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + LeaderInfo.prototype.externalTcpAddress = ""; /** - * Gets the default type url for NotHandled - * @function getTypeUrl - * @memberof EventStore.Client.Messages.NotHandled + * LeaderInfo externalTcpPort. + * @member {number} externalTcpPort + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo + * @instance + */ + LeaderInfo.prototype.externalTcpPort = 0; + + /** + * LeaderInfo httpAddress. + * @member {string} httpAddress + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo + * @instance + */ + LeaderInfo.prototype.httpAddress = ""; + + /** + * LeaderInfo httpPort. + * @member {number} httpPort + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo + * @instance + */ + LeaderInfo.prototype.httpPort = 0; + + /** + * LeaderInfo externalSecureTcpAddress. + * @member {string} externalSecureTcpAddress + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo + * @instance + */ + LeaderInfo.prototype.externalSecureTcpAddress = ""; + + /** + * LeaderInfo externalSecureTcpPort. + * @member {number} externalSecureTcpPort + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo + * @instance + */ + LeaderInfo.prototype.externalSecureTcpPort = 0; + + /** + * Creates a new LeaderInfo instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url + * @param {EventStore.Client.Messages.NotHandled.ILeaderInfo=} [properties] Properties to set + * @returns {EventStore.Client.Messages.NotHandled.LeaderInfo} LeaderInfo instance */ - NotHandled.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.NotHandled"; + LeaderInfo.create = function create(properties) { + return new LeaderInfo(properties); }; /** - * NotHandledReason enum. - * @name EventStore.Client.Messages.NotHandled.NotHandledReason - * @enum {number} - * @property {number} NotReady=0 NotReady value - * @property {number} TooBusy=1 TooBusy value - * @property {number} NotLeader=2 NotLeader value - * @property {number} IsReadOnly=3 IsReadOnly value + * Encodes the specified LeaderInfo message. Does not implicitly {@link EventStore.Client.Messages.NotHandled.LeaderInfo.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo + * @static + * @param {EventStore.Client.Messages.NotHandled.ILeaderInfo} message LeaderInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - NotHandled.NotHandledReason = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "NotReady"] = 0; - values[valuesById[1] = "TooBusy"] = 1; - values[valuesById[2] = "NotLeader"] = 2; - values[valuesById[3] = "IsReadOnly"] = 3; - return values; - })(); - - NotHandled.LeaderInfo = (function() { - - /** - * Properties of a LeaderInfo. - * @memberof EventStore.Client.Messages.NotHandled - * @interface ILeaderInfo - * @property {string|null} [externalTcpAddress] LeaderInfo externalTcpAddress - * @property {number|null} [externalTcpPort] LeaderInfo externalTcpPort - * @property {string} httpAddress LeaderInfo httpAddress - * @property {number} httpPort LeaderInfo httpPort - * @property {string|null} [externalSecureTcpAddress] LeaderInfo externalSecureTcpAddress - * @property {number|null} [externalSecureTcpPort] LeaderInfo externalSecureTcpPort - */ - - /** - * Constructs a new LeaderInfo. - * @memberof EventStore.Client.Messages.NotHandled - * @classdesc Represents a LeaderInfo. - * @implements ILeaderInfo - * @constructor - * @param {EventStore.Client.Messages.NotHandled.ILeaderInfo=} [properties] Properties to set - */ - function LeaderInfo(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LeaderInfo externalTcpAddress. - * @member {string} externalTcpAddress - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @instance - */ - LeaderInfo.prototype.externalTcpAddress = ""; - - /** - * LeaderInfo externalTcpPort. - * @member {number} externalTcpPort - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @instance - */ - LeaderInfo.prototype.externalTcpPort = 0; - - /** - * LeaderInfo httpAddress. - * @member {string} httpAddress - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @instance - */ - LeaderInfo.prototype.httpAddress = ""; - - /** - * LeaderInfo httpPort. - * @member {number} httpPort - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @instance - */ - LeaderInfo.prototype.httpPort = 0; - - /** - * LeaderInfo externalSecureTcpAddress. - * @member {string} externalSecureTcpAddress - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @instance - */ - LeaderInfo.prototype.externalSecureTcpAddress = ""; - - /** - * LeaderInfo externalSecureTcpPort. - * @member {number} externalSecureTcpPort - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @instance - */ - LeaderInfo.prototype.externalSecureTcpPort = 0; - - /** - * Creates a new LeaderInfo instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @static - * @param {EventStore.Client.Messages.NotHandled.ILeaderInfo=} [properties] Properties to set - * @returns {EventStore.Client.Messages.NotHandled.LeaderInfo} LeaderInfo instance - */ - LeaderInfo.create = function create(properties) { - return new LeaderInfo(properties); - }; - - /** - * Encodes the specified LeaderInfo message. Does not implicitly {@link EventStore.Client.Messages.NotHandled.LeaderInfo.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @static - * @param {EventStore.Client.Messages.NotHandled.ILeaderInfo} message LeaderInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LeaderInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.externalTcpAddress != null && Object.hasOwnProperty.call(message, "externalTcpAddress")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.externalTcpAddress); - if (message.externalTcpPort != null && Object.hasOwnProperty.call(message, "externalTcpPort")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.externalTcpPort); + LeaderInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.externalTcpAddress != null && Object.hasOwnProperty.call(message, "externalTcpAddress")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.externalTcpAddress); + if (message.externalTcpPort != null && Object.hasOwnProperty.call(message, "externalTcpPort")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.externalTcpPort); + if (message.httpAddress != null && Object.hasOwnProperty.call(message, "httpAddress")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.httpAddress); + if (message.httpPort != null && Object.hasOwnProperty.call(message, "httpPort")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.httpPort); - if (message.externalSecureTcpAddress != null && Object.hasOwnProperty.call(message, "externalSecureTcpAddress")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.externalSecureTcpAddress); - if (message.externalSecureTcpPort != null && Object.hasOwnProperty.call(message, "externalSecureTcpPort")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.externalSecureTcpPort); - return writer; - }; - - /** - * Encodes the specified LeaderInfo message, length delimited. Does not implicitly {@link EventStore.Client.Messages.NotHandled.LeaderInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @static - * @param {EventStore.Client.Messages.NotHandled.ILeaderInfo} message LeaderInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LeaderInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LeaderInfo message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.NotHandled.LeaderInfo} LeaderInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LeaderInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.NotHandled.LeaderInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.externalTcpAddress = reader.string(); - break; - } - case 2: { - message.externalTcpPort = reader.int32(); - break; - } - case 3: { - message.httpAddress = reader.string(); - break; - } - case 4: { - message.httpPort = reader.int32(); - break; - } - case 5: { - message.externalSecureTcpAddress = reader.string(); - break; - } - case 6: { - message.externalSecureTcpPort = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("httpAddress")) - throw $util.ProtocolError("missing required 'httpAddress'", { instance: message }); - if (!message.hasOwnProperty("httpPort")) - throw $util.ProtocolError("missing required 'httpPort'", { instance: message }); - return message; - }; - - /** - * Decodes a LeaderInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.NotHandled.LeaderInfo} LeaderInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LeaderInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LeaderInfo message. - * @function verify - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LeaderInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.externalTcpAddress != null && message.hasOwnProperty("externalTcpAddress")) - if (!$util.isString(message.externalTcpAddress)) - return "externalTcpAddress: string expected"; - if (message.externalTcpPort != null && message.hasOwnProperty("externalTcpPort")) - if (!$util.isInteger(message.externalTcpPort)) - return "externalTcpPort: integer expected"; - if (!$util.isString(message.httpAddress)) - return "httpAddress: string expected"; - if (!$util.isInteger(message.httpPort)) - return "httpPort: integer expected"; - if (message.externalSecureTcpAddress != null && message.hasOwnProperty("externalSecureTcpAddress")) - if (!$util.isString(message.externalSecureTcpAddress)) - return "externalSecureTcpAddress: string expected"; - if (message.externalSecureTcpPort != null && message.hasOwnProperty("externalSecureTcpPort")) - if (!$util.isInteger(message.externalSecureTcpPort)) - return "externalSecureTcpPort: integer expected"; - return null; - }; - - /** - * Creates a LeaderInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.NotHandled.LeaderInfo} LeaderInfo - */ - LeaderInfo.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.NotHandled.LeaderInfo) - return object; - var message = new $root.EventStore.Client.Messages.NotHandled.LeaderInfo(); - if (object.externalTcpAddress != null) - message.externalTcpAddress = String(object.externalTcpAddress); - if (object.externalTcpPort != null) - message.externalTcpPort = object.externalTcpPort | 0; - if (object.httpAddress != null) - message.httpAddress = String(object.httpAddress); - if (object.httpPort != null) - message.httpPort = object.httpPort | 0; - if (object.externalSecureTcpAddress != null) - message.externalSecureTcpAddress = String(object.externalSecureTcpAddress); - if (object.externalSecureTcpPort != null) - message.externalSecureTcpPort = object.externalSecureTcpPort | 0; - return message; - }; - - /** - * Creates a plain object from a LeaderInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @static - * @param {EventStore.Client.Messages.NotHandled.LeaderInfo} message LeaderInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LeaderInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.externalTcpAddress = ""; - object.externalTcpPort = 0; - object.httpAddress = ""; - object.httpPort = 0; - object.externalSecureTcpAddress = ""; - object.externalSecureTcpPort = 0; - } - if (message.externalTcpAddress != null && message.hasOwnProperty("externalTcpAddress")) - object.externalTcpAddress = message.externalTcpAddress; - if (message.externalTcpPort != null && message.hasOwnProperty("externalTcpPort")) - object.externalTcpPort = message.externalTcpPort; - if (message.httpAddress != null && message.hasOwnProperty("httpAddress")) - object.httpAddress = message.httpAddress; - if (message.httpPort != null && message.hasOwnProperty("httpPort")) - object.httpPort = message.httpPort; - if (message.externalSecureTcpAddress != null && message.hasOwnProperty("externalSecureTcpAddress")) - object.externalSecureTcpAddress = message.externalSecureTcpAddress; - if (message.externalSecureTcpPort != null && message.hasOwnProperty("externalSecureTcpPort")) - object.externalSecureTcpPort = message.externalSecureTcpPort; - return object; - }; - - /** - * Converts this LeaderInfo to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @instance - * @returns {Object.} JSON object - */ - LeaderInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LeaderInfo - * @function getTypeUrl - * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LeaderInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.NotHandled.LeaderInfo"; - }; - - return LeaderInfo; - })(); - - return NotHandled; - })(); - - Messages.ScavengeDatabase = (function() { - - /** - * Properties of a ScavengeDatabase. - * @memberof EventStore.Client.Messages - * @interface IScavengeDatabase - */ - - /** - * Constructs a new ScavengeDatabase. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ScavengeDatabase. - * @implements IScavengeDatabase - * @constructor - * @param {EventStore.Client.Messages.IScavengeDatabase=} [properties] Properties to set - */ - function ScavengeDatabase(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Creates a new ScavengeDatabase instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ScavengeDatabase - * @static - * @param {EventStore.Client.Messages.IScavengeDatabase=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ScavengeDatabase} ScavengeDatabase instance - */ - ScavengeDatabase.create = function create(properties) { - return new ScavengeDatabase(properties); - }; - - /** - * Encodes the specified ScavengeDatabase message. Does not implicitly {@link EventStore.Client.Messages.ScavengeDatabase.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ScavengeDatabase - * @static - * @param {EventStore.Client.Messages.IScavengeDatabase} message ScavengeDatabase message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ScavengeDatabase.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); + if (message.externalSecureTcpAddress != null && Object.hasOwnProperty.call(message, "externalSecureTcpAddress")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.externalSecureTcpAddress); + if (message.externalSecureTcpPort != null && Object.hasOwnProperty.call(message, "externalSecureTcpPort")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.externalSecureTcpPort); return writer; }; /** - * Encodes the specified ScavengeDatabase message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ScavengeDatabase.verify|verify} messages. + * Encodes the specified LeaderInfo message, length delimited. Does not implicitly {@link EventStore.Client.Messages.NotHandled.LeaderInfo.verify|verify} messages. * @function encodeDelimited - * @memberof EventStore.Client.Messages.ScavengeDatabase + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo * @static - * @param {EventStore.Client.Messages.IScavengeDatabase} message ScavengeDatabase message or plain object to encode + * @param {EventStore.Client.Messages.NotHandled.ILeaderInfo} message LeaderInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ScavengeDatabase.encodeDelimited = function encodeDelimited(message, writer) { + LeaderInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ScavengeDatabase message from the specified reader or buffer. + * Decodes a LeaderInfo message from the specified reader or buffer. * @function decode - * @memberof EventStore.Client.Messages.ScavengeDatabase + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ScavengeDatabase} ScavengeDatabase + * @returns {EventStore.Client.Messages.NotHandled.LeaderInfo} LeaderInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ScavengeDatabase.decode = function decode(reader, length) { + LeaderInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ScavengeDatabase(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ScavengeDatabase message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ScavengeDatabase - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ScavengeDatabase} ScavengeDatabase - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ScavengeDatabase.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ScavengeDatabase message. - * @function verify - * @memberof EventStore.Client.Messages.ScavengeDatabase - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ScavengeDatabase.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a ScavengeDatabase message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ScavengeDatabase - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ScavengeDatabase} ScavengeDatabase - */ - ScavengeDatabase.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ScavengeDatabase) - return object; - return new $root.EventStore.Client.Messages.ScavengeDatabase(); - }; - - /** - * Creates a plain object from a ScavengeDatabase message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ScavengeDatabase - * @static - * @param {EventStore.Client.Messages.ScavengeDatabase} message ScavengeDatabase - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ScavengeDatabase.toObject = function toObject() { - return {}; - }; - - /** - * Converts this ScavengeDatabase to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ScavengeDatabase - * @instance - * @returns {Object.} JSON object - */ - ScavengeDatabase.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ScavengeDatabase - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ScavengeDatabase - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ScavengeDatabase.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.ScavengeDatabase"; - }; - - return ScavengeDatabase; - })(); - - Messages.ScavengeDatabaseResponse = (function() { - - /** - * Properties of a ScavengeDatabaseResponse. - * @memberof EventStore.Client.Messages - * @interface IScavengeDatabaseResponse - * @property {EventStore.Client.Messages.ScavengeDatabaseResponse.ScavengeResult} result ScavengeDatabaseResponse result - * @property {string|null} [scavengeId] ScavengeDatabaseResponse scavengeId - */ - - /** - * Constructs a new ScavengeDatabaseResponse. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ScavengeDatabaseResponse. - * @implements IScavengeDatabaseResponse - * @constructor - * @param {EventStore.Client.Messages.IScavengeDatabaseResponse=} [properties] Properties to set - */ - function ScavengeDatabaseResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ScavengeDatabaseResponse result. - * @member {EventStore.Client.Messages.ScavengeDatabaseResponse.ScavengeResult} result - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse - * @instance - */ - ScavengeDatabaseResponse.prototype.result = 0; - - /** - * ScavengeDatabaseResponse scavengeId. - * @member {string} scavengeId - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse - * @instance - */ - ScavengeDatabaseResponse.prototype.scavengeId = ""; - - /** - * Creates a new ScavengeDatabaseResponse instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse - * @static - * @param {EventStore.Client.Messages.IScavengeDatabaseResponse=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ScavengeDatabaseResponse} ScavengeDatabaseResponse instance - */ - ScavengeDatabaseResponse.create = function create(properties) { - return new ScavengeDatabaseResponse(properties); - }; - - /** - * Encodes the specified ScavengeDatabaseResponse message. Does not implicitly {@link EventStore.Client.Messages.ScavengeDatabaseResponse.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse - * @static - * @param {EventStore.Client.Messages.IScavengeDatabaseResponse} message ScavengeDatabaseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ScavengeDatabaseResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); - if (message.scavengeId != null && Object.hasOwnProperty.call(message, "scavengeId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.scavengeId); - return writer; - }; - - /** - * Encodes the specified ScavengeDatabaseResponse message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ScavengeDatabaseResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse - * @static - * @param {EventStore.Client.Messages.IScavengeDatabaseResponse} message ScavengeDatabaseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ScavengeDatabaseResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ScavengeDatabaseResponse message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ScavengeDatabaseResponse} ScavengeDatabaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ScavengeDatabaseResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ScavengeDatabaseResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.NotHandled.LeaderInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.result = reader.int32(); + message.externalTcpAddress = reader.string(); break; } case 2: { - message.scavengeId = reader.string(); + message.externalTcpPort = reader.int32(); + break; + } + case 3: { + message.httpAddress = reader.string(); + break; + } + case 4: { + message.httpPort = reader.int32(); + break; + } + case 5: { + message.externalSecureTcpAddress = reader.string(); + break; + } + case 6: { + message.externalSecureTcpPort = reader.int32(); break; } default: @@ -14219,38 +13772,474 @@ break; } } - if (!message.hasOwnProperty("result")) - throw $util.ProtocolError("missing required 'result'", { instance: message }); return message; }; /** - * Decodes a ScavengeDatabaseResponse message from the specified reader or buffer, length delimited. + * Decodes a LeaderInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ScavengeDatabaseResponse} ScavengeDatabaseResponse + * @returns {EventStore.Client.Messages.NotHandled.LeaderInfo} LeaderInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ScavengeDatabaseResponse.decodeDelimited = function decodeDelimited(reader) { + LeaderInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ScavengeDatabaseResponse message. + * Verifies a LeaderInfo message. * @function verify - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ScavengeDatabaseResponse.verify = function verify(message) { + LeaderInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.externalTcpAddress != null && message.hasOwnProperty("externalTcpAddress")) + if (!$util.isString(message.externalTcpAddress)) + return "externalTcpAddress: string expected"; + if (message.externalTcpPort != null && message.hasOwnProperty("externalTcpPort")) + if (!$util.isInteger(message.externalTcpPort)) + return "externalTcpPort: integer expected"; + if (message.httpAddress != null && message.hasOwnProperty("httpAddress")) + if (!$util.isString(message.httpAddress)) + return "httpAddress: string expected"; + if (message.httpPort != null && message.hasOwnProperty("httpPort")) + if (!$util.isInteger(message.httpPort)) + return "httpPort: integer expected"; + if (message.externalSecureTcpAddress != null && message.hasOwnProperty("externalSecureTcpAddress")) + if (!$util.isString(message.externalSecureTcpAddress)) + return "externalSecureTcpAddress: string expected"; + if (message.externalSecureTcpPort != null && message.hasOwnProperty("externalSecureTcpPort")) + if (!$util.isInteger(message.externalSecureTcpPort)) + return "externalSecureTcpPort: integer expected"; + return null; + }; + + /** + * Creates a LeaderInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.NotHandled.LeaderInfo} LeaderInfo + */ + LeaderInfo.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.NotHandled.LeaderInfo) + return object; + var message = new $root.EventStore.Client.Messages.NotHandled.LeaderInfo(); + if (object.externalTcpAddress != null) + message.externalTcpAddress = String(object.externalTcpAddress); + if (object.externalTcpPort != null) + message.externalTcpPort = object.externalTcpPort | 0; + if (object.httpAddress != null) + message.httpAddress = String(object.httpAddress); + if (object.httpPort != null) + message.httpPort = object.httpPort | 0; + if (object.externalSecureTcpAddress != null) + message.externalSecureTcpAddress = String(object.externalSecureTcpAddress); + if (object.externalSecureTcpPort != null) + message.externalSecureTcpPort = object.externalSecureTcpPort | 0; + return message; + }; + + /** + * Creates a plain object from a LeaderInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo + * @static + * @param {EventStore.Client.Messages.NotHandled.LeaderInfo} message LeaderInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LeaderInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.externalTcpAddress = ""; + object.externalTcpPort = 0; + object.httpAddress = ""; + object.httpPort = 0; + object.externalSecureTcpAddress = ""; + object.externalSecureTcpPort = 0; + } + if (message.externalTcpAddress != null && message.hasOwnProperty("externalTcpAddress")) + object.externalTcpAddress = message.externalTcpAddress; + if (message.externalTcpPort != null && message.hasOwnProperty("externalTcpPort")) + object.externalTcpPort = message.externalTcpPort; + if (message.httpAddress != null && message.hasOwnProperty("httpAddress")) + object.httpAddress = message.httpAddress; + if (message.httpPort != null && message.hasOwnProperty("httpPort")) + object.httpPort = message.httpPort; + if (message.externalSecureTcpAddress != null && message.hasOwnProperty("externalSecureTcpAddress")) + object.externalSecureTcpAddress = message.externalSecureTcpAddress; + if (message.externalSecureTcpPort != null && message.hasOwnProperty("externalSecureTcpPort")) + object.externalSecureTcpPort = message.externalSecureTcpPort; + return object; + }; + + /** + * Converts this LeaderInfo to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo + * @instance + * @returns {Object.} JSON object + */ + LeaderInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LeaderInfo + * @function getTypeUrl + * @memberof EventStore.Client.Messages.NotHandled.LeaderInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LeaderInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.NotHandled.LeaderInfo"; + }; + + return LeaderInfo; + })(); + + return NotHandled; + })(); + + Messages.ScavengeDatabase = (function() { + + /** + * Properties of a ScavengeDatabase. + * @memberof EventStore.Client.Messages + * @interface IScavengeDatabase + */ + + /** + * Constructs a new ScavengeDatabase. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ScavengeDatabase. + * @implements IScavengeDatabase + * @constructor + * @param {EventStore.Client.Messages.IScavengeDatabase=} [properties] Properties to set + */ + function ScavengeDatabase(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new ScavengeDatabase instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ScavengeDatabase + * @static + * @param {EventStore.Client.Messages.IScavengeDatabase=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ScavengeDatabase} ScavengeDatabase instance + */ + ScavengeDatabase.create = function create(properties) { + return new ScavengeDatabase(properties); + }; + + /** + * Encodes the specified ScavengeDatabase message. Does not implicitly {@link EventStore.Client.Messages.ScavengeDatabase.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ScavengeDatabase + * @static + * @param {EventStore.Client.Messages.IScavengeDatabase} message ScavengeDatabase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScavengeDatabase.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified ScavengeDatabase message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ScavengeDatabase.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ScavengeDatabase + * @static + * @param {EventStore.Client.Messages.IScavengeDatabase} message ScavengeDatabase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScavengeDatabase.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ScavengeDatabase message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ScavengeDatabase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ScavengeDatabase} ScavengeDatabase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScavengeDatabase.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ScavengeDatabase(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ScavengeDatabase message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ScavengeDatabase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ScavengeDatabase} ScavengeDatabase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScavengeDatabase.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ScavengeDatabase message. + * @function verify + * @memberof EventStore.Client.Messages.ScavengeDatabase + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ScavengeDatabase.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a ScavengeDatabase message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ScavengeDatabase + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ScavengeDatabase} ScavengeDatabase + */ + ScavengeDatabase.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ScavengeDatabase) + return object; + return new $root.EventStore.Client.Messages.ScavengeDatabase(); + }; + + /** + * Creates a plain object from a ScavengeDatabase message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ScavengeDatabase + * @static + * @param {EventStore.Client.Messages.ScavengeDatabase} message ScavengeDatabase + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ScavengeDatabase.toObject = function toObject() { + return {}; + }; + + /** + * Converts this ScavengeDatabase to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ScavengeDatabase + * @instance + * @returns {Object.} JSON object + */ + ScavengeDatabase.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ScavengeDatabase + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ScavengeDatabase + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ScavengeDatabase.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ScavengeDatabase"; + }; + + return ScavengeDatabase; + })(); + + Messages.ScavengeDatabaseResponse = (function() { + + /** + * Properties of a ScavengeDatabaseResponse. + * @memberof EventStore.Client.Messages + * @interface IScavengeDatabaseResponse + * @property {EventStore.Client.Messages.ScavengeDatabaseResponse.ScavengeResult|null} [result] ScavengeDatabaseResponse result + * @property {string|null} [scavengeId] ScavengeDatabaseResponse scavengeId + */ + + /** + * Constructs a new ScavengeDatabaseResponse. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ScavengeDatabaseResponse. + * @implements IScavengeDatabaseResponse + * @constructor + * @param {EventStore.Client.Messages.IScavengeDatabaseResponse=} [properties] Properties to set + */ + function ScavengeDatabaseResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ScavengeDatabaseResponse result. + * @member {EventStore.Client.Messages.ScavengeDatabaseResponse.ScavengeResult} result + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @instance + */ + ScavengeDatabaseResponse.prototype.result = 0; + + /** + * ScavengeDatabaseResponse scavengeId. + * @member {string} scavengeId + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @instance + */ + ScavengeDatabaseResponse.prototype.scavengeId = ""; + + /** + * Creates a new ScavengeDatabaseResponse instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @static + * @param {EventStore.Client.Messages.IScavengeDatabaseResponse=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ScavengeDatabaseResponse} ScavengeDatabaseResponse instance + */ + ScavengeDatabaseResponse.create = function create(properties) { + return new ScavengeDatabaseResponse(properties); + }; + + /** + * Encodes the specified ScavengeDatabaseResponse message. Does not implicitly {@link EventStore.Client.Messages.ScavengeDatabaseResponse.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @static + * @param {EventStore.Client.Messages.IScavengeDatabaseResponse} message ScavengeDatabaseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScavengeDatabaseResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); + if (message.scavengeId != null && Object.hasOwnProperty.call(message, "scavengeId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.scavengeId); + return writer; + }; + + /** + * Encodes the specified ScavengeDatabaseResponse message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ScavengeDatabaseResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @static + * @param {EventStore.Client.Messages.IScavengeDatabaseResponse} message ScavengeDatabaseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScavengeDatabaseResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ScavengeDatabaseResponse message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ScavengeDatabaseResponse} ScavengeDatabaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScavengeDatabaseResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ScavengeDatabaseResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.result = reader.int32(); + break; + } + case 2: { + message.scavengeId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ScavengeDatabaseResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ScavengeDatabaseResponse} ScavengeDatabaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScavengeDatabaseResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ScavengeDatabaseResponse message. + * @function verify + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ScavengeDatabaseResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.result != null && message.hasOwnProperty("result")) switch (message.result) { default: return "result: enum value expected"; @@ -14259,528 +14248,527 @@ case 2: break; } - if (message.scavengeId != null && message.hasOwnProperty("scavengeId")) - if (!$util.isString(message.scavengeId)) - return "scavengeId: string expected"; - return null; - }; + if (message.scavengeId != null && message.hasOwnProperty("scavengeId")) + if (!$util.isString(message.scavengeId)) + return "scavengeId: string expected"; + return null; + }; - /** - * Creates a ScavengeDatabaseResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ScavengeDatabaseResponse} ScavengeDatabaseResponse - */ - ScavengeDatabaseResponse.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ScavengeDatabaseResponse) - return object; - var message = new $root.EventStore.Client.Messages.ScavengeDatabaseResponse(); - switch (object.result) { - default: - if (typeof object.result === "number") { - message.result = object.result; - break; - } - break; - case "Started": - case 0: - message.result = 0; - break; - case "InProgress": - case 1: - message.result = 1; - break; - case "Unauthorized": - case 2: - message.result = 2; - break; - } - if (object.scavengeId != null) - message.scavengeId = String(object.scavengeId); - return message; - }; - - /** - * Creates a plain object from a ScavengeDatabaseResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse - * @static - * @param {EventStore.Client.Messages.ScavengeDatabaseResponse} message ScavengeDatabaseResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ScavengeDatabaseResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.result = options.enums === String ? "Started" : 0; - object.scavengeId = ""; - } - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.EventStore.Client.Messages.ScavengeDatabaseResponse.ScavengeResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.ScavengeDatabaseResponse.ScavengeResult[message.result] : message.result; - if (message.scavengeId != null && message.hasOwnProperty("scavengeId")) - object.scavengeId = message.scavengeId; + /** + * Creates a ScavengeDatabaseResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ScavengeDatabaseResponse} ScavengeDatabaseResponse + */ + ScavengeDatabaseResponse.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ScavengeDatabaseResponse) return object; - }; - - /** - * Converts this ScavengeDatabaseResponse to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse - * @instance - * @returns {Object.} JSON object - */ - ScavengeDatabaseResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ScavengeDatabaseResponse - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ScavengeDatabaseResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + var message = new $root.EventStore.Client.Messages.ScavengeDatabaseResponse(); + switch (object.result) { + default: + if (typeof object.result === "number") { + message.result = object.result; + break; } - return typeUrlPrefix + "/EventStore.Client.Messages.ScavengeDatabaseResponse"; - }; - - /** - * ScavengeResult enum. - * @name EventStore.Client.Messages.ScavengeDatabaseResponse.ScavengeResult - * @enum {number} - * @property {number} Started=0 Started value - * @property {number} InProgress=1 InProgress value - * @property {number} Unauthorized=2 Unauthorized value - */ - ScavengeDatabaseResponse.ScavengeResult = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "Started"] = 0; - values[valuesById[1] = "InProgress"] = 1; - values[valuesById[2] = "Unauthorized"] = 2; - return values; - })(); - - return ScavengeDatabaseResponse; - })(); - - Messages.IdentifyClient = (function() { - - /** - * Properties of an IdentifyClient. - * @memberof EventStore.Client.Messages - * @interface IIdentifyClient - * @property {number} version IdentifyClient version - * @property {string|null} [connectionName] IdentifyClient connectionName - */ - - /** - * Constructs a new IdentifyClient. - * @memberof EventStore.Client.Messages - * @classdesc Represents an IdentifyClient. - * @implements IIdentifyClient - * @constructor - * @param {EventStore.Client.Messages.IIdentifyClient=} [properties] Properties to set - */ - function IdentifyClient(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + break; + case "Started": + case 0: + message.result = 0; + break; + case "InProgress": + case 1: + message.result = 1; + break; + case "Unauthorized": + case 2: + message.result = 2; + break; } + if (object.scavengeId != null) + message.scavengeId = String(object.scavengeId); + return message; + }; - /** - * IdentifyClient version. - * @member {number} version - * @memberof EventStore.Client.Messages.IdentifyClient - * @instance - */ - IdentifyClient.prototype.version = 0; - - /** - * IdentifyClient connectionName. - * @member {string} connectionName - * @memberof EventStore.Client.Messages.IdentifyClient - * @instance - */ - IdentifyClient.prototype.connectionName = ""; - - /** - * Creates a new IdentifyClient instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.IdentifyClient - * @static - * @param {EventStore.Client.Messages.IIdentifyClient=} [properties] Properties to set - * @returns {EventStore.Client.Messages.IdentifyClient} IdentifyClient instance - */ - IdentifyClient.create = function create(properties) { - return new IdentifyClient(properties); - }; - - /** - * Encodes the specified IdentifyClient message. Does not implicitly {@link EventStore.Client.Messages.IdentifyClient.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.IdentifyClient - * @static - * @param {EventStore.Client.Messages.IIdentifyClient} message IdentifyClient message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentifyClient.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.version); - if (message.connectionName != null && Object.hasOwnProperty.call(message, "connectionName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.connectionName); - return writer; - }; - - /** - * Encodes the specified IdentifyClient message, length delimited. Does not implicitly {@link EventStore.Client.Messages.IdentifyClient.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.IdentifyClient - * @static - * @param {EventStore.Client.Messages.IIdentifyClient} message IdentifyClient message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentifyClient.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IdentifyClient message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.IdentifyClient - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.IdentifyClient} IdentifyClient - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentifyClient.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.IdentifyClient(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.version = reader.int32(); - break; - } - case 2: { - message.connectionName = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("version")) - throw $util.ProtocolError("missing required 'version'", { instance: message }); - return message; - }; - - /** - * Decodes an IdentifyClient message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.IdentifyClient - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.IdentifyClient} IdentifyClient - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentifyClient.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IdentifyClient message. - * @function verify - * @memberof EventStore.Client.Messages.IdentifyClient - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IdentifyClient.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isInteger(message.version)) - return "version: integer expected"; - if (message.connectionName != null && message.hasOwnProperty("connectionName")) - if (!$util.isString(message.connectionName)) - return "connectionName: string expected"; - return null; - }; - - /** - * Creates an IdentifyClient message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.IdentifyClient - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.IdentifyClient} IdentifyClient - */ - IdentifyClient.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.IdentifyClient) - return object; - var message = new $root.EventStore.Client.Messages.IdentifyClient(); - if (object.version != null) - message.version = object.version | 0; - if (object.connectionName != null) - message.connectionName = String(object.connectionName); - return message; - }; - - /** - * Creates a plain object from an IdentifyClient message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.IdentifyClient - * @static - * @param {EventStore.Client.Messages.IdentifyClient} message IdentifyClient - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IdentifyClient.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.version = 0; - object.connectionName = ""; - } - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.connectionName != null && message.hasOwnProperty("connectionName")) - object.connectionName = message.connectionName; - return object; - }; - - /** - * Converts this IdentifyClient to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.IdentifyClient - * @instance - * @returns {Object.} JSON object - */ - IdentifyClient.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for IdentifyClient - * @function getTypeUrl - * @memberof EventStore.Client.Messages.IdentifyClient - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - IdentifyClient.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.IdentifyClient"; - }; - - return IdentifyClient; - })(); - - Messages.ClientIdentified = (function() { - - /** - * Properties of a ClientIdentified. - * @memberof EventStore.Client.Messages - * @interface IClientIdentified - */ - - /** - * Constructs a new ClientIdentified. - * @memberof EventStore.Client.Messages - * @classdesc Represents a ClientIdentified. - * @implements IClientIdentified - * @constructor - * @param {EventStore.Client.Messages.IClientIdentified=} [properties] Properties to set - */ - function ClientIdentified(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a ScavengeDatabaseResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @static + * @param {EventStore.Client.Messages.ScavengeDatabaseResponse} message ScavengeDatabaseResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ScavengeDatabaseResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.result = options.enums === String ? "Started" : 0; + object.scavengeId = ""; } + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.EventStore.Client.Messages.ScavengeDatabaseResponse.ScavengeResult[message.result] === undefined ? message.result : $root.EventStore.Client.Messages.ScavengeDatabaseResponse.ScavengeResult[message.result] : message.result; + if (message.scavengeId != null && message.hasOwnProperty("scavengeId")) + object.scavengeId = message.scavengeId; + return object; + }; - /** - * Creates a new ClientIdentified instance using the specified properties. - * @function create - * @memberof EventStore.Client.Messages.ClientIdentified - * @static - * @param {EventStore.Client.Messages.IClientIdentified=} [properties] Properties to set - * @returns {EventStore.Client.Messages.ClientIdentified} ClientIdentified instance - */ - ClientIdentified.create = function create(properties) { - return new ClientIdentified(properties); - }; + /** + * Converts this ScavengeDatabaseResponse to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @instance + * @returns {Object.} JSON object + */ + ScavengeDatabaseResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Encodes the specified ClientIdentified message. Does not implicitly {@link EventStore.Client.Messages.ClientIdentified.verify|verify} messages. - * @function encode - * @memberof EventStore.Client.Messages.ClientIdentified - * @static - * @param {EventStore.Client.Messages.IClientIdentified} message ClientIdentified message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientIdentified.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; + /** + * Gets the default type url for ScavengeDatabaseResponse + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ScavengeDatabaseResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ScavengeDatabaseResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ScavengeDatabaseResponse"; + }; - /** - * Encodes the specified ClientIdentified message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ClientIdentified.verify|verify} messages. - * @function encodeDelimited - * @memberof EventStore.Client.Messages.ClientIdentified - * @static - * @param {EventStore.Client.Messages.IClientIdentified} message ClientIdentified message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientIdentified.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ClientIdentified message from the specified reader or buffer. - * @function decode - * @memberof EventStore.Client.Messages.ClientIdentified - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {EventStore.Client.Messages.ClientIdentified} ClientIdentified - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientIdentified.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ClientIdentified(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ClientIdentified message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof EventStore.Client.Messages.ClientIdentified - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {EventStore.Client.Messages.ClientIdentified} ClientIdentified - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientIdentified.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ClientIdentified message. - * @function verify - * @memberof EventStore.Client.Messages.ClientIdentified - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClientIdentified.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a ClientIdentified message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof EventStore.Client.Messages.ClientIdentified - * @static - * @param {Object.} object Plain object - * @returns {EventStore.Client.Messages.ClientIdentified} ClientIdentified - */ - ClientIdentified.fromObject = function fromObject(object) { - if (object instanceof $root.EventStore.Client.Messages.ClientIdentified) - return object; - return new $root.EventStore.Client.Messages.ClientIdentified(); - }; - - /** - * Creates a plain object from a ClientIdentified message. Also converts values to other types if specified. - * @function toObject - * @memberof EventStore.Client.Messages.ClientIdentified - * @static - * @param {EventStore.Client.Messages.ClientIdentified} message ClientIdentified - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClientIdentified.toObject = function toObject() { - return {}; - }; - - /** - * Converts this ClientIdentified to JSON. - * @function toJSON - * @memberof EventStore.Client.Messages.ClientIdentified - * @instance - * @returns {Object.} JSON object - */ - ClientIdentified.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ClientIdentified - * @function getTypeUrl - * @memberof EventStore.Client.Messages.ClientIdentified - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ClientIdentified.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/EventStore.Client.Messages.ClientIdentified"; - }; - - return ClientIdentified; + /** + * ScavengeResult enum. + * @name EventStore.Client.Messages.ScavengeDatabaseResponse.ScavengeResult + * @enum {number} + * @property {number} Started=0 Started value + * @property {number} InProgress=1 InProgress value + * @property {number} Unauthorized=2 Unauthorized value + */ + ScavengeDatabaseResponse.ScavengeResult = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "Started"] = 0; + values[valuesById[1] = "InProgress"] = 1; + values[valuesById[2] = "Unauthorized"] = 2; + return values; })(); - return Messages; + return ScavengeDatabaseResponse; })(); - return Client; + Messages.IdentifyClient = (function() { + + /** + * Properties of an IdentifyClient. + * @memberof EventStore.Client.Messages + * @interface IIdentifyClient + * @property {number|null} [version] IdentifyClient version + * @property {string|null} [connectionName] IdentifyClient connectionName + */ + + /** + * Constructs a new IdentifyClient. + * @memberof EventStore.Client.Messages + * @classdesc Represents an IdentifyClient. + * @implements IIdentifyClient + * @constructor + * @param {EventStore.Client.Messages.IIdentifyClient=} [properties] Properties to set + */ + function IdentifyClient(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IdentifyClient version. + * @member {number} version + * @memberof EventStore.Client.Messages.IdentifyClient + * @instance + */ + IdentifyClient.prototype.version = 0; + + /** + * IdentifyClient connectionName. + * @member {string} connectionName + * @memberof EventStore.Client.Messages.IdentifyClient + * @instance + */ + IdentifyClient.prototype.connectionName = ""; + + /** + * Creates a new IdentifyClient instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.IdentifyClient + * @static + * @param {EventStore.Client.Messages.IIdentifyClient=} [properties] Properties to set + * @returns {EventStore.Client.Messages.IdentifyClient} IdentifyClient instance + */ + IdentifyClient.create = function create(properties) { + return new IdentifyClient(properties); + }; + + /** + * Encodes the specified IdentifyClient message. Does not implicitly {@link EventStore.Client.Messages.IdentifyClient.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.IdentifyClient + * @static + * @param {EventStore.Client.Messages.IIdentifyClient} message IdentifyClient message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentifyClient.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.version); + if (message.connectionName != null && Object.hasOwnProperty.call(message, "connectionName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.connectionName); + return writer; + }; + + /** + * Encodes the specified IdentifyClient message, length delimited. Does not implicitly {@link EventStore.Client.Messages.IdentifyClient.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.IdentifyClient + * @static + * @param {EventStore.Client.Messages.IIdentifyClient} message IdentifyClient message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentifyClient.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IdentifyClient message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.IdentifyClient + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.IdentifyClient} IdentifyClient + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentifyClient.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.IdentifyClient(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.version = reader.int32(); + break; + } + case 2: { + message.connectionName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IdentifyClient message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.IdentifyClient + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.IdentifyClient} IdentifyClient + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentifyClient.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IdentifyClient message. + * @function verify + * @memberof EventStore.Client.Messages.IdentifyClient + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IdentifyClient.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version)) + return "version: integer expected"; + if (message.connectionName != null && message.hasOwnProperty("connectionName")) + if (!$util.isString(message.connectionName)) + return "connectionName: string expected"; + return null; + }; + + /** + * Creates an IdentifyClient message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.IdentifyClient + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.IdentifyClient} IdentifyClient + */ + IdentifyClient.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.IdentifyClient) + return object; + var message = new $root.EventStore.Client.Messages.IdentifyClient(); + if (object.version != null) + message.version = object.version | 0; + if (object.connectionName != null) + message.connectionName = String(object.connectionName); + return message; + }; + + /** + * Creates a plain object from an IdentifyClient message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.IdentifyClient + * @static + * @param {EventStore.Client.Messages.IdentifyClient} message IdentifyClient + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IdentifyClient.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = 0; + object.connectionName = ""; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.connectionName != null && message.hasOwnProperty("connectionName")) + object.connectionName = message.connectionName; + return object; + }; + + /** + * Converts this IdentifyClient to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.IdentifyClient + * @instance + * @returns {Object.} JSON object + */ + IdentifyClient.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IdentifyClient + * @function getTypeUrl + * @memberof EventStore.Client.Messages.IdentifyClient + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IdentifyClient.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.IdentifyClient"; + }; + + return IdentifyClient; + })(); + + Messages.ClientIdentified = (function() { + + /** + * Properties of a ClientIdentified. + * @memberof EventStore.Client.Messages + * @interface IClientIdentified + */ + + /** + * Constructs a new ClientIdentified. + * @memberof EventStore.Client.Messages + * @classdesc Represents a ClientIdentified. + * @implements IClientIdentified + * @constructor + * @param {EventStore.Client.Messages.IClientIdentified=} [properties] Properties to set + */ + function ClientIdentified(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new ClientIdentified instance using the specified properties. + * @function create + * @memberof EventStore.Client.Messages.ClientIdentified + * @static + * @param {EventStore.Client.Messages.IClientIdentified=} [properties] Properties to set + * @returns {EventStore.Client.Messages.ClientIdentified} ClientIdentified instance + */ + ClientIdentified.create = function create(properties) { + return new ClientIdentified(properties); + }; + + /** + * Encodes the specified ClientIdentified message. Does not implicitly {@link EventStore.Client.Messages.ClientIdentified.verify|verify} messages. + * @function encode + * @memberof EventStore.Client.Messages.ClientIdentified + * @static + * @param {EventStore.Client.Messages.IClientIdentified} message ClientIdentified message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientIdentified.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified ClientIdentified message, length delimited. Does not implicitly {@link EventStore.Client.Messages.ClientIdentified.verify|verify} messages. + * @function encodeDelimited + * @memberof EventStore.Client.Messages.ClientIdentified + * @static + * @param {EventStore.Client.Messages.IClientIdentified} message ClientIdentified message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientIdentified.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientIdentified message from the specified reader or buffer. + * @function decode + * @memberof EventStore.Client.Messages.ClientIdentified + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {EventStore.Client.Messages.ClientIdentified} ClientIdentified + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientIdentified.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ClientIdentified(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientIdentified message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof EventStore.Client.Messages.ClientIdentified + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {EventStore.Client.Messages.ClientIdentified} ClientIdentified + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientIdentified.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientIdentified message. + * @function verify + * @memberof EventStore.Client.Messages.ClientIdentified + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientIdentified.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a ClientIdentified message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof EventStore.Client.Messages.ClientIdentified + * @static + * @param {Object.} object Plain object + * @returns {EventStore.Client.Messages.ClientIdentified} ClientIdentified + */ + ClientIdentified.fromObject = function fromObject(object) { + if (object instanceof $root.EventStore.Client.Messages.ClientIdentified) + return object; + return new $root.EventStore.Client.Messages.ClientIdentified(); + }; + + /** + * Creates a plain object from a ClientIdentified message. Also converts values to other types if specified. + * @function toObject + * @memberof EventStore.Client.Messages.ClientIdentified + * @static + * @param {EventStore.Client.Messages.ClientIdentified} message ClientIdentified + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientIdentified.toObject = function toObject() { + return {}; + }; + + /** + * Converts this ClientIdentified to JSON. + * @function toJSON + * @memberof EventStore.Client.Messages.ClientIdentified + * @instance + * @returns {Object.} JSON object + */ + ClientIdentified.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ClientIdentified + * @function getTypeUrl + * @memberof EventStore.Client.Messages.ClientIdentified + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ClientIdentified.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/EventStore.Client.Messages.ClientIdentified"; + }; + + return ClientIdentified; + })(); + + return Messages; })(); - return EventStore; + return Client; })(); - return $root; -}); + return EventStore; +})(); + +module.exports = $root; diff --git a/src/messages/messages.proto b/src/messages/messages.proto index 7c95448..a94dc2f 100644 --- a/src/messages/messages.proto +++ b/src/messages/messages.proto @@ -1,4 +1,4 @@ -syntax = "proto2"; +syntax = "proto3"; package EventStore.Client.Messages; @@ -15,115 +15,115 @@ enum OperationResult } message NewEvent { - required bytes event_id = 1; - required string event_type = 2; - required int32 data_content_type = 3; - required int32 metadata_content_type = 4; - required bytes data = 5; - optional bytes metadata = 6; + bytes event_id = 1; + string event_type = 2; + int32 data_content_type = 3; + int32 metadata_content_type = 4; + bytes data = 5; + bytes metadata = 6; } message EventRecord { - required string event_stream_id = 1; - required int64 event_number = 2; - required bytes event_id = 3; - required string event_type = 4; - required int32 data_content_type = 5; - required int32 metadata_content_type = 6; - required bytes data = 7; - optional bytes metadata = 8; - optional int64 created = 9; - optional int64 created_epoch = 10; + string event_stream_id = 1; + int64 event_number = 2; + bytes event_id = 3; + string event_type = 4; + int32 data_content_type = 5; + int32 metadata_content_type = 6; + bytes data = 7; + bytes metadata = 8; + int64 created = 9; + int64 created_epoch = 10; } message ResolvedIndexedEvent { - optional EventRecord event = 1; - optional EventRecord link = 2; + EventRecord event = 1; + EventRecord link = 2; } message ResolvedEvent { - optional EventRecord event = 1; - optional EventRecord link = 2; - required int64 commit_position = 3; - required int64 prepare_position = 4; + EventRecord event = 1; + EventRecord link = 2; + int64 commit_position = 3; + int64 prepare_position = 4; } message WriteEvents { - required string event_stream_id = 1; - required int64 expected_version = 2; + string event_stream_id = 1; + int64 expected_version = 2; repeated NewEvent events = 3; - required bool require_leader = 4; + bool require_leader = 4; } message WriteEventsCompleted { - required OperationResult result = 1; - optional string message = 2; - required int64 first_event_number = 3; - required int64 last_event_number = 4; - optional int64 prepare_position = 5; - optional int64 commit_position = 6; - optional int64 current_version = 7; + OperationResult result = 1; + string message = 2; + int64 first_event_number = 3; + int64 last_event_number = 4; + int64 prepare_position = 5; + int64 commit_position = 6; + int64 current_version = 7; } message DeleteStream { - required string event_stream_id = 1; - required int64 expected_version = 2; - required bool require_leader = 3; - optional bool hard_delete = 4; + string event_stream_id = 1; + int64 expected_version = 2; + bool require_leader = 3; + bool hard_delete = 4; } message DeleteStreamCompleted { - required OperationResult result = 1; - optional string message = 2; - optional int64 prepare_position = 3; - optional int64 commit_position = 4; - optional int64 current_version = 5; + OperationResult result = 1; + string message = 2; + int64 prepare_position = 3; + int64 commit_position = 4; + int64 current_version = 5; } message TransactionStart { - required string event_stream_id = 1; - required int64 expected_version = 2; - required bool require_leader = 3; + string event_stream_id = 1; + int64 expected_version = 2; + bool require_leader = 3; } message TransactionStartCompleted { - required int64 transaction_id = 1; - required OperationResult result = 2; - optional string message = 3; + int64 transaction_id = 1; + OperationResult result = 2; + string message = 3; } message TransactionWrite { - required int64 transaction_id = 1; + int64 transaction_id = 1; repeated NewEvent events = 2; - required bool require_leader = 3; + bool require_leader = 3; } message TransactionWriteCompleted { - required int64 transaction_id = 1; - required OperationResult result = 2; - optional string message = 3; + int64 transaction_id = 1; + OperationResult result = 2; + string message = 3; } message TransactionCommit { - required int64 transaction_id = 1; - required bool require_leader = 2; + int64 transaction_id = 1; + bool require_leader = 2; } message TransactionCommitCompleted { - required int64 transaction_id = 1; - required OperationResult result = 2; - optional string message = 3; - required int64 first_event_number = 4; - required int64 last_event_number = 5; - optional int64 prepare_position = 6; - optional int64 commit_position = 7; + int64 transaction_id = 1; + OperationResult result = 2; + string message = 3; + int64 first_event_number = 4; + int64 last_event_number = 5; + int64 prepare_position = 6; + int64 commit_position = 7; } message ReadEvent { - required string event_stream_id = 1; - required int64 event_number = 2; - required bool resolve_link_tos = 3; - required bool require_leader = 4; + string event_stream_id = 1; + int64 event_number = 2; + bool resolve_link_tos = 3; + bool require_leader = 4; } message ReadEventCompleted { @@ -137,18 +137,18 @@ message ReadEventCompleted { AccessDenied = 5; } - required ReadEventResult result = 1; - required ResolvedIndexedEvent event = 2; + ReadEventResult result = 1; + ResolvedIndexedEvent event = 2; - optional string error = 3; + string error = 3; } message ReadStreamEvents { - required string event_stream_id = 1; - required int64 from_event_number = 2; - required int32 max_count = 3; - required bool resolve_link_tos = 4; - required bool require_leader = 5; + string event_stream_id = 1; + int64 from_event_number = 2; + int32 max_count = 3; + bool resolve_link_tos = 4; + bool require_leader = 5; } message ReadStreamEventsCompleted { @@ -163,21 +163,21 @@ message ReadStreamEventsCompleted { } repeated ResolvedIndexedEvent events = 1; - required ReadStreamResult result = 2; - required int64 next_event_number = 3; - required int64 last_event_number = 4; - required bool is_end_of_stream = 5; - required int64 last_commit_position = 6; + ReadStreamResult result = 2; + int64 next_event_number = 3; + int64 last_event_number = 4; + bool is_end_of_stream = 5; + int64 last_commit_position = 6; - optional string error = 7; + string error = 7; } message ReadAllEvents { - required int64 commit_position = 1; - required int64 prepare_position = 2; - required int32 max_count = 3; - required bool resolve_link_tos = 4; - required bool require_leader = 5; + int64 commit_position = 1; + int64 prepare_position = 2; + int32 max_count = 3; + bool resolve_link_tos = 4; + bool require_leader = 5; } message ReadAllEventsCompleted { @@ -189,14 +189,14 @@ message ReadAllEventsCompleted { AccessDenied = 3; } - required int64 commit_position = 1; - required int64 prepare_position = 2; + int64 commit_position = 1; + int64 prepare_position = 2; repeated ResolvedEvent events = 3; - required int64 next_commit_position = 4; - required int64 next_prepare_position = 5; + int64 next_commit_position = 4; + int64 next_prepare_position = 5; - optional ReadAllResult result = 6 [default = Success]; - optional string error = 7; + ReadAllResult result = 6; + string error = 7; } message Filter{ @@ -212,19 +212,19 @@ message Filter{ Prefix = 1; } - required FilterContext context = 1; - required FilterType type = 2; - repeated string data = 3; + FilterContext context = 1; + FilterType type = 2; + repeated string data = 3; } message FilteredReadAllEvents { - required int64 commit_position = 1; - required int64 prepare_position = 2; - required int32 max_count = 3; - optional int32 max_search_window = 4; - required bool resolve_link_tos = 5; - required bool require_leader = 6; - required Filter filter = 7; + int64 commit_position = 1; + int64 prepare_position = 2; + int32 max_count = 3; + int32 max_search_window = 4; + bool resolve_link_tos = 5; + bool require_leader = 6; + Filter filter = 7; } message FilteredReadAllEventsCompleted { @@ -235,59 +235,59 @@ message FilteredReadAllEventsCompleted { Error = 2; AccessDenied = 3; } - - required int64 commit_position = 1; - required int64 prepare_position = 2; + + int64 commit_position = 1; + int64 prepare_position = 2; repeated ResolvedEvent events = 3; - required int64 next_commit_position = 4; - required int64 next_prepare_position = 5; - required bool is_end_of_stream = 6; + int64 next_commit_position = 4; + int64 next_prepare_position = 5; + bool is_end_of_stream = 6; - optional FilteredReadAllResult result = 7 [default = Success]; - optional string error = 8; + FilteredReadAllResult result = 7; + string error = 8; } message CreatePersistentSubscription { - required string subscription_group_name = 1; - required string event_stream_id = 2; - required bool resolve_link_tos = 3; - required int64 start_from = 4; - required int32 message_timeout_milliseconds = 5; - required bool record_statistics = 6; - required int32 live_buffer_size = 7; - required int32 read_batch_size = 8; - required int32 buffer_size = 9; - required int32 max_retry_count = 10; - required bool prefer_round_robin = 11; - required int32 checkpoint_after_time = 12; - required int32 checkpoint_max_count = 13; - required int32 checkpoint_min_count = 14; - required int32 subscriber_max_count = 15; - optional string named_consumer_strategy = 16; + string subscription_group_name = 1; + string event_stream_id = 2; + bool resolve_link_tos = 3; + int64 start_from = 4; + int32 message_timeout_milliseconds = 5; + bool record_statistics = 6; + int32 live_buffer_size = 7; + int32 read_batch_size = 8; + int32 buffer_size = 9; + int32 max_retry_count = 10; + bool prefer_round_robin = 11; + int32 checkpoint_after_time = 12; + int32 checkpoint_max_count = 13; + int32 checkpoint_min_count = 14; + int32 subscriber_max_count = 15; + string named_consumer_strategy = 16; } message DeletePersistentSubscription { - required string subscription_group_name = 1; - required string event_stream_id = 2; + string subscription_group_name = 1; + string event_stream_id = 2; } message UpdatePersistentSubscription { - required string subscription_group_name = 1; - required string event_stream_id = 2; - required bool resolve_link_tos = 3; - required int64 start_from = 4; - required int32 message_timeout_milliseconds = 5; - required bool record_statistics = 6; - required int32 live_buffer_size = 7; - required int32 read_batch_size = 8; - required int32 buffer_size = 9; - required int32 max_retry_count = 10; - required bool prefer_round_robin = 11; - required int32 checkpoint_after_time = 12; - required int32 checkpoint_max_count = 13; - required int32 checkpoint_min_count = 14; - required int32 subscriber_max_count = 15; - optional string named_consumer_strategy = 16; + string subscription_group_name = 1; + string event_stream_id = 2; + bool resolve_link_tos = 3; + int64 start_from = 4; + int32 message_timeout_milliseconds = 5; + bool record_statistics = 6; + int32 live_buffer_size = 7; + int32 read_batch_size = 8; + int32 buffer_size = 9; + int32 max_retry_count = 10; + bool prefer_round_robin = 11; + int32 checkpoint_after_time = 12; + int32 checkpoint_max_count = 13; + int32 checkpoint_min_count = 14; + int32 subscriber_max_count = 15; + string named_consumer_strategy = 16; } message UpdatePersistentSubscriptionCompleted { @@ -297,8 +297,8 @@ message UpdatePersistentSubscriptionCompleted { Fail = 2; AccessDenied=3; } - required UpdatePersistentSubscriptionResult result = 1 [default = Success]; - optional string reason = 2; + UpdatePersistentSubscriptionResult result = 1; + string reason = 2; } message CreatePersistentSubscriptionCompleted { @@ -308,8 +308,8 @@ message CreatePersistentSubscriptionCompleted { Fail = 2; AccessDenied=3; } - required CreatePersistentSubscriptionResult result = 1 [default = Success]; - optional string reason = 2; + CreatePersistentSubscriptionResult result = 1; + string reason = 2; } message DeletePersistentSubscriptionCompleted { @@ -319,19 +319,19 @@ message DeletePersistentSubscriptionCompleted { Fail = 2; AccessDenied = 3; } - required DeletePersistentSubscriptionResult result = 1 [default = Success]; - optional string reason = 2; + DeletePersistentSubscriptionResult result = 1; + string reason = 2; } message ConnectToPersistentSubscription { - required string subscription_id = 1; - required string event_stream_id = 2; - required int32 allowed_in_flight_messages = 3; + string subscription_id = 1; + string event_stream_id = 2; + int32 allowed_in_flight_messages = 3; } message PersistentSubscriptionAckEvents { - required string subscription_id = 1; + string subscription_id = 1; repeated bytes processed_event_ids = 2; } @@ -344,47 +344,47 @@ message PersistentSubscriptionNakEvents { Stop = 4; } - required string subscription_id = 1; + string subscription_id = 1; repeated bytes processed_event_ids = 2; - optional string message = 3; - required NakAction action = 4 [default = Unknown]; + string message = 3; + NakAction action = 4; } message PersistentSubscriptionConfirmation { - required int64 last_commit_position = 1; - required string subscription_id = 2; - optional int64 last_event_number = 3; + int64 last_commit_position = 1; + string subscription_id = 2; + int64 last_event_number = 3; } message PersistentSubscriptionStreamEventAppeared { - required ResolvedIndexedEvent event = 1; - optional int32 retryCount = 2; + ResolvedIndexedEvent event = 1; + int32 retryCount = 2; } message SubscribeToStream { - required string event_stream_id = 1; - required bool resolve_link_tos = 2; + string event_stream_id = 1; + bool resolve_link_tos = 2; } message FilteredSubscribeToStream { - required string event_stream_id = 1; - required bool resolve_link_tos = 2; - required Filter filter = 3; - required int32 checkpoint_interval = 4; + string event_stream_id = 1; + bool resolve_link_tos = 2; + Filter filter = 3; + int32 checkpoint_interval = 4; } message CheckpointReached { - required int64 commit_position = 1; - required int64 prepare_position = 2; + int64 commit_position = 1; + int64 prepare_position = 2; } message SubscriptionConfirmation { - required int64 last_commit_position = 1; - optional int64 last_event_number = 2; + int64 last_commit_position = 1; + int64 last_event_number = 2; } message StreamEventAppeared { - required ResolvedEvent event = 1; + ResolvedEvent event = 1; } message UnsubscribeFromStream { @@ -399,29 +399,29 @@ message SubscriptionDropped { PersistentSubscriptionDeleted=3; SubscriberMaxCountReached=4; } - - optional SubscriptionDropReason reason = 1 [default = Unsubscribed]; + + SubscriptionDropReason reason = 1; } message NotHandled { - + enum NotHandledReason { NotReady = 0; TooBusy = 1; NotLeader = 2; IsReadOnly = 3; } - - required NotHandledReason reason = 1; - optional bytes additional_info = 2; + + NotHandledReason reason = 1; + bytes additional_info = 2; message LeaderInfo { - optional string external_tcp_address = 1; - optional int32 external_tcp_port = 2; - required string http_address = 3; - required int32 http_port = 4; - optional string external_secure_tcp_address = 5; - optional int32 external_secure_tcp_port = 6; + string external_tcp_address = 1; + int32 external_tcp_port = 2; + string http_address = 3; + int32 http_port = 4; + string external_secure_tcp_address = 5; + int32 external_secure_tcp_port = 6; } } @@ -429,21 +429,21 @@ message ScavengeDatabase { } message ScavengeDatabaseResponse { - + enum ScavengeResult { Started = 0; InProgress = 1; Unauthorized = 2; } - - required ScavengeResult result = 1; - optional string scavengeId = 2; - + + ScavengeResult result = 1; + string scavengeId = 2; + } message IdentifyClient { - required int32 version = 1; - optional string connection_name = 2; + int32 version = 1; + string connection_name = 2; } message ClientIdentified {