diff --git a/packages/protons-benchmark/package.json b/packages/protons-benchmark/package.json index 588a741..8e3b1a9 100644 --- a/packages/protons-benchmark/package.json +++ b/packages/protons-benchmark/package.json @@ -27,7 +27,7 @@ "protobufjs": "^7.5.4", "protons": "^8.0.0", "protons-runtime": "^6.0.0", - "uint8arraylist": "^2.4.8" + "uint8arraylist": "^3.0.0" }, "private": true } diff --git a/packages/protons-benchmark/src/implementations/protons/bench.ts b/packages/protons-benchmark/src/implementations/protons/bench.ts index ab6a14f..ffd15dc 100644 --- a/packages/protons-benchmark/src/implementations/protons/bench.ts +++ b/packages/protons-benchmark/src/implementations/protons/bench.ts @@ -1,5 +1,3 @@ -/* eslint-disable require-yield */ - import { decodeMessage, encodeMessage, enumeration, MaxLengthError, message, streamMessage } from 'protons-runtime' import type { Codec, DecodeOptions } from 'protons-runtime' import type { Uint8ArrayList } from 'uint8arraylist' @@ -78,7 +76,7 @@ export namespace Foo { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Foo.codec()) } diff --git a/packages/protons-runtime/package.json b/packages/protons-runtime/package.json index 2ac57be..461c1fc 100644 --- a/packages/protons-runtime/package.json +++ b/packages/protons-runtime/package.json @@ -131,9 +131,9 @@ "release": "aegir release" }, "dependencies": { - "uint8-varint": "^2.0.4", - "uint8arraylist": "^2.4.8", - "uint8arrays": "^5.1.0" + "uint8-varint": "^3.0.0", + "uint8arraylist": "^3.0.0", + "uint8arrays": "^6.0.0" }, "devDependencies": { "aegir": "^48.0.1" diff --git a/packages/protons-runtime/src/encode.ts b/packages/protons-runtime/src/encode.ts index 5ac8c39..58264a1 100644 --- a/packages/protons-runtime/src/encode.ts +++ b/packages/protons-runtime/src/encode.ts @@ -1,7 +1,7 @@ import { createWriter } from './utils/writer.ts' import type { Codec } from './codec.ts' -export function encodeMessage (message: Partial, codec: Pick, 'encode'>): Uint8Array { +export function encodeMessage (message: Partial, codec: Pick, 'encode'>): Uint8Array { const w = createWriter() codec.encode(message, w, { diff --git a/packages/protons-runtime/src/index.ts b/packages/protons-runtime/src/index.ts index 58a06e2..97233c7 100644 --- a/packages/protons-runtime/src/index.ts +++ b/packages/protons-runtime/src/index.ts @@ -188,7 +188,7 @@ export interface Writer { /** * Finishes the write operation */ - finish(): Uint8Array + finish(): Uint8Array } export interface Reader { @@ -250,7 +250,7 @@ export interface Reader { /** * Reads a sequence of bytes preceded by its length as a varint */ - bytes(): Uint8Array + bytes(): Uint8Array /** * Reads a string preceded by its byte length as a varint diff --git a/packages/protons-runtime/src/utils/pool.ts b/packages/protons-runtime/src/utils/pool.ts index b2ce623..674930e 100644 --- a/packages/protons-runtime/src/utils/pool.ts +++ b/packages/protons-runtime/src/utils/pool.ts @@ -3,10 +3,10 @@ import { allocUnsafe } from 'uint8arrays/alloc' /** * A general purpose buffer pool */ -export default function pool (size?: number): (size: number) => Uint8Array { +export default function pool (size?: number): (size: number) => Uint8Array { const SIZE = size ?? 8192 const MAX = SIZE >>> 1 - let slab: Uint8Array + let slab: Uint8Array let offset = SIZE return function poolAlloc (size: number) { if (size < 1 || size > MAX) { diff --git a/packages/protons-runtime/src/utils/reader.ts b/packages/protons-runtime/src/utils/reader.ts index 5074e38..f4c9860 100644 --- a/packages/protons-runtime/src/utils/reader.ts +++ b/packages/protons-runtime/src/utils/reader.ts @@ -1,4 +1,5 @@ import { decodeUint8Array, encodingLength } from 'uint8-varint' +import { withArrayBuffer } from 'uint8arrays/with-array-buffer' import { readFloatLE, readDoubleLE } from './float.ts' import { LongBits } from './longbits.ts' import * as utf8 from './utf8.ts' @@ -21,7 +22,7 @@ function readFixed32End (buf: Uint8Array, end: number): number { // note that th * Constructs a new reader instance using the specified buffer. */ export class Uint8ArrayReader implements Reader { - public buf: Uint8Array + public buf: Uint8Array public pos: number public len: number @@ -31,7 +32,7 @@ export class Uint8ArrayReader implements Reader { /** * Read buffer */ - this.buf = buffer + this.buf = withArrayBuffer(buffer) /** * Read buffer position @@ -138,7 +139,7 @@ export class Uint8ArrayReader implements Reader { /** * Reads a sequence of bytes preceded by its length as a varint */ - bytes (): Uint8Array { + bytes (): Uint8Array { const length = this.uint32() const start = this.pos const end = this.pos + length diff --git a/packages/protons-runtime/src/utils/writer.ts b/packages/protons-runtime/src/utils/writer.ts index 785729c..f2eb228 100644 --- a/packages/protons-runtime/src/utils/writer.ts +++ b/packages/protons-runtime/src/utils/writer.ts @@ -85,7 +85,7 @@ const bufferPool = pool() /** * Allocates a buffer of the specified size */ -function alloc (size: number): Uint8Array { +function alloc (size: number): Uint8Array { if (globalThis.Buffer != null) { return allocUnsafe(size) } @@ -393,7 +393,7 @@ class Uint8ArrayWriter implements Writer { /** * Finishes the write operation */ - finish (): Uint8Array { + finish (): Uint8Array { let head = this.head.next // skip noop const buf = alloc(this.len) let pos = 0 diff --git a/packages/protons/package.json b/packages/protons/package.json index 0374235..7aba30b 100644 --- a/packages/protons/package.json +++ b/packages/protons/package.json @@ -146,7 +146,7 @@ "long": "^5.3.2", "pbjs": "^0.0.14", "protobufjs": "^7.5.4", - "uint8arraylist": "^2.4.8", - "uint8arrays": "^5.1.0" + "uint8arraylist": "^3.0.0", + "uint8arrays": "^6.0.0" } } diff --git a/packages/protons/src/types/message.ts b/packages/protons/src/types/message.ts index 2431a9e..b3e9681 100644 --- a/packages/protons/src/types/message.ts +++ b/packages/protons/src/types/message.ts @@ -334,7 +334,7 @@ ${enforceOneOfDecoding === '' ? '' : `${enforceOneOfDecoding}\n`} return _codec }${this.formatStreamEvents(streamEvents)} - export function encode (obj: Partial<${this.pbType}>): Uint8Array { + export function encode (obj: Partial<${this.pbType}>): Uint8Array { return encodeMessage(obj, ${this.pbType}.codec()) } diff --git a/packages/protons/test/fixtures/basic.ts b/packages/protons/test/fixtures/basic.ts index 0b39cc6..1204d9f 100644 --- a/packages/protons/test/fixtures/basic.ts +++ b/packages/protons/test/fixtures/basic.ts @@ -102,7 +102,7 @@ export namespace Basic { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Basic.codec()) } @@ -166,7 +166,7 @@ export namespace Empty { return _codec } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Empty.codec()) } diff --git a/packages/protons/test/fixtures/bitswap.ts b/packages/protons/test/fixtures/bitswap.ts index ea91b90..88569d2 100644 --- a/packages/protons/test/fixtures/bitswap.ts +++ b/packages/protons/test/fixtures/bitswap.ts @@ -201,7 +201,7 @@ export namespace Message { value: boolean } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Entry.codec()) } @@ -355,7 +355,7 @@ export namespace Message { value: boolean } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Wantlist.codec()) } @@ -467,7 +467,7 @@ export namespace Message { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Block.codec()) } @@ -595,7 +595,7 @@ export namespace Message { value: Message.BlockPresenceType } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, BlockPresence.codec()) } @@ -871,7 +871,7 @@ export namespace Message { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Message.codec()) } diff --git a/packages/protons/test/fixtures/circuit.ts b/packages/protons/test/fixtures/circuit.ts index b0d4a70..e8ad220 100644 --- a/packages/protons/test/fixtures/circuit.ts +++ b/packages/protons/test/fixtures/circuit.ts @@ -193,7 +193,7 @@ export namespace CircuitRelay { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Peer.codec()) } @@ -354,7 +354,7 @@ export namespace CircuitRelay { value: CircuitRelay.Status } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, CircuitRelay.codec()) } diff --git a/packages/protons/test/fixtures/custom-option-jstype.ts b/packages/protons/test/fixtures/custom-option-jstype.ts index 9cf1988..c54d3a3 100644 --- a/packages/protons/test/fixtures/custom-option-jstype.ts +++ b/packages/protons/test/fixtures/custom-option-jstype.ts @@ -113,7 +113,7 @@ export namespace CustomOptionNumber { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, CustomOptionNumber$i64MapEntry.codec()) } @@ -391,7 +391,7 @@ export namespace CustomOptionNumber { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, CustomOptionNumber.codec()) } @@ -515,7 +515,7 @@ export namespace CustomOptionString { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, CustomOptionString$i64MapEntry.codec()) } @@ -793,7 +793,7 @@ export namespace CustomOptionString { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, CustomOptionString.codec()) } diff --git a/packages/protons/test/fixtures/daemon.ts b/packages/protons/test/fixtures/daemon.ts index 7d882cb..eb52fe9 100644 --- a/packages/protons/test/fixtures/daemon.ts +++ b/packages/protons/test/fixtures/daemon.ts @@ -397,7 +397,7 @@ export namespace Request { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Request.codec()) } @@ -750,7 +750,7 @@ export namespace Response { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Response.codec()) } @@ -881,7 +881,7 @@ export namespace IdentifyResponse { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, IdentifyResponse.codec()) } @@ -1034,7 +1034,7 @@ export namespace ConnectRequest { value: bigint } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, ConnectRequest.codec()) } @@ -1187,7 +1187,7 @@ export namespace StreamOpenRequest { value: bigint } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, StreamOpenRequest.codec()) } @@ -1318,7 +1318,7 @@ export namespace StreamHandlerRequest { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, StreamHandlerRequest.codec()) } @@ -1407,7 +1407,7 @@ export namespace ErrorResponse { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, ErrorResponse.codec()) } @@ -1542,7 +1542,7 @@ export namespace StreamInfo { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, StreamInfo.codec()) } @@ -1793,7 +1793,7 @@ export namespace DHTRequest { value: bigint } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, DHTRequest.codec()) } @@ -1952,7 +1952,7 @@ export namespace DHTResponse { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, DHTResponse.codec()) } @@ -2083,7 +2083,7 @@ export namespace PeerInfo { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, PeerInfo.codec()) } @@ -2256,7 +2256,7 @@ export namespace ConnManagerRequest { value: bigint } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, ConnManagerRequest.codec()) } @@ -2345,7 +2345,7 @@ export namespace DisconnectRequest { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, DisconnectRequest.codec()) } @@ -2498,7 +2498,7 @@ export namespace PSRequest { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, PSRequest.codec()) } @@ -2716,7 +2716,7 @@ export namespace PSMessage { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, PSMessage.codec()) } @@ -2863,7 +2863,7 @@ export namespace PSResponse { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, PSResponse.codec()) } @@ -3034,7 +3034,7 @@ export namespace PeerstoreRequest { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, PeerstoreRequest.codec()) } @@ -3172,7 +3172,7 @@ export namespace PeerstoreResponse { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, PeerstoreResponse.codec()) } diff --git a/packages/protons/test/fixtures/dht.ts b/packages/protons/test/fixtures/dht.ts index 09e261c..0f74130 100644 --- a/packages/protons/test/fixtures/dht.ts +++ b/packages/protons/test/fixtures/dht.ts @@ -164,7 +164,7 @@ export namespace Record { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Record.codec()) } @@ -370,7 +370,7 @@ export namespace Message { value: Message.ConnectionType } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Peer.codec()) } @@ -629,7 +629,7 @@ export namespace Message { index: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Message.codec()) } diff --git a/packages/protons/test/fixtures/maps.ts b/packages/protons/test/fixtures/maps.ts index 413a764..555d248 100644 --- a/packages/protons/test/fixtures/maps.ts +++ b/packages/protons/test/fixtures/maps.ts @@ -138,7 +138,7 @@ export namespace SubMessage { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, SubMessage.codec()) } @@ -259,7 +259,7 @@ export namespace MapTypes { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MapTypes$stringMapEntry.codec()) } @@ -371,7 +371,7 @@ export namespace MapTypes { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MapTypes$intMapEntry.codec()) } @@ -483,7 +483,7 @@ export namespace MapTypes { value: boolean } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MapTypes$boolMapEntry.codec()) } @@ -602,7 +602,7 @@ export namespace MapTypes { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MapTypes$messageMapEntry.codec()) } @@ -714,7 +714,7 @@ export namespace MapTypes { value: EnumValue } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MapTypes$enumMapEntry.codec()) } @@ -1001,7 +1001,7 @@ export namespace MapTypes { value: EnumValue } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MapTypes.codec()) } diff --git a/packages/protons/test/fixtures/noise.ts b/packages/protons/test/fixtures/noise.ts index 3b224c6..c8189f2 100644 --- a/packages/protons/test/fixtures/noise.ts +++ b/packages/protons/test/fixtures/noise.ts @@ -130,7 +130,7 @@ export namespace pb { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, NoiseHandshakePayload.codec()) } @@ -191,7 +191,7 @@ export namespace pb { return _codec } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, pb.codec()) } diff --git a/packages/protons/test/fixtures/oneof.ts b/packages/protons/test/fixtures/oneof.ts index 3b6bdfd..0dcf493 100644 --- a/packages/protons/test/fixtures/oneof.ts +++ b/packages/protons/test/fixtures/oneof.ts @@ -216,7 +216,7 @@ export namespace OneOfMessage { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, OneOfMessage.codec()) } @@ -397,7 +397,7 @@ export namespace MessageWithoutOneOfs { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithoutOneOfs.codec()) } diff --git a/packages/protons/test/fixtures/optional.ts b/packages/protons/test/fixtures/optional.ts index c8d1830..1535de3 100644 --- a/packages/protons/test/fixtures/optional.ts +++ b/packages/protons/test/fixtures/optional.ts @@ -116,7 +116,7 @@ export namespace OptionalSubMessage { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, OptionalSubMessage.codec()) } @@ -562,7 +562,7 @@ export namespace Optional { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Optional.codec()) } diff --git a/packages/protons/test/fixtures/peer.ts b/packages/protons/test/fixtures/peer.ts index aa01497..cbde385 100644 --- a/packages/protons/test/fixtures/peer.ts +++ b/packages/protons/test/fixtures/peer.ts @@ -242,7 +242,7 @@ export namespace Peer { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Peer.codec()) } @@ -353,7 +353,7 @@ export namespace Address { value: boolean } - export function encode (obj: Partial
): Uint8Array { + export function encode (obj: Partial
): Uint8Array { return encodeMessage(obj, Address.codec()) } @@ -465,7 +465,7 @@ export namespace Metadata { value: Uint8Array } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Metadata.codec()) } diff --git a/packages/protons/test/fixtures/proto2.ts b/packages/protons/test/fixtures/proto2.ts index 3ba5009..3a7e398 100644 --- a/packages/protons/test/fixtures/proto2.ts +++ b/packages/protons/test/fixtures/proto2.ts @@ -78,7 +78,7 @@ export namespace MessageWithRequired { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithRequired.codec()) } diff --git a/packages/protons/test/fixtures/protons-options.ts b/packages/protons/test/fixtures/protons-options.ts index 7a5e028..763917c 100644 --- a/packages/protons/test/fixtures/protons-options.ts +++ b/packages/protons/test/fixtures/protons-options.ts @@ -105,7 +105,7 @@ export namespace MessageWithSizeLimitedRepeatedField { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithSizeLimitedRepeatedField.codec()) } @@ -222,7 +222,7 @@ export namespace MessageWithSizeLimitedMap { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithSizeLimitedMap$mapFieldEntry.codec()) } @@ -338,7 +338,7 @@ export namespace MessageWithSizeLimitedMap { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithSizeLimitedMap.codec()) } diff --git a/packages/protons/test/fixtures/repeated.ts b/packages/protons/test/fixtures/repeated.ts index 36a3d0a..dfc8db0 100644 --- a/packages/protons/test/fixtures/repeated.ts +++ b/packages/protons/test/fixtures/repeated.ts @@ -119,7 +119,7 @@ export namespace SubSubMessage { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, SubSubMessage.codec()) } @@ -329,7 +329,7 @@ export namespace SubMessage { index: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, SubMessage.codec()) } @@ -633,7 +633,7 @@ export namespace RepeatedTypes { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, RepeatedTypes.codec()) } diff --git a/packages/protons/test/fixtures/singular.ts b/packages/protons/test/fixtures/singular.ts index 4b6f3df..5c55221 100644 --- a/packages/protons/test/fixtures/singular.ts +++ b/packages/protons/test/fixtures/singular.ts @@ -120,7 +120,7 @@ export namespace SingularSubMessage { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, SingularSubMessage.codec()) } @@ -583,7 +583,7 @@ export namespace Singular { value: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, Singular.codec()) } diff --git a/packages/protons/test/fixtures/streaming.ts b/packages/protons/test/fixtures/streaming.ts index 2eb285f..9292436 100644 --- a/packages/protons/test/fixtures/streaming.ts +++ b/packages/protons/test/fixtures/streaming.ts @@ -141,7 +141,7 @@ export namespace MessageWithArrayField { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithArrayField.codec()) } @@ -230,7 +230,7 @@ export namespace NestedMessage { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, NestedMessage.codec()) } @@ -343,7 +343,7 @@ export namespace MessageWithNestedMessage { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithNestedMessage.codec()) } @@ -461,7 +461,7 @@ export namespace MessageWithDeeplyNestedMessage { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithDeeplyNestedMessage.codec()) } @@ -597,7 +597,7 @@ export namespace MessageWithRepeatedMessage { index: number } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithRepeatedMessage.codec()) } @@ -716,7 +716,7 @@ export namespace MessageWithMapMessage { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithMapMessage$nestedMessagesEntry.codec()) } @@ -846,7 +846,7 @@ export namespace MessageWithMapMessage { key: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithMapMessage.codec()) } @@ -964,7 +964,7 @@ export namespace MessageWithPrimitiveMap { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithPrimitiveMap$nestedStringsEntry.codec()) } @@ -1094,7 +1094,7 @@ export namespace MessageWithPrimitiveMap { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, MessageWithPrimitiveMap.codec()) } diff --git a/packages/protons/test/fixtures/test.ts b/packages/protons/test/fixtures/test.ts index 320b2cf..46bbd10 100644 --- a/packages/protons/test/fixtures/test.ts +++ b/packages/protons/test/fixtures/test.ts @@ -94,7 +94,7 @@ export namespace SubMessage { value: string } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, SubMessage.codec()) } @@ -578,7 +578,7 @@ export namespace AllTheTypes { value: bigint } - export function encode (obj: Partial): Uint8Array { + export function encode (obj: Partial): Uint8Array { return encodeMessage(obj, AllTheTypes.codec()) }