A local-first note taking app
0

Configure Feed

Select the types of activity you want to include in your feed.

Integrate subtext

Ethan Graf (May 24, 2026, 12:26 AM EDT) 142218cd 8ed36d7b

+8273 -64
+443 -4
package-lock.json
··· 34 34 "lib0": "^0.2.117", 35 35 "libp2p": "^2.8.0", 36 36 "openid-client": "^6.8.4", 37 + "protobufjs": "^8.4.1", 37 38 "react": "^19.2.5", 38 39 "react-dom": "^19.2.5", 39 40 "react-router-dom": "^7.15.0", ··· 64 65 "eslint-plugin-import": "^2.32.0", 65 66 "prettier": "^3.8.3", 66 67 "prettier-plugin-tailwindcss": "^0.8.0", 68 + "protobufjs-cli": "^2.4.1", 67 69 "tailwindcss": "^4.2.4", 68 70 "typescript": "~6.0.3", 69 71 "vite": "^8.0.10", ··· 257 259 "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", 258 260 "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", 259 261 "license": "MIT", 260 - "peer": true, 261 262 "engines": { 262 263 "node": ">=6.9.0" 263 264 } ··· 267 268 "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", 268 269 "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", 269 270 "license": "MIT", 270 - "peer": true, 271 271 "engines": { 272 272 "node": ">=6.9.0" 273 273 } ··· 301 301 "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.3.tgz", 302 302 "integrity": "sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA==", 303 303 "license": "MIT", 304 - "peer": true, 305 304 "dependencies": { 306 305 "@babel/types": "^7.29.0" 307 306 }, ··· 361 360 "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", 362 361 "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", 363 362 "license": "MIT", 364 - "peer": true, 365 363 "dependencies": { 366 364 "@babel/helper-string-parser": "^7.27.1", 367 365 "@babel/helper-validator-identifier": "^7.28.5" ··· 2006 2004 "dependencies": { 2007 2005 "@jridgewell/resolve-uri": "^3.1.0", 2008 2006 "@jridgewell/sourcemap-codec": "^1.4.14" 2007 + } 2008 + }, 2009 + "node_modules/@jsdoc/salty": { 2010 + "version": "0.2.12", 2011 + "resolved": "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.12.tgz", 2012 + "integrity": "sha512-TuB0x50EoAvEX/UEWITd8Mkn3WhiTjSvbTMCLj0BhsQEl5iUzjXdA0bETEVpTk+5TGTLR6QktI9H4hLviVeaAQ==", 2013 + "dev": true, 2014 + "license": "Apache-2.0", 2015 + "dependencies": { 2016 + "lodash": "^4.18.1" 2017 + }, 2018 + "engines": { 2019 + "node": ">=v12.0.0" 2009 2020 } 2010 2021 }, 2011 2022 "node_modules/@leichtgewicht/ip-codec": { ··· 4563 4574 "@types/node": "*" 4564 4575 } 4565 4576 }, 4577 + "node_modules/@types/linkify-it": { 4578 + "version": "5.0.0", 4579 + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", 4580 + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", 4581 + "dev": true, 4582 + "license": "MIT" 4583 + }, 4584 + "node_modules/@types/markdown-it": { 4585 + "version": "14.1.2", 4586 + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", 4587 + "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", 4588 + "dev": true, 4589 + "license": "MIT", 4590 + "dependencies": { 4591 + "@types/linkify-it": "^5", 4592 + "@types/mdurl": "^2" 4593 + } 4594 + }, 4595 + "node_modules/@types/mdurl": { 4596 + "version": "2.0.0", 4597 + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", 4598 + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", 4599 + "dev": true, 4600 + "license": "MIT" 4601 + }, 4566 4602 "node_modules/@types/mute-stream": { 4567 4603 "version": "0.0.4", 4568 4604 "resolved": "https://registry.npmjs.org/@types/mute-stream/-/mute-stream-0.0.4.tgz", ··· 6423 6459 ], 6424 6460 "license": "CC-BY-4.0" 6425 6461 }, 6462 + "node_modules/catharsis": { 6463 + "version": "0.9.0", 6464 + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", 6465 + "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", 6466 + "dev": true, 6467 + "license": "MIT", 6468 + "dependencies": { 6469 + "lodash": "^4.17.15" 6470 + }, 6471 + "engines": { 6472 + "node": ">= 10" 6473 + } 6474 + }, 6426 6475 "node_modules/chai": { 6427 6476 "version": "6.2.2", 6428 6477 "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", ··· 7775 7824 "node": ">=10.13.0" 7776 7825 } 7777 7826 }, 7827 + "node_modules/entities": { 7828 + "version": "4.5.0", 7829 + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", 7830 + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", 7831 + "dev": true, 7832 + "license": "BSD-2-Clause", 7833 + "engines": { 7834 + "node": ">=0.12" 7835 + }, 7836 + "funding": { 7837 + "url": "https://github.com/fb55/entities?sponsor=1" 7838 + } 7839 + }, 7778 7840 "node_modules/env-paths": { 7779 7841 "version": "2.2.1", 7780 7842 "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", ··· 8002 8064 }, 8003 8065 "funding": { 8004 8066 "url": "https://github.com/sponsors/sindresorhus" 8067 + } 8068 + }, 8069 + "node_modules/escodegen": { 8070 + "version": "1.14.3", 8071 + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", 8072 + "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", 8073 + "dev": true, 8074 + "license": "BSD-2-Clause", 8075 + "dependencies": { 8076 + "esprima": "^4.0.1", 8077 + "estraverse": "^4.2.0", 8078 + "esutils": "^2.0.2", 8079 + "optionator": "^0.8.1" 8080 + }, 8081 + "bin": { 8082 + "escodegen": "bin/escodegen.js", 8083 + "esgenerate": "bin/esgenerate.js" 8084 + }, 8085 + "engines": { 8086 + "node": ">=4.0" 8087 + }, 8088 + "optionalDependencies": { 8089 + "source-map": "~0.6.1" 8090 + } 8091 + }, 8092 + "node_modules/escodegen/node_modules/levn": { 8093 + "version": "0.3.0", 8094 + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", 8095 + "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", 8096 + "dev": true, 8097 + "license": "MIT", 8098 + "dependencies": { 8099 + "prelude-ls": "~1.1.2", 8100 + "type-check": "~0.3.2" 8101 + }, 8102 + "engines": { 8103 + "node": ">= 0.8.0" 8104 + } 8105 + }, 8106 + "node_modules/escodegen/node_modules/optionator": { 8107 + "version": "0.8.3", 8108 + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", 8109 + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", 8110 + "dev": true, 8111 + "license": "MIT", 8112 + "dependencies": { 8113 + "deep-is": "~0.1.3", 8114 + "fast-levenshtein": "~2.0.6", 8115 + "levn": "~0.3.0", 8116 + "prelude-ls": "~1.1.2", 8117 + "type-check": "~0.3.2", 8118 + "word-wrap": "~1.2.3" 8119 + }, 8120 + "engines": { 8121 + "node": ">= 0.8.0" 8122 + } 8123 + }, 8124 + "node_modules/escodegen/node_modules/prelude-ls": { 8125 + "version": "1.1.2", 8126 + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", 8127 + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", 8128 + "dev": true, 8129 + "engines": { 8130 + "node": ">= 0.8.0" 8131 + } 8132 + }, 8133 + "node_modules/escodegen/node_modules/type-check": { 8134 + "version": "0.3.2", 8135 + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", 8136 + "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", 8137 + "dev": true, 8138 + "license": "MIT", 8139 + "dependencies": { 8140 + "prelude-ls": "~1.1.2" 8141 + }, 8142 + "engines": { 8143 + "node": ">= 0.8.0" 8005 8144 } 8006 8145 }, 8007 8146 "node_modules/eslint": { ··· 8348 8487 }, 8349 8488 "funding": { 8350 8489 "url": "https://opencollective.com/eslint" 8490 + } 8491 + }, 8492 + "node_modules/esprima": { 8493 + "version": "4.0.1", 8494 + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", 8495 + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", 8496 + "dev": true, 8497 + "license": "BSD-2-Clause", 8498 + "bin": { 8499 + "esparse": "bin/esparse.js", 8500 + "esvalidate": "bin/esvalidate.js" 8501 + }, 8502 + "engines": { 8503 + "node": ">=4" 8351 8504 } 8352 8505 }, 8353 8506 "node_modules/esquery": { ··· 10873 11026 "js-yaml": "bin/js-yaml.js" 10874 11027 } 10875 11028 }, 11029 + "node_modules/js2xmlparser": { 11030 + "version": "4.0.2", 11031 + "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", 11032 + "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", 11033 + "dev": true, 11034 + "license": "Apache-2.0", 11035 + "dependencies": { 11036 + "xmlcreate": "^2.0.4" 11037 + } 11038 + }, 10876 11039 "node_modules/jsc-safe-url": { 10877 11040 "version": "0.2.4", 10878 11041 "resolved": "https://registry.npmjs.org/jsc-safe-url/-/jsc-safe-url-0.2.4.tgz", 10879 11042 "integrity": "sha512-0wM3YBWtYePOjfyXQH5MWQ8H7sdk5EXSwZvmSLKk2RboVQ2Bu239jycHDz5J/8Blf3K0Qnoy2b6xD+z10MFB+Q==", 10880 11043 "license": "0BSD", 10881 11044 "peer": true 11045 + }, 11046 + "node_modules/jsdoc": { 11047 + "version": "4.0.5", 11048 + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.5.tgz", 11049 + "integrity": "sha512-P4C6MWP9yIlMiK8nwoZvxN84vb6MsnXcHuy7XzVOvQoCizWX5JFCBsWIIWKXBltpoRZXddUOVQmCTOZt9yDj9g==", 11050 + "dev": true, 11051 + "license": "Apache-2.0", 11052 + "dependencies": { 11053 + "@babel/parser": "^7.20.15", 11054 + "@jsdoc/salty": "^0.2.1", 11055 + "@types/markdown-it": "^14.1.1", 11056 + "bluebird": "^3.7.2", 11057 + "catharsis": "^0.9.0", 11058 + "escape-string-regexp": "^2.0.0", 11059 + "js2xmlparser": "^4.0.2", 11060 + "klaw": "^3.0.0", 11061 + "markdown-it": "^14.1.0", 11062 + "markdown-it-anchor": "^8.6.7", 11063 + "marked": "^4.0.10", 11064 + "mkdirp": "^1.0.4", 11065 + "requizzle": "^0.2.3", 11066 + "strip-json-comments": "^3.1.0", 11067 + "underscore": "~1.13.2" 11068 + }, 11069 + "bin": { 11070 + "jsdoc": "jsdoc.js" 11071 + }, 11072 + "engines": { 11073 + "node": ">=12.0.0" 11074 + } 11075 + }, 11076 + "node_modules/jsdoc/node_modules/escape-string-regexp": { 11077 + "version": "2.0.0", 11078 + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", 11079 + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", 11080 + "dev": true, 11081 + "license": "MIT", 11082 + "engines": { 11083 + "node": ">=8" 11084 + } 11085 + }, 11086 + "node_modules/jsdoc/node_modules/marked": { 11087 + "version": "4.3.0", 11088 + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", 11089 + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", 11090 + "dev": true, 11091 + "license": "MIT", 11092 + "bin": { 11093 + "marked": "bin/marked.js" 11094 + }, 11095 + "engines": { 11096 + "node": ">= 12" 11097 + } 10882 11098 }, 10883 11099 "node_modules/jsesc": { 10884 11100 "version": "3.1.0", ··· 10966 11182 "license": "MIT", 10967 11183 "dependencies": { 10968 11184 "json-buffer": "3.0.1" 11185 + } 11186 + }, 11187 + "node_modules/klaw": { 11188 + "version": "3.0.0", 11189 + "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", 11190 + "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", 11191 + "dev": true, 11192 + "license": "MIT", 11193 + "dependencies": { 11194 + "graceful-fs": "^4.1.9" 10969 11195 } 10970 11196 }, 10971 11197 "node_modules/leven": { ··· 11382 11608 "url": "https://opencollective.com/parcel" 11383 11609 } 11384 11610 }, 11611 + "node_modules/linkify-it": { 11612 + "version": "5.0.0", 11613 + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", 11614 + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", 11615 + "dev": true, 11616 + "license": "MIT", 11617 + "dependencies": { 11618 + "uc.micro": "^2.0.0" 11619 + } 11620 + }, 11385 11621 "node_modules/linkifyjs": { 11386 11622 "version": "4.3.3", 11387 11623 "resolved": "https://registry.npmjs.org/linkifyjs/-/linkifyjs-4.3.3.tgz", ··· 11547 11783 "url": "https://github.com/chalk/strip-ansi?sponsor=1" 11548 11784 } 11549 11785 }, 11786 + "node_modules/long": { 11787 + "version": "5.3.2", 11788 + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", 11789 + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", 11790 + "license": "Apache-2.0" 11791 + }, 11550 11792 "node_modules/loose-envify": { 11551 11793 "version": "1.4.0", 11552 11794 "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", ··· 11647 11889 "node": ">=6" 11648 11890 } 11649 11891 }, 11892 + "node_modules/markdown-it": { 11893 + "version": "14.1.1", 11894 + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.1.tgz", 11895 + "integrity": "sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==", 11896 + "dev": true, 11897 + "license": "MIT", 11898 + "dependencies": { 11899 + "argparse": "^2.0.1", 11900 + "entities": "^4.4.0", 11901 + "linkify-it": "^5.0.0", 11902 + "mdurl": "^2.0.0", 11903 + "punycode.js": "^2.3.1", 11904 + "uc.micro": "^2.1.0" 11905 + }, 11906 + "bin": { 11907 + "markdown-it": "bin/markdown-it.mjs" 11908 + } 11909 + }, 11910 + "node_modules/markdown-it-anchor": { 11911 + "version": "8.6.7", 11912 + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz", 11913 + "integrity": "sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==", 11914 + "dev": true, 11915 + "license": "Unlicense", 11916 + "peerDependencies": { 11917 + "@types/markdown-it": "*", 11918 + "markdown-it": "*" 11919 + } 11920 + }, 11650 11921 "node_modules/marked": { 11651 11922 "version": "17.0.6", 11652 11923 "resolved": "https://registry.npmjs.org/marked/-/marked-17.0.6.tgz", ··· 11689 11960 "engines": { 11690 11961 "node": ">= 0.4" 11691 11962 } 11963 + }, 11964 + "node_modules/mdurl": { 11965 + "version": "2.0.0", 11966 + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", 11967 + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", 11968 + "dev": true, 11969 + "license": "MIT" 11692 11970 }, 11693 11971 "node_modules/mem": { 11694 11972 "version": "4.3.0", ··· 13808 14086 "prosemirror-transform": "^1.1.0" 13809 14087 } 13810 14088 }, 14089 + "node_modules/protobufjs": { 14090 + "version": "8.4.1", 14091 + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-8.4.1.tgz", 14092 + "integrity": "sha512-oXf2UgIty8jnwfN4yvL1x79VLhL5uiKjZJbSGXGCIUmHmItTP4eS/UIlWDCeNx3seg+ujfn9vDlPMSrsh7wO+Q==", 14093 + "hasInstallScript": true, 14094 + "license": "BSD-3-Clause", 14095 + "dependencies": { 14096 + "long": "^5.3.2" 14097 + }, 14098 + "engines": { 14099 + "node": ">=12.0.0" 14100 + } 14101 + }, 14102 + "node_modules/protobufjs-cli": { 14103 + "version": "2.4.1", 14104 + "resolved": "https://registry.npmjs.org/protobufjs-cli/-/protobufjs-cli-2.4.1.tgz", 14105 + "integrity": "sha512-qOMpejPoLUcYZkcuzCZRKPen2yiDfvHPiZqvGC4YzO2XWawOMg/HuLWk5vfhlisLTQkUXsZuPJfXnOkh0ZkAfQ==", 14106 + "dev": true, 14107 + "license": "BSD-3-Clause", 14108 + "dependencies": { 14109 + "chalk": "^4.0.0", 14110 + "escodegen": "^1.13.0", 14111 + "espree": "^9.0.0", 14112 + "estraverse": "^5.1.0", 14113 + "glob": "^8.0.0", 14114 + "jsdoc": "^4.0.0", 14115 + "minimist": "^1.2.8", 14116 + "semver": "^7.1.2", 14117 + "tmp": "^0.2.1", 14118 + "uglify-js": "^3.7.7" 14119 + }, 14120 + "bin": { 14121 + "pbjs": "bin/pbjs", 14122 + "pbts": "bin/pbts", 14123 + "protoc-gen-pbjs": "bin/protoc-gen-pbjs" 14124 + }, 14125 + "engines": { 14126 + "node": ">=12.0.0" 14127 + }, 14128 + "peerDependencies": { 14129 + "protobufjs": "^8.4.1" 14130 + } 14131 + }, 14132 + "node_modules/protobufjs-cli/node_modules/brace-expansion": { 14133 + "version": "2.1.0", 14134 + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz", 14135 + "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==", 14136 + "dev": true, 14137 + "license": "MIT", 14138 + "dependencies": { 14139 + "balanced-match": "^1.0.0" 14140 + } 14141 + }, 14142 + "node_modules/protobufjs-cli/node_modules/estraverse": { 14143 + "version": "5.3.0", 14144 + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", 14145 + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", 14146 + "dev": true, 14147 + "license": "BSD-2-Clause", 14148 + "engines": { 14149 + "node": ">=4.0" 14150 + } 14151 + }, 14152 + "node_modules/protobufjs-cli/node_modules/glob": { 14153 + "version": "8.1.0", 14154 + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", 14155 + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", 14156 + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", 14157 + "dev": true, 14158 + "license": "ISC", 14159 + "dependencies": { 14160 + "fs.realpath": "^1.0.0", 14161 + "inflight": "^1.0.4", 14162 + "inherits": "2", 14163 + "minimatch": "^5.0.1", 14164 + "once": "^1.3.0" 14165 + }, 14166 + "engines": { 14167 + "node": ">=12" 14168 + }, 14169 + "funding": { 14170 + "url": "https://github.com/sponsors/isaacs" 14171 + } 14172 + }, 14173 + "node_modules/protobufjs-cli/node_modules/minimatch": { 14174 + "version": "5.1.9", 14175 + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz", 14176 + "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==", 14177 + "dev": true, 14178 + "license": "ISC", 14179 + "dependencies": { 14180 + "brace-expansion": "^2.0.1" 14181 + }, 14182 + "engines": { 14183 + "node": ">=10" 14184 + } 14185 + }, 14186 + "node_modules/protobufjs-cli/node_modules/tmp": { 14187 + "version": "0.2.5", 14188 + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", 14189 + "integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==", 14190 + "dev": true, 14191 + "license": "MIT", 14192 + "engines": { 14193 + "node": ">=14.14" 14194 + } 14195 + }, 13811 14196 "node_modules/protons-runtime": { 13812 14197 "version": "5.6.0", 13813 14198 "resolved": "https://registry.npmjs.org/protons-runtime/-/protons-runtime-5.6.0.tgz", ··· 13833 14218 "version": "2.3.1", 13834 14219 "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", 13835 14220 "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", 14221 + "dev": true, 14222 + "license": "MIT", 14223 + "engines": { 14224 + "node": ">=6" 14225 + } 14226 + }, 14227 + "node_modules/punycode.js": { 14228 + "version": "2.3.1", 14229 + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", 14230 + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", 13836 14231 "dev": true, 13837 14232 "license": "MIT", 13838 14233 "engines": { ··· 14413 14808 "license": "MIT", 14414 14809 "engines": { 14415 14810 "node": ">=0.10.0" 14811 + } 14812 + }, 14813 + "node_modules/requizzle": { 14814 + "version": "0.2.4", 14815 + "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.4.tgz", 14816 + "integrity": "sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==", 14817 + "dev": true, 14818 + "license": "MIT", 14819 + "dependencies": { 14820 + "lodash": "^4.17.21" 14416 14821 } 14417 14822 }, 14418 14823 "node_modules/resedit": { ··· 16202 16607 "node": ">=14.17" 16203 16608 } 16204 16609 }, 16610 + "node_modules/uc.micro": { 16611 + "version": "2.1.0", 16612 + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", 16613 + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", 16614 + "dev": true, 16615 + "license": "MIT" 16616 + }, 16617 + "node_modules/uglify-js": { 16618 + "version": "3.19.3", 16619 + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", 16620 + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", 16621 + "dev": true, 16622 + "license": "BSD-2-Clause", 16623 + "bin": { 16624 + "uglifyjs": "bin/uglifyjs" 16625 + }, 16626 + "engines": { 16627 + "node": ">=0.8.0" 16628 + } 16629 + }, 16205 16630 "node_modules/uint8-varint": { 16206 16631 "version": "2.0.5", 16207 16632 "resolved": "https://registry.npmjs.org/uint8-varint/-/uint8-varint-2.0.5.tgz", ··· 16248 16673 "funding": { 16249 16674 "url": "https://github.com/sponsors/ljharb" 16250 16675 } 16676 + }, 16677 + "node_modules/underscore": { 16678 + "version": "1.13.8", 16679 + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.8.tgz", 16680 + "integrity": "sha512-DXtD3ZtEQzc7M8m4cXotyHR+FAS18C64asBYY5vqZexfYryNNnDc02W4hKg3rdQuqOYas1jkseX0+nZXjTXnvQ==", 16681 + "dev": true, 16682 + "license": "MIT" 16251 16683 }, 16252 16684 "node_modules/undici-types": { 16253 16685 "version": "7.19.2", ··· 17046 17478 "engines": { 17047 17479 "node": ">=8.0" 17048 17480 } 17481 + }, 17482 + "node_modules/xmlcreate": { 17483 + "version": "2.0.4", 17484 + "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", 17485 + "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==", 17486 + "dev": true, 17487 + "license": "Apache-2.0" 17049 17488 }, 17050 17489 "node_modules/y-protocols": { 17051 17490 "version": "1.0.7",
+4 -1
package.json
··· 14 14 "format": "prettier --write .", 15 15 "format:check": "prettier --check .", 16 16 "test": "vitest run", 17 - "test:watch": "vitest" 17 + "test:watch": "vitest", 18 + "proto:gen": "pbjs -t static-module -w es6 -o src/subtext/proto.js ../subtext/proto/subtext_handlers.proto && pbts -o src/subtext/proto.d.ts src/subtext/proto.js" 18 19 }, 19 20 "keywords": [], 20 21 "author": "ethan", ··· 43 44 "eslint-plugin-import": "^2.32.0", 44 45 "prettier": "^3.8.3", 45 46 "prettier-plugin-tailwindcss": "^0.8.0", 47 + "protobufjs-cli": "^2.4.1", 46 48 "tailwindcss": "^4.2.4", 47 49 "typescript": "~6.0.3", 48 50 "vite": "^8.0.10", ··· 74 76 "lib0": "^0.2.117", 75 77 "libp2p": "^2.8.0", 76 78 "openid-client": "^6.8.4", 79 + "protobufjs": "^8.4.1", 77 80 "react": "^19.2.5", 78 81 "react-dom": "^19.2.5", 79 82 "react-router-dom": "^7.15.0",
+27 -4
src/App.tsx
··· 7 7 import { AppTitleBar } from './components/AppTitleBar'; 8 8 import { SettingsModal } from './components/SettingsModal'; 9 9 import { HabitatDocumentsProvider } from './documents/providers/habitatDocumentsProvider'; 10 + import { SubtextDocumentsProvider } from './documents/providers/subtextDocumentsProvider'; 10 11 import { HabitatFilesystemProvider } from './filesystem/providers/habitatFilesystemProvider'; 12 + import type { FileSystemProvider } from './filesystem/types'; 13 + import { SubtextFilesystemProvider } from './filesystem/providers/subtextFilesystemProvider'; 11 14 import { getRendererPlatform } from './lib/platform'; 12 15 import { AboutPage } from './pages/AboutPage'; 13 16 import { ··· 30 33 }); 31 34 32 35 const WORKSPACE_KIND_STORAGE_KEY = 'textile.workspaceKind'; 36 + const SUBTEXT_ENABLED_KEY = 'textile.subtext.enabled'; 37 + 38 + function isSubtextEnabled(): boolean { 39 + if (typeof localStorage === 'undefined') return false; 40 + try { 41 + return localStorage.getItem(SUBTEXT_ENABLED_KEY) === 'true'; 42 + } catch { 43 + return false; 44 + } 45 + } 33 46 34 47 function loadInitialWorkspaceKind(): WorkspaceKind { 35 48 if (typeof localStorage === 'undefined') return DEFAULT_WORKSPACE_KIND; ··· 54 67 const [openRequest, setOpenRequest] = useState<OpenDocRequest | null>(null); 55 68 const [openRequestId, setOpenRequestId] = useState(0); 56 69 57 - const fileSystemProviders = useMemo(() => { 58 - const habitatDocuments = new HabitatDocumentsProvider(); 59 - return [ 70 + const fileSystemProviders = useMemo<FileSystemProvider[]>(() => { 71 + const providers: FileSystemProvider[] = [ 60 72 new HabitatFilesystemProvider({ 61 - documents: habitatDocuments, 73 + documents: new HabitatDocumentsProvider(), 62 74 defaultEditorKind: 'yjs', 63 75 }), 64 76 ]; 77 + // TODO: When the Vault concept is introduced, each vault will choose its own 78 + // source; this conditional registration will move to per-vault configuration. 79 + if (isSubtextEnabled()) { 80 + providers.push( 81 + new SubtextFilesystemProvider({ 82 + documents: new SubtextDocumentsProvider(), 83 + defaultEditorKind: 'yjs', 84 + }), 85 + ); 86 + } 87 + return providers; 65 88 }, []); 66 89 const resolveProvider = useCallback( 67 90 (providerId: string) =>
+6
src/index.css
··· 10 10 --semantic-accent: oklch(0.52 0.17 260); 11 11 --semantic-border: oklch(0.9 0 0); 12 12 --semantic-destructive: oklch(0.52 0.2 27); 13 + --semantic-warning: oklch(0.55 0.16 70); 14 + --semantic-warning-bg: oklch(0.95 0.04 90); 13 15 } 14 16 15 17 :root[data-theme='dark'] { ··· 20 22 --semantic-accent: oklch(0.72 0.14 260); 21 23 --semantic-border: oklch(0.32 0.02 260); 22 24 --semantic-destructive: oklch(0.7 0.16 27); 25 + --semantic-warning: oklch(0.78 0.12 70); 26 + --semantic-warning-bg: oklch(0.25 0.03 70); 23 27 } 24 28 25 29 @theme { ··· 30 34 --color-accent: var(--semantic-accent); 31 35 --color-border: var(--semantic-border); 32 36 --color-destructive: var(--semantic-destructive); 37 + --color-warning: var(--semantic-warning); 38 + --color-warning-bg: var(--semantic-warning-bg); 33 39 } 34 40 35 41 @layer base {
+31
src/main.ts
··· 1 1 import { app, BrowserWindow, Menu, ipcMain } from 'electron'; 2 + import { SubtextTCPClient } from './subtext/tcpClient'; 2 3 import path from 'node:path'; 3 4 import started from 'electron-squirrel-startup'; 4 5 ··· 267 268 registerAppProtocol(); 268 269 installApplicationMenu(); 269 270 createWindow(); 271 + }); 272 + 273 + const subtextClient = new SubtextTCPClient(); 274 + 275 + ipcMain.handle('subtext:get-full-state', async (_event, { vaultPath }) => { 276 + return subtextClient.getFullState(vaultPath); 277 + }); 278 + 279 + ipcMain.handle('subtext:apply-update', async (_event, { vaultPath, update }) => { 280 + return subtextClient.applyUpdate(vaultPath, update); 281 + }); 282 + 283 + ipcMain.handle('subtext:list-files', async () => { 284 + return subtextClient.listFiles(); 285 + }); 286 + 287 + ipcMain.handle('subtext:file-exists', async (_event, { vaultPath }) => { 288 + return subtextClient.fileExists(vaultPath); 289 + }); 290 + 291 + ipcMain.handle('subtext:create-file', async (_event, { vaultPath, initialState }) => { 292 + return subtextClient.createFile(vaultPath, initialState); 293 + }); 294 + 295 + ipcMain.handle('subtext:rename-file', async (_event, { oldVaultPath, newVaultPath }) => { 296 + return subtextClient.renameFile(oldVaultPath, newVaultPath); 297 + }); 298 + 299 + ipcMain.handle('subtext:status', async () => { 300 + return { connected: subtextClient.isConnected }; 270 301 }); 271 302 272 303 ipcMain.handle(
+14
src/preload.ts
··· 9 9 }, 10 10 startHabitatLogin: (url: string, redirectUri: string) => 11 11 ipcRenderer.invoke('auth:start-habitat-login', { redirectUri, url }), 12 + subtext: { 13 + getFullState: (vaultPath: string) => 14 + ipcRenderer.invoke('subtext:get-full-state', { vaultPath }), 15 + applyUpdate: (vaultPath: string, update: Uint8Array) => 16 + ipcRenderer.invoke('subtext:apply-update', { vaultPath, update }), 17 + listFiles: () => ipcRenderer.invoke('subtext:list-files'), 18 + fileExists: (vaultPath: string) => 19 + ipcRenderer.invoke('subtext:file-exists', { vaultPath }), 20 + createFile: (vaultPath: string, initialState: Uint8Array) => 21 + ipcRenderer.invoke('subtext:create-file', { vaultPath, initialState }), 22 + renameFile: (oldVaultPath: string, newVaultPath: string) => 23 + ipcRenderer.invoke('subtext:rename-file', { oldVaultPath, newVaultPath }), 24 + status: () => ipcRenderer.invoke('subtext:status'), 25 + }, 12 26 });
+9
src/vite-env.d.ts
··· 6 6 platform: NodeJS.Platform; 7 7 onOpenSettings: (callback: () => void) => () => void; 8 8 startHabitatLogin: (url: string, redirectUri: string) => Promise<string>; 9 + subtext: { 10 + getFullState: (vaultPath: string) => Promise<Uint8Array | null>; 11 + applyUpdate: (vaultPath: string, update: Uint8Array) => Promise<void>; 12 + listFiles: () => Promise<string[]>; 13 + fileExists: (vaultPath: string) => Promise<boolean>; 14 + createFile: (vaultPath: string, initialState: Uint8Array) => Promise<void>; 15 + renameFile: (oldVaultPath: string, newVaultPath: string) => Promise<void>; 16 + status: () => Promise<{ connected: boolean }>; 17 + }; 9 18 }; 10 19 } 11 20 }
+10 -52
src/components/AppSidebar.tsx
··· 1 1 import { useCallback, useEffect, useMemo, useState } from 'react'; 2 2 import { useQuery, useQueryClient } from '@tanstack/react-query'; 3 3 import type { FileSystemEntry, FileSystemProvider } from '../filesystem/types'; 4 + import { DocFileIcon, SubtextIcon, NewDocumentIcon } from '../icons'; 4 5 import type { OpenDocRequest } from '../workspaces/workspace'; 5 6 6 7 type AppSidebarProps = { ··· 11 12 }; 12 13 13 14 type Selection = { providerId: string; entryId: string } | null; 14 - 15 - function DocFileIcon({ className }: { className?: string }) { 16 - return ( 17 - <svg 18 - className={className} 19 - viewBox="0 0 24 24" 20 - fill="none" 21 - stroke="currentColor" 22 - strokeWidth="2" 23 - strokeLinecap="round" 24 - strokeLinejoin="round" 25 - aria-hidden 26 - > 27 - <path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" /> 28 - <path d="M14 2v6h6" /> 29 - </svg> 30 - ); 31 - } 32 - 33 - /** File with pencil (lucide-style), for "new document". */ 34 - function NewDocumentIcon({ className }: { className?: string }) { 35 - return ( 36 - <svg 37 - className={className} 38 - viewBox="0 0 24 24" 39 - fill="none" 40 - stroke="currentColor" 41 - strokeWidth="2" 42 - strokeLinecap="round" 43 - strokeLinejoin="round" 44 - aria-hidden 45 - > 46 - {/* Document with folded corner */} 47 - <path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5Z" /> 48 - <polyline points="14 2 14 8 20 8" /> 49 - {/* Pencil diagonal on the page: eraser upper-right, tip lower-left. 50 - Axis runs from (15,12) to (9,18); perpendicular is (1,1)/√2. 51 - Shaft half-width 1.5; tip 2.5 units before the point. */} 52 - <polygon points="14,11 16,13 12,17 9,18 10,15" /> 53 - {/* Ferrule line, perpendicular to axis, spanning shaft edge-to-edge */} 54 - <line x1="14.5" y1="14.5" x2="12.5" y2="12.5" /> 55 - </svg> 56 - ); 57 - } 58 15 59 16 function filesQueryKey(providerId: string) { 60 17 return ['files', providerId] as const; ··· 129 86 'Connect an account in Settings (⌘,) to see files here.'; 130 87 131 88 return ( 132 - <section className="flex min-h-0 min-w-0 flex-1 flex-col gap-1"> 133 - <h2 className="text-foreground/80 shrink-0 text-xs font-semibold tracking-wide uppercase"> 89 + <section className="min-w-0"> 90 + <h2 className="text-foreground/80 mb-1 text-xs font-semibold tracking-wide uppercase"> 134 91 {provider.displayName} 135 92 </h2> 136 - <div className="flex min-h-0 flex-1 flex-col gap-0.5"> 93 + <div className="flex flex-col gap-0.5"> 137 94 {!provider.isReady() ? ( 138 95 <p className="text-foreground/60 px-2 text-xs leading-snug"> 139 96 {idleCopy} ··· 151 108 No files. 152 109 </p> 153 110 ) : ( 154 - <div 155 - role="list" 156 - className="flex min-h-0 flex-1 flex-col gap-0.5" 157 - > 111 + <div role="list" className="flex flex-col gap-0.5"> 158 112 {entries.map((entry) => { 159 113 const isSelected = 160 114 selection?.providerId === provider.id && ··· 279 233 onClick={() => void handleCreate(provider)} 280 234 className="text-foreground hover:bg-border/40 focus-visible:ring-accent/50 cursor-pointer rounded-md p-1.5 outline-none focus-visible:ring-2 disabled:opacity-50" 281 235 > 282 - <NewDocumentIcon className="size-4 shrink-0" /> 236 + {provider.id === 'subtext' ? ( 237 + <SubtextIcon className="size-4 shrink-0" /> 238 + ) : ( 239 + <NewDocumentIcon className="size-4 shrink-0" /> 240 + )} 283 241 </button> 284 242 ); 285 243 })}
+59 -1
src/components/SettingsModal.tsx
··· 1 1 import { useState, type ReactNode } from 'react'; 2 2 import { LOGIN_NAME, useHabitatAuth } from '../auth/habitatAuth'; 3 + import { SubtextIcon } from '../icons'; 3 4 import { 4 5 WORKSPACE_DESCRIPTORS, 5 6 type WorkspaceKind, ··· 16 17 onWorkspaceKindChange: (kind: WorkspaceKind) => void; 17 18 }; 18 19 19 - type SettingsCategory = 'atmosphere' | 'appearance'; 20 + type SettingsCategory = 'atmosphere' | 'appearance' | 'subtext'; 20 21 21 22 function AtmosphereAccountPane() { 22 23 const { authInfo, login, logout } = useHabitatAuth(); ··· 168 169 ); 169 170 } 170 171 172 + 173 + 174 + function SubtextSettingsPane() { 175 + const [enabled, setEnabled] = useState(() => { 176 + if (typeof localStorage === 'undefined') return false; 177 + return localStorage.getItem('textile.subtext.enabled') === 'true'; 178 + }); 179 + 180 + const toggle = () => { 181 + const next = !enabled; 182 + setEnabled(next); 183 + if (typeof localStorage !== 'undefined') { 184 + localStorage.setItem('textile.subtext.enabled', String(next)); 185 + } 186 + }; 187 + 188 + return ( 189 + <div className="space-y-4"> 190 + <div className="bg-warning-bg border-border space-y-2 rounded-md border p-3 text-sm"> 191 + <p className="text-warning font-medium"> 192 + Experimental Feature 193 + </p> 194 + <p className="text-warning"> 195 + Subtext is an experimental local-first cache. Files stored in Subtext 196 + are read-only when opened with external editors. Edits made outside 197 + Textile will not be saved. 198 + </p> 199 + </div> 200 + 201 + <SettingsPaneSection title="Enable Subtext"> 202 + <button 203 + type="button" 204 + onClick={toggle} 205 + role="switch" 206 + aria-checked={enabled} 207 + className="border-border bg-background hover:bg-border/20 inline-flex h-8 w-16 items-center rounded-full border px-1 transition-colors" 208 + > 209 + <span 210 + className={`bg-foreground text-background inline-flex size-6 items-center justify-center rounded-full transition-transform duration-500 ease-in-out ${enabled ? 'translate-x-8' : 'translate-x-0'}`} 211 + /> 212 + </button> 213 + </SettingsPaneSection> 214 + 215 + <p className="text-foreground/60 text-xs"> 216 + Subtext daemon address: 127.0.0.1:8081 217 + </p> 218 + </div> 219 + ); 220 + } 221 + 171 222 export function SettingsModal({ 172 223 open, 173 224 onClose, ··· 192 243 id: 'appearance', 193 244 label: 'Appearance', 194 245 icon: <AppearanceIcon />, 246 + }, 247 + { 248 + id: 'subtext', 249 + label: 'Subtext', 250 + icon: <SubtextIcon className="size-4" />, 195 251 }, 196 252 ]; 197 253 ··· 226 282 > 227 283 {selectedCategory === 'atmosphere' ? ( 228 284 <AtmosphereAccountPane /> 285 + ) : selectedCategory === 'subtext' ? ( 286 + <SubtextSettingsPane /> 229 287 ) : ( 230 288 <div className="space-y-4"> 231 289 <SettingsPaneSection title="Theme">
+5 -2
src/habitat/docSession.ts
··· 233 233 * with a `DocSession` whose `ydoc` is the canonical instance for `uri`; the 234 234 * first load resolves in the background and updates the ydoc in place. 235 235 */ 236 - export function acquireDocSession(uri: string): DocSession { 236 + export function acquireDocSession( 237 + uri: string, 238 + options?: { initialYdoc?: Y.Doc }, 239 + ): DocSession { 237 240 ensureVisibilityListener(); 238 241 let entry = ydocRegistry.get(uri); 239 242 if (!entry) { 240 - const ydoc = new Y.Doc(); 243 + const ydoc = options?.initialYdoc ?? new Y.Doc(); 241 244 entry = { 242 245 uri, 243 246 ydoc,
+69
src/icons/index.tsx
··· 1 + /** 2 + * Shared SVG icons used across the app. 3 + * 4 + * All icons accept `className` for sizing/coloring via Tailwind and use 5 + * `currentColor` for stroke so they inherit the parent's text color. 6 + */ 7 + 8 + type IconProps = { className?: string }; 9 + 10 + /** Generic document icon (lucide file). */ 11 + export function DocFileIcon({ className }: IconProps) { 12 + return ( 13 + <svg 14 + className={className} 15 + viewBox="0 0 24 24" 16 + fill="none" 17 + stroke="currentColor" 18 + strokeWidth="2" 19 + strokeLinecap="round" 20 + strokeLinejoin="round" 21 + aria-hidden 22 + > 23 + <path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" /> 24 + <path d="M14 2v6h6" /> 25 + </svg> 26 + ); 27 + } 28 + 29 + /** Document with pencil (lucide-style), for "new document" actions. */ 30 + export function NewDocumentIcon({ className }: IconProps) { 31 + return ( 32 + <svg 33 + className={className} 34 + viewBox="0 0 24 24" 35 + fill="none" 36 + stroke="currentColor" 37 + strokeWidth="2" 38 + strokeLinecap="round" 39 + strokeLinejoin="round" 40 + aria-hidden 41 + > 42 + <path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5Z" /> 43 + <polyline points="14 2 14 8 20 8" /> 44 + <polygon points="14,11 16,13 12,17 9,18 10,15" /> 45 + <line x1="14.5" y1="14.5" x2="12.5" y2="12.5" /> 46 + </svg> 47 + ); 48 + } 49 + 50 + /** Subtext logo: document with upward arrow (file-upload style). */ 51 + export function SubtextIcon({ className }: IconProps) { 52 + return ( 53 + <svg 54 + className={className} 55 + viewBox="0 0 24 24" 56 + fill="none" 57 + stroke="currentColor" 58 + strokeWidth="2" 59 + strokeLinecap="round" 60 + strokeLinejoin="round" 61 + aria-hidden 62 + > 63 + <path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" /> 64 + <path d="M14 2v6h6" /> 65 + <path d="M12 18v-6" /> 66 + <path d="M9 15l3-3 3 3" /> 67 + </svg> 68 + ); 69 + }
+93
src/subtext/cache.ts
··· 1 + /** 2 + * Subtext cache operations (renderer-side). 3 + * 4 + * Bridges the renderer's Yjs documents with the Subtext local CRDT store via 5 + * the IPC-exposed TCP client. 6 + * 7 + * All functions below accept a `vaultPath` directly; there is no URI→vaultPath 8 + * mapping layer at this time. 9 + */ 10 + 11 + import * as Y from 'yjs'; 12 + 13 + const IPC_TIMEOUT_MS = 5000; 14 + 15 + async function ipcCall<T>(method: string, ...args: unknown[]): Promise<T> { 16 + if (!window.textile?.subtext) { 17 + throw new Error('subtext IPC not available'); 18 + } 19 + const fn = window.textile.subtext[method as keyof typeof window.textile.subtext]; 20 + if (typeof fn !== 'function') { 21 + throw new Error(`unknown subtext IPC method: ${method}`); 22 + } 23 + return Promise.race([ 24 + (fn as (...args: unknown[]) => Promise<T>)(...args), 25 + new Promise<T>((_, reject) => 26 + setTimeout(() => reject(new Error('subtext IPC timeout')), IPC_TIMEOUT_MS), 27 + ), 28 + ]); 29 + } 30 + 31 + /** Try to seed an existing Y.Doc from Subtext's local cache. Returns true if seeded. */ 32 + export async function seedYdocFromSubtext(vaultPath: string, ydoc: Y.Doc): Promise<boolean> { 33 + try { 34 + const bytes = (await ipcCall<Uint8Array | null>('getFullState', vaultPath)) as Uint8Array | null; 35 + if (bytes && bytes.length > 0) { 36 + Y.applyUpdateV2(ydoc, bytes); 37 + return true; 38 + } 39 + } catch (e) { 40 + console.warn('[subtext] seed failed for', vaultPath, e); 41 + } 42 + return false; 43 + } 44 + 45 + /** Push the full Yjs state of a document to Subtext (overwrite local cache). */ 46 + export async function pushYdocToSubtext(vaultPath: string, ydoc: Y.Doc): Promise<void> { 47 + const bytes = Y.encodeStateAsUpdateV2(ydoc); 48 + try { 49 + await ipcCall('applyUpdate', vaultPath, bytes); 50 + } catch (e) { 51 + console.warn('[subtext] push failed for', vaultPath, e); 52 + throw e; 53 + } 54 + } 55 + 56 + /** Push a single update diff to Subtext (lightweight, used on every local edit). */ 57 + export async function pushUpdateToSubtext(vaultPath: string, update: Uint8Array): Promise<void> { 58 + try { 59 + await ipcCall('applyUpdate', vaultPath, update); 60 + } catch (e) { 61 + console.warn('[subtext] push update failed for', vaultPath, e); 62 + } 63 + } 64 + 65 + /** Create a new vault file in Subtext with the given initial Yjs state. */ 66 + export async function createFileInSubtext( 67 + vaultPath: string, 68 + initialState: Uint8Array, 69 + ): Promise<void> { 70 + await ipcCall('createFile', vaultPath, initialState); 71 + } 72 + 73 + /** Rename a vault file in Subtext. */ 74 + export async function renameFileInSubtext( 75 + oldVaultPath: string, 76 + newVaultPath: string, 77 + ): Promise<void> { 78 + await ipcCall('renameFile', oldVaultPath, newVaultPath); 79 + } 80 + 81 + /** Check whether Subtext has a local file at the given vault path. */ 82 + export async function fileExists(vaultPath: string): Promise<boolean> { 83 + try { 84 + return await ipcCall<boolean>('fileExists', vaultPath); 85 + } catch { 86 + return false; 87 + } 88 + } 89 + 90 + /** List all local vault paths from Subtext. */ 91 + export async function listCachedVaults(): Promise<string[]> { 92 + return await ipcCall<string[]>('listFiles'); 93 + }
+127
src/subtext/index.ts
··· 1 + /** 2 + * Subtext stable file registry (renderer-side). 3 + * 4 + * Maps opaque stable IDs to current vault paths so the sidebar selection survives 5 + * renames. Persisted in localStorage so IDs are stable across app restarts. 6 + */ 7 + 8 + const REGISTRY_KEY = 'textile.subtext.registry'; 9 + 10 + type Registry = { 11 + version: number; 12 + entries: Record<string, string>; // id -> vaultPath 13 + }; 14 + 15 + function readRegistry(): Registry { 16 + if (typeof localStorage === 'undefined') { 17 + return { version: 1, entries: {} }; 18 + } 19 + try { 20 + const raw = localStorage.getItem(REGISTRY_KEY); 21 + if (raw) { 22 + const parsed = JSON.parse(raw) as Registry; 23 + if (parsed.version === 1) return parsed; 24 + } 25 + } catch { 26 + // corrupt storage 27 + } 28 + return { version: 1, entries: {} }; 29 + } 30 + 31 + function writeRegistry(registry: Registry): void { 32 + if (typeof localStorage === 'undefined') return; 33 + localStorage.setItem(REGISTRY_KEY, JSON.stringify(registry)); 34 + } 35 + 36 + function generateId(): string { 37 + if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) { 38 + return crypto.randomUUID(); 39 + } 40 + // Fallback for environments without crypto.randomUUID() 41 + return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`; 42 + } 43 + 44 + /** Allocate a new stable ID mapped to the given vault path. */ 45 + export function allocateId(vaultPath: string): string { 46 + const registry = readRegistry(); 47 + const id = generateId(); 48 + registry.entries[id] = vaultPath; 49 + writeRegistry(registry); 50 + return id; 51 + } 52 + 53 + /** Look up the current vault path for a stable ID. */ 54 + export function getPath(id: string): string | null { 55 + return readRegistry().entries[id] ?? null; 56 + } 57 + 58 + /** Update the vault path for an existing stable ID (e.g. after a rename). */ 59 + export function updatePath(id: string, newPath: string): void { 60 + const registry = readRegistry(); 61 + if (registry.entries[id]) { 62 + registry.entries[id] = newPath; 63 + writeRegistry(registry); 64 + } 65 + } 66 + 67 + /** Find an existing ID for a vault path, or return null. */ 68 + export function findIdByPath(vaultPath: string): string | null { 69 + const registry = readRegistry(); 70 + for (const [id, path] of Object.entries(registry.entries)) { 71 + if (path === vaultPath) return id; 72 + } 73 + return null; 74 + } 75 + 76 + /** 77 + * Scan a list of paths from the daemon and reconcile them with the registry. 78 + * Returns `{ id, path }` pairs with stable IDs. Unknown paths get new IDs. 79 + * Stale entries (paths that no longer exist) are cleaned up. 80 + */ 81 + export function scanPaths(paths: string[]): Array<{ id: string; path: string }> { 82 + const registry = readRegistry(); 83 + const reverse = new Map<string, string>(); 84 + for (const [id, path] of Object.entries(registry.entries)) { 85 + reverse.set(path, id); 86 + } 87 + 88 + const result: Array<{ id: string; path: string }> = []; 89 + const seenPaths = new Set<string>(); 90 + 91 + for (const path of paths) { 92 + seenPaths.add(path); 93 + let id = reverse.get(path); 94 + if (!id) { 95 + id = generateId(); 96 + registry.entries[id] = path; 97 + } 98 + result.push({ id, path }); 99 + } 100 + 101 + // Remove stale entries whose paths no longer exist on disk. 102 + for (const [id, path] of Object.entries(registry.entries)) { 103 + if (!seenPaths.has(path)) { 104 + delete registry.entries[id]; 105 + } 106 + } 107 + 108 + writeRegistry(registry); 109 + return result; 110 + } 111 + 112 + // --- Title-change pub/sub (mirrors habitat/docSession.ts pattern) --------- 113 + 114 + const titleListeners = new Set<(id: string, name: string) => void>(); 115 + 116 + export function subscribeSubtextTitleChanges( 117 + listener: (id: string, name: string) => void, 118 + ): () => void { 119 + titleListeners.add(listener); 120 + return () => titleListeners.delete(listener); 121 + } 122 + 123 + export function emitSubtextTitle(id: string, name: string): void { 124 + for (const listener of titleListeners) { 125 + listener(id, name); 126 + } 127 + }
+2004
src/subtext/proto.d.ts
··· 1 + import * as $protobuf from "protobufjs"; 2 + import Long = require("long"); 3 + 4 + /** Namespace subtext_handlers. */ 5 + export namespace subtext_handlers { 6 + 7 + /** 8 + * Properties of a Request. 9 + * @deprecated Use subtext_handlers.Request.$Properties instead. 10 + */ 11 + interface IRequest extends subtext_handlers.Request.$Properties { 12 + } 13 + 14 + /** Represents a Request. */ 15 + class Request { 16 + 17 + /** 18 + * Constructs a new Request. 19 + * @param [properties] Properties to set 20 + */ 21 + constructor(properties?: subtext_handlers.Request.$Properties); 22 + 23 + /** Unknown fields preserved while decoding */ 24 + $unknowns?: Uint8Array[]; 25 + 26 + /** Request id. */ 27 + id: (number|Long); 28 + 29 + /** Request ping. */ 30 + ping?: (subtext_handlers.Ping.$Properties|null); 31 + 32 + /** Request applyUpdateV2. */ 33 + applyUpdateV2?: (subtext_handlers.ApplyUpdateV2.$Properties|null); 34 + 35 + /** Request getStateVector. */ 36 + getStateVector?: (subtext_handlers.GetStateVector.$Properties|null); 37 + 38 + /** Request getFullState. */ 39 + getFullState?: (subtext_handlers.GetFullState.$Properties|null); 40 + 41 + /** Request listFiles. */ 42 + listFiles?: (subtext_handlers.ListFiles.$Properties|null); 43 + 44 + /** Request fileExists. */ 45 + fileExists?: (subtext_handlers.FileExists.$Properties|null); 46 + 47 + /** Request createFile. */ 48 + createFile?: (subtext_handlers.CreateFile.$Properties|null); 49 + 50 + /** Request renameFile. */ 51 + renameFile?: (subtext_handlers.RenameFile.$Properties|null); 52 + 53 + /** Request content. */ 54 + content?: ("ping"|"applyUpdateV2"|"getStateVector"|"getFullState"|"listFiles"|"fileExists"|"createFile"|"renameFile"); 55 + 56 + /** 57 + * Creates a new Request instance using the specified properties. 58 + * @param [properties] Properties to set 59 + * @returns Request instance 60 + */ 61 + static create(properties: subtext_handlers.Request.$Shape): subtext_handlers.Request & subtext_handlers.Request.$Shape; 62 + static create(properties?: subtext_handlers.Request.$Properties): subtext_handlers.Request; 63 + 64 + /** 65 + * Encodes the specified Request message. Does not implicitly {@link subtext_handlers.Request.verify|verify} messages. 66 + * @param message Request message or plain object to encode 67 + * @param [writer] Writer to encode to 68 + * @returns Writer 69 + */ 70 + static encode(message: subtext_handlers.Request.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 71 + 72 + /** 73 + * Encodes the specified Request message, length delimited. Does not implicitly {@link subtext_handlers.Request.verify|verify} messages. 74 + * @param message Request message or plain object to encode 75 + * @param [writer] Writer to encode to 76 + * @returns Writer 77 + */ 78 + static encodeDelimited(message: subtext_handlers.Request.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 79 + 80 + /** 81 + * Decodes a Request message from the specified reader or buffer. 82 + * @param reader Reader or buffer to decode from 83 + * @param [length] Message length if known beforehand 84 + * @returns {subtext_handlers.Request & subtext_handlers.Request.$Shape} Request 85 + * @throws {Error} If the payload is not a reader or valid buffer 86 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 87 + */ 88 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.Request & subtext_handlers.Request.$Shape; 89 + 90 + /** 91 + * Decodes a Request message from the specified reader or buffer, length delimited. 92 + * @param reader Reader or buffer to decode from 93 + * @returns {subtext_handlers.Request & subtext_handlers.Request.$Shape} Request 94 + * @throws {Error} If the payload is not a reader or valid buffer 95 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 96 + */ 97 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.Request & subtext_handlers.Request.$Shape; 98 + 99 + /** 100 + * Verifies a Request message. 101 + * @param message Plain object to verify 102 + * @returns `null` if valid, otherwise the reason why it is not 103 + */ 104 + static verify(message: { [k: string]: any }): (string|null); 105 + 106 + /** 107 + * Creates a Request message from a plain object. Also converts values to their respective internal types. 108 + * @param object Plain object 109 + * @returns Request 110 + */ 111 + static fromObject(object: { [k: string]: any }): subtext_handlers.Request; 112 + 113 + /** 114 + * Creates a plain object from a Request message. Also converts values to other types if specified. 115 + * @param message Request 116 + * @param [options] Conversion options 117 + * @returns Plain object 118 + */ 119 + static toObject(message: subtext_handlers.Request, options?: $protobuf.IConversionOptions): { [k: string]: any }; 120 + 121 + /** 122 + * Converts this Request to JSON. 123 + * @returns JSON object 124 + */ 125 + toJSON(): { [k: string]: any }; 126 + 127 + /** 128 + * Gets the type url for Request 129 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 130 + * @returns The type url 131 + */ 132 + static getTypeUrl(prefix?: string): string; 133 + } 134 + 135 + namespace Request { 136 + 137 + /** Properties of a Request. */ 138 + interface $Properties { 139 + 140 + /** Request id */ 141 + id?: (number|Long|null); 142 + 143 + /** Request ping */ 144 + ping?: (subtext_handlers.Ping.$Properties|null); 145 + 146 + /** Request applyUpdateV2 */ 147 + applyUpdateV2?: (subtext_handlers.ApplyUpdateV2.$Properties|null); 148 + 149 + /** Request getStateVector */ 150 + getStateVector?: (subtext_handlers.GetStateVector.$Properties|null); 151 + 152 + /** Request getFullState */ 153 + getFullState?: (subtext_handlers.GetFullState.$Properties|null); 154 + 155 + /** Request listFiles */ 156 + listFiles?: (subtext_handlers.ListFiles.$Properties|null); 157 + 158 + /** Request fileExists */ 159 + fileExists?: (subtext_handlers.FileExists.$Properties|null); 160 + 161 + /** Request createFile */ 162 + createFile?: (subtext_handlers.CreateFile.$Properties|null); 163 + 164 + /** Request renameFile */ 165 + renameFile?: (subtext_handlers.RenameFile.$Properties|null); 166 + 167 + /** Request content */ 168 + content?: ("ping"|"applyUpdateV2"|"getStateVector"|"getFullState"|"listFiles"|"fileExists"|"createFile"|"renameFile"); 169 + 170 + /** Unknown fields preserved while decoding */ 171 + $unknowns?: Uint8Array[]; 172 + } 173 + 174 + /** Narrowed shape of a Request. */ 175 + type $Shape = { 176 + id?: number|Long|null; 177 + ping?: subtext_handlers.Ping.$Shape|null; 178 + applyUpdateV2?: subtext_handlers.ApplyUpdateV2.$Shape|null; 179 + getStateVector?: subtext_handlers.GetStateVector.$Shape|null; 180 + getFullState?: subtext_handlers.GetFullState.$Shape|null; 181 + listFiles?: subtext_handlers.ListFiles.$Shape|null; 182 + fileExists?: subtext_handlers.FileExists.$Shape|null; 183 + createFile?: subtext_handlers.CreateFile.$Shape|null; 184 + renameFile?: subtext_handlers.RenameFile.$Shape|null; 185 + $unknowns?: Uint8Array[]; 186 + } & ( 187 + ({ content?: undefined; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "ping"; ping: subtext_handlers.Ping.$Shape; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "applyUpdateV2"; ping?: null; applyUpdateV2: subtext_handlers.ApplyUpdateV2.$Shape; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "getStateVector"; ping?: null; applyUpdateV2?: null; getStateVector: subtext_handlers.GetStateVector.$Shape; getFullState?: null; listFiles?: null; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "getFullState"; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState: subtext_handlers.GetFullState.$Shape; listFiles?: null; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "listFiles"; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles: subtext_handlers.ListFiles.$Shape; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "fileExists"; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists: subtext_handlers.FileExists.$Shape; createFile?: null; renameFile?: null }|{ content?: "createFile"; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists?: null; createFile: subtext_handlers.CreateFile.$Shape; renameFile?: null }|{ content?: "renameFile"; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists?: null; createFile?: null; renameFile: subtext_handlers.RenameFile.$Shape }) 188 + ); 189 + } 190 + 191 + /** 192 + * Properties of a Ping. 193 + * @deprecated Use subtext_handlers.Ping.$Properties instead. 194 + */ 195 + interface IPing extends subtext_handlers.Ping.$Properties { 196 + } 197 + 198 + /** Represents a Ping. */ 199 + class Ping { 200 + 201 + /** 202 + * Constructs a new Ping. 203 + * @param [properties] Properties to set 204 + */ 205 + constructor(properties?: subtext_handlers.Ping.$Properties); 206 + 207 + /** Unknown fields preserved while decoding */ 208 + $unknowns?: Uint8Array[]; 209 + 210 + /** 211 + * Creates a new Ping instance using the specified properties. 212 + * @param [properties] Properties to set 213 + * @returns Ping instance 214 + */ 215 + static create(properties: subtext_handlers.Ping.$Shape): subtext_handlers.Ping & subtext_handlers.Ping.$Shape; 216 + static create(properties?: subtext_handlers.Ping.$Properties): subtext_handlers.Ping; 217 + 218 + /** 219 + * Encodes the specified Ping message. Does not implicitly {@link subtext_handlers.Ping.verify|verify} messages. 220 + * @param message Ping message or plain object to encode 221 + * @param [writer] Writer to encode to 222 + * @returns Writer 223 + */ 224 + static encode(message: subtext_handlers.Ping.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 225 + 226 + /** 227 + * Encodes the specified Ping message, length delimited. Does not implicitly {@link subtext_handlers.Ping.verify|verify} messages. 228 + * @param message Ping message or plain object to encode 229 + * @param [writer] Writer to encode to 230 + * @returns Writer 231 + */ 232 + static encodeDelimited(message: subtext_handlers.Ping.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 233 + 234 + /** 235 + * Decodes a Ping message from the specified reader or buffer. 236 + * @param reader Reader or buffer to decode from 237 + * @param [length] Message length if known beforehand 238 + * @returns {subtext_handlers.Ping & subtext_handlers.Ping.$Shape} Ping 239 + * @throws {Error} If the payload is not a reader or valid buffer 240 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 241 + */ 242 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.Ping & subtext_handlers.Ping.$Shape; 243 + 244 + /** 245 + * Decodes a Ping message from the specified reader or buffer, length delimited. 246 + * @param reader Reader or buffer to decode from 247 + * @returns {subtext_handlers.Ping & subtext_handlers.Ping.$Shape} Ping 248 + * @throws {Error} If the payload is not a reader or valid buffer 249 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 250 + */ 251 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.Ping & subtext_handlers.Ping.$Shape; 252 + 253 + /** 254 + * Verifies a Ping message. 255 + * @param message Plain object to verify 256 + * @returns `null` if valid, otherwise the reason why it is not 257 + */ 258 + static verify(message: { [k: string]: any }): (string|null); 259 + 260 + /** 261 + * Creates a Ping message from a plain object. Also converts values to their respective internal types. 262 + * @param object Plain object 263 + * @returns Ping 264 + */ 265 + static fromObject(object: { [k: string]: any }): subtext_handlers.Ping; 266 + 267 + /** 268 + * Creates a plain object from a Ping message. Also converts values to other types if specified. 269 + * @param message Ping 270 + * @param [options] Conversion options 271 + * @returns Plain object 272 + */ 273 + static toObject(message: subtext_handlers.Ping, options?: $protobuf.IConversionOptions): { [k: string]: any }; 274 + 275 + /** 276 + * Converts this Ping to JSON. 277 + * @returns JSON object 278 + */ 279 + toJSON(): { [k: string]: any }; 280 + 281 + /** 282 + * Gets the type url for Ping 283 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 284 + * @returns The type url 285 + */ 286 + static getTypeUrl(prefix?: string): string; 287 + } 288 + 289 + namespace Ping { 290 + 291 + /** Properties of a Ping. */ 292 + interface $Properties { 293 + 294 + /** Unknown fields preserved while decoding */ 295 + $unknowns?: Uint8Array[]; 296 + } 297 + 298 + /** Shape of a Ping. */ 299 + type $Shape = subtext_handlers.Ping.$Properties; 300 + } 301 + 302 + /** 303 + * Properties of an ApplyUpdateV2. 304 + * @deprecated Use subtext_handlers.ApplyUpdateV2.$Properties instead. 305 + */ 306 + interface IApplyUpdateV2 extends subtext_handlers.ApplyUpdateV2.$Properties { 307 + } 308 + 309 + /** Represents an ApplyUpdateV2. */ 310 + class ApplyUpdateV2 { 311 + 312 + /** 313 + * Constructs a new ApplyUpdateV2. 314 + * @param [properties] Properties to set 315 + */ 316 + constructor(properties?: subtext_handlers.ApplyUpdateV2.$Properties); 317 + 318 + /** Unknown fields preserved while decoding */ 319 + $unknowns?: Uint8Array[]; 320 + 321 + /** ApplyUpdateV2 vaultPath. */ 322 + vaultPath: string; 323 + 324 + /** ApplyUpdateV2 update. */ 325 + update: Uint8Array; 326 + 327 + /** 328 + * Creates a new ApplyUpdateV2 instance using the specified properties. 329 + * @param [properties] Properties to set 330 + * @returns ApplyUpdateV2 instance 331 + */ 332 + static create(properties: subtext_handlers.ApplyUpdateV2.$Shape): subtext_handlers.ApplyUpdateV2 & subtext_handlers.ApplyUpdateV2.$Shape; 333 + static create(properties?: subtext_handlers.ApplyUpdateV2.$Properties): subtext_handlers.ApplyUpdateV2; 334 + 335 + /** 336 + * Encodes the specified ApplyUpdateV2 message. Does not implicitly {@link subtext_handlers.ApplyUpdateV2.verify|verify} messages. 337 + * @param message ApplyUpdateV2 message or plain object to encode 338 + * @param [writer] Writer to encode to 339 + * @returns Writer 340 + */ 341 + static encode(message: subtext_handlers.ApplyUpdateV2.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 342 + 343 + /** 344 + * Encodes the specified ApplyUpdateV2 message, length delimited. Does not implicitly {@link subtext_handlers.ApplyUpdateV2.verify|verify} messages. 345 + * @param message ApplyUpdateV2 message or plain object to encode 346 + * @param [writer] Writer to encode to 347 + * @returns Writer 348 + */ 349 + static encodeDelimited(message: subtext_handlers.ApplyUpdateV2.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 350 + 351 + /** 352 + * Decodes an ApplyUpdateV2 message from the specified reader or buffer. 353 + * @param reader Reader or buffer to decode from 354 + * @param [length] Message length if known beforehand 355 + * @returns {subtext_handlers.ApplyUpdateV2 & subtext_handlers.ApplyUpdateV2.$Shape} ApplyUpdateV2 356 + * @throws {Error} If the payload is not a reader or valid buffer 357 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 358 + */ 359 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.ApplyUpdateV2 & subtext_handlers.ApplyUpdateV2.$Shape; 360 + 361 + /** 362 + * Decodes an ApplyUpdateV2 message from the specified reader or buffer, length delimited. 363 + * @param reader Reader or buffer to decode from 364 + * @returns {subtext_handlers.ApplyUpdateV2 & subtext_handlers.ApplyUpdateV2.$Shape} ApplyUpdateV2 365 + * @throws {Error} If the payload is not a reader or valid buffer 366 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 367 + */ 368 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.ApplyUpdateV2 & subtext_handlers.ApplyUpdateV2.$Shape; 369 + 370 + /** 371 + * Verifies an ApplyUpdateV2 message. 372 + * @param message Plain object to verify 373 + * @returns `null` if valid, otherwise the reason why it is not 374 + */ 375 + static verify(message: { [k: string]: any }): (string|null); 376 + 377 + /** 378 + * Creates an ApplyUpdateV2 message from a plain object. Also converts values to their respective internal types. 379 + * @param object Plain object 380 + * @returns ApplyUpdateV2 381 + */ 382 + static fromObject(object: { [k: string]: any }): subtext_handlers.ApplyUpdateV2; 383 + 384 + /** 385 + * Creates a plain object from an ApplyUpdateV2 message. Also converts values to other types if specified. 386 + * @param message ApplyUpdateV2 387 + * @param [options] Conversion options 388 + * @returns Plain object 389 + */ 390 + static toObject(message: subtext_handlers.ApplyUpdateV2, options?: $protobuf.IConversionOptions): { [k: string]: any }; 391 + 392 + /** 393 + * Converts this ApplyUpdateV2 to JSON. 394 + * @returns JSON object 395 + */ 396 + toJSON(): { [k: string]: any }; 397 + 398 + /** 399 + * Gets the type url for ApplyUpdateV2 400 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 401 + * @returns The type url 402 + */ 403 + static getTypeUrl(prefix?: string): string; 404 + } 405 + 406 + namespace ApplyUpdateV2 { 407 + 408 + /** Properties of an ApplyUpdateV2. */ 409 + interface $Properties { 410 + 411 + /** ApplyUpdateV2 vaultPath */ 412 + vaultPath?: (string|null); 413 + 414 + /** ApplyUpdateV2 update */ 415 + update?: (Uint8Array|null); 416 + 417 + /** Unknown fields preserved while decoding */ 418 + $unknowns?: Uint8Array[]; 419 + } 420 + 421 + /** Shape of an ApplyUpdateV2. */ 422 + type $Shape = subtext_handlers.ApplyUpdateV2.$Properties; 423 + } 424 + 425 + /** 426 + * Properties of a GetStateVector. 427 + * @deprecated Use subtext_handlers.GetStateVector.$Properties instead. 428 + */ 429 + interface IGetStateVector extends subtext_handlers.GetStateVector.$Properties { 430 + } 431 + 432 + /** Represents a GetStateVector. */ 433 + class GetStateVector { 434 + 435 + /** 436 + * Constructs a new GetStateVector. 437 + * @param [properties] Properties to set 438 + */ 439 + constructor(properties?: subtext_handlers.GetStateVector.$Properties); 440 + 441 + /** Unknown fields preserved while decoding */ 442 + $unknowns?: Uint8Array[]; 443 + 444 + /** GetStateVector vaultPath. */ 445 + vaultPath: string; 446 + 447 + /** 448 + * Creates a new GetStateVector instance using the specified properties. 449 + * @param [properties] Properties to set 450 + * @returns GetStateVector instance 451 + */ 452 + static create(properties: subtext_handlers.GetStateVector.$Shape): subtext_handlers.GetStateVector & subtext_handlers.GetStateVector.$Shape; 453 + static create(properties?: subtext_handlers.GetStateVector.$Properties): subtext_handlers.GetStateVector; 454 + 455 + /** 456 + * Encodes the specified GetStateVector message. Does not implicitly {@link subtext_handlers.GetStateVector.verify|verify} messages. 457 + * @param message GetStateVector message or plain object to encode 458 + * @param [writer] Writer to encode to 459 + * @returns Writer 460 + */ 461 + static encode(message: subtext_handlers.GetStateVector.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 462 + 463 + /** 464 + * Encodes the specified GetStateVector message, length delimited. Does not implicitly {@link subtext_handlers.GetStateVector.verify|verify} messages. 465 + * @param message GetStateVector message or plain object to encode 466 + * @param [writer] Writer to encode to 467 + * @returns Writer 468 + */ 469 + static encodeDelimited(message: subtext_handlers.GetStateVector.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 470 + 471 + /** 472 + * Decodes a GetStateVector message from the specified reader or buffer. 473 + * @param reader Reader or buffer to decode from 474 + * @param [length] Message length if known beforehand 475 + * @returns {subtext_handlers.GetStateVector & subtext_handlers.GetStateVector.$Shape} GetStateVector 476 + * @throws {Error} If the payload is not a reader or valid buffer 477 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 478 + */ 479 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.GetStateVector & subtext_handlers.GetStateVector.$Shape; 480 + 481 + /** 482 + * Decodes a GetStateVector message from the specified reader or buffer, length delimited. 483 + * @param reader Reader or buffer to decode from 484 + * @returns {subtext_handlers.GetStateVector & subtext_handlers.GetStateVector.$Shape} GetStateVector 485 + * @throws {Error} If the payload is not a reader or valid buffer 486 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 487 + */ 488 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.GetStateVector & subtext_handlers.GetStateVector.$Shape; 489 + 490 + /** 491 + * Verifies a GetStateVector message. 492 + * @param message Plain object to verify 493 + * @returns `null` if valid, otherwise the reason why it is not 494 + */ 495 + static verify(message: { [k: string]: any }): (string|null); 496 + 497 + /** 498 + * Creates a GetStateVector message from a plain object. Also converts values to their respective internal types. 499 + * @param object Plain object 500 + * @returns GetStateVector 501 + */ 502 + static fromObject(object: { [k: string]: any }): subtext_handlers.GetStateVector; 503 + 504 + /** 505 + * Creates a plain object from a GetStateVector message. Also converts values to other types if specified. 506 + * @param message GetStateVector 507 + * @param [options] Conversion options 508 + * @returns Plain object 509 + */ 510 + static toObject(message: subtext_handlers.GetStateVector, options?: $protobuf.IConversionOptions): { [k: string]: any }; 511 + 512 + /** 513 + * Converts this GetStateVector to JSON. 514 + * @returns JSON object 515 + */ 516 + toJSON(): { [k: string]: any }; 517 + 518 + /** 519 + * Gets the type url for GetStateVector 520 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 521 + * @returns The type url 522 + */ 523 + static getTypeUrl(prefix?: string): string; 524 + } 525 + 526 + namespace GetStateVector { 527 + 528 + /** Properties of a GetStateVector. */ 529 + interface $Properties { 530 + 531 + /** GetStateVector vaultPath */ 532 + vaultPath?: (string|null); 533 + 534 + /** Unknown fields preserved while decoding */ 535 + $unknowns?: Uint8Array[]; 536 + } 537 + 538 + /** Shape of a GetStateVector. */ 539 + type $Shape = subtext_handlers.GetStateVector.$Properties; 540 + } 541 + 542 + /** 543 + * Properties of a GetFullState. 544 + * @deprecated Use subtext_handlers.GetFullState.$Properties instead. 545 + */ 546 + interface IGetFullState extends subtext_handlers.GetFullState.$Properties { 547 + } 548 + 549 + /** Represents a GetFullState. */ 550 + class GetFullState { 551 + 552 + /** 553 + * Constructs a new GetFullState. 554 + * @param [properties] Properties to set 555 + */ 556 + constructor(properties?: subtext_handlers.GetFullState.$Properties); 557 + 558 + /** Unknown fields preserved while decoding */ 559 + $unknowns?: Uint8Array[]; 560 + 561 + /** GetFullState vaultPath. */ 562 + vaultPath: string; 563 + 564 + /** 565 + * Creates a new GetFullState instance using the specified properties. 566 + * @param [properties] Properties to set 567 + * @returns GetFullState instance 568 + */ 569 + static create(properties: subtext_handlers.GetFullState.$Shape): subtext_handlers.GetFullState & subtext_handlers.GetFullState.$Shape; 570 + static create(properties?: subtext_handlers.GetFullState.$Properties): subtext_handlers.GetFullState; 571 + 572 + /** 573 + * Encodes the specified GetFullState message. Does not implicitly {@link subtext_handlers.GetFullState.verify|verify} messages. 574 + * @param message GetFullState message or plain object to encode 575 + * @param [writer] Writer to encode to 576 + * @returns Writer 577 + */ 578 + static encode(message: subtext_handlers.GetFullState.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 579 + 580 + /** 581 + * Encodes the specified GetFullState message, length delimited. Does not implicitly {@link subtext_handlers.GetFullState.verify|verify} messages. 582 + * @param message GetFullState message or plain object to encode 583 + * @param [writer] Writer to encode to 584 + * @returns Writer 585 + */ 586 + static encodeDelimited(message: subtext_handlers.GetFullState.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 587 + 588 + /** 589 + * Decodes a GetFullState message from the specified reader or buffer. 590 + * @param reader Reader or buffer to decode from 591 + * @param [length] Message length if known beforehand 592 + * @returns {subtext_handlers.GetFullState & subtext_handlers.GetFullState.$Shape} GetFullState 593 + * @throws {Error} If the payload is not a reader or valid buffer 594 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 595 + */ 596 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.GetFullState & subtext_handlers.GetFullState.$Shape; 597 + 598 + /** 599 + * Decodes a GetFullState message from the specified reader or buffer, length delimited. 600 + * @param reader Reader or buffer to decode from 601 + * @returns {subtext_handlers.GetFullState & subtext_handlers.GetFullState.$Shape} GetFullState 602 + * @throws {Error} If the payload is not a reader or valid buffer 603 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 604 + */ 605 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.GetFullState & subtext_handlers.GetFullState.$Shape; 606 + 607 + /** 608 + * Verifies a GetFullState message. 609 + * @param message Plain object to verify 610 + * @returns `null` if valid, otherwise the reason why it is not 611 + */ 612 + static verify(message: { [k: string]: any }): (string|null); 613 + 614 + /** 615 + * Creates a GetFullState message from a plain object. Also converts values to their respective internal types. 616 + * @param object Plain object 617 + * @returns GetFullState 618 + */ 619 + static fromObject(object: { [k: string]: any }): subtext_handlers.GetFullState; 620 + 621 + /** 622 + * Creates a plain object from a GetFullState message. Also converts values to other types if specified. 623 + * @param message GetFullState 624 + * @param [options] Conversion options 625 + * @returns Plain object 626 + */ 627 + static toObject(message: subtext_handlers.GetFullState, options?: $protobuf.IConversionOptions): { [k: string]: any }; 628 + 629 + /** 630 + * Converts this GetFullState to JSON. 631 + * @returns JSON object 632 + */ 633 + toJSON(): { [k: string]: any }; 634 + 635 + /** 636 + * Gets the type url for GetFullState 637 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 638 + * @returns The type url 639 + */ 640 + static getTypeUrl(prefix?: string): string; 641 + } 642 + 643 + namespace GetFullState { 644 + 645 + /** Properties of a GetFullState. */ 646 + interface $Properties { 647 + 648 + /** GetFullState vaultPath */ 649 + vaultPath?: (string|null); 650 + 651 + /** Unknown fields preserved while decoding */ 652 + $unknowns?: Uint8Array[]; 653 + } 654 + 655 + /** Shape of a GetFullState. */ 656 + type $Shape = subtext_handlers.GetFullState.$Properties; 657 + } 658 + 659 + /** 660 + * Properties of a ListFiles. 661 + * @deprecated Use subtext_handlers.ListFiles.$Properties instead. 662 + */ 663 + interface IListFiles extends subtext_handlers.ListFiles.$Properties { 664 + } 665 + 666 + /** Represents a ListFiles. */ 667 + class ListFiles { 668 + 669 + /** 670 + * Constructs a new ListFiles. 671 + * @param [properties] Properties to set 672 + */ 673 + constructor(properties?: subtext_handlers.ListFiles.$Properties); 674 + 675 + /** Unknown fields preserved while decoding */ 676 + $unknowns?: Uint8Array[]; 677 + 678 + /** ListFiles prefix. */ 679 + prefix: string; 680 + 681 + /** 682 + * Creates a new ListFiles instance using the specified properties. 683 + * @param [properties] Properties to set 684 + * @returns ListFiles instance 685 + */ 686 + static create(properties: subtext_handlers.ListFiles.$Shape): subtext_handlers.ListFiles & subtext_handlers.ListFiles.$Shape; 687 + static create(properties?: subtext_handlers.ListFiles.$Properties): subtext_handlers.ListFiles; 688 + 689 + /** 690 + * Encodes the specified ListFiles message. Does not implicitly {@link subtext_handlers.ListFiles.verify|verify} messages. 691 + * @param message ListFiles message or plain object to encode 692 + * @param [writer] Writer to encode to 693 + * @returns Writer 694 + */ 695 + static encode(message: subtext_handlers.ListFiles.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 696 + 697 + /** 698 + * Encodes the specified ListFiles message, length delimited. Does not implicitly {@link subtext_handlers.ListFiles.verify|verify} messages. 699 + * @param message ListFiles message or plain object to encode 700 + * @param [writer] Writer to encode to 701 + * @returns Writer 702 + */ 703 + static encodeDelimited(message: subtext_handlers.ListFiles.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 704 + 705 + /** 706 + * Decodes a ListFiles message from the specified reader or buffer. 707 + * @param reader Reader or buffer to decode from 708 + * @param [length] Message length if known beforehand 709 + * @returns {subtext_handlers.ListFiles & subtext_handlers.ListFiles.$Shape} ListFiles 710 + * @throws {Error} If the payload is not a reader or valid buffer 711 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 712 + */ 713 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.ListFiles & subtext_handlers.ListFiles.$Shape; 714 + 715 + /** 716 + * Decodes a ListFiles message from the specified reader or buffer, length delimited. 717 + * @param reader Reader or buffer to decode from 718 + * @returns {subtext_handlers.ListFiles & subtext_handlers.ListFiles.$Shape} ListFiles 719 + * @throws {Error} If the payload is not a reader or valid buffer 720 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 721 + */ 722 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.ListFiles & subtext_handlers.ListFiles.$Shape; 723 + 724 + /** 725 + * Verifies a ListFiles message. 726 + * @param message Plain object to verify 727 + * @returns `null` if valid, otherwise the reason why it is not 728 + */ 729 + static verify(message: { [k: string]: any }): (string|null); 730 + 731 + /** 732 + * Creates a ListFiles message from a plain object. Also converts values to their respective internal types. 733 + * @param object Plain object 734 + * @returns ListFiles 735 + */ 736 + static fromObject(object: { [k: string]: any }): subtext_handlers.ListFiles; 737 + 738 + /** 739 + * Creates a plain object from a ListFiles message. Also converts values to other types if specified. 740 + * @param message ListFiles 741 + * @param [options] Conversion options 742 + * @returns Plain object 743 + */ 744 + static toObject(message: subtext_handlers.ListFiles, options?: $protobuf.IConversionOptions): { [k: string]: any }; 745 + 746 + /** 747 + * Converts this ListFiles to JSON. 748 + * @returns JSON object 749 + */ 750 + toJSON(): { [k: string]: any }; 751 + 752 + /** 753 + * Gets the type url for ListFiles 754 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 755 + * @returns The type url 756 + */ 757 + static getTypeUrl(prefix?: string): string; 758 + } 759 + 760 + namespace ListFiles { 761 + 762 + /** Properties of a ListFiles. */ 763 + interface $Properties { 764 + 765 + /** ListFiles prefix */ 766 + prefix?: (string|null); 767 + 768 + /** Unknown fields preserved while decoding */ 769 + $unknowns?: Uint8Array[]; 770 + } 771 + 772 + /** Shape of a ListFiles. */ 773 + type $Shape = subtext_handlers.ListFiles.$Properties; 774 + } 775 + 776 + /** 777 + * Properties of a FileExists. 778 + * @deprecated Use subtext_handlers.FileExists.$Properties instead. 779 + */ 780 + interface IFileExists extends subtext_handlers.FileExists.$Properties { 781 + } 782 + 783 + /** Represents a FileExists. */ 784 + class FileExists { 785 + 786 + /** 787 + * Constructs a new FileExists. 788 + * @param [properties] Properties to set 789 + */ 790 + constructor(properties?: subtext_handlers.FileExists.$Properties); 791 + 792 + /** Unknown fields preserved while decoding */ 793 + $unknowns?: Uint8Array[]; 794 + 795 + /** FileExists vaultPath. */ 796 + vaultPath: string; 797 + 798 + /** 799 + * Creates a new FileExists instance using the specified properties. 800 + * @param [properties] Properties to set 801 + * @returns FileExists instance 802 + */ 803 + static create(properties: subtext_handlers.FileExists.$Shape): subtext_handlers.FileExists & subtext_handlers.FileExists.$Shape; 804 + static create(properties?: subtext_handlers.FileExists.$Properties): subtext_handlers.FileExists; 805 + 806 + /** 807 + * Encodes the specified FileExists message. Does not implicitly {@link subtext_handlers.FileExists.verify|verify} messages. 808 + * @param message FileExists message or plain object to encode 809 + * @param [writer] Writer to encode to 810 + * @returns Writer 811 + */ 812 + static encode(message: subtext_handlers.FileExists.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 813 + 814 + /** 815 + * Encodes the specified FileExists message, length delimited. Does not implicitly {@link subtext_handlers.FileExists.verify|verify} messages. 816 + * @param message FileExists message or plain object to encode 817 + * @param [writer] Writer to encode to 818 + * @returns Writer 819 + */ 820 + static encodeDelimited(message: subtext_handlers.FileExists.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 821 + 822 + /** 823 + * Decodes a FileExists message from the specified reader or buffer. 824 + * @param reader Reader or buffer to decode from 825 + * @param [length] Message length if known beforehand 826 + * @returns {subtext_handlers.FileExists & subtext_handlers.FileExists.$Shape} FileExists 827 + * @throws {Error} If the payload is not a reader or valid buffer 828 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 829 + */ 830 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.FileExists & subtext_handlers.FileExists.$Shape; 831 + 832 + /** 833 + * Decodes a FileExists message from the specified reader or buffer, length delimited. 834 + * @param reader Reader or buffer to decode from 835 + * @returns {subtext_handlers.FileExists & subtext_handlers.FileExists.$Shape} FileExists 836 + * @throws {Error} If the payload is not a reader or valid buffer 837 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 838 + */ 839 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.FileExists & subtext_handlers.FileExists.$Shape; 840 + 841 + /** 842 + * Verifies a FileExists message. 843 + * @param message Plain object to verify 844 + * @returns `null` if valid, otherwise the reason why it is not 845 + */ 846 + static verify(message: { [k: string]: any }): (string|null); 847 + 848 + /** 849 + * Creates a FileExists message from a plain object. Also converts values to their respective internal types. 850 + * @param object Plain object 851 + * @returns FileExists 852 + */ 853 + static fromObject(object: { [k: string]: any }): subtext_handlers.FileExists; 854 + 855 + /** 856 + * Creates a plain object from a FileExists message. Also converts values to other types if specified. 857 + * @param message FileExists 858 + * @param [options] Conversion options 859 + * @returns Plain object 860 + */ 861 + static toObject(message: subtext_handlers.FileExists, options?: $protobuf.IConversionOptions): { [k: string]: any }; 862 + 863 + /** 864 + * Converts this FileExists to JSON. 865 + * @returns JSON object 866 + */ 867 + toJSON(): { [k: string]: any }; 868 + 869 + /** 870 + * Gets the type url for FileExists 871 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 872 + * @returns The type url 873 + */ 874 + static getTypeUrl(prefix?: string): string; 875 + } 876 + 877 + namespace FileExists { 878 + 879 + /** Properties of a FileExists. */ 880 + interface $Properties { 881 + 882 + /** FileExists vaultPath */ 883 + vaultPath?: (string|null); 884 + 885 + /** Unknown fields preserved while decoding */ 886 + $unknowns?: Uint8Array[]; 887 + } 888 + 889 + /** Shape of a FileExists. */ 890 + type $Shape = subtext_handlers.FileExists.$Properties; 891 + } 892 + 893 + /** 894 + * Properties of a CreateFile. 895 + * @deprecated Use subtext_handlers.CreateFile.$Properties instead. 896 + */ 897 + interface ICreateFile extends subtext_handlers.CreateFile.$Properties { 898 + } 899 + 900 + /** Represents a CreateFile. */ 901 + class CreateFile { 902 + 903 + /** 904 + * Constructs a new CreateFile. 905 + * @param [properties] Properties to set 906 + */ 907 + constructor(properties?: subtext_handlers.CreateFile.$Properties); 908 + 909 + /** Unknown fields preserved while decoding */ 910 + $unknowns?: Uint8Array[]; 911 + 912 + /** CreateFile vaultPath. */ 913 + vaultPath: string; 914 + 915 + /** CreateFile initialState. */ 916 + initialState: Uint8Array; 917 + 918 + /** 919 + * Creates a new CreateFile instance using the specified properties. 920 + * @param [properties] Properties to set 921 + * @returns CreateFile instance 922 + */ 923 + static create(properties: subtext_handlers.CreateFile.$Shape): subtext_handlers.CreateFile & subtext_handlers.CreateFile.$Shape; 924 + static create(properties?: subtext_handlers.CreateFile.$Properties): subtext_handlers.CreateFile; 925 + 926 + /** 927 + * Encodes the specified CreateFile message. Does not implicitly {@link subtext_handlers.CreateFile.verify|verify} messages. 928 + * @param message CreateFile message or plain object to encode 929 + * @param [writer] Writer to encode to 930 + * @returns Writer 931 + */ 932 + static encode(message: subtext_handlers.CreateFile.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 933 + 934 + /** 935 + * Encodes the specified CreateFile message, length delimited. Does not implicitly {@link subtext_handlers.CreateFile.verify|verify} messages. 936 + * @param message CreateFile message or plain object to encode 937 + * @param [writer] Writer to encode to 938 + * @returns Writer 939 + */ 940 + static encodeDelimited(message: subtext_handlers.CreateFile.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 941 + 942 + /** 943 + * Decodes a CreateFile message from the specified reader or buffer. 944 + * @param reader Reader or buffer to decode from 945 + * @param [length] Message length if known beforehand 946 + * @returns {subtext_handlers.CreateFile & subtext_handlers.CreateFile.$Shape} CreateFile 947 + * @throws {Error} If the payload is not a reader or valid buffer 948 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 949 + */ 950 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.CreateFile & subtext_handlers.CreateFile.$Shape; 951 + 952 + /** 953 + * Decodes a CreateFile message from the specified reader or buffer, length delimited. 954 + * @param reader Reader or buffer to decode from 955 + * @returns {subtext_handlers.CreateFile & subtext_handlers.CreateFile.$Shape} CreateFile 956 + * @throws {Error} If the payload is not a reader or valid buffer 957 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 958 + */ 959 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.CreateFile & subtext_handlers.CreateFile.$Shape; 960 + 961 + /** 962 + * Verifies a CreateFile message. 963 + * @param message Plain object to verify 964 + * @returns `null` if valid, otherwise the reason why it is not 965 + */ 966 + static verify(message: { [k: string]: any }): (string|null); 967 + 968 + /** 969 + * Creates a CreateFile message from a plain object. Also converts values to their respective internal types. 970 + * @param object Plain object 971 + * @returns CreateFile 972 + */ 973 + static fromObject(object: { [k: string]: any }): subtext_handlers.CreateFile; 974 + 975 + /** 976 + * Creates a plain object from a CreateFile message. Also converts values to other types if specified. 977 + * @param message CreateFile 978 + * @param [options] Conversion options 979 + * @returns Plain object 980 + */ 981 + static toObject(message: subtext_handlers.CreateFile, options?: $protobuf.IConversionOptions): { [k: string]: any }; 982 + 983 + /** 984 + * Converts this CreateFile to JSON. 985 + * @returns JSON object 986 + */ 987 + toJSON(): { [k: string]: any }; 988 + 989 + /** 990 + * Gets the type url for CreateFile 991 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 992 + * @returns The type url 993 + */ 994 + static getTypeUrl(prefix?: string): string; 995 + } 996 + 997 + namespace CreateFile { 998 + 999 + /** Properties of a CreateFile. */ 1000 + interface $Properties { 1001 + 1002 + /** CreateFile vaultPath */ 1003 + vaultPath?: (string|null); 1004 + 1005 + /** CreateFile initialState */ 1006 + initialState?: (Uint8Array|null); 1007 + 1008 + /** Unknown fields preserved while decoding */ 1009 + $unknowns?: Uint8Array[]; 1010 + } 1011 + 1012 + /** Shape of a CreateFile. */ 1013 + type $Shape = subtext_handlers.CreateFile.$Properties; 1014 + } 1015 + 1016 + /** 1017 + * Properties of a RenameFile. 1018 + * @deprecated Use subtext_handlers.RenameFile.$Properties instead. 1019 + */ 1020 + interface IRenameFile extends subtext_handlers.RenameFile.$Properties { 1021 + } 1022 + 1023 + /** Represents a RenameFile. */ 1024 + class RenameFile { 1025 + 1026 + /** 1027 + * Constructs a new RenameFile. 1028 + * @param [properties] Properties to set 1029 + */ 1030 + constructor(properties?: subtext_handlers.RenameFile.$Properties); 1031 + 1032 + /** Unknown fields preserved while decoding */ 1033 + $unknowns?: Uint8Array[]; 1034 + 1035 + /** RenameFile oldVaultPath. */ 1036 + oldVaultPath: string; 1037 + 1038 + /** RenameFile newVaultPath. */ 1039 + newVaultPath: string; 1040 + 1041 + /** 1042 + * Creates a new RenameFile instance using the specified properties. 1043 + * @param [properties] Properties to set 1044 + * @returns RenameFile instance 1045 + */ 1046 + static create(properties: subtext_handlers.RenameFile.$Shape): subtext_handlers.RenameFile & subtext_handlers.RenameFile.$Shape; 1047 + static create(properties?: subtext_handlers.RenameFile.$Properties): subtext_handlers.RenameFile; 1048 + 1049 + /** 1050 + * Encodes the specified RenameFile message. Does not implicitly {@link subtext_handlers.RenameFile.verify|verify} messages. 1051 + * @param message RenameFile message or plain object to encode 1052 + * @param [writer] Writer to encode to 1053 + * @returns Writer 1054 + */ 1055 + static encode(message: subtext_handlers.RenameFile.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1056 + 1057 + /** 1058 + * Encodes the specified RenameFile message, length delimited. Does not implicitly {@link subtext_handlers.RenameFile.verify|verify} messages. 1059 + * @param message RenameFile message or plain object to encode 1060 + * @param [writer] Writer to encode to 1061 + * @returns Writer 1062 + */ 1063 + static encodeDelimited(message: subtext_handlers.RenameFile.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1064 + 1065 + /** 1066 + * Decodes a RenameFile message from the specified reader or buffer. 1067 + * @param reader Reader or buffer to decode from 1068 + * @param [length] Message length if known beforehand 1069 + * @returns {subtext_handlers.RenameFile & subtext_handlers.RenameFile.$Shape} RenameFile 1070 + * @throws {Error} If the payload is not a reader or valid buffer 1071 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1072 + */ 1073 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.RenameFile & subtext_handlers.RenameFile.$Shape; 1074 + 1075 + /** 1076 + * Decodes a RenameFile message from the specified reader or buffer, length delimited. 1077 + * @param reader Reader or buffer to decode from 1078 + * @returns {subtext_handlers.RenameFile & subtext_handlers.RenameFile.$Shape} RenameFile 1079 + * @throws {Error} If the payload is not a reader or valid buffer 1080 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1081 + */ 1082 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.RenameFile & subtext_handlers.RenameFile.$Shape; 1083 + 1084 + /** 1085 + * Verifies a RenameFile message. 1086 + * @param message Plain object to verify 1087 + * @returns `null` if valid, otherwise the reason why it is not 1088 + */ 1089 + static verify(message: { [k: string]: any }): (string|null); 1090 + 1091 + /** 1092 + * Creates a RenameFile message from a plain object. Also converts values to their respective internal types. 1093 + * @param object Plain object 1094 + * @returns RenameFile 1095 + */ 1096 + static fromObject(object: { [k: string]: any }): subtext_handlers.RenameFile; 1097 + 1098 + /** 1099 + * Creates a plain object from a RenameFile message. Also converts values to other types if specified. 1100 + * @param message RenameFile 1101 + * @param [options] Conversion options 1102 + * @returns Plain object 1103 + */ 1104 + static toObject(message: subtext_handlers.RenameFile, options?: $protobuf.IConversionOptions): { [k: string]: any }; 1105 + 1106 + /** 1107 + * Converts this RenameFile to JSON. 1108 + * @returns JSON object 1109 + */ 1110 + toJSON(): { [k: string]: any }; 1111 + 1112 + /** 1113 + * Gets the type url for RenameFile 1114 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1115 + * @returns The type url 1116 + */ 1117 + static getTypeUrl(prefix?: string): string; 1118 + } 1119 + 1120 + namespace RenameFile { 1121 + 1122 + /** Properties of a RenameFile. */ 1123 + interface $Properties { 1124 + 1125 + /** RenameFile oldVaultPath */ 1126 + oldVaultPath?: (string|null); 1127 + 1128 + /** RenameFile newVaultPath */ 1129 + newVaultPath?: (string|null); 1130 + 1131 + /** Unknown fields preserved while decoding */ 1132 + $unknowns?: Uint8Array[]; 1133 + } 1134 + 1135 + /** Shape of a RenameFile. */ 1136 + type $Shape = subtext_handlers.RenameFile.$Properties; 1137 + } 1138 + 1139 + /** 1140 + * Properties of a Response. 1141 + * @deprecated Use subtext_handlers.Response.$Properties instead. 1142 + */ 1143 + interface IResponse extends subtext_handlers.Response.$Properties { 1144 + } 1145 + 1146 + /** Represents a Response. */ 1147 + class Response { 1148 + 1149 + /** 1150 + * Constructs a new Response. 1151 + * @param [properties] Properties to set 1152 + */ 1153 + constructor(properties?: subtext_handlers.Response.$Properties); 1154 + 1155 + /** Unknown fields preserved while decoding */ 1156 + $unknowns?: Uint8Array[]; 1157 + 1158 + /** Response requestId. */ 1159 + requestId: (number|Long); 1160 + 1161 + /** Response pong. */ 1162 + pong?: (subtext_handlers.Pong.$Properties|null); 1163 + 1164 + /** Response ack. */ 1165 + ack?: (subtext_handlers.Ack.$Properties|null); 1166 + 1167 + /** Response error. */ 1168 + error?: (subtext_handlers.Error.$Properties|null); 1169 + 1170 + /** Response bytesPayload. */ 1171 + bytesPayload?: (subtext_handlers.BytesPayload.$Properties|null); 1172 + 1173 + /** Response fileList. */ 1174 + fileList?: (subtext_handlers.FileList.$Properties|null); 1175 + 1176 + /** Response fileExistsResult. */ 1177 + fileExistsResult?: (subtext_handlers.FileExistsResult.$Properties|null); 1178 + 1179 + /** Response content. */ 1180 + content?: ("pong"|"ack"|"error"|"bytesPayload"|"fileList"|"fileExistsResult"); 1181 + 1182 + /** 1183 + * Creates a new Response instance using the specified properties. 1184 + * @param [properties] Properties to set 1185 + * @returns Response instance 1186 + */ 1187 + static create(properties: subtext_handlers.Response.$Shape): subtext_handlers.Response & subtext_handlers.Response.$Shape; 1188 + static create(properties?: subtext_handlers.Response.$Properties): subtext_handlers.Response; 1189 + 1190 + /** 1191 + * Encodes the specified Response message. Does not implicitly {@link subtext_handlers.Response.verify|verify} messages. 1192 + * @param message Response message or plain object to encode 1193 + * @param [writer] Writer to encode to 1194 + * @returns Writer 1195 + */ 1196 + static encode(message: subtext_handlers.Response.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1197 + 1198 + /** 1199 + * Encodes the specified Response message, length delimited. Does not implicitly {@link subtext_handlers.Response.verify|verify} messages. 1200 + * @param message Response message or plain object to encode 1201 + * @param [writer] Writer to encode to 1202 + * @returns Writer 1203 + */ 1204 + static encodeDelimited(message: subtext_handlers.Response.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1205 + 1206 + /** 1207 + * Decodes a Response message from the specified reader or buffer. 1208 + * @param reader Reader or buffer to decode from 1209 + * @param [length] Message length if known beforehand 1210 + * @returns {subtext_handlers.Response & subtext_handlers.Response.$Shape} Response 1211 + * @throws {Error} If the payload is not a reader or valid buffer 1212 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1213 + */ 1214 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.Response & subtext_handlers.Response.$Shape; 1215 + 1216 + /** 1217 + * Decodes a Response message from the specified reader or buffer, length delimited. 1218 + * @param reader Reader or buffer to decode from 1219 + * @returns {subtext_handlers.Response & subtext_handlers.Response.$Shape} Response 1220 + * @throws {Error} If the payload is not a reader or valid buffer 1221 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1222 + */ 1223 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.Response & subtext_handlers.Response.$Shape; 1224 + 1225 + /** 1226 + * Verifies a Response message. 1227 + * @param message Plain object to verify 1228 + * @returns `null` if valid, otherwise the reason why it is not 1229 + */ 1230 + static verify(message: { [k: string]: any }): (string|null); 1231 + 1232 + /** 1233 + * Creates a Response message from a plain object. Also converts values to their respective internal types. 1234 + * @param object Plain object 1235 + * @returns Response 1236 + */ 1237 + static fromObject(object: { [k: string]: any }): subtext_handlers.Response; 1238 + 1239 + /** 1240 + * Creates a plain object from a Response message. Also converts values to other types if specified. 1241 + * @param message Response 1242 + * @param [options] Conversion options 1243 + * @returns Plain object 1244 + */ 1245 + static toObject(message: subtext_handlers.Response, options?: $protobuf.IConversionOptions): { [k: string]: any }; 1246 + 1247 + /** 1248 + * Converts this Response to JSON. 1249 + * @returns JSON object 1250 + */ 1251 + toJSON(): { [k: string]: any }; 1252 + 1253 + /** 1254 + * Gets the type url for Response 1255 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1256 + * @returns The type url 1257 + */ 1258 + static getTypeUrl(prefix?: string): string; 1259 + } 1260 + 1261 + namespace Response { 1262 + 1263 + /** Properties of a Response. */ 1264 + interface $Properties { 1265 + 1266 + /** Response requestId */ 1267 + requestId?: (number|Long|null); 1268 + 1269 + /** Response pong */ 1270 + pong?: (subtext_handlers.Pong.$Properties|null); 1271 + 1272 + /** Response ack */ 1273 + ack?: (subtext_handlers.Ack.$Properties|null); 1274 + 1275 + /** Response error */ 1276 + error?: (subtext_handlers.Error.$Properties|null); 1277 + 1278 + /** Response bytesPayload */ 1279 + bytesPayload?: (subtext_handlers.BytesPayload.$Properties|null); 1280 + 1281 + /** Response fileList */ 1282 + fileList?: (subtext_handlers.FileList.$Properties|null); 1283 + 1284 + /** Response fileExistsResult */ 1285 + fileExistsResult?: (subtext_handlers.FileExistsResult.$Properties|null); 1286 + 1287 + /** Response content */ 1288 + content?: ("pong"|"ack"|"error"|"bytesPayload"|"fileList"|"fileExistsResult"); 1289 + 1290 + /** Unknown fields preserved while decoding */ 1291 + $unknowns?: Uint8Array[]; 1292 + } 1293 + 1294 + /** Narrowed shape of a Response. */ 1295 + type $Shape = { 1296 + requestId?: number|Long|null; 1297 + pong?: subtext_handlers.Pong.$Shape|null; 1298 + ack?: subtext_handlers.Ack.$Shape|null; 1299 + error?: subtext_handlers.Error.$Shape|null; 1300 + bytesPayload?: subtext_handlers.BytesPayload.$Shape|null; 1301 + fileList?: subtext_handlers.FileList.$Shape|null; 1302 + fileExistsResult?: subtext_handlers.FileExistsResult.$Shape|null; 1303 + $unknowns?: Uint8Array[]; 1304 + } & ( 1305 + ({ content?: undefined; pong?: null; ack?: null; error?: null; bytesPayload?: null; fileList?: null; fileExistsResult?: null }|{ content?: "pong"; pong: subtext_handlers.Pong.$Shape; ack?: null; error?: null; bytesPayload?: null; fileList?: null; fileExistsResult?: null }|{ content?: "ack"; pong?: null; ack: subtext_handlers.Ack.$Shape; error?: null; bytesPayload?: null; fileList?: null; fileExistsResult?: null }|{ content?: "error"; pong?: null; ack?: null; error: subtext_handlers.Error.$Shape; bytesPayload?: null; fileList?: null; fileExistsResult?: null }|{ content?: "bytesPayload"; pong?: null; ack?: null; error?: null; bytesPayload: subtext_handlers.BytesPayload.$Shape; fileList?: null; fileExistsResult?: null }|{ content?: "fileList"; pong?: null; ack?: null; error?: null; bytesPayload?: null; fileList: subtext_handlers.FileList.$Shape; fileExistsResult?: null }|{ content?: "fileExistsResult"; pong?: null; ack?: null; error?: null; bytesPayload?: null; fileList?: null; fileExistsResult: subtext_handlers.FileExistsResult.$Shape }) 1306 + ); 1307 + } 1308 + 1309 + /** 1310 + * Properties of a Pong. 1311 + * @deprecated Use subtext_handlers.Pong.$Properties instead. 1312 + */ 1313 + interface IPong extends subtext_handlers.Pong.$Properties { 1314 + } 1315 + 1316 + /** Represents a Pong. */ 1317 + class Pong { 1318 + 1319 + /** 1320 + * Constructs a new Pong. 1321 + * @param [properties] Properties to set 1322 + */ 1323 + constructor(properties?: subtext_handlers.Pong.$Properties); 1324 + 1325 + /** Unknown fields preserved while decoding */ 1326 + $unknowns?: Uint8Array[]; 1327 + 1328 + /** 1329 + * Creates a new Pong instance using the specified properties. 1330 + * @param [properties] Properties to set 1331 + * @returns Pong instance 1332 + */ 1333 + static create(properties: subtext_handlers.Pong.$Shape): subtext_handlers.Pong & subtext_handlers.Pong.$Shape; 1334 + static create(properties?: subtext_handlers.Pong.$Properties): subtext_handlers.Pong; 1335 + 1336 + /** 1337 + * Encodes the specified Pong message. Does not implicitly {@link subtext_handlers.Pong.verify|verify} messages. 1338 + * @param message Pong message or plain object to encode 1339 + * @param [writer] Writer to encode to 1340 + * @returns Writer 1341 + */ 1342 + static encode(message: subtext_handlers.Pong.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1343 + 1344 + /** 1345 + * Encodes the specified Pong message, length delimited. Does not implicitly {@link subtext_handlers.Pong.verify|verify} messages. 1346 + * @param message Pong message or plain object to encode 1347 + * @param [writer] Writer to encode to 1348 + * @returns Writer 1349 + */ 1350 + static encodeDelimited(message: subtext_handlers.Pong.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1351 + 1352 + /** 1353 + * Decodes a Pong message from the specified reader or buffer. 1354 + * @param reader Reader or buffer to decode from 1355 + * @param [length] Message length if known beforehand 1356 + * @returns {subtext_handlers.Pong & subtext_handlers.Pong.$Shape} Pong 1357 + * @throws {Error} If the payload is not a reader or valid buffer 1358 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1359 + */ 1360 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.Pong & subtext_handlers.Pong.$Shape; 1361 + 1362 + /** 1363 + * Decodes a Pong message from the specified reader or buffer, length delimited. 1364 + * @param reader Reader or buffer to decode from 1365 + * @returns {subtext_handlers.Pong & subtext_handlers.Pong.$Shape} Pong 1366 + * @throws {Error} If the payload is not a reader or valid buffer 1367 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1368 + */ 1369 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.Pong & subtext_handlers.Pong.$Shape; 1370 + 1371 + /** 1372 + * Verifies a Pong message. 1373 + * @param message Plain object to verify 1374 + * @returns `null` if valid, otherwise the reason why it is not 1375 + */ 1376 + static verify(message: { [k: string]: any }): (string|null); 1377 + 1378 + /** 1379 + * Creates a Pong message from a plain object. Also converts values to their respective internal types. 1380 + * @param object Plain object 1381 + * @returns Pong 1382 + */ 1383 + static fromObject(object: { [k: string]: any }): subtext_handlers.Pong; 1384 + 1385 + /** 1386 + * Creates a plain object from a Pong message. Also converts values to other types if specified. 1387 + * @param message Pong 1388 + * @param [options] Conversion options 1389 + * @returns Plain object 1390 + */ 1391 + static toObject(message: subtext_handlers.Pong, options?: $protobuf.IConversionOptions): { [k: string]: any }; 1392 + 1393 + /** 1394 + * Converts this Pong to JSON. 1395 + * @returns JSON object 1396 + */ 1397 + toJSON(): { [k: string]: any }; 1398 + 1399 + /** 1400 + * Gets the type url for Pong 1401 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1402 + * @returns The type url 1403 + */ 1404 + static getTypeUrl(prefix?: string): string; 1405 + } 1406 + 1407 + namespace Pong { 1408 + 1409 + /** Properties of a Pong. */ 1410 + interface $Properties { 1411 + 1412 + /** Unknown fields preserved while decoding */ 1413 + $unknowns?: Uint8Array[]; 1414 + } 1415 + 1416 + /** Shape of a Pong. */ 1417 + type $Shape = subtext_handlers.Pong.$Properties; 1418 + } 1419 + 1420 + /** 1421 + * Properties of an Ack. 1422 + * @deprecated Use subtext_handlers.Ack.$Properties instead. 1423 + */ 1424 + interface IAck extends subtext_handlers.Ack.$Properties { 1425 + } 1426 + 1427 + /** Represents an Ack. */ 1428 + class Ack { 1429 + 1430 + /** 1431 + * Constructs a new Ack. 1432 + * @param [properties] Properties to set 1433 + */ 1434 + constructor(properties?: subtext_handlers.Ack.$Properties); 1435 + 1436 + /** Unknown fields preserved while decoding */ 1437 + $unknowns?: Uint8Array[]; 1438 + 1439 + /** Ack message. */ 1440 + message: string; 1441 + 1442 + /** 1443 + * Creates a new Ack instance using the specified properties. 1444 + * @param [properties] Properties to set 1445 + * @returns Ack instance 1446 + */ 1447 + static create(properties: subtext_handlers.Ack.$Shape): subtext_handlers.Ack & subtext_handlers.Ack.$Shape; 1448 + static create(properties?: subtext_handlers.Ack.$Properties): subtext_handlers.Ack; 1449 + 1450 + /** 1451 + * Encodes the specified Ack message. Does not implicitly {@link subtext_handlers.Ack.verify|verify} messages. 1452 + * @param message Ack message or plain object to encode 1453 + * @param [writer] Writer to encode to 1454 + * @returns Writer 1455 + */ 1456 + static encode(message: subtext_handlers.Ack.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1457 + 1458 + /** 1459 + * Encodes the specified Ack message, length delimited. Does not implicitly {@link subtext_handlers.Ack.verify|verify} messages. 1460 + * @param message Ack message or plain object to encode 1461 + * @param [writer] Writer to encode to 1462 + * @returns Writer 1463 + */ 1464 + static encodeDelimited(message: subtext_handlers.Ack.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1465 + 1466 + /** 1467 + * Decodes an Ack message from the specified reader or buffer. 1468 + * @param reader Reader or buffer to decode from 1469 + * @param [length] Message length if known beforehand 1470 + * @returns {subtext_handlers.Ack & subtext_handlers.Ack.$Shape} Ack 1471 + * @throws {Error} If the payload is not a reader or valid buffer 1472 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1473 + */ 1474 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.Ack & subtext_handlers.Ack.$Shape; 1475 + 1476 + /** 1477 + * Decodes an Ack message from the specified reader or buffer, length delimited. 1478 + * @param reader Reader or buffer to decode from 1479 + * @returns {subtext_handlers.Ack & subtext_handlers.Ack.$Shape} Ack 1480 + * @throws {Error} If the payload is not a reader or valid buffer 1481 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1482 + */ 1483 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.Ack & subtext_handlers.Ack.$Shape; 1484 + 1485 + /** 1486 + * Verifies an Ack message. 1487 + * @param message Plain object to verify 1488 + * @returns `null` if valid, otherwise the reason why it is not 1489 + */ 1490 + static verify(message: { [k: string]: any }): (string|null); 1491 + 1492 + /** 1493 + * Creates an Ack message from a plain object. Also converts values to their respective internal types. 1494 + * @param object Plain object 1495 + * @returns Ack 1496 + */ 1497 + static fromObject(object: { [k: string]: any }): subtext_handlers.Ack; 1498 + 1499 + /** 1500 + * Creates a plain object from an Ack message. Also converts values to other types if specified. 1501 + * @param message Ack 1502 + * @param [options] Conversion options 1503 + * @returns Plain object 1504 + */ 1505 + static toObject(message: subtext_handlers.Ack, options?: $protobuf.IConversionOptions): { [k: string]: any }; 1506 + 1507 + /** 1508 + * Converts this Ack to JSON. 1509 + * @returns JSON object 1510 + */ 1511 + toJSON(): { [k: string]: any }; 1512 + 1513 + /** 1514 + * Gets the type url for Ack 1515 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1516 + * @returns The type url 1517 + */ 1518 + static getTypeUrl(prefix?: string): string; 1519 + } 1520 + 1521 + namespace Ack { 1522 + 1523 + /** Properties of an Ack. */ 1524 + interface $Properties { 1525 + 1526 + /** Ack message */ 1527 + message?: (string|null); 1528 + 1529 + /** Unknown fields preserved while decoding */ 1530 + $unknowns?: Uint8Array[]; 1531 + } 1532 + 1533 + /** Shape of an Ack. */ 1534 + type $Shape = subtext_handlers.Ack.$Properties; 1535 + } 1536 + 1537 + /** 1538 + * Properties of an Error. 1539 + * @deprecated Use subtext_handlers.Error.$Properties instead. 1540 + */ 1541 + interface IError extends subtext_handlers.Error.$Properties { 1542 + } 1543 + 1544 + /** Represents an Error. */ 1545 + class Error { 1546 + 1547 + /** 1548 + * Constructs a new Error. 1549 + * @param [properties] Properties to set 1550 + */ 1551 + constructor(properties?: subtext_handlers.Error.$Properties); 1552 + 1553 + /** Unknown fields preserved while decoding */ 1554 + $unknowns?: Uint8Array[]; 1555 + 1556 + /** Error message. */ 1557 + message: string; 1558 + 1559 + /** 1560 + * Creates a new Error instance using the specified properties. 1561 + * @param [properties] Properties to set 1562 + * @returns Error instance 1563 + */ 1564 + static create(properties: subtext_handlers.Error.$Shape): subtext_handlers.Error & subtext_handlers.Error.$Shape; 1565 + static create(properties?: subtext_handlers.Error.$Properties): subtext_handlers.Error; 1566 + 1567 + /** 1568 + * Encodes the specified Error message. Does not implicitly {@link subtext_handlers.Error.verify|verify} messages. 1569 + * @param message Error message or plain object to encode 1570 + * @param [writer] Writer to encode to 1571 + * @returns Writer 1572 + */ 1573 + static encode(message: subtext_handlers.Error.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1574 + 1575 + /** 1576 + * Encodes the specified Error message, length delimited. Does not implicitly {@link subtext_handlers.Error.verify|verify} messages. 1577 + * @param message Error message or plain object to encode 1578 + * @param [writer] Writer to encode to 1579 + * @returns Writer 1580 + */ 1581 + static encodeDelimited(message: subtext_handlers.Error.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1582 + 1583 + /** 1584 + * Decodes an Error message from the specified reader or buffer. 1585 + * @param reader Reader or buffer to decode from 1586 + * @param [length] Message length if known beforehand 1587 + * @returns {subtext_handlers.Error & subtext_handlers.Error.$Shape} Error 1588 + * @throws {Error} If the payload is not a reader or valid buffer 1589 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1590 + */ 1591 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.Error & subtext_handlers.Error.$Shape; 1592 + 1593 + /** 1594 + * Decodes an Error message from the specified reader or buffer, length delimited. 1595 + * @param reader Reader or buffer to decode from 1596 + * @returns {subtext_handlers.Error & subtext_handlers.Error.$Shape} Error 1597 + * @throws {Error} If the payload is not a reader or valid buffer 1598 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1599 + */ 1600 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.Error & subtext_handlers.Error.$Shape; 1601 + 1602 + /** 1603 + * Verifies an Error message. 1604 + * @param message Plain object to verify 1605 + * @returns `null` if valid, otherwise the reason why it is not 1606 + */ 1607 + static verify(message: { [k: string]: any }): (string|null); 1608 + 1609 + /** 1610 + * Creates an Error message from a plain object. Also converts values to their respective internal types. 1611 + * @param object Plain object 1612 + * @returns Error 1613 + */ 1614 + static fromObject(object: { [k: string]: any }): subtext_handlers.Error; 1615 + 1616 + /** 1617 + * Creates a plain object from an Error message. Also converts values to other types if specified. 1618 + * @param message Error 1619 + * @param [options] Conversion options 1620 + * @returns Plain object 1621 + */ 1622 + static toObject(message: subtext_handlers.Error, options?: $protobuf.IConversionOptions): { [k: string]: any }; 1623 + 1624 + /** 1625 + * Converts this Error to JSON. 1626 + * @returns JSON object 1627 + */ 1628 + toJSON(): { [k: string]: any }; 1629 + 1630 + /** 1631 + * Gets the type url for Error 1632 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1633 + * @returns The type url 1634 + */ 1635 + static getTypeUrl(prefix?: string): string; 1636 + } 1637 + 1638 + namespace Error { 1639 + 1640 + /** Properties of an Error. */ 1641 + interface $Properties { 1642 + 1643 + /** Error message */ 1644 + message?: (string|null); 1645 + 1646 + /** Unknown fields preserved while decoding */ 1647 + $unknowns?: Uint8Array[]; 1648 + } 1649 + 1650 + /** Shape of an Error. */ 1651 + type $Shape = subtext_handlers.Error.$Properties; 1652 + } 1653 + 1654 + /** 1655 + * Properties of a BytesPayload. 1656 + * @deprecated Use subtext_handlers.BytesPayload.$Properties instead. 1657 + */ 1658 + interface IBytesPayload extends subtext_handlers.BytesPayload.$Properties { 1659 + } 1660 + 1661 + /** Represents a BytesPayload. */ 1662 + class BytesPayload { 1663 + 1664 + /** 1665 + * Constructs a new BytesPayload. 1666 + * @param [properties] Properties to set 1667 + */ 1668 + constructor(properties?: subtext_handlers.BytesPayload.$Properties); 1669 + 1670 + /** Unknown fields preserved while decoding */ 1671 + $unknowns?: Uint8Array[]; 1672 + 1673 + /** BytesPayload data. */ 1674 + data: Uint8Array; 1675 + 1676 + /** 1677 + * Creates a new BytesPayload instance using the specified properties. 1678 + * @param [properties] Properties to set 1679 + * @returns BytesPayload instance 1680 + */ 1681 + static create(properties: subtext_handlers.BytesPayload.$Shape): subtext_handlers.BytesPayload & subtext_handlers.BytesPayload.$Shape; 1682 + static create(properties?: subtext_handlers.BytesPayload.$Properties): subtext_handlers.BytesPayload; 1683 + 1684 + /** 1685 + * Encodes the specified BytesPayload message. Does not implicitly {@link subtext_handlers.BytesPayload.verify|verify} messages. 1686 + * @param message BytesPayload message or plain object to encode 1687 + * @param [writer] Writer to encode to 1688 + * @returns Writer 1689 + */ 1690 + static encode(message: subtext_handlers.BytesPayload.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1691 + 1692 + /** 1693 + * Encodes the specified BytesPayload message, length delimited. Does not implicitly {@link subtext_handlers.BytesPayload.verify|verify} messages. 1694 + * @param message BytesPayload message or plain object to encode 1695 + * @param [writer] Writer to encode to 1696 + * @returns Writer 1697 + */ 1698 + static encodeDelimited(message: subtext_handlers.BytesPayload.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1699 + 1700 + /** 1701 + * Decodes a BytesPayload message from the specified reader or buffer. 1702 + * @param reader Reader or buffer to decode from 1703 + * @param [length] Message length if known beforehand 1704 + * @returns {subtext_handlers.BytesPayload & subtext_handlers.BytesPayload.$Shape} BytesPayload 1705 + * @throws {Error} If the payload is not a reader or valid buffer 1706 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1707 + */ 1708 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.BytesPayload & subtext_handlers.BytesPayload.$Shape; 1709 + 1710 + /** 1711 + * Decodes a BytesPayload message from the specified reader or buffer, length delimited. 1712 + * @param reader Reader or buffer to decode from 1713 + * @returns {subtext_handlers.BytesPayload & subtext_handlers.BytesPayload.$Shape} BytesPayload 1714 + * @throws {Error} If the payload is not a reader or valid buffer 1715 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1716 + */ 1717 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.BytesPayload & subtext_handlers.BytesPayload.$Shape; 1718 + 1719 + /** 1720 + * Verifies a BytesPayload message. 1721 + * @param message Plain object to verify 1722 + * @returns `null` if valid, otherwise the reason why it is not 1723 + */ 1724 + static verify(message: { [k: string]: any }): (string|null); 1725 + 1726 + /** 1727 + * Creates a BytesPayload message from a plain object. Also converts values to their respective internal types. 1728 + * @param object Plain object 1729 + * @returns BytesPayload 1730 + */ 1731 + static fromObject(object: { [k: string]: any }): subtext_handlers.BytesPayload; 1732 + 1733 + /** 1734 + * Creates a plain object from a BytesPayload message. Also converts values to other types if specified. 1735 + * @param message BytesPayload 1736 + * @param [options] Conversion options 1737 + * @returns Plain object 1738 + */ 1739 + static toObject(message: subtext_handlers.BytesPayload, options?: $protobuf.IConversionOptions): { [k: string]: any }; 1740 + 1741 + /** 1742 + * Converts this BytesPayload to JSON. 1743 + * @returns JSON object 1744 + */ 1745 + toJSON(): { [k: string]: any }; 1746 + 1747 + /** 1748 + * Gets the type url for BytesPayload 1749 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1750 + * @returns The type url 1751 + */ 1752 + static getTypeUrl(prefix?: string): string; 1753 + } 1754 + 1755 + namespace BytesPayload { 1756 + 1757 + /** Properties of a BytesPayload. */ 1758 + interface $Properties { 1759 + 1760 + /** BytesPayload data */ 1761 + data?: (Uint8Array|null); 1762 + 1763 + /** Unknown fields preserved while decoding */ 1764 + $unknowns?: Uint8Array[]; 1765 + } 1766 + 1767 + /** Shape of a BytesPayload. */ 1768 + type $Shape = subtext_handlers.BytesPayload.$Properties; 1769 + } 1770 + 1771 + /** 1772 + * Properties of a FileList. 1773 + * @deprecated Use subtext_handlers.FileList.$Properties instead. 1774 + */ 1775 + interface IFileList extends subtext_handlers.FileList.$Properties { 1776 + } 1777 + 1778 + /** Represents a FileList. */ 1779 + class FileList { 1780 + 1781 + /** 1782 + * Constructs a new FileList. 1783 + * @param [properties] Properties to set 1784 + */ 1785 + constructor(properties?: subtext_handlers.FileList.$Properties); 1786 + 1787 + /** Unknown fields preserved while decoding */ 1788 + $unknowns?: Uint8Array[]; 1789 + 1790 + /** FileList paths. */ 1791 + paths: string[]; 1792 + 1793 + /** 1794 + * Creates a new FileList instance using the specified properties. 1795 + * @param [properties] Properties to set 1796 + * @returns FileList instance 1797 + */ 1798 + static create(properties: subtext_handlers.FileList.$Shape): subtext_handlers.FileList & subtext_handlers.FileList.$Shape; 1799 + static create(properties?: subtext_handlers.FileList.$Properties): subtext_handlers.FileList; 1800 + 1801 + /** 1802 + * Encodes the specified FileList message. Does not implicitly {@link subtext_handlers.FileList.verify|verify} messages. 1803 + * @param message FileList message or plain object to encode 1804 + * @param [writer] Writer to encode to 1805 + * @returns Writer 1806 + */ 1807 + static encode(message: subtext_handlers.FileList.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1808 + 1809 + /** 1810 + * Encodes the specified FileList message, length delimited. Does not implicitly {@link subtext_handlers.FileList.verify|verify} messages. 1811 + * @param message FileList message or plain object to encode 1812 + * @param [writer] Writer to encode to 1813 + * @returns Writer 1814 + */ 1815 + static encodeDelimited(message: subtext_handlers.FileList.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1816 + 1817 + /** 1818 + * Decodes a FileList message from the specified reader or buffer. 1819 + * @param reader Reader or buffer to decode from 1820 + * @param [length] Message length if known beforehand 1821 + * @returns {subtext_handlers.FileList & subtext_handlers.FileList.$Shape} FileList 1822 + * @throws {Error} If the payload is not a reader or valid buffer 1823 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1824 + */ 1825 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.FileList & subtext_handlers.FileList.$Shape; 1826 + 1827 + /** 1828 + * Decodes a FileList message from the specified reader or buffer, length delimited. 1829 + * @param reader Reader or buffer to decode from 1830 + * @returns {subtext_handlers.FileList & subtext_handlers.FileList.$Shape} FileList 1831 + * @throws {Error} If the payload is not a reader or valid buffer 1832 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1833 + */ 1834 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.FileList & subtext_handlers.FileList.$Shape; 1835 + 1836 + /** 1837 + * Verifies a FileList message. 1838 + * @param message Plain object to verify 1839 + * @returns `null` if valid, otherwise the reason why it is not 1840 + */ 1841 + static verify(message: { [k: string]: any }): (string|null); 1842 + 1843 + /** 1844 + * Creates a FileList message from a plain object. Also converts values to their respective internal types. 1845 + * @param object Plain object 1846 + * @returns FileList 1847 + */ 1848 + static fromObject(object: { [k: string]: any }): subtext_handlers.FileList; 1849 + 1850 + /** 1851 + * Creates a plain object from a FileList message. Also converts values to other types if specified. 1852 + * @param message FileList 1853 + * @param [options] Conversion options 1854 + * @returns Plain object 1855 + */ 1856 + static toObject(message: subtext_handlers.FileList, options?: $protobuf.IConversionOptions): { [k: string]: any }; 1857 + 1858 + /** 1859 + * Converts this FileList to JSON. 1860 + * @returns JSON object 1861 + */ 1862 + toJSON(): { [k: string]: any }; 1863 + 1864 + /** 1865 + * Gets the type url for FileList 1866 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1867 + * @returns The type url 1868 + */ 1869 + static getTypeUrl(prefix?: string): string; 1870 + } 1871 + 1872 + namespace FileList { 1873 + 1874 + /** Properties of a FileList. */ 1875 + interface $Properties { 1876 + 1877 + /** FileList paths */ 1878 + paths?: (string[]|null); 1879 + 1880 + /** Unknown fields preserved while decoding */ 1881 + $unknowns?: Uint8Array[]; 1882 + } 1883 + 1884 + /** Shape of a FileList. */ 1885 + type $Shape = subtext_handlers.FileList.$Properties; 1886 + } 1887 + 1888 + /** 1889 + * Properties of a FileExistsResult. 1890 + * @deprecated Use subtext_handlers.FileExistsResult.$Properties instead. 1891 + */ 1892 + interface IFileExistsResult extends subtext_handlers.FileExistsResult.$Properties { 1893 + } 1894 + 1895 + /** Represents a FileExistsResult. */ 1896 + class FileExistsResult { 1897 + 1898 + /** 1899 + * Constructs a new FileExistsResult. 1900 + * @param [properties] Properties to set 1901 + */ 1902 + constructor(properties?: subtext_handlers.FileExistsResult.$Properties); 1903 + 1904 + /** Unknown fields preserved while decoding */ 1905 + $unknowns?: Uint8Array[]; 1906 + 1907 + /** FileExistsResult exists. */ 1908 + exists: boolean; 1909 + 1910 + /** 1911 + * Creates a new FileExistsResult instance using the specified properties. 1912 + * @param [properties] Properties to set 1913 + * @returns FileExistsResult instance 1914 + */ 1915 + static create(properties: subtext_handlers.FileExistsResult.$Shape): subtext_handlers.FileExistsResult & subtext_handlers.FileExistsResult.$Shape; 1916 + static create(properties?: subtext_handlers.FileExistsResult.$Properties): subtext_handlers.FileExistsResult; 1917 + 1918 + /** 1919 + * Encodes the specified FileExistsResult message. Does not implicitly {@link subtext_handlers.FileExistsResult.verify|verify} messages. 1920 + * @param message FileExistsResult message or plain object to encode 1921 + * @param [writer] Writer to encode to 1922 + * @returns Writer 1923 + */ 1924 + static encode(message: subtext_handlers.FileExistsResult.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1925 + 1926 + /** 1927 + * Encodes the specified FileExistsResult message, length delimited. Does not implicitly {@link subtext_handlers.FileExistsResult.verify|verify} messages. 1928 + * @param message FileExistsResult message or plain object to encode 1929 + * @param [writer] Writer to encode to 1930 + * @returns Writer 1931 + */ 1932 + static encodeDelimited(message: subtext_handlers.FileExistsResult.$Properties, writer?: $protobuf.Writer): $protobuf.Writer; 1933 + 1934 + /** 1935 + * Decodes a FileExistsResult message from the specified reader or buffer. 1936 + * @param reader Reader or buffer to decode from 1937 + * @param [length] Message length if known beforehand 1938 + * @returns {subtext_handlers.FileExistsResult & subtext_handlers.FileExistsResult.$Shape} FileExistsResult 1939 + * @throws {Error} If the payload is not a reader or valid buffer 1940 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1941 + */ 1942 + static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): subtext_handlers.FileExistsResult & subtext_handlers.FileExistsResult.$Shape; 1943 + 1944 + /** 1945 + * Decodes a FileExistsResult message from the specified reader or buffer, length delimited. 1946 + * @param reader Reader or buffer to decode from 1947 + * @returns {subtext_handlers.FileExistsResult & subtext_handlers.FileExistsResult.$Shape} FileExistsResult 1948 + * @throws {Error} If the payload is not a reader or valid buffer 1949 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1950 + */ 1951 + static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): subtext_handlers.FileExistsResult & subtext_handlers.FileExistsResult.$Shape; 1952 + 1953 + /** 1954 + * Verifies a FileExistsResult message. 1955 + * @param message Plain object to verify 1956 + * @returns `null` if valid, otherwise the reason why it is not 1957 + */ 1958 + static verify(message: { [k: string]: any }): (string|null); 1959 + 1960 + /** 1961 + * Creates a FileExistsResult message from a plain object. Also converts values to their respective internal types. 1962 + * @param object Plain object 1963 + * @returns FileExistsResult 1964 + */ 1965 + static fromObject(object: { [k: string]: any }): subtext_handlers.FileExistsResult; 1966 + 1967 + /** 1968 + * Creates a plain object from a FileExistsResult message. Also converts values to other types if specified. 1969 + * @param message FileExistsResult 1970 + * @param [options] Conversion options 1971 + * @returns Plain object 1972 + */ 1973 + static toObject(message: subtext_handlers.FileExistsResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; 1974 + 1975 + /** 1976 + * Converts this FileExistsResult to JSON. 1977 + * @returns JSON object 1978 + */ 1979 + toJSON(): { [k: string]: any }; 1980 + 1981 + /** 1982 + * Gets the type url for FileExistsResult 1983 + * @param [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1984 + * @returns The type url 1985 + */ 1986 + static getTypeUrl(prefix?: string): string; 1987 + } 1988 + 1989 + namespace FileExistsResult { 1990 + 1991 + /** Properties of a FileExistsResult. */ 1992 + interface $Properties { 1993 + 1994 + /** FileExistsResult exists */ 1995 + exists?: (boolean|null); 1996 + 1997 + /** Unknown fields preserved while decoding */ 1998 + $unknowns?: Uint8Array[]; 1999 + } 2000 + 2001 + /** Shape of a FileExistsResult. */ 2002 + type $Shape = subtext_handlers.FileExistsResult.$Properties; 2003 + } 2004 + }
+4783
src/subtext/proto.js
··· 1 + /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-mixed-operators, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars, default-case, jsdoc/require-param*/ 2 + import $protobuf from "protobufjs/minimal.js"; 3 + 4 + // Common aliases 5 + const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; 6 + 7 + // Exported root namespace 8 + const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); 9 + 10 + export const subtext_handlers = $root.subtext_handlers = (() => { 11 + 12 + /** 13 + * Namespace subtext_handlers. 14 + * @exports subtext_handlers 15 + * @namespace 16 + */ 17 + const subtext_handlers = {}; 18 + 19 + subtext_handlers.Request = (function() { 20 + 21 + /** 22 + * Properties of a Request. 23 + * @typedef {Object} subtext_handlers.Request.$Properties 24 + * @property {number|Long|null} [id] Request id 25 + * @property {subtext_handlers.Ping.$Properties|null} [ping] Request ping 26 + * @property {subtext_handlers.ApplyUpdateV2.$Properties|null} [applyUpdateV2] Request applyUpdateV2 27 + * @property {subtext_handlers.GetStateVector.$Properties|null} [getStateVector] Request getStateVector 28 + * @property {subtext_handlers.GetFullState.$Properties|null} [getFullState] Request getFullState 29 + * @property {subtext_handlers.ListFiles.$Properties|null} [listFiles] Request listFiles 30 + * @property {subtext_handlers.FileExists.$Properties|null} [fileExists] Request fileExists 31 + * @property {subtext_handlers.CreateFile.$Properties|null} [createFile] Request createFile 32 + * @property {subtext_handlers.RenameFile.$Properties|null} [renameFile] Request renameFile 33 + * @property {"ping"|"applyUpdateV2"|"getStateVector"|"getFullState"|"listFiles"|"fileExists"|"createFile"|"renameFile"} [content] Request content 34 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 35 + */ 36 + 37 + /** 38 + * Properties of a Request. 39 + * @memberof subtext_handlers 40 + * @interface IRequest 41 + * @augments subtext_handlers.Request.$Properties 42 + * @deprecated Use subtext_handlers.Request.$Properties instead. 43 + */ 44 + 45 + /** 46 + * Narrowed shape of a Request. 47 + * @typedef {{ 48 + * id?: number|Long|null; 49 + * ping?: subtext_handlers.Ping.$Shape|null; 50 + * applyUpdateV2?: subtext_handlers.ApplyUpdateV2.$Shape|null; 51 + * getStateVector?: subtext_handlers.GetStateVector.$Shape|null; 52 + * getFullState?: subtext_handlers.GetFullState.$Shape|null; 53 + * listFiles?: subtext_handlers.ListFiles.$Shape|null; 54 + * fileExists?: subtext_handlers.FileExists.$Shape|null; 55 + * createFile?: subtext_handlers.CreateFile.$Shape|null; 56 + * renameFile?: subtext_handlers.RenameFile.$Shape|null; 57 + * $unknowns?: Array.<Uint8Array>; 58 + * } & ( 59 + * ({ content?: undefined; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "ping"; ping: subtext_handlers.Ping.$Shape; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "applyUpdateV2"; ping?: null; applyUpdateV2: subtext_handlers.ApplyUpdateV2.$Shape; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "getStateVector"; ping?: null; applyUpdateV2?: null; getStateVector: subtext_handlers.GetStateVector.$Shape; getFullState?: null; listFiles?: null; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "getFullState"; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState: subtext_handlers.GetFullState.$Shape; listFiles?: null; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "listFiles"; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles: subtext_handlers.ListFiles.$Shape; fileExists?: null; createFile?: null; renameFile?: null }|{ content?: "fileExists"; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists: subtext_handlers.FileExists.$Shape; createFile?: null; renameFile?: null }|{ content?: "createFile"; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists?: null; createFile: subtext_handlers.CreateFile.$Shape; renameFile?: null }|{ content?: "renameFile"; ping?: null; applyUpdateV2?: null; getStateVector?: null; getFullState?: null; listFiles?: null; fileExists?: null; createFile?: null; renameFile: subtext_handlers.RenameFile.$Shape }) 60 + * )} subtext_handlers.Request.$Shape 61 + */ 62 + 63 + /** 64 + * Constructs a new Request. 65 + * @memberof subtext_handlers 66 + * @classdesc Represents a Request. 67 + * @constructor 68 + * @param {subtext_handlers.Request.$Properties=} [properties] Properties to set 69 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 70 + */ 71 + function Request(properties) { 72 + if (properties) 73 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 74 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 75 + this[keys[i]] = properties[keys[i]]; 76 + } 77 + 78 + /** 79 + * Request id. 80 + * @member {number|Long} id 81 + * @memberof subtext_handlers.Request 82 + * @instance 83 + */ 84 + Request.prototype.id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; 85 + 86 + /** 87 + * Request ping. 88 + * @member {subtext_handlers.Ping.$Properties|null|undefined} ping 89 + * @memberof subtext_handlers.Request 90 + * @instance 91 + */ 92 + Request.prototype.ping = null; 93 + 94 + /** 95 + * Request applyUpdateV2. 96 + * @member {subtext_handlers.ApplyUpdateV2.$Properties|null|undefined} applyUpdateV2 97 + * @memberof subtext_handlers.Request 98 + * @instance 99 + */ 100 + Request.prototype.applyUpdateV2 = null; 101 + 102 + /** 103 + * Request getStateVector. 104 + * @member {subtext_handlers.GetStateVector.$Properties|null|undefined} getStateVector 105 + * @memberof subtext_handlers.Request 106 + * @instance 107 + */ 108 + Request.prototype.getStateVector = null; 109 + 110 + /** 111 + * Request getFullState. 112 + * @member {subtext_handlers.GetFullState.$Properties|null|undefined} getFullState 113 + * @memberof subtext_handlers.Request 114 + * @instance 115 + */ 116 + Request.prototype.getFullState = null; 117 + 118 + /** 119 + * Request listFiles. 120 + * @member {subtext_handlers.ListFiles.$Properties|null|undefined} listFiles 121 + * @memberof subtext_handlers.Request 122 + * @instance 123 + */ 124 + Request.prototype.listFiles = null; 125 + 126 + /** 127 + * Request fileExists. 128 + * @member {subtext_handlers.FileExists.$Properties|null|undefined} fileExists 129 + * @memberof subtext_handlers.Request 130 + * @instance 131 + */ 132 + Request.prototype.fileExists = null; 133 + 134 + /** 135 + * Request createFile. 136 + * @member {subtext_handlers.CreateFile.$Properties|null|undefined} createFile 137 + * @memberof subtext_handlers.Request 138 + * @instance 139 + */ 140 + Request.prototype.createFile = null; 141 + 142 + /** 143 + * Request renameFile. 144 + * @member {subtext_handlers.RenameFile.$Properties|null|undefined} renameFile 145 + * @memberof subtext_handlers.Request 146 + * @instance 147 + */ 148 + Request.prototype.renameFile = null; 149 + 150 + // OneOf field names bound to virtual getters and setters 151 + let $oneOfFields; 152 + 153 + /** 154 + * Request content. 155 + * @member {"ping"|"applyUpdateV2"|"getStateVector"|"getFullState"|"listFiles"|"fileExists"|"createFile"|"renameFile"|undefined} content 156 + * @memberof subtext_handlers.Request 157 + * @instance 158 + */ 159 + Object.defineProperty(Request.prototype, "content", { 160 + get: $util.oneOfGetter($oneOfFields = ["ping", "applyUpdateV2", "getStateVector", "getFullState", "listFiles", "fileExists", "createFile", "renameFile"]), 161 + set: $util.oneOfSetter($oneOfFields) 162 + }); 163 + 164 + /** 165 + * Creates a new Request instance using the specified properties. 166 + * @function create 167 + * @memberof subtext_handlers.Request 168 + * @static 169 + * @param {subtext_handlers.Request.$Properties=} [properties] Properties to set 170 + * @returns {subtext_handlers.Request} Request instance 171 + * @type {{ 172 + * (properties: subtext_handlers.Request.$Shape): subtext_handlers.Request & subtext_handlers.Request.$Shape; 173 + * (properties?: subtext_handlers.Request.$Properties): subtext_handlers.Request; 174 + * }} 175 + */ 176 + Request.create = function create(properties) { 177 + return new Request(properties); 178 + }; 179 + 180 + /** 181 + * Encodes the specified Request message. Does not implicitly {@link subtext_handlers.Request.verify|verify} messages. 182 + * @function encode 183 + * @memberof subtext_handlers.Request 184 + * @static 185 + * @param {subtext_handlers.Request.$Properties} message Request message or plain object to encode 186 + * @param {$protobuf.Writer} [writer] Writer to encode to 187 + * @returns {$protobuf.Writer} Writer 188 + */ 189 + Request.encode = function encode(message, writer, _depth) { 190 + if (!writer) 191 + writer = $Writer.create(); 192 + if (_depth === undefined) 193 + _depth = 0; 194 + if (_depth > $util.recursionLimit) 195 + throw Error("max depth exceeded"); 196 + if (message.id != null && Object.hasOwnProperty.call(message, "id")) 197 + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.id); 198 + if (message.ping != null && Object.hasOwnProperty.call(message, "ping")) 199 + $root.subtext_handlers.Ping.encode(message.ping, writer.uint32(/* id 2, wireType 2 =*/18).fork(), _depth + 1).ldelim(); 200 + if (message.applyUpdateV2 != null && Object.hasOwnProperty.call(message, "applyUpdateV2")) 201 + $root.subtext_handlers.ApplyUpdateV2.encode(message.applyUpdateV2, writer.uint32(/* id 3, wireType 2 =*/26).fork(), _depth + 1).ldelim(); 202 + if (message.getStateVector != null && Object.hasOwnProperty.call(message, "getStateVector")) 203 + $root.subtext_handlers.GetStateVector.encode(message.getStateVector, writer.uint32(/* id 4, wireType 2 =*/34).fork(), _depth + 1).ldelim(); 204 + if (message.getFullState != null && Object.hasOwnProperty.call(message, "getFullState")) 205 + $root.subtext_handlers.GetFullState.encode(message.getFullState, writer.uint32(/* id 5, wireType 2 =*/42).fork(), _depth + 1).ldelim(); 206 + if (message.listFiles != null && Object.hasOwnProperty.call(message, "listFiles")) 207 + $root.subtext_handlers.ListFiles.encode(message.listFiles, writer.uint32(/* id 6, wireType 2 =*/50).fork(), _depth + 1).ldelim(); 208 + if (message.fileExists != null && Object.hasOwnProperty.call(message, "fileExists")) 209 + $root.subtext_handlers.FileExists.encode(message.fileExists, writer.uint32(/* id 7, wireType 2 =*/58).fork(), _depth + 1).ldelim(); 210 + if (message.createFile != null && Object.hasOwnProperty.call(message, "createFile")) 211 + $root.subtext_handlers.CreateFile.encode(message.createFile, writer.uint32(/* id 8, wireType 2 =*/66).fork(), _depth + 1).ldelim(); 212 + if (message.renameFile != null && Object.hasOwnProperty.call(message, "renameFile")) 213 + $root.subtext_handlers.RenameFile.encode(message.renameFile, writer.uint32(/* id 9, wireType 2 =*/74).fork(), _depth + 1).ldelim(); 214 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 215 + for (let i = 0; i < message.$unknowns.length; ++i) 216 + writer.raw(message.$unknowns[i]); 217 + return writer; 218 + }; 219 + 220 + /** 221 + * Encodes the specified Request message, length delimited. Does not implicitly {@link subtext_handlers.Request.verify|verify} messages. 222 + * @function encodeDelimited 223 + * @memberof subtext_handlers.Request 224 + * @static 225 + * @param {subtext_handlers.Request.$Properties} message Request message or plain object to encode 226 + * @param {$protobuf.Writer} [writer] Writer to encode to 227 + * @returns {$protobuf.Writer} Writer 228 + */ 229 + Request.encodeDelimited = function encodeDelimited(message, writer) { 230 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 231 + }; 232 + 233 + /** 234 + * Decodes a Request message from the specified reader or buffer. 235 + * @function decode 236 + * @memberof subtext_handlers.Request 237 + * @static 238 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 239 + * @param {number} [length] Message length if known beforehand 240 + * @returns {subtext_handlers.Request & subtext_handlers.Request.$Shape} Request 241 + * @throws {Error} If the payload is not a reader or valid buffer 242 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 243 + */ 244 + Request.decode = function decode(reader, length, _end, _depth, _target) { 245 + if (!(reader instanceof $Reader)) 246 + reader = $Reader.create(reader); 247 + if (_depth === undefined) 248 + _depth = 0; 249 + if (_depth > $Reader.recursionLimit) 250 + throw Error("max depth exceeded"); 251 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.Request(), value; 252 + while (reader.pos < end) { 253 + let start = reader.pos; 254 + let tag = reader.tag(); 255 + if (tag === _end) { 256 + _end = undefined; 257 + break; 258 + } 259 + let wireType = tag & 7; 260 + switch (tag >>>= 3) { 261 + case 1: { 262 + if (wireType !== 0) 263 + break; 264 + if (typeof (value = reader.uint64()) === "object" ? value.low || value.high : value !== 0) 265 + message.id = value; 266 + else 267 + delete message.id; 268 + continue; 269 + } 270 + case 2: { 271 + if (wireType !== 2) 272 + break; 273 + message.ping = $root.subtext_handlers.Ping.decode(reader, reader.uint32(), undefined, _depth + 1, message.ping); 274 + message.content = "ping"; 275 + continue; 276 + } 277 + case 3: { 278 + if (wireType !== 2) 279 + break; 280 + message.applyUpdateV2 = $root.subtext_handlers.ApplyUpdateV2.decode(reader, reader.uint32(), undefined, _depth + 1, message.applyUpdateV2); 281 + message.content = "applyUpdateV2"; 282 + continue; 283 + } 284 + case 4: { 285 + if (wireType !== 2) 286 + break; 287 + message.getStateVector = $root.subtext_handlers.GetStateVector.decode(reader, reader.uint32(), undefined, _depth + 1, message.getStateVector); 288 + message.content = "getStateVector"; 289 + continue; 290 + } 291 + case 5: { 292 + if (wireType !== 2) 293 + break; 294 + message.getFullState = $root.subtext_handlers.GetFullState.decode(reader, reader.uint32(), undefined, _depth + 1, message.getFullState); 295 + message.content = "getFullState"; 296 + continue; 297 + } 298 + case 6: { 299 + if (wireType !== 2) 300 + break; 301 + message.listFiles = $root.subtext_handlers.ListFiles.decode(reader, reader.uint32(), undefined, _depth + 1, message.listFiles); 302 + message.content = "listFiles"; 303 + continue; 304 + } 305 + case 7: { 306 + if (wireType !== 2) 307 + break; 308 + message.fileExists = $root.subtext_handlers.FileExists.decode(reader, reader.uint32(), undefined, _depth + 1, message.fileExists); 309 + message.content = "fileExists"; 310 + continue; 311 + } 312 + case 8: { 313 + if (wireType !== 2) 314 + break; 315 + message.createFile = $root.subtext_handlers.CreateFile.decode(reader, reader.uint32(), undefined, _depth + 1, message.createFile); 316 + message.content = "createFile"; 317 + continue; 318 + } 319 + case 9: { 320 + if (wireType !== 2) 321 + break; 322 + message.renameFile = $root.subtext_handlers.RenameFile.decode(reader, reader.uint32(), undefined, _depth + 1, message.renameFile); 323 + message.content = "renameFile"; 324 + continue; 325 + } 326 + } 327 + reader.skipType(wireType, _depth, tag); 328 + $util.makeProp(message, "$unknowns", false); 329 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 330 + } 331 + if (_end !== undefined) 332 + throw Error("missing end group"); 333 + return message; 334 + }; 335 + 336 + /** 337 + * Decodes a Request message from the specified reader or buffer, length delimited. 338 + * @function decodeDelimited 339 + * @memberof subtext_handlers.Request 340 + * @static 341 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 342 + * @returns {subtext_handlers.Request & subtext_handlers.Request.$Shape} Request 343 + * @throws {Error} If the payload is not a reader or valid buffer 344 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 345 + */ 346 + Request.decodeDelimited = function decodeDelimited(reader) { 347 + if (!(reader instanceof $Reader)) 348 + reader = new $Reader(reader); 349 + return this.decode(reader, reader.uint32()); 350 + }; 351 + 352 + /** 353 + * Verifies a Request message. 354 + * @function verify 355 + * @memberof subtext_handlers.Request 356 + * @static 357 + * @param {Object.<string,*>} message Plain object to verify 358 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 359 + */ 360 + Request.verify = function verify(message, _depth) { 361 + if (typeof message !== "object" || message === null) 362 + return "object expected"; 363 + if (_depth === undefined) 364 + _depth = 0; 365 + if (_depth > $util.recursionLimit) 366 + return "max depth exceeded"; 367 + let properties = {}; 368 + if (message.id != null && message.hasOwnProperty("id")) 369 + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) 370 + return "id: integer|Long expected"; 371 + if (message.ping != null && message.hasOwnProperty("ping")) { 372 + properties.content = 1; 373 + { 374 + let error = $root.subtext_handlers.Ping.verify(message.ping, _depth + 1); 375 + if (error) 376 + return "ping." + error; 377 + } 378 + } 379 + if (message.applyUpdateV2 != null && message.hasOwnProperty("applyUpdateV2")) { 380 + if (properties.content === 1) 381 + return "content: multiple values"; 382 + properties.content = 1; 383 + { 384 + let error = $root.subtext_handlers.ApplyUpdateV2.verify(message.applyUpdateV2, _depth + 1); 385 + if (error) 386 + return "applyUpdateV2." + error; 387 + } 388 + } 389 + if (message.getStateVector != null && message.hasOwnProperty("getStateVector")) { 390 + if (properties.content === 1) 391 + return "content: multiple values"; 392 + properties.content = 1; 393 + { 394 + let error = $root.subtext_handlers.GetStateVector.verify(message.getStateVector, _depth + 1); 395 + if (error) 396 + return "getStateVector." + error; 397 + } 398 + } 399 + if (message.getFullState != null && message.hasOwnProperty("getFullState")) { 400 + if (properties.content === 1) 401 + return "content: multiple values"; 402 + properties.content = 1; 403 + { 404 + let error = $root.subtext_handlers.GetFullState.verify(message.getFullState, _depth + 1); 405 + if (error) 406 + return "getFullState." + error; 407 + } 408 + } 409 + if (message.listFiles != null && message.hasOwnProperty("listFiles")) { 410 + if (properties.content === 1) 411 + return "content: multiple values"; 412 + properties.content = 1; 413 + { 414 + let error = $root.subtext_handlers.ListFiles.verify(message.listFiles, _depth + 1); 415 + if (error) 416 + return "listFiles." + error; 417 + } 418 + } 419 + if (message.fileExists != null && message.hasOwnProperty("fileExists")) { 420 + if (properties.content === 1) 421 + return "content: multiple values"; 422 + properties.content = 1; 423 + { 424 + let error = $root.subtext_handlers.FileExists.verify(message.fileExists, _depth + 1); 425 + if (error) 426 + return "fileExists." + error; 427 + } 428 + } 429 + if (message.createFile != null && message.hasOwnProperty("createFile")) { 430 + if (properties.content === 1) 431 + return "content: multiple values"; 432 + properties.content = 1; 433 + { 434 + let error = $root.subtext_handlers.CreateFile.verify(message.createFile, _depth + 1); 435 + if (error) 436 + return "createFile." + error; 437 + } 438 + } 439 + if (message.renameFile != null && message.hasOwnProperty("renameFile")) { 440 + if (properties.content === 1) 441 + return "content: multiple values"; 442 + properties.content = 1; 443 + { 444 + let error = $root.subtext_handlers.RenameFile.verify(message.renameFile, _depth + 1); 445 + if (error) 446 + return "renameFile." + error; 447 + } 448 + } 449 + return null; 450 + }; 451 + 452 + /** 453 + * Creates a Request message from a plain object. Also converts values to their respective internal types. 454 + * @function fromObject 455 + * @memberof subtext_handlers.Request 456 + * @static 457 + * @param {Object.<string,*>} object Plain object 458 + * @returns {subtext_handlers.Request} Request 459 + */ 460 + Request.fromObject = function fromObject(object, _depth) { 461 + if (object instanceof $root.subtext_handlers.Request) 462 + return object; 463 + if (_depth === undefined) 464 + _depth = 0; 465 + if (_depth > $util.recursionLimit) 466 + throw Error("max depth exceeded"); 467 + let message = new $root.subtext_handlers.Request(); 468 + if (object.id != null) 469 + if (typeof object.id === "object" ? object.id.low || object.id.high : Number(object.id) !== 0) 470 + if ($util.Long) 471 + message.id = $util.Long.fromValue(object.id, true); 472 + else if (typeof object.id === "string") 473 + message.id = parseInt(object.id, 10); 474 + else if (typeof object.id === "number") 475 + message.id = object.id; 476 + else if (typeof object.id === "object") 477 + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true); 478 + if (object.ping != null) { 479 + if (typeof object.ping !== "object") 480 + throw TypeError(".subtext_handlers.Request.ping: object expected"); 481 + message.ping = $root.subtext_handlers.Ping.fromObject(object.ping, _depth + 1); 482 + } 483 + if (object.applyUpdateV2 != null) { 484 + if (typeof object.applyUpdateV2 !== "object") 485 + throw TypeError(".subtext_handlers.Request.applyUpdateV2: object expected"); 486 + message.applyUpdateV2 = $root.subtext_handlers.ApplyUpdateV2.fromObject(object.applyUpdateV2, _depth + 1); 487 + } 488 + if (object.getStateVector != null) { 489 + if (typeof object.getStateVector !== "object") 490 + throw TypeError(".subtext_handlers.Request.getStateVector: object expected"); 491 + message.getStateVector = $root.subtext_handlers.GetStateVector.fromObject(object.getStateVector, _depth + 1); 492 + } 493 + if (object.getFullState != null) { 494 + if (typeof object.getFullState !== "object") 495 + throw TypeError(".subtext_handlers.Request.getFullState: object expected"); 496 + message.getFullState = $root.subtext_handlers.GetFullState.fromObject(object.getFullState, _depth + 1); 497 + } 498 + if (object.listFiles != null) { 499 + if (typeof object.listFiles !== "object") 500 + throw TypeError(".subtext_handlers.Request.listFiles: object expected"); 501 + message.listFiles = $root.subtext_handlers.ListFiles.fromObject(object.listFiles, _depth + 1); 502 + } 503 + if (object.fileExists != null) { 504 + if (typeof object.fileExists !== "object") 505 + throw TypeError(".subtext_handlers.Request.fileExists: object expected"); 506 + message.fileExists = $root.subtext_handlers.FileExists.fromObject(object.fileExists, _depth + 1); 507 + } 508 + if (object.createFile != null) { 509 + if (typeof object.createFile !== "object") 510 + throw TypeError(".subtext_handlers.Request.createFile: object expected"); 511 + message.createFile = $root.subtext_handlers.CreateFile.fromObject(object.createFile, _depth + 1); 512 + } 513 + if (object.renameFile != null) { 514 + if (typeof object.renameFile !== "object") 515 + throw TypeError(".subtext_handlers.Request.renameFile: object expected"); 516 + message.renameFile = $root.subtext_handlers.RenameFile.fromObject(object.renameFile, _depth + 1); 517 + } 518 + return message; 519 + }; 520 + 521 + /** 522 + * Creates a plain object from a Request message. Also converts values to other types if specified. 523 + * @function toObject 524 + * @memberof subtext_handlers.Request 525 + * @static 526 + * @param {subtext_handlers.Request} message Request 527 + * @param {$protobuf.IConversionOptions} [options] Conversion options 528 + * @returns {Object.<string,*>} Plain object 529 + */ 530 + Request.toObject = function toObject(message, options, _depth) { 531 + if (!options) 532 + options = {}; 533 + if (_depth === undefined) 534 + _depth = 0; 535 + if (_depth > $util.recursionLimit) 536 + throw Error("max depth exceeded"); 537 + let object = {}; 538 + if (options.defaults) 539 + if ($util.Long) { 540 + let long = new $util.Long(0, 0, true); 541 + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; 542 + } else 543 + object.id = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; 544 + if (message.id != null && message.hasOwnProperty("id")) 545 + if (typeof BigInt !== "undefined" && options.longs === BigInt) 546 + object.id = typeof message.id === "number" ? BigInt(message.id) : $util.Long.fromBits(message.id.low >>> 0, message.id.high >>> 0, true).toBigInt(); 547 + else if (typeof message.id === "number") 548 + object.id = options.longs === String ? String(message.id) : message.id; 549 + else 550 + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) : message.id; 551 + if (message.ping != null && message.hasOwnProperty("ping")) { 552 + object.ping = $root.subtext_handlers.Ping.toObject(message.ping, options, _depth + 1); 553 + if (options.oneofs) 554 + object.content = "ping"; 555 + } 556 + if (message.applyUpdateV2 != null && message.hasOwnProperty("applyUpdateV2")) { 557 + object.applyUpdateV2 = $root.subtext_handlers.ApplyUpdateV2.toObject(message.applyUpdateV2, options, _depth + 1); 558 + if (options.oneofs) 559 + object.content = "applyUpdateV2"; 560 + } 561 + if (message.getStateVector != null && message.hasOwnProperty("getStateVector")) { 562 + object.getStateVector = $root.subtext_handlers.GetStateVector.toObject(message.getStateVector, options, _depth + 1); 563 + if (options.oneofs) 564 + object.content = "getStateVector"; 565 + } 566 + if (message.getFullState != null && message.hasOwnProperty("getFullState")) { 567 + object.getFullState = $root.subtext_handlers.GetFullState.toObject(message.getFullState, options, _depth + 1); 568 + if (options.oneofs) 569 + object.content = "getFullState"; 570 + } 571 + if (message.listFiles != null && message.hasOwnProperty("listFiles")) { 572 + object.listFiles = $root.subtext_handlers.ListFiles.toObject(message.listFiles, options, _depth + 1); 573 + if (options.oneofs) 574 + object.content = "listFiles"; 575 + } 576 + if (message.fileExists != null && message.hasOwnProperty("fileExists")) { 577 + object.fileExists = $root.subtext_handlers.FileExists.toObject(message.fileExists, options, _depth + 1); 578 + if (options.oneofs) 579 + object.content = "fileExists"; 580 + } 581 + if (message.createFile != null && message.hasOwnProperty("createFile")) { 582 + object.createFile = $root.subtext_handlers.CreateFile.toObject(message.createFile, options, _depth + 1); 583 + if (options.oneofs) 584 + object.content = "createFile"; 585 + } 586 + if (message.renameFile != null && message.hasOwnProperty("renameFile")) { 587 + object.renameFile = $root.subtext_handlers.RenameFile.toObject(message.renameFile, options, _depth + 1); 588 + if (options.oneofs) 589 + object.content = "renameFile"; 590 + } 591 + return object; 592 + }; 593 + 594 + /** 595 + * Converts this Request to JSON. 596 + * @function toJSON 597 + * @memberof subtext_handlers.Request 598 + * @instance 599 + * @returns {Object.<string,*>} JSON object 600 + */ 601 + Request.prototype.toJSON = function toJSON() { 602 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 603 + }; 604 + 605 + /** 606 + * Gets the type url for Request 607 + * @function getTypeUrl 608 + * @memberof subtext_handlers.Request 609 + * @static 610 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 611 + * @returns {string} The type url 612 + */ 613 + Request.getTypeUrl = function getTypeUrl(prefix) { 614 + if (prefix === undefined) 615 + prefix = "type.googleapis.com"; 616 + return prefix + "/subtext_handlers.Request"; 617 + }; 618 + 619 + return Request; 620 + })(); 621 + 622 + subtext_handlers.Ping = (function() { 623 + 624 + /** 625 + * Properties of a Ping. 626 + * @typedef {Object} subtext_handlers.Ping.$Properties 627 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 628 + */ 629 + 630 + /** 631 + * Properties of a Ping. 632 + * @memberof subtext_handlers 633 + * @interface IPing 634 + * @augments subtext_handlers.Ping.$Properties 635 + * @deprecated Use subtext_handlers.Ping.$Properties instead. 636 + */ 637 + 638 + /** 639 + * Shape of a Ping. 640 + * @typedef {subtext_handlers.Ping.$Properties} subtext_handlers.Ping.$Shape 641 + */ 642 + 643 + /** 644 + * Constructs a new Ping. 645 + * @memberof subtext_handlers 646 + * @classdesc Represents a Ping. 647 + * @constructor 648 + * @param {subtext_handlers.Ping.$Properties=} [properties] Properties to set 649 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 650 + */ 651 + function Ping(properties) { 652 + if (properties) 653 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 654 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 655 + this[keys[i]] = properties[keys[i]]; 656 + } 657 + 658 + /** 659 + * Creates a new Ping instance using the specified properties. 660 + * @function create 661 + * @memberof subtext_handlers.Ping 662 + * @static 663 + * @param {subtext_handlers.Ping.$Properties=} [properties] Properties to set 664 + * @returns {subtext_handlers.Ping} Ping instance 665 + * @type {{ 666 + * (properties: subtext_handlers.Ping.$Shape): subtext_handlers.Ping & subtext_handlers.Ping.$Shape; 667 + * (properties?: subtext_handlers.Ping.$Properties): subtext_handlers.Ping; 668 + * }} 669 + */ 670 + Ping.create = function create(properties) { 671 + return new Ping(properties); 672 + }; 673 + 674 + /** 675 + * Encodes the specified Ping message. Does not implicitly {@link subtext_handlers.Ping.verify|verify} messages. 676 + * @function encode 677 + * @memberof subtext_handlers.Ping 678 + * @static 679 + * @param {subtext_handlers.Ping.$Properties} message Ping message or plain object to encode 680 + * @param {$protobuf.Writer} [writer] Writer to encode to 681 + * @returns {$protobuf.Writer} Writer 682 + */ 683 + Ping.encode = function encode(message, writer, _depth) { 684 + if (!writer) 685 + writer = $Writer.create(); 686 + if (_depth === undefined) 687 + _depth = 0; 688 + if (_depth > $util.recursionLimit) 689 + throw Error("max depth exceeded"); 690 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 691 + for (let i = 0; i < message.$unknowns.length; ++i) 692 + writer.raw(message.$unknowns[i]); 693 + return writer; 694 + }; 695 + 696 + /** 697 + * Encodes the specified Ping message, length delimited. Does not implicitly {@link subtext_handlers.Ping.verify|verify} messages. 698 + * @function encodeDelimited 699 + * @memberof subtext_handlers.Ping 700 + * @static 701 + * @param {subtext_handlers.Ping.$Properties} message Ping message or plain object to encode 702 + * @param {$protobuf.Writer} [writer] Writer to encode to 703 + * @returns {$protobuf.Writer} Writer 704 + */ 705 + Ping.encodeDelimited = function encodeDelimited(message, writer) { 706 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 707 + }; 708 + 709 + /** 710 + * Decodes a Ping message from the specified reader or buffer. 711 + * @function decode 712 + * @memberof subtext_handlers.Ping 713 + * @static 714 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 715 + * @param {number} [length] Message length if known beforehand 716 + * @returns {subtext_handlers.Ping & subtext_handlers.Ping.$Shape} Ping 717 + * @throws {Error} If the payload is not a reader or valid buffer 718 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 719 + */ 720 + Ping.decode = function decode(reader, length, _end, _depth, _target) { 721 + if (!(reader instanceof $Reader)) 722 + reader = $Reader.create(reader); 723 + if (_depth === undefined) 724 + _depth = 0; 725 + if (_depth > $Reader.recursionLimit) 726 + throw Error("max depth exceeded"); 727 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.Ping(); 728 + while (reader.pos < end) { 729 + let start = reader.pos; 730 + let tag = reader.tag(); 731 + if (tag === _end) { 732 + _end = undefined; 733 + break; 734 + } 735 + reader.skipType(tag & 7, _depth, tag); 736 + $util.makeProp(message, "$unknowns", false); 737 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 738 + } 739 + if (_end !== undefined) 740 + throw Error("missing end group"); 741 + return message; 742 + }; 743 + 744 + /** 745 + * Decodes a Ping message from the specified reader or buffer, length delimited. 746 + * @function decodeDelimited 747 + * @memberof subtext_handlers.Ping 748 + * @static 749 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 750 + * @returns {subtext_handlers.Ping & subtext_handlers.Ping.$Shape} Ping 751 + * @throws {Error} If the payload is not a reader or valid buffer 752 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 753 + */ 754 + Ping.decodeDelimited = function decodeDelimited(reader) { 755 + if (!(reader instanceof $Reader)) 756 + reader = new $Reader(reader); 757 + return this.decode(reader, reader.uint32()); 758 + }; 759 + 760 + /** 761 + * Verifies a Ping message. 762 + * @function verify 763 + * @memberof subtext_handlers.Ping 764 + * @static 765 + * @param {Object.<string,*>} message Plain object to verify 766 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 767 + */ 768 + Ping.verify = function verify(message, _depth) { 769 + if (typeof message !== "object" || message === null) 770 + return "object expected"; 771 + if (_depth === undefined) 772 + _depth = 0; 773 + if (_depth > $util.recursionLimit) 774 + return "max depth exceeded"; 775 + return null; 776 + }; 777 + 778 + /** 779 + * Creates a Ping message from a plain object. Also converts values to their respective internal types. 780 + * @function fromObject 781 + * @memberof subtext_handlers.Ping 782 + * @static 783 + * @param {Object.<string,*>} object Plain object 784 + * @returns {subtext_handlers.Ping} Ping 785 + */ 786 + Ping.fromObject = function fromObject(object, _depth) { 787 + if (object instanceof $root.subtext_handlers.Ping) 788 + return object; 789 + if (_depth === undefined) 790 + _depth = 0; 791 + if (_depth > $util.recursionLimit) 792 + throw Error("max depth exceeded"); 793 + return new $root.subtext_handlers.Ping(); 794 + }; 795 + 796 + /** 797 + * Creates a plain object from a Ping message. Also converts values to other types if specified. 798 + * @function toObject 799 + * @memberof subtext_handlers.Ping 800 + * @static 801 + * @param {subtext_handlers.Ping} message Ping 802 + * @param {$protobuf.IConversionOptions} [options] Conversion options 803 + * @returns {Object.<string,*>} Plain object 804 + */ 805 + Ping.toObject = function toObject() { 806 + return {}; 807 + }; 808 + 809 + /** 810 + * Converts this Ping to JSON. 811 + * @function toJSON 812 + * @memberof subtext_handlers.Ping 813 + * @instance 814 + * @returns {Object.<string,*>} JSON object 815 + */ 816 + Ping.prototype.toJSON = function toJSON() { 817 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 818 + }; 819 + 820 + /** 821 + * Gets the type url for Ping 822 + * @function getTypeUrl 823 + * @memberof subtext_handlers.Ping 824 + * @static 825 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 826 + * @returns {string} The type url 827 + */ 828 + Ping.getTypeUrl = function getTypeUrl(prefix) { 829 + if (prefix === undefined) 830 + prefix = "type.googleapis.com"; 831 + return prefix + "/subtext_handlers.Ping"; 832 + }; 833 + 834 + return Ping; 835 + })(); 836 + 837 + subtext_handlers.ApplyUpdateV2 = (function() { 838 + 839 + /** 840 + * Properties of an ApplyUpdateV2. 841 + * @typedef {Object} subtext_handlers.ApplyUpdateV2.$Properties 842 + * @property {string|null} [vaultPath] ApplyUpdateV2 vaultPath 843 + * @property {Uint8Array|null} [update] ApplyUpdateV2 update 844 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 845 + */ 846 + 847 + /** 848 + * Properties of an ApplyUpdateV2. 849 + * @memberof subtext_handlers 850 + * @interface IApplyUpdateV2 851 + * @augments subtext_handlers.ApplyUpdateV2.$Properties 852 + * @deprecated Use subtext_handlers.ApplyUpdateV2.$Properties instead. 853 + */ 854 + 855 + /** 856 + * Shape of an ApplyUpdateV2. 857 + * @typedef {subtext_handlers.ApplyUpdateV2.$Properties} subtext_handlers.ApplyUpdateV2.$Shape 858 + */ 859 + 860 + /** 861 + * Constructs a new ApplyUpdateV2. 862 + * @memberof subtext_handlers 863 + * @classdesc Represents an ApplyUpdateV2. 864 + * @constructor 865 + * @param {subtext_handlers.ApplyUpdateV2.$Properties=} [properties] Properties to set 866 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 867 + */ 868 + function ApplyUpdateV2(properties) { 869 + if (properties) 870 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 871 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 872 + this[keys[i]] = properties[keys[i]]; 873 + } 874 + 875 + /** 876 + * ApplyUpdateV2 vaultPath. 877 + * @member {string} vaultPath 878 + * @memberof subtext_handlers.ApplyUpdateV2 879 + * @instance 880 + */ 881 + ApplyUpdateV2.prototype.vaultPath = ""; 882 + 883 + /** 884 + * ApplyUpdateV2 update. 885 + * @member {Uint8Array} update 886 + * @memberof subtext_handlers.ApplyUpdateV2 887 + * @instance 888 + */ 889 + ApplyUpdateV2.prototype.update = $util.newBuffer([]); 890 + 891 + /** 892 + * Creates a new ApplyUpdateV2 instance using the specified properties. 893 + * @function create 894 + * @memberof subtext_handlers.ApplyUpdateV2 895 + * @static 896 + * @param {subtext_handlers.ApplyUpdateV2.$Properties=} [properties] Properties to set 897 + * @returns {subtext_handlers.ApplyUpdateV2} ApplyUpdateV2 instance 898 + * @type {{ 899 + * (properties: subtext_handlers.ApplyUpdateV2.$Shape): subtext_handlers.ApplyUpdateV2 & subtext_handlers.ApplyUpdateV2.$Shape; 900 + * (properties?: subtext_handlers.ApplyUpdateV2.$Properties): subtext_handlers.ApplyUpdateV2; 901 + * }} 902 + */ 903 + ApplyUpdateV2.create = function create(properties) { 904 + return new ApplyUpdateV2(properties); 905 + }; 906 + 907 + /** 908 + * Encodes the specified ApplyUpdateV2 message. Does not implicitly {@link subtext_handlers.ApplyUpdateV2.verify|verify} messages. 909 + * @function encode 910 + * @memberof subtext_handlers.ApplyUpdateV2 911 + * @static 912 + * @param {subtext_handlers.ApplyUpdateV2.$Properties} message ApplyUpdateV2 message or plain object to encode 913 + * @param {$protobuf.Writer} [writer] Writer to encode to 914 + * @returns {$protobuf.Writer} Writer 915 + */ 916 + ApplyUpdateV2.encode = function encode(message, writer, _depth) { 917 + if (!writer) 918 + writer = $Writer.create(); 919 + if (_depth === undefined) 920 + _depth = 0; 921 + if (_depth > $util.recursionLimit) 922 + throw Error("max depth exceeded"); 923 + if (message.vaultPath != null && Object.hasOwnProperty.call(message, "vaultPath")) 924 + writer.uint32(/* id 1, wireType 2 =*/10).string(message.vaultPath); 925 + if (message.update != null && Object.hasOwnProperty.call(message, "update")) 926 + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.update); 927 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 928 + for (let i = 0; i < message.$unknowns.length; ++i) 929 + writer.raw(message.$unknowns[i]); 930 + return writer; 931 + }; 932 + 933 + /** 934 + * Encodes the specified ApplyUpdateV2 message, length delimited. Does not implicitly {@link subtext_handlers.ApplyUpdateV2.verify|verify} messages. 935 + * @function encodeDelimited 936 + * @memberof subtext_handlers.ApplyUpdateV2 937 + * @static 938 + * @param {subtext_handlers.ApplyUpdateV2.$Properties} message ApplyUpdateV2 message or plain object to encode 939 + * @param {$protobuf.Writer} [writer] Writer to encode to 940 + * @returns {$protobuf.Writer} Writer 941 + */ 942 + ApplyUpdateV2.encodeDelimited = function encodeDelimited(message, writer) { 943 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 944 + }; 945 + 946 + /** 947 + * Decodes an ApplyUpdateV2 message from the specified reader or buffer. 948 + * @function decode 949 + * @memberof subtext_handlers.ApplyUpdateV2 950 + * @static 951 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 952 + * @param {number} [length] Message length if known beforehand 953 + * @returns {subtext_handlers.ApplyUpdateV2 & subtext_handlers.ApplyUpdateV2.$Shape} ApplyUpdateV2 954 + * @throws {Error} If the payload is not a reader or valid buffer 955 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 956 + */ 957 + ApplyUpdateV2.decode = function decode(reader, length, _end, _depth, _target) { 958 + if (!(reader instanceof $Reader)) 959 + reader = $Reader.create(reader); 960 + if (_depth === undefined) 961 + _depth = 0; 962 + if (_depth > $Reader.recursionLimit) 963 + throw Error("max depth exceeded"); 964 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.ApplyUpdateV2(), value; 965 + while (reader.pos < end) { 966 + let start = reader.pos; 967 + let tag = reader.tag(); 968 + if (tag === _end) { 969 + _end = undefined; 970 + break; 971 + } 972 + let wireType = tag & 7; 973 + switch (tag >>>= 3) { 974 + case 1: { 975 + if (wireType !== 2) 976 + break; 977 + if ((value = reader.string()).length) 978 + message.vaultPath = value; 979 + else 980 + delete message.vaultPath; 981 + continue; 982 + } 983 + case 2: { 984 + if (wireType !== 2) 985 + break; 986 + if ((value = reader.bytes()).length) 987 + message.update = value; 988 + else 989 + delete message.update; 990 + continue; 991 + } 992 + } 993 + reader.skipType(wireType, _depth, tag); 994 + $util.makeProp(message, "$unknowns", false); 995 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 996 + } 997 + if (_end !== undefined) 998 + throw Error("missing end group"); 999 + return message; 1000 + }; 1001 + 1002 + /** 1003 + * Decodes an ApplyUpdateV2 message from the specified reader or buffer, length delimited. 1004 + * @function decodeDelimited 1005 + * @memberof subtext_handlers.ApplyUpdateV2 1006 + * @static 1007 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 1008 + * @returns {subtext_handlers.ApplyUpdateV2 & subtext_handlers.ApplyUpdateV2.$Shape} ApplyUpdateV2 1009 + * @throws {Error} If the payload is not a reader or valid buffer 1010 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1011 + */ 1012 + ApplyUpdateV2.decodeDelimited = function decodeDelimited(reader) { 1013 + if (!(reader instanceof $Reader)) 1014 + reader = new $Reader(reader); 1015 + return this.decode(reader, reader.uint32()); 1016 + }; 1017 + 1018 + /** 1019 + * Verifies an ApplyUpdateV2 message. 1020 + * @function verify 1021 + * @memberof subtext_handlers.ApplyUpdateV2 1022 + * @static 1023 + * @param {Object.<string,*>} message Plain object to verify 1024 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 1025 + */ 1026 + ApplyUpdateV2.verify = function verify(message, _depth) { 1027 + if (typeof message !== "object" || message === null) 1028 + return "object expected"; 1029 + if (_depth === undefined) 1030 + _depth = 0; 1031 + if (_depth > $util.recursionLimit) 1032 + return "max depth exceeded"; 1033 + if (message.vaultPath != null && message.hasOwnProperty("vaultPath")) 1034 + if (!$util.isString(message.vaultPath)) 1035 + return "vaultPath: string expected"; 1036 + if (message.update != null && message.hasOwnProperty("update")) 1037 + if (!(message.update && typeof message.update.length === "number" || $util.isString(message.update))) 1038 + return "update: buffer expected"; 1039 + return null; 1040 + }; 1041 + 1042 + /** 1043 + * Creates an ApplyUpdateV2 message from a plain object. Also converts values to their respective internal types. 1044 + * @function fromObject 1045 + * @memberof subtext_handlers.ApplyUpdateV2 1046 + * @static 1047 + * @param {Object.<string,*>} object Plain object 1048 + * @returns {subtext_handlers.ApplyUpdateV2} ApplyUpdateV2 1049 + */ 1050 + ApplyUpdateV2.fromObject = function fromObject(object, _depth) { 1051 + if (object instanceof $root.subtext_handlers.ApplyUpdateV2) 1052 + return object; 1053 + if (_depth === undefined) 1054 + _depth = 0; 1055 + if (_depth > $util.recursionLimit) 1056 + throw Error("max depth exceeded"); 1057 + let message = new $root.subtext_handlers.ApplyUpdateV2(); 1058 + if (object.vaultPath != null) 1059 + if (typeof object.vaultPath !== "string" || object.vaultPath.length) 1060 + message.vaultPath = String(object.vaultPath); 1061 + if (object.update != null) 1062 + if (object.update.length) 1063 + if (typeof object.update === "string") 1064 + $util.base64.decode(object.update, message.update = $util.newBuffer($util.base64.length(object.update)), 0); 1065 + else if (object.update.length >= 0) 1066 + message.update = object.update; 1067 + return message; 1068 + }; 1069 + 1070 + /** 1071 + * Creates a plain object from an ApplyUpdateV2 message. Also converts values to other types if specified. 1072 + * @function toObject 1073 + * @memberof subtext_handlers.ApplyUpdateV2 1074 + * @static 1075 + * @param {subtext_handlers.ApplyUpdateV2} message ApplyUpdateV2 1076 + * @param {$protobuf.IConversionOptions} [options] Conversion options 1077 + * @returns {Object.<string,*>} Plain object 1078 + */ 1079 + ApplyUpdateV2.toObject = function toObject(message, options, _depth) { 1080 + if (!options) 1081 + options = {}; 1082 + if (_depth === undefined) 1083 + _depth = 0; 1084 + if (_depth > $util.recursionLimit) 1085 + throw Error("max depth exceeded"); 1086 + let object = {}; 1087 + if (options.defaults) { 1088 + object.vaultPath = ""; 1089 + if (options.bytes === String) 1090 + object.update = ""; 1091 + else { 1092 + object.update = []; 1093 + if (options.bytes !== Array) 1094 + object.update = $util.newBuffer(object.update); 1095 + } 1096 + } 1097 + if (message.vaultPath != null && message.hasOwnProperty("vaultPath")) 1098 + object.vaultPath = message.vaultPath; 1099 + if (message.update != null && message.hasOwnProperty("update")) 1100 + object.update = options.bytes === String ? $util.base64.encode(message.update, 0, message.update.length) : options.bytes === Array ? Array.prototype.slice.call(message.update) : message.update; 1101 + return object; 1102 + }; 1103 + 1104 + /** 1105 + * Converts this ApplyUpdateV2 to JSON. 1106 + * @function toJSON 1107 + * @memberof subtext_handlers.ApplyUpdateV2 1108 + * @instance 1109 + * @returns {Object.<string,*>} JSON object 1110 + */ 1111 + ApplyUpdateV2.prototype.toJSON = function toJSON() { 1112 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 1113 + }; 1114 + 1115 + /** 1116 + * Gets the type url for ApplyUpdateV2 1117 + * @function getTypeUrl 1118 + * @memberof subtext_handlers.ApplyUpdateV2 1119 + * @static 1120 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1121 + * @returns {string} The type url 1122 + */ 1123 + ApplyUpdateV2.getTypeUrl = function getTypeUrl(prefix) { 1124 + if (prefix === undefined) 1125 + prefix = "type.googleapis.com"; 1126 + return prefix + "/subtext_handlers.ApplyUpdateV2"; 1127 + }; 1128 + 1129 + return ApplyUpdateV2; 1130 + })(); 1131 + 1132 + subtext_handlers.GetStateVector = (function() { 1133 + 1134 + /** 1135 + * Properties of a GetStateVector. 1136 + * @typedef {Object} subtext_handlers.GetStateVector.$Properties 1137 + * @property {string|null} [vaultPath] GetStateVector vaultPath 1138 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 1139 + */ 1140 + 1141 + /** 1142 + * Properties of a GetStateVector. 1143 + * @memberof subtext_handlers 1144 + * @interface IGetStateVector 1145 + * @augments subtext_handlers.GetStateVector.$Properties 1146 + * @deprecated Use subtext_handlers.GetStateVector.$Properties instead. 1147 + */ 1148 + 1149 + /** 1150 + * Shape of a GetStateVector. 1151 + * @typedef {subtext_handlers.GetStateVector.$Properties} subtext_handlers.GetStateVector.$Shape 1152 + */ 1153 + 1154 + /** 1155 + * Constructs a new GetStateVector. 1156 + * @memberof subtext_handlers 1157 + * @classdesc Represents a GetStateVector. 1158 + * @constructor 1159 + * @param {subtext_handlers.GetStateVector.$Properties=} [properties] Properties to set 1160 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 1161 + */ 1162 + function GetStateVector(properties) { 1163 + if (properties) 1164 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 1165 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 1166 + this[keys[i]] = properties[keys[i]]; 1167 + } 1168 + 1169 + /** 1170 + * GetStateVector vaultPath. 1171 + * @member {string} vaultPath 1172 + * @memberof subtext_handlers.GetStateVector 1173 + * @instance 1174 + */ 1175 + GetStateVector.prototype.vaultPath = ""; 1176 + 1177 + /** 1178 + * Creates a new GetStateVector instance using the specified properties. 1179 + * @function create 1180 + * @memberof subtext_handlers.GetStateVector 1181 + * @static 1182 + * @param {subtext_handlers.GetStateVector.$Properties=} [properties] Properties to set 1183 + * @returns {subtext_handlers.GetStateVector} GetStateVector instance 1184 + * @type {{ 1185 + * (properties: subtext_handlers.GetStateVector.$Shape): subtext_handlers.GetStateVector & subtext_handlers.GetStateVector.$Shape; 1186 + * (properties?: subtext_handlers.GetStateVector.$Properties): subtext_handlers.GetStateVector; 1187 + * }} 1188 + */ 1189 + GetStateVector.create = function create(properties) { 1190 + return new GetStateVector(properties); 1191 + }; 1192 + 1193 + /** 1194 + * Encodes the specified GetStateVector message. Does not implicitly {@link subtext_handlers.GetStateVector.verify|verify} messages. 1195 + * @function encode 1196 + * @memberof subtext_handlers.GetStateVector 1197 + * @static 1198 + * @param {subtext_handlers.GetStateVector.$Properties} message GetStateVector message or plain object to encode 1199 + * @param {$protobuf.Writer} [writer] Writer to encode to 1200 + * @returns {$protobuf.Writer} Writer 1201 + */ 1202 + GetStateVector.encode = function encode(message, writer, _depth) { 1203 + if (!writer) 1204 + writer = $Writer.create(); 1205 + if (_depth === undefined) 1206 + _depth = 0; 1207 + if (_depth > $util.recursionLimit) 1208 + throw Error("max depth exceeded"); 1209 + if (message.vaultPath != null && Object.hasOwnProperty.call(message, "vaultPath")) 1210 + writer.uint32(/* id 1, wireType 2 =*/10).string(message.vaultPath); 1211 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 1212 + for (let i = 0; i < message.$unknowns.length; ++i) 1213 + writer.raw(message.$unknowns[i]); 1214 + return writer; 1215 + }; 1216 + 1217 + /** 1218 + * Encodes the specified GetStateVector message, length delimited. Does not implicitly {@link subtext_handlers.GetStateVector.verify|verify} messages. 1219 + * @function encodeDelimited 1220 + * @memberof subtext_handlers.GetStateVector 1221 + * @static 1222 + * @param {subtext_handlers.GetStateVector.$Properties} message GetStateVector message or plain object to encode 1223 + * @param {$protobuf.Writer} [writer] Writer to encode to 1224 + * @returns {$protobuf.Writer} Writer 1225 + */ 1226 + GetStateVector.encodeDelimited = function encodeDelimited(message, writer) { 1227 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 1228 + }; 1229 + 1230 + /** 1231 + * Decodes a GetStateVector message from the specified reader or buffer. 1232 + * @function decode 1233 + * @memberof subtext_handlers.GetStateVector 1234 + * @static 1235 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 1236 + * @param {number} [length] Message length if known beforehand 1237 + * @returns {subtext_handlers.GetStateVector & subtext_handlers.GetStateVector.$Shape} GetStateVector 1238 + * @throws {Error} If the payload is not a reader or valid buffer 1239 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1240 + */ 1241 + GetStateVector.decode = function decode(reader, length, _end, _depth, _target) { 1242 + if (!(reader instanceof $Reader)) 1243 + reader = $Reader.create(reader); 1244 + if (_depth === undefined) 1245 + _depth = 0; 1246 + if (_depth > $Reader.recursionLimit) 1247 + throw Error("max depth exceeded"); 1248 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.GetStateVector(), value; 1249 + while (reader.pos < end) { 1250 + let start = reader.pos; 1251 + let tag = reader.tag(); 1252 + if (tag === _end) { 1253 + _end = undefined; 1254 + break; 1255 + } 1256 + let wireType = tag & 7; 1257 + switch (tag >>>= 3) { 1258 + case 1: { 1259 + if (wireType !== 2) 1260 + break; 1261 + if ((value = reader.string()).length) 1262 + message.vaultPath = value; 1263 + else 1264 + delete message.vaultPath; 1265 + continue; 1266 + } 1267 + } 1268 + reader.skipType(wireType, _depth, tag); 1269 + $util.makeProp(message, "$unknowns", false); 1270 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 1271 + } 1272 + if (_end !== undefined) 1273 + throw Error("missing end group"); 1274 + return message; 1275 + }; 1276 + 1277 + /** 1278 + * Decodes a GetStateVector message from the specified reader or buffer, length delimited. 1279 + * @function decodeDelimited 1280 + * @memberof subtext_handlers.GetStateVector 1281 + * @static 1282 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 1283 + * @returns {subtext_handlers.GetStateVector & subtext_handlers.GetStateVector.$Shape} GetStateVector 1284 + * @throws {Error} If the payload is not a reader or valid buffer 1285 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1286 + */ 1287 + GetStateVector.decodeDelimited = function decodeDelimited(reader) { 1288 + if (!(reader instanceof $Reader)) 1289 + reader = new $Reader(reader); 1290 + return this.decode(reader, reader.uint32()); 1291 + }; 1292 + 1293 + /** 1294 + * Verifies a GetStateVector message. 1295 + * @function verify 1296 + * @memberof subtext_handlers.GetStateVector 1297 + * @static 1298 + * @param {Object.<string,*>} message Plain object to verify 1299 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 1300 + */ 1301 + GetStateVector.verify = function verify(message, _depth) { 1302 + if (typeof message !== "object" || message === null) 1303 + return "object expected"; 1304 + if (_depth === undefined) 1305 + _depth = 0; 1306 + if (_depth > $util.recursionLimit) 1307 + return "max depth exceeded"; 1308 + if (message.vaultPath != null && message.hasOwnProperty("vaultPath")) 1309 + if (!$util.isString(message.vaultPath)) 1310 + return "vaultPath: string expected"; 1311 + return null; 1312 + }; 1313 + 1314 + /** 1315 + * Creates a GetStateVector message from a plain object. Also converts values to their respective internal types. 1316 + * @function fromObject 1317 + * @memberof subtext_handlers.GetStateVector 1318 + * @static 1319 + * @param {Object.<string,*>} object Plain object 1320 + * @returns {subtext_handlers.GetStateVector} GetStateVector 1321 + */ 1322 + GetStateVector.fromObject = function fromObject(object, _depth) { 1323 + if (object instanceof $root.subtext_handlers.GetStateVector) 1324 + return object; 1325 + if (_depth === undefined) 1326 + _depth = 0; 1327 + if (_depth > $util.recursionLimit) 1328 + throw Error("max depth exceeded"); 1329 + let message = new $root.subtext_handlers.GetStateVector(); 1330 + if (object.vaultPath != null) 1331 + if (typeof object.vaultPath !== "string" || object.vaultPath.length) 1332 + message.vaultPath = String(object.vaultPath); 1333 + return message; 1334 + }; 1335 + 1336 + /** 1337 + * Creates a plain object from a GetStateVector message. Also converts values to other types if specified. 1338 + * @function toObject 1339 + * @memberof subtext_handlers.GetStateVector 1340 + * @static 1341 + * @param {subtext_handlers.GetStateVector} message GetStateVector 1342 + * @param {$protobuf.IConversionOptions} [options] Conversion options 1343 + * @returns {Object.<string,*>} Plain object 1344 + */ 1345 + GetStateVector.toObject = function toObject(message, options, _depth) { 1346 + if (!options) 1347 + options = {}; 1348 + if (_depth === undefined) 1349 + _depth = 0; 1350 + if (_depth > $util.recursionLimit) 1351 + throw Error("max depth exceeded"); 1352 + let object = {}; 1353 + if (options.defaults) 1354 + object.vaultPath = ""; 1355 + if (message.vaultPath != null && message.hasOwnProperty("vaultPath")) 1356 + object.vaultPath = message.vaultPath; 1357 + return object; 1358 + }; 1359 + 1360 + /** 1361 + * Converts this GetStateVector to JSON. 1362 + * @function toJSON 1363 + * @memberof subtext_handlers.GetStateVector 1364 + * @instance 1365 + * @returns {Object.<string,*>} JSON object 1366 + */ 1367 + GetStateVector.prototype.toJSON = function toJSON() { 1368 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 1369 + }; 1370 + 1371 + /** 1372 + * Gets the type url for GetStateVector 1373 + * @function getTypeUrl 1374 + * @memberof subtext_handlers.GetStateVector 1375 + * @static 1376 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1377 + * @returns {string} The type url 1378 + */ 1379 + GetStateVector.getTypeUrl = function getTypeUrl(prefix) { 1380 + if (prefix === undefined) 1381 + prefix = "type.googleapis.com"; 1382 + return prefix + "/subtext_handlers.GetStateVector"; 1383 + }; 1384 + 1385 + return GetStateVector; 1386 + })(); 1387 + 1388 + subtext_handlers.GetFullState = (function() { 1389 + 1390 + /** 1391 + * Properties of a GetFullState. 1392 + * @typedef {Object} subtext_handlers.GetFullState.$Properties 1393 + * @property {string|null} [vaultPath] GetFullState vaultPath 1394 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 1395 + */ 1396 + 1397 + /** 1398 + * Properties of a GetFullState. 1399 + * @memberof subtext_handlers 1400 + * @interface IGetFullState 1401 + * @augments subtext_handlers.GetFullState.$Properties 1402 + * @deprecated Use subtext_handlers.GetFullState.$Properties instead. 1403 + */ 1404 + 1405 + /** 1406 + * Shape of a GetFullState. 1407 + * @typedef {subtext_handlers.GetFullState.$Properties} subtext_handlers.GetFullState.$Shape 1408 + */ 1409 + 1410 + /** 1411 + * Constructs a new GetFullState. 1412 + * @memberof subtext_handlers 1413 + * @classdesc Represents a GetFullState. 1414 + * @constructor 1415 + * @param {subtext_handlers.GetFullState.$Properties=} [properties] Properties to set 1416 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 1417 + */ 1418 + function GetFullState(properties) { 1419 + if (properties) 1420 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 1421 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 1422 + this[keys[i]] = properties[keys[i]]; 1423 + } 1424 + 1425 + /** 1426 + * GetFullState vaultPath. 1427 + * @member {string} vaultPath 1428 + * @memberof subtext_handlers.GetFullState 1429 + * @instance 1430 + */ 1431 + GetFullState.prototype.vaultPath = ""; 1432 + 1433 + /** 1434 + * Creates a new GetFullState instance using the specified properties. 1435 + * @function create 1436 + * @memberof subtext_handlers.GetFullState 1437 + * @static 1438 + * @param {subtext_handlers.GetFullState.$Properties=} [properties] Properties to set 1439 + * @returns {subtext_handlers.GetFullState} GetFullState instance 1440 + * @type {{ 1441 + * (properties: subtext_handlers.GetFullState.$Shape): subtext_handlers.GetFullState & subtext_handlers.GetFullState.$Shape; 1442 + * (properties?: subtext_handlers.GetFullState.$Properties): subtext_handlers.GetFullState; 1443 + * }} 1444 + */ 1445 + GetFullState.create = function create(properties) { 1446 + return new GetFullState(properties); 1447 + }; 1448 + 1449 + /** 1450 + * Encodes the specified GetFullState message. Does not implicitly {@link subtext_handlers.GetFullState.verify|verify} messages. 1451 + * @function encode 1452 + * @memberof subtext_handlers.GetFullState 1453 + * @static 1454 + * @param {subtext_handlers.GetFullState.$Properties} message GetFullState message or plain object to encode 1455 + * @param {$protobuf.Writer} [writer] Writer to encode to 1456 + * @returns {$protobuf.Writer} Writer 1457 + */ 1458 + GetFullState.encode = function encode(message, writer, _depth) { 1459 + if (!writer) 1460 + writer = $Writer.create(); 1461 + if (_depth === undefined) 1462 + _depth = 0; 1463 + if (_depth > $util.recursionLimit) 1464 + throw Error("max depth exceeded"); 1465 + if (message.vaultPath != null && Object.hasOwnProperty.call(message, "vaultPath")) 1466 + writer.uint32(/* id 1, wireType 2 =*/10).string(message.vaultPath); 1467 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 1468 + for (let i = 0; i < message.$unknowns.length; ++i) 1469 + writer.raw(message.$unknowns[i]); 1470 + return writer; 1471 + }; 1472 + 1473 + /** 1474 + * Encodes the specified GetFullState message, length delimited. Does not implicitly {@link subtext_handlers.GetFullState.verify|verify} messages. 1475 + * @function encodeDelimited 1476 + * @memberof subtext_handlers.GetFullState 1477 + * @static 1478 + * @param {subtext_handlers.GetFullState.$Properties} message GetFullState message or plain object to encode 1479 + * @param {$protobuf.Writer} [writer] Writer to encode to 1480 + * @returns {$protobuf.Writer} Writer 1481 + */ 1482 + GetFullState.encodeDelimited = function encodeDelimited(message, writer) { 1483 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 1484 + }; 1485 + 1486 + /** 1487 + * Decodes a GetFullState message from the specified reader or buffer. 1488 + * @function decode 1489 + * @memberof subtext_handlers.GetFullState 1490 + * @static 1491 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 1492 + * @param {number} [length] Message length if known beforehand 1493 + * @returns {subtext_handlers.GetFullState & subtext_handlers.GetFullState.$Shape} GetFullState 1494 + * @throws {Error} If the payload is not a reader or valid buffer 1495 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1496 + */ 1497 + GetFullState.decode = function decode(reader, length, _end, _depth, _target) { 1498 + if (!(reader instanceof $Reader)) 1499 + reader = $Reader.create(reader); 1500 + if (_depth === undefined) 1501 + _depth = 0; 1502 + if (_depth > $Reader.recursionLimit) 1503 + throw Error("max depth exceeded"); 1504 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.GetFullState(), value; 1505 + while (reader.pos < end) { 1506 + let start = reader.pos; 1507 + let tag = reader.tag(); 1508 + if (tag === _end) { 1509 + _end = undefined; 1510 + break; 1511 + } 1512 + let wireType = tag & 7; 1513 + switch (tag >>>= 3) { 1514 + case 1: { 1515 + if (wireType !== 2) 1516 + break; 1517 + if ((value = reader.string()).length) 1518 + message.vaultPath = value; 1519 + else 1520 + delete message.vaultPath; 1521 + continue; 1522 + } 1523 + } 1524 + reader.skipType(wireType, _depth, tag); 1525 + $util.makeProp(message, "$unknowns", false); 1526 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 1527 + } 1528 + if (_end !== undefined) 1529 + throw Error("missing end group"); 1530 + return message; 1531 + }; 1532 + 1533 + /** 1534 + * Decodes a GetFullState message from the specified reader or buffer, length delimited. 1535 + * @function decodeDelimited 1536 + * @memberof subtext_handlers.GetFullState 1537 + * @static 1538 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 1539 + * @returns {subtext_handlers.GetFullState & subtext_handlers.GetFullState.$Shape} GetFullState 1540 + * @throws {Error} If the payload is not a reader or valid buffer 1541 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1542 + */ 1543 + GetFullState.decodeDelimited = function decodeDelimited(reader) { 1544 + if (!(reader instanceof $Reader)) 1545 + reader = new $Reader(reader); 1546 + return this.decode(reader, reader.uint32()); 1547 + }; 1548 + 1549 + /** 1550 + * Verifies a GetFullState message. 1551 + * @function verify 1552 + * @memberof subtext_handlers.GetFullState 1553 + * @static 1554 + * @param {Object.<string,*>} message Plain object to verify 1555 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 1556 + */ 1557 + GetFullState.verify = function verify(message, _depth) { 1558 + if (typeof message !== "object" || message === null) 1559 + return "object expected"; 1560 + if (_depth === undefined) 1561 + _depth = 0; 1562 + if (_depth > $util.recursionLimit) 1563 + return "max depth exceeded"; 1564 + if (message.vaultPath != null && message.hasOwnProperty("vaultPath")) 1565 + if (!$util.isString(message.vaultPath)) 1566 + return "vaultPath: string expected"; 1567 + return null; 1568 + }; 1569 + 1570 + /** 1571 + * Creates a GetFullState message from a plain object. Also converts values to their respective internal types. 1572 + * @function fromObject 1573 + * @memberof subtext_handlers.GetFullState 1574 + * @static 1575 + * @param {Object.<string,*>} object Plain object 1576 + * @returns {subtext_handlers.GetFullState} GetFullState 1577 + */ 1578 + GetFullState.fromObject = function fromObject(object, _depth) { 1579 + if (object instanceof $root.subtext_handlers.GetFullState) 1580 + return object; 1581 + if (_depth === undefined) 1582 + _depth = 0; 1583 + if (_depth > $util.recursionLimit) 1584 + throw Error("max depth exceeded"); 1585 + let message = new $root.subtext_handlers.GetFullState(); 1586 + if (object.vaultPath != null) 1587 + if (typeof object.vaultPath !== "string" || object.vaultPath.length) 1588 + message.vaultPath = String(object.vaultPath); 1589 + return message; 1590 + }; 1591 + 1592 + /** 1593 + * Creates a plain object from a GetFullState message. Also converts values to other types if specified. 1594 + * @function toObject 1595 + * @memberof subtext_handlers.GetFullState 1596 + * @static 1597 + * @param {subtext_handlers.GetFullState} message GetFullState 1598 + * @param {$protobuf.IConversionOptions} [options] Conversion options 1599 + * @returns {Object.<string,*>} Plain object 1600 + */ 1601 + GetFullState.toObject = function toObject(message, options, _depth) { 1602 + if (!options) 1603 + options = {}; 1604 + if (_depth === undefined) 1605 + _depth = 0; 1606 + if (_depth > $util.recursionLimit) 1607 + throw Error("max depth exceeded"); 1608 + let object = {}; 1609 + if (options.defaults) 1610 + object.vaultPath = ""; 1611 + if (message.vaultPath != null && message.hasOwnProperty("vaultPath")) 1612 + object.vaultPath = message.vaultPath; 1613 + return object; 1614 + }; 1615 + 1616 + /** 1617 + * Converts this GetFullState to JSON. 1618 + * @function toJSON 1619 + * @memberof subtext_handlers.GetFullState 1620 + * @instance 1621 + * @returns {Object.<string,*>} JSON object 1622 + */ 1623 + GetFullState.prototype.toJSON = function toJSON() { 1624 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 1625 + }; 1626 + 1627 + /** 1628 + * Gets the type url for GetFullState 1629 + * @function getTypeUrl 1630 + * @memberof subtext_handlers.GetFullState 1631 + * @static 1632 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1633 + * @returns {string} The type url 1634 + */ 1635 + GetFullState.getTypeUrl = function getTypeUrl(prefix) { 1636 + if (prefix === undefined) 1637 + prefix = "type.googleapis.com"; 1638 + return prefix + "/subtext_handlers.GetFullState"; 1639 + }; 1640 + 1641 + return GetFullState; 1642 + })(); 1643 + 1644 + subtext_handlers.ListFiles = (function() { 1645 + 1646 + /** 1647 + * Properties of a ListFiles. 1648 + * @typedef {Object} subtext_handlers.ListFiles.$Properties 1649 + * @property {string|null} [prefix] ListFiles prefix 1650 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 1651 + */ 1652 + 1653 + /** 1654 + * Properties of a ListFiles. 1655 + * @memberof subtext_handlers 1656 + * @interface IListFiles 1657 + * @augments subtext_handlers.ListFiles.$Properties 1658 + * @deprecated Use subtext_handlers.ListFiles.$Properties instead. 1659 + */ 1660 + 1661 + /** 1662 + * Shape of a ListFiles. 1663 + * @typedef {subtext_handlers.ListFiles.$Properties} subtext_handlers.ListFiles.$Shape 1664 + */ 1665 + 1666 + /** 1667 + * Constructs a new ListFiles. 1668 + * @memberof subtext_handlers 1669 + * @classdesc Represents a ListFiles. 1670 + * @constructor 1671 + * @param {subtext_handlers.ListFiles.$Properties=} [properties] Properties to set 1672 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 1673 + */ 1674 + function ListFiles(properties) { 1675 + if (properties) 1676 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 1677 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 1678 + this[keys[i]] = properties[keys[i]]; 1679 + } 1680 + 1681 + /** 1682 + * ListFiles prefix. 1683 + * @member {string} prefix 1684 + * @memberof subtext_handlers.ListFiles 1685 + * @instance 1686 + */ 1687 + ListFiles.prototype.prefix = ""; 1688 + 1689 + /** 1690 + * Creates a new ListFiles instance using the specified properties. 1691 + * @function create 1692 + * @memberof subtext_handlers.ListFiles 1693 + * @static 1694 + * @param {subtext_handlers.ListFiles.$Properties=} [properties] Properties to set 1695 + * @returns {subtext_handlers.ListFiles} ListFiles instance 1696 + * @type {{ 1697 + * (properties: subtext_handlers.ListFiles.$Shape): subtext_handlers.ListFiles & subtext_handlers.ListFiles.$Shape; 1698 + * (properties?: subtext_handlers.ListFiles.$Properties): subtext_handlers.ListFiles; 1699 + * }} 1700 + */ 1701 + ListFiles.create = function create(properties) { 1702 + return new ListFiles(properties); 1703 + }; 1704 + 1705 + /** 1706 + * Encodes the specified ListFiles message. Does not implicitly {@link subtext_handlers.ListFiles.verify|verify} messages. 1707 + * @function encode 1708 + * @memberof subtext_handlers.ListFiles 1709 + * @static 1710 + * @param {subtext_handlers.ListFiles.$Properties} message ListFiles message or plain object to encode 1711 + * @param {$protobuf.Writer} [writer] Writer to encode to 1712 + * @returns {$protobuf.Writer} Writer 1713 + */ 1714 + ListFiles.encode = function encode(message, writer, _depth) { 1715 + if (!writer) 1716 + writer = $Writer.create(); 1717 + if (_depth === undefined) 1718 + _depth = 0; 1719 + if (_depth > $util.recursionLimit) 1720 + throw Error("max depth exceeded"); 1721 + if (message.prefix != null && Object.hasOwnProperty.call(message, "prefix")) 1722 + writer.uint32(/* id 1, wireType 2 =*/10).string(message.prefix); 1723 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 1724 + for (let i = 0; i < message.$unknowns.length; ++i) 1725 + writer.raw(message.$unknowns[i]); 1726 + return writer; 1727 + }; 1728 + 1729 + /** 1730 + * Encodes the specified ListFiles message, length delimited. Does not implicitly {@link subtext_handlers.ListFiles.verify|verify} messages. 1731 + * @function encodeDelimited 1732 + * @memberof subtext_handlers.ListFiles 1733 + * @static 1734 + * @param {subtext_handlers.ListFiles.$Properties} message ListFiles message or plain object to encode 1735 + * @param {$protobuf.Writer} [writer] Writer to encode to 1736 + * @returns {$protobuf.Writer} Writer 1737 + */ 1738 + ListFiles.encodeDelimited = function encodeDelimited(message, writer) { 1739 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 1740 + }; 1741 + 1742 + /** 1743 + * Decodes a ListFiles message from the specified reader or buffer. 1744 + * @function decode 1745 + * @memberof subtext_handlers.ListFiles 1746 + * @static 1747 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 1748 + * @param {number} [length] Message length if known beforehand 1749 + * @returns {subtext_handlers.ListFiles & subtext_handlers.ListFiles.$Shape} ListFiles 1750 + * @throws {Error} If the payload is not a reader or valid buffer 1751 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1752 + */ 1753 + ListFiles.decode = function decode(reader, length, _end, _depth, _target) { 1754 + if (!(reader instanceof $Reader)) 1755 + reader = $Reader.create(reader); 1756 + if (_depth === undefined) 1757 + _depth = 0; 1758 + if (_depth > $Reader.recursionLimit) 1759 + throw Error("max depth exceeded"); 1760 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.ListFiles(), value; 1761 + while (reader.pos < end) { 1762 + let start = reader.pos; 1763 + let tag = reader.tag(); 1764 + if (tag === _end) { 1765 + _end = undefined; 1766 + break; 1767 + } 1768 + let wireType = tag & 7; 1769 + switch (tag >>>= 3) { 1770 + case 1: { 1771 + if (wireType !== 2) 1772 + break; 1773 + if ((value = reader.string()).length) 1774 + message.prefix = value; 1775 + else 1776 + delete message.prefix; 1777 + continue; 1778 + } 1779 + } 1780 + reader.skipType(wireType, _depth, tag); 1781 + $util.makeProp(message, "$unknowns", false); 1782 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 1783 + } 1784 + if (_end !== undefined) 1785 + throw Error("missing end group"); 1786 + return message; 1787 + }; 1788 + 1789 + /** 1790 + * Decodes a ListFiles message from the specified reader or buffer, length delimited. 1791 + * @function decodeDelimited 1792 + * @memberof subtext_handlers.ListFiles 1793 + * @static 1794 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 1795 + * @returns {subtext_handlers.ListFiles & subtext_handlers.ListFiles.$Shape} ListFiles 1796 + * @throws {Error} If the payload is not a reader or valid buffer 1797 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 1798 + */ 1799 + ListFiles.decodeDelimited = function decodeDelimited(reader) { 1800 + if (!(reader instanceof $Reader)) 1801 + reader = new $Reader(reader); 1802 + return this.decode(reader, reader.uint32()); 1803 + }; 1804 + 1805 + /** 1806 + * Verifies a ListFiles message. 1807 + * @function verify 1808 + * @memberof subtext_handlers.ListFiles 1809 + * @static 1810 + * @param {Object.<string,*>} message Plain object to verify 1811 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 1812 + */ 1813 + ListFiles.verify = function verify(message, _depth) { 1814 + if (typeof message !== "object" || message === null) 1815 + return "object expected"; 1816 + if (_depth === undefined) 1817 + _depth = 0; 1818 + if (_depth > $util.recursionLimit) 1819 + return "max depth exceeded"; 1820 + if (message.prefix != null && message.hasOwnProperty("prefix")) 1821 + if (!$util.isString(message.prefix)) 1822 + return "prefix: string expected"; 1823 + return null; 1824 + }; 1825 + 1826 + /** 1827 + * Creates a ListFiles message from a plain object. Also converts values to their respective internal types. 1828 + * @function fromObject 1829 + * @memberof subtext_handlers.ListFiles 1830 + * @static 1831 + * @param {Object.<string,*>} object Plain object 1832 + * @returns {subtext_handlers.ListFiles} ListFiles 1833 + */ 1834 + ListFiles.fromObject = function fromObject(object, _depth) { 1835 + if (object instanceof $root.subtext_handlers.ListFiles) 1836 + return object; 1837 + if (_depth === undefined) 1838 + _depth = 0; 1839 + if (_depth > $util.recursionLimit) 1840 + throw Error("max depth exceeded"); 1841 + let message = new $root.subtext_handlers.ListFiles(); 1842 + if (object.prefix != null) 1843 + if (typeof object.prefix !== "string" || object.prefix.length) 1844 + message.prefix = String(object.prefix); 1845 + return message; 1846 + }; 1847 + 1848 + /** 1849 + * Creates a plain object from a ListFiles message. Also converts values to other types if specified. 1850 + * @function toObject 1851 + * @memberof subtext_handlers.ListFiles 1852 + * @static 1853 + * @param {subtext_handlers.ListFiles} message ListFiles 1854 + * @param {$protobuf.IConversionOptions} [options] Conversion options 1855 + * @returns {Object.<string,*>} Plain object 1856 + */ 1857 + ListFiles.toObject = function toObject(message, options, _depth) { 1858 + if (!options) 1859 + options = {}; 1860 + if (_depth === undefined) 1861 + _depth = 0; 1862 + if (_depth > $util.recursionLimit) 1863 + throw Error("max depth exceeded"); 1864 + let object = {}; 1865 + if (options.defaults) 1866 + object.prefix = ""; 1867 + if (message.prefix != null && message.hasOwnProperty("prefix")) 1868 + object.prefix = message.prefix; 1869 + return object; 1870 + }; 1871 + 1872 + /** 1873 + * Converts this ListFiles to JSON. 1874 + * @function toJSON 1875 + * @memberof subtext_handlers.ListFiles 1876 + * @instance 1877 + * @returns {Object.<string,*>} JSON object 1878 + */ 1879 + ListFiles.prototype.toJSON = function toJSON() { 1880 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 1881 + }; 1882 + 1883 + /** 1884 + * Gets the type url for ListFiles 1885 + * @function getTypeUrl 1886 + * @memberof subtext_handlers.ListFiles 1887 + * @static 1888 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 1889 + * @returns {string} The type url 1890 + */ 1891 + ListFiles.getTypeUrl = function getTypeUrl(prefix) { 1892 + if (prefix === undefined) 1893 + prefix = "type.googleapis.com"; 1894 + return prefix + "/subtext_handlers.ListFiles"; 1895 + }; 1896 + 1897 + return ListFiles; 1898 + })(); 1899 + 1900 + subtext_handlers.FileExists = (function() { 1901 + 1902 + /** 1903 + * Properties of a FileExists. 1904 + * @typedef {Object} subtext_handlers.FileExists.$Properties 1905 + * @property {string|null} [vaultPath] FileExists vaultPath 1906 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 1907 + */ 1908 + 1909 + /** 1910 + * Properties of a FileExists. 1911 + * @memberof subtext_handlers 1912 + * @interface IFileExists 1913 + * @augments subtext_handlers.FileExists.$Properties 1914 + * @deprecated Use subtext_handlers.FileExists.$Properties instead. 1915 + */ 1916 + 1917 + /** 1918 + * Shape of a FileExists. 1919 + * @typedef {subtext_handlers.FileExists.$Properties} subtext_handlers.FileExists.$Shape 1920 + */ 1921 + 1922 + /** 1923 + * Constructs a new FileExists. 1924 + * @memberof subtext_handlers 1925 + * @classdesc Represents a FileExists. 1926 + * @constructor 1927 + * @param {subtext_handlers.FileExists.$Properties=} [properties] Properties to set 1928 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 1929 + */ 1930 + function FileExists(properties) { 1931 + if (properties) 1932 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 1933 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 1934 + this[keys[i]] = properties[keys[i]]; 1935 + } 1936 + 1937 + /** 1938 + * FileExists vaultPath. 1939 + * @member {string} vaultPath 1940 + * @memberof subtext_handlers.FileExists 1941 + * @instance 1942 + */ 1943 + FileExists.prototype.vaultPath = ""; 1944 + 1945 + /** 1946 + * Creates a new FileExists instance using the specified properties. 1947 + * @function create 1948 + * @memberof subtext_handlers.FileExists 1949 + * @static 1950 + * @param {subtext_handlers.FileExists.$Properties=} [properties] Properties to set 1951 + * @returns {subtext_handlers.FileExists} FileExists instance 1952 + * @type {{ 1953 + * (properties: subtext_handlers.FileExists.$Shape): subtext_handlers.FileExists & subtext_handlers.FileExists.$Shape; 1954 + * (properties?: subtext_handlers.FileExists.$Properties): subtext_handlers.FileExists; 1955 + * }} 1956 + */ 1957 + FileExists.create = function create(properties) { 1958 + return new FileExists(properties); 1959 + }; 1960 + 1961 + /** 1962 + * Encodes the specified FileExists message. Does not implicitly {@link subtext_handlers.FileExists.verify|verify} messages. 1963 + * @function encode 1964 + * @memberof subtext_handlers.FileExists 1965 + * @static 1966 + * @param {subtext_handlers.FileExists.$Properties} message FileExists message or plain object to encode 1967 + * @param {$protobuf.Writer} [writer] Writer to encode to 1968 + * @returns {$protobuf.Writer} Writer 1969 + */ 1970 + FileExists.encode = function encode(message, writer, _depth) { 1971 + if (!writer) 1972 + writer = $Writer.create(); 1973 + if (_depth === undefined) 1974 + _depth = 0; 1975 + if (_depth > $util.recursionLimit) 1976 + throw Error("max depth exceeded"); 1977 + if (message.vaultPath != null && Object.hasOwnProperty.call(message, "vaultPath")) 1978 + writer.uint32(/* id 1, wireType 2 =*/10).string(message.vaultPath); 1979 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 1980 + for (let i = 0; i < message.$unknowns.length; ++i) 1981 + writer.raw(message.$unknowns[i]); 1982 + return writer; 1983 + }; 1984 + 1985 + /** 1986 + * Encodes the specified FileExists message, length delimited. Does not implicitly {@link subtext_handlers.FileExists.verify|verify} messages. 1987 + * @function encodeDelimited 1988 + * @memberof subtext_handlers.FileExists 1989 + * @static 1990 + * @param {subtext_handlers.FileExists.$Properties} message FileExists message or plain object to encode 1991 + * @param {$protobuf.Writer} [writer] Writer to encode to 1992 + * @returns {$protobuf.Writer} Writer 1993 + */ 1994 + FileExists.encodeDelimited = function encodeDelimited(message, writer) { 1995 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 1996 + }; 1997 + 1998 + /** 1999 + * Decodes a FileExists message from the specified reader or buffer. 2000 + * @function decode 2001 + * @memberof subtext_handlers.FileExists 2002 + * @static 2003 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 2004 + * @param {number} [length] Message length if known beforehand 2005 + * @returns {subtext_handlers.FileExists & subtext_handlers.FileExists.$Shape} FileExists 2006 + * @throws {Error} If the payload is not a reader or valid buffer 2007 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 2008 + */ 2009 + FileExists.decode = function decode(reader, length, _end, _depth, _target) { 2010 + if (!(reader instanceof $Reader)) 2011 + reader = $Reader.create(reader); 2012 + if (_depth === undefined) 2013 + _depth = 0; 2014 + if (_depth > $Reader.recursionLimit) 2015 + throw Error("max depth exceeded"); 2016 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.FileExists(), value; 2017 + while (reader.pos < end) { 2018 + let start = reader.pos; 2019 + let tag = reader.tag(); 2020 + if (tag === _end) { 2021 + _end = undefined; 2022 + break; 2023 + } 2024 + let wireType = tag & 7; 2025 + switch (tag >>>= 3) { 2026 + case 1: { 2027 + if (wireType !== 2) 2028 + break; 2029 + if ((value = reader.string()).length) 2030 + message.vaultPath = value; 2031 + else 2032 + delete message.vaultPath; 2033 + continue; 2034 + } 2035 + } 2036 + reader.skipType(wireType, _depth, tag); 2037 + $util.makeProp(message, "$unknowns", false); 2038 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 2039 + } 2040 + if (_end !== undefined) 2041 + throw Error("missing end group"); 2042 + return message; 2043 + }; 2044 + 2045 + /** 2046 + * Decodes a FileExists message from the specified reader or buffer, length delimited. 2047 + * @function decodeDelimited 2048 + * @memberof subtext_handlers.FileExists 2049 + * @static 2050 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 2051 + * @returns {subtext_handlers.FileExists & subtext_handlers.FileExists.$Shape} FileExists 2052 + * @throws {Error} If the payload is not a reader or valid buffer 2053 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 2054 + */ 2055 + FileExists.decodeDelimited = function decodeDelimited(reader) { 2056 + if (!(reader instanceof $Reader)) 2057 + reader = new $Reader(reader); 2058 + return this.decode(reader, reader.uint32()); 2059 + }; 2060 + 2061 + /** 2062 + * Verifies a FileExists message. 2063 + * @function verify 2064 + * @memberof subtext_handlers.FileExists 2065 + * @static 2066 + * @param {Object.<string,*>} message Plain object to verify 2067 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 2068 + */ 2069 + FileExists.verify = function verify(message, _depth) { 2070 + if (typeof message !== "object" || message === null) 2071 + return "object expected"; 2072 + if (_depth === undefined) 2073 + _depth = 0; 2074 + if (_depth > $util.recursionLimit) 2075 + return "max depth exceeded"; 2076 + if (message.vaultPath != null && message.hasOwnProperty("vaultPath")) 2077 + if (!$util.isString(message.vaultPath)) 2078 + return "vaultPath: string expected"; 2079 + return null; 2080 + }; 2081 + 2082 + /** 2083 + * Creates a FileExists message from a plain object. Also converts values to their respective internal types. 2084 + * @function fromObject 2085 + * @memberof subtext_handlers.FileExists 2086 + * @static 2087 + * @param {Object.<string,*>} object Plain object 2088 + * @returns {subtext_handlers.FileExists} FileExists 2089 + */ 2090 + FileExists.fromObject = function fromObject(object, _depth) { 2091 + if (object instanceof $root.subtext_handlers.FileExists) 2092 + return object; 2093 + if (_depth === undefined) 2094 + _depth = 0; 2095 + if (_depth > $util.recursionLimit) 2096 + throw Error("max depth exceeded"); 2097 + let message = new $root.subtext_handlers.FileExists(); 2098 + if (object.vaultPath != null) 2099 + if (typeof object.vaultPath !== "string" || object.vaultPath.length) 2100 + message.vaultPath = String(object.vaultPath); 2101 + return message; 2102 + }; 2103 + 2104 + /** 2105 + * Creates a plain object from a FileExists message. Also converts values to other types if specified. 2106 + * @function toObject 2107 + * @memberof subtext_handlers.FileExists 2108 + * @static 2109 + * @param {subtext_handlers.FileExists} message FileExists 2110 + * @param {$protobuf.IConversionOptions} [options] Conversion options 2111 + * @returns {Object.<string,*>} Plain object 2112 + */ 2113 + FileExists.toObject = function toObject(message, options, _depth) { 2114 + if (!options) 2115 + options = {}; 2116 + if (_depth === undefined) 2117 + _depth = 0; 2118 + if (_depth > $util.recursionLimit) 2119 + throw Error("max depth exceeded"); 2120 + let object = {}; 2121 + if (options.defaults) 2122 + object.vaultPath = ""; 2123 + if (message.vaultPath != null && message.hasOwnProperty("vaultPath")) 2124 + object.vaultPath = message.vaultPath; 2125 + return object; 2126 + }; 2127 + 2128 + /** 2129 + * Converts this FileExists to JSON. 2130 + * @function toJSON 2131 + * @memberof subtext_handlers.FileExists 2132 + * @instance 2133 + * @returns {Object.<string,*>} JSON object 2134 + */ 2135 + FileExists.prototype.toJSON = function toJSON() { 2136 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 2137 + }; 2138 + 2139 + /** 2140 + * Gets the type url for FileExists 2141 + * @function getTypeUrl 2142 + * @memberof subtext_handlers.FileExists 2143 + * @static 2144 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 2145 + * @returns {string} The type url 2146 + */ 2147 + FileExists.getTypeUrl = function getTypeUrl(prefix) { 2148 + if (prefix === undefined) 2149 + prefix = "type.googleapis.com"; 2150 + return prefix + "/subtext_handlers.FileExists"; 2151 + }; 2152 + 2153 + return FileExists; 2154 + })(); 2155 + 2156 + subtext_handlers.CreateFile = (function() { 2157 + 2158 + /** 2159 + * Properties of a CreateFile. 2160 + * @typedef {Object} subtext_handlers.CreateFile.$Properties 2161 + * @property {string|null} [vaultPath] CreateFile vaultPath 2162 + * @property {Uint8Array|null} [initialState] CreateFile initialState 2163 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 2164 + */ 2165 + 2166 + /** 2167 + * Properties of a CreateFile. 2168 + * @memberof subtext_handlers 2169 + * @interface ICreateFile 2170 + * @augments subtext_handlers.CreateFile.$Properties 2171 + * @deprecated Use subtext_handlers.CreateFile.$Properties instead. 2172 + */ 2173 + 2174 + /** 2175 + * Shape of a CreateFile. 2176 + * @typedef {subtext_handlers.CreateFile.$Properties} subtext_handlers.CreateFile.$Shape 2177 + */ 2178 + 2179 + /** 2180 + * Constructs a new CreateFile. 2181 + * @memberof subtext_handlers 2182 + * @classdesc Represents a CreateFile. 2183 + * @constructor 2184 + * @param {subtext_handlers.CreateFile.$Properties=} [properties] Properties to set 2185 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 2186 + */ 2187 + function CreateFile(properties) { 2188 + if (properties) 2189 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 2190 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 2191 + this[keys[i]] = properties[keys[i]]; 2192 + } 2193 + 2194 + /** 2195 + * CreateFile vaultPath. 2196 + * @member {string} vaultPath 2197 + * @memberof subtext_handlers.CreateFile 2198 + * @instance 2199 + */ 2200 + CreateFile.prototype.vaultPath = ""; 2201 + 2202 + /** 2203 + * CreateFile initialState. 2204 + * @member {Uint8Array} initialState 2205 + * @memberof subtext_handlers.CreateFile 2206 + * @instance 2207 + */ 2208 + CreateFile.prototype.initialState = $util.newBuffer([]); 2209 + 2210 + /** 2211 + * Creates a new CreateFile instance using the specified properties. 2212 + * @function create 2213 + * @memberof subtext_handlers.CreateFile 2214 + * @static 2215 + * @param {subtext_handlers.CreateFile.$Properties=} [properties] Properties to set 2216 + * @returns {subtext_handlers.CreateFile} CreateFile instance 2217 + * @type {{ 2218 + * (properties: subtext_handlers.CreateFile.$Shape): subtext_handlers.CreateFile & subtext_handlers.CreateFile.$Shape; 2219 + * (properties?: subtext_handlers.CreateFile.$Properties): subtext_handlers.CreateFile; 2220 + * }} 2221 + */ 2222 + CreateFile.create = function create(properties) { 2223 + return new CreateFile(properties); 2224 + }; 2225 + 2226 + /** 2227 + * Encodes the specified CreateFile message. Does not implicitly {@link subtext_handlers.CreateFile.verify|verify} messages. 2228 + * @function encode 2229 + * @memberof subtext_handlers.CreateFile 2230 + * @static 2231 + * @param {subtext_handlers.CreateFile.$Properties} message CreateFile message or plain object to encode 2232 + * @param {$protobuf.Writer} [writer] Writer to encode to 2233 + * @returns {$protobuf.Writer} Writer 2234 + */ 2235 + CreateFile.encode = function encode(message, writer, _depth) { 2236 + if (!writer) 2237 + writer = $Writer.create(); 2238 + if (_depth === undefined) 2239 + _depth = 0; 2240 + if (_depth > $util.recursionLimit) 2241 + throw Error("max depth exceeded"); 2242 + if (message.vaultPath != null && Object.hasOwnProperty.call(message, "vaultPath")) 2243 + writer.uint32(/* id 1, wireType 2 =*/10).string(message.vaultPath); 2244 + if (message.initialState != null && Object.hasOwnProperty.call(message, "initialState")) 2245 + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.initialState); 2246 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 2247 + for (let i = 0; i < message.$unknowns.length; ++i) 2248 + writer.raw(message.$unknowns[i]); 2249 + return writer; 2250 + }; 2251 + 2252 + /** 2253 + * Encodes the specified CreateFile message, length delimited. Does not implicitly {@link subtext_handlers.CreateFile.verify|verify} messages. 2254 + * @function encodeDelimited 2255 + * @memberof subtext_handlers.CreateFile 2256 + * @static 2257 + * @param {subtext_handlers.CreateFile.$Properties} message CreateFile message or plain object to encode 2258 + * @param {$protobuf.Writer} [writer] Writer to encode to 2259 + * @returns {$protobuf.Writer} Writer 2260 + */ 2261 + CreateFile.encodeDelimited = function encodeDelimited(message, writer) { 2262 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 2263 + }; 2264 + 2265 + /** 2266 + * Decodes a CreateFile message from the specified reader or buffer. 2267 + * @function decode 2268 + * @memberof subtext_handlers.CreateFile 2269 + * @static 2270 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 2271 + * @param {number} [length] Message length if known beforehand 2272 + * @returns {subtext_handlers.CreateFile & subtext_handlers.CreateFile.$Shape} CreateFile 2273 + * @throws {Error} If the payload is not a reader or valid buffer 2274 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 2275 + */ 2276 + CreateFile.decode = function decode(reader, length, _end, _depth, _target) { 2277 + if (!(reader instanceof $Reader)) 2278 + reader = $Reader.create(reader); 2279 + if (_depth === undefined) 2280 + _depth = 0; 2281 + if (_depth > $Reader.recursionLimit) 2282 + throw Error("max depth exceeded"); 2283 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.CreateFile(), value; 2284 + while (reader.pos < end) { 2285 + let start = reader.pos; 2286 + let tag = reader.tag(); 2287 + if (tag === _end) { 2288 + _end = undefined; 2289 + break; 2290 + } 2291 + let wireType = tag & 7; 2292 + switch (tag >>>= 3) { 2293 + case 1: { 2294 + if (wireType !== 2) 2295 + break; 2296 + if ((value = reader.string()).length) 2297 + message.vaultPath = value; 2298 + else 2299 + delete message.vaultPath; 2300 + continue; 2301 + } 2302 + case 2: { 2303 + if (wireType !== 2) 2304 + break; 2305 + if ((value = reader.bytes()).length) 2306 + message.initialState = value; 2307 + else 2308 + delete message.initialState; 2309 + continue; 2310 + } 2311 + } 2312 + reader.skipType(wireType, _depth, tag); 2313 + $util.makeProp(message, "$unknowns", false); 2314 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 2315 + } 2316 + if (_end !== undefined) 2317 + throw Error("missing end group"); 2318 + return message; 2319 + }; 2320 + 2321 + /** 2322 + * Decodes a CreateFile message from the specified reader or buffer, length delimited. 2323 + * @function decodeDelimited 2324 + * @memberof subtext_handlers.CreateFile 2325 + * @static 2326 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 2327 + * @returns {subtext_handlers.CreateFile & subtext_handlers.CreateFile.$Shape} CreateFile 2328 + * @throws {Error} If the payload is not a reader or valid buffer 2329 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 2330 + */ 2331 + CreateFile.decodeDelimited = function decodeDelimited(reader) { 2332 + if (!(reader instanceof $Reader)) 2333 + reader = new $Reader(reader); 2334 + return this.decode(reader, reader.uint32()); 2335 + }; 2336 + 2337 + /** 2338 + * Verifies a CreateFile message. 2339 + * @function verify 2340 + * @memberof subtext_handlers.CreateFile 2341 + * @static 2342 + * @param {Object.<string,*>} message Plain object to verify 2343 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 2344 + */ 2345 + CreateFile.verify = function verify(message, _depth) { 2346 + if (typeof message !== "object" || message === null) 2347 + return "object expected"; 2348 + if (_depth === undefined) 2349 + _depth = 0; 2350 + if (_depth > $util.recursionLimit) 2351 + return "max depth exceeded"; 2352 + if (message.vaultPath != null && message.hasOwnProperty("vaultPath")) 2353 + if (!$util.isString(message.vaultPath)) 2354 + return "vaultPath: string expected"; 2355 + if (message.initialState != null && message.hasOwnProperty("initialState")) 2356 + if (!(message.initialState && typeof message.initialState.length === "number" || $util.isString(message.initialState))) 2357 + return "initialState: buffer expected"; 2358 + return null; 2359 + }; 2360 + 2361 + /** 2362 + * Creates a CreateFile message from a plain object. Also converts values to their respective internal types. 2363 + * @function fromObject 2364 + * @memberof subtext_handlers.CreateFile 2365 + * @static 2366 + * @param {Object.<string,*>} object Plain object 2367 + * @returns {subtext_handlers.CreateFile} CreateFile 2368 + */ 2369 + CreateFile.fromObject = function fromObject(object, _depth) { 2370 + if (object instanceof $root.subtext_handlers.CreateFile) 2371 + return object; 2372 + if (_depth === undefined) 2373 + _depth = 0; 2374 + if (_depth > $util.recursionLimit) 2375 + throw Error("max depth exceeded"); 2376 + let message = new $root.subtext_handlers.CreateFile(); 2377 + if (object.vaultPath != null) 2378 + if (typeof object.vaultPath !== "string" || object.vaultPath.length) 2379 + message.vaultPath = String(object.vaultPath); 2380 + if (object.initialState != null) 2381 + if (object.initialState.length) 2382 + if (typeof object.initialState === "string") 2383 + $util.base64.decode(object.initialState, message.initialState = $util.newBuffer($util.base64.length(object.initialState)), 0); 2384 + else if (object.initialState.length >= 0) 2385 + message.initialState = object.initialState; 2386 + return message; 2387 + }; 2388 + 2389 + /** 2390 + * Creates a plain object from a CreateFile message. Also converts values to other types if specified. 2391 + * @function toObject 2392 + * @memberof subtext_handlers.CreateFile 2393 + * @static 2394 + * @param {subtext_handlers.CreateFile} message CreateFile 2395 + * @param {$protobuf.IConversionOptions} [options] Conversion options 2396 + * @returns {Object.<string,*>} Plain object 2397 + */ 2398 + CreateFile.toObject = function toObject(message, options, _depth) { 2399 + if (!options) 2400 + options = {}; 2401 + if (_depth === undefined) 2402 + _depth = 0; 2403 + if (_depth > $util.recursionLimit) 2404 + throw Error("max depth exceeded"); 2405 + let object = {}; 2406 + if (options.defaults) { 2407 + object.vaultPath = ""; 2408 + if (options.bytes === String) 2409 + object.initialState = ""; 2410 + else { 2411 + object.initialState = []; 2412 + if (options.bytes !== Array) 2413 + object.initialState = $util.newBuffer(object.initialState); 2414 + } 2415 + } 2416 + if (message.vaultPath != null && message.hasOwnProperty("vaultPath")) 2417 + object.vaultPath = message.vaultPath; 2418 + if (message.initialState != null && message.hasOwnProperty("initialState")) 2419 + object.initialState = options.bytes === String ? $util.base64.encode(message.initialState, 0, message.initialState.length) : options.bytes === Array ? Array.prototype.slice.call(message.initialState) : message.initialState; 2420 + return object; 2421 + }; 2422 + 2423 + /** 2424 + * Converts this CreateFile to JSON. 2425 + * @function toJSON 2426 + * @memberof subtext_handlers.CreateFile 2427 + * @instance 2428 + * @returns {Object.<string,*>} JSON object 2429 + */ 2430 + CreateFile.prototype.toJSON = function toJSON() { 2431 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 2432 + }; 2433 + 2434 + /** 2435 + * Gets the type url for CreateFile 2436 + * @function getTypeUrl 2437 + * @memberof subtext_handlers.CreateFile 2438 + * @static 2439 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 2440 + * @returns {string} The type url 2441 + */ 2442 + CreateFile.getTypeUrl = function getTypeUrl(prefix) { 2443 + if (prefix === undefined) 2444 + prefix = "type.googleapis.com"; 2445 + return prefix + "/subtext_handlers.CreateFile"; 2446 + }; 2447 + 2448 + return CreateFile; 2449 + })(); 2450 + 2451 + subtext_handlers.RenameFile = (function() { 2452 + 2453 + /** 2454 + * Properties of a RenameFile. 2455 + * @typedef {Object} subtext_handlers.RenameFile.$Properties 2456 + * @property {string|null} [oldVaultPath] RenameFile oldVaultPath 2457 + * @property {string|null} [newVaultPath] RenameFile newVaultPath 2458 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 2459 + */ 2460 + 2461 + /** 2462 + * Properties of a RenameFile. 2463 + * @memberof subtext_handlers 2464 + * @interface IRenameFile 2465 + * @augments subtext_handlers.RenameFile.$Properties 2466 + * @deprecated Use subtext_handlers.RenameFile.$Properties instead. 2467 + */ 2468 + 2469 + /** 2470 + * Shape of a RenameFile. 2471 + * @typedef {subtext_handlers.RenameFile.$Properties} subtext_handlers.RenameFile.$Shape 2472 + */ 2473 + 2474 + /** 2475 + * Constructs a new RenameFile. 2476 + * @memberof subtext_handlers 2477 + * @classdesc Represents a RenameFile. 2478 + * @constructor 2479 + * @param {subtext_handlers.RenameFile.$Properties=} [properties] Properties to set 2480 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 2481 + */ 2482 + function RenameFile(properties) { 2483 + if (properties) 2484 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 2485 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 2486 + this[keys[i]] = properties[keys[i]]; 2487 + } 2488 + 2489 + /** 2490 + * RenameFile oldVaultPath. 2491 + * @member {string} oldVaultPath 2492 + * @memberof subtext_handlers.RenameFile 2493 + * @instance 2494 + */ 2495 + RenameFile.prototype.oldVaultPath = ""; 2496 + 2497 + /** 2498 + * RenameFile newVaultPath. 2499 + * @member {string} newVaultPath 2500 + * @memberof subtext_handlers.RenameFile 2501 + * @instance 2502 + */ 2503 + RenameFile.prototype.newVaultPath = ""; 2504 + 2505 + /** 2506 + * Creates a new RenameFile instance using the specified properties. 2507 + * @function create 2508 + * @memberof subtext_handlers.RenameFile 2509 + * @static 2510 + * @param {subtext_handlers.RenameFile.$Properties=} [properties] Properties to set 2511 + * @returns {subtext_handlers.RenameFile} RenameFile instance 2512 + * @type {{ 2513 + * (properties: subtext_handlers.RenameFile.$Shape): subtext_handlers.RenameFile & subtext_handlers.RenameFile.$Shape; 2514 + * (properties?: subtext_handlers.RenameFile.$Properties): subtext_handlers.RenameFile; 2515 + * }} 2516 + */ 2517 + RenameFile.create = function create(properties) { 2518 + return new RenameFile(properties); 2519 + }; 2520 + 2521 + /** 2522 + * Encodes the specified RenameFile message. Does not implicitly {@link subtext_handlers.RenameFile.verify|verify} messages. 2523 + * @function encode 2524 + * @memberof subtext_handlers.RenameFile 2525 + * @static 2526 + * @param {subtext_handlers.RenameFile.$Properties} message RenameFile message or plain object to encode 2527 + * @param {$protobuf.Writer} [writer] Writer to encode to 2528 + * @returns {$protobuf.Writer} Writer 2529 + */ 2530 + RenameFile.encode = function encode(message, writer, _depth) { 2531 + if (!writer) 2532 + writer = $Writer.create(); 2533 + if (_depth === undefined) 2534 + _depth = 0; 2535 + if (_depth > $util.recursionLimit) 2536 + throw Error("max depth exceeded"); 2537 + if (message.oldVaultPath != null && Object.hasOwnProperty.call(message, "oldVaultPath")) 2538 + writer.uint32(/* id 1, wireType 2 =*/10).string(message.oldVaultPath); 2539 + if (message.newVaultPath != null && Object.hasOwnProperty.call(message, "newVaultPath")) 2540 + writer.uint32(/* id 2, wireType 2 =*/18).string(message.newVaultPath); 2541 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 2542 + for (let i = 0; i < message.$unknowns.length; ++i) 2543 + writer.raw(message.$unknowns[i]); 2544 + return writer; 2545 + }; 2546 + 2547 + /** 2548 + * Encodes the specified RenameFile message, length delimited. Does not implicitly {@link subtext_handlers.RenameFile.verify|verify} messages. 2549 + * @function encodeDelimited 2550 + * @memberof subtext_handlers.RenameFile 2551 + * @static 2552 + * @param {subtext_handlers.RenameFile.$Properties} message RenameFile message or plain object to encode 2553 + * @param {$protobuf.Writer} [writer] Writer to encode to 2554 + * @returns {$protobuf.Writer} Writer 2555 + */ 2556 + RenameFile.encodeDelimited = function encodeDelimited(message, writer) { 2557 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 2558 + }; 2559 + 2560 + /** 2561 + * Decodes a RenameFile message from the specified reader or buffer. 2562 + * @function decode 2563 + * @memberof subtext_handlers.RenameFile 2564 + * @static 2565 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 2566 + * @param {number} [length] Message length if known beforehand 2567 + * @returns {subtext_handlers.RenameFile & subtext_handlers.RenameFile.$Shape} RenameFile 2568 + * @throws {Error} If the payload is not a reader or valid buffer 2569 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 2570 + */ 2571 + RenameFile.decode = function decode(reader, length, _end, _depth, _target) { 2572 + if (!(reader instanceof $Reader)) 2573 + reader = $Reader.create(reader); 2574 + if (_depth === undefined) 2575 + _depth = 0; 2576 + if (_depth > $Reader.recursionLimit) 2577 + throw Error("max depth exceeded"); 2578 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.RenameFile(), value; 2579 + while (reader.pos < end) { 2580 + let start = reader.pos; 2581 + let tag = reader.tag(); 2582 + if (tag === _end) { 2583 + _end = undefined; 2584 + break; 2585 + } 2586 + let wireType = tag & 7; 2587 + switch (tag >>>= 3) { 2588 + case 1: { 2589 + if (wireType !== 2) 2590 + break; 2591 + if ((value = reader.string()).length) 2592 + message.oldVaultPath = value; 2593 + else 2594 + delete message.oldVaultPath; 2595 + continue; 2596 + } 2597 + case 2: { 2598 + if (wireType !== 2) 2599 + break; 2600 + if ((value = reader.string()).length) 2601 + message.newVaultPath = value; 2602 + else 2603 + delete message.newVaultPath; 2604 + continue; 2605 + } 2606 + } 2607 + reader.skipType(wireType, _depth, tag); 2608 + $util.makeProp(message, "$unknowns", false); 2609 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 2610 + } 2611 + if (_end !== undefined) 2612 + throw Error("missing end group"); 2613 + return message; 2614 + }; 2615 + 2616 + /** 2617 + * Decodes a RenameFile message from the specified reader or buffer, length delimited. 2618 + * @function decodeDelimited 2619 + * @memberof subtext_handlers.RenameFile 2620 + * @static 2621 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 2622 + * @returns {subtext_handlers.RenameFile & subtext_handlers.RenameFile.$Shape} RenameFile 2623 + * @throws {Error} If the payload is not a reader or valid buffer 2624 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 2625 + */ 2626 + RenameFile.decodeDelimited = function decodeDelimited(reader) { 2627 + if (!(reader instanceof $Reader)) 2628 + reader = new $Reader(reader); 2629 + return this.decode(reader, reader.uint32()); 2630 + }; 2631 + 2632 + /** 2633 + * Verifies a RenameFile message. 2634 + * @function verify 2635 + * @memberof subtext_handlers.RenameFile 2636 + * @static 2637 + * @param {Object.<string,*>} message Plain object to verify 2638 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 2639 + */ 2640 + RenameFile.verify = function verify(message, _depth) { 2641 + if (typeof message !== "object" || message === null) 2642 + return "object expected"; 2643 + if (_depth === undefined) 2644 + _depth = 0; 2645 + if (_depth > $util.recursionLimit) 2646 + return "max depth exceeded"; 2647 + if (message.oldVaultPath != null && message.hasOwnProperty("oldVaultPath")) 2648 + if (!$util.isString(message.oldVaultPath)) 2649 + return "oldVaultPath: string expected"; 2650 + if (message.newVaultPath != null && message.hasOwnProperty("newVaultPath")) 2651 + if (!$util.isString(message.newVaultPath)) 2652 + return "newVaultPath: string expected"; 2653 + return null; 2654 + }; 2655 + 2656 + /** 2657 + * Creates a RenameFile message from a plain object. Also converts values to their respective internal types. 2658 + * @function fromObject 2659 + * @memberof subtext_handlers.RenameFile 2660 + * @static 2661 + * @param {Object.<string,*>} object Plain object 2662 + * @returns {subtext_handlers.RenameFile} RenameFile 2663 + */ 2664 + RenameFile.fromObject = function fromObject(object, _depth) { 2665 + if (object instanceof $root.subtext_handlers.RenameFile) 2666 + return object; 2667 + if (_depth === undefined) 2668 + _depth = 0; 2669 + if (_depth > $util.recursionLimit) 2670 + throw Error("max depth exceeded"); 2671 + let message = new $root.subtext_handlers.RenameFile(); 2672 + if (object.oldVaultPath != null) 2673 + if (typeof object.oldVaultPath !== "string" || object.oldVaultPath.length) 2674 + message.oldVaultPath = String(object.oldVaultPath); 2675 + if (object.newVaultPath != null) 2676 + if (typeof object.newVaultPath !== "string" || object.newVaultPath.length) 2677 + message.newVaultPath = String(object.newVaultPath); 2678 + return message; 2679 + }; 2680 + 2681 + /** 2682 + * Creates a plain object from a RenameFile message. Also converts values to other types if specified. 2683 + * @function toObject 2684 + * @memberof subtext_handlers.RenameFile 2685 + * @static 2686 + * @param {subtext_handlers.RenameFile} message RenameFile 2687 + * @param {$protobuf.IConversionOptions} [options] Conversion options 2688 + * @returns {Object.<string,*>} Plain object 2689 + */ 2690 + RenameFile.toObject = function toObject(message, options, _depth) { 2691 + if (!options) 2692 + options = {}; 2693 + if (_depth === undefined) 2694 + _depth = 0; 2695 + if (_depth > $util.recursionLimit) 2696 + throw Error("max depth exceeded"); 2697 + let object = {}; 2698 + if (options.defaults) { 2699 + object.oldVaultPath = ""; 2700 + object.newVaultPath = ""; 2701 + } 2702 + if (message.oldVaultPath != null && message.hasOwnProperty("oldVaultPath")) 2703 + object.oldVaultPath = message.oldVaultPath; 2704 + if (message.newVaultPath != null && message.hasOwnProperty("newVaultPath")) 2705 + object.newVaultPath = message.newVaultPath; 2706 + return object; 2707 + }; 2708 + 2709 + /** 2710 + * Converts this RenameFile to JSON. 2711 + * @function toJSON 2712 + * @memberof subtext_handlers.RenameFile 2713 + * @instance 2714 + * @returns {Object.<string,*>} JSON object 2715 + */ 2716 + RenameFile.prototype.toJSON = function toJSON() { 2717 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 2718 + }; 2719 + 2720 + /** 2721 + * Gets the type url for RenameFile 2722 + * @function getTypeUrl 2723 + * @memberof subtext_handlers.RenameFile 2724 + * @static 2725 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 2726 + * @returns {string} The type url 2727 + */ 2728 + RenameFile.getTypeUrl = function getTypeUrl(prefix) { 2729 + if (prefix === undefined) 2730 + prefix = "type.googleapis.com"; 2731 + return prefix + "/subtext_handlers.RenameFile"; 2732 + }; 2733 + 2734 + return RenameFile; 2735 + })(); 2736 + 2737 + subtext_handlers.Response = (function() { 2738 + 2739 + /** 2740 + * Properties of a Response. 2741 + * @typedef {Object} subtext_handlers.Response.$Properties 2742 + * @property {number|Long|null} [requestId] Response requestId 2743 + * @property {subtext_handlers.Pong.$Properties|null} [pong] Response pong 2744 + * @property {subtext_handlers.Ack.$Properties|null} [ack] Response ack 2745 + * @property {subtext_handlers.Error.$Properties|null} [error] Response error 2746 + * @property {subtext_handlers.BytesPayload.$Properties|null} [bytesPayload] Response bytesPayload 2747 + * @property {subtext_handlers.FileList.$Properties|null} [fileList] Response fileList 2748 + * @property {subtext_handlers.FileExistsResult.$Properties|null} [fileExistsResult] Response fileExistsResult 2749 + * @property {"pong"|"ack"|"error"|"bytesPayload"|"fileList"|"fileExistsResult"} [content] Response content 2750 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 2751 + */ 2752 + 2753 + /** 2754 + * Properties of a Response. 2755 + * @memberof subtext_handlers 2756 + * @interface IResponse 2757 + * @augments subtext_handlers.Response.$Properties 2758 + * @deprecated Use subtext_handlers.Response.$Properties instead. 2759 + */ 2760 + 2761 + /** 2762 + * Narrowed shape of a Response. 2763 + * @typedef {{ 2764 + * requestId?: number|Long|null; 2765 + * pong?: subtext_handlers.Pong.$Shape|null; 2766 + * ack?: subtext_handlers.Ack.$Shape|null; 2767 + * error?: subtext_handlers.Error.$Shape|null; 2768 + * bytesPayload?: subtext_handlers.BytesPayload.$Shape|null; 2769 + * fileList?: subtext_handlers.FileList.$Shape|null; 2770 + * fileExistsResult?: subtext_handlers.FileExistsResult.$Shape|null; 2771 + * $unknowns?: Array.<Uint8Array>; 2772 + * } & ( 2773 + * ({ content?: undefined; pong?: null; ack?: null; error?: null; bytesPayload?: null; fileList?: null; fileExistsResult?: null }|{ content?: "pong"; pong: subtext_handlers.Pong.$Shape; ack?: null; error?: null; bytesPayload?: null; fileList?: null; fileExistsResult?: null }|{ content?: "ack"; pong?: null; ack: subtext_handlers.Ack.$Shape; error?: null; bytesPayload?: null; fileList?: null; fileExistsResult?: null }|{ content?: "error"; pong?: null; ack?: null; error: subtext_handlers.Error.$Shape; bytesPayload?: null; fileList?: null; fileExistsResult?: null }|{ content?: "bytesPayload"; pong?: null; ack?: null; error?: null; bytesPayload: subtext_handlers.BytesPayload.$Shape; fileList?: null; fileExistsResult?: null }|{ content?: "fileList"; pong?: null; ack?: null; error?: null; bytesPayload?: null; fileList: subtext_handlers.FileList.$Shape; fileExistsResult?: null }|{ content?: "fileExistsResult"; pong?: null; ack?: null; error?: null; bytesPayload?: null; fileList?: null; fileExistsResult: subtext_handlers.FileExistsResult.$Shape }) 2774 + * )} subtext_handlers.Response.$Shape 2775 + */ 2776 + 2777 + /** 2778 + * Constructs a new Response. 2779 + * @memberof subtext_handlers 2780 + * @classdesc Represents a Response. 2781 + * @constructor 2782 + * @param {subtext_handlers.Response.$Properties=} [properties] Properties to set 2783 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 2784 + */ 2785 + function Response(properties) { 2786 + if (properties) 2787 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 2788 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 2789 + this[keys[i]] = properties[keys[i]]; 2790 + } 2791 + 2792 + /** 2793 + * Response requestId. 2794 + * @member {number|Long} requestId 2795 + * @memberof subtext_handlers.Response 2796 + * @instance 2797 + */ 2798 + Response.prototype.requestId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; 2799 + 2800 + /** 2801 + * Response pong. 2802 + * @member {subtext_handlers.Pong.$Properties|null|undefined} pong 2803 + * @memberof subtext_handlers.Response 2804 + * @instance 2805 + */ 2806 + Response.prototype.pong = null; 2807 + 2808 + /** 2809 + * Response ack. 2810 + * @member {subtext_handlers.Ack.$Properties|null|undefined} ack 2811 + * @memberof subtext_handlers.Response 2812 + * @instance 2813 + */ 2814 + Response.prototype.ack = null; 2815 + 2816 + /** 2817 + * Response error. 2818 + * @member {subtext_handlers.Error.$Properties|null|undefined} error 2819 + * @memberof subtext_handlers.Response 2820 + * @instance 2821 + */ 2822 + Response.prototype.error = null; 2823 + 2824 + /** 2825 + * Response bytesPayload. 2826 + * @member {subtext_handlers.BytesPayload.$Properties|null|undefined} bytesPayload 2827 + * @memberof subtext_handlers.Response 2828 + * @instance 2829 + */ 2830 + Response.prototype.bytesPayload = null; 2831 + 2832 + /** 2833 + * Response fileList. 2834 + * @member {subtext_handlers.FileList.$Properties|null|undefined} fileList 2835 + * @memberof subtext_handlers.Response 2836 + * @instance 2837 + */ 2838 + Response.prototype.fileList = null; 2839 + 2840 + /** 2841 + * Response fileExistsResult. 2842 + * @member {subtext_handlers.FileExistsResult.$Properties|null|undefined} fileExistsResult 2843 + * @memberof subtext_handlers.Response 2844 + * @instance 2845 + */ 2846 + Response.prototype.fileExistsResult = null; 2847 + 2848 + // OneOf field names bound to virtual getters and setters 2849 + let $oneOfFields; 2850 + 2851 + /** 2852 + * Response content. 2853 + * @member {"pong"|"ack"|"error"|"bytesPayload"|"fileList"|"fileExistsResult"|undefined} content 2854 + * @memberof subtext_handlers.Response 2855 + * @instance 2856 + */ 2857 + Object.defineProperty(Response.prototype, "content", { 2858 + get: $util.oneOfGetter($oneOfFields = ["pong", "ack", "error", "bytesPayload", "fileList", "fileExistsResult"]), 2859 + set: $util.oneOfSetter($oneOfFields) 2860 + }); 2861 + 2862 + /** 2863 + * Creates a new Response instance using the specified properties. 2864 + * @function create 2865 + * @memberof subtext_handlers.Response 2866 + * @static 2867 + * @param {subtext_handlers.Response.$Properties=} [properties] Properties to set 2868 + * @returns {subtext_handlers.Response} Response instance 2869 + * @type {{ 2870 + * (properties: subtext_handlers.Response.$Shape): subtext_handlers.Response & subtext_handlers.Response.$Shape; 2871 + * (properties?: subtext_handlers.Response.$Properties): subtext_handlers.Response; 2872 + * }} 2873 + */ 2874 + Response.create = function create(properties) { 2875 + return new Response(properties); 2876 + }; 2877 + 2878 + /** 2879 + * Encodes the specified Response message. Does not implicitly {@link subtext_handlers.Response.verify|verify} messages. 2880 + * @function encode 2881 + * @memberof subtext_handlers.Response 2882 + * @static 2883 + * @param {subtext_handlers.Response.$Properties} message Response message or plain object to encode 2884 + * @param {$protobuf.Writer} [writer] Writer to encode to 2885 + * @returns {$protobuf.Writer} Writer 2886 + */ 2887 + Response.encode = function encode(message, writer, _depth) { 2888 + if (!writer) 2889 + writer = $Writer.create(); 2890 + if (_depth === undefined) 2891 + _depth = 0; 2892 + if (_depth > $util.recursionLimit) 2893 + throw Error("max depth exceeded"); 2894 + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) 2895 + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.requestId); 2896 + if (message.pong != null && Object.hasOwnProperty.call(message, "pong")) 2897 + $root.subtext_handlers.Pong.encode(message.pong, writer.uint32(/* id 2, wireType 2 =*/18).fork(), _depth + 1).ldelim(); 2898 + if (message.ack != null && Object.hasOwnProperty.call(message, "ack")) 2899 + $root.subtext_handlers.Ack.encode(message.ack, writer.uint32(/* id 3, wireType 2 =*/26).fork(), _depth + 1).ldelim(); 2900 + if (message.error != null && Object.hasOwnProperty.call(message, "error")) 2901 + $root.subtext_handlers.Error.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork(), _depth + 1).ldelim(); 2902 + if (message.bytesPayload != null && Object.hasOwnProperty.call(message, "bytesPayload")) 2903 + $root.subtext_handlers.BytesPayload.encode(message.bytesPayload, writer.uint32(/* id 5, wireType 2 =*/42).fork(), _depth + 1).ldelim(); 2904 + if (message.fileList != null && Object.hasOwnProperty.call(message, "fileList")) 2905 + $root.subtext_handlers.FileList.encode(message.fileList, writer.uint32(/* id 6, wireType 2 =*/50).fork(), _depth + 1).ldelim(); 2906 + if (message.fileExistsResult != null && Object.hasOwnProperty.call(message, "fileExistsResult")) 2907 + $root.subtext_handlers.FileExistsResult.encode(message.fileExistsResult, writer.uint32(/* id 7, wireType 2 =*/58).fork(), _depth + 1).ldelim(); 2908 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 2909 + for (let i = 0; i < message.$unknowns.length; ++i) 2910 + writer.raw(message.$unknowns[i]); 2911 + return writer; 2912 + }; 2913 + 2914 + /** 2915 + * Encodes the specified Response message, length delimited. Does not implicitly {@link subtext_handlers.Response.verify|verify} messages. 2916 + * @function encodeDelimited 2917 + * @memberof subtext_handlers.Response 2918 + * @static 2919 + * @param {subtext_handlers.Response.$Properties} message Response message or plain object to encode 2920 + * @param {$protobuf.Writer} [writer] Writer to encode to 2921 + * @returns {$protobuf.Writer} Writer 2922 + */ 2923 + Response.encodeDelimited = function encodeDelimited(message, writer) { 2924 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 2925 + }; 2926 + 2927 + /** 2928 + * Decodes a Response message from the specified reader or buffer. 2929 + * @function decode 2930 + * @memberof subtext_handlers.Response 2931 + * @static 2932 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 2933 + * @param {number} [length] Message length if known beforehand 2934 + * @returns {subtext_handlers.Response & subtext_handlers.Response.$Shape} Response 2935 + * @throws {Error} If the payload is not a reader or valid buffer 2936 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 2937 + */ 2938 + Response.decode = function decode(reader, length, _end, _depth, _target) { 2939 + if (!(reader instanceof $Reader)) 2940 + reader = $Reader.create(reader); 2941 + if (_depth === undefined) 2942 + _depth = 0; 2943 + if (_depth > $Reader.recursionLimit) 2944 + throw Error("max depth exceeded"); 2945 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.Response(), value; 2946 + while (reader.pos < end) { 2947 + let start = reader.pos; 2948 + let tag = reader.tag(); 2949 + if (tag === _end) { 2950 + _end = undefined; 2951 + break; 2952 + } 2953 + let wireType = tag & 7; 2954 + switch (tag >>>= 3) { 2955 + case 1: { 2956 + if (wireType !== 0) 2957 + break; 2958 + if (typeof (value = reader.uint64()) === "object" ? value.low || value.high : value !== 0) 2959 + message.requestId = value; 2960 + else 2961 + delete message.requestId; 2962 + continue; 2963 + } 2964 + case 2: { 2965 + if (wireType !== 2) 2966 + break; 2967 + message.pong = $root.subtext_handlers.Pong.decode(reader, reader.uint32(), undefined, _depth + 1, message.pong); 2968 + message.content = "pong"; 2969 + continue; 2970 + } 2971 + case 3: { 2972 + if (wireType !== 2) 2973 + break; 2974 + message.ack = $root.subtext_handlers.Ack.decode(reader, reader.uint32(), undefined, _depth + 1, message.ack); 2975 + message.content = "ack"; 2976 + continue; 2977 + } 2978 + case 4: { 2979 + if (wireType !== 2) 2980 + break; 2981 + message.error = $root.subtext_handlers.Error.decode(reader, reader.uint32(), undefined, _depth + 1, message.error); 2982 + message.content = "error"; 2983 + continue; 2984 + } 2985 + case 5: { 2986 + if (wireType !== 2) 2987 + break; 2988 + message.bytesPayload = $root.subtext_handlers.BytesPayload.decode(reader, reader.uint32(), undefined, _depth + 1, message.bytesPayload); 2989 + message.content = "bytesPayload"; 2990 + continue; 2991 + } 2992 + case 6: { 2993 + if (wireType !== 2) 2994 + break; 2995 + message.fileList = $root.subtext_handlers.FileList.decode(reader, reader.uint32(), undefined, _depth + 1, message.fileList); 2996 + message.content = "fileList"; 2997 + continue; 2998 + } 2999 + case 7: { 3000 + if (wireType !== 2) 3001 + break; 3002 + message.fileExistsResult = $root.subtext_handlers.FileExistsResult.decode(reader, reader.uint32(), undefined, _depth + 1, message.fileExistsResult); 3003 + message.content = "fileExistsResult"; 3004 + continue; 3005 + } 3006 + } 3007 + reader.skipType(wireType, _depth, tag); 3008 + $util.makeProp(message, "$unknowns", false); 3009 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 3010 + } 3011 + if (_end !== undefined) 3012 + throw Error("missing end group"); 3013 + return message; 3014 + }; 3015 + 3016 + /** 3017 + * Decodes a Response message from the specified reader or buffer, length delimited. 3018 + * @function decodeDelimited 3019 + * @memberof subtext_handlers.Response 3020 + * @static 3021 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 3022 + * @returns {subtext_handlers.Response & subtext_handlers.Response.$Shape} Response 3023 + * @throws {Error} If the payload is not a reader or valid buffer 3024 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 3025 + */ 3026 + Response.decodeDelimited = function decodeDelimited(reader) { 3027 + if (!(reader instanceof $Reader)) 3028 + reader = new $Reader(reader); 3029 + return this.decode(reader, reader.uint32()); 3030 + }; 3031 + 3032 + /** 3033 + * Verifies a Response message. 3034 + * @function verify 3035 + * @memberof subtext_handlers.Response 3036 + * @static 3037 + * @param {Object.<string,*>} message Plain object to verify 3038 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 3039 + */ 3040 + Response.verify = function verify(message, _depth) { 3041 + if (typeof message !== "object" || message === null) 3042 + return "object expected"; 3043 + if (_depth === undefined) 3044 + _depth = 0; 3045 + if (_depth > $util.recursionLimit) 3046 + return "max depth exceeded"; 3047 + let properties = {}; 3048 + if (message.requestId != null && message.hasOwnProperty("requestId")) 3049 + if (!$util.isInteger(message.requestId) && !(message.requestId && $util.isInteger(message.requestId.low) && $util.isInteger(message.requestId.high))) 3050 + return "requestId: integer|Long expected"; 3051 + if (message.pong != null && message.hasOwnProperty("pong")) { 3052 + properties.content = 1; 3053 + { 3054 + let error = $root.subtext_handlers.Pong.verify(message.pong, _depth + 1); 3055 + if (error) 3056 + return "pong." + error; 3057 + } 3058 + } 3059 + if (message.ack != null && message.hasOwnProperty("ack")) { 3060 + if (properties.content === 1) 3061 + return "content: multiple values"; 3062 + properties.content = 1; 3063 + { 3064 + let error = $root.subtext_handlers.Ack.verify(message.ack, _depth + 1); 3065 + if (error) 3066 + return "ack." + error; 3067 + } 3068 + } 3069 + if (message.error != null && message.hasOwnProperty("error")) { 3070 + if (properties.content === 1) 3071 + return "content: multiple values"; 3072 + properties.content = 1; 3073 + { 3074 + let error = $root.subtext_handlers.Error.verify(message.error, _depth + 1); 3075 + if (error) 3076 + return "error." + error; 3077 + } 3078 + } 3079 + if (message.bytesPayload != null && message.hasOwnProperty("bytesPayload")) { 3080 + if (properties.content === 1) 3081 + return "content: multiple values"; 3082 + properties.content = 1; 3083 + { 3084 + let error = $root.subtext_handlers.BytesPayload.verify(message.bytesPayload, _depth + 1); 3085 + if (error) 3086 + return "bytesPayload." + error; 3087 + } 3088 + } 3089 + if (message.fileList != null && message.hasOwnProperty("fileList")) { 3090 + if (properties.content === 1) 3091 + return "content: multiple values"; 3092 + properties.content = 1; 3093 + { 3094 + let error = $root.subtext_handlers.FileList.verify(message.fileList, _depth + 1); 3095 + if (error) 3096 + return "fileList." + error; 3097 + } 3098 + } 3099 + if (message.fileExistsResult != null && message.hasOwnProperty("fileExistsResult")) { 3100 + if (properties.content === 1) 3101 + return "content: multiple values"; 3102 + properties.content = 1; 3103 + { 3104 + let error = $root.subtext_handlers.FileExistsResult.verify(message.fileExistsResult, _depth + 1); 3105 + if (error) 3106 + return "fileExistsResult." + error; 3107 + } 3108 + } 3109 + return null; 3110 + }; 3111 + 3112 + /** 3113 + * Creates a Response message from a plain object. Also converts values to their respective internal types. 3114 + * @function fromObject 3115 + * @memberof subtext_handlers.Response 3116 + * @static 3117 + * @param {Object.<string,*>} object Plain object 3118 + * @returns {subtext_handlers.Response} Response 3119 + */ 3120 + Response.fromObject = function fromObject(object, _depth) { 3121 + if (object instanceof $root.subtext_handlers.Response) 3122 + return object; 3123 + if (_depth === undefined) 3124 + _depth = 0; 3125 + if (_depth > $util.recursionLimit) 3126 + throw Error("max depth exceeded"); 3127 + let message = new $root.subtext_handlers.Response(); 3128 + if (object.requestId != null) 3129 + if (typeof object.requestId === "object" ? object.requestId.low || object.requestId.high : Number(object.requestId) !== 0) 3130 + if ($util.Long) 3131 + message.requestId = $util.Long.fromValue(object.requestId, true); 3132 + else if (typeof object.requestId === "string") 3133 + message.requestId = parseInt(object.requestId, 10); 3134 + else if (typeof object.requestId === "number") 3135 + message.requestId = object.requestId; 3136 + else if (typeof object.requestId === "object") 3137 + message.requestId = new $util.LongBits(object.requestId.low >>> 0, object.requestId.high >>> 0).toNumber(true); 3138 + if (object.pong != null) { 3139 + if (typeof object.pong !== "object") 3140 + throw TypeError(".subtext_handlers.Response.pong: object expected"); 3141 + message.pong = $root.subtext_handlers.Pong.fromObject(object.pong, _depth + 1); 3142 + } 3143 + if (object.ack != null) { 3144 + if (typeof object.ack !== "object") 3145 + throw TypeError(".subtext_handlers.Response.ack: object expected"); 3146 + message.ack = $root.subtext_handlers.Ack.fromObject(object.ack, _depth + 1); 3147 + } 3148 + if (object.error != null) { 3149 + if (typeof object.error !== "object") 3150 + throw TypeError(".subtext_handlers.Response.error: object expected"); 3151 + message.error = $root.subtext_handlers.Error.fromObject(object.error, _depth + 1); 3152 + } 3153 + if (object.bytesPayload != null) { 3154 + if (typeof object.bytesPayload !== "object") 3155 + throw TypeError(".subtext_handlers.Response.bytesPayload: object expected"); 3156 + message.bytesPayload = $root.subtext_handlers.BytesPayload.fromObject(object.bytesPayload, _depth + 1); 3157 + } 3158 + if (object.fileList != null) { 3159 + if (typeof object.fileList !== "object") 3160 + throw TypeError(".subtext_handlers.Response.fileList: object expected"); 3161 + message.fileList = $root.subtext_handlers.FileList.fromObject(object.fileList, _depth + 1); 3162 + } 3163 + if (object.fileExistsResult != null) { 3164 + if (typeof object.fileExistsResult !== "object") 3165 + throw TypeError(".subtext_handlers.Response.fileExistsResult: object expected"); 3166 + message.fileExistsResult = $root.subtext_handlers.FileExistsResult.fromObject(object.fileExistsResult, _depth + 1); 3167 + } 3168 + return message; 3169 + }; 3170 + 3171 + /** 3172 + * Creates a plain object from a Response message. Also converts values to other types if specified. 3173 + * @function toObject 3174 + * @memberof subtext_handlers.Response 3175 + * @static 3176 + * @param {subtext_handlers.Response} message Response 3177 + * @param {$protobuf.IConversionOptions} [options] Conversion options 3178 + * @returns {Object.<string,*>} Plain object 3179 + */ 3180 + Response.toObject = function toObject(message, options, _depth) { 3181 + if (!options) 3182 + options = {}; 3183 + if (_depth === undefined) 3184 + _depth = 0; 3185 + if (_depth > $util.recursionLimit) 3186 + throw Error("max depth exceeded"); 3187 + let object = {}; 3188 + if (options.defaults) 3189 + if ($util.Long) { 3190 + let long = new $util.Long(0, 0, true); 3191 + object.requestId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; 3192 + } else 3193 + object.requestId = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; 3194 + if (message.requestId != null && message.hasOwnProperty("requestId")) 3195 + if (typeof BigInt !== "undefined" && options.longs === BigInt) 3196 + object.requestId = typeof message.requestId === "number" ? BigInt(message.requestId) : $util.Long.fromBits(message.requestId.low >>> 0, message.requestId.high >>> 0, true).toBigInt(); 3197 + else if (typeof message.requestId === "number") 3198 + object.requestId = options.longs === String ? String(message.requestId) : message.requestId; 3199 + else 3200 + object.requestId = options.longs === String ? $util.Long.prototype.toString.call(message.requestId) : options.longs === Number ? new $util.LongBits(message.requestId.low >>> 0, message.requestId.high >>> 0).toNumber(true) : message.requestId; 3201 + if (message.pong != null && message.hasOwnProperty("pong")) { 3202 + object.pong = $root.subtext_handlers.Pong.toObject(message.pong, options, _depth + 1); 3203 + if (options.oneofs) 3204 + object.content = "pong"; 3205 + } 3206 + if (message.ack != null && message.hasOwnProperty("ack")) { 3207 + object.ack = $root.subtext_handlers.Ack.toObject(message.ack, options, _depth + 1); 3208 + if (options.oneofs) 3209 + object.content = "ack"; 3210 + } 3211 + if (message.error != null && message.hasOwnProperty("error")) { 3212 + object.error = $root.subtext_handlers.Error.toObject(message.error, options, _depth + 1); 3213 + if (options.oneofs) 3214 + object.content = "error"; 3215 + } 3216 + if (message.bytesPayload != null && message.hasOwnProperty("bytesPayload")) { 3217 + object.bytesPayload = $root.subtext_handlers.BytesPayload.toObject(message.bytesPayload, options, _depth + 1); 3218 + if (options.oneofs) 3219 + object.content = "bytesPayload"; 3220 + } 3221 + if (message.fileList != null && message.hasOwnProperty("fileList")) { 3222 + object.fileList = $root.subtext_handlers.FileList.toObject(message.fileList, options, _depth + 1); 3223 + if (options.oneofs) 3224 + object.content = "fileList"; 3225 + } 3226 + if (message.fileExistsResult != null && message.hasOwnProperty("fileExistsResult")) { 3227 + object.fileExistsResult = $root.subtext_handlers.FileExistsResult.toObject(message.fileExistsResult, options, _depth + 1); 3228 + if (options.oneofs) 3229 + object.content = "fileExistsResult"; 3230 + } 3231 + return object; 3232 + }; 3233 + 3234 + /** 3235 + * Converts this Response to JSON. 3236 + * @function toJSON 3237 + * @memberof subtext_handlers.Response 3238 + * @instance 3239 + * @returns {Object.<string,*>} JSON object 3240 + */ 3241 + Response.prototype.toJSON = function toJSON() { 3242 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 3243 + }; 3244 + 3245 + /** 3246 + * Gets the type url for Response 3247 + * @function getTypeUrl 3248 + * @memberof subtext_handlers.Response 3249 + * @static 3250 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 3251 + * @returns {string} The type url 3252 + */ 3253 + Response.getTypeUrl = function getTypeUrl(prefix) { 3254 + if (prefix === undefined) 3255 + prefix = "type.googleapis.com"; 3256 + return prefix + "/subtext_handlers.Response"; 3257 + }; 3258 + 3259 + return Response; 3260 + })(); 3261 + 3262 + subtext_handlers.Pong = (function() { 3263 + 3264 + /** 3265 + * Properties of a Pong. 3266 + * @typedef {Object} subtext_handlers.Pong.$Properties 3267 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 3268 + */ 3269 + 3270 + /** 3271 + * Properties of a Pong. 3272 + * @memberof subtext_handlers 3273 + * @interface IPong 3274 + * @augments subtext_handlers.Pong.$Properties 3275 + * @deprecated Use subtext_handlers.Pong.$Properties instead. 3276 + */ 3277 + 3278 + /** 3279 + * Shape of a Pong. 3280 + * @typedef {subtext_handlers.Pong.$Properties} subtext_handlers.Pong.$Shape 3281 + */ 3282 + 3283 + /** 3284 + * Constructs a new Pong. 3285 + * @memberof subtext_handlers 3286 + * @classdesc Represents a Pong. 3287 + * @constructor 3288 + * @param {subtext_handlers.Pong.$Properties=} [properties] Properties to set 3289 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 3290 + */ 3291 + function Pong(properties) { 3292 + if (properties) 3293 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 3294 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 3295 + this[keys[i]] = properties[keys[i]]; 3296 + } 3297 + 3298 + /** 3299 + * Creates a new Pong instance using the specified properties. 3300 + * @function create 3301 + * @memberof subtext_handlers.Pong 3302 + * @static 3303 + * @param {subtext_handlers.Pong.$Properties=} [properties] Properties to set 3304 + * @returns {subtext_handlers.Pong} Pong instance 3305 + * @type {{ 3306 + * (properties: subtext_handlers.Pong.$Shape): subtext_handlers.Pong & subtext_handlers.Pong.$Shape; 3307 + * (properties?: subtext_handlers.Pong.$Properties): subtext_handlers.Pong; 3308 + * }} 3309 + */ 3310 + Pong.create = function create(properties) { 3311 + return new Pong(properties); 3312 + }; 3313 + 3314 + /** 3315 + * Encodes the specified Pong message. Does not implicitly {@link subtext_handlers.Pong.verify|verify} messages. 3316 + * @function encode 3317 + * @memberof subtext_handlers.Pong 3318 + * @static 3319 + * @param {subtext_handlers.Pong.$Properties} message Pong message or plain object to encode 3320 + * @param {$protobuf.Writer} [writer] Writer to encode to 3321 + * @returns {$protobuf.Writer} Writer 3322 + */ 3323 + Pong.encode = function encode(message, writer, _depth) { 3324 + if (!writer) 3325 + writer = $Writer.create(); 3326 + if (_depth === undefined) 3327 + _depth = 0; 3328 + if (_depth > $util.recursionLimit) 3329 + throw Error("max depth exceeded"); 3330 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 3331 + for (let i = 0; i < message.$unknowns.length; ++i) 3332 + writer.raw(message.$unknowns[i]); 3333 + return writer; 3334 + }; 3335 + 3336 + /** 3337 + * Encodes the specified Pong message, length delimited. Does not implicitly {@link subtext_handlers.Pong.verify|verify} messages. 3338 + * @function encodeDelimited 3339 + * @memberof subtext_handlers.Pong 3340 + * @static 3341 + * @param {subtext_handlers.Pong.$Properties} message Pong message or plain object to encode 3342 + * @param {$protobuf.Writer} [writer] Writer to encode to 3343 + * @returns {$protobuf.Writer} Writer 3344 + */ 3345 + Pong.encodeDelimited = function encodeDelimited(message, writer) { 3346 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 3347 + }; 3348 + 3349 + /** 3350 + * Decodes a Pong message from the specified reader or buffer. 3351 + * @function decode 3352 + * @memberof subtext_handlers.Pong 3353 + * @static 3354 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 3355 + * @param {number} [length] Message length if known beforehand 3356 + * @returns {subtext_handlers.Pong & subtext_handlers.Pong.$Shape} Pong 3357 + * @throws {Error} If the payload is not a reader or valid buffer 3358 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 3359 + */ 3360 + Pong.decode = function decode(reader, length, _end, _depth, _target) { 3361 + if (!(reader instanceof $Reader)) 3362 + reader = $Reader.create(reader); 3363 + if (_depth === undefined) 3364 + _depth = 0; 3365 + if (_depth > $Reader.recursionLimit) 3366 + throw Error("max depth exceeded"); 3367 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.Pong(); 3368 + while (reader.pos < end) { 3369 + let start = reader.pos; 3370 + let tag = reader.tag(); 3371 + if (tag === _end) { 3372 + _end = undefined; 3373 + break; 3374 + } 3375 + reader.skipType(tag & 7, _depth, tag); 3376 + $util.makeProp(message, "$unknowns", false); 3377 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 3378 + } 3379 + if (_end !== undefined) 3380 + throw Error("missing end group"); 3381 + return message; 3382 + }; 3383 + 3384 + /** 3385 + * Decodes a Pong message from the specified reader or buffer, length delimited. 3386 + * @function decodeDelimited 3387 + * @memberof subtext_handlers.Pong 3388 + * @static 3389 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 3390 + * @returns {subtext_handlers.Pong & subtext_handlers.Pong.$Shape} Pong 3391 + * @throws {Error} If the payload is not a reader or valid buffer 3392 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 3393 + */ 3394 + Pong.decodeDelimited = function decodeDelimited(reader) { 3395 + if (!(reader instanceof $Reader)) 3396 + reader = new $Reader(reader); 3397 + return this.decode(reader, reader.uint32()); 3398 + }; 3399 + 3400 + /** 3401 + * Verifies a Pong message. 3402 + * @function verify 3403 + * @memberof subtext_handlers.Pong 3404 + * @static 3405 + * @param {Object.<string,*>} message Plain object to verify 3406 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 3407 + */ 3408 + Pong.verify = function verify(message, _depth) { 3409 + if (typeof message !== "object" || message === null) 3410 + return "object expected"; 3411 + if (_depth === undefined) 3412 + _depth = 0; 3413 + if (_depth > $util.recursionLimit) 3414 + return "max depth exceeded"; 3415 + return null; 3416 + }; 3417 + 3418 + /** 3419 + * Creates a Pong message from a plain object. Also converts values to their respective internal types. 3420 + * @function fromObject 3421 + * @memberof subtext_handlers.Pong 3422 + * @static 3423 + * @param {Object.<string,*>} object Plain object 3424 + * @returns {subtext_handlers.Pong} Pong 3425 + */ 3426 + Pong.fromObject = function fromObject(object, _depth) { 3427 + if (object instanceof $root.subtext_handlers.Pong) 3428 + return object; 3429 + if (_depth === undefined) 3430 + _depth = 0; 3431 + if (_depth > $util.recursionLimit) 3432 + throw Error("max depth exceeded"); 3433 + return new $root.subtext_handlers.Pong(); 3434 + }; 3435 + 3436 + /** 3437 + * Creates a plain object from a Pong message. Also converts values to other types if specified. 3438 + * @function toObject 3439 + * @memberof subtext_handlers.Pong 3440 + * @static 3441 + * @param {subtext_handlers.Pong} message Pong 3442 + * @param {$protobuf.IConversionOptions} [options] Conversion options 3443 + * @returns {Object.<string,*>} Plain object 3444 + */ 3445 + Pong.toObject = function toObject() { 3446 + return {}; 3447 + }; 3448 + 3449 + /** 3450 + * Converts this Pong to JSON. 3451 + * @function toJSON 3452 + * @memberof subtext_handlers.Pong 3453 + * @instance 3454 + * @returns {Object.<string,*>} JSON object 3455 + */ 3456 + Pong.prototype.toJSON = function toJSON() { 3457 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 3458 + }; 3459 + 3460 + /** 3461 + * Gets the type url for Pong 3462 + * @function getTypeUrl 3463 + * @memberof subtext_handlers.Pong 3464 + * @static 3465 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 3466 + * @returns {string} The type url 3467 + */ 3468 + Pong.getTypeUrl = function getTypeUrl(prefix) { 3469 + if (prefix === undefined) 3470 + prefix = "type.googleapis.com"; 3471 + return prefix + "/subtext_handlers.Pong"; 3472 + }; 3473 + 3474 + return Pong; 3475 + })(); 3476 + 3477 + subtext_handlers.Ack = (function() { 3478 + 3479 + /** 3480 + * Properties of an Ack. 3481 + * @typedef {Object} subtext_handlers.Ack.$Properties 3482 + * @property {string|null} [message] Ack message 3483 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 3484 + */ 3485 + 3486 + /** 3487 + * Properties of an Ack. 3488 + * @memberof subtext_handlers 3489 + * @interface IAck 3490 + * @augments subtext_handlers.Ack.$Properties 3491 + * @deprecated Use subtext_handlers.Ack.$Properties instead. 3492 + */ 3493 + 3494 + /** 3495 + * Shape of an Ack. 3496 + * @typedef {subtext_handlers.Ack.$Properties} subtext_handlers.Ack.$Shape 3497 + */ 3498 + 3499 + /** 3500 + * Constructs a new Ack. 3501 + * @memberof subtext_handlers 3502 + * @classdesc Represents an Ack. 3503 + * @constructor 3504 + * @param {subtext_handlers.Ack.$Properties=} [properties] Properties to set 3505 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 3506 + */ 3507 + function Ack(properties) { 3508 + if (properties) 3509 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 3510 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 3511 + this[keys[i]] = properties[keys[i]]; 3512 + } 3513 + 3514 + /** 3515 + * Ack message. 3516 + * @member {string} message 3517 + * @memberof subtext_handlers.Ack 3518 + * @instance 3519 + */ 3520 + Ack.prototype.message = ""; 3521 + 3522 + /** 3523 + * Creates a new Ack instance using the specified properties. 3524 + * @function create 3525 + * @memberof subtext_handlers.Ack 3526 + * @static 3527 + * @param {subtext_handlers.Ack.$Properties=} [properties] Properties to set 3528 + * @returns {subtext_handlers.Ack} Ack instance 3529 + * @type {{ 3530 + * (properties: subtext_handlers.Ack.$Shape): subtext_handlers.Ack & subtext_handlers.Ack.$Shape; 3531 + * (properties?: subtext_handlers.Ack.$Properties): subtext_handlers.Ack; 3532 + * }} 3533 + */ 3534 + Ack.create = function create(properties) { 3535 + return new Ack(properties); 3536 + }; 3537 + 3538 + /** 3539 + * Encodes the specified Ack message. Does not implicitly {@link subtext_handlers.Ack.verify|verify} messages. 3540 + * @function encode 3541 + * @memberof subtext_handlers.Ack 3542 + * @static 3543 + * @param {subtext_handlers.Ack.$Properties} message Ack message or plain object to encode 3544 + * @param {$protobuf.Writer} [writer] Writer to encode to 3545 + * @returns {$protobuf.Writer} Writer 3546 + */ 3547 + Ack.encode = function encode(message, writer, _depth) { 3548 + if (!writer) 3549 + writer = $Writer.create(); 3550 + if (_depth === undefined) 3551 + _depth = 0; 3552 + if (_depth > $util.recursionLimit) 3553 + throw Error("max depth exceeded"); 3554 + if (message.message != null && Object.hasOwnProperty.call(message, "message")) 3555 + writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); 3556 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 3557 + for (let i = 0; i < message.$unknowns.length; ++i) 3558 + writer.raw(message.$unknowns[i]); 3559 + return writer; 3560 + }; 3561 + 3562 + /** 3563 + * Encodes the specified Ack message, length delimited. Does not implicitly {@link subtext_handlers.Ack.verify|verify} messages. 3564 + * @function encodeDelimited 3565 + * @memberof subtext_handlers.Ack 3566 + * @static 3567 + * @param {subtext_handlers.Ack.$Properties} message Ack message or plain object to encode 3568 + * @param {$protobuf.Writer} [writer] Writer to encode to 3569 + * @returns {$protobuf.Writer} Writer 3570 + */ 3571 + Ack.encodeDelimited = function encodeDelimited(message, writer) { 3572 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 3573 + }; 3574 + 3575 + /** 3576 + * Decodes an Ack message from the specified reader or buffer. 3577 + * @function decode 3578 + * @memberof subtext_handlers.Ack 3579 + * @static 3580 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 3581 + * @param {number} [length] Message length if known beforehand 3582 + * @returns {subtext_handlers.Ack & subtext_handlers.Ack.$Shape} Ack 3583 + * @throws {Error} If the payload is not a reader or valid buffer 3584 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 3585 + */ 3586 + Ack.decode = function decode(reader, length, _end, _depth, _target) { 3587 + if (!(reader instanceof $Reader)) 3588 + reader = $Reader.create(reader); 3589 + if (_depth === undefined) 3590 + _depth = 0; 3591 + if (_depth > $Reader.recursionLimit) 3592 + throw Error("max depth exceeded"); 3593 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.Ack(), value; 3594 + while (reader.pos < end) { 3595 + let start = reader.pos; 3596 + let tag = reader.tag(); 3597 + if (tag === _end) { 3598 + _end = undefined; 3599 + break; 3600 + } 3601 + let wireType = tag & 7; 3602 + switch (tag >>>= 3) { 3603 + case 1: { 3604 + if (wireType !== 2) 3605 + break; 3606 + if ((value = reader.string()).length) 3607 + message.message = value; 3608 + else 3609 + delete message.message; 3610 + continue; 3611 + } 3612 + } 3613 + reader.skipType(wireType, _depth, tag); 3614 + $util.makeProp(message, "$unknowns", false); 3615 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 3616 + } 3617 + if (_end !== undefined) 3618 + throw Error("missing end group"); 3619 + return message; 3620 + }; 3621 + 3622 + /** 3623 + * Decodes an Ack message from the specified reader or buffer, length delimited. 3624 + * @function decodeDelimited 3625 + * @memberof subtext_handlers.Ack 3626 + * @static 3627 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 3628 + * @returns {subtext_handlers.Ack & subtext_handlers.Ack.$Shape} Ack 3629 + * @throws {Error} If the payload is not a reader or valid buffer 3630 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 3631 + */ 3632 + Ack.decodeDelimited = function decodeDelimited(reader) { 3633 + if (!(reader instanceof $Reader)) 3634 + reader = new $Reader(reader); 3635 + return this.decode(reader, reader.uint32()); 3636 + }; 3637 + 3638 + /** 3639 + * Verifies an Ack message. 3640 + * @function verify 3641 + * @memberof subtext_handlers.Ack 3642 + * @static 3643 + * @param {Object.<string,*>} message Plain object to verify 3644 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 3645 + */ 3646 + Ack.verify = function verify(message, _depth) { 3647 + if (typeof message !== "object" || message === null) 3648 + return "object expected"; 3649 + if (_depth === undefined) 3650 + _depth = 0; 3651 + if (_depth > $util.recursionLimit) 3652 + return "max depth exceeded"; 3653 + if (message.message != null && message.hasOwnProperty("message")) 3654 + if (!$util.isString(message.message)) 3655 + return "message: string expected"; 3656 + return null; 3657 + }; 3658 + 3659 + /** 3660 + * Creates an Ack message from a plain object. Also converts values to their respective internal types. 3661 + * @function fromObject 3662 + * @memberof subtext_handlers.Ack 3663 + * @static 3664 + * @param {Object.<string,*>} object Plain object 3665 + * @returns {subtext_handlers.Ack} Ack 3666 + */ 3667 + Ack.fromObject = function fromObject(object, _depth) { 3668 + if (object instanceof $root.subtext_handlers.Ack) 3669 + return object; 3670 + if (_depth === undefined) 3671 + _depth = 0; 3672 + if (_depth > $util.recursionLimit) 3673 + throw Error("max depth exceeded"); 3674 + let message = new $root.subtext_handlers.Ack(); 3675 + if (object.message != null) 3676 + if (typeof object.message !== "string" || object.message.length) 3677 + message.message = String(object.message); 3678 + return message; 3679 + }; 3680 + 3681 + /** 3682 + * Creates a plain object from an Ack message. Also converts values to other types if specified. 3683 + * @function toObject 3684 + * @memberof subtext_handlers.Ack 3685 + * @static 3686 + * @param {subtext_handlers.Ack} message Ack 3687 + * @param {$protobuf.IConversionOptions} [options] Conversion options 3688 + * @returns {Object.<string,*>} Plain object 3689 + */ 3690 + Ack.toObject = function toObject(message, options, _depth) { 3691 + if (!options) 3692 + options = {}; 3693 + if (_depth === undefined) 3694 + _depth = 0; 3695 + if (_depth > $util.recursionLimit) 3696 + throw Error("max depth exceeded"); 3697 + let object = {}; 3698 + if (options.defaults) 3699 + object.message = ""; 3700 + if (message.message != null && message.hasOwnProperty("message")) 3701 + object.message = message.message; 3702 + return object; 3703 + }; 3704 + 3705 + /** 3706 + * Converts this Ack to JSON. 3707 + * @function toJSON 3708 + * @memberof subtext_handlers.Ack 3709 + * @instance 3710 + * @returns {Object.<string,*>} JSON object 3711 + */ 3712 + Ack.prototype.toJSON = function toJSON() { 3713 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 3714 + }; 3715 + 3716 + /** 3717 + * Gets the type url for Ack 3718 + * @function getTypeUrl 3719 + * @memberof subtext_handlers.Ack 3720 + * @static 3721 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 3722 + * @returns {string} The type url 3723 + */ 3724 + Ack.getTypeUrl = function getTypeUrl(prefix) { 3725 + if (prefix === undefined) 3726 + prefix = "type.googleapis.com"; 3727 + return prefix + "/subtext_handlers.Ack"; 3728 + }; 3729 + 3730 + return Ack; 3731 + })(); 3732 + 3733 + subtext_handlers.Error = (function() { 3734 + 3735 + /** 3736 + * Properties of an Error. 3737 + * @typedef {Object} subtext_handlers.Error.$Properties 3738 + * @property {string|null} [message] Error message 3739 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 3740 + */ 3741 + 3742 + /** 3743 + * Properties of an Error. 3744 + * @memberof subtext_handlers 3745 + * @interface IError 3746 + * @augments subtext_handlers.Error.$Properties 3747 + * @deprecated Use subtext_handlers.Error.$Properties instead. 3748 + */ 3749 + 3750 + /** 3751 + * Shape of an Error. 3752 + * @typedef {subtext_handlers.Error.$Properties} subtext_handlers.Error.$Shape 3753 + */ 3754 + 3755 + /** 3756 + * Constructs a new Error. 3757 + * @memberof subtext_handlers 3758 + * @classdesc Represents an Error. 3759 + * @constructor 3760 + * @param {subtext_handlers.Error.$Properties=} [properties] Properties to set 3761 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 3762 + */ 3763 + function Error(properties) { 3764 + if (properties) 3765 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 3766 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 3767 + this[keys[i]] = properties[keys[i]]; 3768 + } 3769 + 3770 + /** 3771 + * Error message. 3772 + * @member {string} message 3773 + * @memberof subtext_handlers.Error 3774 + * @instance 3775 + */ 3776 + Error.prototype.message = ""; 3777 + 3778 + /** 3779 + * Creates a new Error instance using the specified properties. 3780 + * @function create 3781 + * @memberof subtext_handlers.Error 3782 + * @static 3783 + * @param {subtext_handlers.Error.$Properties=} [properties] Properties to set 3784 + * @returns {subtext_handlers.Error} Error instance 3785 + * @type {{ 3786 + * (properties: subtext_handlers.Error.$Shape): subtext_handlers.Error & subtext_handlers.Error.$Shape; 3787 + * (properties?: subtext_handlers.Error.$Properties): subtext_handlers.Error; 3788 + * }} 3789 + */ 3790 + Error.create = function create(properties) { 3791 + return new Error(properties); 3792 + }; 3793 + 3794 + /** 3795 + * Encodes the specified Error message. Does not implicitly {@link subtext_handlers.Error.verify|verify} messages. 3796 + * @function encode 3797 + * @memberof subtext_handlers.Error 3798 + * @static 3799 + * @param {subtext_handlers.Error.$Properties} message Error message or plain object to encode 3800 + * @param {$protobuf.Writer} [writer] Writer to encode to 3801 + * @returns {$protobuf.Writer} Writer 3802 + */ 3803 + Error.encode = function encode(message, writer, _depth) { 3804 + if (!writer) 3805 + writer = $Writer.create(); 3806 + if (_depth === undefined) 3807 + _depth = 0; 3808 + if (_depth > $util.recursionLimit) 3809 + throw Error("max depth exceeded"); 3810 + if (message.message != null && Object.hasOwnProperty.call(message, "message")) 3811 + writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); 3812 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 3813 + for (let i = 0; i < message.$unknowns.length; ++i) 3814 + writer.raw(message.$unknowns[i]); 3815 + return writer; 3816 + }; 3817 + 3818 + /** 3819 + * Encodes the specified Error message, length delimited. Does not implicitly {@link subtext_handlers.Error.verify|verify} messages. 3820 + * @function encodeDelimited 3821 + * @memberof subtext_handlers.Error 3822 + * @static 3823 + * @param {subtext_handlers.Error.$Properties} message Error message or plain object to encode 3824 + * @param {$protobuf.Writer} [writer] Writer to encode to 3825 + * @returns {$protobuf.Writer} Writer 3826 + */ 3827 + Error.encodeDelimited = function encodeDelimited(message, writer) { 3828 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 3829 + }; 3830 + 3831 + /** 3832 + * Decodes an Error message from the specified reader or buffer. 3833 + * @function decode 3834 + * @memberof subtext_handlers.Error 3835 + * @static 3836 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 3837 + * @param {number} [length] Message length if known beforehand 3838 + * @returns {subtext_handlers.Error & subtext_handlers.Error.$Shape} Error 3839 + * @throws {Error} If the payload is not a reader or valid buffer 3840 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 3841 + */ 3842 + Error.decode = function decode(reader, length, _end, _depth, _target) { 3843 + if (!(reader instanceof $Reader)) 3844 + reader = $Reader.create(reader); 3845 + if (_depth === undefined) 3846 + _depth = 0; 3847 + if (_depth > $Reader.recursionLimit) 3848 + throw Error("max depth exceeded"); 3849 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.Error(), value; 3850 + while (reader.pos < end) { 3851 + let start = reader.pos; 3852 + let tag = reader.tag(); 3853 + if (tag === _end) { 3854 + _end = undefined; 3855 + break; 3856 + } 3857 + let wireType = tag & 7; 3858 + switch (tag >>>= 3) { 3859 + case 1: { 3860 + if (wireType !== 2) 3861 + break; 3862 + if ((value = reader.string()).length) 3863 + message.message = value; 3864 + else 3865 + delete message.message; 3866 + continue; 3867 + } 3868 + } 3869 + reader.skipType(wireType, _depth, tag); 3870 + $util.makeProp(message, "$unknowns", false); 3871 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 3872 + } 3873 + if (_end !== undefined) 3874 + throw Error("missing end group"); 3875 + return message; 3876 + }; 3877 + 3878 + /** 3879 + * Decodes an Error message from the specified reader or buffer, length delimited. 3880 + * @function decodeDelimited 3881 + * @memberof subtext_handlers.Error 3882 + * @static 3883 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 3884 + * @returns {subtext_handlers.Error & subtext_handlers.Error.$Shape} Error 3885 + * @throws {Error} If the payload is not a reader or valid buffer 3886 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 3887 + */ 3888 + Error.decodeDelimited = function decodeDelimited(reader) { 3889 + if (!(reader instanceof $Reader)) 3890 + reader = new $Reader(reader); 3891 + return this.decode(reader, reader.uint32()); 3892 + }; 3893 + 3894 + /** 3895 + * Verifies an Error message. 3896 + * @function verify 3897 + * @memberof subtext_handlers.Error 3898 + * @static 3899 + * @param {Object.<string,*>} message Plain object to verify 3900 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 3901 + */ 3902 + Error.verify = function verify(message, _depth) { 3903 + if (typeof message !== "object" || message === null) 3904 + return "object expected"; 3905 + if (_depth === undefined) 3906 + _depth = 0; 3907 + if (_depth > $util.recursionLimit) 3908 + return "max depth exceeded"; 3909 + if (message.message != null && message.hasOwnProperty("message")) 3910 + if (!$util.isString(message.message)) 3911 + return "message: string expected"; 3912 + return null; 3913 + }; 3914 + 3915 + /** 3916 + * Creates an Error message from a plain object. Also converts values to their respective internal types. 3917 + * @function fromObject 3918 + * @memberof subtext_handlers.Error 3919 + * @static 3920 + * @param {Object.<string,*>} object Plain object 3921 + * @returns {subtext_handlers.Error} Error 3922 + */ 3923 + Error.fromObject = function fromObject(object, _depth) { 3924 + if (object instanceof $root.subtext_handlers.Error) 3925 + return object; 3926 + if (_depth === undefined) 3927 + _depth = 0; 3928 + if (_depth > $util.recursionLimit) 3929 + throw Error("max depth exceeded"); 3930 + let message = new $root.subtext_handlers.Error(); 3931 + if (object.message != null) 3932 + if (typeof object.message !== "string" || object.message.length) 3933 + message.message = String(object.message); 3934 + return message; 3935 + }; 3936 + 3937 + /** 3938 + * Creates a plain object from an Error message. Also converts values to other types if specified. 3939 + * @function toObject 3940 + * @memberof subtext_handlers.Error 3941 + * @static 3942 + * @param {subtext_handlers.Error} message Error 3943 + * @param {$protobuf.IConversionOptions} [options] Conversion options 3944 + * @returns {Object.<string,*>} Plain object 3945 + */ 3946 + Error.toObject = function toObject(message, options, _depth) { 3947 + if (!options) 3948 + options = {}; 3949 + if (_depth === undefined) 3950 + _depth = 0; 3951 + if (_depth > $util.recursionLimit) 3952 + throw Error("max depth exceeded"); 3953 + let object = {}; 3954 + if (options.defaults) 3955 + object.message = ""; 3956 + if (message.message != null && message.hasOwnProperty("message")) 3957 + object.message = message.message; 3958 + return object; 3959 + }; 3960 + 3961 + /** 3962 + * Converts this Error to JSON. 3963 + * @function toJSON 3964 + * @memberof subtext_handlers.Error 3965 + * @instance 3966 + * @returns {Object.<string,*>} JSON object 3967 + */ 3968 + Error.prototype.toJSON = function toJSON() { 3969 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 3970 + }; 3971 + 3972 + /** 3973 + * Gets the type url for Error 3974 + * @function getTypeUrl 3975 + * @memberof subtext_handlers.Error 3976 + * @static 3977 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 3978 + * @returns {string} The type url 3979 + */ 3980 + Error.getTypeUrl = function getTypeUrl(prefix) { 3981 + if (prefix === undefined) 3982 + prefix = "type.googleapis.com"; 3983 + return prefix + "/subtext_handlers.Error"; 3984 + }; 3985 + 3986 + return Error; 3987 + })(); 3988 + 3989 + subtext_handlers.BytesPayload = (function() { 3990 + 3991 + /** 3992 + * Properties of a BytesPayload. 3993 + * @typedef {Object} subtext_handlers.BytesPayload.$Properties 3994 + * @property {Uint8Array|null} [data] BytesPayload data 3995 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 3996 + */ 3997 + 3998 + /** 3999 + * Properties of a BytesPayload. 4000 + * @memberof subtext_handlers 4001 + * @interface IBytesPayload 4002 + * @augments subtext_handlers.BytesPayload.$Properties 4003 + * @deprecated Use subtext_handlers.BytesPayload.$Properties instead. 4004 + */ 4005 + 4006 + /** 4007 + * Shape of a BytesPayload. 4008 + * @typedef {subtext_handlers.BytesPayload.$Properties} subtext_handlers.BytesPayload.$Shape 4009 + */ 4010 + 4011 + /** 4012 + * Constructs a new BytesPayload. 4013 + * @memberof subtext_handlers 4014 + * @classdesc Represents a BytesPayload. 4015 + * @constructor 4016 + * @param {subtext_handlers.BytesPayload.$Properties=} [properties] Properties to set 4017 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 4018 + */ 4019 + function BytesPayload(properties) { 4020 + if (properties) 4021 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 4022 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 4023 + this[keys[i]] = properties[keys[i]]; 4024 + } 4025 + 4026 + /** 4027 + * BytesPayload data. 4028 + * @member {Uint8Array} data 4029 + * @memberof subtext_handlers.BytesPayload 4030 + * @instance 4031 + */ 4032 + BytesPayload.prototype.data = $util.newBuffer([]); 4033 + 4034 + /** 4035 + * Creates a new BytesPayload instance using the specified properties. 4036 + * @function create 4037 + * @memberof subtext_handlers.BytesPayload 4038 + * @static 4039 + * @param {subtext_handlers.BytesPayload.$Properties=} [properties] Properties to set 4040 + * @returns {subtext_handlers.BytesPayload} BytesPayload instance 4041 + * @type {{ 4042 + * (properties: subtext_handlers.BytesPayload.$Shape): subtext_handlers.BytesPayload & subtext_handlers.BytesPayload.$Shape; 4043 + * (properties?: subtext_handlers.BytesPayload.$Properties): subtext_handlers.BytesPayload; 4044 + * }} 4045 + */ 4046 + BytesPayload.create = function create(properties) { 4047 + return new BytesPayload(properties); 4048 + }; 4049 + 4050 + /** 4051 + * Encodes the specified BytesPayload message. Does not implicitly {@link subtext_handlers.BytesPayload.verify|verify} messages. 4052 + * @function encode 4053 + * @memberof subtext_handlers.BytesPayload 4054 + * @static 4055 + * @param {subtext_handlers.BytesPayload.$Properties} message BytesPayload message or plain object to encode 4056 + * @param {$protobuf.Writer} [writer] Writer to encode to 4057 + * @returns {$protobuf.Writer} Writer 4058 + */ 4059 + BytesPayload.encode = function encode(message, writer, _depth) { 4060 + if (!writer) 4061 + writer = $Writer.create(); 4062 + if (_depth === undefined) 4063 + _depth = 0; 4064 + if (_depth > $util.recursionLimit) 4065 + throw Error("max depth exceeded"); 4066 + if (message.data != null && Object.hasOwnProperty.call(message, "data")) 4067 + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.data); 4068 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 4069 + for (let i = 0; i < message.$unknowns.length; ++i) 4070 + writer.raw(message.$unknowns[i]); 4071 + return writer; 4072 + }; 4073 + 4074 + /** 4075 + * Encodes the specified BytesPayload message, length delimited. Does not implicitly {@link subtext_handlers.BytesPayload.verify|verify} messages. 4076 + * @function encodeDelimited 4077 + * @memberof subtext_handlers.BytesPayload 4078 + * @static 4079 + * @param {subtext_handlers.BytesPayload.$Properties} message BytesPayload message or plain object to encode 4080 + * @param {$protobuf.Writer} [writer] Writer to encode to 4081 + * @returns {$protobuf.Writer} Writer 4082 + */ 4083 + BytesPayload.encodeDelimited = function encodeDelimited(message, writer) { 4084 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 4085 + }; 4086 + 4087 + /** 4088 + * Decodes a BytesPayload message from the specified reader or buffer. 4089 + * @function decode 4090 + * @memberof subtext_handlers.BytesPayload 4091 + * @static 4092 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 4093 + * @param {number} [length] Message length if known beforehand 4094 + * @returns {subtext_handlers.BytesPayload & subtext_handlers.BytesPayload.$Shape} BytesPayload 4095 + * @throws {Error} If the payload is not a reader or valid buffer 4096 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 4097 + */ 4098 + BytesPayload.decode = function decode(reader, length, _end, _depth, _target) { 4099 + if (!(reader instanceof $Reader)) 4100 + reader = $Reader.create(reader); 4101 + if (_depth === undefined) 4102 + _depth = 0; 4103 + if (_depth > $Reader.recursionLimit) 4104 + throw Error("max depth exceeded"); 4105 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.BytesPayload(), value; 4106 + while (reader.pos < end) { 4107 + let start = reader.pos; 4108 + let tag = reader.tag(); 4109 + if (tag === _end) { 4110 + _end = undefined; 4111 + break; 4112 + } 4113 + let wireType = tag & 7; 4114 + switch (tag >>>= 3) { 4115 + case 1: { 4116 + if (wireType !== 2) 4117 + break; 4118 + if ((value = reader.bytes()).length) 4119 + message.data = value; 4120 + else 4121 + delete message.data; 4122 + continue; 4123 + } 4124 + } 4125 + reader.skipType(wireType, _depth, tag); 4126 + $util.makeProp(message, "$unknowns", false); 4127 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 4128 + } 4129 + if (_end !== undefined) 4130 + throw Error("missing end group"); 4131 + return message; 4132 + }; 4133 + 4134 + /** 4135 + * Decodes a BytesPayload message from the specified reader or buffer, length delimited. 4136 + * @function decodeDelimited 4137 + * @memberof subtext_handlers.BytesPayload 4138 + * @static 4139 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 4140 + * @returns {subtext_handlers.BytesPayload & subtext_handlers.BytesPayload.$Shape} BytesPayload 4141 + * @throws {Error} If the payload is not a reader or valid buffer 4142 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 4143 + */ 4144 + BytesPayload.decodeDelimited = function decodeDelimited(reader) { 4145 + if (!(reader instanceof $Reader)) 4146 + reader = new $Reader(reader); 4147 + return this.decode(reader, reader.uint32()); 4148 + }; 4149 + 4150 + /** 4151 + * Verifies a BytesPayload message. 4152 + * @function verify 4153 + * @memberof subtext_handlers.BytesPayload 4154 + * @static 4155 + * @param {Object.<string,*>} message Plain object to verify 4156 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 4157 + */ 4158 + BytesPayload.verify = function verify(message, _depth) { 4159 + if (typeof message !== "object" || message === null) 4160 + return "object expected"; 4161 + if (_depth === undefined) 4162 + _depth = 0; 4163 + if (_depth > $util.recursionLimit) 4164 + return "max depth exceeded"; 4165 + if (message.data != null && message.hasOwnProperty("data")) 4166 + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) 4167 + return "data: buffer expected"; 4168 + return null; 4169 + }; 4170 + 4171 + /** 4172 + * Creates a BytesPayload message from a plain object. Also converts values to their respective internal types. 4173 + * @function fromObject 4174 + * @memberof subtext_handlers.BytesPayload 4175 + * @static 4176 + * @param {Object.<string,*>} object Plain object 4177 + * @returns {subtext_handlers.BytesPayload} BytesPayload 4178 + */ 4179 + BytesPayload.fromObject = function fromObject(object, _depth) { 4180 + if (object instanceof $root.subtext_handlers.BytesPayload) 4181 + return object; 4182 + if (_depth === undefined) 4183 + _depth = 0; 4184 + if (_depth > $util.recursionLimit) 4185 + throw Error("max depth exceeded"); 4186 + let message = new $root.subtext_handlers.BytesPayload(); 4187 + if (object.data != null) 4188 + if (object.data.length) 4189 + if (typeof object.data === "string") 4190 + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); 4191 + else if (object.data.length >= 0) 4192 + message.data = object.data; 4193 + return message; 4194 + }; 4195 + 4196 + /** 4197 + * Creates a plain object from a BytesPayload message. Also converts values to other types if specified. 4198 + * @function toObject 4199 + * @memberof subtext_handlers.BytesPayload 4200 + * @static 4201 + * @param {subtext_handlers.BytesPayload} message BytesPayload 4202 + * @param {$protobuf.IConversionOptions} [options] Conversion options 4203 + * @returns {Object.<string,*>} Plain object 4204 + */ 4205 + BytesPayload.toObject = function toObject(message, options, _depth) { 4206 + if (!options) 4207 + options = {}; 4208 + if (_depth === undefined) 4209 + _depth = 0; 4210 + if (_depth > $util.recursionLimit) 4211 + throw Error("max depth exceeded"); 4212 + let object = {}; 4213 + if (options.defaults) 4214 + if (options.bytes === String) 4215 + object.data = ""; 4216 + else { 4217 + object.data = []; 4218 + if (options.bytes !== Array) 4219 + object.data = $util.newBuffer(object.data); 4220 + } 4221 + if (message.data != null && message.hasOwnProperty("data")) 4222 + 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; 4223 + return object; 4224 + }; 4225 + 4226 + /** 4227 + * Converts this BytesPayload to JSON. 4228 + * @function toJSON 4229 + * @memberof subtext_handlers.BytesPayload 4230 + * @instance 4231 + * @returns {Object.<string,*>} JSON object 4232 + */ 4233 + BytesPayload.prototype.toJSON = function toJSON() { 4234 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 4235 + }; 4236 + 4237 + /** 4238 + * Gets the type url for BytesPayload 4239 + * @function getTypeUrl 4240 + * @memberof subtext_handlers.BytesPayload 4241 + * @static 4242 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 4243 + * @returns {string} The type url 4244 + */ 4245 + BytesPayload.getTypeUrl = function getTypeUrl(prefix) { 4246 + if (prefix === undefined) 4247 + prefix = "type.googleapis.com"; 4248 + return prefix + "/subtext_handlers.BytesPayload"; 4249 + }; 4250 + 4251 + return BytesPayload; 4252 + })(); 4253 + 4254 + subtext_handlers.FileList = (function() { 4255 + 4256 + /** 4257 + * Properties of a FileList. 4258 + * @typedef {Object} subtext_handlers.FileList.$Properties 4259 + * @property {Array.<string>|null} [paths] FileList paths 4260 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 4261 + */ 4262 + 4263 + /** 4264 + * Properties of a FileList. 4265 + * @memberof subtext_handlers 4266 + * @interface IFileList 4267 + * @augments subtext_handlers.FileList.$Properties 4268 + * @deprecated Use subtext_handlers.FileList.$Properties instead. 4269 + */ 4270 + 4271 + /** 4272 + * Shape of a FileList. 4273 + * @typedef {subtext_handlers.FileList.$Properties} subtext_handlers.FileList.$Shape 4274 + */ 4275 + 4276 + /** 4277 + * Constructs a new FileList. 4278 + * @memberof subtext_handlers 4279 + * @classdesc Represents a FileList. 4280 + * @constructor 4281 + * @param {subtext_handlers.FileList.$Properties=} [properties] Properties to set 4282 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 4283 + */ 4284 + function FileList(properties) { 4285 + this.paths = []; 4286 + if (properties) 4287 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 4288 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 4289 + this[keys[i]] = properties[keys[i]]; 4290 + } 4291 + 4292 + /** 4293 + * FileList paths. 4294 + * @member {Array.<string>} paths 4295 + * @memberof subtext_handlers.FileList 4296 + * @instance 4297 + */ 4298 + FileList.prototype.paths = $util.emptyArray; 4299 + 4300 + /** 4301 + * Creates a new FileList instance using the specified properties. 4302 + * @function create 4303 + * @memberof subtext_handlers.FileList 4304 + * @static 4305 + * @param {subtext_handlers.FileList.$Properties=} [properties] Properties to set 4306 + * @returns {subtext_handlers.FileList} FileList instance 4307 + * @type {{ 4308 + * (properties: subtext_handlers.FileList.$Shape): subtext_handlers.FileList & subtext_handlers.FileList.$Shape; 4309 + * (properties?: subtext_handlers.FileList.$Properties): subtext_handlers.FileList; 4310 + * }} 4311 + */ 4312 + FileList.create = function create(properties) { 4313 + return new FileList(properties); 4314 + }; 4315 + 4316 + /** 4317 + * Encodes the specified FileList message. Does not implicitly {@link subtext_handlers.FileList.verify|verify} messages. 4318 + * @function encode 4319 + * @memberof subtext_handlers.FileList 4320 + * @static 4321 + * @param {subtext_handlers.FileList.$Properties} message FileList message or plain object to encode 4322 + * @param {$protobuf.Writer} [writer] Writer to encode to 4323 + * @returns {$protobuf.Writer} Writer 4324 + */ 4325 + FileList.encode = function encode(message, writer, _depth) { 4326 + if (!writer) 4327 + writer = $Writer.create(); 4328 + if (_depth === undefined) 4329 + _depth = 0; 4330 + if (_depth > $util.recursionLimit) 4331 + throw Error("max depth exceeded"); 4332 + if (message.paths != null && message.paths.length) 4333 + for (let i = 0; i < message.paths.length; ++i) 4334 + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); 4335 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 4336 + for (let i = 0; i < message.$unknowns.length; ++i) 4337 + writer.raw(message.$unknowns[i]); 4338 + return writer; 4339 + }; 4340 + 4341 + /** 4342 + * Encodes the specified FileList message, length delimited. Does not implicitly {@link subtext_handlers.FileList.verify|verify} messages. 4343 + * @function encodeDelimited 4344 + * @memberof subtext_handlers.FileList 4345 + * @static 4346 + * @param {subtext_handlers.FileList.$Properties} message FileList message or plain object to encode 4347 + * @param {$protobuf.Writer} [writer] Writer to encode to 4348 + * @returns {$protobuf.Writer} Writer 4349 + */ 4350 + FileList.encodeDelimited = function encodeDelimited(message, writer) { 4351 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 4352 + }; 4353 + 4354 + /** 4355 + * Decodes a FileList message from the specified reader or buffer. 4356 + * @function decode 4357 + * @memberof subtext_handlers.FileList 4358 + * @static 4359 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 4360 + * @param {number} [length] Message length if known beforehand 4361 + * @returns {subtext_handlers.FileList & subtext_handlers.FileList.$Shape} FileList 4362 + * @throws {Error} If the payload is not a reader or valid buffer 4363 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 4364 + */ 4365 + FileList.decode = function decode(reader, length, _end, _depth, _target) { 4366 + if (!(reader instanceof $Reader)) 4367 + reader = $Reader.create(reader); 4368 + if (_depth === undefined) 4369 + _depth = 0; 4370 + if (_depth > $Reader.recursionLimit) 4371 + throw Error("max depth exceeded"); 4372 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.FileList(); 4373 + while (reader.pos < end) { 4374 + let start = reader.pos; 4375 + let tag = reader.tag(); 4376 + if (tag === _end) { 4377 + _end = undefined; 4378 + break; 4379 + } 4380 + let wireType = tag & 7; 4381 + switch (tag >>>= 3) { 4382 + case 1: { 4383 + if (wireType !== 2) 4384 + break; 4385 + if (!(message.paths && message.paths.length)) 4386 + message.paths = []; 4387 + message.paths.push(reader.string()); 4388 + continue; 4389 + } 4390 + } 4391 + reader.skipType(wireType, _depth, tag); 4392 + $util.makeProp(message, "$unknowns", false); 4393 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 4394 + } 4395 + if (_end !== undefined) 4396 + throw Error("missing end group"); 4397 + return message; 4398 + }; 4399 + 4400 + /** 4401 + * Decodes a FileList message from the specified reader or buffer, length delimited. 4402 + * @function decodeDelimited 4403 + * @memberof subtext_handlers.FileList 4404 + * @static 4405 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 4406 + * @returns {subtext_handlers.FileList & subtext_handlers.FileList.$Shape} FileList 4407 + * @throws {Error} If the payload is not a reader or valid buffer 4408 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 4409 + */ 4410 + FileList.decodeDelimited = function decodeDelimited(reader) { 4411 + if (!(reader instanceof $Reader)) 4412 + reader = new $Reader(reader); 4413 + return this.decode(reader, reader.uint32()); 4414 + }; 4415 + 4416 + /** 4417 + * Verifies a FileList message. 4418 + * @function verify 4419 + * @memberof subtext_handlers.FileList 4420 + * @static 4421 + * @param {Object.<string,*>} message Plain object to verify 4422 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 4423 + */ 4424 + FileList.verify = function verify(message, _depth) { 4425 + if (typeof message !== "object" || message === null) 4426 + return "object expected"; 4427 + if (_depth === undefined) 4428 + _depth = 0; 4429 + if (_depth > $util.recursionLimit) 4430 + return "max depth exceeded"; 4431 + if (message.paths != null && message.hasOwnProperty("paths")) { 4432 + if (!Array.isArray(message.paths)) 4433 + return "paths: array expected"; 4434 + for (let i = 0; i < message.paths.length; ++i) 4435 + if (!$util.isString(message.paths[i])) 4436 + return "paths: string[] expected"; 4437 + } 4438 + return null; 4439 + }; 4440 + 4441 + /** 4442 + * Creates a FileList message from a plain object. Also converts values to their respective internal types. 4443 + * @function fromObject 4444 + * @memberof subtext_handlers.FileList 4445 + * @static 4446 + * @param {Object.<string,*>} object Plain object 4447 + * @returns {subtext_handlers.FileList} FileList 4448 + */ 4449 + FileList.fromObject = function fromObject(object, _depth) { 4450 + if (object instanceof $root.subtext_handlers.FileList) 4451 + return object; 4452 + if (_depth === undefined) 4453 + _depth = 0; 4454 + if (_depth > $util.recursionLimit) 4455 + throw Error("max depth exceeded"); 4456 + let message = new $root.subtext_handlers.FileList(); 4457 + if (object.paths) { 4458 + if (!Array.isArray(object.paths)) 4459 + throw TypeError(".subtext_handlers.FileList.paths: array expected"); 4460 + message.paths = Array(object.paths.length); 4461 + for (let i = 0; i < object.paths.length; ++i) 4462 + message.paths[i] = String(object.paths[i]); 4463 + } 4464 + return message; 4465 + }; 4466 + 4467 + /** 4468 + * Creates a plain object from a FileList message. Also converts values to other types if specified. 4469 + * @function toObject 4470 + * @memberof subtext_handlers.FileList 4471 + * @static 4472 + * @param {subtext_handlers.FileList} message FileList 4473 + * @param {$protobuf.IConversionOptions} [options] Conversion options 4474 + * @returns {Object.<string,*>} Plain object 4475 + */ 4476 + FileList.toObject = function toObject(message, options, _depth) { 4477 + if (!options) 4478 + options = {}; 4479 + if (_depth === undefined) 4480 + _depth = 0; 4481 + if (_depth > $util.recursionLimit) 4482 + throw Error("max depth exceeded"); 4483 + let object = {}; 4484 + if (options.arrays || options.defaults) 4485 + object.paths = []; 4486 + if (message.paths && message.paths.length) { 4487 + object.paths = Array(message.paths.length); 4488 + for (let j = 0; j < message.paths.length; ++j) 4489 + object.paths[j] = message.paths[j]; 4490 + } 4491 + return object; 4492 + }; 4493 + 4494 + /** 4495 + * Converts this FileList to JSON. 4496 + * @function toJSON 4497 + * @memberof subtext_handlers.FileList 4498 + * @instance 4499 + * @returns {Object.<string,*>} JSON object 4500 + */ 4501 + FileList.prototype.toJSON = function toJSON() { 4502 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 4503 + }; 4504 + 4505 + /** 4506 + * Gets the type url for FileList 4507 + * @function getTypeUrl 4508 + * @memberof subtext_handlers.FileList 4509 + * @static 4510 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 4511 + * @returns {string} The type url 4512 + */ 4513 + FileList.getTypeUrl = function getTypeUrl(prefix) { 4514 + if (prefix === undefined) 4515 + prefix = "type.googleapis.com"; 4516 + return prefix + "/subtext_handlers.FileList"; 4517 + }; 4518 + 4519 + return FileList; 4520 + })(); 4521 + 4522 + subtext_handlers.FileExistsResult = (function() { 4523 + 4524 + /** 4525 + * Properties of a FileExistsResult. 4526 + * @typedef {Object} subtext_handlers.FileExistsResult.$Properties 4527 + * @property {boolean|null} [exists] FileExistsResult exists 4528 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 4529 + */ 4530 + 4531 + /** 4532 + * Properties of a FileExistsResult. 4533 + * @memberof subtext_handlers 4534 + * @interface IFileExistsResult 4535 + * @augments subtext_handlers.FileExistsResult.$Properties 4536 + * @deprecated Use subtext_handlers.FileExistsResult.$Properties instead. 4537 + */ 4538 + 4539 + /** 4540 + * Shape of a FileExistsResult. 4541 + * @typedef {subtext_handlers.FileExistsResult.$Properties} subtext_handlers.FileExistsResult.$Shape 4542 + */ 4543 + 4544 + /** 4545 + * Constructs a new FileExistsResult. 4546 + * @memberof subtext_handlers 4547 + * @classdesc Represents a FileExistsResult. 4548 + * @constructor 4549 + * @param {subtext_handlers.FileExistsResult.$Properties=} [properties] Properties to set 4550 + * @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding 4551 + */ 4552 + function FileExistsResult(properties) { 4553 + if (properties) 4554 + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) 4555 + if (properties[keys[i]] != null && keys[i] !== "__proto__") 4556 + this[keys[i]] = properties[keys[i]]; 4557 + } 4558 + 4559 + /** 4560 + * FileExistsResult exists. 4561 + * @member {boolean} exists 4562 + * @memberof subtext_handlers.FileExistsResult 4563 + * @instance 4564 + */ 4565 + FileExistsResult.prototype.exists = false; 4566 + 4567 + /** 4568 + * Creates a new FileExistsResult instance using the specified properties. 4569 + * @function create 4570 + * @memberof subtext_handlers.FileExistsResult 4571 + * @static 4572 + * @param {subtext_handlers.FileExistsResult.$Properties=} [properties] Properties to set 4573 + * @returns {subtext_handlers.FileExistsResult} FileExistsResult instance 4574 + * @type {{ 4575 + * (properties: subtext_handlers.FileExistsResult.$Shape): subtext_handlers.FileExistsResult & subtext_handlers.FileExistsResult.$Shape; 4576 + * (properties?: subtext_handlers.FileExistsResult.$Properties): subtext_handlers.FileExistsResult; 4577 + * }} 4578 + */ 4579 + FileExistsResult.create = function create(properties) { 4580 + return new FileExistsResult(properties); 4581 + }; 4582 + 4583 + /** 4584 + * Encodes the specified FileExistsResult message. Does not implicitly {@link subtext_handlers.FileExistsResult.verify|verify} messages. 4585 + * @function encode 4586 + * @memberof subtext_handlers.FileExistsResult 4587 + * @static 4588 + * @param {subtext_handlers.FileExistsResult.$Properties} message FileExistsResult message or plain object to encode 4589 + * @param {$protobuf.Writer} [writer] Writer to encode to 4590 + * @returns {$protobuf.Writer} Writer 4591 + */ 4592 + FileExistsResult.encode = function encode(message, writer, _depth) { 4593 + if (!writer) 4594 + writer = $Writer.create(); 4595 + if (_depth === undefined) 4596 + _depth = 0; 4597 + if (_depth > $util.recursionLimit) 4598 + throw Error("max depth exceeded"); 4599 + if (message.exists != null && Object.hasOwnProperty.call(message, "exists")) 4600 + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.exists); 4601 + if (message.$unknowns != null && Object.hasOwnProperty.call(message, "$unknowns")) 4602 + for (let i = 0; i < message.$unknowns.length; ++i) 4603 + writer.raw(message.$unknowns[i]); 4604 + return writer; 4605 + }; 4606 + 4607 + /** 4608 + * Encodes the specified FileExistsResult message, length delimited. Does not implicitly {@link subtext_handlers.FileExistsResult.verify|verify} messages. 4609 + * @function encodeDelimited 4610 + * @memberof subtext_handlers.FileExistsResult 4611 + * @static 4612 + * @param {subtext_handlers.FileExistsResult.$Properties} message FileExistsResult message or plain object to encode 4613 + * @param {$protobuf.Writer} [writer] Writer to encode to 4614 + * @returns {$protobuf.Writer} Writer 4615 + */ 4616 + FileExistsResult.encodeDelimited = function encodeDelimited(message, writer) { 4617 + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); 4618 + }; 4619 + 4620 + /** 4621 + * Decodes a FileExistsResult message from the specified reader or buffer. 4622 + * @function decode 4623 + * @memberof subtext_handlers.FileExistsResult 4624 + * @static 4625 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 4626 + * @param {number} [length] Message length if known beforehand 4627 + * @returns {subtext_handlers.FileExistsResult & subtext_handlers.FileExistsResult.$Shape} FileExistsResult 4628 + * @throws {Error} If the payload is not a reader or valid buffer 4629 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 4630 + */ 4631 + FileExistsResult.decode = function decode(reader, length, _end, _depth, _target) { 4632 + if (!(reader instanceof $Reader)) 4633 + reader = $Reader.create(reader); 4634 + if (_depth === undefined) 4635 + _depth = 0; 4636 + if (_depth > $Reader.recursionLimit) 4637 + throw Error("max depth exceeded"); 4638 + let end = length === undefined ? reader.len : reader.pos + length, message = _target || new $root.subtext_handlers.FileExistsResult(), value; 4639 + while (reader.pos < end) { 4640 + let start = reader.pos; 4641 + let tag = reader.tag(); 4642 + if (tag === _end) { 4643 + _end = undefined; 4644 + break; 4645 + } 4646 + let wireType = tag & 7; 4647 + switch (tag >>>= 3) { 4648 + case 1: { 4649 + if (wireType !== 0) 4650 + break; 4651 + if (value = reader.bool()) 4652 + message.exists = value; 4653 + else 4654 + delete message.exists; 4655 + continue; 4656 + } 4657 + } 4658 + reader.skipType(wireType, _depth, tag); 4659 + $util.makeProp(message, "$unknowns", false); 4660 + (message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos)); 4661 + } 4662 + if (_end !== undefined) 4663 + throw Error("missing end group"); 4664 + return message; 4665 + }; 4666 + 4667 + /** 4668 + * Decodes a FileExistsResult message from the specified reader or buffer, length delimited. 4669 + * @function decodeDelimited 4670 + * @memberof subtext_handlers.FileExistsResult 4671 + * @static 4672 + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from 4673 + * @returns {subtext_handlers.FileExistsResult & subtext_handlers.FileExistsResult.$Shape} FileExistsResult 4674 + * @throws {Error} If the payload is not a reader or valid buffer 4675 + * @throws {$protobuf.util.ProtocolError} If required fields are missing 4676 + */ 4677 + FileExistsResult.decodeDelimited = function decodeDelimited(reader) { 4678 + if (!(reader instanceof $Reader)) 4679 + reader = new $Reader(reader); 4680 + return this.decode(reader, reader.uint32()); 4681 + }; 4682 + 4683 + /** 4684 + * Verifies a FileExistsResult message. 4685 + * @function verify 4686 + * @memberof subtext_handlers.FileExistsResult 4687 + * @static 4688 + * @param {Object.<string,*>} message Plain object to verify 4689 + * @returns {string|null} `null` if valid, otherwise the reason why it is not 4690 + */ 4691 + FileExistsResult.verify = function verify(message, _depth) { 4692 + if (typeof message !== "object" || message === null) 4693 + return "object expected"; 4694 + if (_depth === undefined) 4695 + _depth = 0; 4696 + if (_depth > $util.recursionLimit) 4697 + return "max depth exceeded"; 4698 + if (message.exists != null && message.hasOwnProperty("exists")) 4699 + if (typeof message.exists !== "boolean") 4700 + return "exists: boolean expected"; 4701 + return null; 4702 + }; 4703 + 4704 + /** 4705 + * Creates a FileExistsResult message from a plain object. Also converts values to their respective internal types. 4706 + * @function fromObject 4707 + * @memberof subtext_handlers.FileExistsResult 4708 + * @static 4709 + * @param {Object.<string,*>} object Plain object 4710 + * @returns {subtext_handlers.FileExistsResult} FileExistsResult 4711 + */ 4712 + FileExistsResult.fromObject = function fromObject(object, _depth) { 4713 + if (object instanceof $root.subtext_handlers.FileExistsResult) 4714 + return object; 4715 + if (_depth === undefined) 4716 + _depth = 0; 4717 + if (_depth > $util.recursionLimit) 4718 + throw Error("max depth exceeded"); 4719 + let message = new $root.subtext_handlers.FileExistsResult(); 4720 + if (object.exists != null) 4721 + if (object.exists) 4722 + message.exists = Boolean(object.exists); 4723 + return message; 4724 + }; 4725 + 4726 + /** 4727 + * Creates a plain object from a FileExistsResult message. Also converts values to other types if specified. 4728 + * @function toObject 4729 + * @memberof subtext_handlers.FileExistsResult 4730 + * @static 4731 + * @param {subtext_handlers.FileExistsResult} message FileExistsResult 4732 + * @param {$protobuf.IConversionOptions} [options] Conversion options 4733 + * @returns {Object.<string,*>} Plain object 4734 + */ 4735 + FileExistsResult.toObject = function toObject(message, options, _depth) { 4736 + if (!options) 4737 + options = {}; 4738 + if (_depth === undefined) 4739 + _depth = 0; 4740 + if (_depth > $util.recursionLimit) 4741 + throw Error("max depth exceeded"); 4742 + let object = {}; 4743 + if (options.defaults) 4744 + object.exists = false; 4745 + if (message.exists != null && message.hasOwnProperty("exists")) 4746 + object.exists = message.exists; 4747 + return object; 4748 + }; 4749 + 4750 + /** 4751 + * Converts this FileExistsResult to JSON. 4752 + * @function toJSON 4753 + * @memberof subtext_handlers.FileExistsResult 4754 + * @instance 4755 + * @returns {Object.<string,*>} JSON object 4756 + */ 4757 + FileExistsResult.prototype.toJSON = function toJSON() { 4758 + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); 4759 + }; 4760 + 4761 + /** 4762 + * Gets the type url for FileExistsResult 4763 + * @function getTypeUrl 4764 + * @memberof subtext_handlers.FileExistsResult 4765 + * @static 4766 + * @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"` 4767 + * @returns {string} The type url 4768 + */ 4769 + FileExistsResult.getTypeUrl = function getTypeUrl(prefix) { 4770 + if (prefix === undefined) 4771 + prefix = "type.googleapis.com"; 4772 + return prefix + "/subtext_handlers.FileExistsResult"; 4773 + }; 4774 + 4775 + return FileExistsResult; 4776 + })(); 4777 + 4778 + return subtext_handlers; 4779 + })(); 4780 + 4781 + export { 4782 + $root as default 4783 + };
+296
src/subtext/tcpClient.ts
··· 1 + import * as net from 'net'; 2 + import { subtext_handlers } from './proto'; 3 + 4 + const DEFAULT_ADDR = '127.0.0.1:8081'; 5 + const TCP_TIMEOUT_MS = 5000; 6 + 7 + function getDaemonAddr(): string { 8 + return process.env.SUBTEXT_DAEMON_ADDR ?? DEFAULT_ADDR; 9 + } 10 + 11 + /** Encode a number as a LEB128 / protobuf varint. */ 12 + function encodeVarint(value: number): Buffer { 13 + const bytes: number[] = []; 14 + while (value >= 0x80) { 15 + bytes.push((value & 0x7f) | 0x80); 16 + value >>>= 7; 17 + } 18 + bytes.push(value); 19 + return Buffer.from(bytes); 20 + } 21 + 22 + /** Try to decode a LEB128 / protobuf varint from the front of a buffer. */ 23 + function decodeVarint(buf: Buffer): { value: number; bytesRead: number } | null { 24 + let value = 0; 25 + let shift = 0; 26 + let bytesRead = 0; 27 + while (bytesRead < buf.length) { 28 + const byte = buf[bytesRead]; 29 + value |= (byte & 0x7f) << shift; 30 + bytesRead++; 31 + if ((byte & 0x80) === 0) { 32 + return { value, bytesRead }; 33 + } 34 + shift += 7; 35 + if (shift >= 32) throw new Error('varint too long'); 36 + } 37 + return null; // incomplete 38 + } 39 + 40 + /** 41 + * Length-delimited protobuf client for the Subtext application-handler TCP port. 42 + * 43 + * Uses **protobuf varint (LEB128)** framing to match [`prost::Message::encode_length_delimited`] 44 + * on the Rust side. 45 + * 46 + * Maintains a persistent socket and auto-reconnects with exponential backoff 47 + * (max 3 retries). 48 + */ 49 + export class SubtextTCPClient { 50 + private socket: net.Socket | null = null; 51 + private addr: string; 52 + private reconnectAttempts = 0; 53 + private readonly maxReconnectAttempts = 3; 54 + private readonly baseReconnectDelayMs = 500; 55 + private connected = false; 56 + private pending = new Map< 57 + number, 58 + { resolve: (resp: subtext_handlers.Response) => void; reject: (err: Error) => void } 59 + >(); 60 + private nextId = 1; 61 + private readBuf = Buffer.alloc(0); 62 + 63 + constructor(addr?: string) { 64 + this.addr = addr ?? getDaemonAddr(); 65 + } 66 + 67 + get isConnected(): boolean { 68 + return this.connected; 69 + } 70 + 71 + async connect(): Promise<void> { 72 + if (this.connected && this.socket && !this.socket.destroyed) { 73 + return; 74 + } 75 + console.log('[subtext] connecting to', this.addr); 76 + return new Promise((resolve, reject) => { 77 + const [host, portStr] = this.addr.split(':'); 78 + const port = parseInt(portStr ?? '8081', 10); 79 + 80 + const sock = new net.Socket(); 81 + sock.once('connect', () => { 82 + console.log('[subtext] connected'); 83 + this.socket = sock; 84 + this.connected = true; 85 + this.reconnectAttempts = 0; 86 + this.setupSocketHandlers(); 87 + resolve(); 88 + }); 89 + sock.once('error', (err) => { 90 + console.warn('[subtext] connection error:', err.message); 91 + reject(err); 92 + }); 93 + sock.connect(port, host ?? '127.0.0.1'); 94 + }); 95 + } 96 + 97 + disconnect(): void { 98 + this.socket?.destroy(); 99 + this.socket = null; 100 + this.connected = false; 101 + } 102 + 103 + private setupSocketHandlers(): void { 104 + if (!this.socket) return; 105 + this.socket.on('data', (chunk: Buffer) => { 106 + console.log('[subtext] received', chunk.length, 'bytes'); 107 + this.readBuf = Buffer.concat([this.readBuf, chunk]); 108 + this.tryDecodeResponse(); 109 + }); 110 + this.socket.on('close', () => { 111 + console.warn('[subtext] socket closed'); 112 + this.connected = false; 113 + this.socket = null; 114 + this.attemptReconnect(); 115 + }); 116 + this.socket.on('error', (err) => { 117 + console.warn('[subtext] socket error:', err.message); 118 + }); 119 + } 120 + 121 + private tryDecodeResponse(): void { 122 + console.log('[subtext] trying decode, buffer length:', this.readBuf.length); 123 + while (true) { 124 + const result = decodeVarint(this.readBuf); 125 + if (!result) { 126 + console.log('[subtext] incomplete varint, waiting for more data'); 127 + break; 128 + } 129 + const { value: len, bytesRead } = result; 130 + console.log('[subtext] decoded varint: len=', len, 'bytesRead=', bytesRead); 131 + if (this.readBuf.length < bytesRead + len) { 132 + console.log('[subtext] incomplete frame, need', bytesRead + len, 'have', this.readBuf.length); 133 + break; 134 + } 135 + const frame = this.readBuf.subarray(bytesRead, bytesRead + len); 136 + this.readBuf = this.readBuf.subarray(bytesRead + len); 137 + console.log('[subtext] decoded frame,', frame.length, 'bytes'); 138 + try { 139 + const resp = subtext_handlers.Response.decode(frame); 140 + console.log('[subtext] decoded response id=', resp.requestId, 'content=', resp.content); 141 + if (resp.requestId != null) { 142 + const pending = this.pending.get(Number(resp.requestId)); 143 + if (pending) { 144 + console.log('[subtext] resolving pending request', resp.requestId); 145 + this.pending.delete(Number(resp.requestId)); 146 + pending.resolve(resp); 147 + } else { 148 + console.warn('[subtext] no pending request for id', resp.requestId); 149 + } 150 + } 151 + } catch (e) { 152 + console.warn('[subtext] decode error:', e); 153 + } 154 + } 155 + } 156 + 157 + private attemptReconnect(): void { 158 + if (this.reconnectAttempts >= this.maxReconnectAttempts) { 159 + console.warn('[subtext] max reconnect attempts reached'); 160 + return; 161 + } 162 + this.reconnectAttempts += 1; 163 + const delay = this.baseReconnectDelayMs * 2 ** (this.reconnectAttempts - 1); 164 + console.log('[subtext] reconnecting in', delay, 'ms (attempt', this.reconnectAttempts, ')'); 165 + setTimeout(() => { 166 + this.connect().catch(() => { 167 + // retry loop continues on next close 168 + }); 169 + }, delay); 170 + } 171 + 172 + private async send(req: subtext_handlers.Request): Promise<subtext_handlers.Response> { 173 + await this.connect(); 174 + if (!this.socket) { 175 + throw new Error('subtext socket not connected'); 176 + } 177 + return new Promise((resolve, reject) => { 178 + const id = this.nextId++; 179 + req.id = id; 180 + console.log('[subtext] sending request', id, 'content:', Object.keys(req).filter(k => k !== 'id' && (req as any)[k])); 181 + this.pending.set(id, { resolve, reject }); 182 + 183 + // TCP-level timeout: if no response arrives in time, reject and clean up 184 + const timer = setTimeout(() => { 185 + if (this.pending.has(id)) { 186 + console.warn('[subtext] request', id, 'timed out after', TCP_TIMEOUT_MS, 'ms'); 187 + this.pending.delete(id); 188 + reject(new Error(`subtext TCP timeout after ${TCP_TIMEOUT_MS}ms`)); 189 + } 190 + }, TCP_TIMEOUT_MS); 191 + 192 + const encoded = subtext_handlers.Request.encode(req).finish(); 193 + const lenBuf = encodeVarint(encoded.length); 194 + const frame = Buffer.concat([lenBuf, Buffer.from(encoded)]); 195 + console.log('[subtext] writing frame:', frame.length, 'bytes (varint:', lenBuf.length, 'bytes, payload:', encoded.length, 'bytes)'); 196 + this.socket!.write(frame, (err) => { 197 + if (err) { 198 + console.warn('[subtext] write error:', err.message); 199 + clearTimeout(timer); 200 + this.pending.delete(id); 201 + reject(err); 202 + } 203 + }); 204 + }); 205 + } 206 + 207 + async ping(): Promise<boolean> { 208 + try { 209 + const resp = await this.send( 210 + subtext_handlers.Request.create({ ping: subtext_handlers.Ping.create() }), 211 + ); 212 + return resp.pong != null; 213 + } catch { 214 + return false; 215 + } 216 + } 217 + 218 + async getFullState(vaultPath: string): Promise<Uint8Array | null> { 219 + const resp = await this.send( 220 + subtext_handlers.Request.create({ 221 + getFullState: subtext_handlers.GetFullState.create({ vaultPath }), 222 + }), 223 + ); 224 + if (resp.error) { 225 + throw new Error(resp.error.message ?? 'subtext error'); 226 + } 227 + if (resp.bytesPayload?.data) { 228 + const data = resp.bytesPayload.data; 229 + if (Buffer.isBuffer(data)) { 230 + return new Uint8Array(data.buffer, data.byteOffset, data.byteLength); 231 + } 232 + if (typeof data === 'string') { 233 + return new TextEncoder().encode(data); 234 + } 235 + return data as Uint8Array; 236 + } 237 + return null; 238 + } 239 + 240 + async applyUpdate(vaultPath: string, update: Uint8Array): Promise<void> { 241 + const resp = await this.send( 242 + subtext_handlers.Request.create({ 243 + applyUpdateV2: subtext_handlers.ApplyUpdateV2.create({ vaultPath, update }), 244 + }), 245 + ); 246 + if (resp.error) { 247 + throw new Error(resp.error.message ?? 'subtext error'); 248 + } 249 + } 250 + 251 + async listFiles(prefix?: string): Promise<string[]> { 252 + const resp = await this.send( 253 + subtext_handlers.Request.create({ 254 + listFiles: subtext_handlers.ListFiles.create({ prefix: prefix ?? '' }), 255 + }), 256 + ); 257 + if (resp.error) { 258 + throw new Error(resp.error.message ?? 'subtext error'); 259 + } 260 + return resp.fileList?.paths ?? []; 261 + } 262 + 263 + async fileExists(vaultPath: string): Promise<boolean> { 264 + const resp = await this.send( 265 + subtext_handlers.Request.create({ 266 + fileExists: subtext_handlers.FileExists.create({ vaultPath }), 267 + }), 268 + ); 269 + if (resp.error) { 270 + throw new Error(resp.error.message ?? 'subtext error'); 271 + } 272 + return resp.fileExistsResult?.exists ?? false; 273 + } 274 + 275 + async createFile(vaultPath: string, initialState: Uint8Array): Promise<void> { 276 + const resp = await this.send( 277 + subtext_handlers.Request.create({ 278 + createFile: subtext_handlers.CreateFile.create({ vaultPath, initialState }), 279 + }), 280 + ); 281 + if (resp.error) { 282 + throw new Error(resp.error.message ?? 'subtext error'); 283 + } 284 + } 285 + 286 + async renameFile(oldVaultPath: string, newVaultPath: string): Promise<void> { 287 + const resp = await this.send( 288 + subtext_handlers.Request.create({ 289 + renameFile: subtext_handlers.RenameFile.create({ oldVaultPath, newVaultPath }), 290 + }), 291 + ); 292 + if (resp.error) { 293 + throw new Error(resp.error.message ?? 'subtext error'); 294 + } 295 + } 296 + }
+56
src/subtext/testClient.ts
··· 1 + /** 2 + * Standalone test for the Subtext TCP client. 3 + * 4 + * Run this directly with Node.js while the subtext daemon is running: 5 + * 6 + * npx tsx src/subtext/testClient.ts 7 + * 8 + * Or compile first: 9 + * 10 + * npx tsc src/subtext/testClient.ts --outDir /tmp/subtext-test --module commonjs 11 + * node /tmp/subtext-test/testClient.js 12 + */ 13 + 14 + import { SubtextTCPClient } from './tcpClient'; 15 + 16 + async function main() { 17 + const client = new SubtextTCPClient(); 18 + 19 + console.log('--- ping ---'); 20 + const pong = await client.ping(); 21 + console.log('ping result:', pong); 22 + 23 + console.log('\n--- listFiles ---'); 24 + const files = await client.listFiles(); 25 + console.log('files:', files); 26 + 27 + console.log('\n--- createFile ---'); 28 + const testPath = 'test.md'; 29 + const initialState = new Uint8Array([0, 0, 0, 0, 1]); // minimal empty doc envelope 30 + try { 31 + await client.createFile(testPath, initialState); 32 + console.log('created', testPath); 33 + } catch (e) { 34 + console.error('create failed:', e); 35 + } 36 + 37 + console.log('\n--- fileExists ---'); 38 + const exists = await client.fileExists(testPath); 39 + console.log(testPath, 'exists:', exists); 40 + 41 + console.log('\n--- getFullState ---'); 42 + const state = await client.getFullState(testPath); 43 + console.log(testPath, 'state length:', state?.length ?? null); 44 + 45 + console.log('\n--- listFiles again ---'); 46 + const files2 = await client.listFiles(); 47 + console.log('files:', files2); 48 + 49 + client.disconnect(); 50 + console.log('\nDone.'); 51 + } 52 + 53 + main().catch((e) => { 54 + console.error('Fatal:', e); 55 + process.exit(1); 56 + });
+178
src/documents/providers/subtextDocumentsProvider.ts
··· 1 + import * as Y from 'yjs'; 2 + 3 + import { createYjsBinding } from '../../editors/yjs/yjsEditorBinding'; 4 + import { getHeadingFromYdoc } from '../../habitat/habitatDoc'; 5 + import type { DocumentHandle, DocumentProvider } from '../types'; 6 + import { 7 + seedYdocFromSubtext, 8 + pushUpdateToSubtext, 9 + createFileInSubtext, 10 + renameFileInSubtext, 11 + listCachedVaults, 12 + } from '../../subtext/cache'; 13 + import { 14 + allocateId, 15 + getPath, 16 + updatePath, 17 + emitSubtextTitle, 18 + } from '../../subtext/index'; 19 + 20 + /** Sanitize a heading string for use as a filename. */ 21 + function sanitizeFilename(name: string): string { 22 + return name 23 + .trim() 24 + .replace(/[/\\?%*:|"<>]/g, '-') 25 + .replace(/\s+/g, ' ') 26 + .slice(0, 100); 27 + } 28 + 29 + function makeVaultPath(name: string): string { 30 + const safe = sanitizeFilename(name); 31 + return `local/${safe}.md`; 32 + } 33 + 34 + /** Find a non-conflicting vault path, appending (2), (3), etc. when needed. */ 35 + async function findUniqueVaultPath( 36 + desiredName: string, 37 + excludePath?: string, 38 + ): Promise<string> { 39 + const basePath = makeVaultPath(desiredName); 40 + const existing = new Set(await listCachedVaults()); 41 + if (!existing.has(basePath) || basePath === excludePath) { 42 + return basePath; 43 + } 44 + let n = 2; 45 + while (true) { 46 + const candidate = `local/${sanitizeFilename(desiredName)} (${n}).md`; 47 + if (!existing.has(candidate) || candidate === excludePath) { 48 + return candidate; 49 + } 50 + n += 1; 51 + if (n > 999) break; 52 + } 53 + return `local/${Date.now()}.md`; 54 + } 55 + 56 + /** 57 + * Document provider for Subtext local vaults. 58 + * 59 + * - Files have stable opaque IDs (survive renames). 60 + * - New files default to "Unknown" display name. 61 + * - When a heading is added/changed, the file auto-renames on disk after a 62 + * debounce and the sidebar title is patched live via subscribeEntryTitles. 63 + */ 64 + export class SubtextDocumentsProvider implements DocumentProvider { 65 + readonly id = 'subtext'; 66 + 67 + async openDocument(entryId: string): Promise<DocumentHandle> { 68 + const vaultPath = getPath(entryId); 69 + if (!vaultPath) { 70 + throw new Error(`Unknown subtext document: ${entryId}`); 71 + } 72 + return this.openLocalDocument(entryId, vaultPath); 73 + } 74 + 75 + private async openLocalDocument( 76 + id: string, 77 + vaultPath: string, 78 + ): Promise<DocumentHandle> { 79 + const ydoc = new Y.Doc(); 80 + 81 + // Try to seed from an existing subtext vault; if absent we start empty. 82 + await seedYdocFromSubtext(vaultPath, ydoc); 83 + 84 + let currentVaultPath = vaultPath; 85 + let released = false; 86 + let renameTimer: ReturnType<typeof setTimeout> | null = null; 87 + 88 + const getDisplayTitle = (): string => { 89 + const heading = getHeadingFromYdoc(ydoc)?.trim(); 90 + if (heading) return heading; 91 + // Derive fallback from the filename (e.g. "Untitled" from "local/Untitled.md") 92 + const filename = currentVaultPath.split('/').pop() ?? currentVaultPath; 93 + return filename.replace(/\.md$/, ''); 94 + }; 95 + 96 + const saveHandler = (_update: Uint8Array, _origin: unknown) => { 97 + const update = Y.encodeStateAsUpdateV2(ydoc); 98 + void pushUpdateToSubtext(currentVaultPath, update); 99 + }; 100 + ydoc.on('updateV2', saveHandler); 101 + 102 + // Auto-rename: when the user edits the first heading, we rename the vault 103 + // file on disk to match. This is debounced (1.5 s trailing edge) so rapid 104 + // keystrokes don't trigger many renames. The rename itself is async and 105 + // fire-and-forget (`void tryRename()`); failures are logged, not thrown. 106 + const tryRename = async () => { 107 + if (released) return; 108 + const heading = getHeadingFromYdoc(ydoc)?.trim(); 109 + if (!heading) return; 110 + 111 + const desiredPath = await findUniqueVaultPath(heading, currentVaultPath); 112 + if (desiredPath === currentVaultPath) return; 113 + 114 + try { 115 + await renameFileInSubtext(currentVaultPath, desiredPath); 116 + updatePath(id, desiredPath); 117 + currentVaultPath = desiredPath; 118 + emitSubtextTitle(id, getDisplayTitle()); 119 + } catch (e) { 120 + console.warn('[subtext] auto-rename failed:', e); 121 + } 122 + }; 123 + 124 + const scheduleRename = () => { 125 + if (renameTimer) clearTimeout(renameTimer); 126 + renameTimer = setTimeout(() => { 127 + renameTimer = null; 128 + void tryRename(); 129 + }, 1500); 130 + }; 131 + 132 + const titleWatcher = () => { 133 + const heading = getHeadingFromYdoc(ydoc)?.trim(); 134 + const nextTitle = heading ?? 'Unknown'; 135 + emitSubtextTitle(id, nextTitle); 136 + if (heading && makeVaultPath(heading) !== currentVaultPath) { 137 + scheduleRename(); 138 + } 139 + }; 140 + ydoc.on('update', titleWatcher); 141 + // Emit initial title so the sidebar shows it immediately. 142 + emitSubtextTitle(id, getDisplayTitle()); 143 + 144 + return { 145 + id, 146 + loadPromise: Promise.resolve(), 147 + getTitle: getDisplayTitle, 148 + subscribeTitle(listener: () => void) { 149 + ydoc.on('update', listener); 150 + return () => ydoc.off('update', listener); 151 + }, 152 + release() { 153 + if (released) return; 154 + released = true; 155 + if (renameTimer) clearTimeout(renameTimer); 156 + ydoc.off('updateV2', saveHandler); 157 + ydoc.off('update', titleWatcher); 158 + ydoc.destroy(); 159 + }, 160 + getEditorBinding: () => createYjsBinding({ ydoc, collabProvider: null }), 161 + }; 162 + } 163 + 164 + async createDocument(options?: { id?: string }): Promise<DocumentHandle> { 165 + const vaultPath = options?.id ?? (await findUniqueVaultPath('Untitled')); 166 + const id = allocateId(vaultPath); 167 + 168 + const ydoc = new Y.Doc(); 169 + const initialState = Y.encodeStateAsUpdateV2(ydoc); 170 + try { 171 + await createFileInSubtext(vaultPath, initialState); 172 + } catch (e) { 173 + console.warn('[subtext] failed to create local file in daemon:', e); 174 + } 175 + 176 + return this.openLocalDocument(id, vaultPath); 177 + } 178 + }
+59
src/filesystem/providers/subtextFilesystemProvider.ts
··· 1 + import type { DocumentProvider } from '../../documents/types'; 2 + import type { EditorKind } from '../../editors/types'; 3 + import { listCachedVaults } from '../../subtext/cache'; 4 + import { scanPaths, subscribeSubtextTitleChanges } from '../../subtext/index'; 5 + import type { FileSystemEntry, FileSystemProvider } from '../types'; 6 + 7 + export type SubtextFilesystemProviderOptions = { 8 + documents: DocumentProvider; 9 + defaultEditorKind?: EditorKind; 10 + }; 11 + 12 + /** 13 + * FileSystemProvider for Subtext local vaults. 14 + * 15 + * Uses stable IDs so sidebar selection survives renames. Listing scans the 16 + * daemon store and reconciles paths with a persistent registry. 17 + */ 18 + export class SubtextFilesystemProvider implements FileSystemProvider { 19 + readonly id = 'subtext'; 20 + readonly displayName = 'Subtext'; 21 + readonly idleHint = 'Subtext daemon not reachable. Ensure it is running on 127.0.0.1:8081.'; 22 + readonly documents: DocumentProvider; 23 + readonly defaultEditorKind: EditorKind; 24 + 25 + constructor(options: SubtextFilesystemProviderOptions) { 26 + this.documents = options.documents; 27 + this.defaultEditorKind = options.defaultEditorKind ?? 'yjs'; 28 + } 29 + 30 + isReady(): boolean { 31 + return true; 32 + } 33 + 34 + subscribeReady(_listener: () => void): () => void { 35 + return () => {}; 36 + } 37 + 38 + async listFiles(): Promise<FileSystemEntry[]> { 39 + const paths = await listCachedVaults(); 40 + console.log('[subtext] daemon listed', paths.length, 'files'); 41 + const entries = scanPaths(paths); 42 + console.log('[subtext] registry has', entries.length, 'entries'); 43 + return entries.map(({ id, path }) => ({ 44 + id, 45 + name: (path.split('/').pop() ?? path).replace(/\.md$/, ''), 46 + })); 47 + } 48 + 49 + subscribeEntryTitles( 50 + listener: (entryId: string, name: string) => void, 51 + ): () => void { 52 + return subscribeSubtextTitleChanges(listener); 53 + } 54 + 55 + async createFile(): Promise<FileSystemEntry> { 56 + const handle = await this.documents.createDocument(); 57 + return { id: handle.id, name: handle.getTitle() }; 58 + } 59 + }