Skip to content

Commit 0d83a4c

Browse files
committed
chore: update lib
1 parent 8b59c96 commit 0d83a4c

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

lib/tracking.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { ClickHouseClient } from '@clickhouse/client'
22
import type { WebClickHouseClient } from '@clickhouse/client-web/dist/client'
33

4+
const log = (...args: string[]) => console.log(`[/api/init] ${args.join(' ')}`)
5+
const error = (...args: string[]) =>
6+
console.error(`[/api/init] ${args.join(' ')}`)
7+
48
export async function initTrackingTable(
59
client: WebClickHouseClient | ClickHouseClient
610
) {
7-
console.log('[Middleware] initializing system.monitoring_events')
11+
log('initializing system.monitoring_events')
812

913
try {
1014
const response = await client.query({
@@ -20,14 +24,8 @@ export async function initTrackingTable(
2024
PARTITION BY event_date
2125
ORDER BY (kind, actor, event_time)`,
2226
})
23-
console.log(
24-
'[Middleware] Created table system.monitoring_events',
25-
await response.text()
26-
)
27-
} catch (error) {
28-
console.error(
29-
'[Middleware] Error initializing table system.monitoring_events',
30-
error
31-
)
27+
log('created table system.monitoring_events', await response.text())
28+
} catch (err) {
29+
error('error initializing table system.monitoring_events', `${err}`)
3230
}
3331
}

lib/types/icon.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { IconProps } from '@radix-ui/react-icons/dist/types'
2+
import type { LucideProps } from 'lucide-react'
3+
4+
declare const RadixOrLucide:
5+
| React.ForwardRefExoticComponent<
6+
IconProps & React.RefAttributes<SVGSVGElement>
7+
>
8+
| React.ForwardRefExoticComponent<LucideProps>
9+
10+
export type Icon = typeof RadixOrLucide

lib/types/query-config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {
44
ColumnFormatOptions,
55
} from '@/components/data-table/column-defs'
66
import type { PartialBy } from '@/lib/types/generic'
7+
import type { Icon } from '@/lib/types/icon'
78

89
export interface QueryConfig {
910
name: string
@@ -41,6 +42,24 @@ export interface QueryConfig {
4142
* ```
4243
*/
4344
defaultParams?: Record<string, string | number | boolean>
45+
/**
46+
* Filter presets are predefined filters that can be applied to the query
47+
* For example:
48+
* ```ts
49+
* filterPresets: [
50+
* {
51+
* name: 'Changed only',
52+
* key: 'changed',
53+
* sql: 'changed = 1',
54+
* },
55+
* ]
56+
*/
57+
filterParamPresets?: {
58+
name: string
59+
key: string
60+
sql: string
61+
icon?: Icon
62+
}[]
4463
}
4564

4665
export type QueryConfigNoName = PartialBy<QueryConfig, 'name'>

0 commit comments

Comments
 (0)