From b520a7a2b9a0e935aff866b85c0217f0dacdf26d Mon Sep 17 00:00:00 2001 From: tomasciccola <117094913+tomasciccola@users.noreply.github.com> Date: Wed, 31 Jul 2024 12:33:35 -0300 Subject: [PATCH] feat!: add unspecified to rpc.proto enums (#731) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **NOTE**: this changes the publicApi adding `device_type_unspecified` to the `DeviceInfo.DeviceType` enum * add unspecified to rpc.proto enums * fix type error on member api I'm rejecting an invite with `DECISION_UNSPECIFIED` as value * add @ts-ignore to e2e-test until we update mapeo/schema --------- Co-authored-by: Tomás Ciccola --- package-lock.json | 207 ++++++++++++++++++----------------------- package.json | 2 +- proto/rpc.proto | 14 +-- src/generated/rpc.d.ts | 2 + src/generated/rpc.js | 38 +++++--- src/generated/rpc.ts | 38 +++++--- src/member-api.js | 1 + test-e2e/utils.js | 1 + 8 files changed, 156 insertions(+), 147 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2b403583d..c9c4528c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@fastify/type-provider-typebox": "^4.0.0", "@hyperswarm/secret-stream": "^6.1.2", "@mapeo/crypto": "1.0.0-alpha.10", - "@mapeo/schema": "3.0.0-next.16", + "@mapeo/schema": "^3.0.0-next.16", "@mapeo/sqlite-indexer": "1.0.0-alpha.9", "@sinclair/typebox": "^0.29.6", "b4a": "^1.6.3", @@ -1261,21 +1261,6 @@ "balanced-match": "^1.0.0" } }, - "node_modules/@fastify/static/node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@fastify/static/node_modules/glob": { "version": "10.3.12", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", @@ -1311,17 +1296,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@fastify/static/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@fastify/type-provider-typebox": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@fastify/type-provider-typebox/-/type-provider-typebox-4.0.0.tgz", @@ -1460,28 +1434,32 @@ }, "node_modules/@json-schema-spec/json-pointer": { "version": "0.1.2", - "license": "MIT" + "resolved": "https://registry.npmjs.org/@json-schema-spec/json-pointer/-/json-pointer-0.1.2.tgz", + "integrity": "sha512-BYY7IavBjwsWWSmVcMz2A9mKiDD9RvacnsItgmy1xV8cmgbtxFfKmKMtkVpD7pYtkx4mIW4800yZBXueVFIWPw==" }, "node_modules/@json-schema-tools/dereferencer": { - "version": "1.6.1", - "license": "Apache-2.0", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@json-schema-tools/dereferencer/-/dereferencer-1.6.3.tgz", + "integrity": "sha512-NoQkj6hx9Joqbd/GZAOHSGtE6R+OzlnOcDfyidmx8e/CUv1Q+Z6/fmZo2wwCQWiwP1pnGYc95iKwp8M7XlV7wQ==", "dependencies": { - "@json-schema-tools/reference-resolver": "^1.2.5", - "@json-schema-tools/traverse": "^1.10.0", + "@json-schema-tools/reference-resolver": "^1.2.6", + "@json-schema-tools/traverse": "^1.10.4", "fast-safe-stringify": "^2.1.1" } }, "node_modules/@json-schema-tools/reference-resolver": { - "version": "1.2.5", - "license": "Apache-2.0", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@json-schema-tools/reference-resolver/-/reference-resolver-1.2.6.tgz", + "integrity": "sha512-4QZu5ROb5EpLSvV+buzk8WR30W+dffSNaKqD3VGFYJ3y0BLDi2OHoSz5e6NKcLYTyUYXV8IKxocNOszeVBJI4Q==", "dependencies": { "@json-schema-spec/json-pointer": "^0.1.2", "isomorphic-fetch": "^3.0.0" } }, "node_modules/@json-schema-tools/traverse": { - "version": "1.10.1", - "license": "Apache-2.0" + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/@json-schema-tools/traverse/-/traverse-1.10.4.tgz", + "integrity": "sha512-9e42zjhLIxzBONroNC4SGsTqdB877tzwH2S6lqgTav9K24kWJR9vNieeMVSuyqnY8FlclH21D8wsm/tuD9WA9Q==" }, "node_modules/@lukeed/ms": { "version": "2.0.2", @@ -1563,43 +1541,43 @@ }, "node_modules/@mapeo/schema/node_modules/brace-expansion": { "version": "2.0.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dependencies": { "balanced-match": "^1.0.0" } }, - "node_modules/@mapeo/schema/node_modules/foreground-child": { - "version": "3.1.1", - "license": "ISC", + "node_modules/@mapeo/schema/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, - "engines": { - "node": ">=14" + "bin": { + "glob": "dist/esm/bin.mjs" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@mapeo/schema/node_modules/glob": { - "version": "10.3.3", - "license": "ISC", + "node_modules/@mapeo/schema/node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^2.0.3", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" - }, - "bin": { - "glob": "dist/cjs/src/bin.js" - }, - "engines": { - "node": ">=16 || 14 >=14.17" + "@isaacs/cliui": "^8.0.2" }, "funding": { "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" } }, "node_modules/@mapeo/schema/node_modules/json-schema-traverse": { @@ -1607,8 +1585,9 @@ "license": "MIT" }, "node_modules/@mapeo/schema/node_modules/minimatch": { - "version": "9.0.3", - "license": "ISC", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -1619,16 +1598,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@mapeo/schema/node_modules/signal-exit": { - "version": "4.1.0", - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@mapeo/schema/node_modules/typedoc": { "version": "0.24.8", "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.24.8.tgz", @@ -4047,7 +4016,8 @@ }, "node_modules/fast-safe-stringify": { "version": "2.1.1", - "license": "MIT" + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" }, "node_modules/fast-uri": { "version": "2.2.0", @@ -4252,6 +4222,32 @@ "is-callable": "^1.1.3" } }, + "node_modules/foreground-child": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", + "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/format-util": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/format-util/-/format-util-1.0.5.tgz", @@ -5246,7 +5242,8 @@ }, "node_modules/isomorphic-fetch": { "version": "3.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", "dependencies": { "node-fetch": "^2.6.1", "whatwg-fetch": "^3.4.1" @@ -6064,9 +6061,9 @@ } }, "node_modules/minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "engines": { "node": ">=16 || 14 >=14.17" } @@ -6198,8 +6195,9 @@ } }, "node_modules/node-fetch": { - "version": "2.6.13", - "license": "MIT", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -6700,6 +6698,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==" + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -6846,15 +6849,15 @@ "license": "MIT" }, "node_modules/path-scurry": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", - "integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -7630,22 +7633,6 @@ "balanced-match": "^1.0.0" } }, - "node_modules/rimraf/node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/rimraf/node_modules/glob": { "version": "10.3.10", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", @@ -7683,18 +7670,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rimraf/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "dev": true, @@ -8540,7 +8515,8 @@ }, "node_modules/tr46": { "version": "0.0.3", - "license": "MIT" + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "node_modules/trim-newlines": { "version": "5.0.0", @@ -8882,15 +8858,18 @@ }, "node_modules/webidl-conversions": { "version": "3.0.1", - "license": "BSD-2-Clause" + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/whatwg-fetch": { - "version": "3.6.17", - "license": "MIT" + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==" }, "node_modules/whatwg-url": { "version": "5.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" diff --git a/package.json b/package.json index 5a7f2aa1c..1c42288e1 100644 --- a/package.json +++ b/package.json @@ -157,7 +157,7 @@ "@fastify/type-provider-typebox": "^4.0.0", "@hyperswarm/secret-stream": "^6.1.2", "@mapeo/crypto": "1.0.0-alpha.10", - "@mapeo/schema": "3.0.0-next.16", + "@mapeo/schema": "^3.0.0-next.16", "@mapeo/sqlite-indexer": "1.0.0-alpha.9", "@sinclair/typebox": "^0.29.6", "b4a": "^1.6.3", diff --git a/proto/rpc.proto b/proto/rpc.proto index 0e8326e50..5b30a77aa 100644 --- a/proto/rpc.proto +++ b/proto/rpc.proto @@ -17,9 +17,10 @@ message InviteCancel { message InviteResponse { enum Decision { - REJECT = 0; - ACCEPT = 1; - ALREADY = 2; + DECISION_UNSPECIFIED = 0; + REJECT = 1; + ACCEPT = 2; + ALREADY = 3; } bytes inviteId = 1; Decision decision = 2; @@ -33,9 +34,10 @@ message ProjectJoinDetails { message DeviceInfo { enum DeviceType { - mobile = 0; - tablet = 1; - desktop = 2; + device_type_unspecified = 0; + mobile = 1; + tablet = 2; + desktop = 3; } string name = 1; optional DeviceType deviceType = 2; diff --git a/src/generated/rpc.d.ts b/src/generated/rpc.d.ts index 138e84f1e..e4e23ed3d 100644 --- a/src/generated/rpc.d.ts +++ b/src/generated/rpc.d.ts @@ -17,6 +17,7 @@ export interface InviteResponse { decision: InviteResponse_Decision; } export declare const InviteResponse_Decision: { + readonly DECISION_UNSPECIFIED: "DECISION_UNSPECIFIED"; readonly REJECT: "REJECT"; readonly ACCEPT: "ACCEPT"; readonly ALREADY: "ALREADY"; @@ -35,6 +36,7 @@ export interface DeviceInfo { deviceType?: DeviceInfo_DeviceType | undefined; } export declare const DeviceInfo_DeviceType: { + readonly device_type_unspecified: "device_type_unspecified"; readonly mobile: "mobile"; readonly tablet: "tablet"; readonly desktop: "desktop"; diff --git a/src/generated/rpc.js b/src/generated/rpc.js index 8e14e6fe8..66b8a3e81 100644 --- a/src/generated/rpc.js +++ b/src/generated/rpc.js @@ -2,6 +2,7 @@ import _m0 from "protobufjs/minimal.js"; import { EncryptionKeys } from "./keys.js"; export var InviteResponse_Decision = { + DECISION_UNSPECIFIED: "DECISION_UNSPECIFIED", REJECT: "REJECT", ACCEPT: "ACCEPT", ALREADY: "ALREADY", @@ -10,12 +11,15 @@ export var InviteResponse_Decision = { export function inviteResponse_DecisionFromJSON(object) { switch (object) { case 0: + case "DECISION_UNSPECIFIED": + return InviteResponse_Decision.DECISION_UNSPECIFIED; + case 1: case "REJECT": return InviteResponse_Decision.REJECT; - case 1: + case 2: case "ACCEPT": return InviteResponse_Decision.ACCEPT; - case 2: + case 3: case "ALREADY": return InviteResponse_Decision.ALREADY; case -1: @@ -26,18 +30,21 @@ export function inviteResponse_DecisionFromJSON(object) { } export function inviteResponse_DecisionToNumber(object) { switch (object) { - case InviteResponse_Decision.REJECT: + case InviteResponse_Decision.DECISION_UNSPECIFIED: return 0; - case InviteResponse_Decision.ACCEPT: + case InviteResponse_Decision.REJECT: return 1; - case InviteResponse_Decision.ALREADY: + case InviteResponse_Decision.ACCEPT: return 2; + case InviteResponse_Decision.ALREADY: + return 3; case InviteResponse_Decision.UNRECOGNIZED: default: return -1; } } export var DeviceInfo_DeviceType = { + device_type_unspecified: "device_type_unspecified", mobile: "mobile", tablet: "tablet", desktop: "desktop", @@ -46,12 +53,15 @@ export var DeviceInfo_DeviceType = { export function deviceInfo_DeviceTypeFromJSON(object) { switch (object) { case 0: + case "device_type_unspecified": + return DeviceInfo_DeviceType.device_type_unspecified; + case 1: case "mobile": return DeviceInfo_DeviceType.mobile; - case 1: + case 2: case "tablet": return DeviceInfo_DeviceType.tablet; - case 2: + case 3: case "desktop": return DeviceInfo_DeviceType.desktop; case -1: @@ -62,12 +72,14 @@ export function deviceInfo_DeviceTypeFromJSON(object) { } export function deviceInfo_DeviceTypeToNumber(object) { switch (object) { - case DeviceInfo_DeviceType.mobile: + case DeviceInfo_DeviceType.device_type_unspecified: return 0; - case DeviceInfo_DeviceType.tablet: + case DeviceInfo_DeviceType.mobile: return 1; - case DeviceInfo_DeviceType.desktop: + case DeviceInfo_DeviceType.tablet: return 2; + case DeviceInfo_DeviceType.desktop: + return 3; case DeviceInfo_DeviceType.UNRECOGNIZED: default: return -1; @@ -208,7 +220,7 @@ export var InviteCancel = { }, }; function createBaseInviteResponse() { - return { inviteId: Buffer.alloc(0), decision: InviteResponse_Decision.REJECT }; + return { inviteId: Buffer.alloc(0), decision: InviteResponse_Decision.DECISION_UNSPECIFIED }; } export var InviteResponse = { encode: function (message, writer) { @@ -216,7 +228,7 @@ export var InviteResponse = { if (message.inviteId.length !== 0) { writer.uint32(10).bytes(message.inviteId); } - if (message.decision !== InviteResponse_Decision.REJECT) { + if (message.decision !== InviteResponse_Decision.DECISION_UNSPECIFIED) { writer.uint32(16).int32(inviteResponse_DecisionToNumber(message.decision)); } return writer; @@ -255,7 +267,7 @@ export var InviteResponse = { var _a, _b; var message = createBaseInviteResponse(); message.inviteId = (_a = object.inviteId) !== null && _a !== void 0 ? _a : Buffer.alloc(0); - message.decision = (_b = object.decision) !== null && _b !== void 0 ? _b : InviteResponse_Decision.REJECT; + message.decision = (_b = object.decision) !== null && _b !== void 0 ? _b : InviteResponse_Decision.DECISION_UNSPECIFIED; return message; }, }; diff --git a/src/generated/rpc.ts b/src/generated/rpc.ts index f99576664..2a82168d0 100644 --- a/src/generated/rpc.ts +++ b/src/generated/rpc.ts @@ -21,6 +21,7 @@ export interface InviteResponse { } export const InviteResponse_Decision = { + DECISION_UNSPECIFIED: "DECISION_UNSPECIFIED", REJECT: "REJECT", ACCEPT: "ACCEPT", ALREADY: "ALREADY", @@ -32,12 +33,15 @@ export type InviteResponse_Decision = typeof InviteResponse_Decision[keyof typeo export function inviteResponse_DecisionFromJSON(object: any): InviteResponse_Decision { switch (object) { case 0: + case "DECISION_UNSPECIFIED": + return InviteResponse_Decision.DECISION_UNSPECIFIED; + case 1: case "REJECT": return InviteResponse_Decision.REJECT; - case 1: + case 2: case "ACCEPT": return InviteResponse_Decision.ACCEPT; - case 2: + case 3: case "ALREADY": return InviteResponse_Decision.ALREADY; case -1: @@ -49,12 +53,14 @@ export function inviteResponse_DecisionFromJSON(object: any): InviteResponse_Dec export function inviteResponse_DecisionToNumber(object: InviteResponse_Decision): number { switch (object) { - case InviteResponse_Decision.REJECT: + case InviteResponse_Decision.DECISION_UNSPECIFIED: return 0; - case InviteResponse_Decision.ACCEPT: + case InviteResponse_Decision.REJECT: return 1; - case InviteResponse_Decision.ALREADY: + case InviteResponse_Decision.ACCEPT: return 2; + case InviteResponse_Decision.ALREADY: + return 3; case InviteResponse_Decision.UNRECOGNIZED: default: return -1; @@ -73,6 +79,7 @@ export interface DeviceInfo { } export const DeviceInfo_DeviceType = { + device_type_unspecified: "device_type_unspecified", mobile: "mobile", tablet: "tablet", desktop: "desktop", @@ -84,12 +91,15 @@ export type DeviceInfo_DeviceType = typeof DeviceInfo_DeviceType[keyof typeof De export function deviceInfo_DeviceTypeFromJSON(object: any): DeviceInfo_DeviceType { switch (object) { case 0: + case "device_type_unspecified": + return DeviceInfo_DeviceType.device_type_unspecified; + case 1: case "mobile": return DeviceInfo_DeviceType.mobile; - case 1: + case 2: case "tablet": return DeviceInfo_DeviceType.tablet; - case 2: + case 3: case "desktop": return DeviceInfo_DeviceType.desktop; case -1: @@ -101,12 +111,14 @@ export function deviceInfo_DeviceTypeFromJSON(object: any): DeviceInfo_DeviceTyp export function deviceInfo_DeviceTypeToNumber(object: DeviceInfo_DeviceType): number { switch (object) { - case DeviceInfo_DeviceType.mobile: + case DeviceInfo_DeviceType.device_type_unspecified: return 0; - case DeviceInfo_DeviceType.tablet: + case DeviceInfo_DeviceType.mobile: return 1; - case DeviceInfo_DeviceType.desktop: + case DeviceInfo_DeviceType.tablet: return 2; + case DeviceInfo_DeviceType.desktop: + return 3; case DeviceInfo_DeviceType.UNRECOGNIZED: default: return -1; @@ -259,7 +271,7 @@ export const InviteCancel = { }; function createBaseInviteResponse(): InviteResponse { - return { inviteId: Buffer.alloc(0), decision: InviteResponse_Decision.REJECT }; + return { inviteId: Buffer.alloc(0), decision: InviteResponse_Decision.DECISION_UNSPECIFIED }; } export const InviteResponse = { @@ -267,7 +279,7 @@ export const InviteResponse = { if (message.inviteId.length !== 0) { writer.uint32(10).bytes(message.inviteId); } - if (message.decision !== InviteResponse_Decision.REJECT) { + if (message.decision !== InviteResponse_Decision.DECISION_UNSPECIFIED) { writer.uint32(16).int32(inviteResponse_DecisionToNumber(message.decision)); } return writer; @@ -309,7 +321,7 @@ export const InviteResponse = { fromPartial, I>>(object: I): InviteResponse { const message = createBaseInviteResponse(); message.inviteId = object.inviteId ?? Buffer.alloc(0); - message.decision = object.decision ?? InviteResponse_Decision.REJECT; + message.decision = object.decision ?? InviteResponse_Decision.DECISION_UNSPECIFIED; return message; }, }; diff --git a/src/member-api.js b/src/member-api.js index 52f5613aa..8fb9d3c62 100644 --- a/src/member-api.js +++ b/src/member-api.js @@ -148,6 +148,7 @@ export class MemberApi extends TypedEmitter { case InviteResponse_Decision.REJECT: return inviteResponse.decision case InviteResponse_Decision.UNRECOGNIZED: + case InviteResponse_Decision.DECISION_UNSPECIFIED: return InviteResponse_Decision.REJECT case InviteResponse_Decision.ACCEPT: // We should assign the role locally *before* sharing the project details diff --git a/test-e2e/utils.js b/test-e2e/utils.js index 39fee3d99..5fa769262 100644 --- a/test-e2e/utils.js +++ b/test-e2e/utils.js @@ -173,6 +173,7 @@ export async function createManagers(count, t, deviceType) { .map(async (_, i) => { const name = 'device' + i + (deviceType ? `-${deviceType}` : '') const manager = createManager(name, t) + // @ts-ignore TODO: remove after updating @mapeo/schema await manager.setDeviceInfo({ name, deviceType }) return manager })