Skip to content

Commit e29b8d4

Browse files
committed
cleanup warnings and fix DTS build phase for typescript
1 parent 88ac390 commit e29b8d4

6 files changed

Lines changed: 11 additions & 36 deletions

File tree

elixir/lib/datagrout_conduit/transport/ws.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ defmodule DatagroutConduit.Transport.Ws do
232232

233233
cond do
234234
Map.has_key?(state.pending_subscribe, str_id) ->
235-
{topic, caller_pid, from} = Map.fetch!(state.pending_subscribe, str_id)
235+
{_topic, caller_pid, from} = Map.fetch!(state.pending_subscribe, str_id)
236236
pending_subscribe = Map.delete(state.pending_subscribe, str_id)
237237

238238
if err = msg["error"] do

elixir/test/ws_transport_test.exs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,10 @@ defmodule DatagroutConduit.Transport.WsTest do
1010

1111
use ExUnit.Case, async: true
1212

13-
import Mox
14-
1513
alias DatagroutConduit.Transport.Ws
1614

1715
# ── Helpers ─────────────────────────────────────────────────────────────────
1816

19-
# Start a WS GenServer with a stub conn_pid (not a real WebSockex process).
20-
# We inject frames directly via `send/2`.
21-
defp start_ws_with_stub do
22-
# We bypass the init by manually setting state via :sys.replace_state.
23-
{:ok, pid} =
24-
GenServer.start_link(Ws, %Ws{
25-
conn_pid: self(),
26-
pending: %{},
27-
pending_subscribe: %{},
28-
subscriptions: %{},
29-
next_id: 0
30-
})
31-
32-
pid
33-
end
34-
3517
defp inject_frame(pid, payload) do
3618
send(pid, {:ws_frame, Jason.encode!(payload)})
3719
end
@@ -252,14 +234,6 @@ defmodule DatagroutConduit.Transport.WsTest do
252234

253235
describe "to_ws_url / build_headers (via init logic)" do
254236
test "URL rewriting: https → wss" do
255-
state = %Ws{
256-
conn_pid: self(),
257-
pending: %{},
258-
pending_subscribe: %{},
259-
subscriptions: %{},
260-
next_id: 0
261-
}
262-
263237
ws_url =
264238
"https://gateway.datagrout.ai/servers/test/ws"
265239
|> String.replace_prefix("https://", "wss://")

python/tests/test_identity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def test_with_expiry_returns_new_object(self) -> None:
336336

337337
def test_needs_rotation_handles_naive_datetime(self) -> None:
338338
"""Naive datetimes are treated as UTC."""
339-
past_naive = datetime.utcnow() - timedelta(seconds=1)
339+
past_naive = datetime.now(timezone.utc).replace(tzinfo=None) - timedelta(seconds=1)
340340
identity = ConduitIdentity.from_pem(CERT_PEM, KEY_PEM).with_expiry(past_naive)
341341
assert identity.needs_rotation(0) is True
342342

ruby/test/datagrout_conduit_test.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,11 @@ def test_extract_meta_with_meta_key_fallback
128128
end
129129

130130
def test_extract_meta_returns_nil_for_no_meta
131-
assert_nil DatagroutConduit.extract_meta({})
132-
assert_nil DatagroutConduit.extract_meta({ "value" => 42 })
133-
assert_nil DatagroutConduit.extract_meta(nil)
131+
assert_output(nil, /No DataGrout metadata/) do
132+
assert_nil DatagroutConduit.extract_meta({})
133+
assert_nil DatagroutConduit.extract_meta({ "value" => 42 })
134+
assert_nil DatagroutConduit.extract_meta(nil)
135+
end
134136
end
135137

136138
def test_extract_meta_with_symbol_keys

typescript/src/transports/ws.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ interface PendingSubscribe {
147147
export class WsTransport extends Transport {
148148
private readonly _url: string;
149149
private readonly _auth?: AuthConfig;
150-
private readonly _identity?: ConduitIdentity;
151150

152151
private _ws: WebSocket | null = null;
153152
private _nextId = 0;
@@ -156,7 +155,7 @@ export class WsTransport extends Transport {
156155
private readonly _pendingSubscribe = new Map<string, PendingSubscribe>();
157156
private readonly _subscriptions = new Map<string, Subscription>();
158157

159-
constructor(url: string, auth?: AuthConfig, _timeout?: number, identity?: ConduitIdentity) {
158+
constructor(url: string, auth?: AuthConfig, _timeout?: number, _identity?: ConduitIdentity) {
160159
super();
161160

162161
const scheme = new URL(url).protocol.replace(':', '');
@@ -166,7 +165,6 @@ export class WsTransport extends Transport {
166165

167166
this._url = url;
168167
this._auth = auth;
169-
this._identity = identity;
170168
}
171169

172170
// ── Lifecycle ─────────────────────────────────────────────────────────────
@@ -186,7 +184,7 @@ export class WsTransport extends Transport {
186184
await new Promise<void>((resolve, reject) => {
187185
ws.onopen = () => resolve();
188186
ws.onerror = (ev: Event) =>
189-
reject(new Error(`WS connect failed: ${(ev as ErrorEvent).message ?? 'unknown'}`));
187+
reject(new Error(`WS connect failed: ${(ev as any).message ?? 'unknown'}`));
190188
});
191189

192190
ws.onmessage = (ev: MessageEvent) => this._handleMessage(ev.data);

typescript/src/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ export interface GuideState {
221221

222222
export interface AuthConfig {
223223
bearer?: string;
224+
apiKey?: string;
224225
basic?: {
225226
username: string;
226227
password: string;
@@ -287,7 +288,7 @@ export interface ClientOptions {
287288
* @default false
288289
*/
289290
disableMtls?: boolean;
290-
transport?: 'mcp' | 'jsonrpc';
291+
transport?: 'mcp' | 'jsonrpc' | 'websocket';
291292
timeout?: number;
292293
/**
293294
* Maximum number of automatic retries on "server not initialized" errors.

0 commit comments

Comments
 (0)