From b263884352d83099dc43e3dbfd2da74ea84ba3e2 Mon Sep 17 00:00:00 2001 From: Simon Chan <1330321+yume-chan@users.noreply.github.com> Date: Sun, 4 Jun 2023 23:31:01 +0800 Subject: [PATCH] chore: fix typo --- .github/workflows/pull_request.yml | 2 +- .github/workflows/test.yml | 2 +- .vscode/settings.json | 1 + libraries/adb/src/commands/reverse.ts | 2 +- libraries/adb/src/commands/sync/list.ts | 4 ++-- libraries/adb/src/commands/sync/request.ts | 2 +- libraries/adb/src/daemon/packet.ts | 2 +- libraries/scrcpy/src/options/1_18.ts | 2 +- libraries/scrcpy/src/options/1_22/scroll.ts | 2 +- libraries/struct/README.md | 10 +++++----- 10 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 877e1bcb..eb542b31 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x] + node-version: [18.x] steps: - name: Checkout diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f035c670..0aeeb35c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [18.x, 20.x] + node-version: [18.x] steps: - name: Checkout diff --git a/.vscode/settings.json b/.vscode/settings.json index 4cccf063..9828f883 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,6 +15,7 @@ "CNXN", "colour", "comlink", + "concat", "Demuxer", "Deserialization", "DESERIALIZERS", diff --git a/libraries/adb/src/commands/reverse.ts b/libraries/adb/src/commands/reverse.ts index 3377ad7e..ffe4442b 100644 --- a/libraries/adb/src/commands/reverse.ts +++ b/libraries/adb/src/commands/reverse.ts @@ -35,7 +35,7 @@ export class AdbReverseNotSupportedError extends AdbReverseError { } const AdbReverseErrorResponse = new Struct() - .fields(AdbReverseStringResponse) + .concat(AdbReverseStringResponse) .postDeserialize((value) => { // https://issuetracker.google.com/issues/37066218 // ADB on Android <9 can't create reverse tunnels when connected wirelessly (ADB over WiFi), diff --git a/libraries/adb/src/commands/sync/list.ts b/libraries/adb/src/commands/sync/list.ts index cce39b44..69c045c7 100644 --- a/libraries/adb/src/commands/sync/list.ts +++ b/libraries/adb/src/commands/sync/list.ts @@ -11,7 +11,7 @@ export interface AdbSyncEntry extends AdbSyncStat { } export const AdbSyncEntryResponse = new Struct({ littleEndian: true }) - .fields(AdbSyncLstatResponse) + .concat(AdbSyncLstatResponse) .uint32("nameLength") .string("name", { lengthField: "nameLength" }) .extra({ id: AdbSyncResponseId.Entry as const }); @@ -20,7 +20,7 @@ export type AdbSyncEntryResponse = (typeof AdbSyncEntryResponse)["TDeserializeResult"]; export const AdbSyncEntry2Response = new Struct({ littleEndian: true }) - .fields(AdbSyncStatResponse) + .concat(AdbSyncStatResponse) .uint32("nameLength") .string("name", { lengthField: "nameLength" }) .extra({ id: AdbSyncResponseId.Entry2 as const }); diff --git a/libraries/adb/src/commands/sync/request.ts b/libraries/adb/src/commands/sync/request.ts index eedb6d4f..357c1b67 100644 --- a/libraries/adb/src/commands/sync/request.ts +++ b/libraries/adb/src/commands/sync/request.ts @@ -20,7 +20,7 @@ export const AdbSyncNumberRequest = new Struct({ littleEndian: true }) .uint32("arg"); export const AdbSyncDataRequest = new Struct({ littleEndian: true }) - .fields(AdbSyncNumberRequest) + .concat(AdbSyncNumberRequest) .uint8Array("data", { lengthField: "arg" }); export interface AdbSyncWritable { diff --git a/libraries/adb/src/daemon/packet.ts b/libraries/adb/src/daemon/packet.ts index 14877a07..ef713cc3 100644 --- a/libraries/adb/src/daemon/packet.ts +++ b/libraries/adb/src/daemon/packet.ts @@ -23,7 +23,7 @@ export type AdbPacketHeader = (typeof AdbPacketHeader)["TDeserializeResult"]; type AdbPacketHeaderInit = (typeof AdbPacketHeader)["TInit"]; export const AdbPacket = new Struct({ littleEndian: true }) - .fields(AdbPacketHeader) + .concat(AdbPacketHeader) .uint8Array("payload", { lengthField: "payloadLength" }); export type AdbPacket = (typeof AdbPacket)["TDeserializeResult"]; diff --git a/libraries/scrcpy/src/options/1_18.ts b/libraries/scrcpy/src/options/1_18.ts index e8832db1..ab2169b9 100644 --- a/libraries/scrcpy/src/options/1_18.ts +++ b/libraries/scrcpy/src/options/1_18.ts @@ -45,7 +45,7 @@ export interface ScrcpyOptionsInit1_18 } export const ScrcpyBackOrScreenOnControlMessage1_18 = new Struct() - .fields(ScrcpyBackOrScreenOnControlMessage1_16) + .concat(ScrcpyBackOrScreenOnControlMessage1_16) .uint8("action", placeholder()); export type ScrcpyBackOrScreenOnControlMessage1_18 = diff --git a/libraries/scrcpy/src/options/1_22/scroll.ts b/libraries/scrcpy/src/options/1_22/scroll.ts index 40a59cc3..4a65ff9d 100644 --- a/libraries/scrcpy/src/options/1_22/scroll.ts +++ b/libraries/scrcpy/src/options/1_22/scroll.ts @@ -6,7 +6,7 @@ import { } from "../1_16/index.js"; export const ScrcpyInjectScrollControlMessage1_22 = new Struct() - .fields(ScrcpyInjectScrollControlMessage1_16) + .concat(ScrcpyInjectScrollControlMessage1_16) .int32("buttons"); export type ScrcpyInjectScrollControlMessage1_22 = diff --git a/libraries/struct/README.md b/libraries/struct/README.md index 917cf640..a6353cda 100644 --- a/libraries/struct/README.md +++ b/libraries/struct/README.md @@ -60,7 +60,7 @@ const buffer = MyStruct.serialize({ - [`int8`/`uint8`/`int16`/`uint16`/`int32`/`uint32`](#int8uint8int16uint16int32uint32) - [`int64`/`uint64`](#int64uint64-1) - [`uint8Array`/`string`](#uint8arraystring) - - [`fields`](#fields) + - [`concat`](#concat) - [`extra`](#extra) - [`postDeserialize`](#postdeserialize) - [`deserialize`](#deserialize) @@ -332,10 +332,10 @@ The `options` parameter defines its length, it supports two formats: - `{ length: number }`: Presence of the `length` option indicates that it's a fixed length array. - `{ lengthField: string; lengthFieldRadix?: number }`: Presence of the `lengthField` option indicates it's a variable length array. The `lengthField` options must refers to a `number` or `string` (can't be `bigint`) typed field that's already defined in this `Struct`. If the length field is a `string`, the optional `lengthFieldRadix` option (defaults to `10`) defines the radix when converting the string to a number. When deserializing, it will use that field's value as its length. When serializing, it will write its length to that field. -#### `fields` +#### `concat` ```ts -fields< +concat< TOther extends Struct >( other: TOther @@ -356,7 +356,7 @@ Merges (flats) another `Struct`'s fields and extra fields into the current one. ```ts const MyStructV1 = new Struct().int32("field1"); - const MyStructV2 = new Struct().fields(MyStructV1).int32("field2"); + const MyStructV2 = new Struct().concat(MyStructV1).int32("field2"); const structV2 = await MyStructV2.deserialize(stream); structV2.field1; // number @@ -369,7 +369,7 @@ Merges (flats) another `Struct`'s fields and extra fields into the current one. ```ts const MyStructV1 = new Struct().int32("field1"); - const MyStructV2 = new Struct().int32("field2").fields(MyStructV1); + const MyStructV2 = new Struct().int32("field2").concat(MyStructV1); const structV2 = await MyStructV2.deserialize(stream); structV2.field1; // number