datool 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +218 -0
  2. package/client-dist/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
  3. package/client-dist/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
  4. package/client-dist/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
  5. package/client-dist/assets/index-BeRNeRUq.css +1 -0
  6. package/client-dist/assets/index-uoZ4c_I8.js +164 -0
  7. package/client-dist/index.html +13 -0
  8. package/index.html +12 -0
  9. package/package.json +55 -0
  10. package/src/client/App.tsx +885 -0
  11. package/src/client/components/connection-status.tsx +43 -0
  12. package/src/client/components/data-table-cell.tsx +235 -0
  13. package/src/client/components/data-table-col-icon.tsx +73 -0
  14. package/src/client/components/data-table-header-col.tsx +225 -0
  15. package/src/client/components/data-table-search-input.tsx +729 -0
  16. package/src/client/components/data-table.tsx +2014 -0
  17. package/src/client/components/stream-controls.tsx +157 -0
  18. package/src/client/components/theme-provider.tsx +230 -0
  19. package/src/client/components/ui/button.tsx +68 -0
  20. package/src/client/components/ui/combobox.tsx +308 -0
  21. package/src/client/components/ui/context-menu.tsx +261 -0
  22. package/src/client/components/ui/dropdown-menu.tsx +267 -0
  23. package/src/client/components/ui/input-group.tsx +153 -0
  24. package/src/client/components/ui/input.tsx +19 -0
  25. package/src/client/components/ui/textarea.tsx +18 -0
  26. package/src/client/components/viewer-settings.tsx +185 -0
  27. package/src/client/index.css +192 -0
  28. package/src/client/lib/data-table-search.ts +750 -0
  29. package/src/client/lib/datool-icons.ts +37 -0
  30. package/src/client/lib/datool-url-state.ts +159 -0
  31. package/src/client/lib/filterable-table.ts +146 -0
  32. package/src/client/lib/table-search-persistence.ts +94 -0
  33. package/src/client/lib/utils.ts +6 -0
  34. package/src/client/main.tsx +14 -0
  35. package/src/index.ts +19 -0
  36. package/src/node/cli.ts +54 -0
  37. package/src/node/config.ts +231 -0
  38. package/src/node/lines.ts +82 -0
  39. package/src/node/runtime.ts +102 -0
  40. package/src/node/server.ts +403 -0
  41. package/src/node/sources/command.ts +82 -0
  42. package/src/node/sources/file.ts +116 -0
  43. package/src/node/sources/ssh.ts +59 -0
  44. package/src/shared/columns.ts +41 -0
  45. package/src/shared/types.ts +188 -0
