Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/0198-network-broker-stats-schema-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cdot65/prisma-airs-sdk': patch
---

Fix the Network Broker `ChannelStats` schema field names to match the actual API (verified live). `getChannelStats()` previously modeled non-existent fields (`broker_server`, `registry`, `chart`, `image`, `online_channel_count`, `total_channel_count`) so every typed accessor returned `undefined`. They are now `network_channels_server_domain`, `docker_registry`, `helm_chart`, `docker_image`, `online_channels`, `total_channels`, plus `client_version`. `Channel` also gains the live-observed `added_by`, `last_online_at`, `connected_clients_count`, `outdated_clients_count`, and `features` fields. The Network Broker OpenAPI spec is now committed so preflight validates these schemas going forward.
2 changes: 1 addition & 1 deletion docs-site/docs/guides/red-team-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ const detail = await client.networkBroker.getChannel(channel.uuid!);
await client.networkBroker.updateChannel(channel.uuid!, { description: 'Updated description' });

const stats = await client.networkBroker.getChannelStats();
console.log(stats.online_channel_count, stats.total_channel_count);
console.log(stats.online_channels, stats.total_channels);
```

Channel statuses are `ONLINE`, `OFFLINE`, and `DRAFT` (see the `ChannelStatus` enum).
Expand Down
6 changes: 3 additions & 3 deletions docs-site/examples/red-team-network-broker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ async function main() {
// --- STATS ---
console.log('\nGetting channel stats...');
const stats = await client.networkBroker.getChannelStats();
console.log(' Broker server:', stats.broker_server);
console.log(' Online channels:', stats.online_channel_count);
console.log(' Total channels:', stats.total_channel_count);
console.log(' Broker server:', stats.network_channels_server_domain);
console.log(' Online channels:', stats.online_channels);
console.log(' Total channels:', stats.total_channels);
} catch (error) {
if (error instanceof AISecSDKException) {
console.error('Error:', error.message);
Expand Down
41 changes: 41 additions & 0 deletions scripts/preflight/allowlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,47 @@ export const PREFLIGHT_ALLOWLIST: AllowlistEntry[] = [
kind: 'missing-required-field',
reason: 'status is modeled as z.unknown(); cannot be marked required.',
},

// ── ErrorResponse name collision ─────────────────────────────────────────────
// src/models/error-response.ts models the AIRS scan/gateway error envelope
// (status_code, error{}, retry_after). The Network Broker spec coincidentally defines an
// unrelated `ErrorResponse` component (code, message). Same name, different contract — the
// SDK schema is not meant to model the network-broker error shape.
{
schema: 'ErrorResponse',
pathSubstring: '$',
reason:
'SDK ErrorResponse models the AIRS scan error envelope; the network-broker spec has an ' +
'unrelated component of the same name (code/message). Coincidental collision.',
},

// ── Network Broker fields the live API returns but the OpenAPI omits ──────────
// Verified live on 2026-07-09; modeled so callers get typed access.
{
schema: 'ChannelStats',
pathSubstring: 'client_version',
kind: 'extra-field',
reason: 'API returns `client_version` on channel stats; not in upstream OpenAPI ChannelStats.',
},
{
schema: 'Channel',
pathSubstring: 'connected_clients_count',
kind: 'extra-field',
reason: 'API returns `connected_clients_count` on channels; not in upstream OpenAPI Channel.',
},
{
schema: 'Channel',
pathSubstring: 'outdated_clients_count',
kind: 'extra-field',
reason: 'API returns `outdated_clients_count` on channels; not in upstream OpenAPI Channel.',
},
{
schema: 'Channel',
pathSubstring: 'features',
kind: 'extra-field',
reason:
'API returns `features` (per-adapter capability flags) on channels; not in upstream OpenAPI Channel.',
},
];

/**
Expand Down
Loading
Loading