From 32850eb0457c76c993377ec0990040b869639135 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Fri, 10 Feb 2023 16:40:03 +1100 Subject: [PATCH] chore!: bump protons from 5.1.0 to 7.0.2 Notable change: optionality of singular fields and optional values. See https://github.com/ipfs/protons/releases --- package-lock.json | 388 ++++++++----------- packages/proto/package.json | 2 +- packages/proto/src/lib/filter.ts | 233 ++++------- packages/proto/src/lib/light_push.ts | 213 ++++------ packages/proto/src/lib/message.ts | 161 +++----- packages/proto/src/lib/peer_exchange.ts | 61 ++- packages/proto/src/lib/store.ts | 297 ++++++-------- packages/proto/src/lib/topic_only_message.ts | 17 +- 8 files changed, 519 insertions(+), 853 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7d8264b929..b81f02360f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22543,12 +22543,12 @@ } }, "node_modules/protons": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/protons/-/protons-5.1.0.tgz", - "integrity": "sha512-U6FldjrEEIVF4ujIN5VrzAUkGKbYhYUGixy1SxlL38t85EXSnlYIvaHZHmvEdi4WTWyskQVD/zlgQdkRqkU/5Q==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/protons/-/protons-7.0.2.tgz", + "integrity": "sha512-6hecUJH2qR0KRYo3qPdQGvtgIrxrvWteIMYclaSx2qM4mteLfUl8V7NU0BI1FA6JRabPpR14Nd/nJZB1q6zKkw==", "dev": true, "dependencies": { - "meow": "^10.1.2", + "meow": "^11.0.0", "protobufjs-cli": "^1.0.0" }, "bin": { @@ -22612,31 +22612,55 @@ "balanced-match": "^1.0.0" } }, + "node_modules/protons/node_modules/camelcase": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-7.0.1.tgz", + "integrity": "sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/protons/node_modules/camelcase-keys": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-7.0.2.tgz", - "integrity": "sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-8.0.2.tgz", + "integrity": "sha512-qMKdlOfsjlezMqxkUGGMaWWs17i2HoL15tM+wtx8ld4nLrUwU58TFdvyGOz/piNP842KeO8yXvggVQSdQ828NA==", "dev": true, "dependencies": { - "camelcase": "^6.3.0", - "map-obj": "^4.1.0", - "quick-lru": "^5.1.1", - "type-fest": "^1.2.1" + "camelcase": "^7.0.0", + "map-obj": "^4.3.0", + "quick-lru": "^6.1.1", + "type-fest": "^2.13.0" }, "engines": { - "node": ">=12" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/protons/node_modules/camelcase-keys/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "dev": true, + "engines": { + "node": ">=12.20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/protons/node_modules/decamelize": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-5.0.1.tgz", - "integrity": "sha512-VfxadyCECXgQlkoEAjeghAr5gY3Hf+IKjKb+X8tGVDtveCjN+USwprd2q3QXBR9T1+x2DG0XZF5/w+7HAtSaXA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", "dev": true, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -22664,22 +22688,6 @@ "source-map": "~0.6.1" } }, - "node_modules/protons/node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/protons/node_modules/glob": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", @@ -22699,6 +22707,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/protons/node_modules/hosted-git-info": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-5.2.1.tgz", + "integrity": "sha512-xIcQYMnhcx2Nr4JTjsFmwwnr9vldugPy9uVm0o87bjqqWMv9GaqsTeT+i99wTl0mk1uLxJtHxLb8kymqTENQsw==", + "dev": true, + "dependencies": { + "lru-cache": "^7.5.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/protons/node_modules/indent-string": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", @@ -22724,21 +22744,6 @@ "node": ">= 0.8.0" } }, - "node_modules/protons/node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/protons/node_modules/long": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/long/-/long-5.2.1.tgz", @@ -22746,27 +22751,36 @@ "dev": true, "peer": true }, + "node_modules/protons/node_modules/lru-cache": { + "version": "7.14.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz", + "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/protons/node_modules/meow": { - "version": "10.1.5", - "resolved": "https://registry.npmjs.org/meow/-/meow-10.1.5.tgz", - "integrity": "sha512-/d+PQ4GKmGvM9Bee/DPa8z3mXs/pkvJE2KEThngVNOqtmljC6K7NMPxtc2JeZYTmpWb9k/TmxjeL18ez3h7vCw==", + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-11.0.0.tgz", + "integrity": "sha512-Cl0yeeIrko6d94KpUo1M+0X1sB14ikoaqlIGuTH1fW4I+E3+YljL54/hb/BWmVfrV9tTV9zU04+xjw08Fh2WkA==", "dev": true, "dependencies": { "@types/minimist": "^1.2.2", - "camelcase-keys": "^7.0.0", - "decamelize": "^5.0.0", + "camelcase-keys": "^8.0.2", + "decamelize": "^6.0.0", "decamelize-keys": "^1.1.0", "hard-rejection": "^2.1.0", "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.2", - "read-pkg-up": "^8.0.0", + "normalize-package-data": "^4.0.1", + "read-pkg-up": "^9.1.0", "redent": "^4.0.0", "trim-newlines": "^4.0.2", - "type-fest": "^1.2.2", - "yargs-parser": "^20.2.9" + "type-fest": "^3.1.0", + "yargs-parser": "^21.1.1" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -22784,6 +22798,21 @@ "node": ">=10" } }, + "node_modules/protons/node_modules/normalize-package-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-4.0.1.tgz", + "integrity": "sha512-EBk5QKKuocMJhB3BILuKhmaPjI8vNRSpIfO9woLC6NyHVkKKdVEdAO1mrT0ZfxNR1lKwCcTkuZfmGIFdizZ8Pg==", + "dev": true, + "dependencies": { + "hosted-git-info": "^5.0.0", + "is-core-module": "^2.8.1", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/protons/node_modules/optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -22801,36 +22830,6 @@ "node": ">= 0.8.0" } }, - "node_modules/protons/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/protons/node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/protons/node_modules/prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -22902,34 +22901,11 @@ "node": ">=4.0" } }, - "node_modules/protons/node_modules/read-pkg": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-6.0.0.tgz", - "integrity": "sha512-X1Fu3dPuk/8ZLsMhEj5f4wFAF0DWoK7qhGJvgaijocXxBmSToKfbFtqbxMO7bVjNA1dmE5huAzjXj/ey86iw9Q==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^1.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/protons/node_modules/read-pkg-up": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-8.0.0.tgz", - "integrity": "sha512-snVCqPczksT0HS2EC+SxUndvSzn6LRCwpfSvLrIfR5BKDQQZMaI6jPRC9dYvYFDRAuFEAnkwww8kBBNE/3VvzQ==", + "node_modules/protons/node_modules/quick-lru": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-6.1.1.tgz", + "integrity": "sha512-S27GBT+F0NTRiehtbrgaSE1idUAJ5bX8dPAQTdylEyNlrdcH5X4Lz7Edz3DYzecbsCluD5zO8ZNEe04z3D3u6Q==", "dev": true, - "dependencies": { - "find-up": "^5.0.0", - "read-pkg": "^6.0.0", - "type-fest": "^1.0.1" - }, "engines": { "node": ">=12" }, @@ -22993,26 +22969,17 @@ } }, "node_modules/protons/node_modules/type-fest": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", - "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "version": "3.5.7", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.5.7.tgz", + "integrity": "sha512-6J4bYzb4sdkcLBty4XW7F18VPI66M4boXNE+CY40532oq2OJe6AVMB5NmjOp6skt/jw5mRjz/hLRpuglz0U+FA==", "dev": true, "engines": { - "node": ">=10" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/protons/node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -29289,7 +29256,7 @@ "eslint-plugin-prettier": "^4.2.1", "npm-run-all": "^4.1.5", "prettier": "^2.8.4", - "protons": "^5.1.0", + "protons": "^7.0.2", "rollup": "^3.14.0", "typescript": "^4.9.5", "uint8arraylist": "^2.4.3" @@ -34776,7 +34743,7 @@ "eslint-plugin-prettier": "^4.2.1", "npm-run-all": "^4.1.5", "prettier": "^2.8.4", - "protons": "^5.1.0", + "protons": "^7.0.2", "protons-runtime": "^5.0.0", "rollup": "^3.14.0", "typescript": "^4.9.5", @@ -47382,12 +47349,12 @@ } }, "protons": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/protons/-/protons-5.1.0.tgz", - "integrity": "sha512-U6FldjrEEIVF4ujIN5VrzAUkGKbYhYUGixy1SxlL38t85EXSnlYIvaHZHmvEdi4WTWyskQVD/zlgQdkRqkU/5Q==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/protons/-/protons-7.0.2.tgz", + "integrity": "sha512-6hecUJH2qR0KRYo3qPdQGvtgIrxrvWteIMYclaSx2qM4mteLfUl8V7NU0BI1FA6JRabPpR14Nd/nJZB1q6zKkw==", "dev": true, "requires": { - "meow": "^10.1.2", + "meow": "^11.0.0", "protobufjs-cli": "^1.0.0" }, "dependencies": { @@ -47400,22 +47367,36 @@ "balanced-match": "^1.0.0" } }, + "camelcase": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-7.0.1.tgz", + "integrity": "sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==", + "dev": true + }, "camelcase-keys": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-7.0.2.tgz", - "integrity": "sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-8.0.2.tgz", + "integrity": "sha512-qMKdlOfsjlezMqxkUGGMaWWs17i2HoL15tM+wtx8ld4nLrUwU58TFdvyGOz/piNP842KeO8yXvggVQSdQ828NA==", "dev": true, "requires": { - "camelcase": "^6.3.0", - "map-obj": "^4.1.0", - "quick-lru": "^5.1.1", - "type-fest": "^1.2.1" + "camelcase": "^7.0.0", + "map-obj": "^4.3.0", + "quick-lru": "^6.1.1", + "type-fest": "^2.13.0" + }, + "dependencies": { + "type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "dev": true + } } }, "decamelize": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-5.0.1.tgz", - "integrity": "sha512-VfxadyCECXgQlkoEAjeghAr5gY3Hf+IKjKb+X8tGVDtveCjN+USwprd2q3QXBR9T1+x2DG0XZF5/w+7HAtSaXA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", "dev": true }, "escodegen": { @@ -47431,16 +47412,6 @@ "source-map": "~0.6.1" } }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, "glob": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", @@ -47454,6 +47425,15 @@ "once": "^1.3.0" } }, + "hosted-git-info": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-5.2.1.tgz", + "integrity": "sha512-xIcQYMnhcx2Nr4JTjsFmwwnr9vldugPy9uVm0o87bjqqWMv9GaqsTeT+i99wTl0mk1uLxJtHxLb8kymqTENQsw==", + "dev": true, + "requires": { + "lru-cache": "^7.5.1" + } + }, "indent-string": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", @@ -47470,15 +47450,6 @@ "type-check": "~0.3.2" } }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, "long": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/long/-/long-5.2.1.tgz", @@ -47486,24 +47457,30 @@ "dev": true, "peer": true }, + "lru-cache": { + "version": "7.14.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz", + "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==", + "dev": true + }, "meow": { - "version": "10.1.5", - "resolved": "https://registry.npmjs.org/meow/-/meow-10.1.5.tgz", - "integrity": "sha512-/d+PQ4GKmGvM9Bee/DPa8z3mXs/pkvJE2KEThngVNOqtmljC6K7NMPxtc2JeZYTmpWb9k/TmxjeL18ez3h7vCw==", + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-11.0.0.tgz", + "integrity": "sha512-Cl0yeeIrko6d94KpUo1M+0X1sB14ikoaqlIGuTH1fW4I+E3+YljL54/hb/BWmVfrV9tTV9zU04+xjw08Fh2WkA==", "dev": true, "requires": { "@types/minimist": "^1.2.2", - "camelcase-keys": "^7.0.0", - "decamelize": "^5.0.0", + "camelcase-keys": "^8.0.2", + "decamelize": "^6.0.0", "decamelize-keys": "^1.1.0", "hard-rejection": "^2.1.0", "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.2", - "read-pkg-up": "^8.0.0", + "normalize-package-data": "^4.0.1", + "read-pkg-up": "^9.1.0", "redent": "^4.0.0", "trim-newlines": "^4.0.2", - "type-fest": "^1.2.2", - "yargs-parser": "^20.2.9" + "type-fest": "^3.1.0", + "yargs-parser": "^21.1.1" } }, "minimatch": { @@ -47515,6 +47492,18 @@ "brace-expansion": "^2.0.1" } }, + "normalize-package-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-4.0.1.tgz", + "integrity": "sha512-EBk5QKKuocMJhB3BILuKhmaPjI8vNRSpIfO9woLC6NyHVkKKdVEdAO1mrT0ZfxNR1lKwCcTkuZfmGIFdizZ8Pg==", + "dev": true, + "requires": { + "hosted-git-info": "^5.0.0", + "is-core-module": "^2.8.1", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + } + }, "optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -47529,24 +47518,6 @@ "word-wrap": "~1.2.3" } }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -47600,28 +47571,11 @@ } } }, - "read-pkg": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-6.0.0.tgz", - "integrity": "sha512-X1Fu3dPuk/8ZLsMhEj5f4wFAF0DWoK7qhGJvgaijocXxBmSToKfbFtqbxMO7bVjNA1dmE5huAzjXj/ey86iw9Q==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^1.0.1" - } - }, - "read-pkg-up": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-8.0.0.tgz", - "integrity": "sha512-snVCqPczksT0HS2EC+SxUndvSzn6LRCwpfSvLrIfR5BKDQQZMaI6jPRC9dYvYFDRAuFEAnkwww8kBBNE/3VvzQ==", - "dev": true, - "requires": { - "find-up": "^5.0.0", - "read-pkg": "^6.0.0", - "type-fest": "^1.0.1" - } + "quick-lru": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-6.1.1.tgz", + "integrity": "sha512-S27GBT+F0NTRiehtbrgaSE1idUAJ5bX8dPAQTdylEyNlrdcH5X4Lz7Edz3DYzecbsCluD5zO8ZNEe04z3D3u6Q==", + "dev": true }, "redent": { "version": "4.0.0", @@ -47658,15 +47612,9 @@ } }, "type-fest": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", - "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", - "dev": true - }, - "yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "version": "3.5.7", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.5.7.tgz", + "integrity": "sha512-6J4bYzb4sdkcLBty4XW7F18VPI66M4boXNE+CY40532oq2OJe6AVMB5NmjOp6skt/jw5mRjz/hLRpuglz0U+FA==", "dev": true } } diff --git a/packages/proto/package.json b/packages/proto/package.json index f5688241aa..0ece6395b6 100644 --- a/packages/proto/package.json +++ b/packages/proto/package.json @@ -64,7 +64,7 @@ "eslint-plugin-prettier": "^4.2.1", "npm-run-all": "^4.1.5", "prettier": "^2.8.4", - "protons": "^5.1.0", + "protons": "^7.0.2", "rollup": "^3.14.0", "typescript": "^4.9.5", "uint8arraylist": "^2.4.3" diff --git a/packages/proto/src/lib/filter.ts b/packages/proto/src/lib/filter.ts index 87b2f95cc3..648ff5e629 100644 --- a/packages/proto/src/lib/filter.ts +++ b/packages/proto/src/lib/filter.ts @@ -1,9 +1,12 @@ /* eslint-disable import/export */ +/* eslint-disable complexity */ /* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ +/* eslint-disable @typescript-eslint/no-empty-interface */ import { encodeMessage, decodeMessage, message } from "protons-runtime"; -import type { Uint8ArrayList } from "uint8arraylist"; import type { Codec } from "protons-runtime"; +import type { Uint8ArrayList } from "uint8arraylist"; export interface FilterRequest { subscribe?: boolean; @@ -22,18 +25,18 @@ export namespace FilterRequest { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.contentTopic != null) { - writer.uint32(10); - writer.string(obj.contentTopic); + w.uint32(10); + w.string(obj.contentTopic); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -62,7 +65,7 @@ export namespace FilterRequest { return _codec; }; - export const encode = (obj: ContentFilter): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, ContentFilter.codec()); }; @@ -76,34 +79,30 @@ export namespace FilterRequest { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.subscribe != null) { - writer.uint32(8); - writer.bool(obj.subscribe); + w.uint32(8); + w.bool(obj.subscribe); } if (obj.topic != null) { - writer.uint32(18); - writer.string(obj.topic); + w.uint32(18); + w.string(obj.topic); } if (obj.contentFilters != null) { for (const value of obj.contentFilters) { - writer.uint32(26); - FilterRequest.ContentFilter.codec().encode(value, writer); + w.uint32(26); + FilterRequest.ContentFilter.codec().encode(value, w); } - } else { - throw new Error( - 'Protocol error: required field "contentFilters" was not found in object' - ); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -145,7 +144,7 @@ export namespace FilterRequest { return _codec; }; - export const encode = (obj: FilterRequest): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, FilterRequest.codec()); }; @@ -164,24 +163,20 @@ export namespace MessagePush { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.messages != null) { for (const value of obj.messages) { - writer.uint32(10); - WakuMessage.codec().encode(value, writer); + w.uint32(10); + WakuMessage.codec().encode(value, w); } - } else { - throw new Error( - 'Protocol error: required field "messages" was not found in object' - ); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -214,7 +209,7 @@ export namespace MessagePush { return _codec; }; - export const encode = (obj: MessagePush): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, MessagePush.codec()); }; @@ -235,28 +230,28 @@ export namespace FilterRPC { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.requestId != null) { - writer.uint32(10); - writer.string(obj.requestId); + w.uint32(10); + w.string(obj.requestId); } if (obj.request != null) { - writer.uint32(18); - FilterRequest.codec().encode(obj.request, writer); + w.uint32(18); + FilterRequest.codec().encode(obj.request, w); } if (obj.push != null) { - writer.uint32(26); - MessagePush.codec().encode(obj.push, writer); + w.uint32(26); + MessagePush.codec().encode(obj.push, w); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -294,7 +289,7 @@ export namespace FilterRPC { return _codec; }; - export const encode = (obj: FilterRPC): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, FilterRPC.codec()); }; @@ -319,76 +314,48 @@ export namespace RateLimitProof { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } - if (obj.proof != null) { - writer.uint32(10); - writer.bytes(obj.proof); - } else { - throw new Error( - 'Protocol error: required field "proof" was not found in object' - ); + if (obj.proof != null && obj.proof.byteLength > 0) { + w.uint32(10); + w.bytes(obj.proof); } - if (obj.merkleRoot != null) { - writer.uint32(18); - writer.bytes(obj.merkleRoot); - } else { - throw new Error( - 'Protocol error: required field "merkleRoot" was not found in object' - ); + if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) { + w.uint32(18); + w.bytes(obj.merkleRoot); } - if (obj.epoch != null) { - writer.uint32(26); - writer.bytes(obj.epoch); - } else { - throw new Error( - 'Protocol error: required field "epoch" was not found in object' - ); + if (obj.epoch != null && obj.epoch.byteLength > 0) { + w.uint32(26); + w.bytes(obj.epoch); } - if (obj.shareX != null) { - writer.uint32(34); - writer.bytes(obj.shareX); - } else { - throw new Error( - 'Protocol error: required field "shareX" was not found in object' - ); + if (obj.shareX != null && obj.shareX.byteLength > 0) { + w.uint32(34); + w.bytes(obj.shareX); } - if (obj.shareY != null) { - writer.uint32(42); - writer.bytes(obj.shareY); - } else { - throw new Error( - 'Protocol error: required field "shareY" was not found in object' - ); + if (obj.shareY != null && obj.shareY.byteLength > 0) { + w.uint32(42); + w.bytes(obj.shareY); } - if (obj.nullifier != null) { - writer.uint32(50); - writer.bytes(obj.nullifier); - } else { - throw new Error( - 'Protocol error: required field "nullifier" was not found in object' - ); + if (obj.nullifier != null && obj.nullifier.byteLength > 0) { + w.uint32(50); + w.bytes(obj.nullifier); } - if (obj.rlnIdentifier != null) { - writer.uint32(58); - writer.bytes(obj.rlnIdentifier); - } else { - throw new Error( - 'Protocol error: required field "rlnIdentifier" was not found in object' - ); + if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) { + w.uint32(58); + w.bytes(obj.rlnIdentifier); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -435,48 +402,6 @@ export namespace RateLimitProof { } } - if (obj.proof == null) { - throw new Error( - 'Protocol error: value for required field "proof" was not found in protobuf' - ); - } - - if (obj.merkleRoot == null) { - throw new Error( - 'Protocol error: value for required field "merkleRoot" was not found in protobuf' - ); - } - - if (obj.epoch == null) { - throw new Error( - 'Protocol error: value for required field "epoch" was not found in protobuf' - ); - } - - if (obj.shareX == null) { - throw new Error( - 'Protocol error: value for required field "shareX" was not found in protobuf' - ); - } - - if (obj.shareY == null) { - throw new Error( - 'Protocol error: value for required field "shareY" was not found in protobuf' - ); - } - - if (obj.nullifier == null) { - throw new Error( - 'Protocol error: value for required field "nullifier" was not found in protobuf' - ); - } - - if (obj.rlnIdentifier == null) { - throw new Error( - 'Protocol error: value for required field "rlnIdentifier" was not found in protobuf' - ); - } - return obj; } ); @@ -485,7 +410,7 @@ export namespace RateLimitProof { return _codec; }; - export const encode = (obj: RateLimitProof): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, RateLimitProof.codec()); }; @@ -510,48 +435,48 @@ export namespace WakuMessage { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.payload != null) { - writer.uint32(10); - writer.bytes(obj.payload); + w.uint32(10); + w.bytes(obj.payload); } if (obj.contentTopic != null) { - writer.uint32(18); - writer.string(obj.contentTopic); + w.uint32(18); + w.string(obj.contentTopic); } if (obj.version != null) { - writer.uint32(24); - writer.uint32(obj.version); + w.uint32(24); + w.uint32(obj.version); } if (obj.timestampDeprecated != null) { - writer.uint32(33); - writer.double(obj.timestampDeprecated); + w.uint32(33); + w.double(obj.timestampDeprecated); } if (obj.timestamp != null) { - writer.uint32(80); - writer.sint64(obj.timestamp); + w.uint32(80); + w.sint64(obj.timestamp); } if (obj.rateLimitProof != null) { - writer.uint32(170); - RateLimitProof.codec().encode(obj.rateLimitProof, writer); + w.uint32(170); + RateLimitProof.codec().encode(obj.rateLimitProof, w); } if (obj.ephemeral != null) { - writer.uint32(248); - writer.bool(obj.ephemeral); + w.uint32(248); + w.bool(obj.ephemeral); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -601,7 +526,7 @@ export namespace WakuMessage { return _codec; }; - export const encode = (obj: WakuMessage): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, WakuMessage.codec()); }; diff --git a/packages/proto/src/lib/light_push.ts b/packages/proto/src/lib/light_push.ts index bb34340e81..95f61ffbeb 100644 --- a/packages/proto/src/lib/light_push.ts +++ b/packages/proto/src/lib/light_push.ts @@ -1,9 +1,12 @@ /* eslint-disable import/export */ +/* eslint-disable complexity */ /* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ +/* eslint-disable @typescript-eslint/no-empty-interface */ import { encodeMessage, decodeMessage, message } from "protons-runtime"; -import type { Uint8ArrayList } from "uint8arraylist"; import type { Codec } from "protons-runtime"; +import type { Uint8ArrayList } from "uint8arraylist"; export interface PushRequest { pubSubTopic?: string; @@ -16,23 +19,23 @@ export namespace PushRequest { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.pubSubTopic != null) { - writer.uint32(10); - writer.string(obj.pubSubTopic); + w.uint32(10); + w.string(obj.pubSubTopic); } if (obj.message != null) { - writer.uint32(18); - WakuMessage.codec().encode(obj.message, writer); + w.uint32(18); + WakuMessage.codec().encode(obj.message, w); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -67,7 +70,7 @@ export namespace PushRequest { return _codec; }; - export const encode = (obj: PushRequest): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, PushRequest.codec()); }; @@ -87,23 +90,23 @@ export namespace PushResponse { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.isSuccess != null) { - writer.uint32(8); - writer.bool(obj.isSuccess); + w.uint32(8); + w.bool(obj.isSuccess); } if (obj.info != null) { - writer.uint32(18); - writer.string(obj.info); + w.uint32(18); + w.string(obj.info); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -135,7 +138,7 @@ export namespace PushResponse { return _codec; }; - export const encode = (obj: PushResponse): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, PushResponse.codec()); }; @@ -156,28 +159,28 @@ export namespace PushRPC { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.requestId != null) { - writer.uint32(10); - writer.string(obj.requestId); + w.uint32(10); + w.string(obj.requestId); } if (obj.request != null) { - writer.uint32(18); - PushRequest.codec().encode(obj.request, writer); + w.uint32(18); + PushRequest.codec().encode(obj.request, w); } if (obj.response != null) { - writer.uint32(26); - PushResponse.codec().encode(obj.response, writer); + w.uint32(26); + PushResponse.codec().encode(obj.response, w); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -218,7 +221,7 @@ export namespace PushRPC { return _codec; }; - export const encode = (obj: PushRPC): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, PushRPC.codec()); }; @@ -243,76 +246,48 @@ export namespace RateLimitProof { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } - if (obj.proof != null) { - writer.uint32(10); - writer.bytes(obj.proof); - } else { - throw new Error( - 'Protocol error: required field "proof" was not found in object' - ); + if (obj.proof != null && obj.proof.byteLength > 0) { + w.uint32(10); + w.bytes(obj.proof); } - if (obj.merkleRoot != null) { - writer.uint32(18); - writer.bytes(obj.merkleRoot); - } else { - throw new Error( - 'Protocol error: required field "merkleRoot" was not found in object' - ); + if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) { + w.uint32(18); + w.bytes(obj.merkleRoot); } - if (obj.epoch != null) { - writer.uint32(26); - writer.bytes(obj.epoch); - } else { - throw new Error( - 'Protocol error: required field "epoch" was not found in object' - ); + if (obj.epoch != null && obj.epoch.byteLength > 0) { + w.uint32(26); + w.bytes(obj.epoch); } - if (obj.shareX != null) { - writer.uint32(34); - writer.bytes(obj.shareX); - } else { - throw new Error( - 'Protocol error: required field "shareX" was not found in object' - ); + if (obj.shareX != null && obj.shareX.byteLength > 0) { + w.uint32(34); + w.bytes(obj.shareX); } - if (obj.shareY != null) { - writer.uint32(42); - writer.bytes(obj.shareY); - } else { - throw new Error( - 'Protocol error: required field "shareY" was not found in object' - ); + if (obj.shareY != null && obj.shareY.byteLength > 0) { + w.uint32(42); + w.bytes(obj.shareY); } - if (obj.nullifier != null) { - writer.uint32(50); - writer.bytes(obj.nullifier); - } else { - throw new Error( - 'Protocol error: required field "nullifier" was not found in object' - ); + if (obj.nullifier != null && obj.nullifier.byteLength > 0) { + w.uint32(50); + w.bytes(obj.nullifier); } - if (obj.rlnIdentifier != null) { - writer.uint32(58); - writer.bytes(obj.rlnIdentifier); - } else { - throw new Error( - 'Protocol error: required field "rlnIdentifier" was not found in object' - ); + if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) { + w.uint32(58); + w.bytes(obj.rlnIdentifier); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -359,48 +334,6 @@ export namespace RateLimitProof { } } - if (obj.proof == null) { - throw new Error( - 'Protocol error: value for required field "proof" was not found in protobuf' - ); - } - - if (obj.merkleRoot == null) { - throw new Error( - 'Protocol error: value for required field "merkleRoot" was not found in protobuf' - ); - } - - if (obj.epoch == null) { - throw new Error( - 'Protocol error: value for required field "epoch" was not found in protobuf' - ); - } - - if (obj.shareX == null) { - throw new Error( - 'Protocol error: value for required field "shareX" was not found in protobuf' - ); - } - - if (obj.shareY == null) { - throw new Error( - 'Protocol error: value for required field "shareY" was not found in protobuf' - ); - } - - if (obj.nullifier == null) { - throw new Error( - 'Protocol error: value for required field "nullifier" was not found in protobuf' - ); - } - - if (obj.rlnIdentifier == null) { - throw new Error( - 'Protocol error: value for required field "rlnIdentifier" was not found in protobuf' - ); - } - return obj; } ); @@ -409,7 +342,7 @@ export namespace RateLimitProof { return _codec; }; - export const encode = (obj: RateLimitProof): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, RateLimitProof.codec()); }; @@ -434,48 +367,48 @@ export namespace WakuMessage { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.payload != null) { - writer.uint32(10); - writer.bytes(obj.payload); + w.uint32(10); + w.bytes(obj.payload); } if (obj.contentTopic != null) { - writer.uint32(18); - writer.string(obj.contentTopic); + w.uint32(18); + w.string(obj.contentTopic); } if (obj.version != null) { - writer.uint32(24); - writer.uint32(obj.version); + w.uint32(24); + w.uint32(obj.version); } if (obj.timestampDeprecated != null) { - writer.uint32(33); - writer.double(obj.timestampDeprecated); + w.uint32(33); + w.double(obj.timestampDeprecated); } if (obj.timestamp != null) { - writer.uint32(80); - writer.sint64(obj.timestamp); + w.uint32(80); + w.sint64(obj.timestamp); } if (obj.rateLimitProof != null) { - writer.uint32(170); - RateLimitProof.codec().encode(obj.rateLimitProof, writer); + w.uint32(170); + RateLimitProof.codec().encode(obj.rateLimitProof, w); } if (obj.ephemeral != null) { - writer.uint32(248); - writer.bool(obj.ephemeral); + w.uint32(248); + w.bool(obj.ephemeral); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -525,7 +458,7 @@ export namespace WakuMessage { return _codec; }; - export const encode = (obj: WakuMessage): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, WakuMessage.codec()); }; diff --git a/packages/proto/src/lib/message.ts b/packages/proto/src/lib/message.ts index f24100e98e..18db689383 100644 --- a/packages/proto/src/lib/message.ts +++ b/packages/proto/src/lib/message.ts @@ -1,9 +1,12 @@ /* eslint-disable import/export */ +/* eslint-disable complexity */ /* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ +/* eslint-disable @typescript-eslint/no-empty-interface */ import { encodeMessage, decodeMessage, message } from "protons-runtime"; -import type { Uint8ArrayList } from "uint8arraylist"; import type { Codec } from "protons-runtime"; +import type { Uint8ArrayList } from "uint8arraylist"; export interface RateLimitProof { proof: Uint8Array; @@ -21,76 +24,48 @@ export namespace RateLimitProof { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } - if (obj.proof != null) { - writer.uint32(10); - writer.bytes(obj.proof); - } else { - throw new Error( - 'Protocol error: required field "proof" was not found in object' - ); + if (obj.proof != null && obj.proof.byteLength > 0) { + w.uint32(10); + w.bytes(obj.proof); } - if (obj.merkleRoot != null) { - writer.uint32(18); - writer.bytes(obj.merkleRoot); - } else { - throw new Error( - 'Protocol error: required field "merkleRoot" was not found in object' - ); + if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) { + w.uint32(18); + w.bytes(obj.merkleRoot); } - if (obj.epoch != null) { - writer.uint32(26); - writer.bytes(obj.epoch); - } else { - throw new Error( - 'Protocol error: required field "epoch" was not found in object' - ); + if (obj.epoch != null && obj.epoch.byteLength > 0) { + w.uint32(26); + w.bytes(obj.epoch); } - if (obj.shareX != null) { - writer.uint32(34); - writer.bytes(obj.shareX); - } else { - throw new Error( - 'Protocol error: required field "shareX" was not found in object' - ); + if (obj.shareX != null && obj.shareX.byteLength > 0) { + w.uint32(34); + w.bytes(obj.shareX); } - if (obj.shareY != null) { - writer.uint32(42); - writer.bytes(obj.shareY); - } else { - throw new Error( - 'Protocol error: required field "shareY" was not found in object' - ); + if (obj.shareY != null && obj.shareY.byteLength > 0) { + w.uint32(42); + w.bytes(obj.shareY); } - if (obj.nullifier != null) { - writer.uint32(50); - writer.bytes(obj.nullifier); - } else { - throw new Error( - 'Protocol error: required field "nullifier" was not found in object' - ); + if (obj.nullifier != null && obj.nullifier.byteLength > 0) { + w.uint32(50); + w.bytes(obj.nullifier); } - if (obj.rlnIdentifier != null) { - writer.uint32(58); - writer.bytes(obj.rlnIdentifier); - } else { - throw new Error( - 'Protocol error: required field "rlnIdentifier" was not found in object' - ); + if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) { + w.uint32(58); + w.bytes(obj.rlnIdentifier); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -137,48 +112,6 @@ export namespace RateLimitProof { } } - if (obj.proof == null) { - throw new Error( - 'Protocol error: value for required field "proof" was not found in protobuf' - ); - } - - if (obj.merkleRoot == null) { - throw new Error( - 'Protocol error: value for required field "merkleRoot" was not found in protobuf' - ); - } - - if (obj.epoch == null) { - throw new Error( - 'Protocol error: value for required field "epoch" was not found in protobuf' - ); - } - - if (obj.shareX == null) { - throw new Error( - 'Protocol error: value for required field "shareX" was not found in protobuf' - ); - } - - if (obj.shareY == null) { - throw new Error( - 'Protocol error: value for required field "shareY" was not found in protobuf' - ); - } - - if (obj.nullifier == null) { - throw new Error( - 'Protocol error: value for required field "nullifier" was not found in protobuf' - ); - } - - if (obj.rlnIdentifier == null) { - throw new Error( - 'Protocol error: value for required field "rlnIdentifier" was not found in protobuf' - ); - } - return obj; } ); @@ -187,7 +120,7 @@ export namespace RateLimitProof { return _codec; }; - export const encode = (obj: RateLimitProof): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, RateLimitProof.codec()); }; @@ -212,48 +145,48 @@ export namespace WakuMessage { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.payload != null) { - writer.uint32(10); - writer.bytes(obj.payload); + w.uint32(10); + w.bytes(obj.payload); } if (obj.contentTopic != null) { - writer.uint32(18); - writer.string(obj.contentTopic); + w.uint32(18); + w.string(obj.contentTopic); } if (obj.version != null) { - writer.uint32(24); - writer.uint32(obj.version); + w.uint32(24); + w.uint32(obj.version); } if (obj.timestampDeprecated != null) { - writer.uint32(33); - writer.double(obj.timestampDeprecated); + w.uint32(33); + w.double(obj.timestampDeprecated); } if (obj.timestamp != null) { - writer.uint32(80); - writer.sint64(obj.timestamp); + w.uint32(80); + w.sint64(obj.timestamp); } if (obj.rateLimitProof != null) { - writer.uint32(170); - RateLimitProof.codec().encode(obj.rateLimitProof, writer); + w.uint32(170); + RateLimitProof.codec().encode(obj.rateLimitProof, w); } if (obj.ephemeral != null) { - writer.uint32(248); - writer.bool(obj.ephemeral); + w.uint32(248); + w.bool(obj.ephemeral); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -303,7 +236,7 @@ export namespace WakuMessage { return _codec; }; - export const encode = (obj: WakuMessage): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, WakuMessage.codec()); }; diff --git a/packages/proto/src/lib/peer_exchange.ts b/packages/proto/src/lib/peer_exchange.ts index d14f85b1da..fbb1dd0b2b 100644 --- a/packages/proto/src/lib/peer_exchange.ts +++ b/packages/proto/src/lib/peer_exchange.ts @@ -1,9 +1,12 @@ /* eslint-disable import/export */ +/* eslint-disable complexity */ /* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ +/* eslint-disable @typescript-eslint/no-empty-interface */ import { encodeMessage, decodeMessage, message } from "protons-runtime"; -import type { Uint8ArrayList } from "uint8arraylist"; import type { Codec } from "protons-runtime"; +import type { Uint8ArrayList } from "uint8arraylist"; export interface PeerInfo { enr?: Uint8Array; @@ -15,18 +18,18 @@ export namespace PeerInfo { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.enr != null) { - writer.uint32(10); - writer.bytes(obj.enr); + w.uint32(10); + w.bytes(obj.enr); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -55,7 +58,7 @@ export namespace PeerInfo { return _codec; }; - export const encode = (obj: PeerInfo): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, PeerInfo.codec()); }; @@ -74,18 +77,18 @@ export namespace PeerExchangeQuery { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.numPeers != null) { - writer.uint32(8); - writer.uint64(obj.numPeers); + w.uint32(8); + w.uint64(obj.numPeers); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -114,7 +117,7 @@ export namespace PeerExchangeQuery { return _codec; }; - export const encode = (obj: PeerExchangeQuery): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, PeerExchangeQuery.codec()); }; @@ -135,24 +138,20 @@ export namespace PeerExchangeResponse { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.peerInfos != null) { for (const value of obj.peerInfos) { - writer.uint32(10); - PeerInfo.codec().encode(value, writer); + w.uint32(10); + PeerInfo.codec().encode(value, w); } - } else { - throw new Error( - 'Protocol error: required field "peerInfos" was not found in object' - ); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -185,7 +184,7 @@ export namespace PeerExchangeResponse { return _codec; }; - export const encode = (obj: PeerExchangeResponse): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, PeerExchangeResponse.codec()); }; @@ -207,23 +206,23 @@ export namespace PeerExchangeRPC { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.query != null) { - writer.uint32(10); - PeerExchangeQuery.codec().encode(obj.query, writer); + w.uint32(10); + PeerExchangeQuery.codec().encode(obj.query, w); } if (obj.response != null) { - writer.uint32(18); - PeerExchangeResponse.codec().encode(obj.response, writer); + w.uint32(18); + PeerExchangeResponse.codec().encode(obj.response, w); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -261,7 +260,7 @@ export namespace PeerExchangeRPC { return _codec; }; - export const encode = (obj: PeerExchangeRPC): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, PeerExchangeRPC.codec()); }; diff --git a/packages/proto/src/lib/store.ts b/packages/proto/src/lib/store.ts index 558b545f96..b319ca4785 100644 --- a/packages/proto/src/lib/store.ts +++ b/packages/proto/src/lib/store.ts @@ -1,5 +1,8 @@ /* eslint-disable import/export */ +/* eslint-disable complexity */ /* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ +/* eslint-disable @typescript-eslint/no-empty-interface */ import { encodeMessage, @@ -7,8 +10,8 @@ import { message, enumeration, } from "protons-runtime"; -import type { Uint8ArrayList } from "uint8arraylist"; import type { Codec } from "protons-runtime"; +import type { Uint8ArrayList } from "uint8arraylist"; export interface Index { digest?: Uint8Array; @@ -23,33 +26,33 @@ export namespace Index { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.digest != null) { - writer.uint32(10); - writer.bytes(obj.digest); + w.uint32(10); + w.bytes(obj.digest); } if (obj.receivedTime != null) { - writer.uint32(16); - writer.sint64(obj.receivedTime); + w.uint32(16); + w.sint64(obj.receivedTime); } if (obj.senderTime != null) { - writer.uint32(24); - writer.sint64(obj.senderTime); + w.uint32(24); + w.sint64(obj.senderTime); } if (obj.pubsubTopic != null) { - writer.uint32(34); - writer.string(obj.pubsubTopic); + w.uint32(34); + w.string(obj.pubsubTopic); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -87,7 +90,7 @@ export namespace Index { return _codec; }; - export const encode = (obj: Index): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, Index.codec()); }; @@ -114,7 +117,7 @@ export namespace PagingInfo { } export namespace Direction { - export const codec = () => { + export const codec = (): Codec => { return enumeration(__DirectionValues); }; } @@ -124,28 +127,28 @@ export namespace PagingInfo { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.pageSize != null) { - writer.uint32(8); - writer.uint64(obj.pageSize); + w.uint32(8); + w.uint64(obj.pageSize); } if (obj.cursor != null) { - writer.uint32(18); - Index.codec().encode(obj.cursor, writer); + w.uint32(18); + Index.codec().encode(obj.cursor, w); } if (obj.direction != null) { - writer.uint32(24); - PagingInfo.Direction.codec().encode(obj.direction, writer); + w.uint32(24); + PagingInfo.Direction.codec().encode(obj.direction, w); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -180,7 +183,7 @@ export namespace PagingInfo { return _codec; }; - export const encode = (obj: PagingInfo): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, PagingInfo.codec()); }; @@ -199,18 +202,18 @@ export namespace ContentFilter { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.contentTopic != null) { - writer.uint32(10); - writer.string(obj.contentTopic); + w.uint32(10); + w.string(obj.contentTopic); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -239,7 +242,7 @@ export namespace ContentFilter { return _codec; }; - export const encode = (obj: ContentFilter): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, ContentFilter.codec()); }; @@ -262,44 +265,40 @@ export namespace HistoryQuery { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.pubSubTopic != null) { - writer.uint32(18); - writer.string(obj.pubSubTopic); + w.uint32(18); + w.string(obj.pubSubTopic); } if (obj.contentFilters != null) { for (const value of obj.contentFilters) { - writer.uint32(26); - ContentFilter.codec().encode(value, writer); + w.uint32(26); + ContentFilter.codec().encode(value, w); } - } else { - throw new Error( - 'Protocol error: required field "contentFilters" was not found in object' - ); } if (obj.pagingInfo != null) { - writer.uint32(34); - PagingInfo.codec().encode(obj.pagingInfo, writer); + w.uint32(34); + PagingInfo.codec().encode(obj.pagingInfo, w); } if (obj.startTime != null) { - writer.uint32(40); - writer.sint64(obj.startTime); + w.uint32(40); + w.sint64(obj.startTime); } if (obj.endTime != null) { - writer.uint32(48); - writer.sint64(obj.endTime); + w.uint32(48); + w.sint64(obj.endTime); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -347,7 +346,7 @@ export namespace HistoryQuery { return _codec; }; - export const encode = (obj: HistoryQuery): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, HistoryQuery.codec()); }; @@ -374,7 +373,7 @@ export namespace HistoryResponse { } export namespace HistoryError { - export const codec = () => { + export const codec = (): Codec => { return enumeration(__HistoryErrorValues); }; } @@ -384,34 +383,30 @@ export namespace HistoryResponse { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.messages != null) { for (const value of obj.messages) { - writer.uint32(18); - WakuMessage.codec().encode(value, writer); + w.uint32(18); + WakuMessage.codec().encode(value, w); } - } else { - throw new Error( - 'Protocol error: required field "messages" was not found in object' - ); } if (obj.pagingInfo != null) { - writer.uint32(26); - PagingInfo.codec().encode(obj.pagingInfo, writer); + w.uint32(26); + PagingInfo.codec().encode(obj.pagingInfo, w); } if (obj.error != null) { - writer.uint32(32); - HistoryResponse.HistoryError.codec().encode(obj.error, writer); + w.uint32(32); + HistoryResponse.HistoryError.codec().encode(obj.error, w); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -453,7 +448,7 @@ export namespace HistoryResponse { return _codec; }; - export const encode = (obj: HistoryResponse): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, HistoryResponse.codec()); }; @@ -474,28 +469,28 @@ export namespace HistoryRPC { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.requestId != null) { - writer.uint32(10); - writer.string(obj.requestId); + w.uint32(10); + w.string(obj.requestId); } if (obj.query != null) { - writer.uint32(18); - HistoryQuery.codec().encode(obj.query, writer); + w.uint32(18); + HistoryQuery.codec().encode(obj.query, w); } if (obj.response != null) { - writer.uint32(26); - HistoryResponse.codec().encode(obj.response, writer); + w.uint32(26); + HistoryResponse.codec().encode(obj.response, w); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -536,7 +531,7 @@ export namespace HistoryRPC { return _codec; }; - export const encode = (obj: HistoryRPC): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, HistoryRPC.codec()); }; @@ -561,76 +556,48 @@ export namespace RateLimitProof { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } - if (obj.proof != null) { - writer.uint32(10); - writer.bytes(obj.proof); - } else { - throw new Error( - 'Protocol error: required field "proof" was not found in object' - ); + if (obj.proof != null && obj.proof.byteLength > 0) { + w.uint32(10); + w.bytes(obj.proof); } - if (obj.merkleRoot != null) { - writer.uint32(18); - writer.bytes(obj.merkleRoot); - } else { - throw new Error( - 'Protocol error: required field "merkleRoot" was not found in object' - ); + if (obj.merkleRoot != null && obj.merkleRoot.byteLength > 0) { + w.uint32(18); + w.bytes(obj.merkleRoot); } - if (obj.epoch != null) { - writer.uint32(26); - writer.bytes(obj.epoch); - } else { - throw new Error( - 'Protocol error: required field "epoch" was not found in object' - ); + if (obj.epoch != null && obj.epoch.byteLength > 0) { + w.uint32(26); + w.bytes(obj.epoch); } - if (obj.shareX != null) { - writer.uint32(34); - writer.bytes(obj.shareX); - } else { - throw new Error( - 'Protocol error: required field "shareX" was not found in object' - ); + if (obj.shareX != null && obj.shareX.byteLength > 0) { + w.uint32(34); + w.bytes(obj.shareX); } - if (obj.shareY != null) { - writer.uint32(42); - writer.bytes(obj.shareY); - } else { - throw new Error( - 'Protocol error: required field "shareY" was not found in object' - ); + if (obj.shareY != null && obj.shareY.byteLength > 0) { + w.uint32(42); + w.bytes(obj.shareY); } - if (obj.nullifier != null) { - writer.uint32(50); - writer.bytes(obj.nullifier); - } else { - throw new Error( - 'Protocol error: required field "nullifier" was not found in object' - ); + if (obj.nullifier != null && obj.nullifier.byteLength > 0) { + w.uint32(50); + w.bytes(obj.nullifier); } - if (obj.rlnIdentifier != null) { - writer.uint32(58); - writer.bytes(obj.rlnIdentifier); - } else { - throw new Error( - 'Protocol error: required field "rlnIdentifier" was not found in object' - ); + if (obj.rlnIdentifier != null && obj.rlnIdentifier.byteLength > 0) { + w.uint32(58); + w.bytes(obj.rlnIdentifier); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -677,48 +644,6 @@ export namespace RateLimitProof { } } - if (obj.proof == null) { - throw new Error( - 'Protocol error: value for required field "proof" was not found in protobuf' - ); - } - - if (obj.merkleRoot == null) { - throw new Error( - 'Protocol error: value for required field "merkleRoot" was not found in protobuf' - ); - } - - if (obj.epoch == null) { - throw new Error( - 'Protocol error: value for required field "epoch" was not found in protobuf' - ); - } - - if (obj.shareX == null) { - throw new Error( - 'Protocol error: value for required field "shareX" was not found in protobuf' - ); - } - - if (obj.shareY == null) { - throw new Error( - 'Protocol error: value for required field "shareY" was not found in protobuf' - ); - } - - if (obj.nullifier == null) { - throw new Error( - 'Protocol error: value for required field "nullifier" was not found in protobuf' - ); - } - - if (obj.rlnIdentifier == null) { - throw new Error( - 'Protocol error: value for required field "rlnIdentifier" was not found in protobuf' - ); - } - return obj; } ); @@ -727,7 +652,7 @@ export namespace RateLimitProof { return _codec; }; - export const encode = (obj: RateLimitProof): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, RateLimitProof.codec()); }; @@ -752,48 +677,48 @@ export namespace WakuMessage { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.payload != null) { - writer.uint32(10); - writer.bytes(obj.payload); + w.uint32(10); + w.bytes(obj.payload); } if (obj.contentTopic != null) { - writer.uint32(18); - writer.string(obj.contentTopic); + w.uint32(18); + w.string(obj.contentTopic); } if (obj.version != null) { - writer.uint32(24); - writer.uint32(obj.version); + w.uint32(24); + w.uint32(obj.version); } if (obj.timestampDeprecated != null) { - writer.uint32(33); - writer.double(obj.timestampDeprecated); + w.uint32(33); + w.double(obj.timestampDeprecated); } if (obj.timestamp != null) { - writer.uint32(80); - writer.sint64(obj.timestamp); + w.uint32(80); + w.sint64(obj.timestamp); } if (obj.rateLimitProof != null) { - writer.uint32(170); - RateLimitProof.codec().encode(obj.rateLimitProof, writer); + w.uint32(170); + RateLimitProof.codec().encode(obj.rateLimitProof, w); } if (obj.ephemeral != null) { - writer.uint32(248); - writer.bool(obj.ephemeral); + w.uint32(248); + w.bool(obj.ephemeral); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -843,7 +768,7 @@ export namespace WakuMessage { return _codec; }; - export const encode = (obj: WakuMessage): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, WakuMessage.codec()); }; diff --git a/packages/proto/src/lib/topic_only_message.ts b/packages/proto/src/lib/topic_only_message.ts index a17ed89a36..006d8537aa 100644 --- a/packages/proto/src/lib/topic_only_message.ts +++ b/packages/proto/src/lib/topic_only_message.ts @@ -1,9 +1,12 @@ /* eslint-disable import/export */ +/* eslint-disable complexity */ /* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ +/* eslint-disable @typescript-eslint/no-empty-interface */ import { encodeMessage, decodeMessage, message } from "protons-runtime"; -import type { Uint8ArrayList } from "uint8arraylist"; import type { Codec } from "protons-runtime"; +import type { Uint8ArrayList } from "uint8arraylist"; export interface TopicOnlyMessage { contentTopic?: string; @@ -15,18 +18,18 @@ export namespace TopicOnlyMessage { export const codec = (): Codec => { if (_codec == null) { _codec = message( - (obj, writer, opts = {}) => { + (obj, w, opts = {}) => { if (opts.lengthDelimited !== false) { - writer.fork(); + w.fork(); } if (obj.contentTopic != null) { - writer.uint32(18); - writer.string(obj.contentTopic); + w.uint32(18); + w.string(obj.contentTopic); } if (opts.lengthDelimited !== false) { - writer.ldelim(); + w.ldelim(); } }, (reader, length) => { @@ -55,7 +58,7 @@ export namespace TopicOnlyMessage { return _codec; }; - export const encode = (obj: TopicOnlyMessage): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, TopicOnlyMessage.codec()); };