@aeye/query 0.6.7 → 0.7.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.
- package/README.md +1332 -1332
- package/aeye-query.md +25 -0
- package/dist/index.d.ts +797 -4
- package/dist/index.js +2226 -219
- package/package.json +63 -57
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { TypeDef as TypeDef$1 } from '@aeye/gin';
|
|
2
3
|
import { Tool } from '@aeye/core';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -2338,6 +2339,378 @@ declare abstract class FieldType implements Node {
|
|
|
2338
2339
|
toCode(_registry?: Registry, _options?: CodeOptions): string;
|
|
2339
2340
|
}
|
|
2340
2341
|
|
|
2342
|
+
/**
|
|
2343
|
+
* The physical shape of a table, as a database reports it or as DDL should make
|
|
2344
|
+
* it: columns with a portable column type, nullability, defaults, the primary
|
|
2345
|
+
* key, foreign keys and unique sets. One shape for both directions, so a schema
|
|
2346
|
+
* read from a live database and a table wanted from a type compare directly
|
|
2347
|
+
* (`Dialect.ddl.alterTable(current, wanted)`).
|
|
2348
|
+
*
|
|
2349
|
+
* Constraint names are optional: a schema reader fills the names the database
|
|
2350
|
+
* uses, and DDL that creates a constraint names it `pk_<table>`,
|
|
2351
|
+
* `fk_<table>_<columns>`, `uq_<table>_<columns>`, `ck_<table>_<column>` and
|
|
2352
|
+
* (SQL Server defaults) `df_<table>_<column>`. A drop with no recorded name uses
|
|
2353
|
+
* that same convention.
|
|
2354
|
+
*/
|
|
2355
|
+
|
|
2356
|
+
/** A portable column type: what a column holds, independent of any dialect's spelling. */
|
|
2357
|
+
declare const ColumnType: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2358
|
+
kind: z.ZodLiteral<"text">;
|
|
2359
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
2360
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2361
|
+
kind: z.ZodLiteral<"integer">;
|
|
2362
|
+
big: z.ZodOptional<z.ZodBoolean>;
|
|
2363
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2364
|
+
kind: z.ZodLiteral<"decimal">;
|
|
2365
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
2366
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
2367
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2368
|
+
kind: z.ZodLiteral<"float">;
|
|
2369
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2370
|
+
kind: z.ZodLiteral<"bool">;
|
|
2371
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2372
|
+
kind: z.ZodLiteral<"date">;
|
|
2373
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2374
|
+
kind: z.ZodLiteral<"timestamp">;
|
|
2375
|
+
timezone: z.ZodOptional<z.ZodBoolean>;
|
|
2376
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2377
|
+
kind: z.ZodLiteral<"uuid">;
|
|
2378
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2379
|
+
kind: z.ZodLiteral<"json">;
|
|
2380
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2381
|
+
kind: z.ZodLiteral<"bytes">;
|
|
2382
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2383
|
+
kind: z.ZodLiteral<"other">;
|
|
2384
|
+
native: z.ZodString;
|
|
2385
|
+
}, z.core.$strip>], "kind">;
|
|
2386
|
+
type ColumnType = z.infer<typeof ColumnType>;
|
|
2387
|
+
/** The kinds of {@link ColumnType}. */
|
|
2388
|
+
type ColumnTypeKind = ColumnType['kind'];
|
|
2389
|
+
/** A column default: a constant, the current time, or a native SQL expression as the database reported it. */
|
|
2390
|
+
declare const ColumnDefault: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2391
|
+
kind: z.ZodLiteral<"value">;
|
|
2392
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
2393
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2394
|
+
kind: z.ZodLiteral<"now">;
|
|
2395
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2396
|
+
kind: z.ZodLiteral<"sql">;
|
|
2397
|
+
sql: z.ZodString;
|
|
2398
|
+
}, z.core.$strip>], "kind">;
|
|
2399
|
+
type ColumnDefault = z.infer<typeof ColumnDefault>;
|
|
2400
|
+
/** One column. */
|
|
2401
|
+
declare const ColumnSpec: z.ZodObject<{
|
|
2402
|
+
name: z.ZodString;
|
|
2403
|
+
type: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2404
|
+
kind: z.ZodLiteral<"text">;
|
|
2405
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
2406
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2407
|
+
kind: z.ZodLiteral<"integer">;
|
|
2408
|
+
big: z.ZodOptional<z.ZodBoolean>;
|
|
2409
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2410
|
+
kind: z.ZodLiteral<"decimal">;
|
|
2411
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
2412
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
2413
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2414
|
+
kind: z.ZodLiteral<"float">;
|
|
2415
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2416
|
+
kind: z.ZodLiteral<"bool">;
|
|
2417
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2418
|
+
kind: z.ZodLiteral<"date">;
|
|
2419
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2420
|
+
kind: z.ZodLiteral<"timestamp">;
|
|
2421
|
+
timezone: z.ZodOptional<z.ZodBoolean>;
|
|
2422
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2423
|
+
kind: z.ZodLiteral<"uuid">;
|
|
2424
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2425
|
+
kind: z.ZodLiteral<"json">;
|
|
2426
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2427
|
+
kind: z.ZodLiteral<"bytes">;
|
|
2428
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2429
|
+
kind: z.ZodLiteral<"other">;
|
|
2430
|
+
native: z.ZodString;
|
|
2431
|
+
}, z.core.$strip>], "kind">;
|
|
2432
|
+
nullable: z.ZodBoolean;
|
|
2433
|
+
default: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2434
|
+
kind: z.ZodLiteral<"value">;
|
|
2435
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
2436
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2437
|
+
kind: z.ZodLiteral<"now">;
|
|
2438
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2439
|
+
kind: z.ZodLiteral<"sql">;
|
|
2440
|
+
sql: z.ZodString;
|
|
2441
|
+
}, z.core.$strip>], "kind">>;
|
|
2442
|
+
generated: z.ZodOptional<z.ZodBoolean>;
|
|
2443
|
+
values: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
2444
|
+
checkName: z.ZodOptional<z.ZodString>;
|
|
2445
|
+
defaultName: z.ZodOptional<z.ZodString>;
|
|
2446
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
2447
|
+
}, z.core.$strip>;
|
|
2448
|
+
type ColumnSpec = z.infer<typeof ColumnSpec>;
|
|
2449
|
+
/** A foreign key: `columns` of this table reference `references` of `table`. */
|
|
2450
|
+
declare const ForeignKeySpec: z.ZodObject<{
|
|
2451
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2452
|
+
columns: z.ZodArray<z.ZodString>;
|
|
2453
|
+
table: z.ZodString;
|
|
2454
|
+
references: z.ZodArray<z.ZodString>;
|
|
2455
|
+
onDelete: z.ZodOptional<z.ZodEnum<{
|
|
2456
|
+
"no-action": "no-action";
|
|
2457
|
+
cascade: "cascade";
|
|
2458
|
+
"set-null": "set-null";
|
|
2459
|
+
restrict: "restrict";
|
|
2460
|
+
}>>;
|
|
2461
|
+
}, z.core.$strip>;
|
|
2462
|
+
type ForeignKeySpec = z.infer<typeof ForeignKeySpec>;
|
|
2463
|
+
/** A set of columns whose values together are unique. */
|
|
2464
|
+
declare const UniqueSpec: z.ZodObject<{
|
|
2465
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2466
|
+
columns: z.ZodArray<z.ZodString>;
|
|
2467
|
+
}, z.core.$strip>;
|
|
2468
|
+
type UniqueSpec = z.infer<typeof UniqueSpec>;
|
|
2469
|
+
/** A table. */
|
|
2470
|
+
declare const TableSpec: z.ZodObject<{
|
|
2471
|
+
name: z.ZodString;
|
|
2472
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
2473
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
2474
|
+
name: z.ZodString;
|
|
2475
|
+
type: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2476
|
+
kind: z.ZodLiteral<"text">;
|
|
2477
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
2478
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2479
|
+
kind: z.ZodLiteral<"integer">;
|
|
2480
|
+
big: z.ZodOptional<z.ZodBoolean>;
|
|
2481
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2482
|
+
kind: z.ZodLiteral<"decimal">;
|
|
2483
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
2484
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
2485
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2486
|
+
kind: z.ZodLiteral<"float">;
|
|
2487
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2488
|
+
kind: z.ZodLiteral<"bool">;
|
|
2489
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2490
|
+
kind: z.ZodLiteral<"date">;
|
|
2491
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2492
|
+
kind: z.ZodLiteral<"timestamp">;
|
|
2493
|
+
timezone: z.ZodOptional<z.ZodBoolean>;
|
|
2494
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2495
|
+
kind: z.ZodLiteral<"uuid">;
|
|
2496
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2497
|
+
kind: z.ZodLiteral<"json">;
|
|
2498
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2499
|
+
kind: z.ZodLiteral<"bytes">;
|
|
2500
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2501
|
+
kind: z.ZodLiteral<"other">;
|
|
2502
|
+
native: z.ZodString;
|
|
2503
|
+
}, z.core.$strip>], "kind">;
|
|
2504
|
+
nullable: z.ZodBoolean;
|
|
2505
|
+
default: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2506
|
+
kind: z.ZodLiteral<"value">;
|
|
2507
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
2508
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2509
|
+
kind: z.ZodLiteral<"now">;
|
|
2510
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2511
|
+
kind: z.ZodLiteral<"sql">;
|
|
2512
|
+
sql: z.ZodString;
|
|
2513
|
+
}, z.core.$strip>], "kind">>;
|
|
2514
|
+
generated: z.ZodOptional<z.ZodBoolean>;
|
|
2515
|
+
values: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
2516
|
+
checkName: z.ZodOptional<z.ZodString>;
|
|
2517
|
+
defaultName: z.ZodOptional<z.ZodString>;
|
|
2518
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
2519
|
+
}, z.core.$strip>>;
|
|
2520
|
+
primaryKey: z.ZodArray<z.ZodString>;
|
|
2521
|
+
primaryKeyName: z.ZodOptional<z.ZodString>;
|
|
2522
|
+
foreignKeys: z.ZodArray<z.ZodObject<{
|
|
2523
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2524
|
+
columns: z.ZodArray<z.ZodString>;
|
|
2525
|
+
table: z.ZodString;
|
|
2526
|
+
references: z.ZodArray<z.ZodString>;
|
|
2527
|
+
onDelete: z.ZodOptional<z.ZodEnum<{
|
|
2528
|
+
"no-action": "no-action";
|
|
2529
|
+
cascade: "cascade";
|
|
2530
|
+
"set-null": "set-null";
|
|
2531
|
+
restrict: "restrict";
|
|
2532
|
+
}>>;
|
|
2533
|
+
}, z.core.$strip>>;
|
|
2534
|
+
unique: z.ZodArray<z.ZodObject<{
|
|
2535
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2536
|
+
columns: z.ZodArray<z.ZodString>;
|
|
2537
|
+
}, z.core.$strip>>;
|
|
2538
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
2539
|
+
}, z.core.$strip>;
|
|
2540
|
+
type TableSpec = z.infer<typeof TableSpec>;
|
|
2541
|
+
/** True when two column types are the same type. */
|
|
2542
|
+
declare function sameColumnType(a: ColumnType, b: ColumnType): boolean;
|
|
2543
|
+
/**
|
|
2544
|
+
* True when every value of `from` fits `to` unchanged, so converting a column is
|
|
2545
|
+
* safe; false for a narrowing change that can lose or refuse data.
|
|
2546
|
+
*/
|
|
2547
|
+
declare function columnTypeWidens(from: ColumnType, to: ColumnType): boolean;
|
|
2548
|
+
|
|
2549
|
+
/**
|
|
2550
|
+
* DDL from table shapes: `CREATE TABLE` for a {@link TableSpec}, and the ordered
|
|
2551
|
+
* `ALTER` steps that turn the table a database has into the table that is
|
|
2552
|
+
* wanted. Each dialect has one writer (`dialect.ddl`); the diff and the step
|
|
2553
|
+
* order are shared here, and a dialect overrides only its spelling (types,
|
|
2554
|
+
* identity columns, how a column is altered) or, for SQLite, how a change that
|
|
2555
|
+
* `ALTER TABLE` cannot express is made (a table rebuild).
|
|
2556
|
+
*/
|
|
2557
|
+
|
|
2558
|
+
/** What a DDL step does. */
|
|
2559
|
+
declare const DdlAction: z.ZodEnum<{
|
|
2560
|
+
"create-table": "create-table";
|
|
2561
|
+
"drop-table": "drop-table";
|
|
2562
|
+
"rebuild-table": "rebuild-table";
|
|
2563
|
+
"add-column": "add-column";
|
|
2564
|
+
"drop-column": "drop-column";
|
|
2565
|
+
"alter-column": "alter-column";
|
|
2566
|
+
"add-constraint": "add-constraint";
|
|
2567
|
+
"drop-constraint": "drop-constraint";
|
|
2568
|
+
}>;
|
|
2569
|
+
type DdlAction = z.infer<typeof DdlAction>;
|
|
2570
|
+
/** One step of a schema change: its statements, in order, and whether it can lose data. */
|
|
2571
|
+
declare const DdlStep: z.ZodObject<{
|
|
2572
|
+
action: z.ZodEnum<{
|
|
2573
|
+
"create-table": "create-table";
|
|
2574
|
+
"drop-table": "drop-table";
|
|
2575
|
+
"rebuild-table": "rebuild-table";
|
|
2576
|
+
"add-column": "add-column";
|
|
2577
|
+
"drop-column": "drop-column";
|
|
2578
|
+
"alter-column": "alter-column";
|
|
2579
|
+
"add-constraint": "add-constraint";
|
|
2580
|
+
"drop-constraint": "drop-constraint";
|
|
2581
|
+
}>;
|
|
2582
|
+
table: z.ZodString;
|
|
2583
|
+
target: z.ZodOptional<z.ZodString>;
|
|
2584
|
+
sql: z.ZodArray<z.ZodString>;
|
|
2585
|
+
irreversible: z.ZodBoolean;
|
|
2586
|
+
summary: z.ZodString;
|
|
2587
|
+
}, z.core.$strip>;
|
|
2588
|
+
type DdlStep = z.infer<typeof DdlStep>;
|
|
2589
|
+
/** A schema change DDL cannot express (a renamed table, a missing constraint name the dialect needs). */
|
|
2590
|
+
declare class DdlError extends Error {
|
|
2591
|
+
readonly name = "DdlError";
|
|
2592
|
+
}
|
|
2593
|
+
/** How one column differs between the current and the wanted table. */
|
|
2594
|
+
interface ColumnChange {
|
|
2595
|
+
readonly from: ColumnSpec;
|
|
2596
|
+
readonly to: ColumnSpec;
|
|
2597
|
+
readonly type: boolean;
|
|
2598
|
+
readonly nullable: boolean;
|
|
2599
|
+
readonly default: boolean;
|
|
2600
|
+
readonly values: boolean;
|
|
2601
|
+
}
|
|
2602
|
+
/** Everything that differs between two shapes of one table. */
|
|
2603
|
+
interface TableDiff {
|
|
2604
|
+
readonly added: readonly ColumnSpec[];
|
|
2605
|
+
readonly dropped: readonly ColumnSpec[];
|
|
2606
|
+
readonly changed: readonly ColumnChange[];
|
|
2607
|
+
readonly primaryKey: boolean;
|
|
2608
|
+
readonly foreignKeysAdded: readonly ForeignKeySpec[];
|
|
2609
|
+
readonly foreignKeysDropped: readonly ForeignKeySpec[];
|
|
2610
|
+
readonly uniqueAdded: readonly UniqueSpec[];
|
|
2611
|
+
readonly uniqueDropped: readonly UniqueSpec[];
|
|
2612
|
+
}
|
|
2613
|
+
/** A dialect's DDL: native types both ways, defaults read back, `CREATE`, `DROP` and `ALTER`. */
|
|
2614
|
+
interface DdlWriter {
|
|
2615
|
+
/** The native type this dialect gives a column type. */
|
|
2616
|
+
columnType(type: ColumnType): string;
|
|
2617
|
+
/** The column type for a native type as a database reports it (`character varying(40)`, `nvarchar(max)`). */
|
|
2618
|
+
readColumnType(native: string): ColumnType;
|
|
2619
|
+
/** A column default as a database reports it (`('x'::text)`, `((0))`, `now()`), or undefined for none / `NULL`. */
|
|
2620
|
+
readDefault(sql: string): ColumnDefault | undefined;
|
|
2621
|
+
/** The column type a database reports back after creating `type` (types it has no exact spelling for widen). */
|
|
2622
|
+
canonicalType(type: ColumnType): ColumnType;
|
|
2623
|
+
/** What differs between two shapes of one table, compared the way this dialect stores them. */
|
|
2624
|
+
diff(current: TableSpec, wanted: TableSpec): TableDiff;
|
|
2625
|
+
/** `CREATE TABLE` for a table, constraints included. */
|
|
2626
|
+
createTable(table: TableSpec): DdlStep;
|
|
2627
|
+
/** `DROP TABLE`. */
|
|
2628
|
+
dropTable(table: TableSpec): DdlStep;
|
|
2629
|
+
/** The ordered steps that turn `current` into `wanted` (empty when they match). Throws {@link DdlError}. */
|
|
2630
|
+
alterTable(current: TableSpec, wanted: TableSpec): DdlStep[];
|
|
2631
|
+
}
|
|
2632
|
+
/** The shared DDL algorithm; a dialect supplies its spelling through the protected hooks. */
|
|
2633
|
+
declare abstract class SqlDdl implements DdlWriter {
|
|
2634
|
+
protected readonly dialect: Dialect;
|
|
2635
|
+
constructor(dialect: Dialect);
|
|
2636
|
+
abstract columnType(type: ColumnType): string;
|
|
2637
|
+
abstract readColumnType(native: string): ColumnType;
|
|
2638
|
+
canonicalType(type: ColumnType): ColumnType;
|
|
2639
|
+
readDefault(sql: string): ColumnDefault | undefined;
|
|
2640
|
+
diff(current: TableSpec, wanted: TableSpec): TableDiff;
|
|
2641
|
+
createTable(table: TableSpec): DdlStep;
|
|
2642
|
+
dropTable(table: TableSpec): DdlStep;
|
|
2643
|
+
alterTable(current: TableSpec, wanted: TableSpec): DdlStep[];
|
|
2644
|
+
/**
|
|
2645
|
+
* The ALTER steps for a diff, in an order that never trips a constraint:
|
|
2646
|
+
* drop the constraints that go or change, drop columns, add columns, alter
|
|
2647
|
+
* columns, then add the constraints that are new or changed.
|
|
2648
|
+
*/
|
|
2649
|
+
protected planAlter(current: TableSpec, wanted: TableSpec, diff: TableDiff): DdlStep[];
|
|
2650
|
+
/** A quoted identifier. */
|
|
2651
|
+
protected q(name: string): string;
|
|
2652
|
+
/** The table's quoted, schema-qualified name. */
|
|
2653
|
+
protected tableName(table: TableSpec): string;
|
|
2654
|
+
/** Quoted, comma-separated column names. */
|
|
2655
|
+
protected list(columns: readonly string[]): string;
|
|
2656
|
+
/** The keyword between `ALTER TABLE t` and a new column (`ADD COLUMN`; SQL Server `ADD`). */
|
|
2657
|
+
protected addColumnKeyword(): string;
|
|
2658
|
+
/** The words after the type that make the database assign the value. */
|
|
2659
|
+
protected generatedClause(): string;
|
|
2660
|
+
/** A constant as a SQL literal. */
|
|
2661
|
+
protected literal(value: string | number | boolean | null): string;
|
|
2662
|
+
/** A default as SQL. */
|
|
2663
|
+
protected defaultSql(d: ColumnDefault): string;
|
|
2664
|
+
/**
|
|
2665
|
+
* A column's default as it compares: the SQL this dialect would write for it,
|
|
2666
|
+
* so `false` and a read-back `0` match on SQLite, and absent and `NULL` are the same.
|
|
2667
|
+
*/
|
|
2668
|
+
protected comparableDefault(c: ColumnSpec): string | null;
|
|
2669
|
+
/** One column of a `CREATE TABLE` or `ADD COLUMN`. */
|
|
2670
|
+
protected columnDefinition(table: TableSpec, c: ColumnSpec): string;
|
|
2671
|
+
/** `DEFAULT <sql>` (SQL Server names it). */
|
|
2672
|
+
protected defaultClause(_table: TableSpec, _c: ColumnSpec, d: ColumnDefault): string;
|
|
2673
|
+
/** The `CREATE TABLE` statement; its constraints are named after `owner` (the table, unless it is a stand-in). */
|
|
2674
|
+
protected createSql(table: TableSpec, owner: string): string;
|
|
2675
|
+
/** The table-level constraints of a `CREATE TABLE`, named after `owner`. */
|
|
2676
|
+
protected tableConstraints(table: TableSpec, owner: string): string[];
|
|
2677
|
+
/** `FOREIGN KEY (…) REFERENCES t (…) [ON DELETE …]`. */
|
|
2678
|
+
protected foreignKeyClause(f: ForeignKeySpec): string;
|
|
2679
|
+
/** `CHECK (c IN (…))` for a column with a closed set of values. */
|
|
2680
|
+
protected checkClause(c: ColumnSpec): string;
|
|
2681
|
+
/** The statements that change one column's type, nullability or default (ANSI / Postgres). */
|
|
2682
|
+
protected alterColumn(table: TableSpec, c: ColumnChange): string[];
|
|
2683
|
+
/** A step adding a named table constraint. */
|
|
2684
|
+
protected addConstraint(table: TableSpec, name: string, clause: string): DdlStep;
|
|
2685
|
+
/** A step dropping a named table constraint. */
|
|
2686
|
+
protected dropConstraint(table: TableSpec, name: string): DdlStep;
|
|
2687
|
+
}
|
|
2688
|
+
/** The ANSI writer (the base dialect): portable spellings, read leniently. */
|
|
2689
|
+
declare class AnsiDdl extends SqlDdl {
|
|
2690
|
+
columnType(type: ColumnType): string;
|
|
2691
|
+
readColumnType(native: string): ColumnType;
|
|
2692
|
+
}
|
|
2693
|
+
/** A native type split into its lower-case name and numeric arguments (`varchar(40)` → `varchar`, `[40]`). */
|
|
2694
|
+
declare function splitNative(native: string): {
|
|
2695
|
+
name: string;
|
|
2696
|
+
args: number[];
|
|
2697
|
+
max: boolean;
|
|
2698
|
+
};
|
|
2699
|
+
/**
|
|
2700
|
+
* The column type for a native type name most databases share: the SQL
|
|
2701
|
+
* standard names and the common Postgres, SQLite and SQL Server spellings. A
|
|
2702
|
+
* dialect reader handles its own oddities first and falls back to this.
|
|
2703
|
+
*/
|
|
2704
|
+
declare function readCommonType(native: string): ColumnType;
|
|
2705
|
+
/** `pk_<table>`. */
|
|
2706
|
+
declare function pkName(table: string): string;
|
|
2707
|
+
/** `fk_<table>_<columns>`. */
|
|
2708
|
+
declare function fkName(table: string, columns: readonly string[]): string;
|
|
2709
|
+
/** `uq_<table>_<columns>`. */
|
|
2710
|
+
declare function uqName(table: string, columns: readonly string[]): string;
|
|
2711
|
+
/** `ck_<table>_<column>`. */
|
|
2712
|
+
declare function ckName(table: string, column: string): string;
|
|
2713
|
+
|
|
2341
2714
|
/**
|
|
2342
2715
|
* `Dialect` — the abstract SQL-dialect contract. Concrete dialects
|
|
2343
2716
|
* (`BaseDialect` = ANSI, `PostgresDialect`) override the handful of points
|
|
@@ -2407,8 +2780,35 @@ declare abstract class Dialect implements DialectEntry {
|
|
|
2407
2780
|
/**
|
|
2408
2781
|
* The LIMIT / OFFSET clause for the (already-emitted) limit / offset
|
|
2409
2782
|
* fragments. Returns empty when both are absent. ANSI `LIMIT n OFFSET m`.
|
|
2783
|
+
*
|
|
2784
|
+
* `ordered` says whether the statement already has an `ORDER BY`: a dialect
|
|
2785
|
+
* whose paging needs one (SQL Server's `OFFSET … FETCH`) supplies a neutral
|
|
2786
|
+
* order when it has none. Defaults to `true` for callers that predate it.
|
|
2787
|
+
*/
|
|
2788
|
+
limitOffset(limit: SqlText | undefined, offset: SqlText | undefined, _ordered?: boolean): SqlText;
|
|
2789
|
+
/**
|
|
2790
|
+
* One `ORDER BY` term: `<key> ASC|DESC [NULLS FIRST|LAST]`. A dialect with no
|
|
2791
|
+
* `NULLS` clause (SQL Server) overrides to order by a null flag first.
|
|
2792
|
+
*/
|
|
2793
|
+
orderTerm(key: SqlText, dir: 'asc' | 'desc', nulls: 'first' | 'last' | undefined): SqlText;
|
|
2794
|
+
/** A predicate that is always true (`TRUE`; SQL Server has no boolean literal). */
|
|
2795
|
+
trueSql(): SqlText;
|
|
2796
|
+
/** A predicate that is always false (`FALSE`; SQL Server has no boolean literal). */
|
|
2797
|
+
falseSql(): SqlText;
|
|
2798
|
+
/**
|
|
2799
|
+
* The value a driver is handed for a bound parameter. Identity by default; a
|
|
2800
|
+
* dialect whose driver cannot bind a JS boolean (SQLite) maps it to `1` / `0`.
|
|
2801
|
+
*/
|
|
2802
|
+
encodeParam(value: SqlValue): SqlValue;
|
|
2803
|
+
/**
|
|
2804
|
+
* This dialect's DDL writer: native column types, reading an introspected
|
|
2805
|
+
* type back, `CREATE TABLE`, and the ordered `ALTER` steps from one table
|
|
2806
|
+
* shape to another. Made once per dialect instance.
|
|
2410
2807
|
*/
|
|
2411
|
-
|
|
2808
|
+
get ddl(): DdlWriter;
|
|
2809
|
+
private ddlWriter;
|
|
2810
|
+
/** Build this dialect's DDL writer (ANSI by default). */
|
|
2811
|
+
protected makeDdl(): DdlWriter;
|
|
2412
2812
|
/**
|
|
2413
2813
|
* Case-insensitive LIKE. ANSI has no `ILIKE`, so lower both sides; Postgres
|
|
2414
2814
|
* overrides with the native operator.
|
|
@@ -12084,8 +12484,6 @@ declare class SelectQuery extends Query {
|
|
|
12084
12484
|
/** Emit the FROM source: `"type" AS "alias"`, `(subquery) AS "alias"`, or a
|
|
12085
12485
|
* table-valued `fn(args) AS "alias"` — delegated to the source itself. */
|
|
12086
12486
|
private fromSQL;
|
|
12087
|
-
/** One ORDER BY clause `<key> ASC|DESC [NULLS FIRST|LAST]` from a resolved key + dir/nulls. */
|
|
12088
|
-
private orderClauseSQL;
|
|
12089
12487
|
/**
|
|
12090
12488
|
* One ORDER BY term: `<expr> ASC|DESC [NULLS FIRST|LAST]`. A RELATION term
|
|
12091
12489
|
* expands to ONE clause per key column (each inheriting the term's direction
|
|
@@ -12889,6 +13287,8 @@ declare class BaseDialect extends Dialect {
|
|
|
12889
13287
|
declare class PostgresDialect extends BaseDialect {
|
|
12890
13288
|
/** This dialect's name (`'postgres'`). */
|
|
12891
13289
|
readonly name: string;
|
|
13290
|
+
/** Postgres DDL: native types, identity columns, `ALTER COLUMN … TYPE … USING`. */
|
|
13291
|
+
protected makeDdl(): DdlWriter;
|
|
12892
13292
|
/** Postgres numbered placeholders are 1-based. */
|
|
12893
13293
|
bindPlaceholder(index: number): string;
|
|
12894
13294
|
/** Native case-insensitive pattern match. */
|
|
@@ -12978,6 +13378,88 @@ declare class PostgresDialect extends BaseDialect {
|
|
|
12978
13378
|
arrayOverlaps(col: SqlText, elements: readonly SqlText[]): SqlText;
|
|
12979
13379
|
}
|
|
12980
13380
|
|
|
13381
|
+
/**
|
|
13382
|
+
* `SqliteDialect` — SQLite: `?` placeholders, double-quoted identifiers,
|
|
13383
|
+
* `LIMIT … OFFSET` (with `LIMIT -1` for an offset alone), `LOWER … LIKE` for
|
|
13384
|
+
* `ILIKE`, booleans bound as `1` / `0`, JSON through the JSON1 functions
|
|
13385
|
+
* (`json_object`, `json_array_length`, `json_each`), dates through `strftime`,
|
|
13386
|
+
* and no LATERAL joins.
|
|
13387
|
+
*/
|
|
13388
|
+
|
|
13389
|
+
/** The SQLite dialect. */
|
|
13390
|
+
declare class SqliteDialect extends BaseDialect {
|
|
13391
|
+
/** This dialect's name (`'sqlite'`). */
|
|
13392
|
+
readonly name: string;
|
|
13393
|
+
/** An offset with no limit needs `LIMIT -1` in SQLite. */
|
|
13394
|
+
limitOffset(limit: SqlText | undefined, offset: SqlText | undefined, ordered?: boolean): SqlText;
|
|
13395
|
+
/** SQLite's driver binds no booleans: `true` / `false` become `1` / `0`. */
|
|
13396
|
+
encodeParam(value: SqlValue): SqlValue;
|
|
13397
|
+
jsonObject(entries: readonly {
|
|
13398
|
+
key: string;
|
|
13399
|
+
value: SqlText;
|
|
13400
|
+
}[]): SqlText;
|
|
13401
|
+
jsonSqlType(): string;
|
|
13402
|
+
/** A JSON document is bound as its text and parsed by `json(…)`. */
|
|
13403
|
+
protected builtinJsonValue(value: JsonValue, _fieldType?: FieldType, _site?: ValueSite): SqlText;
|
|
13404
|
+
protected builtinSqlTypeFor(fieldType: FieldType): string;
|
|
13405
|
+
arrayLength(arg: SqlText): SqlText;
|
|
13406
|
+
/** Membership over a JSON array column through `json_each`. */
|
|
13407
|
+
arrayHas(col: SqlText, value: SqlText): SqlText;
|
|
13408
|
+
arrayContains(col: SqlText, elements: readonly SqlText[]): SqlText;
|
|
13409
|
+
arrayOverlaps(col: SqlText, elements: readonly SqlText[]): SqlText;
|
|
13410
|
+
lateralJoin(_subquery: SqlText, _alias: string, _joinType: 'left' | 'inner'): SqlText;
|
|
13411
|
+
/** A date-field token as its `strftime` format string. */
|
|
13412
|
+
rawArgLiteral(token: string): SqlText;
|
|
13413
|
+
emitBuiltinCall(name: string, args: readonly SqlText[]): SqlText | undefined;
|
|
13414
|
+
protected makeDdl(): DdlWriter;
|
|
13415
|
+
}
|
|
13416
|
+
|
|
13417
|
+
/**
|
|
13418
|
+
* `SqlServerDialect` — Microsoft SQL Server (2022 and later): `[bracketed]`
|
|
13419
|
+
* identifiers, `@p1` placeholders, `OFFSET … ROWS FETCH NEXT … ROWS ONLY`
|
|
13420
|
+
* paging (with a neutral `ORDER BY (SELECT NULL)` when the statement has no
|
|
13421
|
+
* order), `LOWER … LIKE` for `ILIKE`, `(1 = 1)` / `(1 = 0)` for the boolean
|
|
13422
|
+
* constants, emulated `NULLS FIRST|LAST`, JSON through `JSON_OBJECT` and
|
|
13423
|
+
* `OPENJSON`, dates through `DATEPART` / `DATEADD` / `DATETRUNC`, and
|
|
13424
|
+
* `OUTER|CROSS APPLY` for lateral joins.
|
|
13425
|
+
*
|
|
13426
|
+
* T-SQL has no boolean value type: a comparison is a predicate, not a value,
|
|
13427
|
+
* so a query that projects a predicate as a column (`select a > 1 as big`)
|
|
13428
|
+
* emits SQL the server refuses. Filters, joins and `CASE` work as usual.
|
|
13429
|
+
*/
|
|
13430
|
+
|
|
13431
|
+
/** The SQL Server dialect. */
|
|
13432
|
+
declare class SqlServerDialect extends BaseDialect {
|
|
13433
|
+
/** This dialect's name (`'sqlserver'`). */
|
|
13434
|
+
readonly name: string;
|
|
13435
|
+
quoteIdent(name: string): string;
|
|
13436
|
+
/** Named placeholders, 1-based, as the `mssql` driver binds them (`request.input('p1', …)`). */
|
|
13437
|
+
bindPlaceholder(index: number): string;
|
|
13438
|
+
limitOffset(limit: SqlText | undefined, offset: SqlText | undefined, ordered?: boolean): SqlText;
|
|
13439
|
+
/** No `NULLS FIRST|LAST`: order by a null flag first, then the key. */
|
|
13440
|
+
orderTerm(key: SqlText, dir: 'asc' | 'desc', nulls: 'first' | 'last' | undefined): SqlText;
|
|
13441
|
+
trueSql(): SqlText;
|
|
13442
|
+
falseSql(): SqlText;
|
|
13443
|
+
jsonObject(entries: readonly {
|
|
13444
|
+
key: string;
|
|
13445
|
+
value: SqlText;
|
|
13446
|
+
}[]): SqlText;
|
|
13447
|
+
jsonSqlType(): string;
|
|
13448
|
+
/** A precomputed text field matched by substring (`+` concatenation, not `||`). */
|
|
13449
|
+
tsvectorSearch(tsv: SqlText, query: SqlText, _language?: string): SqlText;
|
|
13450
|
+
protected builtinSqlTypeFor(fieldType: FieldType): string;
|
|
13451
|
+
arrayLength(arg: SqlText): SqlText;
|
|
13452
|
+
arrayHas(col: SqlText, value: SqlText): SqlText;
|
|
13453
|
+
arrayContains(col: SqlText, elements: readonly SqlText[]): SqlText;
|
|
13454
|
+
arrayOverlaps(col: SqlText, elements: readonly SqlText[]): SqlText;
|
|
13455
|
+
/** `OUTER APPLY` / `CROSS APPLY`, SQL Server's lateral join. */
|
|
13456
|
+
lateralJoin(subquery: SqlText, alias: string, joinType: 'left' | 'inner'): SqlText;
|
|
13457
|
+
/** A date-field token as its bare `DATEPART` name. */
|
|
13458
|
+
rawArgLiteral(token: string): SqlText;
|
|
13459
|
+
emitBuiltinCall(name: string, args: readonly SqlText[]): SqlText | undefined;
|
|
13460
|
+
protected makeDdl(): DdlWriter;
|
|
13461
|
+
}
|
|
13462
|
+
|
|
12981
13463
|
/**
|
|
12982
13464
|
* SQL-converter barrel: emit primitives, the dialect hierarchy, the
|
|
12983
13465
|
* join/CTE planner, and RLS injection.
|
|
@@ -12986,6 +13468,317 @@ declare class PostgresDialect extends BaseDialect {
|
|
|
12986
13468
|
/** Construct fresh instances of every built-in dialect. */
|
|
12987
13469
|
declare function builtinDialects(): ReadonlyArray<Dialect>;
|
|
12988
13470
|
|
|
13471
|
+
/**
|
|
13472
|
+
* The DDL writers of the Postgres, SQLite and SQL Server dialects. Each changes
|
|
13473
|
+
* only what its database spells differently from the shared algorithm in
|
|
13474
|
+
* `writer.ts`; SQLite also rebuilds a table for a change `ALTER TABLE` cannot
|
|
13475
|
+
* make there.
|
|
13476
|
+
*/
|
|
13477
|
+
|
|
13478
|
+
/** Postgres: native `text`, `jsonb`, `bytea`, identity columns, `ALTER COLUMN … TYPE … USING`. */
|
|
13479
|
+
declare class PostgresDdl extends SqlDdl {
|
|
13480
|
+
columnType(type: ColumnType): string;
|
|
13481
|
+
readColumnType(native: string): ColumnType;
|
|
13482
|
+
protected alterColumn(table: TableSpec, c: ColumnChange): string[];
|
|
13483
|
+
}
|
|
13484
|
+
/** SQL Server: `[ident]`, `nvarchar`, `bit`, `IDENTITY(1,1)`, named default constraints, `ALTER COLUMN` with nullability. */
|
|
13485
|
+
declare class SqlServerDdl extends SqlDdl {
|
|
13486
|
+
columnType(type: ColumnType): string;
|
|
13487
|
+
readColumnType(native: string): ColumnType;
|
|
13488
|
+
protected addColumnKeyword(): string;
|
|
13489
|
+
protected generatedClause(): string;
|
|
13490
|
+
protected literal(value: string | number | boolean | null): string;
|
|
13491
|
+
protected defaultClause(table: TableSpec, c: ColumnSpec, d: ColumnDefault): string;
|
|
13492
|
+
protected defaultSql(d: ColumnDefault): string;
|
|
13493
|
+
protected alterColumn(table: TableSpec, c: ColumnChange): string[];
|
|
13494
|
+
protected planAlter(current: TableSpec, wanted: TableSpec, diff: TableDiff): DdlStep[];
|
|
13495
|
+
}
|
|
13496
|
+
/**
|
|
13497
|
+
* SQLite: types by affinity name, `INTEGER PRIMARY KEY AUTOINCREMENT` for a
|
|
13498
|
+
* generated key, `ADD COLUMN` / `DROP COLUMN` for plain columns, and a table
|
|
13499
|
+
* rebuild (create the new shape, copy the rows, drop, rename) for every other
|
|
13500
|
+
* change, since SQLite cannot alter a column or a constraint in place.
|
|
13501
|
+
*/
|
|
13502
|
+
declare class SqliteDdl extends SqlDdl {
|
|
13503
|
+
columnType(type: ColumnType): string;
|
|
13504
|
+
readColumnType(native: string): ColumnType;
|
|
13505
|
+
protected literal(value: string | number | boolean | null): string;
|
|
13506
|
+
protected columnDefinition(table: TableSpec, c: ColumnSpec): string;
|
|
13507
|
+
protected tableConstraints(table: TableSpec, owner: string): string[];
|
|
13508
|
+
/** The one generated integer primary key, which SQLite spells inline as an alias of the rowid. */
|
|
13509
|
+
private isRowidKey;
|
|
13510
|
+
protected planAlter(current: TableSpec, wanted: TableSpec, diff: TableDiff): DdlStep[];
|
|
13511
|
+
/** Make the wanted table beside the current one, copy the kept columns across, and swap it in. */
|
|
13512
|
+
private rebuild;
|
|
13513
|
+
}
|
|
13514
|
+
|
|
13515
|
+
/**
|
|
13516
|
+
* Tables as gin types, and gin types as tables.
|
|
13517
|
+
*
|
|
13518
|
+
* `tableToGinType` gives the plain type of a table's rows: one prop per column,
|
|
13519
|
+
* `nullable<…>` for a column that may be empty, an `enum` for a column with a
|
|
13520
|
+
* closed set of values, the column's default as the prop's default, and docs
|
|
13521
|
+
* saying what the type cannot (the key, references, values the database
|
|
13522
|
+
* assigns). A foreign key stays its scalar value, because a row holds the key,
|
|
13523
|
+
* not the row it points at; the reference is in the docs and in the table.
|
|
13524
|
+
*
|
|
13525
|
+
* `ginTypeToTable` goes the other way, for making or altering a table from a
|
|
13526
|
+
* type. Given the `current` table it keeps every physical detail the type does
|
|
13527
|
+
* not speak to (a decimal's precision, a default the database computes, the
|
|
13528
|
+
* identity column, check and constraint names), so a type that only gained
|
|
13529
|
+
* descriptions, formats or ranges (an enriched type) maps back to the same
|
|
13530
|
+
* table and plans no change.
|
|
13531
|
+
*/
|
|
13532
|
+
|
|
13533
|
+
/** The pattern a gin `text` carries to mean a UUID. */
|
|
13534
|
+
declare const UUID_PATTERN = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$";
|
|
13535
|
+
/** The gin type of a table's rows: an `obj` with one prop per column. */
|
|
13536
|
+
declare function tableToGinType(table: TableSpec): TypeDef$1;
|
|
13537
|
+
/** The gin scalar for a column type. */
|
|
13538
|
+
declare function scalarType(t: ColumnType): TypeDef$1;
|
|
13539
|
+
/** What `ginTypeToTable` needs besides the type. */
|
|
13540
|
+
interface GinTableOptions {
|
|
13541
|
+
/** The table as the database has it now; its physical details are kept where the type does not change them. */
|
|
13542
|
+
readonly current?: TableSpec;
|
|
13543
|
+
/** The primary key (else the current one, else `id` when there is such a prop). */
|
|
13544
|
+
readonly primaryKey?: readonly string[];
|
|
13545
|
+
readonly foreignKeys?: readonly ForeignKeySpec[];
|
|
13546
|
+
readonly unique?: readonly UniqueSpec[];
|
|
13547
|
+
readonly schema?: string;
|
|
13548
|
+
readonly comment?: string;
|
|
13549
|
+
/**
|
|
13550
|
+
* The table behind a named type, for a prop whose type is another table's
|
|
13551
|
+
* type: the column takes that table's key type and becomes a foreign key.
|
|
13552
|
+
*/
|
|
13553
|
+
readonly resolveTable?: (typeName: string) => TableSpec | undefined;
|
|
13554
|
+
}
|
|
13555
|
+
/** A table for a gin `obj` type. Throws when the type is not an `obj` with props. */
|
|
13556
|
+
declare function ginTypeToTable(name: string, def: TypeDef$1, options?: GinTableOptions): TableSpec;
|
|
13557
|
+
/** The column type for a gin value type. */
|
|
13558
|
+
declare function ginToColumnType(type: TypeDef$1): ColumnType;
|
|
13559
|
+
|
|
13560
|
+
/**
|
|
13561
|
+
* A table as a query Type: the conceptual schema a query (and a model writing
|
|
13562
|
+
* one) is checked against. Each column is a field; a single-column foreign key
|
|
13563
|
+
* onto another table's key is a `relation` field of the same name (so the
|
|
13564
|
+
* query can cross it, and SQL still reads the stored key column); the primary
|
|
13565
|
+
* key is the identity and a unique index; a column's closed set of values is
|
|
13566
|
+
* its `values`.
|
|
13567
|
+
*/
|
|
13568
|
+
|
|
13569
|
+
/** What `tableToQueryType` needs besides the table. */
|
|
13570
|
+
interface QueryTypeOptions {
|
|
13571
|
+
/** The query Type name of a table (default: the table name). Relations name their targets with it too. */
|
|
13572
|
+
readonly typeName?: (table: string) => string;
|
|
13573
|
+
/** The estimated row count (drives cost estimates; default 1000). */
|
|
13574
|
+
readonly rowCount?: number;
|
|
13575
|
+
/** The tables a foreign key may point at, to check the reference is onto their key. */
|
|
13576
|
+
readonly tables?: readonly TableSpec[];
|
|
13577
|
+
}
|
|
13578
|
+
/** The query Type for a table. */
|
|
13579
|
+
declare function tableToQueryType(table: TableSpec, options?: QueryTypeOptions): TypeDef;
|
|
13580
|
+
/** The query field type for a column type. */
|
|
13581
|
+
declare function scalarFieldType(t: ColumnType): FieldTypeDef;
|
|
13582
|
+
|
|
13583
|
+
/**
|
|
13584
|
+
* A saved query as a callable function: its args as a gin `obj` type (the
|
|
13585
|
+
* query's params, then paging and sorting), a one-line signature, and the check
|
|
13586
|
+
* a call's args go through before the query runs. One home for what every
|
|
13587
|
+
* caller of a stored query needs, so the args a model is shown, the args a call
|
|
13588
|
+
* is checked against and the params the query binds can't drift apart.
|
|
13589
|
+
*
|
|
13590
|
+
* Every param is REQUIRED: a missing param is refused as invalid input, never
|
|
13591
|
+
* bound as NULL (`engine.checkParams` only warns about it, because
|
|
13592
|
+
* `autoPaginate` binds NULL on purpose; a call through a signature does not).
|
|
13593
|
+
*/
|
|
13594
|
+
|
|
13595
|
+
/** A gin type as a plain def (the `@aeye/gin` `TypeDef`). */
|
|
13596
|
+
type GinDef = TypeDef$1;
|
|
13597
|
+
/** Paging for a query that reads a list: the most rows one call reads, and the page when the caller gives none. */
|
|
13598
|
+
interface QueryPaging {
|
|
13599
|
+
readonly max: number;
|
|
13600
|
+
readonly page: number;
|
|
13601
|
+
}
|
|
13602
|
+
/** What `queryArgsType` adds after the params. */
|
|
13603
|
+
interface QueryArgsOptions {
|
|
13604
|
+
/** Add optional `limit` / `offset` args (a list query that does not bound its own rows). */
|
|
13605
|
+
readonly paging?: QueryPaging;
|
|
13606
|
+
/** The sort names a caller may pick; adds an optional `sort` list of `{ column, dir }`. */
|
|
13607
|
+
readonly sorters?: readonly string[];
|
|
13608
|
+
/** Params that are optional after all (a paging window bound as a param). */
|
|
13609
|
+
readonly optional?: readonly string[];
|
|
13610
|
+
/** Constant defaults: the param becomes optional, and `withArgDefaults` fills it before binding. */
|
|
13611
|
+
readonly defaults?: Readonly<Record<string, JsonValue>>;
|
|
13612
|
+
}
|
|
13613
|
+
/** A param's gin type: its merged field type as a value a caller passes (`any` when nothing closer fits). */
|
|
13614
|
+
declare function fieldTypeToGin(def: FieldTypeDef | undefined): GinDef;
|
|
13615
|
+
/**
|
|
13616
|
+
* The args of a query's fn, as a gin `obj`: each param (required unless named
|
|
13617
|
+
* in `optional`; documented with the column it is compared with), then
|
|
13618
|
+
* `limit` / `offset`, then `sort`.
|
|
13619
|
+
*/
|
|
13620
|
+
declare function queryArgsType(params: readonly ParamInfo[], options?: QueryArgsOptions): GinDef;
|
|
13621
|
+
/** Call args with every left-out arg that has a constant default (`queryArgsType`'s `defaults`) filled in. */
|
|
13622
|
+
declare function withArgDefaults(type: GinDef, args: Readonly<Record<string, JsonValue>>): Record<string, JsonValue>;
|
|
13623
|
+
/**
|
|
13624
|
+
* What is wrong with a call's args for a query's fn (`queryArgsType`), one line
|
|
13625
|
+
* per problem; empty when they fit. A missing required param is refused.
|
|
13626
|
+
*/
|
|
13627
|
+
declare function queryArgProblems(type: GinDef, args: unknown): string[];
|
|
13628
|
+
/** A fn's one-line signature: `database/main.overdue(customer: text, limit?: num, offset?: num)`. */
|
|
13629
|
+
declare function signatureText(fn: string, args: GinDef): string;
|
|
13630
|
+
|
|
13631
|
+
/** What a generated fn does, which also says how its query is built. */
|
|
13632
|
+
type TableFnKind = 'create' | 'update' | 'updateWhere' | 'remove' | 'removeWhere' | 'selectOne' | 'selectPage' | 'countBy' | 'stats' | 'buckets' | 'exists' | 'findOrCreate' | 'childrenOf' | 'countPerParent' | 'derived';
|
|
13633
|
+
/** What a normalized value means: a plain measure, progress through an order, a portion of a whole, or a relative place. */
|
|
13634
|
+
type DerivedMeaning = 'measure' | 'progress' | 'portion' | 'relative';
|
|
13635
|
+
/** How a derived field is measured. */
|
|
13636
|
+
type DerivedMeasure = 'value' | 'count' | 'sum' | 'avg' | 'min' | 'max' | 'rank' | 'percentile' | 'share' | 'position' | 'ofMax';
|
|
13637
|
+
/** A value computed for each row of a table from its relations or the whole table. */
|
|
13638
|
+
interface DerivedField {
|
|
13639
|
+
/** Its name, also the column and fn name (`projectAvgValue`). */
|
|
13640
|
+
readonly name: string;
|
|
13641
|
+
readonly about: string;
|
|
13642
|
+
readonly meaning: DerivedMeaning;
|
|
13643
|
+
readonly measure: DerivedMeasure;
|
|
13644
|
+
/** The table and column its values come from (`column` is null for a count of rows). */
|
|
13645
|
+
readonly table: string;
|
|
13646
|
+
readonly column: string | null;
|
|
13647
|
+
/** The relations crossed to reach them, in order (empty for the table's own rows). */
|
|
13648
|
+
readonly via: readonly string[];
|
|
13649
|
+
}
|
|
13650
|
+
/** How a fn changes data. */
|
|
13651
|
+
type TableFnMode = 'read' | 'write' | 'delete';
|
|
13652
|
+
/** What the query of a fn is built from: JSON, so it can be stored and rebuilt. */
|
|
13653
|
+
interface TableFnOp {
|
|
13654
|
+
readonly kind: TableFnKind;
|
|
13655
|
+
readonly table: string;
|
|
13656
|
+
/** The column it is about (stats, counts, buckets, a unique lookup), or the foreign key (children, counts per parent). */
|
|
13657
|
+
readonly column?: string;
|
|
13658
|
+
/** The child table, for `childrenOf` and `countPerParent`. */
|
|
13659
|
+
readonly child?: string;
|
|
13660
|
+
/** The date bucket, for `buckets`. */
|
|
13661
|
+
readonly bucket?: 'day' | 'week' | 'month';
|
|
13662
|
+
/** Derived fields to add (`selectPage`), or the one a `derived` fn reads. */
|
|
13663
|
+
readonly derived?: readonly string[];
|
|
13664
|
+
}
|
|
13665
|
+
/** One generated fn. */
|
|
13666
|
+
interface TableFn {
|
|
13667
|
+
/** Its name within the table (`selectPage`, `projectCount`). */
|
|
13668
|
+
readonly name: string;
|
|
13669
|
+
readonly table: string;
|
|
13670
|
+
readonly kind: TableFnKind;
|
|
13671
|
+
readonly about: string;
|
|
13672
|
+
/** Its group: `crud`, `columns`, `table`, or the relation it comes from. */
|
|
13673
|
+
readonly group: string;
|
|
13674
|
+
/** Lower comes first: the most useful fns of a group lead. */
|
|
13675
|
+
readonly rank: number;
|
|
13676
|
+
readonly mode: TableFnMode;
|
|
13677
|
+
readonly op: TableFnOp;
|
|
13678
|
+
readonly query: QueryDef;
|
|
13679
|
+
/** Its args as a gin `obj` (params, then paging and sort). */
|
|
13680
|
+
readonly args: TypeDef$1;
|
|
13681
|
+
/** One line: `selectPage(status?: "active" | "done", limit?: num, …)`. */
|
|
13682
|
+
readonly signature: string;
|
|
13683
|
+
/** It reads a list, so callers page it. */
|
|
13684
|
+
readonly list: boolean;
|
|
13685
|
+
/** Output columns a caller may sort by. */
|
|
13686
|
+
readonly sorters: readonly string[];
|
|
13687
|
+
/** Params a caller may leave out (bound as null: no filter, no change). */
|
|
13688
|
+
readonly optional: readonly string[];
|
|
13689
|
+
/** Constant defaults of args a caller may leave out (`withArgDefaults` fills them before binding). */
|
|
13690
|
+
readonly defaults: Readonly<Record<string, JsonValue>>;
|
|
13691
|
+
readonly derived?: DerivedField;
|
|
13692
|
+
}
|
|
13693
|
+
/** A table's generated fns, the most useful first, capped. */
|
|
13694
|
+
interface TableFnList {
|
|
13695
|
+
readonly table: string;
|
|
13696
|
+
/** A hash of the table and every table it relates to: when it changes, regenerate. */
|
|
13697
|
+
readonly hash: string;
|
|
13698
|
+
readonly fns: readonly TableFn[];
|
|
13699
|
+
/** How many fns were left out past the cap. */
|
|
13700
|
+
readonly more: number;
|
|
13701
|
+
}
|
|
13702
|
+
/** What `tableFns` takes besides the tables. */
|
|
13703
|
+
interface TableFnOptions {
|
|
13704
|
+
/** How many relation hops derived fields follow (default 2). */
|
|
13705
|
+
readonly depth?: number;
|
|
13706
|
+
/** The most fns listed (default 60); the rest are counted in `more`. */
|
|
13707
|
+
readonly cap?: number;
|
|
13708
|
+
/** Paging for list fns (default max 500, page 50). */
|
|
13709
|
+
readonly paging?: QueryPaging;
|
|
13710
|
+
}
|
|
13711
|
+
/** A combination the generators refuse (an incompatible ratio, an unknown table, column or derived field). */
|
|
13712
|
+
declare class TableFnError extends Error {
|
|
13713
|
+
constructor(message: string);
|
|
13714
|
+
}
|
|
13715
|
+
/** Whether a numerator and denominator measure the same table and column, so their ratio means something. */
|
|
13716
|
+
declare function canCompare(numerator: Pick<DerivedField, 'table' | 'column'>, denominator: Pick<DerivedField, 'table' | 'column'>): boolean;
|
|
13717
|
+
/** `numerator / denominator` as a decimal, NULL over zero; refused unless they measure the same table and column. */
|
|
13718
|
+
declare function ratio(numerator: {
|
|
13719
|
+
readonly expr: ExprDef;
|
|
13720
|
+
readonly table: string;
|
|
13721
|
+
readonly column: string | null;
|
|
13722
|
+
}, denominator: {
|
|
13723
|
+
readonly expr: ExprDef;
|
|
13724
|
+
readonly table: string;
|
|
13725
|
+
readonly column: string | null;
|
|
13726
|
+
}): ExprDef;
|
|
13727
|
+
/** Every fn a table could have, the most useful first, capped. */
|
|
13728
|
+
declare function tableFns(table: string, tables: readonly TableSpec[], options?: TableFnOptions): TableFnList;
|
|
13729
|
+
/** The query of one fn, rebuilt from its op (with other derived columns, say). */
|
|
13730
|
+
declare function tableFnQuery(op: TableFnOp, tables: readonly TableSpec[], options?: TableFnOptions): TableFn;
|
|
13731
|
+
/** A stable hash of a table and the tables it relates to (FNV-1a over their canonical JSON). */
|
|
13732
|
+
declare function tableSchemaHash(table: string, tables: readonly TableSpec[]): string;
|
|
13733
|
+
/** A table's single-column foreign key onto another table's single-column key. */
|
|
13734
|
+
interface BelongsTo {
|
|
13735
|
+
/** The relation word (`owner`). */
|
|
13736
|
+
readonly word: string;
|
|
13737
|
+
readonly column: string;
|
|
13738
|
+
readonly parent: TableSpec;
|
|
13739
|
+
readonly key: string;
|
|
13740
|
+
}
|
|
13741
|
+
/** Another table's foreign key onto this one. */
|
|
13742
|
+
interface HasMany {
|
|
13743
|
+
/** The relation word (`project`, or `projectByReviewer` when one table points here twice). */
|
|
13744
|
+
readonly word: string;
|
|
13745
|
+
readonly child: TableSpec;
|
|
13746
|
+
readonly column: string;
|
|
13747
|
+
}
|
|
13748
|
+
/** Collects the joins an inner select needs, one per belongs-to crossing, and fresh aliases. */
|
|
13749
|
+
declare class JoinSet {
|
|
13750
|
+
#private;
|
|
13751
|
+
readonly joins: JoinDef[];
|
|
13752
|
+
fresh(prefix: string): string;
|
|
13753
|
+
/** The alias of `alias`'s parent across `column`, joining it the first time. */
|
|
13754
|
+
parent(alias: string, column: string): string;
|
|
13755
|
+
}
|
|
13756
|
+
/** A derived field and how to compute it for a row bound under an alias. */
|
|
13757
|
+
interface Derivation {
|
|
13758
|
+
readonly field: DerivedField;
|
|
13759
|
+
readonly rank: number;
|
|
13760
|
+
readonly group: string;
|
|
13761
|
+
build(joins: JoinSet, alias: string): ExprDef;
|
|
13762
|
+
}
|
|
13763
|
+
/** Tables, their relations, and an engine to check every generated query. */
|
|
13764
|
+
declare class TableFnSchema {
|
|
13765
|
+
#private;
|
|
13766
|
+
constructor(tables: readonly TableSpec[], options?: TableFnOptions);
|
|
13767
|
+
/** The engine the queries are checked with. */
|
|
13768
|
+
get engine(): QueryEngine;
|
|
13769
|
+
table(name: string): TableSpec;
|
|
13770
|
+
belongsTo(t: TableSpec): BelongsTo[];
|
|
13771
|
+
hasMany(t: TableSpec): HasMany[];
|
|
13772
|
+
/** Every derived field of a table (own number columns compared, relations followed to the depth). */
|
|
13773
|
+
derivations(t: TableSpec, depth?: number, own?: boolean): Derivation[];
|
|
13774
|
+
/** The table's fns, most useful first, capped. */
|
|
13775
|
+
list(table: string): TableFnList;
|
|
13776
|
+
/** One fn from its op: its query (checked), args and signature. Throws `TableFnError` for what it can't build. */
|
|
13777
|
+
fn(op: TableFnOp): TableFn;
|
|
13778
|
+
}
|
|
13779
|
+
/** The field type of a derived field's value. */
|
|
13780
|
+
declare function derivedFieldType(field: DerivedField, tables: readonly TableSpec[]): FieldTypeDef;
|
|
13781
|
+
|
|
12989
13782
|
/**
|
|
12990
13783
|
* inferType — derive a `TypeDef` from a sample of plain JSON rows.
|
|
12991
13784
|
*
|
|
@@ -13683,4 +14476,4 @@ declare function parseQueryTool(engine: QueryEngine, raw: unknown, options?: Bui
|
|
|
13683
14476
|
*/
|
|
13684
14477
|
declare function buildQueryTool(engine: QueryEngine, options?: BuildQueryToolOptions): Tool<{}, {}, string, QueryToolInput, Promise<QueryResult>, [], Query>;
|
|
13685
14478
|
|
|
13686
|
-
export { AID_REGISTRY, type Access, type AccessRun, type AccessSql, AggregateExpr, type AggregateExprDef, type AggregateMerge, type AggregateRun, type AidInfo, type AidOptions, type AliasedSourceDef, type ArgExprDef, ArrayFieldType, type ArrayFieldTypeDef, type ArrayOp, ArrayOpExpr, type ArrayOpExprDef, type AutoPaginateOptions, BUILTIN_EXPRS, BUILTIN_FIELD_TYPES, BUILTIN_LIBRARY, BUILTIN_QUERIES, Backing, BaseDialect, BetweenExpr, type BetweenExprDef, BinaryExpr, type BinaryExprDef, type BinaryOp, BoolExpr, BoolFieldType, type BoolFieldTypeDef, type BuildQueryToolOptions, type BuildSchemasOptions, type BuiltinFunction, COMPARE_ARM_OPERATORS, type CTEDef, type CTERecursiveDef, type CTEStatementDef, CTEStatementQuery, type CallVocabulary, type CaseBranchDef, type CaseBranchSpec, CaseExpr, type CaseExprDef, type CheckCtx, Code, type CodeLine, type CodeOptions, ComparisonExpr, type ComparisonExprDef, type ComparisonOp, type CompiledFieldTypeOption, type ComputeRun, type ComputeSql, type Computed, type ComputedResolved, type Cost, type CostConstraints, DEFAULT_MAX_CTE_ITERATIONS, DEFAULT_MAX_EXAMPLES, DEFAULT_MAX_QUERY_SCHEMA_TYPES, DEFAULT_SAMPLES, DEFAULT_TEXT_CASING, DateFieldType, type DateFieldTypeDef, type DeclaredArg, type DefaultCondition, type DefaultConditionOp, type DefaultOrder, type DefaultOrderDir, type DefaultOrderScope, type DefaultOrderTerm, type DeleteDef, DeleteQuery, type DescribeEngineOptions, type DescribeOverrides, Dialect, type DialectEntry, type DifferentialCheckOptions, type DifferentialColumns, type DifferentialComparison, type DifferentialExecute, type DifferentialProbe, type DifferentialReport, type DifferentialRow, type DifferentialSkip, type DrillDownFailure, type DrillDownIntoSuccess, type DrillDownResult, type DrillDownSuccess, type DrillParam, type DrillValue, EQ_SELECTIVITY, type Embedder, ExcludedExpr, type ExcludedExprDef, type ExecutorContext, ExistsExpr, type ExistsExprDef, Expr, type ExprClass, type ExprClassEntry, type ExprDef, type ExprKind, ExprQuery, type ExprQueryDef, Field, type FieldBacking, type FieldDef, type FieldExprRestriction, FieldRefExpr, type FieldRefExprDef, type FieldResolved, type FieldSpec, FieldType, type FieldTypeCheckImpl, type FieldTypeClass, type FieldTypeCompareDecl, type FieldTypeConformanceReport, type FieldTypeDef, type FieldTypeImpl, type FieldTypeKind, type FieldTypeOptionDecl, type FieldTypeOptionsOf, FieldTypeRefinement, type FieldTypeRefinementDef, type FieldTypeRefinementDefFor, type FieldTypeRefinementKey, type FieldValueDef, type FilterDepth, FiltersExpr, type FiltersExprDef, type FnDepth, type FormatOptions, type FormatProblemsOptions, FunctionCallExpr, type FunctionCallExprDef, type FunctionDef, type FunctionParamDef, type FunctionRun, type FunctionSelector, type FunctionShape, type FunctionSourceDef, IN_SELECTIVITY, InExpr, type InExprDef, Index, type IndexDef, IndexPart, type IndexPartDef, type InferOptions, type InsertDef, InsertQuery, type InsertRowDef, IsNullExpr, type IsNullExprDef, type JSONEntry, type JoinBacking, JoinCtePlanner, type JoinDef, type JoinHop, type JoinOnDef, type JoinRequest, type JoinRunPlan, type JoinSpec, type JoinSqlPlan, type JoinType, JsonFieldType, type JsonFieldTypeDef, type JsonValue, type LateralJoinSpec, type LatticeLaw, type LatticeLawOptions, type LatticeLawReport, LiteralExpr, type LiteralExprDef, LogicalExpr, type LogicalExprDef, type LogicalOp, type MaybePromise, type Meta, MoneyFieldType, type MoneyFieldTypeDef, type MoneyOptions, type NameDepth, type NamedArgs, type Node, NumberFieldType, type NumberFieldTypeDef, type NumberOptions, OPERATOR_NAME_PATTERN, type OnConflictDef, type OperatorCheckOptions, type OperatorConformanceReport, type OperatorDef, OperatorExpr, type OperatorExprDef, type OperatorOperandDef, type OperatorRun, type OrderDef, type OrderEntry, OutputRefExpr, type OutputRefExprDef, type PaginatableDef, type PaginatableQuery, type ParamConflict, type ParamDef, ParamExpr, type ParamExprDef, type ParamInfo, ParamSet, type ParamUse, PostgresDialect, type Problem, Problems, Query, type QueryClass, type QueryClassEntry, type QueryDef, QueryEngine, type QueryEngineOptions, type QueryField, QueryFunction, QueryJoin, type QueryKind, QueryOperator, QueryOrder, type QueryResult, type QueryResultArray, type QuerySchemaOptions, type QuerySchemas, QueryScope, QuerySource, QueryToolError, type QueryToolInput, QueryTypeError, type QueryValidator, RANGE_SELECTIVITY, RECURSIVE_CTE_LEVELS, REFINABLE_BASES, REFINEMENT_NAME_PATTERN, ROOT_VALIDATE_CONTEXT, type RefDepth, type RefinableBase, Registry, type RelationBacking, RelationFieldType, type RelationFieldTypeDef, type RelationJoinOnDef, type RelationJoinSpec, type RelationKey, type RelationKeyPair, type RelationOn, type RelationOnPair, type RelationResolved, type RenderedSql, type ResolvedParam, type ResolvedSchemaDepth, type ResolvedType, type RlsProvider, RuntimeContext, type RuntimeJoin, type RuntimeOptions, SCALAR_KINDS, SEMANTIC_ROW_PENALTY, type ScalarKind, type ScalarRun, type ScalarValue, type SchemaDepth, type SchemaOptions, type SearchBacking, type SelectDef, type SelectFieldDef, SelectQuery, type SelectTypesOptions, type SelectedFunctions, type SemanticBacking, type SemanticEmbeddings, SemanticExpr, type SemanticExprDef, type SemanticQueryDef, type SemanticTextToVector, type SetDef, type SetOperationDef, SetOperationQuery, type Shape, type SortEntryDef, type SortSelectionDef, type SorterDef, SorterExpr, type SourceDef, type SourceFieldOptionalRef, type SourceFieldRef, type SourceFieldsRef, type SourceRecord, type SourceRow, type Span, type SpanMeta, SqlContext, type SqlParamValue, SqlText, type SqlValue, SubqueryExpr, type SubqueryExprDef, type SubquerySourceDef, TEXT_CASINGS, TEXT_SEARCH_ROW_PENALTY, TabularFunctionCallExpr, type TabularFunctionCallExprDef, type TabularRun, type Template, type TemplatePart, type TextCasing, TextFieldType, type TextFieldTypeDef, type TextOptions, TextScoreExpr, type TextScoreExprDef, TextSearchExpr, type TextSearchExprDef, TimestampFieldType, type TimestampFieldTypeDef, type TimezonePolicy, type ToSqlOptions, Type, type TypeBacking, type TypeDef, type TypeExecutor, type TypeFieldRef, type TypeResolved, type TypeSourceDef, type TypeSpec, type TypeState, UnaryExpr, type UnaryExprDef, type UnaryOp, type UpdateDef, UpdateQuery, type ValidateContext, Value, type ValueCategory, type ValueComparator, type ValueSchemaOptions, type ValueSite, WINDOW_ORDER_ARG, WindowExpr, type WindowExprDef, type WindowOrderSpec, type WindowRun, type WriteValueDef, ZERO_COST, add, addCost, age, agg, aidInfo, aliasedDigest, and, arrayAgg, arrayAppend, arrayConcat, arrayContains, arrayDistinct, arrayExecutor, arrayIndexOf, arrayPrepend, arrayRemove, arraySlice, arrayToString, asFieldType, autoPaginate, avg, between, boolAnd, boolOr, boundValue, buildQueryTool, buildSchemas, builtinDialects, bytesOfResolved, canAutoPaginate, canonicalize, caseExpr, casingRank, checkFieldType, checkLatticeLaws, checkOperator, cloneRecord, code, concat, contains, containsAll, containsAny, count, countIf, countStar, createRegistry, currentTime, currentTimestamp, dateAdd, dateDiff, dateFormat, datePart, dateTrunc, day, dayOfWeek, dayOfYear, defaultConditionOps, defaultConditionWithout, depthInstructions, describeDialects, describeEngine, describeExprs, describeFunctions, describeInput, describeOperators, describeQueryExamples, describeType, describeTypes, didYouMean, differentialCheck, directedMessage, div, drillDown, drillDownInto, e, editDistance, effectiveCasing, embeddingResolver, epoch, eq, excluded, exists, exprDefSchema, exprDigest, fieldMeta, fieldNameOf, fieldTypeDefSchema, filters, firstField, fn, foldsAtRuntime, foldsInSql, fromEpoch, generatedFieldDescription, generatedFieldLabel, generatedTypeDescription, generatedTypeLabel, gt, gte, hour, humanize, ilike, inList, inSubquery, inferType, isEmpty, isNull, isScalar, isScalarValue, isSlot, isType, isVectorText, join, joinAlias, joinCode, joinLines, jsonValueSchema, like, lit, lt, lte, makeDate, makeField, makeResult, max, maxCost, mergeOfAggregateCall, mergeRows, min, minute, mod, month, mul, nearest, nearestKind, neg, neq, not, notBetween, notEmpty, notExists, notInList, notInSubquery, notLike, notNull, or, output, param, parseQueryRequest, parseQueryTool, parseVectorText, plain, pos, querySchema, raw, recordKey, recordSignature, ref, refinementKeySchema, refusedOperators, relJoin, relationKeyColumns, relationOf, renameSource, reportCostProblems, resolveAccessRun, resolveAccessSql, resolveComputeRun, resolveComputeSql, resolveDefaultConditionRun, resolveDefaultConditionSql, resolveFields, resolveJoinRun, resolveJoinSql, resolveSchemaDepth, rlsPredicate, rowsCost, runAggregateFunction, runOperator, runScalarFunction, runTabularFunction, runWindowFunction, scaleRows, scanTemplate, second, selectFunctions, selectTypes, semantic, index as shape, shouldUseStringSchema, singleRow, sortEntries, sourcesOf, span, stddev, strictestCasing, stringAgg, stringToArray, sub, subquery, suggestionBudget, sum, syntheticType, tableFn, templateSlotNames, textScore, textSearch, timezoneSchema, toArrayRows, toVectorText, topsByKind, typeFromFields, typeMeta, typedValueSql, validateNamedCall, value, valueFieldType, variance, week, when, widenNullable, window, withAid, year };
|
|
14479
|
+
export { AID_REGISTRY, type Access, type AccessRun, type AccessSql, AggregateExpr, type AggregateExprDef, type AggregateMerge, type AggregateRun, type AidInfo, type AidOptions, type AliasedSourceDef, AnsiDdl, type ArgExprDef, ArrayFieldType, type ArrayFieldTypeDef, type ArrayOp, ArrayOpExpr, type ArrayOpExprDef, type AutoPaginateOptions, BUILTIN_EXPRS, BUILTIN_FIELD_TYPES, BUILTIN_LIBRARY, BUILTIN_QUERIES, Backing, BaseDialect, BetweenExpr, type BetweenExprDef, BinaryExpr, type BinaryExprDef, type BinaryOp, BoolExpr, BoolFieldType, type BoolFieldTypeDef, type BuildQueryToolOptions, type BuildSchemasOptions, type BuiltinFunction, COMPARE_ARM_OPERATORS, type CTEDef, type CTERecursiveDef, type CTEStatementDef, CTEStatementQuery, type CallVocabulary, type CaseBranchDef, type CaseBranchSpec, CaseExpr, type CaseExprDef, type CheckCtx, Code, type CodeLine, type CodeOptions, type ColumnChange, ColumnDefault, ColumnSpec, ColumnType, type ColumnTypeKind, ComparisonExpr, type ComparisonExprDef, type ComparisonOp, type CompiledFieldTypeOption, type ComputeRun, type ComputeSql, type Computed, type ComputedResolved, type Cost, type CostConstraints, DEFAULT_MAX_CTE_ITERATIONS, DEFAULT_MAX_EXAMPLES, DEFAULT_MAX_QUERY_SCHEMA_TYPES, DEFAULT_SAMPLES, DEFAULT_TEXT_CASING, DateFieldType, type DateFieldTypeDef, DdlAction, DdlError, DdlStep, type DdlWriter, type DeclaredArg, type DefaultCondition, type DefaultConditionOp, type DefaultOrder, type DefaultOrderDir, type DefaultOrderScope, type DefaultOrderTerm, type DeleteDef, DeleteQuery, type DerivedField, type DerivedMeaning, type DerivedMeasure, type DescribeEngineOptions, type DescribeOverrides, Dialect, type DialectEntry, type DifferentialCheckOptions, type DifferentialColumns, type DifferentialComparison, type DifferentialExecute, type DifferentialProbe, type DifferentialReport, type DifferentialRow, type DifferentialSkip, type DrillDownFailure, type DrillDownIntoSuccess, type DrillDownResult, type DrillDownSuccess, type DrillParam, type DrillValue, EQ_SELECTIVITY, type Embedder, ExcludedExpr, type ExcludedExprDef, type ExecutorContext, ExistsExpr, type ExistsExprDef, Expr, type ExprClass, type ExprClassEntry, type ExprDef, type ExprKind, ExprQuery, type ExprQueryDef, Field, type FieldBacking, type FieldDef, type FieldExprRestriction, FieldRefExpr, type FieldRefExprDef, type FieldResolved, type FieldSpec, FieldType, type FieldTypeCheckImpl, type FieldTypeClass, type FieldTypeCompareDecl, type FieldTypeConformanceReport, type FieldTypeDef, type FieldTypeImpl, type FieldTypeKind, type FieldTypeOptionDecl, type FieldTypeOptionsOf, FieldTypeRefinement, type FieldTypeRefinementDef, type FieldTypeRefinementDefFor, type FieldTypeRefinementKey, type FieldValueDef, type FilterDepth, FiltersExpr, type FiltersExprDef, type FnDepth, ForeignKeySpec, type FormatOptions, type FormatProblemsOptions, FunctionCallExpr, type FunctionCallExprDef, type FunctionDef, type FunctionParamDef, type FunctionRun, type FunctionSelector, type FunctionShape, type FunctionSourceDef, type GinTableOptions, IN_SELECTIVITY, InExpr, type InExprDef, Index, type IndexDef, IndexPart, type IndexPartDef, type InferOptions, type InsertDef, InsertQuery, type InsertRowDef, IsNullExpr, type IsNullExprDef, type JSONEntry, type JoinBacking, JoinCtePlanner, type JoinDef, type JoinHop, type JoinOnDef, type JoinRequest, type JoinRunPlan, type JoinSpec, type JoinSqlPlan, type JoinType, JsonFieldType, type JsonFieldTypeDef, type JsonValue, type LateralJoinSpec, type LatticeLaw, type LatticeLawOptions, type LatticeLawReport, LiteralExpr, type LiteralExprDef, LogicalExpr, type LogicalExprDef, type LogicalOp, type MaybePromise, type Meta, MoneyFieldType, type MoneyFieldTypeDef, type MoneyOptions, type NameDepth, type NamedArgs, type Node, NumberFieldType, type NumberFieldTypeDef, type NumberOptions, OPERATOR_NAME_PATTERN, type OnConflictDef, type OperatorCheckOptions, type OperatorConformanceReport, type OperatorDef, OperatorExpr, type OperatorExprDef, type OperatorOperandDef, type OperatorRun, type OrderDef, type OrderEntry, OutputRefExpr, type OutputRefExprDef, type PaginatableDef, type PaginatableQuery, type ParamConflict, type ParamDef, ParamExpr, type ParamExprDef, type ParamInfo, ParamSet, type ParamUse, PostgresDdl, PostgresDialect, type Problem, Problems, Query, type QueryArgsOptions, type QueryClass, type QueryClassEntry, type QueryDef, QueryEngine, type QueryEngineOptions, type QueryField, QueryFunction, QueryJoin, type QueryKind, QueryOperator, QueryOrder, type QueryPaging, type QueryResult, type QueryResultArray, type QuerySchemaOptions, type QuerySchemas, QueryScope, QuerySource, QueryToolError, type QueryToolInput, QueryTypeError, type QueryTypeOptions, type QueryValidator, RANGE_SELECTIVITY, RECURSIVE_CTE_LEVELS, REFINABLE_BASES, REFINEMENT_NAME_PATTERN, ROOT_VALIDATE_CONTEXT, type RefDepth, type RefinableBase, Registry, type RelationBacking, RelationFieldType, type RelationFieldTypeDef, type RelationJoinOnDef, type RelationJoinSpec, type RelationKey, type RelationKeyPair, type RelationOn, type RelationOnPair, type RelationResolved, type RenderedSql, type ResolvedParam, type ResolvedSchemaDepth, type ResolvedType, type RlsProvider, RuntimeContext, type RuntimeJoin, type RuntimeOptions, SCALAR_KINDS, SEMANTIC_ROW_PENALTY, type ScalarKind, type ScalarRun, type ScalarValue, type SchemaDepth, type SchemaOptions, type SearchBacking, type SelectDef, type SelectFieldDef, SelectQuery, type SelectTypesOptions, type SelectedFunctions, type SemanticBacking, type SemanticEmbeddings, SemanticExpr, type SemanticExprDef, type SemanticQueryDef, type SemanticTextToVector, type SetDef, type SetOperationDef, SetOperationQuery, type Shape, type SortEntryDef, type SortSelectionDef, type SorterDef, SorterExpr, type SourceDef, type SourceFieldOptionalRef, type SourceFieldRef, type SourceFieldsRef, type SourceRecord, type SourceRow, type Span, type SpanMeta, SqlContext, SqlDdl, type SqlParamValue, SqlServerDdl, SqlServerDialect, SqlText, type SqlValue, SqliteDdl, SqliteDialect, SubqueryExpr, type SubqueryExprDef, type SubquerySourceDef, TEXT_CASINGS, TEXT_SEARCH_ROW_PENALTY, type TableDiff, type TableFn, TableFnError, type TableFnKind, type TableFnList, type TableFnMode, type TableFnOp, type TableFnOptions, TableFnSchema, TableSpec, TabularFunctionCallExpr, type TabularFunctionCallExprDef, type TabularRun, type Template, type TemplatePart, type TextCasing, TextFieldType, type TextFieldTypeDef, type TextOptions, TextScoreExpr, type TextScoreExprDef, TextSearchExpr, type TextSearchExprDef, TimestampFieldType, type TimestampFieldTypeDef, type TimezonePolicy, type ToSqlOptions, Type, type TypeBacking, type TypeDef, type TypeExecutor, type TypeFieldRef, type TypeResolved, type TypeSourceDef, type TypeSpec, type TypeState, UUID_PATTERN, UnaryExpr, type UnaryExprDef, type UnaryOp, UniqueSpec, type UpdateDef, UpdateQuery, type ValidateContext, Value, type ValueCategory, type ValueComparator, type ValueSchemaOptions, type ValueSite, WINDOW_ORDER_ARG, WindowExpr, type WindowExprDef, type WindowOrderSpec, type WindowRun, type WriteValueDef, ZERO_COST, add, addCost, age, agg, aidInfo, aliasedDigest, and, arrayAgg, arrayAppend, arrayConcat, arrayContains, arrayDistinct, arrayExecutor, arrayIndexOf, arrayPrepend, arrayRemove, arraySlice, arrayToString, asFieldType, autoPaginate, avg, between, boolAnd, boolOr, boundValue, buildQueryTool, buildSchemas, builtinDialects, bytesOfResolved, canAutoPaginate, canCompare, canonicalize, caseExpr, casingRank, checkFieldType, checkLatticeLaws, checkOperator, ckName, cloneRecord, code, columnTypeWidens, concat, contains, containsAll, containsAny, count, countIf, countStar, createRegistry, currentTime, currentTimestamp, dateAdd, dateDiff, dateFormat, datePart, dateTrunc, day, dayOfWeek, dayOfYear, defaultConditionOps, defaultConditionWithout, depthInstructions, derivedFieldType, describeDialects, describeEngine, describeExprs, describeFunctions, describeInput, describeOperators, describeQueryExamples, describeType, describeTypes, didYouMean, differentialCheck, directedMessage, div, drillDown, drillDownInto, e, editDistance, effectiveCasing, embeddingResolver, epoch, eq, excluded, exists, exprDefSchema, exprDigest, fieldMeta, fieldNameOf, fieldTypeDefSchema, fieldTypeToGin, filters, firstField, fkName, fn, foldsAtRuntime, foldsInSql, fromEpoch, generatedFieldDescription, generatedFieldLabel, generatedTypeDescription, generatedTypeLabel, ginToColumnType, ginTypeToTable, gt, gte, hour, humanize, ilike, inList, inSubquery, inferType, isEmpty, isNull, isScalar, isScalarValue, isSlot, isType, isVectorText, join, joinAlias, joinCode, joinLines, jsonValueSchema, like, lit, lt, lte, makeDate, makeField, makeResult, max, maxCost, mergeOfAggregateCall, mergeRows, min, minute, mod, month, mul, nearest, nearestKind, neg, neq, not, notBetween, notEmpty, notExists, notInList, notInSubquery, notLike, notNull, or, output, param, parseQueryRequest, parseQueryTool, parseVectorText, pkName, plain, pos, queryArgProblems, queryArgsType, querySchema, ratio, raw, readCommonType, recordKey, recordSignature, ref, refinementKeySchema, refusedOperators, relJoin, relationKeyColumns, relationOf, renameSource, reportCostProblems, resolveAccessRun, resolveAccessSql, resolveComputeRun, resolveComputeSql, resolveDefaultConditionRun, resolveDefaultConditionSql, resolveFields, resolveJoinRun, resolveJoinSql, resolveSchemaDepth, rlsPredicate, rowsCost, runAggregateFunction, runOperator, runScalarFunction, runTabularFunction, runWindowFunction, sameColumnType, scalarFieldType, scalarType, scaleRows, scanTemplate, second, selectFunctions, selectTypes, semantic, index as shape, shouldUseStringSchema, signatureText, singleRow, sortEntries, sourcesOf, span, splitNative, stddev, strictestCasing, stringAgg, stringToArray, sub, subquery, suggestionBudget, sum, syntheticType, tableFn, tableFnQuery, tableFns, tableSchemaHash, tableToGinType, tableToQueryType, templateSlotNames, textScore, textSearch, timezoneSchema, toArrayRows, toVectorText, topsByKind, typeFromFields, typeMeta, typedValueSql, uqName, validateNamedCall, value, valueFieldType, variance, week, when, widenNullable, window, withAid, withArgDefaults, year };
|