From 7d1cca82d9fd2586a280bec52bde8d2996f777ca Mon Sep 17 00:00:00 2001 From: Steven Borrelli Date: Mon, 12 Jan 2026 11:00:59 +0000 Subject: [PATCH 1/3] add protoc to ci.yaml workflow Signed-off-by: Steven Borrelli --- .github/workflows/ci.yaml | 134 +++++++++++++++++++++++--------------- package.json | 1 + 2 files changed, 83 insertions(+), 52 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6b93eba..b4cace2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,59 +1,89 @@ name: CI on: - push: - branches: - - main - - release-* - pull_request: {} + push: + branches: + - main + - release-* + pull_request: {} env: - NODE_VERSION: "25" + NODE_VERSION: "25" jobs: - lint: - runs-on: ubuntu-24.04 - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Install - uses: actions/setup-node@v6 - with: - node-version: ${{env.NODE_VERSION}} - - run: npm ci - - - name: Lint - run: npm run lint - - test: - runs-on: ubuntu-24.04 - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Install - uses: actions/setup-node@v6 - with: - node-version: ${{env.NODE_VERSION}} - - run: npm ci - - - name: test - run: npm test - - build: - runs-on: ubuntu-24.04 - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Build - uses: actions/setup-node@v6 - with: - node-version: ${{env.NODE_VERSION}} - - run: npm ci - - run: npm run clean - - run: npm run build + protobuf-check: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Install + uses: actions/setup-node@v6 + with: + node-version: ${{env.NODE_VERSION}} + - run: npm ci + + - name: Install Protoc + uses: arduino/setup-protoc@v3 + + - name: Generate Protobuf Files + run: npm run protoc-gen + + - name: Check for changes in src + run: | + if [[ -n $(git status --porcelain src) ]]; then + echo "Error: Protobuf generation caused changes in src directory" + echo "Please run 'npm run protoc-gen' locally and commit the changes" + git --no-pager status src + git --no-pager diff src + exit 1 + fi + echo "No changes detected in src directory" + + lint: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Install + uses: actions/setup-node@v6 + with: + node-version: ${{env.NODE_VERSION}} + - run: npm ci + + - name: Lint + run: npm run lint + + test: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Install + uses: actions/setup-node@v6 + with: + node-version: ${{env.NODE_VERSION}} + - run: npm ci + + - name: test + run: npm test + + build: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Build + uses: actions/setup-node@v6 + with: + node-version: ${{env.NODE_VERSION}} + - run: npm ci + - run: npm run clean + - run: npm run build diff --git a/package.json b/package.json index e8a0d86..0c17408 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ ], "scripts": { "clean": "scripts/clean.sh", + "protoc-gen": "scripts/protoc-gen.sh", "build": "npx tsc", "pack": "npm pack", "prepublishOnly": "npm run build", From 7c57fa79b57ae853a1c80a69f75499aeb9eb4f6b Mon Sep 17 00:00:00 2001 From: Steven Borrelli Date: Mon, 12 Jan 2026 11:27:44 +0000 Subject: [PATCH 2/3] update protoc used in ci action Signed-off-by: Steven Borrelli --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b4cace2..c4f99b2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,6 +26,8 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v3 + with: + version: "33.0" - name: Generate Protobuf Files run: npm run protoc-gen From 0714c38881644c3c232cad7e5ea65bb5824fe3cb Mon Sep 17 00:00:00 2001 From: Steven Borrelli Date: Mon, 12 Jan 2026 11:31:28 +0000 Subject: [PATCH 3/3] update generated protobuf files Signed-off-by: Steven Borrelli --- .github/workflows/ci.yaml | 1 + src/proto/google/protobuf/duration.ts | 2 +- src/proto/google/protobuf/struct.ts | 25 ++-- src/proto/run_function.ts | 207 +++++++++++++++----------- 4 files changed, 133 insertions(+), 102 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c4f99b2..145933f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,6 +24,7 @@ jobs: node-version: ${{env.NODE_VERSION}} - run: npm ci + # Update this version when ts-proto in package.json is updated - name: Install Protoc uses: arduino/setup-protoc@v3 with: diff --git a/src/proto/google/protobuf/duration.ts b/src/proto/google/protobuf/duration.ts index 16bd020..2230ea0 100644 --- a/src/proto/google/protobuf/duration.ts +++ b/src/proto/google/protobuf/duration.ts @@ -1,6 +1,6 @@ // Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: -// protoc-gen-ts_proto v2.8.3 +// protoc-gen-ts_proto v2.10.1 // protoc v6.33.0 // source: google/protobuf/duration.proto diff --git a/src/proto/google/protobuf/struct.ts b/src/proto/google/protobuf/struct.ts index 7a27dae..b5ee227 100644 --- a/src/proto/google/protobuf/struct.ts +++ b/src/proto/google/protobuf/struct.ts @@ -1,6 +1,6 @@ // Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: -// protoc-gen-ts_proto v2.8.3 +// protoc-gen-ts_proto v2.10.1 // protoc v6.33.0 // source: google/protobuf/struct.proto @@ -112,7 +112,7 @@ function createBaseStruct(): Struct { export const Struct: MessageFns & StructWrapperFns = { encode(message: Struct, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - Object.entries(message.fields).forEach(([key, value]) => { + globalThis.Object.entries(message.fields).forEach(([key, value]: [string, any | undefined]) => { if (value !== undefined) { Struct_FieldsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); } @@ -150,10 +150,13 @@ export const Struct: MessageFns & StructWrapperFns = { fromJSON(object: any): Struct { return { fields: isObject(object.fields) - ? Object.entries(object.fields).reduce<{ [key: string]: any | undefined }>((acc, [key, value]) => { - acc[key] = value as any | undefined; - return acc; - }, {}) + ? (globalThis.Object.entries(object.fields) as [string, any][]).reduce( + (acc: { [key: string]: any | undefined }, [key, value]: [string, any]) => { + acc[key] = value as any | undefined; + return acc; + }, + {}, + ) : {}, }; }, @@ -161,7 +164,7 @@ export const Struct: MessageFns & StructWrapperFns = { toJSON(message: Struct): unknown { const obj: any = {}; if (message.fields) { - const entries = Object.entries(message.fields); + const entries = globalThis.Object.entries(message.fields) as [string, any | undefined][]; if (entries.length > 0) { obj.fields = {}; entries.forEach(([k, v]) => { @@ -177,8 +180,8 @@ export const Struct: MessageFns & StructWrapperFns = { }, fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); - message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( - (acc, [key, value]) => { + message.fields = (globalThis.Object.entries(object.fields ?? {}) as [string, any | undefined][]).reduce( + (acc: { [key: string]: any | undefined }, [key, value]: [string, any | undefined]) => { if (value !== undefined) { acc[key] = value; } @@ -193,7 +196,7 @@ export const Struct: MessageFns & StructWrapperFns = { const struct = createBaseStruct(); if (object !== undefined) { - for (const key of Object.keys(object)) { + for (const key of globalThis.Object.keys(object)) { struct.fields[key] = object[key]; } } @@ -203,7 +206,7 @@ export const Struct: MessageFns & StructWrapperFns = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; if (message.fields) { - for (const key of Object.keys(message.fields)) { + for (const key of globalThis.Object.keys(message.fields)) { object[key] = message.fields[key]; } } diff --git a/src/proto/run_function.ts b/src/proto/run_function.ts index bb0609c..60fbcc5 100644 --- a/src/proto/run_function.ts +++ b/src/proto/run_function.ts @@ -1,6 +1,6 @@ // Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: -// protoc-gen-ts_proto v2.8.3 +// protoc-gen-ts_proto v2.10.1 // protoc v6.33.0 // source: run_function.proto @@ -623,13 +623,13 @@ export const RunFunctionRequest: MessageFns = { if (message.context !== undefined) { Struct.encode(Struct.wrap(message.context), writer.uint32(42).fork()).join(); } - Object.entries(message.extraResources).forEach(([key, value]) => { + globalThis.Object.entries(message.extraResources).forEach(([key, value]: [string, Resources]) => { RunFunctionRequest_ExtraResourcesEntry.encode({ key: key as any, value }, writer.uint32(50).fork()).join(); }); - Object.entries(message.credentials).forEach(([key, value]) => { + globalThis.Object.entries(message.credentials).forEach(([key, value]: [string, Credentials]) => { RunFunctionRequest_CredentialsEntry.encode({ key: key as any, value }, writer.uint32(58).fork()).join(); }); - Object.entries(message.requiredResources).forEach(([key, value]) => { + globalThis.Object.entries(message.requiredResources).forEach(([key, value]: [string, Resources]) => { RunFunctionRequest_RequiredResourcesEntry.encode({ key: key as any, value }, writer.uint32(66).fork()).join(); }); return writer; @@ -732,22 +732,31 @@ export const RunFunctionRequest: MessageFns = { input: isObject(object.input) ? object.input : undefined, context: isObject(object.context) ? object.context : undefined, extraResources: isObject(object.extraResources) - ? Object.entries(object.extraResources).reduce<{ [key: string]: Resources }>((acc, [key, value]) => { - acc[key] = Resources.fromJSON(value); - return acc; - }, {}) + ? (globalThis.Object.entries(object.extraResources) as [string, any][]).reduce( + (acc: { [key: string]: Resources }, [key, value]: [string, any]) => { + acc[key] = Resources.fromJSON(value); + return acc; + }, + {}, + ) : {}, credentials: isObject(object.credentials) - ? Object.entries(object.credentials).reduce<{ [key: string]: Credentials }>((acc, [key, value]) => { - acc[key] = Credentials.fromJSON(value); - return acc; - }, {}) + ? (globalThis.Object.entries(object.credentials) as [string, any][]).reduce( + (acc: { [key: string]: Credentials }, [key, value]: [string, any]) => { + acc[key] = Credentials.fromJSON(value); + return acc; + }, + {}, + ) : {}, requiredResources: isObject(object.requiredResources) - ? Object.entries(object.requiredResources).reduce<{ [key: string]: Resources }>((acc, [key, value]) => { - acc[key] = Resources.fromJSON(value); - return acc; - }, {}) + ? (globalThis.Object.entries(object.requiredResources) as [string, any][]).reduce( + (acc: { [key: string]: Resources }, [key, value]: [string, any]) => { + acc[key] = Resources.fromJSON(value); + return acc; + }, + {}, + ) : {}, }; }, @@ -770,7 +779,7 @@ export const RunFunctionRequest: MessageFns = { obj.context = message.context; } if (message.extraResources) { - const entries = Object.entries(message.extraResources); + const entries = globalThis.Object.entries(message.extraResources) as [string, Resources][]; if (entries.length > 0) { obj.extraResources = {}; entries.forEach(([k, v]) => { @@ -779,7 +788,7 @@ export const RunFunctionRequest: MessageFns = { } } if (message.credentials) { - const entries = Object.entries(message.credentials); + const entries = globalThis.Object.entries(message.credentials) as [string, Credentials][]; if (entries.length > 0) { obj.credentials = {}; entries.forEach(([k, v]) => { @@ -788,7 +797,7 @@ export const RunFunctionRequest: MessageFns = { } } if (message.requiredResources) { - const entries = Object.entries(message.requiredResources); + const entries = globalThis.Object.entries(message.requiredResources) as [string, Resources][]; if (entries.length > 0) { obj.requiredResources = {}; entries.forEach(([k, v]) => { @@ -815,8 +824,8 @@ export const RunFunctionRequest: MessageFns = { : undefined; message.input = object.input ?? undefined; message.context = object.context ?? undefined; - message.extraResources = Object.entries(object.extraResources ?? {}).reduce<{ [key: string]: Resources }>( - (acc, [key, value]) => { + message.extraResources = (globalThis.Object.entries(object.extraResources ?? {}) as [string, Resources][]).reduce( + (acc: { [key: string]: Resources }, [key, value]: [string, Resources]) => { if (value !== undefined) { acc[key] = Resources.fromPartial(value); } @@ -824,8 +833,8 @@ export const RunFunctionRequest: MessageFns = { }, {}, ); - message.credentials = Object.entries(object.credentials ?? {}).reduce<{ [key: string]: Credentials }>( - (acc, [key, value]) => { + message.credentials = (globalThis.Object.entries(object.credentials ?? {}) as [string, Credentials][]).reduce( + (acc: { [key: string]: Credentials }, [key, value]: [string, Credentials]) => { if (value !== undefined) { acc[key] = Credentials.fromPartial(value); } @@ -833,15 +842,13 @@ export const RunFunctionRequest: MessageFns = { }, {}, ); - message.requiredResources = Object.entries(object.requiredResources ?? {}).reduce<{ [key: string]: Resources }>( - (acc, [key, value]) => { + message.requiredResources = (globalThis.Object.entries(object.requiredResources ?? {}) as [string, Resources][]) + .reduce((acc: { [key: string]: Resources }, [key, value]: [string, Resources]) => { if (value !== undefined) { acc[key] = Resources.fromPartial(value); } return acc; - }, - {}, - ); + }, {}); return message; }, }; @@ -1160,7 +1167,7 @@ function createBaseCredentialData(): CredentialData { export const CredentialData: MessageFns = { encode(message: CredentialData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - Object.entries(message.data).forEach(([key, value]) => { + globalThis.Object.entries(message.data).forEach(([key, value]: [string, Buffer]) => { CredentialData_DataEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); }); return writer; @@ -1196,10 +1203,13 @@ export const CredentialData: MessageFns = { fromJSON(object: any): CredentialData { return { data: isObject(object.data) - ? Object.entries(object.data).reduce<{ [key: string]: Buffer }>((acc, [key, value]) => { - acc[key] = Buffer.from(bytesFromBase64(value as string)); - return acc; - }, {}) + ? (globalThis.Object.entries(object.data) as [string, any][]).reduce( + (acc: { [key: string]: Buffer }, [key, value]: [string, any]) => { + acc[key] = Buffer.from(bytesFromBase64(value as string)); + return acc; + }, + {}, + ) : {}, }; }, @@ -1207,7 +1217,7 @@ export const CredentialData: MessageFns = { toJSON(message: CredentialData): unknown { const obj: any = {}; if (message.data) { - const entries = Object.entries(message.data); + const entries = globalThis.Object.entries(message.data) as [string, Buffer][]; if (entries.length > 0) { obj.data = {}; entries.forEach(([k, v]) => { @@ -1223,12 +1233,15 @@ export const CredentialData: MessageFns = { }, fromPartial, I>>(object: I): CredentialData { const message = createBaseCredentialData(); - message.data = Object.entries(object.data ?? {}).reduce<{ [key: string]: Buffer }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = value; - } - return acc; - }, {}); + message.data = (globalThis.Object.entries(object.data ?? {}) as [string, Buffer][]).reduce( + (acc: { [key: string]: Buffer }, [key, value]: [string, Buffer]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, + {}, + ); return message; }, }; @@ -1603,10 +1616,10 @@ function createBaseRequirements(): Requirements { export const Requirements: MessageFns = { encode(message: Requirements, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - Object.entries(message.extraResources).forEach(([key, value]) => { + globalThis.Object.entries(message.extraResources).forEach(([key, value]: [string, ResourceSelector]) => { Requirements_ExtraResourcesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); }); - Object.entries(message.resources).forEach(([key, value]) => { + globalThis.Object.entries(message.resources).forEach(([key, value]: [string, ResourceSelector]) => { Requirements_ResourcesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); }); return writer; @@ -1653,16 +1666,22 @@ export const Requirements: MessageFns = { fromJSON(object: any): Requirements { return { extraResources: isObject(object.extraResources) - ? Object.entries(object.extraResources).reduce<{ [key: string]: ResourceSelector }>((acc, [key, value]) => { - acc[key] = ResourceSelector.fromJSON(value); - return acc; - }, {}) + ? (globalThis.Object.entries(object.extraResources) as [string, any][]).reduce( + (acc: { [key: string]: ResourceSelector }, [key, value]: [string, any]) => { + acc[key] = ResourceSelector.fromJSON(value); + return acc; + }, + {}, + ) : {}, resources: isObject(object.resources) - ? Object.entries(object.resources).reduce<{ [key: string]: ResourceSelector }>((acc, [key, value]) => { - acc[key] = ResourceSelector.fromJSON(value); - return acc; - }, {}) + ? (globalThis.Object.entries(object.resources) as [string, any][]).reduce( + (acc: { [key: string]: ResourceSelector }, [key, value]: [string, any]) => { + acc[key] = ResourceSelector.fromJSON(value); + return acc; + }, + {}, + ) : {}, }; }, @@ -1670,7 +1689,7 @@ export const Requirements: MessageFns = { toJSON(message: Requirements): unknown { const obj: any = {}; if (message.extraResources) { - const entries = Object.entries(message.extraResources); + const entries = globalThis.Object.entries(message.extraResources) as [string, ResourceSelector][]; if (entries.length > 0) { obj.extraResources = {}; entries.forEach(([k, v]) => { @@ -1679,7 +1698,7 @@ export const Requirements: MessageFns = { } } if (message.resources) { - const entries = Object.entries(message.resources); + const entries = globalThis.Object.entries(message.resources) as [string, ResourceSelector][]; if (entries.length > 0) { obj.resources = {}; entries.forEach(([k, v]) => { @@ -1695,17 +1714,15 @@ export const Requirements: MessageFns = { }, fromPartial, I>>(object: I): Requirements { const message = createBaseRequirements(); - message.extraResources = Object.entries(object.extraResources ?? {}).reduce<{ [key: string]: ResourceSelector }>( - (acc, [key, value]) => { + message.extraResources = (globalThis.Object.entries(object.extraResources ?? {}) as [string, ResourceSelector][]) + .reduce((acc: { [key: string]: ResourceSelector }, [key, value]: [string, ResourceSelector]) => { if (value !== undefined) { acc[key] = ResourceSelector.fromPartial(value); } return acc; - }, - {}, - ); - message.resources = Object.entries(object.resources ?? {}).reduce<{ [key: string]: ResourceSelector }>( - (acc, [key, value]) => { + }, {}); + message.resources = (globalThis.Object.entries(object.resources ?? {}) as [string, ResourceSelector][]).reduce( + (acc: { [key: string]: ResourceSelector }, [key, value]: [string, ResourceSelector]) => { if (value !== undefined) { acc[key] = ResourceSelector.fromPartial(value); } @@ -2009,7 +2026,7 @@ function createBaseMatchLabels(): MatchLabels { export const MatchLabels: MessageFns = { encode(message: MatchLabels, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - Object.entries(message.labels).forEach(([key, value]) => { + globalThis.Object.entries(message.labels).forEach(([key, value]: [string, string]) => { MatchLabels_LabelsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); }); return writer; @@ -2045,10 +2062,13 @@ export const MatchLabels: MessageFns = { fromJSON(object: any): MatchLabels { return { labels: isObject(object.labels) - ? Object.entries(object.labels).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) + ? (globalThis.Object.entries(object.labels) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + acc[key] = globalThis.String(value); + return acc; + }, + {}, + ) : {}, }; }, @@ -2056,7 +2076,7 @@ export const MatchLabels: MessageFns = { toJSON(message: MatchLabels): unknown { const obj: any = {}; if (message.labels) { - const entries = Object.entries(message.labels); + const entries = globalThis.Object.entries(message.labels) as [string, string][]; if (entries.length > 0) { obj.labels = {}; entries.forEach(([k, v]) => { @@ -2072,12 +2092,15 @@ export const MatchLabels: MessageFns = { }, fromPartial, I>>(object: I): MatchLabels { const message = createBaseMatchLabels(); - message.labels = Object.entries(object.labels ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = globalThis.String(value); - } - return acc; - }, {}); + message.labels = (globalThis.Object.entries(object.labels ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); return message; }, }; @@ -2243,7 +2266,7 @@ export const State: MessageFns = { if (message.composite !== undefined) { Resource.encode(message.composite, writer.uint32(10).fork()).join(); } - Object.entries(message.resources).forEach(([key, value]) => { + globalThis.Object.entries(message.resources).forEach(([key, value]: [string, Resource]) => { State_ResourcesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); }); return writer; @@ -2288,10 +2311,13 @@ export const State: MessageFns = { return { composite: isSet(object.composite) ? Resource.fromJSON(object.composite) : undefined, resources: isObject(object.resources) - ? Object.entries(object.resources).reduce<{ [key: string]: Resource }>((acc, [key, value]) => { - acc[key] = Resource.fromJSON(value); - return acc; - }, {}) + ? (globalThis.Object.entries(object.resources) as [string, any][]).reduce( + (acc: { [key: string]: Resource }, [key, value]: [string, any]) => { + acc[key] = Resource.fromJSON(value); + return acc; + }, + {}, + ) : {}, }; }, @@ -2302,7 +2328,7 @@ export const State: MessageFns = { obj.composite = Resource.toJSON(message.composite); } if (message.resources) { - const entries = Object.entries(message.resources); + const entries = globalThis.Object.entries(message.resources) as [string, Resource][]; if (entries.length > 0) { obj.resources = {}; entries.forEach(([k, v]) => { @@ -2321,8 +2347,8 @@ export const State: MessageFns = { message.composite = (object.composite !== undefined && object.composite !== null) ? Resource.fromPartial(object.composite) : undefined; - message.resources = Object.entries(object.resources ?? {}).reduce<{ [key: string]: Resource }>( - (acc, [key, value]) => { + message.resources = (globalThis.Object.entries(object.resources ?? {}) as [string, Resource][]).reduce( + (acc: { [key: string]: Resource }, [key, value]: [string, Resource]) => { if (value !== undefined) { acc[key] = Resource.fromPartial(value); } @@ -2421,7 +2447,7 @@ export const Resource: MessageFns = { if (message.resource !== undefined) { Struct.encode(Struct.wrap(message.resource), writer.uint32(10).fork()).join(); } - Object.entries(message.connectionDetails).forEach(([key, value]) => { + globalThis.Object.entries(message.connectionDetails).forEach(([key, value]: [string, Buffer]) => { Resource_ConnectionDetailsEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); }); if (message.ready !== 0) { @@ -2477,10 +2503,13 @@ export const Resource: MessageFns = { return { resource: isObject(object.resource) ? object.resource : undefined, connectionDetails: isObject(object.connectionDetails) - ? Object.entries(object.connectionDetails).reduce<{ [key: string]: Buffer }>((acc, [key, value]) => { - acc[key] = Buffer.from(bytesFromBase64(value as string)); - return acc; - }, {}) + ? (globalThis.Object.entries(object.connectionDetails) as [string, any][]).reduce( + (acc: { [key: string]: Buffer }, [key, value]: [string, any]) => { + acc[key] = Buffer.from(bytesFromBase64(value as string)); + return acc; + }, + {}, + ) : {}, ready: isSet(object.ready) ? readyFromJSON(object.ready) : 0, }; @@ -2492,7 +2521,7 @@ export const Resource: MessageFns = { obj.resource = message.resource; } if (message.connectionDetails) { - const entries = Object.entries(message.connectionDetails); + const entries = globalThis.Object.entries(message.connectionDetails) as [string, Buffer][]; if (entries.length > 0) { obj.connectionDetails = {}; entries.forEach(([k, v]) => { @@ -2512,15 +2541,13 @@ export const Resource: MessageFns = { fromPartial, I>>(object: I): Resource { const message = createBaseResource(); message.resource = object.resource ?? undefined; - message.connectionDetails = Object.entries(object.connectionDetails ?? {}).reduce<{ [key: string]: Buffer }>( - (acc, [key, value]) => { + message.connectionDetails = (globalThis.Object.entries(object.connectionDetails ?? {}) as [string, Buffer][]) + .reduce((acc: { [key: string]: Buffer }, [key, value]: [string, Buffer]) => { if (value !== undefined) { acc[key] = value; } return acc; - }, - {}, - ); + }, {}); message.ready = object.ready ?? 0; return message; },