From 931f3788439123ab98503118699bde1da3eeb2b4 Mon Sep 17 00:00:00 2001 From: jbiskur Date: Mon, 30 Mar 2026 11:52:40 +0100 Subject: [PATCH] chore: use non-null assertion for apiKeyId (guaranteed by create()) FlowcoreDataPump.create() parses apiKeyId from fc_ keys before any code path reaches these files. The ! assertion is safe and removes the unsafe `as string` cast while being type-correct. --- src/data-pump/flowcore-client.ts | 3 ++- src/data-pump/notifier.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/data-pump/flowcore-client.ts b/src/data-pump/flowcore-client.ts index d047bda..f3e31eb 100644 --- a/src/data-pump/flowcore-client.ts +++ b/src/data-pump/flowcore-client.ts @@ -13,7 +13,8 @@ export function getFlowcoreClient(auth: FlowcoreDataPumpAuth, baseUrlOverride?: const client = "apiKey" in auth ? new FlowcoreClientWithMetrics({ apiKey: auth.apiKey, - apiKeyId: auth.apiKeyId as string, + // apiKeyId is guaranteed to be set — FlowcoreDataPump.create() parses it from fc_ keys + apiKeyId: auth.apiKeyId!, }) : new FlowcoreClientWithMetrics(auth) diff --git a/src/data-pump/notifier.ts b/src/data-pump/notifier.ts index 01e04bf..87427ea 100644 --- a/src/data-pump/notifier.ts +++ b/src/data-pump/notifier.ts @@ -143,7 +143,8 @@ export class FlowcoreNotifier { if ("apiKey" in this.options.auth) { return { apiKey: this.options.auth.apiKey, - apiKeyId: this.options.auth.apiKeyId as string, + // apiKeyId is guaranteed to be set — FlowcoreDataPump.create() parses it from fc_ keys + apiKeyId: this.options.auth.apiKeyId!, } } const getBearerToken = this.options.auth.getBearerToken