@reifydb/console 0.4.0 → 0.4.2
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.d.ts +2 -0
- package/dist/index.js +409 -99
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -2
- package/package.json +8 -5
package/dist/index.js
CHANGED
|
@@ -3,6 +3,35 @@ import { useCallback as useCallback3, useEffect as useEffect4, useRef as useRef4
|
|
|
3
3
|
import { Client } from "@reifydb/client";
|
|
4
4
|
|
|
5
5
|
// src/executor/ws-executor.ts
|
|
6
|
+
import { ReifyError } from "@reifydb/core";
|
|
7
|
+
function normalizeFragment(raw) {
|
|
8
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
9
|
+
const obj = raw;
|
|
10
|
+
if ("Statement" in obj && obj.Statement && typeof obj.Statement === "object") {
|
|
11
|
+
const s = obj.Statement;
|
|
12
|
+
return { text: String(s.text ?? ""), line: s.line, column: s.column };
|
|
13
|
+
}
|
|
14
|
+
if ("Internal" in obj && obj.Internal && typeof obj.Internal === "object") {
|
|
15
|
+
const s = obj.Internal;
|
|
16
|
+
return { text: String(s.text ?? "") };
|
|
17
|
+
}
|
|
18
|
+
if ("text" in obj) {
|
|
19
|
+
return { text: String(obj.text), line: obj.line, column: obj.column };
|
|
20
|
+
}
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
23
|
+
function toDiagnostic(error) {
|
|
24
|
+
return {
|
|
25
|
+
code: error.code,
|
|
26
|
+
statement: error.statement,
|
|
27
|
+
message: error.message.replace(/^\[.*?\]\s*/, ""),
|
|
28
|
+
fragment: normalizeFragment(error.fragment),
|
|
29
|
+
label: error.label,
|
|
30
|
+
help: error.help,
|
|
31
|
+
notes: error.notes,
|
|
32
|
+
cause: error.cause
|
|
33
|
+
};
|
|
34
|
+
}
|
|
6
35
|
var WsExecutor = class {
|
|
7
36
|
client;
|
|
8
37
|
constructor(client) {
|
|
@@ -32,15 +61,10 @@ var WsExecutor = class {
|
|
|
32
61
|
return { success: true, data, executionTime };
|
|
33
62
|
} catch (error) {
|
|
34
63
|
const executionTime = Math.round(performance.now() - startTime);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const diagnostic = error.diagnostic;
|
|
38
|
-
errorMessage = diagnostic.message;
|
|
39
|
-
} else if (error instanceof Error) {
|
|
40
|
-
errorMessage = error.message;
|
|
41
|
-
} else {
|
|
42
|
-
errorMessage = String(error);
|
|
64
|
+
if (error instanceof ReifyError) {
|
|
65
|
+
return { success: false, error: error.message, diagnostic: toDiagnostic(error), executionTime };
|
|
43
66
|
}
|
|
67
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
44
68
|
return { success: false, error: errorMessage, executionTime };
|
|
45
69
|
}
|
|
46
70
|
}
|
|
@@ -210,47 +234,236 @@ import { useRef as useRef2 } from "react";
|
|
|
210
234
|
import Editor from "@monaco-editor/react";
|
|
211
235
|
|
|
212
236
|
// src/monaco/rql-language.ts
|
|
213
|
-
var
|
|
214
|
-
|
|
215
|
-
"
|
|
216
|
-
"create",
|
|
217
|
-
"derive",
|
|
218
|
-
"deferred",
|
|
219
|
-
"distinct",
|
|
237
|
+
var KEYWORDS = [
|
|
238
|
+
// Query transforms
|
|
239
|
+
"map",
|
|
220
240
|
"extend",
|
|
221
|
-
"
|
|
241
|
+
"by",
|
|
222
242
|
"from",
|
|
223
|
-
"
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"map",
|
|
243
|
+
"where",
|
|
244
|
+
"aggregate",
|
|
245
|
+
"having",
|
|
227
246
|
"sort",
|
|
247
|
+
"distinct",
|
|
228
248
|
"take",
|
|
229
|
-
"
|
|
249
|
+
"offset",
|
|
250
|
+
// Joins & set operations
|
|
251
|
+
"left",
|
|
252
|
+
"inner",
|
|
253
|
+
"natural",
|
|
254
|
+
"join",
|
|
255
|
+
"on",
|
|
256
|
+
"using",
|
|
257
|
+
"intersect",
|
|
258
|
+
"except",
|
|
259
|
+
// DML
|
|
260
|
+
"insert",
|
|
261
|
+
"into",
|
|
262
|
+
"update",
|
|
263
|
+
"set",
|
|
264
|
+
"delete",
|
|
265
|
+
// Control flow
|
|
266
|
+
"let",
|
|
267
|
+
"if",
|
|
268
|
+
"else",
|
|
269
|
+
"end",
|
|
270
|
+
"loop",
|
|
271
|
+
"while",
|
|
272
|
+
"break",
|
|
273
|
+
"continue",
|
|
274
|
+
"return",
|
|
275
|
+
// Functions & casting
|
|
276
|
+
"fun",
|
|
277
|
+
"call",
|
|
278
|
+
"apply",
|
|
279
|
+
"cast",
|
|
280
|
+
// DDL & schema commands
|
|
281
|
+
"describe",
|
|
282
|
+
"show",
|
|
283
|
+
"create",
|
|
284
|
+
"alter",
|
|
285
|
+
"drop",
|
|
286
|
+
"filter",
|
|
287
|
+
"gate",
|
|
288
|
+
"flow",
|
|
289
|
+
"window",
|
|
290
|
+
// Operators & predicates
|
|
291
|
+
"in",
|
|
292
|
+
"between",
|
|
293
|
+
"like",
|
|
294
|
+
"is",
|
|
295
|
+
"with",
|
|
296
|
+
// Object types
|
|
297
|
+
"namespace",
|
|
298
|
+
"sequence",
|
|
299
|
+
"series",
|
|
300
|
+
"subscription",
|
|
301
|
+
"table",
|
|
302
|
+
"ringbuffer",
|
|
303
|
+
"column",
|
|
304
|
+
"policy",
|
|
305
|
+
"property",
|
|
230
306
|
"view",
|
|
231
|
-
"
|
|
307
|
+
"deferred",
|
|
308
|
+
"transactional",
|
|
309
|
+
// Index & constraints
|
|
310
|
+
"index",
|
|
311
|
+
"unique",
|
|
312
|
+
"primary",
|
|
313
|
+
"key",
|
|
314
|
+
"asc",
|
|
315
|
+
"desc",
|
|
316
|
+
"auto",
|
|
317
|
+
"increment",
|
|
318
|
+
"value",
|
|
319
|
+
// Misc operations
|
|
320
|
+
"exists",
|
|
321
|
+
"replace",
|
|
322
|
+
"cascade",
|
|
323
|
+
"restrict",
|
|
324
|
+
"to",
|
|
325
|
+
"pause",
|
|
326
|
+
"resume",
|
|
327
|
+
"query",
|
|
328
|
+
"rename",
|
|
329
|
+
"rownum",
|
|
330
|
+
"dictionary",
|
|
331
|
+
"for",
|
|
332
|
+
"output",
|
|
333
|
+
"append",
|
|
334
|
+
"assert",
|
|
335
|
+
"patch",
|
|
336
|
+
// Enums & pattern matching
|
|
337
|
+
"enum",
|
|
338
|
+
"match",
|
|
339
|
+
// Procedures & events
|
|
340
|
+
"procedure",
|
|
341
|
+
"event",
|
|
342
|
+
"handler",
|
|
343
|
+
"dispatch",
|
|
344
|
+
"tag",
|
|
345
|
+
// Testing
|
|
346
|
+
"test",
|
|
347
|
+
"tests",
|
|
348
|
+
"run",
|
|
349
|
+
// Access control
|
|
350
|
+
"user",
|
|
351
|
+
"role",
|
|
352
|
+
"grant",
|
|
353
|
+
"revoke",
|
|
354
|
+
"password",
|
|
355
|
+
"require",
|
|
356
|
+
"execute",
|
|
357
|
+
"access",
|
|
358
|
+
"subscribe",
|
|
359
|
+
"enable",
|
|
360
|
+
"disable",
|
|
361
|
+
// System objects
|
|
362
|
+
"function",
|
|
363
|
+
"session",
|
|
364
|
+
"feature",
|
|
365
|
+
// Migrations
|
|
366
|
+
"add",
|
|
367
|
+
"migration",
|
|
368
|
+
"migrate",
|
|
369
|
+
"rollback",
|
|
370
|
+
"diff",
|
|
371
|
+
"version",
|
|
372
|
+
"current",
|
|
373
|
+
"pending",
|
|
374
|
+
// Misc
|
|
375
|
+
"authentication",
|
|
376
|
+
"contains",
|
|
377
|
+
"remote",
|
|
378
|
+
"error",
|
|
379
|
+
// Additional keywords (not in keyword.rs but valid RQL constructs)
|
|
380
|
+
"derive",
|
|
381
|
+
"group",
|
|
382
|
+
"union",
|
|
383
|
+
"as",
|
|
384
|
+
// Word operators
|
|
385
|
+
"and",
|
|
386
|
+
"or",
|
|
387
|
+
"not",
|
|
388
|
+
"xor"
|
|
232
389
|
];
|
|
233
390
|
var MODULES = ["date", "math", "text"];
|
|
234
391
|
var BUILTIN_FUNCTIONS = ["case"];
|
|
235
|
-
var KEYWORDS = ["set", "as", "on", "by"];
|
|
236
392
|
var LITERALS = ["none", "true", "false"];
|
|
393
|
+
var TYPE_KEYWORDS = [
|
|
394
|
+
// Signed integers
|
|
395
|
+
"int1",
|
|
396
|
+
"int2",
|
|
397
|
+
"int4",
|
|
398
|
+
"int8",
|
|
399
|
+
"int16",
|
|
400
|
+
"int",
|
|
401
|
+
// Unsigned integers
|
|
402
|
+
"uint1",
|
|
403
|
+
"uint2",
|
|
404
|
+
"uint4",
|
|
405
|
+
"uint8",
|
|
406
|
+
"uint16",
|
|
407
|
+
"uint",
|
|
408
|
+
// Floating point
|
|
409
|
+
"float4",
|
|
410
|
+
"float8",
|
|
411
|
+
// Text & binary
|
|
412
|
+
"utf8",
|
|
413
|
+
"blob",
|
|
414
|
+
// Boolean
|
|
415
|
+
"bool",
|
|
416
|
+
"boolean",
|
|
417
|
+
// Numeric
|
|
418
|
+
"decimal",
|
|
419
|
+
// Temporal
|
|
420
|
+
"date",
|
|
421
|
+
"datetime",
|
|
422
|
+
"time",
|
|
423
|
+
"duration",
|
|
424
|
+
"interval",
|
|
425
|
+
// Identifiers & UUIDs
|
|
426
|
+
"uuid4",
|
|
427
|
+
"uuid7",
|
|
428
|
+
"identityid",
|
|
429
|
+
"identity_id",
|
|
430
|
+
"dictionaryid",
|
|
431
|
+
"dictionary_id",
|
|
432
|
+
// Special
|
|
433
|
+
"any",
|
|
434
|
+
// Container types
|
|
435
|
+
"Option",
|
|
436
|
+
"List",
|
|
437
|
+
"Record",
|
|
438
|
+
"Tuple",
|
|
439
|
+
// Alias
|
|
440
|
+
"text"
|
|
441
|
+
];
|
|
237
442
|
var rqlLanguageDefinition = {
|
|
238
|
-
defaultToken: "
|
|
443
|
+
defaultToken: "",
|
|
239
444
|
ignoreCase: true,
|
|
240
|
-
keywords: [...
|
|
445
|
+
keywords: [...KEYWORDS, ...MODULES, ...BUILTIN_FUNCTIONS],
|
|
446
|
+
constants: LITERALS,
|
|
447
|
+
typeKeywords: TYPE_KEYWORDS,
|
|
241
448
|
operators: ["+", "-", "*", "/", "//", "%", "=", "==", "!=", "->", "=>", ">", "<", ">=", "<=", "~=", "&&", "||", "??"],
|
|
242
449
|
tokenizer: {
|
|
243
450
|
root: [
|
|
244
451
|
// Comments
|
|
245
452
|
[/#.*/, "comment"],
|
|
246
|
-
//
|
|
247
|
-
[
|
|
453
|
+
// Namespace separator (must precede named arguments)
|
|
454
|
+
[/::/, "operator"],
|
|
455
|
+
// Named arguments (negative lookahead prevents matching `::`)
|
|
456
|
+
[/(\w+)\s*:(?!:)/, "key"],
|
|
457
|
+
// Variable references
|
|
458
|
+
[/\$[\w$]+/, "variable"],
|
|
248
459
|
// Identifiers and keywords (case insensitive)
|
|
249
460
|
[
|
|
250
|
-
/[a-zA-Z_
|
|
461
|
+
/[a-zA-Z_][\w$]*/,
|
|
251
462
|
{
|
|
252
463
|
cases: {
|
|
253
464
|
"@keywords": "keyword",
|
|
465
|
+
"@constants": "constant",
|
|
466
|
+
"@typeKeywords": "type",
|
|
254
467
|
"@default": "identifier"
|
|
255
468
|
}
|
|
256
469
|
}
|
|
@@ -259,19 +472,23 @@ var rqlLanguageDefinition = {
|
|
|
259
472
|
{ include: "@whitespace" },
|
|
260
473
|
// Brackets
|
|
261
474
|
[/[{}()[\]]/, "@brackets"],
|
|
262
|
-
// Numbers with underscores support
|
|
263
|
-
[/[+-]?(?:[\d_]+(?:\.[\d_]+)?|\.[\d_]+)
|
|
475
|
+
// Numbers with underscores and scientific notation support
|
|
476
|
+
[/[+-]?(?:[\d_]+(?:\.[\d_]+)?|\.[\d_]+)(?:[eE][+-]?\d+)?/, "number"],
|
|
264
477
|
// Strings
|
|
265
478
|
[/"([^"\\]|\\.)*$/, "string.invalid"],
|
|
266
479
|
[/"/, { token: "string.quote", bracket: "@open", next: "@string" }],
|
|
267
480
|
// Single-quoted strings
|
|
268
481
|
[/'([^'\\]|\\.)*$/, "string.invalid"],
|
|
269
482
|
[/'/, { token: "string.quote", bracket: "@open", next: "@singlestring" }],
|
|
270
|
-
// Operators
|
|
271
|
-
[
|
|
483
|
+
// Operators — multi-char first for longest match
|
|
484
|
+
[/<<|>>|\.\./, "operator"],
|
|
485
|
+
[/==|!=|->|=>|>=|<=|~=|:=/, "operator"],
|
|
486
|
+
[/&&|\|\||\?\?/, "operator"],
|
|
272
487
|
[/\/\//, "operator"],
|
|
273
|
-
|
|
274
|
-
[
|
|
488
|
+
// Single-char operators
|
|
489
|
+
[/[+\-*/%|.=<>!&^?]/, "operator"],
|
|
490
|
+
// Delimiters
|
|
491
|
+
[/[;,]/, "delimiter"]
|
|
275
492
|
],
|
|
276
493
|
string: [
|
|
277
494
|
[/[^\\"]+/, "string"],
|
|
@@ -284,22 +501,13 @@ var rqlLanguageDefinition = {
|
|
|
284
501
|
[/'/, { token: "string.quote", bracket: "@close", next: "@pop" }]
|
|
285
502
|
],
|
|
286
503
|
whitespace: [
|
|
287
|
-
[/[ \t\r\n]+/, "white"]
|
|
288
|
-
[/\/\*/, "comment", "@comment"],
|
|
289
|
-
[/\/\/.*$/, "comment"]
|
|
290
|
-
],
|
|
291
|
-
comment: [
|
|
292
|
-
[/[^/*]+/, "comment"],
|
|
293
|
-
[/\/\*/, "comment", "@push"],
|
|
294
|
-
[/\*\//, "comment", "@pop"],
|
|
295
|
-
[/[/*]/, "comment"]
|
|
504
|
+
[/[ \t\r\n]+/, "white"]
|
|
296
505
|
]
|
|
297
506
|
}
|
|
298
507
|
};
|
|
299
508
|
var rqlLanguageConfiguration = {
|
|
300
509
|
comments: {
|
|
301
|
-
lineComment: "#"
|
|
302
|
-
blockComment: ["/*", "*/"]
|
|
510
|
+
lineComment: "#"
|
|
303
511
|
},
|
|
304
512
|
brackets: [
|
|
305
513
|
["{", "}"],
|
|
@@ -641,12 +849,99 @@ function ResultsTable({ data }) {
|
|
|
641
849
|
}
|
|
642
850
|
|
|
643
851
|
// src/components/results/ResultsError.tsx
|
|
644
|
-
import { jsx as jsx7
|
|
645
|
-
function
|
|
646
|
-
return
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
852
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
853
|
+
function getLine(source, line) {
|
|
854
|
+
return source.split("\n")[line - 1] ?? "";
|
|
855
|
+
}
|
|
856
|
+
function renderFlat(d) {
|
|
857
|
+
const lines = [];
|
|
858
|
+
lines.push(`Error ${d.code}`);
|
|
859
|
+
lines.push(` ${d.message}`);
|
|
860
|
+
lines.push("");
|
|
861
|
+
if (d.fragment?.line != null && d.fragment.column != null) {
|
|
862
|
+
const { text: fragment, line, column } = d.fragment;
|
|
863
|
+
const statement = d.statement ?? "";
|
|
864
|
+
lines.push("LOCATION");
|
|
865
|
+
lines.push(` line ${line}, column ${column}`);
|
|
866
|
+
lines.push("");
|
|
867
|
+
const lineContent = getLine(statement, line);
|
|
868
|
+
lines.push("CODE");
|
|
869
|
+
lines.push(` ${line} \u2502 ${lineContent}`);
|
|
870
|
+
const fragmentStart = lineContent.indexOf(fragment) !== -1 ? lineContent.indexOf(fragment) : column;
|
|
871
|
+
lines.push(` \u2502 ${" ".repeat(fragmentStart)}${"~".repeat(fragment.length)}`);
|
|
872
|
+
lines.push(" \u2502");
|
|
873
|
+
const labelText = d.label ?? "";
|
|
874
|
+
if (labelText) {
|
|
875
|
+
const fragmentCenter = fragmentStart + Math.floor(fragment.length / 2);
|
|
876
|
+
const labelHalf = Math.floor(labelText.length / 2);
|
|
877
|
+
const labelOffset = labelHalf > fragmentCenter ? 0 : fragmentCenter - labelHalf;
|
|
878
|
+
lines.push(` \u2502 ${" ".repeat(labelOffset)}${labelText}`);
|
|
879
|
+
}
|
|
880
|
+
lines.push("");
|
|
881
|
+
}
|
|
882
|
+
if (d.help) {
|
|
883
|
+
lines.push("HELP");
|
|
884
|
+
lines.push(` ${d.help}`);
|
|
885
|
+
lines.push("");
|
|
886
|
+
}
|
|
887
|
+
if (d.notes.length > 0) {
|
|
888
|
+
lines.push("NOTES");
|
|
889
|
+
for (const note of d.notes) {
|
|
890
|
+
lines.push(` \u2022 ${note}`);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
return lines.join("\n");
|
|
894
|
+
}
|
|
895
|
+
function renderNested(d, depth) {
|
|
896
|
+
const lines = [];
|
|
897
|
+
const indent = depth === 0 ? "" : " ";
|
|
898
|
+
const prefix = depth === 0 ? "" : "\u21B3 ";
|
|
899
|
+
lines.push(`${indent}${prefix}Error ${d.code}: ${d.message}`);
|
|
900
|
+
if (d.fragment?.line != null && d.fragment.column != null) {
|
|
901
|
+
const { text: fragment, line, column } = d.fragment;
|
|
902
|
+
const statement = d.statement ?? "";
|
|
903
|
+
const atText = statement ? `"${fragment}"` : "unknown";
|
|
904
|
+
lines.push(`${indent} at ${atText} (line ${line}, column ${column})`);
|
|
905
|
+
lines.push("");
|
|
906
|
+
const lineContent = getLine(statement, line);
|
|
907
|
+
lines.push(`${indent} ${line} \u2502 ${lineContent}`);
|
|
908
|
+
const fragmentStart = lineContent.indexOf(fragment) !== -1 ? lineContent.indexOf(fragment) : column;
|
|
909
|
+
lines.push(`${indent} \u2502 ${" ".repeat(fragmentStart)}${"~".repeat(fragment.length)}`);
|
|
910
|
+
const labelText = d.label ?? "";
|
|
911
|
+
if (labelText) {
|
|
912
|
+
const fragmentCenter = fragmentStart + Math.floor(fragment.length / 2);
|
|
913
|
+
const labelHalf = Math.floor(labelText.length / 2);
|
|
914
|
+
const labelOffset = labelHalf > fragmentCenter ? 0 : fragmentCenter - labelHalf;
|
|
915
|
+
lines.push(`${indent} \u2502 ${" ".repeat(labelOffset)}${labelText}`);
|
|
916
|
+
}
|
|
917
|
+
lines.push("");
|
|
918
|
+
}
|
|
919
|
+
if (d.cause) {
|
|
920
|
+
lines.push(renderNested(d.cause, depth + 1));
|
|
921
|
+
}
|
|
922
|
+
if (d.help) {
|
|
923
|
+
lines.push(`${indent} help: ${d.help}`);
|
|
924
|
+
}
|
|
925
|
+
if (d.notes.length > 0) {
|
|
926
|
+
for (const note of d.notes) {
|
|
927
|
+
lines.push(`${indent} note: ${note}`);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
if (depth > 0) {
|
|
931
|
+
lines.push("");
|
|
932
|
+
}
|
|
933
|
+
return lines.join("\n");
|
|
934
|
+
}
|
|
935
|
+
function renderDiagnostic(d) {
|
|
936
|
+
if (d.cause) {
|
|
937
|
+
return renderNested(d, 0);
|
|
938
|
+
}
|
|
939
|
+
return renderFlat(d);
|
|
940
|
+
}
|
|
941
|
+
function ResultsError({ message, diagnostic }) {
|
|
942
|
+
const text = diagnostic ? renderDiagnostic(diagnostic) : `Error
|
|
943
|
+
${message}`;
|
|
944
|
+
return /* @__PURE__ */ jsx7("div", { className: "rdb-results__error", children: /* @__PURE__ */ jsx7("pre", { children: text }) });
|
|
650
945
|
}
|
|
651
946
|
|
|
652
947
|
// src/components/results/ResultsEmpty.tsx
|
|
@@ -657,7 +952,7 @@ function ResultsEmpty() {
|
|
|
657
952
|
|
|
658
953
|
// src/components/results/ResultsStatusBar.tsx
|
|
659
954
|
import { useCallback as useCallback2 } from "react";
|
|
660
|
-
import { jsx as jsx9, jsxs as
|
|
955
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
661
956
|
function ResultsStatusBar({ rowCount, executionTime, data }) {
|
|
662
957
|
const copyAsCsv = useCallback2(() => {
|
|
663
958
|
if (!data || data.length === 0) return;
|
|
@@ -682,20 +977,20 @@ function ResultsStatusBar({ rowCount, executionTime, data }) {
|
|
|
682
977
|
});
|
|
683
978
|
navigator.clipboard.writeText(JSON.stringify(serialized, null, 2));
|
|
684
979
|
}, [data]);
|
|
685
|
-
return /* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
/* @__PURE__ */
|
|
980
|
+
return /* @__PURE__ */ jsxs4("div", { className: "rdb-status-bar", children: [
|
|
981
|
+
/* @__PURE__ */ jsxs4("div", { className: "rdb-status-bar__info", children: [
|
|
982
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
688
983
|
rowCount,
|
|
689
984
|
" row",
|
|
690
985
|
rowCount !== 1 ? "s" : ""
|
|
691
986
|
] }),
|
|
692
|
-
/* @__PURE__ */
|
|
987
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
693
988
|
"(",
|
|
694
989
|
executionTime,
|
|
695
990
|
"ms)"
|
|
696
991
|
] })
|
|
697
992
|
] }),
|
|
698
|
-
/* @__PURE__ */
|
|
993
|
+
/* @__PURE__ */ jsxs4("div", { className: "rdb-status-bar__actions", children: [
|
|
699
994
|
/* @__PURE__ */ jsx9("button", { className: "rdb-status-bar__btn", onClick: copyAsCsv, title: "Copy as CSV", children: "[CSV]" }),
|
|
700
995
|
/* @__PURE__ */ jsx9("button", { className: "rdb-status-bar__btn", onClick: copyAsJson, title: "Copy as JSON", children: "[JSON]" })
|
|
701
996
|
] })
|
|
@@ -703,19 +998,19 @@ function ResultsStatusBar({ rowCount, executionTime, data }) {
|
|
|
703
998
|
}
|
|
704
999
|
|
|
705
1000
|
// src/components/results/ResultsPanel.tsx
|
|
706
|
-
import { Fragment, jsx as jsx10, jsxs as
|
|
1001
|
+
import { Fragment, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
707
1002
|
function ResultsPanel({ result }) {
|
|
708
1003
|
if (!result) {
|
|
709
1004
|
return /* @__PURE__ */ jsx10("div", { className: "rdb-results__empty", children: "$ run a query to see results" });
|
|
710
1005
|
}
|
|
711
1006
|
if (!result.success && result.error) {
|
|
712
|
-
return /* @__PURE__ */ jsx10(ResultsError, { message: result.error });
|
|
1007
|
+
return /* @__PURE__ */ jsx10(ResultsError, { message: result.error, diagnostic: result.diagnostic });
|
|
713
1008
|
}
|
|
714
1009
|
const data = result.data ?? [];
|
|
715
1010
|
if (data.length === 0) {
|
|
716
1011
|
return /* @__PURE__ */ jsx10(ResultsEmpty, {});
|
|
717
1012
|
}
|
|
718
|
-
return /* @__PURE__ */
|
|
1013
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
719
1014
|
/* @__PURE__ */ jsx10(ResultsTable, { data }),
|
|
720
1015
|
/* @__PURE__ */ jsx10(
|
|
721
1016
|
ResultsStatusBar,
|
|
@@ -733,12 +1028,12 @@ import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
|
733
1028
|
|
|
734
1029
|
// src/components/schema/SchemaNode.tsx
|
|
735
1030
|
import { useState as useState2 } from "react";
|
|
736
|
-
import { jsx as jsx11, jsxs as
|
|
1031
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
737
1032
|
function SchemaNode({ label, labelClass, type, typeClass, children }) {
|
|
738
1033
|
const [expanded, setExpanded] = useState2(false);
|
|
739
1034
|
const hasChildren = !!children;
|
|
740
|
-
return /* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
1035
|
+
return /* @__PURE__ */ jsxs6("div", { className: "rdb-schema__node", children: [
|
|
1036
|
+
/* @__PURE__ */ jsxs6(
|
|
742
1037
|
"div",
|
|
743
1038
|
{
|
|
744
1039
|
className: "rdb-schema__node-header",
|
|
@@ -756,7 +1051,7 @@ function SchemaNode({ label, labelClass, type, typeClass, children }) {
|
|
|
756
1051
|
}
|
|
757
1052
|
|
|
758
1053
|
// src/components/schema/SchemaBrowser.tsx
|
|
759
|
-
import { Fragment as Fragment2, jsx as jsx12, jsxs as
|
|
1054
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
760
1055
|
var TYPE_NAMES = {
|
|
761
1056
|
1: "Float4",
|
|
762
1057
|
2: "Float8",
|
|
@@ -994,18 +1289,18 @@ function SchemaBrowser({ executor }) {
|
|
|
994
1289
|
}
|
|
995
1290
|
) });
|
|
996
1291
|
if (loading) {
|
|
997
|
-
return /* @__PURE__ */
|
|
1292
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
998
1293
|
toolbar,
|
|
999
1294
|
/* @__PURE__ */ jsx12("div", { className: "rdb-history__empty", children: "$ loading schema..." })
|
|
1000
1295
|
] });
|
|
1001
1296
|
}
|
|
1002
1297
|
if (namespaces.length === 0) {
|
|
1003
|
-
return /* @__PURE__ */
|
|
1298
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1004
1299
|
toolbar,
|
|
1005
1300
|
/* @__PURE__ */ jsx12("div", { className: "rdb-history__empty", children: "$ no tables found" })
|
|
1006
1301
|
] });
|
|
1007
1302
|
}
|
|
1008
|
-
return /* @__PURE__ */
|
|
1303
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1009
1304
|
toolbar,
|
|
1010
1305
|
/* @__PURE__ */ jsx12("div", { children: namespaces.map((ns) => /* @__PURE__ */ jsx12(SchemaNode, { label: ns.name, labelClass: "rdb-schema__node-label--namespace", children: CATEGORY_GROUPS.map(({ key, label }) => {
|
|
1011
1306
|
const sources = ns.sources.filter((s) => s.category === key);
|
|
@@ -1028,7 +1323,7 @@ function SchemaBrowser({ executor }) {
|
|
|
1028
1323
|
import { useState as useState4 } from "react";
|
|
1029
1324
|
|
|
1030
1325
|
// src/components/history/HistoryEntry.tsx
|
|
1031
|
-
import { jsx as jsx13, jsxs as
|
|
1326
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1032
1327
|
function formatTimestamp(ts) {
|
|
1033
1328
|
const d = new Date(ts);
|
|
1034
1329
|
const hh = String(d.getHours()).padStart(2, "0");
|
|
@@ -1037,11 +1332,11 @@ function formatTimestamp(ts) {
|
|
|
1037
1332
|
return `${hh}:${mm}:${ss}`;
|
|
1038
1333
|
}
|
|
1039
1334
|
function HistoryEntryRow({ entry, onClick }) {
|
|
1040
|
-
return /* @__PURE__ */
|
|
1041
|
-
/* @__PURE__ */
|
|
1335
|
+
return /* @__PURE__ */ jsxs8("div", { className: "rdb-history__entry", onClick: () => onClick(entry.query), children: [
|
|
1336
|
+
/* @__PURE__ */ jsxs8("div", { className: "rdb-history__entry-meta", children: [
|
|
1042
1337
|
/* @__PURE__ */ jsx13("span", { children: formatTimestamp(entry.timestamp) }),
|
|
1043
|
-
/* @__PURE__ */
|
|
1044
|
-
/* @__PURE__ */
|
|
1338
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
|
|
1339
|
+
/* @__PURE__ */ jsxs8("span", { children: [
|
|
1045
1340
|
entry.executionTime,
|
|
1046
1341
|
"ms"
|
|
1047
1342
|
] }),
|
|
@@ -1058,11 +1353,11 @@ function HistoryEntryRow({ entry, onClick }) {
|
|
|
1058
1353
|
}
|
|
1059
1354
|
|
|
1060
1355
|
// src/components/history/HistoryPanel.tsx
|
|
1061
|
-
import { jsx as jsx14, jsxs as
|
|
1356
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1062
1357
|
function HistoryPanel({ entries, onSelect }) {
|
|
1063
1358
|
const [search, setSearch] = useState4("");
|
|
1064
1359
|
const filtered = search ? entries.filter((e) => e.query.toLowerCase().includes(search.toLowerCase())) : entries;
|
|
1065
|
-
return /* @__PURE__ */
|
|
1360
|
+
return /* @__PURE__ */ jsxs9("div", { className: "rdb-history", children: [
|
|
1066
1361
|
/* @__PURE__ */ jsx14("div", { className: "rdb-history__search", children: /* @__PURE__ */ jsx14(
|
|
1067
1362
|
"input",
|
|
1068
1363
|
{
|
|
@@ -1079,7 +1374,7 @@ function HistoryPanel({ entries, onSelect }) {
|
|
|
1079
1374
|
|
|
1080
1375
|
// src/components/connection/ConnectionPanel.tsx
|
|
1081
1376
|
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
1082
|
-
import { Fragment as Fragment3, jsx as jsx15, jsxs as
|
|
1377
|
+
import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1083
1378
|
function ConnectionPanel({
|
|
1084
1379
|
mode,
|
|
1085
1380
|
wsUrl,
|
|
@@ -1110,9 +1405,9 @@ function ConnectionPanel({
|
|
|
1110
1405
|
}, [onClose]);
|
|
1111
1406
|
const isWsConnected = mode === "websocket" && status === "connected";
|
|
1112
1407
|
const isWsConnecting = mode === "websocket" && status === "connecting";
|
|
1113
|
-
return /* @__PURE__ */
|
|
1408
|
+
return /* @__PURE__ */ jsxs10("div", { className: "rdb-connection-panel", ref: panelRef, children: [
|
|
1114
1409
|
/* @__PURE__ */ jsx15("div", { className: "rdb-connection-panel__header", children: "connection" }),
|
|
1115
|
-
/* @__PURE__ */
|
|
1410
|
+
/* @__PURE__ */ jsxs10("div", { className: "rdb-connection-panel__modes", children: [
|
|
1116
1411
|
/* @__PURE__ */ jsx15(
|
|
1117
1412
|
"button",
|
|
1118
1413
|
{
|
|
@@ -1130,8 +1425,8 @@ function ConnectionPanel({
|
|
|
1130
1425
|
}
|
|
1131
1426
|
)
|
|
1132
1427
|
] }),
|
|
1133
|
-
mode === "websocket" && /* @__PURE__ */
|
|
1134
|
-
/* @__PURE__ */
|
|
1428
|
+
mode === "websocket" && /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1429
|
+
/* @__PURE__ */ jsxs10("div", { className: "rdb-connection-panel__url-row", children: [
|
|
1135
1430
|
/* @__PURE__ */ jsx15("span", { className: "rdb-connection-panel__url-label", children: "url:" }),
|
|
1136
1431
|
/* @__PURE__ */ jsx15(
|
|
1137
1432
|
"input",
|
|
@@ -1155,7 +1450,7 @@ function ConnectionPanel({
|
|
|
1155
1450
|
}
|
|
1156
1451
|
) })
|
|
1157
1452
|
] }),
|
|
1158
|
-
/* @__PURE__ */
|
|
1453
|
+
/* @__PURE__ */ jsxs10("div", { className: "rdb-connection-panel__status", children: [
|
|
1159
1454
|
/* @__PURE__ */ jsx15("span", { className: `rdb-connection-panel__status-dot rdb-connection-panel__status-dot--${status}`, children: "\u25CF" }),
|
|
1160
1455
|
/* @__PURE__ */ jsx15("span", { children: status })
|
|
1161
1456
|
] }),
|
|
@@ -1164,7 +1459,7 @@ function ConnectionPanel({
|
|
|
1164
1459
|
}
|
|
1165
1460
|
|
|
1166
1461
|
// src/components/Console.tsx
|
|
1167
|
-
import { jsx as jsx16, jsxs as
|
|
1462
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1168
1463
|
var TABS = [
|
|
1169
1464
|
{ id: "results", label: "Results" },
|
|
1170
1465
|
{ id: "history", label: "History" },
|
|
@@ -1336,8 +1631,8 @@ function ConsoleInner({ executor, historyKey, connection, theme = "light" }) {
|
|
|
1336
1631
|
const handleSelectHistory = useCallback3((query) => {
|
|
1337
1632
|
dispatch({ type: "LOAD_QUERY", code: query });
|
|
1338
1633
|
}, [dispatch]);
|
|
1339
|
-
const editorPane = /* @__PURE__ */
|
|
1340
|
-
/* @__PURE__ */
|
|
1634
|
+
const editorPane = /* @__PURE__ */ jsxs11("div", { style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
|
|
1635
|
+
/* @__PURE__ */ jsxs11("div", { style: { position: "relative" }, children: [
|
|
1341
1636
|
/* @__PURE__ */ jsx16(
|
|
1342
1637
|
EditorToolbar,
|
|
1343
1638
|
{
|
|
@@ -1375,7 +1670,7 @@ function ConsoleInner({ executor, historyKey, connection, theme = "light" }) {
|
|
|
1375
1670
|
}
|
|
1376
1671
|
) })
|
|
1377
1672
|
] });
|
|
1378
|
-
const bottomPane = /* @__PURE__ */
|
|
1673
|
+
const bottomPane = /* @__PURE__ */ jsxs11("div", { style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
|
|
1379
1674
|
/* @__PURE__ */ jsx16(
|
|
1380
1675
|
TabBar,
|
|
1381
1676
|
{
|
|
@@ -1397,17 +1692,17 @@ import { useState as useState6, useCallback as useCallback4, useEffect as useEff
|
|
|
1397
1692
|
import Editor2 from "@monaco-editor/react";
|
|
1398
1693
|
|
|
1399
1694
|
// src/components/SnippetResults.tsx
|
|
1400
|
-
import { jsx as jsx17, jsxs as
|
|
1695
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1401
1696
|
function SnippetResults({ data, columns, maxKeyLength }) {
|
|
1402
|
-
return /* @__PURE__ */ jsx17("div", { className: "rdb-snippet__rows", children: data.map((row, i) => /* @__PURE__ */
|
|
1403
|
-
/* @__PURE__ */
|
|
1697
|
+
return /* @__PURE__ */ jsx17("div", { className: "rdb-snippet__rows", children: data.map((row, i) => /* @__PURE__ */ jsxs12("div", { className: "rdb-snippet__row", children: [
|
|
1698
|
+
/* @__PURE__ */ jsxs12("div", { className: "rdb-snippet__row-label", children: [
|
|
1404
1699
|
"-- row ",
|
|
1405
1700
|
i + 1,
|
|
1406
1701
|
" --"
|
|
1407
1702
|
] }),
|
|
1408
1703
|
columns.map((col) => {
|
|
1409
1704
|
const vs = getValueStyle(row[col]);
|
|
1410
|
-
return /* @__PURE__ */
|
|
1705
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rdb-snippet__field", children: [
|
|
1411
1706
|
/* @__PURE__ */ jsx17(
|
|
1412
1707
|
"span",
|
|
1413
1708
|
{
|
|
@@ -1431,7 +1726,7 @@ function SnippetResults({ data, columns, maxKeyLength }) {
|
|
|
1431
1726
|
}
|
|
1432
1727
|
|
|
1433
1728
|
// src/components/Snippet.tsx
|
|
1434
|
-
import { jsx as jsx18, jsxs as
|
|
1729
|
+
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1435
1730
|
function Snippet({
|
|
1436
1731
|
executor,
|
|
1437
1732
|
initialCode,
|
|
@@ -1507,14 +1802,14 @@ function Snippet({
|
|
|
1507
1802
|
};
|
|
1508
1803
|
const columns = result?.data && result.data.length > 0 ? Object.keys(result.data[0]) : [];
|
|
1509
1804
|
const maxKeyLength = columns.length > 0 ? Math.max(...columns.map((c) => c.length)) : 0;
|
|
1510
|
-
const content = /* @__PURE__ */
|
|
1511
|
-
/* @__PURE__ */
|
|
1512
|
-
/* @__PURE__ */
|
|
1805
|
+
const content = /* @__PURE__ */ jsxs13("div", { className: `rdb-snippet${isFullscreen ? " rdb-snippet--fullscreen" : ""}${theme === "light" ? " rdb-theme-light" : ""}${className ? ` ${className}` : ""}`, children: [
|
|
1806
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__header", children: [
|
|
1807
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__title", children: [
|
|
1513
1808
|
/* @__PURE__ */ jsx18("span", { className: "rdb-snippet__title-marker", children: "$" }),
|
|
1514
1809
|
" ",
|
|
1515
1810
|
title
|
|
1516
1811
|
] }),
|
|
1517
|
-
/* @__PURE__ */
|
|
1812
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__actions", children: [
|
|
1518
1813
|
/* @__PURE__ */ jsx18(
|
|
1519
1814
|
"button",
|
|
1520
1815
|
{
|
|
@@ -1544,7 +1839,7 @@ function Snippet({
|
|
|
1544
1839
|
)
|
|
1545
1840
|
] })
|
|
1546
1841
|
] }),
|
|
1547
|
-
description && /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__description", children: /* @__PURE__ */
|
|
1842
|
+
description && /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__description", children: /* @__PURE__ */ jsxs13("p", { className: "rdb-snippet__description-text", children: [
|
|
1548
1843
|
/* @__PURE__ */ jsx18("span", { className: "rdb-snippet__description-marker", children: "// " }),
|
|
1549
1844
|
description
|
|
1550
1845
|
] }) }),
|
|
@@ -1589,7 +1884,7 @@ function Snippet({
|
|
|
1589
1884
|
)
|
|
1590
1885
|
}
|
|
1591
1886
|
),
|
|
1592
|
-
/* @__PURE__ */
|
|
1887
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__toolbar", children: [
|
|
1593
1888
|
/* @__PURE__ */ jsx18("span", { className: "rdb-snippet__hint", children: isExecuting ? "$ running..." : "$ ctrl+enter to run" }),
|
|
1594
1889
|
/* @__PURE__ */ jsx18(
|
|
1595
1890
|
"button",
|
|
@@ -1601,10 +1896,10 @@ function Snippet({
|
|
|
1601
1896
|
}
|
|
1602
1897
|
)
|
|
1603
1898
|
] }),
|
|
1604
|
-
result && /* @__PURE__ */
|
|
1605
|
-
/* @__PURE__ */
|
|
1899
|
+
result && /* @__PURE__ */ jsxs13("div", { className: `rdb-snippet__results${isFullscreen ? " rdb-snippet__results--fullscreen" : ""}`, children: [
|
|
1900
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__results-header", children: [
|
|
1606
1901
|
/* @__PURE__ */ jsx18("span", { children: result.error ? "--- error ---" : "--- output ---" }),
|
|
1607
|
-
result.data && !result.error && /* @__PURE__ */
|
|
1902
|
+
result.data && !result.error && /* @__PURE__ */ jsxs13("span", { children: [
|
|
1608
1903
|
"(",
|
|
1609
1904
|
result.data.length,
|
|
1610
1905
|
" row",
|
|
@@ -1612,7 +1907,7 @@ function Snippet({
|
|
|
1612
1907
|
")"
|
|
1613
1908
|
] })
|
|
1614
1909
|
] }),
|
|
1615
|
-
result.error && /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__error", children: /* @__PURE__ */
|
|
1910
|
+
result.error && /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__error", children: /* @__PURE__ */ jsxs13("pre", { className: "rdb-snippet__error-text", children: [
|
|
1616
1911
|
"ERR: ",
|
|
1617
1912
|
result.error
|
|
1618
1913
|
] }) }),
|
|
@@ -1649,9 +1944,24 @@ var WasmExecutor = class {
|
|
|
1649
1944
|
};
|
|
1650
1945
|
} catch (error) {
|
|
1651
1946
|
const executionTime = Math.round(performance.now() - startTime);
|
|
1947
|
+
let diagnostic;
|
|
1948
|
+
if (error && typeof error === "object" && "code" in error) {
|
|
1949
|
+
const e = error;
|
|
1950
|
+
diagnostic = {
|
|
1951
|
+
code: String(e.code),
|
|
1952
|
+
message: String(e.message ?? ""),
|
|
1953
|
+
statement: e.statement,
|
|
1954
|
+
fragment: e.fragment,
|
|
1955
|
+
label: e.label,
|
|
1956
|
+
help: e.help,
|
|
1957
|
+
notes: Array.isArray(e.notes) ? e.notes.map(String) : [],
|
|
1958
|
+
cause: e.cause
|
|
1959
|
+
};
|
|
1960
|
+
}
|
|
1652
1961
|
return {
|
|
1653
1962
|
success: false,
|
|
1654
1963
|
error: error instanceof Error ? error.message : String(error),
|
|
1964
|
+
diagnostic,
|
|
1655
1965
|
executionTime
|
|
1656
1966
|
};
|
|
1657
1967
|
}
|