From dd0a843770eadcd537fcbbc681598516ba201abe Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 20 Apr 2021 15:56:27 +1000 Subject: [PATCH] Upgrade ts-proto to fix long dependency warning/error --- package-lock.json | 32 ++++++++++++++++--------------- package.json | 2 +- src/proto/chat/v2/chat_message.ts | 4 +++- src/proto/waku/v2/message.ts | 8 +++++++- src/proto/waku/v2/store.ts | 16 +++++++++------- 5 files changed, 37 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index 81860df53e..1088c7bf4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "libp2p-websockets": "^0.15.5", "multiaddr": "^8.1.2", "prompt-sync": "^4.2.0", - "ts-proto": "^1.74.0", + "ts-proto": "^1.79.3", "uuid": "^3.4.0", "yarg": "^1.0.8" }, @@ -12866,26 +12866,27 @@ } }, "node_modules/ts-proto": { - "version": "1.74.0", - "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.74.0.tgz", - "integrity": "sha512-FxxJu6ucs/wxMCx5uNd9XzpJw1YykygZy/Z9WFDRHK5w1ao1LExzbOzaHqJS56reyBKhsxl480M865a1ZgAJBA==", + "version": "1.79.3", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.79.3.tgz", + "integrity": "sha512-zAZ3PE+CHdyNzK7oxjRtEvzFFfKOI293xXA8ukxZXUKJXrKLfbvsVwM4kLMx5tMSJEBm/PQq/iOzh+muKbUEhw==", "dependencies": { "@types/object-hash": "^1.3.0", "dataloader": "^1.4.0", "object-hash": "^1.3.1", "protobufjs": "^6.8.8", "ts-poet": "^4.5.0", - "ts-proto-descriptors": "^1.2.0" + "ts-proto-descriptors": "^1.2.1" }, "bin": { "protoc-gen-ts_proto": "protoc-gen-ts_proto" } }, "node_modules/ts-proto-descriptors": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.2.0.tgz", - "integrity": "sha512-0t2WITzCiQ/3H6zPuFrFFOj2jhH6xZNu7agS7aKecKrz7tjRMW9VrmlBlJXslTTC3K7/4phV4qlsP5fOfLxuDg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.2.1.tgz", + "integrity": "sha512-iSHiQAaovi9sBwjiSCca/E089uv0IMt9Cfe0wV5AJwZppGa47yfih97Q+1006bdSLWkxf5Pk3VDQnt1yRTMV8w==", "dependencies": { + "long": "^4.0.0", "protobufjs": "^6.8.8" } }, @@ -24120,23 +24121,24 @@ } }, "ts-proto": { - "version": "1.74.0", - "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.74.0.tgz", - "integrity": "sha512-FxxJu6ucs/wxMCx5uNd9XzpJw1YykygZy/Z9WFDRHK5w1ao1LExzbOzaHqJS56reyBKhsxl480M865a1ZgAJBA==", + "version": "1.79.3", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.79.3.tgz", + "integrity": "sha512-zAZ3PE+CHdyNzK7oxjRtEvzFFfKOI293xXA8ukxZXUKJXrKLfbvsVwM4kLMx5tMSJEBm/PQq/iOzh+muKbUEhw==", "requires": { "@types/object-hash": "^1.3.0", "dataloader": "^1.4.0", "object-hash": "^1.3.1", "protobufjs": "^6.8.8", "ts-poet": "^4.5.0", - "ts-proto-descriptors": "^1.2.0" + "ts-proto-descriptors": "^1.2.1" } }, "ts-proto-descriptors": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.2.0.tgz", - "integrity": "sha512-0t2WITzCiQ/3H6zPuFrFFOj2jhH6xZNu7agS7aKecKrz7tjRMW9VrmlBlJXslTTC3K7/4phV4qlsP5fOfLxuDg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.2.1.tgz", + "integrity": "sha512-iSHiQAaovi9sBwjiSCca/E089uv0IMt9Cfe0wV5AJwZppGa47yfih97Q+1006bdSLWkxf5Pk3VDQnt1yRTMV8w==", "requires": { + "long": "^4.0.0", "protobufjs": "^6.8.8" } }, diff --git a/package.json b/package.json index d844a9d058..ec5177cced 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "libp2p-websockets": "^0.15.5", "multiaddr": "^8.1.2", "prompt-sync": "^4.2.0", - "ts-proto": "^1.74.0", + "ts-proto": "^1.79.3", "uuid": "^3.4.0", "yarg": "^1.0.8" }, diff --git a/src/proto/chat/v2/chat_message.ts b/src/proto/chat/v2/chat_message.ts index 057cb09854..7284131984 100644 --- a/src/proto/chat/v2/chat_message.ts +++ b/src/proto/chat/v2/chat_message.ts @@ -30,9 +30,10 @@ export const ChatMessageProto = { }, decode(input: _m0.Reader | Uint8Array, length?: number): ChatMessageProto { - const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseChatMessageProto } as ChatMessageProto; + message.payload = new Uint8Array(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -55,6 +56,7 @@ export const ChatMessageProto = { fromJSON(object: any): ChatMessageProto { const message = { ...baseChatMessageProto } as ChatMessageProto; + message.payload = new Uint8Array(); if (object.timestamp !== undefined && object.timestamp !== null) { message.timestamp = Number(object.timestamp); } else { diff --git a/src/proto/waku/v2/message.ts b/src/proto/waku/v2/message.ts index 2274d19b2e..915d6eca40 100644 --- a/src/proto/waku/v2/message.ts +++ b/src/proto/waku/v2/message.ts @@ -1,4 +1,5 @@ /* eslint-disable */ +import Long from 'long'; import _m0 from 'protobufjs/minimal'; export const protobufPackage = 'waku.v2'; @@ -33,7 +34,7 @@ export const WakuMessageProto = { }, decode(input: _m0.Reader | Uint8Array, length?: number): WakuMessageProto { - const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseWakuMessageProto } as WakuMessageProto; while (reader.pos < end) { @@ -165,3 +166,8 @@ export type DeepPartial = T extends Builtin : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/src/proto/waku/v2/store.ts b/src/proto/waku/v2/store.ts index 77692dabea..d637c484b9 100644 --- a/src/proto/waku/v2/store.ts +++ b/src/proto/waku/v2/store.ts @@ -1,7 +1,7 @@ /* eslint-disable */ import Long from 'long'; -import { WakuMessageProto } from '../../waku/v2/message'; import _m0 from 'protobufjs/minimal'; +import { WakuMessageProto } from '../../waku/v2/message'; export const protobufPackage = 'waku.v2'; @@ -88,9 +88,10 @@ export const Index = { }, decode(input: _m0.Reader | Uint8Array, length?: number): Index { - const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseIndex } as Index; + message.digest = new Uint8Array(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -110,6 +111,7 @@ export const Index = { fromJSON(object: any): Index { const message = { ...baseIndex } as Index; + message.digest = new Uint8Array(); if (object.digest !== undefined && object.digest !== null) { message.digest = bytesFromBase64(object.digest); } @@ -168,7 +170,7 @@ export const PagingInfo = { }, decode(input: _m0.Reader | Uint8Array, length?: number): PagingInfo { - const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...basePagingInfo } as PagingInfo; while (reader.pos < end) { @@ -256,7 +258,7 @@ export const ContentFilter = { }, decode(input: _m0.Reader | Uint8Array, length?: number): ContentFilter { - const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseContentFilter } as ContentFilter; while (reader.pos < end) { @@ -324,7 +326,7 @@ export const HistoryQuery = { }, decode(input: _m0.Reader | Uint8Array, length?: number): HistoryQuery { - const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseHistoryQuery } as HistoryQuery; message.contentFilters = []; @@ -441,7 +443,7 @@ export const HistoryResponse = { }, decode(input: _m0.Reader | Uint8Array, length?: number): HistoryResponse { - const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseHistoryResponse } as HistoryResponse; message.messages = []; @@ -536,7 +538,7 @@ export const HistoryRPC = { }, decode(input: _m0.Reader | Uint8Array, length?: number): HistoryRPC { - const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseHistoryRPC } as HistoryRPC; while (reader.pos < end) {