From dc6e61775ba5230f20d2bbe474bc2d58d08092d0 Mon Sep 17 00:00:00 2001 From: tomasciccola <117094913+tomasciccola@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:08:11 -0300 Subject: [PATCH 1/7] chore: update mapeo/schema (#803) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update mapeo/schema, add `deviceType.selfHostedServer` to proto/rpc.proto Co-authored-by: Tomás Ciccola --- package-lock.json | 8 ++++---- package.json | 2 +- proto/rpc.proto | 1 + src/generated/rpc.d.ts | 1 + src/generated/rpc.js | 6 ++++++ src/generated/rpc.ts | 6 ++++++ 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2b232a6fb..04630194f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,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.23", + "@mapeo/schema": "^3.0.0-next.24", "@mapeo/sqlite-indexer": "1.0.0-alpha.9", "@sinclair/typebox": "^0.29.6", "b4a": "^1.6.3", @@ -804,9 +804,9 @@ } }, "node_modules/@mapeo/schema": { - "version": "3.0.0-next.23", - "resolved": "https://registry.npmjs.org/@mapeo/schema/-/schema-3.0.0-next.23.tgz", - "integrity": "sha512-NtI32BBwVahOC12ETrsBhNOjBtgF/6p/AatouaivBTe3cXudEGXm3lOgExDytHzKGJDKP4ALNOWLUbEKKlsTWQ==", + "version": "3.0.0-next.24", + "resolved": "https://registry.npmjs.org/@mapeo/schema/-/schema-3.0.0-next.24.tgz", + "integrity": "sha512-NaaIwxjhuZgYifphrC29CtLfEpAw/lvymKu0GdUAONC4TAljpunFUmc5fYEyPurKxo9rUhNKvGvSPyGZBCdc/A==", "dependencies": { "compact-encoding": "^2.12.0", "protobufjs": "^7.2.5", diff --git a/package.json b/package.json index 4ad78dd1e..610546be0 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,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.23", + "@mapeo/schema": "^3.0.0-next.24", "@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 5b30a77aa..a97a27cfa 100644 --- a/proto/rpc.proto +++ b/proto/rpc.proto @@ -38,6 +38,7 @@ message DeviceInfo { mobile = 1; tablet = 2; desktop = 3; + selfHostedServer = 4; } string name = 1; optional DeviceType deviceType = 2; diff --git a/src/generated/rpc.d.ts b/src/generated/rpc.d.ts index f1f4dd1bf..28b42ad9e 100644 --- a/src/generated/rpc.d.ts +++ b/src/generated/rpc.d.ts @@ -39,6 +39,7 @@ export declare const DeviceInfo_DeviceType: { readonly mobile: "mobile"; readonly tablet: "tablet"; readonly desktop: "desktop"; + readonly selfHostedServer: "selfHostedServer"; readonly UNRECOGNIZED: "UNRECOGNIZED"; }; export type DeviceInfo_DeviceType = typeof DeviceInfo_DeviceType[keyof typeof DeviceInfo_DeviceType]; diff --git a/src/generated/rpc.js b/src/generated/rpc.js index 66b8a3e81..e3b0d4bff 100644 --- a/src/generated/rpc.js +++ b/src/generated/rpc.js @@ -48,6 +48,7 @@ export var DeviceInfo_DeviceType = { mobile: "mobile", tablet: "tablet", desktop: "desktop", + selfHostedServer: "selfHostedServer", UNRECOGNIZED: "UNRECOGNIZED", }; export function deviceInfo_DeviceTypeFromJSON(object) { @@ -64,6 +65,9 @@ export function deviceInfo_DeviceTypeFromJSON(object) { case 3: case "desktop": return DeviceInfo_DeviceType.desktop; + case 4: + case "selfHostedServer": + return DeviceInfo_DeviceType.selfHostedServer; case -1: case "UNRECOGNIZED": default: @@ -80,6 +84,8 @@ export function deviceInfo_DeviceTypeToNumber(object) { return 2; case DeviceInfo_DeviceType.desktop: return 3; + case DeviceInfo_DeviceType.selfHostedServer: + return 4; case DeviceInfo_DeviceType.UNRECOGNIZED: default: return -1; diff --git a/src/generated/rpc.ts b/src/generated/rpc.ts index 2a82168d0..86eb97384 100644 --- a/src/generated/rpc.ts +++ b/src/generated/rpc.ts @@ -83,6 +83,7 @@ export const DeviceInfo_DeviceType = { mobile: "mobile", tablet: "tablet", desktop: "desktop", + selfHostedServer: "selfHostedServer", UNRECOGNIZED: "UNRECOGNIZED", } as const; @@ -102,6 +103,9 @@ export function deviceInfo_DeviceTypeFromJSON(object: any): DeviceInfo_DeviceTyp case 3: case "desktop": return DeviceInfo_DeviceType.desktop; + case 4: + case "selfHostedServer": + return DeviceInfo_DeviceType.selfHostedServer; case -1: case "UNRECOGNIZED": default: @@ -119,6 +123,8 @@ export function deviceInfo_DeviceTypeToNumber(object: DeviceInfo_DeviceType): nu return 2; case DeviceInfo_DeviceType.desktop: return 3; + case DeviceInfo_DeviceType.selfHostedServer: + return 4; case DeviceInfo_DeviceType.UNRECOGNIZED: default: return -1; From f1fc61fc0278a72badebb1521afd91826822a59e Mon Sep 17 00:00:00 2001 From: "optic-release-automation[bot]" <94357573+optic-release-automation[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:20:30 -0300 Subject: [PATCH 2/7] [OPTIC-RELEASE-AUTOMATION] release/v9.0.0-alpha.21 (#804) Release v9.0.0-alpha.21 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 04630194f..1cf880cf5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mapeo/core", - "version": "9.0.0-alpha.20", + "version": "9.0.0-alpha.21", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mapeo/core", - "version": "9.0.0-alpha.20", + "version": "9.0.0-alpha.21", "license": "MIT", "dependencies": { "@digidem/types": "^2.3.0", diff --git a/package.json b/package.json index 610546be0..f3dba871b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mapeo/core", - "version": "9.0.0-alpha.20", + "version": "9.0.0-alpha.21", "description": "Offline p2p mapping library", "main": "src/index.js", "types": "dist/index.d.ts", From e9e427aa9ee49a9894fbd4b3fb57cd6bf4ea1183 Mon Sep 17 00:00:00 2001 From: tomasciccola <117094913+tomasciccola@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:40:42 -0300 Subject: [PATCH 3/7] fix: remove `selfHostedServer` from `deviceInfo.deviceType` rpc (#807) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remove `selfHostedServer` from `deviceInfo.deviceType` rpc Co-authored-by: Tomás Ciccola --- proto/rpc.proto | 1 - src/generated/rpc.d.ts | 1 - src/generated/rpc.js | 6 ------ src/generated/rpc.ts | 6 ------ src/mapeo-manager.js | 9 ++++++++- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/proto/rpc.proto b/proto/rpc.proto index a97a27cfa..5b30a77aa 100644 --- a/proto/rpc.proto +++ b/proto/rpc.proto @@ -38,7 +38,6 @@ message DeviceInfo { mobile = 1; tablet = 2; desktop = 3; - selfHostedServer = 4; } string name = 1; optional DeviceType deviceType = 2; diff --git a/src/generated/rpc.d.ts b/src/generated/rpc.d.ts index 28b42ad9e..f1f4dd1bf 100644 --- a/src/generated/rpc.d.ts +++ b/src/generated/rpc.d.ts @@ -39,7 +39,6 @@ export declare const DeviceInfo_DeviceType: { readonly mobile: "mobile"; readonly tablet: "tablet"; readonly desktop: "desktop"; - readonly selfHostedServer: "selfHostedServer"; readonly UNRECOGNIZED: "UNRECOGNIZED"; }; export type DeviceInfo_DeviceType = typeof DeviceInfo_DeviceType[keyof typeof DeviceInfo_DeviceType]; diff --git a/src/generated/rpc.js b/src/generated/rpc.js index e3b0d4bff..66b8a3e81 100644 --- a/src/generated/rpc.js +++ b/src/generated/rpc.js @@ -48,7 +48,6 @@ export var DeviceInfo_DeviceType = { mobile: "mobile", tablet: "tablet", desktop: "desktop", - selfHostedServer: "selfHostedServer", UNRECOGNIZED: "UNRECOGNIZED", }; export function deviceInfo_DeviceTypeFromJSON(object) { @@ -65,9 +64,6 @@ export function deviceInfo_DeviceTypeFromJSON(object) { case 3: case "desktop": return DeviceInfo_DeviceType.desktop; - case 4: - case "selfHostedServer": - return DeviceInfo_DeviceType.selfHostedServer; case -1: case "UNRECOGNIZED": default: @@ -84,8 +80,6 @@ export function deviceInfo_DeviceTypeToNumber(object) { return 2; case DeviceInfo_DeviceType.desktop: return 3; - case DeviceInfo_DeviceType.selfHostedServer: - return 4; case DeviceInfo_DeviceType.UNRECOGNIZED: default: return -1; diff --git a/src/generated/rpc.ts b/src/generated/rpc.ts index 86eb97384..2a82168d0 100644 --- a/src/generated/rpc.ts +++ b/src/generated/rpc.ts @@ -83,7 +83,6 @@ export const DeviceInfo_DeviceType = { mobile: "mobile", tablet: "tablet", desktop: "desktop", - selfHostedServer: "selfHostedServer", UNRECOGNIZED: "UNRECOGNIZED", } as const; @@ -103,9 +102,6 @@ export function deviceInfo_DeviceTypeFromJSON(object: any): DeviceInfo_DeviceTyp case 3: case "desktop": return DeviceInfo_DeviceType.desktop; - case 4: - case "selfHostedServer": - return DeviceInfo_DeviceType.selfHostedServer; case -1: case "UNRECOGNIZED": default: @@ -123,8 +119,6 @@ export function deviceInfo_DeviceTypeToNumber(object: DeviceInfo_DeviceType): nu return 2; case DeviceInfo_DeviceType.desktop: return 3; - case DeviceInfo_DeviceType.selfHostedServer: - return 4; case DeviceInfo_DeviceType.UNRECOGNIZED: default: return -1; diff --git a/src/mapeo-manager.js b/src/mapeo-manager.js index 73b1140f3..7f53d2fa9 100644 --- a/src/mapeo-manager.js +++ b/src/mapeo-manager.js @@ -699,7 +699,14 @@ export class MapeoManager extends TypedEmitter { } /** - * @template {import('type-fest').Exact} T + * @typedef {Exclude< + * import('./schema/client.js').DeviceInfoParam['deviceType'], + * 'selfHostedServer'>} RPCDeviceType + */ + + /** + * @template {import('type-fest').Exact< + * import('./schema/client.js').DeviceInfoParam & {deviceType?: RPCDeviceType}, T>} T * @param {T} deviceInfo */ async setDeviceInfo(deviceInfo) { From 7078638d893864d3249855903a16808ef40d43e6 Mon Sep 17 00:00:00 2001 From: "optic-release-automation[bot]" <94357573+optic-release-automation[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:46:42 -0300 Subject: [PATCH 4/7] [OPTIC-RELEASE-AUTOMATION] release/v9.0.0-alpha.22 (#808) Release v9.0.0-alpha.22 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1cf880cf5..e81d34bd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mapeo/core", - "version": "9.0.0-alpha.21", + "version": "9.0.0-alpha.22", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mapeo/core", - "version": "9.0.0-alpha.21", + "version": "9.0.0-alpha.22", "license": "MIT", "dependencies": { "@digidem/types": "^2.3.0", diff --git a/package.json b/package.json index f3dba871b..0abdd66a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mapeo/core", - "version": "9.0.0-alpha.21", + "version": "9.0.0-alpha.22", "description": "Offline p2p mapping library", "main": "src/index.js", "types": "dist/index.d.ts", From fc3e0c3c7338d6715890a4bdc708031026c2cee7 Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Tue, 3 Sep 2024 12:48:11 -0500 Subject: [PATCH 5/7] feat!: update `@mapeo/schema` to latest version (#809) --- ...k_fury.sql => 0000_chemical_star_brand.sql} | 0 drizzle/client/meta/0000_snapshot.json | 2 +- drizzle/client/meta/_journal.json | 4 ++-- ...0_woozy_stryfe.sql => 0000_tan_glorian.sql} | 4 ++-- drizzle/project/meta/0000_snapshot.json | 9 ++++----- drizzle/project/meta/_journal.json | 4 ++-- package-lock.json | 18 +++++++++--------- package.json | 4 ++-- 8 files changed, 22 insertions(+), 23 deletions(-) rename drizzle/client/{0000_cultured_nick_fury.sql => 0000_chemical_star_brand.sql} (100%) rename drizzle/project/{0000_woozy_stryfe.sql => 0000_tan_glorian.sql} (98%) diff --git a/drizzle/client/0000_cultured_nick_fury.sql b/drizzle/client/0000_chemical_star_brand.sql similarity index 100% rename from drizzle/client/0000_cultured_nick_fury.sql rename to drizzle/client/0000_chemical_star_brand.sql diff --git a/drizzle/client/meta/0000_snapshot.json b/drizzle/client/meta/0000_snapshot.json index ea1183c38..a1920eaa1 100644 --- a/drizzle/client/meta/0000_snapshot.json +++ b/drizzle/client/meta/0000_snapshot.json @@ -1,7 +1,7 @@ { "version": "5", "dialect": "sqlite", - "id": "efbe54ff-5195-4127-b634-76e303657276", + "id": "41e23fc3-463e-432a-9a5f-7c20366d6294", "prevId": "00000000-0000-0000-0000-000000000000", "tables": { "localDeviceInfo": { diff --git a/drizzle/client/meta/_journal.json b/drizzle/client/meta/_journal.json index 8d70e9589..1ca0aaeb7 100644 --- a/drizzle/client/meta/_journal.json +++ b/drizzle/client/meta/_journal.json @@ -5,8 +5,8 @@ { "idx": 0, "version": "5", - "when": 1724972191819, - "tag": "0000_cultured_nick_fury", + "when": 1725381616476, + "tag": "0000_chemical_star_brand", "breakpoints": true } ] diff --git a/drizzle/project/0000_woozy_stryfe.sql b/drizzle/project/0000_tan_glorian.sql similarity index 98% rename from drizzle/project/0000_woozy_stryfe.sql rename to drizzle/project/0000_tan_glorian.sql index 654eb1ec1..1a002d46a 100644 --- a/drizzle/project/0000_woozy_stryfe.sql +++ b/drizzle/project/0000_tan_glorian.sql @@ -61,7 +61,7 @@ CREATE TABLE `field` ( `appearance` text, `snakeCase` integer, `options` text, - `universal` integer DEFAULT false NOT NULL, + `universal` integer, `placeholder` text, `helperText` text, `forks` text NOT NULL @@ -126,7 +126,7 @@ CREATE TABLE `preset` ( `addTags` text NOT NULL, `removeTags` text NOT NULL, `fieldRefs` text NOT NULL, - `iconRef` text NOT NULL, + `iconRef` text, `terms` text NOT NULL, `color` text NOT NULL, `forks` text NOT NULL diff --git a/drizzle/project/meta/0000_snapshot.json b/drizzle/project/meta/0000_snapshot.json index e4ff0cc2e..074b52899 100644 --- a/drizzle/project/meta/0000_snapshot.json +++ b/drizzle/project/meta/0000_snapshot.json @@ -1,7 +1,7 @@ { "version": "5", "dialect": "sqlite", - "id": "2be32705-ddce-45ee-97c1-c6f2fc748568", + "id": "b06de2c5-6a4c-4578-a8f0-d15f9f20e902", "prevId": "00000000-0000-0000-0000-000000000000", "tables": { "coreOwnership_backlink": { @@ -373,9 +373,8 @@ "name": "universal", "type": "integer", "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false + "notNull": false, + "autoincrement": false }, "placeholder": { "name": "placeholder", @@ -757,7 +756,7 @@ "name": "iconRef", "type": "text", "primaryKey": false, - "notNull": true, + "notNull": false, "autoincrement": false }, "terms": { diff --git a/drizzle/project/meta/_journal.json b/drizzle/project/meta/_journal.json index a1449f4ad..dc2730e3e 100644 --- a/drizzle/project/meta/_journal.json +++ b/drizzle/project/meta/_journal.json @@ -5,8 +5,8 @@ { "idx": 0, "version": "5", - "when": 1724972190927, - "tag": "0000_woozy_stryfe", + "when": 1725381611574, + "tag": "0000_tan_glorian", "breakpoints": true } ] diff --git a/package-lock.json b/package-lock.json index e81d34bd0..f8b66e1c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,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.24", + "@mapeo/schema": "^3.0.0-next.26", "@mapeo/sqlite-indexer": "1.0.0-alpha.9", "@sinclair/typebox": "^0.29.6", "b4a": "^1.6.3", @@ -60,7 +60,7 @@ "devDependencies": { "@bufbuild/buf": "^1.26.1", "@mapeo/default-config": "4.0.0-alpha.8", - "@mapeo/mock-data": "^1.0.3-alpha.4", + "@mapeo/mock-data": "^1.0.3-alpha.5", "@sinonjs/fake-timers": "^10.0.2", "@types/b4a": "^1.6.0", "@types/bogon": "^1.0.2", @@ -786,9 +786,9 @@ "dev": true }, "node_modules/@mapeo/mock-data": { - "version": "1.0.3-alpha.4", - "resolved": "https://registry.npmjs.org/@mapeo/mock-data/-/mock-data-1.0.3-alpha.4.tgz", - "integrity": "sha512-2Pwmjc4UUb7snWCGVgPpLevy5IckPtW/Q1DF3FKU3nd96ksUNt7Guo1ALLXl1m2MMe27eaUg4Y7pteKNLnXImw==", + "version": "1.0.3-alpha.5", + "resolved": "https://registry.npmjs.org/@mapeo/mock-data/-/mock-data-1.0.3-alpha.5.tgz", + "integrity": "sha512-XUQaelLsJheovDgv8oRxF+V4k2dD7bpw9Jo2aHmgpF+zZbdel193oEwoU4P8exTCvrsQsS7i1KxIbdiCeeZCyA==", "dev": true, "dependencies": { "@faker-js/faker": "^8.3.1", @@ -800,13 +800,13 @@ "list-mapeo-schemas": "bin/list-mapeo-schemas.js" }, "peerDependencies": { - "@mapeo/schema": "^3.0.0-next.23" + "@mapeo/schema": "^3.0.0-next.25" } }, "node_modules/@mapeo/schema": { - "version": "3.0.0-next.24", - "resolved": "https://registry.npmjs.org/@mapeo/schema/-/schema-3.0.0-next.24.tgz", - "integrity": "sha512-NaaIwxjhuZgYifphrC29CtLfEpAw/lvymKu0GdUAONC4TAljpunFUmc5fYEyPurKxo9rUhNKvGvSPyGZBCdc/A==", + "version": "3.0.0-next.26", + "resolved": "https://registry.npmjs.org/@mapeo/schema/-/schema-3.0.0-next.26.tgz", + "integrity": "sha512-HAQWmIuK0wFbcw4jtU4H5cRzaAZHV3bDHaJfM2FKmcKGPcC/M4JeYKkQcneBOsf9ZV0UAUdKN/OnJ7jiiEmhSw==", "dependencies": { "compact-encoding": "^2.12.0", "protobufjs": "^7.2.5", diff --git a/package.json b/package.json index 0abdd66a8..b6d9cab79 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "devDependencies": { "@bufbuild/buf": "^1.26.1", "@mapeo/default-config": "4.0.0-alpha.8", - "@mapeo/mock-data": "^1.0.3-alpha.4", + "@mapeo/mock-data": "^1.0.3-alpha.5", "@sinonjs/fake-timers": "^10.0.2", "@types/b4a": "^1.6.0", "@types/bogon": "^1.0.2", @@ -155,7 +155,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.24", + "@mapeo/schema": "^3.0.0-next.26", "@mapeo/sqlite-indexer": "1.0.0-alpha.9", "@sinclair/typebox": "^0.29.6", "b4a": "^1.6.3", From 52d8449e4acf759fca34ccc9e625e3aef3773f20 Mon Sep 17 00:00:00 2001 From: "optic-release-automation[bot]" <94357573+optic-release-automation[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 12:53:01 -0500 Subject: [PATCH 6/7] [OPTIC-RELEASE-AUTOMATION] release/v9.0.0-alpha.23 (#810) Release v9.0.0-alpha.23 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f8b66e1c0..5bb2375e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mapeo/core", - "version": "9.0.0-alpha.22", + "version": "9.0.0-alpha.23", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mapeo/core", - "version": "9.0.0-alpha.22", + "version": "9.0.0-alpha.23", "license": "MIT", "dependencies": { "@digidem/types": "^2.3.0", diff --git a/package.json b/package.json index b6d9cab79..769ca50de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mapeo/core", - "version": "9.0.0-alpha.22", + "version": "9.0.0-alpha.23", "description": "Offline p2p mapping library", "main": "src/index.js", "types": "dist/index.d.ts", From 9b72be8b3fc31453d86157724540b34a6be85925 Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Mon, 9 Sep 2024 08:21:38 -0500 Subject: [PATCH 7/7] chore: use upstream types for `compact-encoding` (#813) This is a types-only change. [`@types/compact-encoding`][0] was recently published. Let's use that instead of our "empty" type. [0]: https://www.npmjs.com/package/@types/compact-encoding --- package-lock.json | 8 ++++++++ package.json | 1 + types/compact-encoding.d.ts | 1 - types/protomux.d.ts | 23 +++-------------------- 4 files changed, 12 insertions(+), 21 deletions(-) delete mode 100644 types/compact-encoding.d.ts diff --git a/package-lock.json b/package-lock.json index 5bb2375e2..5fcb9f3de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -64,6 +64,7 @@ "@sinonjs/fake-timers": "^10.0.2", "@types/b4a": "^1.6.0", "@types/bogon": "^1.0.2", + "@types/compact-encoding": "^2.15.0", "@types/debug": "^4.1.8", "@types/json-schema": "^7.0.11", "@types/json-stable-stringify": "^1.0.36", @@ -1217,6 +1218,13 @@ "integrity": "sha512-R7YtCuBSS16AfLJttU/WxFzEC/rlPxUrdfyHkE/VcIybpC1nXftIg1eaFWx0PpV1ZBF/COjTgwRXprUsNew0ng==", "dev": true }, + "node_modules/@types/compact-encoding": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/@types/compact-encoding/-/compact-encoding-2.15.0.tgz", + "integrity": "sha512-NmvvYrQC9QqbbEfm6ISHfCvvfQIwq53B4hZ7aAP6mEXsPc2F15Lkxj+jGzqVeKTT+Ir0HXAj4O9YUDsIpJbOuA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/debug": { "version": "4.1.8", "dev": true, diff --git a/package.json b/package.json index 769ca50de..f06c1b97b 100644 --- a/package.json +++ b/package.json @@ -111,6 +111,7 @@ "@sinonjs/fake-timers": "^10.0.2", "@types/b4a": "^1.6.0", "@types/bogon": "^1.0.2", + "@types/compact-encoding": "^2.15.0", "@types/debug": "^4.1.8", "@types/json-schema": "^7.0.11", "@types/json-stable-stringify": "^1.0.36", diff --git a/types/compact-encoding.d.ts b/types/compact-encoding.d.ts deleted file mode 100644 index 5d9a8553f..000000000 --- a/types/compact-encoding.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'compact-encoding' diff --git a/types/protomux.d.ts b/types/protomux.d.ts index 5930dcd70..f4b3e9bea 100644 --- a/types/protomux.d.ts +++ b/types/protomux.d.ts @@ -1,30 +1,13 @@ declare module 'protomux' { import { Duplex } from 'streamx' import { Duplex as NodeDuplex } from 'stream' - - interface PreEncodingState { - buffer: null - start: number - end: number - } - - interface EncodingState { - buffer: null | Buffer - start: number - end: number - } - - interface Encoding { - preencode(state: PreEncodingState, value: any): void - encode(state: EncodingState, value: any): void - decode(state: EncodingState): any - } + import type cenc from 'compact-encoding' interface Message { type: number send(msg: any): void onmessage: (message: any) => void - encoding: Encoding + encoding: cenc.Encoder } type MessageOptions = Partial> @@ -65,7 +48,7 @@ declare module 'protomux' { aliases?: string[] id?: null | Buffer unique?: boolean - handshake?: Encoding + handshake?: cenc.Encoder messages: MessageOptions[] onopen?(handshake?: any): Promise | void onclose?(): Promise | void