Skip to content

Commit 407d6c4

Browse files
committed
chore: fix all knip unused export warnings in CLI package
- Remove dead code: formatEventRow, formatTraceRow, getSeverityColor, getSpanEventBody (replaced by formatDynamicRow) - Remove unused re-export of ROW_DATA_ALIASES from eventQuery.ts - Un-export internal-only symbols: INTERNAL_ROW_FIELDS, processRowToWhereClause, buildAliasWith, _origDebug, _origWarn - Un-export internal-only interfaces: ApiClientOptions, MeResponse, ConnectionResponse, DashboardTileConfig, DashboardTile, DashboardFilter, DashboardResponse
1 parent 45a4821 commit 407d6c4

File tree

6 files changed

+12
-108
lines changed

6 files changed

+12
-108
lines changed

packages/cli/src/api/client.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { loadSession, saveSession, clearSession } from '@/utils/config';
3030
// API Client (session management + REST calls)
3131
// ------------------------------------------------------------------
3232

33-
export interface ApiClientOptions {
33+
interface ApiClientOptions {
3434
apiUrl: string;
3535
}
3636

@@ -266,7 +266,7 @@ export class ProxyClickhouseClient extends BaseClickhouseClient {
266266
// Response types (matching the internal API shapes)
267267
// ------------------------------------------------------------------
268268

269-
export interface MeResponse {
269+
interface MeResponse {
270270
accessKey: string;
271271
createdAt: string;
272272
email: string;
@@ -321,7 +321,7 @@ export interface SourceResponse {
321321
sessionSourceId?: string;
322322
}
323323

324-
export interface ConnectionResponse {
324+
interface ConnectionResponse {
325325
id: string;
326326
_id: string;
327327
name: string;
@@ -341,7 +341,7 @@ export interface SavedSearchResponse {
341341
orderBy?: string;
342342
}
343343

344-
export interface DashboardTileConfig {
344+
interface DashboardTileConfig {
345345
name?: string;
346346
source?: string;
347347
type?: string;
@@ -350,7 +350,7 @@ export interface DashboardTileConfig {
350350
[key: string]: unknown;
351351
}
352352

353-
export interface DashboardTile {
353+
interface DashboardTile {
354354
id: string;
355355
x: number;
356356
y: number;
@@ -360,14 +360,14 @@ export interface DashboardTile {
360360
containerId?: string;
361361
}
362362

363-
export interface DashboardFilter {
363+
interface DashboardFilter {
364364
key: string;
365365
displayName?: string;
366366
keyExpression?: string;
367367
sourceId?: string;
368368
}
369369

370-
export interface DashboardResponse {
370+
interface DashboardResponse {
371371
id: string;
372372
_id: string;
373373
name: string;

packages/cli/src/api/eventQuery.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ export async function buildEventSearchQuery(
104104

105105
// ---- Full row fetch (SELECT *) -------------------------------------
106106

107-
// Re-export shared modules for consumers
108-
export { ROW_DATA_ALIASES } from '@/shared/rowDataPanel';
109-
110107
// ---- Trace waterfall query (all spans for a traceId) ----------------
111108

112109
export interface TraceSpansQueryOptions {

packages/cli/src/components/EventViewer/utils.ts

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ export function flatten(s: string): string {
5151
.trim();
5252
}
5353

54-
export function getSeverityColor(
55-
sev: string,
56-
): 'red' | 'yellow' | 'blue' | 'gray' | undefined {
57-
const s = sev.toLowerCase();
58-
if (s === 'error' || s === 'fatal' || s === 'critical') return 'red';
59-
if (s === 'warn' || s === 'warning') return 'yellow';
60-
if (s === 'info') return 'blue';
61-
if (s === 'debug' || s === 'trace') return 'gray';
62-
return undefined;
63-
}
64-
6554
/**
6655
* Format a row generically — just stringify each value in column order.
6756
* Used when the user has a custom select clause.
@@ -80,84 +69,6 @@ export function formatDynamicRow(
8069
};
8170
}
8271

83-
function formatTraceRow(
84-
row: EventRow,
85-
source: SourceResponse,
86-
timestamp: string,
87-
): FormattedRow {
88-
const spanName = source.spanNameExpression
89-
? String(row[source.spanNameExpression] ?? '')
90-
: '';
91-
const service = source.serviceNameExpression
92-
? String(row[source.serviceNameExpression] ?? '')
93-
: '';
94-
const durationRaw = source.durationExpression
95-
? String(row[source.durationExpression] ?? '')
96-
: '';
97-
const statusCode = source.statusCodeExpression
98-
? String(row[source.statusCodeExpression] ?? '')
99-
: '';
100-
const traceId = source.traceIdExpression
101-
? String(row[source.traceIdExpression] ?? '')
102-
: '';
103-
104-
let durationStr = '';
105-
if (durationRaw) {
106-
const dur = Number(durationRaw);
107-
const precision = source.durationPrecision ?? 3;
108-
if (precision === 9) {
109-
durationStr = `${(dur / 1_000_000).toFixed(1)}ms`;
110-
} else if (precision === 6) {
111-
durationStr = `${(dur / 1_000).toFixed(1)}ms`;
112-
} else {
113-
durationStr = `${dur.toFixed(1)}ms`;
114-
}
115-
}
116-
117-
const statusLabel =
118-
statusCode === '2' ? 'ERROR' : statusCode === '1' ? 'WARN' : 'OK';
119-
const color =
120-
statusCode === '2'
121-
? ('red' as const)
122-
: statusCode === '1'
123-
? ('yellow' as const)
124-
: undefined;
125-
126-
return {
127-
cells: [
128-
timestamp,
129-
service,
130-
spanName,
131-
durationStr,
132-
statusLabel,
133-
traceId.slice(0, 16),
134-
],
135-
severityColor: color,
136-
};
137-
}
138-
139-
export function formatEventRow(
140-
row: EventRow,
141-
source: SourceResponse,
142-
): FormattedRow {
143-
const tsExpr = source.timestampValueExpression ?? 'TimestampTime';
144-
const timestamp = String(row[tsExpr] ?? row['Timestamp'] ?? '');
145-
146-
if (source.kind === 'trace') {
147-
return formatTraceRow(row, source, timestamp);
148-
}
149-
150-
const bodyExpr = source.bodyExpression ?? 'Body';
151-
const sevExpr = source.severityTextExpression ?? 'SeverityText';
152-
const rawBody = String(row[bodyExpr] ?? JSON.stringify(row));
153-
const severity = String(row[sevExpr] ?? '');
154-
155-
return {
156-
cells: [timestamp, severity, flatten(rawBody)],
157-
severityColor: getSeverityColor(severity),
158-
};
159-
}
160-
16172
export function formatShortDate(d: Date): string {
16273
return d
16374
.toISOString()

packages/cli/src/shared/source.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ export function getFirstTimestampValueExpression(valueExpression: string) {
1919
return splitAndTrimWithBracket(valueExpression)[0];
2020
}
2121

22-
export function getSpanEventBody(eventModel: SourceResponse) {
23-
return eventModel.spanNameExpression;
24-
}
25-
2622
export function getDisplayedTimestampValueExpression(
2723
eventModel: SourceResponse,
2824
) {

packages/cli/src/shared/useRowWhere.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const MAX_STRING_LENGTH = 512;
2727
export type WithClause = NonNullable<BuilderChartConfig['with']>[number];
2828

2929
// Internal row field names used by the table component for row tracking
30-
export const INTERNAL_ROW_FIELDS = {
30+
const INTERNAL_ROW_FIELDS = {
3131
ID: '__hyperdx_id',
3232
ALIAS_WITH: '__hyperdx_alias_with',
3333
} as const;
@@ -43,7 +43,7 @@ type ColumnWithMeta = ColumnMetaType & {
4343
jsType: JSDataType | null;
4444
};
4545

46-
export function processRowToWhereClause(
46+
function processRowToWhereClause(
4747
row: Record<string, unknown>,
4848
columnMap: Map<string, ColumnWithMeta>,
4949
): string {
@@ -159,7 +159,7 @@ export function buildColumnMap(
159159
/**
160160
* Build aliasWith array from aliasMap.
161161
*/
162-
export function buildAliasWith(
162+
function buildAliasWith(
163163
aliasMap: Record<string, string | undefined> | undefined,
164164
): WithClause[] {
165165
return aliasMapToWithClauses(aliasMap) ?? [];

packages/cli/src/utils/silenceLogs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* (e.g. auth, sources) that write directly to stderr.
77
*/
88

9-
export const _origDebug = console.debug;
10-
export const _origWarn = console.warn;
9+
const _origDebug = console.debug;
10+
const _origWarn = console.warn;
1111
export const _origError = console.error;
1212

1313
console.debug = () => {};

0 commit comments

Comments
 (0)