@reifydb/shell 0.8.1 → 0.9.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.
- package/dist/index.css +6 -6
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +103 -47
- package/dist/index.js +282 -135
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/dist/index.css
CHANGED
|
@@ -8,26 +8,26 @@
|
|
|
8
8
|
width: 100vw !important;
|
|
9
9
|
height: 100vh !important;
|
|
10
10
|
z-index: 9999 !important;
|
|
11
|
-
background: #1e1e2e !important;
|
|
11
|
+
background: var(--rdb-shell-bg, #1e1e2e) !important;
|
|
12
12
|
}
|
|
13
13
|
.xterm {
|
|
14
|
-
padding: 12px;
|
|
14
|
+
padding: var(--rdb-shell-padding, 12px);
|
|
15
15
|
}
|
|
16
16
|
.xterm-viewport {
|
|
17
17
|
scrollbar-width: thin;
|
|
18
|
-
scrollbar-color: #45475a #1e1e2e;
|
|
18
|
+
scrollbar-color: var(--rdb-shell-scrollbar-thumb, #45475a) var(--rdb-shell-bg, #1e1e2e);
|
|
19
19
|
}
|
|
20
20
|
.xterm-viewport::-webkit-scrollbar {
|
|
21
21
|
width: 8px;
|
|
22
22
|
}
|
|
23
23
|
.xterm-viewport::-webkit-scrollbar-track {
|
|
24
|
-
background: #1e1e2e;
|
|
24
|
+
background: var(--rdb-shell-bg, #1e1e2e);
|
|
25
25
|
}
|
|
26
26
|
.xterm-viewport::-webkit-scrollbar-thumb {
|
|
27
|
-
background: #45475a;
|
|
27
|
+
background: var(--rdb-shell-scrollbar-thumb, #45475a);
|
|
28
28
|
border-radius: 4px;
|
|
29
29
|
}
|
|
30
30
|
.xterm-viewport::-webkit-scrollbar-thumb:hover {
|
|
31
|
-
background: #585b70;
|
|
31
|
+
background: var(--rdb-shell-scrollbar-thumb-hover, #585b70);
|
|
32
32
|
}
|
|
33
33
|
/*# sourceMappingURL=index.css.map */
|
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/terminal/styles.css"],"sourcesContent":["/* SPDX-License-Identifier: Apache-2.0 */\n/* Copyright (c) 2026 ReifyDB */\n\n/* Fullscreen mode */\n.reifydb-shell-fullscreen {\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n z-index: 9999 !important;\n background: #1e1e2e !important;\n}\n\n/* xterm.js container styling */\n.xterm {\n padding: 12px;\n}\n\n.xterm-viewport {\n /* Hide scrollbar but keep scrolling functional */\n scrollbar-width: thin;\n scrollbar-color: #45475a #1e1e2e;\n}\n\n.xterm-viewport::-webkit-scrollbar {\n width: 8px;\n}\n\n.xterm-viewport::-webkit-scrollbar-track {\n background: #1e1e2e;\n}\n\n.xterm-viewport::-webkit-scrollbar-thumb {\n background: #45475a;\n border-radius: 4px;\n}\n\n.xterm-viewport::-webkit-scrollbar-thumb:hover {\n background: #585b70;\n}\n"],"mappings":";AAIA,CAAC;AACC,YAAU;AACV,OAAK;AACL,QAAM;AACN,SAAO;AACP,UAAQ;AACR,SAAO;AACP,UAAQ;AACR,WAAS;AACT,cAAY;
|
|
1
|
+
{"version":3,"sources":["../src/terminal/styles.css"],"sourcesContent":["/* SPDX-License-Identifier: Apache-2.0 */\n/* Copyright (c) 2026 ReifyDB */\n\n/* Fullscreen mode */\n.reifydb-shell-fullscreen {\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n z-index: 9999 !important;\n background: var(--rdb-shell-bg, #1e1e2e) !important;\n}\n\n/* xterm.js container styling */\n.xterm {\n padding: var(--rdb-shell-padding, 12px);\n}\n\n.xterm-viewport {\n /* Hide scrollbar but keep scrolling functional */\n scrollbar-width: thin;\n scrollbar-color: var(--rdb-shell-scrollbar-thumb, #45475a) var(--rdb-shell-bg, #1e1e2e);\n}\n\n.xterm-viewport::-webkit-scrollbar {\n width: 8px;\n}\n\n.xterm-viewport::-webkit-scrollbar-track {\n background: var(--rdb-shell-bg, #1e1e2e);\n}\n\n.xterm-viewport::-webkit-scrollbar-thumb {\n background: var(--rdb-shell-scrollbar-thumb, #45475a);\n border-radius: 4px;\n}\n\n.xterm-viewport::-webkit-scrollbar-thumb:hover {\n background: var(--rdb-shell-scrollbar-thumb-hover, #585b70);\n}\n"],"mappings":";AAIA,CAAC;AACC,YAAU;AACV,OAAK;AACL,QAAM;AACN,SAAO;AACP,UAAQ;AACR,SAAO;AACP,UAAQ;AACR,WAAS;AACT,cAAY,IAAI,cAAc,EAAE;AAClC;AAGA,CAAC;AACC,WAAS,IAAI,mBAAmB,EAAE;AACpC;AAEA,CAAC;AAEC,mBAAiB;AACjB,mBAAiB,IAAI,2BAA2B,EAAE,SAAS,IAAI,cAAc,EAAE;AACjF;AAEA,CANC,cAMc;AACb,SAAO;AACT;AAEA,CAVC,cAUc;AACb,cAAY,IAAI,cAAc,EAAE;AAClC;AAEA,CAdC,cAcc;AACb,cAAY,IAAI,2BAA2B,EAAE;AAC7C,iBAAe;AACjB;AAEA,CAnBC,cAmBc,yBAAyB;AACtC,cAAY,IAAI,iCAAiC,EAAE;AACrD;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ValueRole, ResultColumn, RqlTokenKind } from '@reifydb/core';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Terminal color theme configuration
|
|
3
5
|
*/
|
|
@@ -28,6 +30,10 @@ interface TerminalTheme {
|
|
|
28
30
|
* Catppuccin Mocha theme - default theme
|
|
29
31
|
*/
|
|
30
32
|
declare const defaultTheme: TerminalTheme;
|
|
33
|
+
/**
|
|
34
|
+
* ReifyDB product theme - zinc-900 ground with the indigo brand accent
|
|
35
|
+
*/
|
|
36
|
+
declare const reifydbDarkTheme: TerminalTheme;
|
|
31
37
|
/**
|
|
32
38
|
* ANSI escape codes for terminal colors and formatting
|
|
33
39
|
*/
|
|
@@ -110,14 +116,66 @@ declare class TerminalAdapter {
|
|
|
110
116
|
static restoreCursor(): string;
|
|
111
117
|
}
|
|
112
118
|
|
|
119
|
+
interface AnsiStyle {
|
|
120
|
+
color?: string;
|
|
121
|
+
bold?: boolean;
|
|
122
|
+
italic?: boolean;
|
|
123
|
+
dim?: boolean;
|
|
124
|
+
}
|
|
125
|
+
declare const RESET = "\u001B[0m";
|
|
126
|
+
declare function sgr(style: AnsiStyle): string;
|
|
127
|
+
declare function paint(text: string, prefix: string): string;
|
|
128
|
+
|
|
129
|
+
type TableBorder = 'unicode' | 'ascii' | 'none';
|
|
130
|
+
type ValuePalette = Partial<Record<ValueRole, AnsiStyle>>;
|
|
131
|
+
interface TableTheme {
|
|
132
|
+
border?: AnsiStyle;
|
|
133
|
+
header?: AnsiStyle;
|
|
134
|
+
values?: ValuePalette;
|
|
135
|
+
}
|
|
136
|
+
interface TableColumn {
|
|
137
|
+
name: string;
|
|
138
|
+
width: number;
|
|
139
|
+
}
|
|
140
|
+
interface TableOptions {
|
|
141
|
+
maxWidth?: number;
|
|
142
|
+
truncate?: boolean;
|
|
143
|
+
border?: TableBorder;
|
|
144
|
+
theme?: TableTheme;
|
|
145
|
+
columns?: ResultColumn[];
|
|
146
|
+
}
|
|
147
|
+
declare const reifydbDarkTableTheme: TableTheme;
|
|
148
|
+
declare class TableRenderer {
|
|
149
|
+
private data;
|
|
150
|
+
private glyphs;
|
|
151
|
+
private plan;
|
|
152
|
+
private borderPrefix;
|
|
153
|
+
private headerPrefix;
|
|
154
|
+
private valuePrefixes;
|
|
155
|
+
constructor(data: Record<string, unknown>[], options?: TableOptions);
|
|
156
|
+
get columns(): TableColumn[];
|
|
157
|
+
get dropped(): string[];
|
|
158
|
+
render(): string[];
|
|
159
|
+
private rule;
|
|
160
|
+
private width;
|
|
161
|
+
private headerRow;
|
|
162
|
+
private dataRow;
|
|
163
|
+
private joinCells;
|
|
164
|
+
}
|
|
165
|
+
|
|
113
166
|
/**
|
|
114
167
|
* Result from executing a statement
|
|
115
168
|
*/
|
|
116
169
|
interface ExecutionResult {
|
|
117
170
|
success: boolean;
|
|
118
171
|
data?: Record<string, unknown>[];
|
|
172
|
+
/**
|
|
173
|
+
* Column metadata for `data`, in display order.
|
|
174
|
+
* Omit it and the formatter infers columns from the rows.
|
|
175
|
+
*/
|
|
176
|
+
columns?: ResultColumn[];
|
|
119
177
|
error?: string;
|
|
120
|
-
|
|
178
|
+
executionTime: number;
|
|
121
179
|
}
|
|
122
180
|
/**
|
|
123
181
|
* Interface for executing database statements.
|
|
@@ -135,7 +193,7 @@ interface Executor {
|
|
|
135
193
|
/**
|
|
136
194
|
* Get shape for a table (optional, used by .shape command)
|
|
137
195
|
*/
|
|
138
|
-
getShape?(
|
|
196
|
+
getShape?(tableName: string): Promise<string | null>;
|
|
139
197
|
}
|
|
140
198
|
/**
|
|
141
199
|
* Display mode for query results
|
|
@@ -149,6 +207,12 @@ interface HistoryStorage {
|
|
|
149
207
|
load(): string[];
|
|
150
208
|
save(entries: string[]): void;
|
|
151
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Paints a single input line for display.
|
|
212
|
+
* Receives the line being edited plus the already-entered part of a
|
|
213
|
+
* multi-line statement, and returns the line with ANSI colors applied.
|
|
214
|
+
*/
|
|
215
|
+
type Highlighter = (line: string, context?: string) => string;
|
|
152
216
|
/**
|
|
153
217
|
* Configuration options for the Shell
|
|
154
218
|
*/
|
|
@@ -190,16 +254,33 @@ interface ShellOptions {
|
|
|
190
254
|
/**
|
|
191
255
|
* Key for localStorage history (default: "reifydb-shell-history")
|
|
192
256
|
*/
|
|
193
|
-
|
|
257
|
+
historyKey?: string;
|
|
194
258
|
/**
|
|
195
259
|
* Custom history storage implementation.
|
|
196
|
-
* If provided,
|
|
260
|
+
* If provided, historyKey is ignored.
|
|
197
261
|
*/
|
|
198
262
|
historyStorage?: HistoryStorage;
|
|
199
263
|
/**
|
|
200
264
|
* Initial display mode (default: "full")
|
|
201
265
|
*/
|
|
202
266
|
displayMode?: DisplayMode;
|
|
267
|
+
/**
|
|
268
|
+
* Text placed on the input line when the shell starts, ready to run.
|
|
269
|
+
*/
|
|
270
|
+
initialInput?: string;
|
|
271
|
+
/**
|
|
272
|
+
* Paints the input line as it is typed.
|
|
273
|
+
* Use `rqlHighlighter()` for RQL syntax coloring.
|
|
274
|
+
*/
|
|
275
|
+
highlight?: Highlighter;
|
|
276
|
+
/**
|
|
277
|
+
* Border style for result tables (default: "unicode")
|
|
278
|
+
*/
|
|
279
|
+
tableBorder?: TableBorder;
|
|
280
|
+
/**
|
|
281
|
+
* Colors for result tables
|
|
282
|
+
*/
|
|
283
|
+
tableTheme?: TableTheme;
|
|
203
284
|
/**
|
|
204
285
|
* Callback when user exits the shell
|
|
205
286
|
*/
|
|
@@ -248,6 +329,8 @@ declare class Shell {
|
|
|
248
329
|
private continuationPrompt;
|
|
249
330
|
private continuationPromptLen;
|
|
250
331
|
private welcomeMessage;
|
|
332
|
+
private initialInput;
|
|
333
|
+
private highlight;
|
|
251
334
|
private onExit;
|
|
252
335
|
private onFullscreenChange;
|
|
253
336
|
constructor(container: HTMLElement, options: ShellOptions);
|
|
@@ -289,7 +372,7 @@ declare class LineEditor {
|
|
|
289
372
|
deleteToEnd(): void;
|
|
290
373
|
deleteToStart(): void;
|
|
291
374
|
deleteWord(): void;
|
|
292
|
-
render(prompt: string): void;
|
|
375
|
+
render(prompt: string, display?: string): void;
|
|
293
376
|
}
|
|
294
377
|
|
|
295
378
|
/**
|
|
@@ -314,7 +397,7 @@ declare class CommandHistory {
|
|
|
314
397
|
private position;
|
|
315
398
|
private savedInput;
|
|
316
399
|
private storage;
|
|
317
|
-
constructor(storage?: HistoryStorage,
|
|
400
|
+
constructor(storage?: HistoryStorage, historyKey?: string);
|
|
318
401
|
add(command: string): void;
|
|
319
402
|
previous(currentInput: string): string | null;
|
|
320
403
|
next(): string | null;
|
|
@@ -333,10 +416,20 @@ declare class MultilineBuffer {
|
|
|
333
416
|
static isStatementComplete(input: string): boolean;
|
|
334
417
|
}
|
|
335
418
|
|
|
419
|
+
type RqlPalette = Partial<Record<RqlTokenKind, AnsiStyle>>;
|
|
420
|
+
declare const reifydbDarkPalette: RqlPalette;
|
|
421
|
+
declare function rqlHighlighter(palette?: RqlPalette): Highlighter;
|
|
422
|
+
|
|
423
|
+
interface FormatterOptions {
|
|
424
|
+
border?: TableBorder;
|
|
425
|
+
theme?: TableTheme;
|
|
426
|
+
}
|
|
336
427
|
declare class OutputFormatter {
|
|
337
428
|
private terminal;
|
|
338
429
|
private displayMode;
|
|
339
|
-
|
|
430
|
+
private border;
|
|
431
|
+
private theme;
|
|
432
|
+
constructor(terminal: TerminalAdapter, displayMode?: DisplayMode, options?: FormatterOptions);
|
|
340
433
|
setDisplayMode(mode: DisplayMode): void;
|
|
341
434
|
formatResult(result: ExecutionResult): void;
|
|
342
435
|
private formatTable;
|
|
@@ -344,66 +437,29 @@ declare class OutputFormatter {
|
|
|
344
437
|
private formatExecutionTime;
|
|
345
438
|
}
|
|
346
439
|
|
|
347
|
-
interface TableColumn {
|
|
348
|
-
name: string;
|
|
349
|
-
width: number;
|
|
350
|
-
}
|
|
351
|
-
interface TableOptions {
|
|
352
|
-
maxWidth?: number;
|
|
353
|
-
truncate?: boolean;
|
|
354
|
-
}
|
|
355
|
-
declare class TableRenderer {
|
|
356
|
-
private data;
|
|
357
|
-
private columns;
|
|
358
|
-
private maxWidth;
|
|
359
|
-
private truncate;
|
|
360
|
-
constructor(data: Record<string, unknown>[], options?: TableOptions);
|
|
361
|
-
private calculateColumns;
|
|
362
|
-
private formatValue;
|
|
363
|
-
private truncateString;
|
|
364
|
-
render(): string[];
|
|
365
|
-
private fitColumns;
|
|
366
|
-
private padCenter;
|
|
367
|
-
private padRight;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Interface for WebAssembly database instances.
|
|
372
|
-
* This matches the WasmDB interface from reifydb-wasm.
|
|
373
|
-
*/
|
|
374
440
|
interface WasmDB {
|
|
375
441
|
admin(rql: string): Promise<unknown> | unknown;
|
|
376
442
|
}
|
|
377
|
-
/**
|
|
378
|
-
* Executor adapter for WebAssembly-based ReifyDB instances.
|
|
379
|
-
*/
|
|
380
443
|
declare class WasmExecutor implements Executor {
|
|
381
444
|
private db;
|
|
382
445
|
constructor(db: WasmDB);
|
|
383
446
|
execute(rql: string): Promise<ExecutionResult>;
|
|
384
447
|
getTables(): Promise<string[]>;
|
|
385
|
-
getShape(
|
|
448
|
+
getShape(tableName: string): Promise<string | null>;
|
|
386
449
|
}
|
|
387
450
|
|
|
388
|
-
/**
|
|
389
|
-
* Interface for WebSocket client.
|
|
390
|
-
* This matches the WsClient interface from @reifydb/client.
|
|
391
|
-
*/
|
|
392
451
|
interface WsClient {
|
|
393
452
|
admin<const S extends readonly unknown[]>(rql: string, params: unknown, shapes: S): Promise<unknown[][]>;
|
|
394
453
|
}
|
|
395
|
-
/**
|
|
396
|
-
* Executor adapter for WebSocket-based ReifyDB connections.
|
|
397
|
-
*/
|
|
398
454
|
declare class WsExecutor implements Executor {
|
|
399
455
|
private client;
|
|
400
456
|
constructor(client: WsClient);
|
|
401
457
|
execute(rql: string): Promise<ExecutionResult>;
|
|
402
458
|
getTables(): Promise<string[]>;
|
|
403
|
-
getShape(
|
|
459
|
+
getShape(tableName: string): Promise<string | null>;
|
|
404
460
|
private extractValue;
|
|
405
461
|
}
|
|
406
462
|
|
|
407
463
|
declare function handleDotCommand(input: string, context: DotCommandContext): Promise<DotCommandResult>;
|
|
408
464
|
|
|
409
|
-
export { COLORS, CommandHistory, type DisplayMode, type DotCommandContext, type DotCommandResult, type ExecutionResult, type Executor, type HistoryStorage, type KeyHandler, LineEditor, LocalStorageHistoryStorage, MemoryHistoryStorage, MultilineBuffer, OutputFormatter, Shell, type ShellOptions, type TableColumn, type TableOptions, TableRenderer, TerminalAdapter, type TerminalTheme, type WasmDB, WasmExecutor, type WsClient, WsExecutor, defaultTheme, handleDotCommand };
|
|
465
|
+
export { type AnsiStyle, COLORS, CommandHistory, type DisplayMode, type DotCommandContext, type DotCommandResult, type ExecutionResult, type Executor, type FormatterOptions, type Highlighter, type HistoryStorage, type KeyHandler, LineEditor, LocalStorageHistoryStorage, MemoryHistoryStorage, MultilineBuffer, OutputFormatter, RESET, type RqlPalette, Shell, type ShellOptions, type TableBorder, type TableColumn, type TableOptions, TableRenderer, type TableTheme, TerminalAdapter, type TerminalTheme, type ValuePalette, type WasmDB, WasmExecutor, type WsClient, WsExecutor, defaultTheme, handleDotCommand, paint, reifydbDarkPalette, reifydbDarkTableTheme, reifydbDarkTheme, rqlHighlighter, sgr };
|