@@ -0,0 +1,188 @@
1
+ export type DatoolColumnKind =
2
+ | "text"
3
+ | "enum"
4
+ | "number"
5
+ | "boolean"
6
+ | "date"
7
+ | "json"
8
+
9
+ export const LOG_VIEWER_ACTION_BUTTON_VARIANTS = [
10
+ "default",
11
+ "outline",
12
+ "secondary",
13
+ "ghost",
14
+ "destructive",
15
+ "link",
16
+ ] as const
17
+
18
+ export const LOG_VIEWER_ACTION_BUTTON_SIZES = [
19
+ "default",
20
+ "xs",
21
+ "sm",
22
+ "lg",
23
+ "xl",
24
+ "icon",
25
+ "icon-xs",
26
+ "icon-sm",
27
+ "icon-lg",
28
+ "icon-xl",
29
+ ] as const
30
+
31
+ export const LOG_VIEWER_ICON_NAMES = [
32
+ "Ban",
33
+ "Check",
34
+ "CircleAlert",
35
+ "Copy",
36
+ "Download",
37
+ "ExternalLink",
38
+ "Filter",
39
+ "Info",
40
+ "Play",
41
+ "RefreshCcw",
42
+ "Search",
43
+ "Trash",
44
+ "X",
45
+ ] as const
46
+
47
+ export type DatoolActionButtonVariant =
48
+ (typeof LOG_VIEWER_ACTION_BUTTON_VARIANTS)[number]
49
+
50
+ export type DatoolActionButtonSize =
51
+ (typeof LOG_VIEWER_ACTION_BUTTON_SIZES)[number]
52
+
53
+ export type DatoolIconName = (typeof LOG_VIEWER_ICON_NAMES)[number]
54
+
55
+ export type DatoolActionButtonConfig =
56
+ | false
57
+ | DatoolActionButtonVariant
58
+ | {
59
+ className?: string
60
+ label?: string
61
+ size?: DatoolActionButtonSize
62
+ variant?: DatoolActionButtonVariant
63
+ }
64
+
65
+ export type DatoolColumn = {
66
+ accessorKey: string
67
+ align?: "left" | "center" | "right"
68
+ header?: string
69
+ id?: string
70
+ kind?: DatoolColumnKind
71
+ maxWidth?: number
72
+ minWidth?: number
73
+ truncate?: boolean
74
+ width?: number
75
+ }
76
+
77
+ export type DatoolOpenContext = {
78
+ emit: (line: string) => void
79
+ query: URLSearchParams
80
+ signal: AbortSignal
81
+ }
82
+
83
+ export type DatoolParseLineContext = {
84
+ line: string
85
+ query: URLSearchParams
86
+ streamId: string
87
+ }
88
+
89
+ export type DatoolGetRowIdContext<Row extends Record<string, unknown>> = {
90
+ index: number
91
+ line: string
92
+ query: URLSearchParams
93
+ row: Row
94
+ streamId: string
95
+ }
96
+
97
+ export type DatoolActionResolveContext<Row extends Record<string, unknown>> = {
98
+ actionId: string
99
+ query: URLSearchParams
100
+ rows: Row[]
101
+ streamId: string
102
+ }
103
+
104
+ export type DatoolActionRowChange<Row extends Record<string, unknown>> =
105
+ | Row
106
+ | boolean
107
+ | null
108
+ | void
109
+
110
+ export type DatoolActionResolveResult<Row extends Record<string, unknown>> =
111
+ | DatoolActionRowChange<Row>[]
112
+ | boolean
113
+ | null
114
+ | void
115
+
116
+ export type DatoolAction<Row extends Record<string, unknown>> = {
117
+ button?: DatoolActionButtonConfig
118
+ icon?: DatoolIconName
119
+ label: string
120
+ resolve: (
121
+ context: DatoolActionResolveContext<Row>
122
+ ) =>
123
+ | DatoolActionResolveResult<Row>
124
+ | Promise<DatoolActionResolveResult<Row>>
125
+ }
126
+
127
+ export type DatoolStream<Row extends Record<string, unknown>> = {
128
+ actions?: Record<string, DatoolAction<Row>>
129
+ columns: DatoolColumn[]
130
+ getRowId?: (
131
+ context: DatoolGetRowIdContext<Row>
132
+ ) => string | Promise<string>
133
+ label: string
134
+ open: (
135
+ context: DatoolOpenContext
136
+ ) => void | Promise<void> | (() => void | Promise<void>)
137
+ parseLine: (
138
+ context: DatoolParseLineContext
139
+ ) => Row | null | Promise<Row | null>
140
+ }
141
+
142
+ export type DatoolConfig = {
143
+ server?: {
144
+ host?: string
145
+ port?: number
146
+ }
147
+ streams: Record<string, DatoolStream<Record<string, unknown>>>
148
+ }
149
+
150
+ export type DatoolSource = Pick<
151
+ DatoolStream<Record<string, unknown>>,
152
+ "open"
153
+ >
154
+
155
+ export type DatoolClientStream = {
156
+ actions: DatoolClientAction[]
157
+ columns: DatoolColumn[]
158
+ id: string
159
+ label: string
160
+ }
161
+
162
+ export type DatoolClientAction = {
163
+ button?: DatoolActionButtonConfig
164
+ icon?: DatoolIconName
165
+ id: string
166
+ label: string
167
+ }
168
+
169
+ export type DatoolClientConfig = {
170
+ streams: DatoolClientStream[]
171
+ }
172
+
173
+ export type DatoolRowEvent = {
174
+ id: string
175
+ row: Record<string, unknown>
176
+ }
177
+
178
+ export type DatoolSseErrorEvent = {
179
+ message: string
180
+ }
181
+
182
+ export type DatoolActionRequest = {
183
+ rows: Record<string, unknown>[]
184
+ }
185
+
186
+ export type DatoolActionResponse = {
187
+ rowChanges?: Array<Record<string, unknown> | boolean>
188
+ }