@questdb/sql-parser 0.1.0

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.
@@ -0,0 +1,709 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/grammar/index.ts
21
+ var grammar_exports = {};
22
+ __export(grammar_exports, {
23
+ constants: () => constants,
24
+ dataTypes: () => dataTypes,
25
+ functions: () => functions,
26
+ keywords: () => keywords,
27
+ operators: () => operators
28
+ });
29
+ module.exports = __toCommonJS(grammar_exports);
30
+
31
+ // src/grammar/keywords.ts
32
+ var keywords = [
33
+ "abort",
34
+ "account",
35
+ "accounts",
36
+ "add",
37
+ "alias",
38
+ "align",
39
+ "all",
40
+ "alter",
41
+ "and",
42
+ "any",
43
+ "as",
44
+ "asof",
45
+ "assume",
46
+ "attach",
47
+ "atomic",
48
+ "backup",
49
+ "base",
50
+ "batch",
51
+ "between",
52
+ "by",
53
+ "bypass",
54
+ "cache",
55
+ "calendar",
56
+ "cancel",
57
+ "capacity",
58
+ "cascade",
59
+ "case",
60
+ "cast",
61
+ "checkpoint",
62
+ "column",
63
+ "columns",
64
+ "compile",
65
+ "compression_codec",
66
+ "compression_level",
67
+ "commitLag",
68
+ "convert",
69
+ "copy",
70
+ "create",
71
+ "cross",
72
+ "cumulative",
73
+ "current",
74
+ "data_page_size",
75
+ "database",
76
+ "declare",
77
+ "dedup",
78
+ "default",
79
+ "deferred",
80
+ "delay",
81
+ "delete",
82
+ "delimiter",
83
+ "detach",
84
+ "details",
85
+ "disable",
86
+ "distinct",
87
+ "drop",
88
+ "else",
89
+ "enable",
90
+ "end",
91
+ "error",
92
+ "every",
93
+ "except",
94
+ "exclude",
95
+ "exclusive",
96
+ "exists",
97
+ "exit",
98
+ "explain",
99
+ "external",
100
+ "fill",
101
+ "first",
102
+ "following",
103
+ "for",
104
+ "foreign",
105
+ "format",
106
+ "from",
107
+ "full",
108
+ "grant",
109
+ "group",
110
+ "groups",
111
+ "header",
112
+ "horizon",
113
+ "http",
114
+ "if",
115
+ "ignore",
116
+ "ilike",
117
+ "in",
118
+ "include",
119
+ "index",
120
+ "inner",
121
+ "insert",
122
+ "intersect",
123
+ "into",
124
+ "is",
125
+ "isolation",
126
+ "join",
127
+ "keep",
128
+ "key",
129
+ "keys",
130
+ "latest",
131
+ "left",
132
+ "length",
133
+ "level",
134
+ "like",
135
+ "limit",
136
+ "list",
137
+ "lock",
138
+ "lt",
139
+ "maps",
140
+ "materialized",
141
+ "maxUncommittedRows",
142
+ "no",
143
+ "nocache",
144
+ "not",
145
+ "nulls",
146
+ "o3MaxLag",
147
+ "observation",
148
+ "offset",
149
+ "on",
150
+ "only",
151
+ "option",
152
+ "or",
153
+ "order",
154
+ "others",
155
+ "outer",
156
+ "over",
157
+ "overridable",
158
+ "owned",
159
+ "param",
160
+ "parameters",
161
+ "parquet_version",
162
+ "partition_by",
163
+ "partition",
164
+ "partitions",
165
+ "password",
166
+ "period",
167
+ "permissions",
168
+ "pivot",
169
+ "preceding",
170
+ "prevailing",
171
+ "primary",
172
+ "public",
173
+ "query",
174
+ "range",
175
+ "references",
176
+ "refresh",
177
+ "release",
178
+ "reindex",
179
+ "remove",
180
+ "rename",
181
+ "repair",
182
+ "replace",
183
+ "respect",
184
+ "resume",
185
+ "revoke",
186
+ "right",
187
+ "row",
188
+ "row_group_size",
189
+ "rows",
190
+ "sample",
191
+ "select",
192
+ "service",
193
+ "set",
194
+ "show",
195
+ "skip",
196
+ "snapshot",
197
+ "splice",
198
+ "squash",
199
+ "start",
200
+ "step",
201
+ "statistics_enabled",
202
+ "suspend",
203
+ "system",
204
+ "table",
205
+ "tables",
206
+ "then",
207
+ "time",
208
+ "to",
209
+ "token",
210
+ "tolerance",
211
+ "transaction",
212
+ "transient",
213
+ "truncate",
214
+ "ttl",
215
+ "txn",
216
+ "type",
217
+ "unbounded",
218
+ "union",
219
+ "unlock",
220
+ "unpivot",
221
+ "update",
222
+ "upsert",
223
+ "user",
224
+ "users",
225
+ "vacuum",
226
+ "values",
227
+ "verification",
228
+ "view",
229
+ "volume",
230
+ "wal",
231
+ "when",
232
+ "where",
233
+ "window",
234
+ "with",
235
+ "within",
236
+ "writer",
237
+ "zone",
238
+ "raw_array_encoding"
239
+ ];
240
+
241
+ // src/grammar/dataTypes.ts
242
+ var dataTypes = [
243
+ "binary",
244
+ "boolean",
245
+ "byte",
246
+ "char",
247
+ "date",
248
+ "decimal",
249
+ "double",
250
+ "float",
251
+ "geohash",
252
+ "int",
253
+ "integer",
254
+ "interval",
255
+ "ipv4",
256
+ "long",
257
+ "long128",
258
+ "long256",
259
+ "short",
260
+ "string",
261
+ "symbol",
262
+ "timestamp",
263
+ "timestamp_ns",
264
+ "uuid",
265
+ "varchar"
266
+ ];
267
+
268
+ // src/grammar/constants.ts
269
+ var constants = [
270
+ "asc",
271
+ "brotli",
272
+ "century",
273
+ "complete",
274
+ "datestyle",
275
+ "day",
276
+ "days",
277
+ "decade",
278
+ "default_transaction_read_only",
279
+ "desc",
280
+ "dow",
281
+ "doy",
282
+ "epoch",
283
+ "false",
284
+ "gzip",
285
+ "hour",
286
+ "hours",
287
+ "http",
288
+ "ilp",
289
+ "immediate",
290
+ "incremental",
291
+ "isodow",
292
+ "isoyear",
293
+ "jwk",
294
+ "linear",
295
+ "lz4",
296
+ "lz4_raw",
297
+ "lzo",
298
+ "manual",
299
+ "max_identifier_length",
300
+ "microsecond",
301
+ "microseconds",
302
+ "millennium",
303
+ "millisecond",
304
+ "milliseconds",
305
+ "minute",
306
+ "minutes",
307
+ "month",
308
+ "months",
309
+ "nan",
310
+ "nanosecond",
311
+ "nanoseconds",
312
+ "native",
313
+ "none",
314
+ "null",
315
+ "parquet",
316
+ "pgwire",
317
+ "prepare",
318
+ "prev",
319
+ "quarter",
320
+ "rest",
321
+ "search_path",
322
+ "second",
323
+ "seconds",
324
+ "server_version",
325
+ "server_version_num",
326
+ "skip_column",
327
+ "skip_row",
328
+ "snappy",
329
+ "standard_conforming_strings",
330
+ "transaction_isolation",
331
+ "true",
332
+ "uncompressed",
333
+ "week",
334
+ "weeks",
335
+ "year",
336
+ "years",
337
+ "zstd"
338
+ ];
339
+
340
+ // src/grammar/functions.ts
341
+ var functions = [
342
+ "abs",
343
+ "acos",
344
+ "all_permissions",
345
+ "all_tables",
346
+ "and",
347
+ "approx_count_distinct",
348
+ "approx_median",
349
+ "approx_percentile",
350
+ "arg_max",
351
+ "arg_min",
352
+ "array_avg",
353
+ "array_count",
354
+ "array_cum_sum",
355
+ "array_max",
356
+ "array_min",
357
+ "array_position",
358
+ "array_stddev",
359
+ "array_stddev_pop",
360
+ "array_stddev_samp",
361
+ "array_sum",
362
+ "asin",
363
+ "atan",
364
+ "atan2",
365
+ "avg",
366
+ "base64",
367
+ "batch",
368
+ "between",
369
+ "bit_and",
370
+ "bit_or",
371
+ "bit_xor",
372
+ "bool_and",
373
+ "bool_or",
374
+ "build",
375
+ "case",
376
+ "cast",
377
+ "ceil",
378
+ "ceiling",
379
+ "coalesce",
380
+ "commitLag",
381
+ "concat",
382
+ "corr",
383
+ "cos",
384
+ "cot",
385
+ "count",
386
+ "count_distinct",
387
+ "covar_pop",
388
+ "covar_samp",
389
+ "current_catalog",
390
+ "current_database",
391
+ "current_schema",
392
+ "current_schemas",
393
+ "current_setting",
394
+ "current_user",
395
+ "date_trunc",
396
+ "dateadd",
397
+ "datediff",
398
+ "day",
399
+ "day_of_week",
400
+ "day_of_week_sunday_first",
401
+ "days_in_month",
402
+ "degrees",
403
+ "dense_rank",
404
+ "dim_length",
405
+ "dot_product",
406
+ "dump_memory_usage",
407
+ "dump_thread_stacks",
408
+ "exp",
409
+ "export_files",
410
+ "extract",
411
+ "files",
412
+ "first",
413
+ "first_not_null",
414
+ "first_not_null_value",
415
+ "first_value",
416
+ "flatten",
417
+ "floor",
418
+ "flush_query_cache",
419
+ "format",
420
+ "format_type",
421
+ "functions",
422
+ "generate_series",
423
+ "geo_distance_meters",
424
+ "geo_within_radius_latlon",
425
+ "geomean",
426
+ "glob",
427
+ "greatest",
428
+ "haversine_dist_deg",
429
+ "headers",
430
+ "hour",
431
+ "hydrate_table_metadata",
432
+ "ifnull",
433
+ "ilike",
434
+ "import_files",
435
+ "in",
436
+ "information_schema._pg_expandarray",
437
+ "insertion_point",
438
+ "interval_end",
439
+ "interval_start",
440
+ "is_leap_year",
441
+ "isOrdered",
442
+ "isnull",
443
+ "json_extract",
444
+ "keywords",
445
+ "ksum",
446
+ "l2price",
447
+ "lag",
448
+ "last",
449
+ "last_not_null",
450
+ "last_value",
451
+ "lcase",
452
+ "lead",
453
+ "least",
454
+ "left",
455
+ "len",
456
+ "length",
457
+ "length_bytes",
458
+ "like",
459
+ "list",
460
+ "ln",
461
+ "log",
462
+ "long_sequence",
463
+ "lower",
464
+ "lpad",
465
+ "ltrim",
466
+ "make_geohash",
467
+ "materialized_views",
468
+ "matmul",
469
+ "max",
470
+ "maxUncommittedRows",
471
+ "md5",
472
+ "memory_metrics",
473
+ "micros",
474
+ "mid",
475
+ "millis",
476
+ "min",
477
+ "minute",
478
+ "mode",
479
+ "month",
480
+ "nanos",
481
+ "netmask",
482
+ "not",
483
+ "now",
484
+ "nsum",
485
+ "nullif",
486
+ "nvl",
487
+ "or",
488
+ "parquet_scan",
489
+ "permissions",
490
+ "pg_advisory_unlock_all",
491
+ "pg_attrdef",
492
+ "pg_attribute",
493
+ "pg_catalog.age",
494
+ "pg_catalog.current_database",
495
+ "pg_catalog.current_schema",
496
+ "pg_catalog.current_schemas",
497
+ "pg_catalog.pg_attrdef",
498
+ "pg_catalog.pg_attribute",
499
+ "pg_catalog.pg_class",
500
+ "pg_catalog.pg_database",
501
+ "pg_catalog.pg_description",
502
+ "pg_catalog.pg_get_expr",
503
+ "pg_catalog.pg_get_keywords",
504
+ "pg_catalog.pg_get_partkeydef",
505
+ "pg_catalog.pg_get_userbyid",
506
+ "pg_catalog.pg_index",
507
+ "pg_catalog.pg_inherits",
508
+ "pg_catalog.pg_is_in_recovery",
509
+ "pg_catalog.pg_locks",
510
+ "pg_catalog.pg_namespace",
511
+ "pg_catalog.pg_roles",
512
+ "pg_catalog.pg_shdescription",
513
+ "pg_catalog.pg_table_is_visible",
514
+ "pg_catalog.pg_type",
515
+ "pg_catalog.txid_current",
516
+ "pg_catalog.version",
517
+ "pg_class",
518
+ "pg_database",
519
+ "pg_description",
520
+ "pg_extension",
521
+ "pg_get_expr",
522
+ "pg_get_keywords",
523
+ "pg_get_partkeydef",
524
+ "pg_index",
525
+ "pg_inherits",
526
+ "pg_is_in_recovery",
527
+ "pg_locks",
528
+ "pg_namespace",
529
+ "pg_postmaster_start_time",
530
+ "pg_proc",
531
+ "pg_range",
532
+ "pg_roles",
533
+ "pg_type",
534
+ "pi",
535
+ "position",
536
+ "power",
537
+ "query_activity",
538
+ "quote_ident",
539
+ "radians",
540
+ "rank",
541
+ "read_parquet",
542
+ "reader_pool",
543
+ "regexp_replace",
544
+ "regr_intercept",
545
+ "regr_slope",
546
+ "reload_config",
547
+ "reload_tls",
548
+ "replace",
549
+ "right",
550
+ "rnd_bin",
551
+ "rnd_boolean",
552
+ "rnd_byte",
553
+ "rnd_char",
554
+ "rnd_date",
555
+ "rnd_decimal",
556
+ "rnd_double",
557
+ "rnd_double_array",
558
+ "rnd_float",
559
+ "rnd_geohash",
560
+ "rnd_int",
561
+ "rnd_interval",
562
+ "rnd_ipv4",
563
+ "rnd_log",
564
+ "rnd_long",
565
+ "rnd_long256",
566
+ "rnd_short",
567
+ "rnd_str",
568
+ "rnd_symbol",
569
+ "rnd_symbol_weighted",
570
+ "rnd_symbol_zipf",
571
+ "rnd_timestamp",
572
+ "rnd_uuid4",
573
+ "rnd_varchar",
574
+ "round",
575
+ "round_down",
576
+ "round_half_even",
577
+ "round_up",
578
+ "row_number",
579
+ "rpad",
580
+ "rtrim",
581
+ "second",
582
+ "server_conf",
583
+ "server_version",
584
+ "session_user",
585
+ "sha1",
586
+ "sha256",
587
+ "shift",
588
+ "show",
589
+ "sign",
590
+ "simulate_crash",
591
+ "sin",
592
+ "size_pretty",
593
+ "split_part",
594
+ "spread",
595
+ "spread_bps",
596
+ "sqrt",
597
+ "starts_with",
598
+ "stddev",
599
+ "stddev_pop",
600
+ "stddev_samp",
601
+ "string_agg",
602
+ "string_distinct_agg",
603
+ "strpos",
604
+ "substring",
605
+ "sum",
606
+ "switch",
607
+ "sysdate",
608
+ "systimestamp",
609
+ "table_columns",
610
+ "table_partitions",
611
+ "table_storage",
612
+ "table_writer_metrics",
613
+ "tables",
614
+ "tan",
615
+ "timestamp_ceil",
616
+ "timestamp_floor",
617
+ "timestamp_sequence",
618
+ "timestamp_shuffle",
619
+ "to_char",
620
+ "to_date",
621
+ "to_long128",
622
+ "to_long256",
623
+ "to_lowercase",
624
+ "to_pg_date",
625
+ "to_str",
626
+ "to_timestamp",
627
+ "to_timestamp_ns",
628
+ "to_timezone",
629
+ "to_uppercase",
630
+ "to_utc",
631
+ "to_uuid",
632
+ "today",
633
+ "tomorrow",
634
+ "touch",
635
+ "transpose",
636
+ "trim",
637
+ "twap",
638
+ "txid_current",
639
+ "typeOf",
640
+ "ucase",
641
+ "upper",
642
+ "var_pop",
643
+ "var_samp",
644
+ "variance",
645
+ "version",
646
+ "views",
647
+ "vwap",
648
+ "wal_tables",
649
+ "wal_transactions",
650
+ "week_of_year",
651
+ "weighted_avg",
652
+ "weighted_stddev",
653
+ "weighted_stddev_freq",
654
+ "weighted_stddev_rel",
655
+ "within",
656
+ "within_box",
657
+ "within_radius",
658
+ "wmid",
659
+ "writer_pool",
660
+ "year",
661
+ "yesterday"
662
+ ];
663
+
664
+ // src/grammar/operators.ts
665
+ var operators = [
666
+ "!~",
667
+ "<<",
668
+ "<<=",
669
+ ">>",
670
+ ">>=",
671
+ "~",
672
+ "~=",
673
+ "ALL",
674
+ "AND",
675
+ "ANY",
676
+ "APPLY",
677
+ "BETWEEN",
678
+ "CONTAINS",
679
+ "CROSS",
680
+ "EXCEPT",
681
+ "EXISTS",
682
+ "FREETEXT",
683
+ "FULL",
684
+ "IN",
685
+ "INNER",
686
+ "INTERSECT",
687
+ "IS",
688
+ "JOIN",
689
+ "LEFT",
690
+ "LIKE",
691
+ "MATCHED",
692
+ "NOT",
693
+ "NULL",
694
+ "OR",
695
+ "OUTER",
696
+ "PIVOT",
697
+ "RIGHT",
698
+ "SOME",
699
+ "UNION",
700
+ "UNPIVOT"
701
+ ];
702
+ // Annotate the CommonJS export names for ESM import in node:
703
+ 0 && (module.exports = {
704
+ constants,
705
+ dataTypes,
706
+ functions,
707
+ keywords,
708
+ operators
709
+ });
@@ -0,0 +1,5 @@
1
+ export { keywords } from "./keywords";
2
+ export { dataTypes } from "./dataTypes";
3
+ export { constants } from "./constants";
4
+ export { functions } from "./functions";
5
+ export { operators } from "./operators";