trilean-sql 2.2.1 → 2.2.3

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.
@@ -2,12 +2,11 @@ import { CompiledSql, SqlCompileOptions } from "./options.cjs";
2
2
  import { PredicateNode } from "trilean";
3
3
  //#region src/compile-test-helpers.d.ts
4
4
  /** Compiles against `subjectOptions` by default, so each split `compile.*.test.ts` file below only has to name a dialect/column configuration explicitly when it actually differs from the shared default. */
5
- declare function compile(node: PredicateNode, options?: Readonly<SqlCompileOptions>): CompiledSql;
6
- declare const ADULT_AGE = 18;
7
- declare const SAMPLE_AGE = 40;
8
- declare const EXCLUDED_AGE = 7;
9
- declare const LOWER_BOUND = 1;
10
- declare const UPPER_BOUND = 4;
11
- declare const ageOver: PredicateNode;
12
- //#endregion
13
- export { ADULT_AGE, EXCLUDED_AGE, LOWER_BOUND, SAMPLE_AGE, UPPER_BOUND, ageOver, compile };
5
+ export declare function compile(node: PredicateNode, options?: Readonly<SqlCompileOptions>): CompiledSql;
6
+ export declare const ADULT_AGE = 18;
7
+ export declare const SAMPLE_AGE = 40;
8
+ export declare const EXCLUDED_AGE = 7;
9
+ export declare const LOWER_BOUND = 1;
10
+ export declare const UPPER_BOUND = 4;
11
+ export declare const ageOver: PredicateNode;
12
+ //#endregion
@@ -2,12 +2,11 @@ import { CompiledSql, SqlCompileOptions } from "./options.js";
2
2
  import { PredicateNode } from "trilean";
3
3
  //#region src/compile-test-helpers.d.ts
4
4
  /** Compiles against `subjectOptions` by default, so each split `compile.*.test.ts` file below only has to name a dialect/column configuration explicitly when it actually differs from the shared default. */
5
- declare function compile(node: PredicateNode, options?: Readonly<SqlCompileOptions>): CompiledSql;
6
- declare const ADULT_AGE = 18;
7
- declare const SAMPLE_AGE = 40;
8
- declare const EXCLUDED_AGE = 7;
9
- declare const LOWER_BOUND = 1;
10
- declare const UPPER_BOUND = 4;
11
- declare const ageOver: PredicateNode;
12
- //#endregion
13
- export { ADULT_AGE, EXCLUDED_AGE, LOWER_BOUND, SAMPLE_AGE, UPPER_BOUND, ageOver, compile };
5
+ export declare function compile(node: PredicateNode, options?: Readonly<SqlCompileOptions>): CompiledSql;
6
+ export declare const ADULT_AGE = 18;
7
+ export declare const SAMPLE_AGE = 40;
8
+ export declare const EXCLUDED_AGE = 7;
9
+ export declare const LOWER_BOUND = 1;
10
+ export declare const UPPER_BOUND = 4;
11
+ export declare const ageOver: PredicateNode;
12
+ //#endregion
@@ -11,6 +11,5 @@ import { PredicateNode } from "trilean";
11
11
  * @throws `UnsupportedNodeError` if any node in the tree is one this compiler will not translate -- see `findUnpushableNodeKind`, which this runs first and which a caller can run itself to choose between pushdown and in-process evaluation without provoking an exception.
12
12
  * @throws `InvalidColumnError` if `columnFor` returns a column that cannot be rendered as an identifier.
13
13
  */
14
- declare function compilePredicateNode(node: PredicateNode, options: Readonly<SqlCompileOptions>): CompiledSql;
15
- //#endregion
16
- export { compilePredicateNode };
14
+ export declare function compilePredicateNode(node: PredicateNode, options: Readonly<SqlCompileOptions>): CompiledSql;
15
+ //#endregion
package/dist/compile.d.ts CHANGED
@@ -11,6 +11,5 @@ import { PredicateNode } from "trilean";
11
11
  * @throws `UnsupportedNodeError` if any node in the tree is one this compiler will not translate -- see `findUnpushableNodeKind`, which this runs first and which a caller can run itself to choose between pushdown and in-process evaluation without provoking an exception.
12
12
  * @throws `InvalidColumnError` if `columnFor` returns a column that cannot be rendered as an identifier.
13
13
  */
14
- declare function compilePredicateNode(node: PredicateNode, options: Readonly<SqlCompileOptions>): CompiledSql;
15
- //#endregion
16
- export { compilePredicateNode };
14
+ export declare function compilePredicateNode(node: PredicateNode, options: Readonly<SqlCompileOptions>): CompiledSql;
15
+ //#endregion
package/dist/errors.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region src/errors.d.ts
2
2
  /** Base class for every error this package raises, so a caller can distinguish a compilation failure from an error thrown by its own `columnFor` (which is called during compilation and whose exceptions propagate unchanged). */
3
- declare class TrileanSqlError extends Error {
3
+ export declare class TrileanSqlError extends Error {
4
4
  constructor(message: string);
5
5
  }
6
6
  /**
@@ -10,7 +10,7 @@ declare class TrileanSqlError extends Error {
10
10
  *
11
11
  * `nodeKind` is the offending node's own `kind`, `path` locates it inside the tree, and `reason` says why it is not pushable -- which is not always about the kind alone (a `reference` carrying a `unit`, or a `compare` whose operands are statically of different kinds, are both refused despite `reference` and `compare` being supported kinds).
12
12
  */
13
- declare class UnsupportedNodeError extends TrileanSqlError {
13
+ export declare class UnsupportedNodeError extends TrileanSqlError {
14
14
  readonly nodeKind: string;
15
15
  readonly path: string;
16
16
  readonly reason: string;
@@ -27,7 +27,7 @@ declare class UnsupportedNodeError extends TrileanSqlError {
27
27
  *
28
28
  * `dialect` is the offending name and `implemented` lists the ones this version does compile.
29
29
  */
30
- declare class UnknownDialectError extends TrileanSqlError {
30
+ export declare class UnknownDialectError extends TrileanSqlError {
31
31
  readonly dialect: string;
32
32
  readonly implemented: readonly string[];
33
33
  constructor(dialect: string, implemented: readonly string[]);
@@ -37,7 +37,7 @@ declare class UnknownDialectError extends TrileanSqlError {
37
37
  *
38
38
  * A column name is an identifier, not a value, so it is the one part of the emitted SQL that cannot be parameterised -- it has to be written into the statement text. It is always emitted double-quoted with any embedded quote doubled, which makes an arbitrary string safe, so this is not the injection defence; it rejects the two shapes that quoting cannot rescue into a valid identifier, an empty name and an empty dot-separated segment.
39
39
  */
40
- declare class InvalidColumnError extends TrileanSqlError {
40
+ export declare class InvalidColumnError extends TrileanSqlError {
41
41
  readonly referenceKey: string;
42
42
  readonly column: string;
43
43
  constructor(referenceKey: string, column: string, reason: string);
@@ -47,10 +47,9 @@ declare class InvalidColumnError extends TrileanSqlError {
47
47
  *
48
48
  * Mirrors `InvalidColumnError` exactly, for the correlated table a `some`/`every`/`fold` node compiles against instead of a mapped column: `table` is likewise an identifier that has to be written into the statement text rather than bound as a parameter, so this rejects the same two shapes quoting cannot rescue -- an empty name and an empty dot-separated segment.
49
49
  */
50
- declare class InvalidCollectionTableError extends TrileanSqlError {
50
+ export declare class InvalidCollectionTableError extends TrileanSqlError {
51
51
  readonly collectionKey: string;
52
52
  readonly table: string;
53
53
  constructor(collectionKey: string, table: string, reason: string);
54
54
  }
55
- //#endregion
56
- export { InvalidCollectionTableError, InvalidColumnError, TrileanSqlError, UnknownDialectError, UnsupportedNodeError };
55
+ //#endregion
package/dist/errors.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region src/errors.d.ts
2
2
  /** Base class for every error this package raises, so a caller can distinguish a compilation failure from an error thrown by its own `columnFor` (which is called during compilation and whose exceptions propagate unchanged). */
3
- declare class TrileanSqlError extends Error {
3
+ export declare class TrileanSqlError extends Error {
4
4
  constructor(message: string);
5
5
  }
6
6
  /**
@@ -10,7 +10,7 @@ declare class TrileanSqlError extends Error {
10
10
  *
11
11
  * `nodeKind` is the offending node's own `kind`, `path` locates it inside the tree, and `reason` says why it is not pushable -- which is not always about the kind alone (a `reference` carrying a `unit`, or a `compare` whose operands are statically of different kinds, are both refused despite `reference` and `compare` being supported kinds).
12
12
  */
13
- declare class UnsupportedNodeError extends TrileanSqlError {
13
+ export declare class UnsupportedNodeError extends TrileanSqlError {
14
14
  readonly nodeKind: string;
15
15
  readonly path: string;
16
16
  readonly reason: string;
@@ -27,7 +27,7 @@ declare class UnsupportedNodeError extends TrileanSqlError {
27
27
  *
28
28
  * `dialect` is the offending name and `implemented` lists the ones this version does compile.
29
29
  */
30
- declare class UnknownDialectError extends TrileanSqlError {
30
+ export declare class UnknownDialectError extends TrileanSqlError {
31
31
  readonly dialect: string;
32
32
  readonly implemented: readonly string[];
33
33
  constructor(dialect: string, implemented: readonly string[]);
@@ -37,7 +37,7 @@ declare class UnknownDialectError extends TrileanSqlError {
37
37
  *
38
38
  * A column name is an identifier, not a value, so it is the one part of the emitted SQL that cannot be parameterised -- it has to be written into the statement text. It is always emitted double-quoted with any embedded quote doubled, which makes an arbitrary string safe, so this is not the injection defence; it rejects the two shapes that quoting cannot rescue into a valid identifier, an empty name and an empty dot-separated segment.
39
39
  */
40
- declare class InvalidColumnError extends TrileanSqlError {
40
+ export declare class InvalidColumnError extends TrileanSqlError {
41
41
  readonly referenceKey: string;
42
42
  readonly column: string;
43
43
  constructor(referenceKey: string, column: string, reason: string);
@@ -47,10 +47,9 @@ declare class InvalidColumnError extends TrileanSqlError {
47
47
  *
48
48
  * Mirrors `InvalidColumnError` exactly, for the correlated table a `some`/`every`/`fold` node compiles against instead of a mapped column: `table` is likewise an identifier that has to be written into the statement text rather than bound as a parameter, so this rejects the same two shapes quoting cannot rescue -- an empty name and an empty dot-separated segment.
49
49
  */
50
- declare class InvalidCollectionTableError extends TrileanSqlError {
50
+ export declare class InvalidCollectionTableError extends TrileanSqlError {
51
51
  readonly collectionKey: string;
52
52
  readonly table: string;
53
53
  constructor(collectionKey: string, table: string, reason: string);
54
54
  }
55
- //#endregion
56
- export { InvalidCollectionTableError, InvalidColumnError, TrileanSqlError, UnknownDialectError, UnsupportedNodeError };
55
+ //#endregion
@@ -1,6 +1,5 @@
1
1
  import { PredicateNode } from "trilean";
2
2
  //#region src/guard-test-helpers.d.ts
3
3
  /** Shared across the split `guard.*.test.ts` files below -- a pushable comparison used as filler in trees whose real subject is something else entirely (an unrelated node kind, a collection wrapper). */
4
- declare const ageOver: PredicateNode;
5
- //#endregion
6
- export { ageOver };
4
+ export declare const ageOver: PredicateNode;
5
+ //#endregion
@@ -1,6 +1,5 @@
1
1
  import { PredicateNode } from "trilean";
2
2
  //#region src/guard-test-helpers.d.ts
3
3
  /** Shared across the split `guard.*.test.ts` files below -- a pushable comparison used as filler in trees whose real subject is something else entirely (an unrelated node kind, a collection wrapper). */
4
- declare const ageOver: PredicateNode;
5
- //#endregion
6
- export { ageOver };
4
+ export declare const ageOver: PredicateNode;
5
+ //#endregion
package/dist/guard.d.cts CHANGED
@@ -2,7 +2,7 @@ import { SqlCompileOptions } from "./options.cjs";
2
2
  import { PredicateNode } from "trilean";
3
3
  //#region src/guard.d.ts
4
4
  /** Where the walk stopped, and why. `kind` is the offending node's own `kind` even when the objection is not to the kind itself. */
5
- interface UnpushableNode {
5
+ export interface UnpushableNode {
6
6
  kind: string;
7
7
  /** A dotted path from the root of the tree, e.g. `$.operands[1].left`. */
8
8
  path: string;
@@ -20,6 +20,5 @@ interface UnpushableNode {
20
20
  * Which nodes are refused does not depend on the dialect -- every divergence refused here is real in both -- so a structural walk given no `options` refuses exactly what a walk given them would. What `options` also settles is which engine each `reason` describes; with none to read a dialect from, the reasons describe PostgreSQL, the dialect these refusals were first derived against.
21
21
  * @throws `UnknownDialectError` if `options` names a dialect this version does not implement. Reporting a tree as pushable is a promise that `compilePredicateNode` will compile it, and under a dialect that does not exist it cannot -- so this is refused here rather than left to surface from the compiler, which is the one caller this function's answer is for.
22
22
  */
23
- declare function findUnpushableNodeKind(node: PredicateNode, options?: SqlCompileOptions): UnpushableNode | undefined;
24
- //#endregion
25
- export { UnpushableNode, findUnpushableNodeKind };
23
+ export declare function findUnpushableNodeKind(node: PredicateNode, options?: SqlCompileOptions): UnpushableNode | undefined;
24
+ //#endregion
package/dist/guard.d.ts CHANGED
@@ -2,7 +2,7 @@ import { SqlCompileOptions } from "./options.js";
2
2
  import { PredicateNode } from "trilean";
3
3
  //#region src/guard.d.ts
4
4
  /** Where the walk stopped, and why. `kind` is the offending node's own `kind` even when the objection is not to the kind itself. */
5
- interface UnpushableNode {
5
+ export interface UnpushableNode {
6
6
  kind: string;
7
7
  /** A dotted path from the root of the tree, e.g. `$.operands[1].left`. */
8
8
  path: string;
@@ -20,6 +20,5 @@ interface UnpushableNode {
20
20
  * Which nodes are refused does not depend on the dialect -- every divergence refused here is real in both -- so a structural walk given no `options` refuses exactly what a walk given them would. What `options` also settles is which engine each `reason` describes; with none to read a dialect from, the reasons describe PostgreSQL, the dialect these refusals were first derived against.
21
21
  * @throws `UnknownDialectError` if `options` names a dialect this version does not implement. Reporting a tree as pushable is a promise that `compilePredicateNode` will compile it, and under a dialect that does not exist it cannot -- so this is refused here rather than left to surface from the compiler, which is the one caller this function's answer is for.
22
22
  */
23
- declare function findUnpushableNodeKind(node: PredicateNode, options?: SqlCompileOptions): UnpushableNode | undefined;
24
- //#endregion
25
- export { UnpushableNode, findUnpushableNodeKind };
23
+ export declare function findUnpushableNodeKind(node: PredicateNode, options?: SqlCompileOptions): UnpushableNode | undefined;
24
+ //#endregion
@@ -1,10 +1,10 @@
1
1
  //#region src/options.d.ts
2
2
  /** The declared SQL value kind of a mapped column. `"timestamp"` names trilean's `instant` kind, whose values are ISO-8601 strings. */
3
- type SqlParamType = "text" | "number" | "boolean" | "timestamp";
3
+ export type SqlParamType = "text" | "number" | "boolean" | "timestamp";
4
4
  /** The SQL dialects this compiler emits. A dialect is named rather than inferred: the same tree compiles to different text for each, and a caller that never said which one it meant would be relying on whichever happened to be the default. */
5
- type SqlDialect = "postgres" | "sqlite";
5
+ export type SqlDialect = "postgres" | "sqlite";
6
6
  /** What a `reference` node's key maps onto in the target schema. */
7
- interface SqlColumnBinding {
7
+ export interface SqlColumnBinding {
8
8
  /** The column, optionally qualified with a table or schema by dots (`"orders.total"`). Each dot-separated segment is emitted as its own double-quoted identifier, so a segment may contain any character except a dot itself. */
9
9
  column: string;
10
10
  /**
@@ -14,7 +14,7 @@ interface SqlColumnBinding {
14
14
  */
15
15
  paramType?: SqlParamType;
16
16
  }
17
- interface SqlCollectionBinding {
17
+ export interface SqlCollectionBinding {
18
18
  /** The correlated child table, dot-qualified exactly like `SqlColumnBinding.column` -- each dot-separated segment is emitted as its own double-quoted identifier. */
19
19
  table: string;
20
20
  /** Raw boolean SQL relating one row of `table` to the outer row, e.g. `"attrs"."nodeId" = "graph_nodes"."id" AND "attrs"."attrName" = 'voltageLevel'`. Caller-authored rather than assembled from a join-column pair, because only the caller knows the real join shape -- a single FK, a composite key, or (the EAV driving case) an FK plus a literal discriminator. */
@@ -22,7 +22,7 @@ interface SqlCollectionBinding {
22
22
  /** Resolves a reference key *inside* this collection's `item`/`filter` -- swapped in for the outer `columnFor` while compiling them, mirroring how trilean's own evaluator re-points `EvaluationContext` at the collection item (see `evaluator.ts`'s `resolveParticipatingItems`). */
23
23
  columnFor: (referenceKey: string) => SqlColumnBinding;
24
24
  }
25
- interface SqlCompileOptions {
25
+ export interface SqlCompileOptions {
26
26
  /** Which dialect to emit. It is a required field rather than a default so that a caller states the engine it is compiling for, instead of inheriting whichever one this package happened to implement first. */
27
27
  dialect: SqlDialect;
28
28
  /**
@@ -52,20 +52,20 @@ interface SqlCompileOptions {
52
52
  */
53
53
  postgresRegexpPushdown?: boolean;
54
54
  }
55
- interface CompiledSql {
55
+ export interface CompiledSql {
56
56
  /** A self-contained boolean expression, always parenthesised, suitable for dropping straight into a `WHERE` clause (or a `CHECK`, a `HAVING`, or a filtered index predicate). It carries no `WHERE` keyword of its own. */
57
57
  sql: string;
58
58
  /** Positional parameters, in emission order, to pass alongside `sql`. Every caller-supplied literal in the tree is here; none is ever written into `sql`. */
59
59
  params: unknown[];
60
60
  }
61
61
  /** The PostgreSQL type each declared value kind is cast to. `timestamptz` rather than `timestamp`: trilean's `instant` is an ISO-8601 string that may carry an offset, and parsing one as a naive `timestamp` would silently discard it. */
62
- declare const POSTGRES_TYPE_NAME: Readonly<Record<SqlParamType, string>>;
62
+ export declare const POSTGRES_TYPE_NAME: Readonly<Record<SqlParamType, string>>;
63
63
  /**
64
64
  * Everything about the emitted SQL that is a property of the dialect rather than of the tree.
65
65
  *
66
66
  * It is deliberately this small. Most of what the compiler emits is ANSI-standard and identical in both engines -- the six comparison operators, `=` and `<>` for `textCompare`'s `equals`/`notEquals`, `AND`/`OR`/`NOT`, `IN`/`NOT IN`, `IS NOT NULL`, and double-quoted identifiers with an embedded quote doubled -- so branching on the dialect anywhere else would be a branch that can never change the output. Three things genuinely differ, and they are the three fields below.
67
67
  */
68
- interface DialectConfig {
68
+ export interface DialectConfig {
69
69
  /** The regular-expression match operator `textCompare`'s `matches` compiles to. */
70
70
  matches: string;
71
71
  /** The negated regular-expression match operator `textCompare`'s `notMatches` compiles to. */
@@ -79,7 +79,7 @@ interface DialectConfig {
79
79
  /** Appended to the bare `NULL` in the two forms an empty `memberOf` candidate list compiles to, for a dialect that needs the resulting expression annotated with a boolean type. */
80
80
  emptyMemberOfNullSuffix: string;
81
81
  }
82
- declare const DIALECT_CONFIG: Readonly<Record<SqlDialect, DialectConfig>>;
82
+ export declare const DIALECT_CONFIG: Readonly<Record<SqlDialect, DialectConfig>>;
83
83
  /**
84
84
  * Refuses a dialect this version does not implement, before anything indexes a per-dialect table with it.
85
85
  *
@@ -87,6 +87,5 @@ declare const DIALECT_CONFIG: Readonly<Record<SqlDialect, DialectConfig>>;
87
87
  *
88
88
  * `DIALECT_CONFIG` is the list, rather than a second constant, so implementing a dialect cannot leave this behind.
89
89
  */
90
- declare function assertImplementedDialect(dialect: SqlDialect): void;
91
- //#endregion
92
- export { CompiledSql, DIALECT_CONFIG, DialectConfig, POSTGRES_TYPE_NAME, SqlCollectionBinding, SqlColumnBinding, SqlCompileOptions, SqlDialect, SqlParamType, assertImplementedDialect };
90
+ export declare function assertImplementedDialect(dialect: SqlDialect): void;
91
+ //#endregion
package/dist/options.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  //#region src/options.d.ts
2
2
  /** The declared SQL value kind of a mapped column. `"timestamp"` names trilean's `instant` kind, whose values are ISO-8601 strings. */
3
- type SqlParamType = "text" | "number" | "boolean" | "timestamp";
3
+ export type SqlParamType = "text" | "number" | "boolean" | "timestamp";
4
4
  /** The SQL dialects this compiler emits. A dialect is named rather than inferred: the same tree compiles to different text for each, and a caller that never said which one it meant would be relying on whichever happened to be the default. */
5
- type SqlDialect = "postgres" | "sqlite";
5
+ export type SqlDialect = "postgres" | "sqlite";
6
6
  /** What a `reference` node's key maps onto in the target schema. */
7
- interface SqlColumnBinding {
7
+ export interface SqlColumnBinding {
8
8
  /** The column, optionally qualified with a table or schema by dots (`"orders.total"`). Each dot-separated segment is emitted as its own double-quoted identifier, so a segment may contain any character except a dot itself. */
9
9
  column: string;
10
10
  /**
@@ -14,7 +14,7 @@ interface SqlColumnBinding {
14
14
  */
15
15
  paramType?: SqlParamType;
16
16
  }
17
- interface SqlCollectionBinding {
17
+ export interface SqlCollectionBinding {
18
18
  /** The correlated child table, dot-qualified exactly like `SqlColumnBinding.column` -- each dot-separated segment is emitted as its own double-quoted identifier. */
19
19
  table: string;
20
20
  /** Raw boolean SQL relating one row of `table` to the outer row, e.g. `"attrs"."nodeId" = "graph_nodes"."id" AND "attrs"."attrName" = 'voltageLevel'`. Caller-authored rather than assembled from a join-column pair, because only the caller knows the real join shape -- a single FK, a composite key, or (the EAV driving case) an FK plus a literal discriminator. */
@@ -22,7 +22,7 @@ interface SqlCollectionBinding {
22
22
  /** Resolves a reference key *inside* this collection's `item`/`filter` -- swapped in for the outer `columnFor` while compiling them, mirroring how trilean's own evaluator re-points `EvaluationContext` at the collection item (see `evaluator.ts`'s `resolveParticipatingItems`). */
23
23
  columnFor: (referenceKey: string) => SqlColumnBinding;
24
24
  }
25
- interface SqlCompileOptions {
25
+ export interface SqlCompileOptions {
26
26
  /** Which dialect to emit. It is a required field rather than a default so that a caller states the engine it is compiling for, instead of inheriting whichever one this package happened to implement first. */
27
27
  dialect: SqlDialect;
28
28
  /**
@@ -52,20 +52,20 @@ interface SqlCompileOptions {
52
52
  */
53
53
  postgresRegexpPushdown?: boolean;
54
54
  }
55
- interface CompiledSql {
55
+ export interface CompiledSql {
56
56
  /** A self-contained boolean expression, always parenthesised, suitable for dropping straight into a `WHERE` clause (or a `CHECK`, a `HAVING`, or a filtered index predicate). It carries no `WHERE` keyword of its own. */
57
57
  sql: string;
58
58
  /** Positional parameters, in emission order, to pass alongside `sql`. Every caller-supplied literal in the tree is here; none is ever written into `sql`. */
59
59
  params: unknown[];
60
60
  }
61
61
  /** The PostgreSQL type each declared value kind is cast to. `timestamptz` rather than `timestamp`: trilean's `instant` is an ISO-8601 string that may carry an offset, and parsing one as a naive `timestamp` would silently discard it. */
62
- declare const POSTGRES_TYPE_NAME: Readonly<Record<SqlParamType, string>>;
62
+ export declare const POSTGRES_TYPE_NAME: Readonly<Record<SqlParamType, string>>;
63
63
  /**
64
64
  * Everything about the emitted SQL that is a property of the dialect rather than of the tree.
65
65
  *
66
66
  * It is deliberately this small. Most of what the compiler emits is ANSI-standard and identical in both engines -- the six comparison operators, `=` and `<>` for `textCompare`'s `equals`/`notEquals`, `AND`/`OR`/`NOT`, `IN`/`NOT IN`, `IS NOT NULL`, and double-quoted identifiers with an embedded quote doubled -- so branching on the dialect anywhere else would be a branch that can never change the output. Three things genuinely differ, and they are the three fields below.
67
67
  */
68
- interface DialectConfig {
68
+ export interface DialectConfig {
69
69
  /** The regular-expression match operator `textCompare`'s `matches` compiles to. */
70
70
  matches: string;
71
71
  /** The negated regular-expression match operator `textCompare`'s `notMatches` compiles to. */
@@ -79,7 +79,7 @@ interface DialectConfig {
79
79
  /** Appended to the bare `NULL` in the two forms an empty `memberOf` candidate list compiles to, for a dialect that needs the resulting expression annotated with a boolean type. */
80
80
  emptyMemberOfNullSuffix: string;
81
81
  }
82
- declare const DIALECT_CONFIG: Readonly<Record<SqlDialect, DialectConfig>>;
82
+ export declare const DIALECT_CONFIG: Readonly<Record<SqlDialect, DialectConfig>>;
83
83
  /**
84
84
  * Refuses a dialect this version does not implement, before anything indexes a per-dialect table with it.
85
85
  *
@@ -87,6 +87,5 @@ declare const DIALECT_CONFIG: Readonly<Record<SqlDialect, DialectConfig>>;
87
87
  *
88
88
  * `DIALECT_CONFIG` is the list, rather than a second constant, so implementing a dialect cannot leave this behind.
89
89
  */
90
- declare function assertImplementedDialect(dialect: SqlDialect): void;
91
- //#endregion
92
- export { CompiledSql, DIALECT_CONFIG, DialectConfig, POSTGRES_TYPE_NAME, SqlCollectionBinding, SqlColumnBinding, SqlCompileOptions, SqlDialect, SqlParamType, assertImplementedDialect };
90
+ export declare function assertImplementedDialect(dialect: SqlDialect): void;
91
+ //#endregion
@@ -3,18 +3,17 @@ import { RegexNode } from "trilean-regex";
3
3
  /**
4
4
  * A `trilean-regex` pattern (or a specific construct within one) this module will not translate for a given target. Distinct from `UnsupportedNodeError`: that class names an unpushable `PredicateNode`/`ExpressionNode`, whereas this names an unpushable construct *inside* a pattern's own AST -- a different tree, one level down. `guard.ts` catches this and folds its `message` into the `textCompare` node's own `UnpushableNode.reason`, so a caller never sees this class directly; it exists to let a compile-time refusal carry a real reason across that boundary without weakening the outer type.
5
5
  */
6
- declare class PortablePatternUnsupportedError extends Error {}
6
+ export declare class PortablePatternUnsupportedError extends Error {}
7
7
  /**
8
8
  * Translates a `trilean-regex` AST into PostgreSQL's own Advanced Regular Expression syntax, for binding as the pattern argument to `~`/`!~`.
9
9
  *
10
10
  * Every construct this grammar accepts translates structurally, `.` included: measured directly against a real PostgreSQL 17 server (see the "PostgreSQL's own engine treats '.' as matching a newline" case in `test/integration/postgres.test.ts`), PostgreSQL's `.` matches a newline by default in the mode this compiler's `~`/`!~` operators run under -- the same as this grammar's own `.` (see trilean-regex's README) -- so no rewriting is needed here. (PostgreSQL's own prose documentation reads, in isolation, as though newline-sensitive matching were the default; it is not the one this operator uses, and the fact was confirmed against the real server rather than trusted from the prose alone -- see the "Verify this assumption" principle this compiler otherwise applies to every other construct too.)
11
11
  * @throws `PortablePatternUnsupportedError` if a bounded repetition exceeds PostgreSQL's own 0-255 bound limit.
12
12
  */
13
- declare function renderPostgresPattern(node: RegexNode): string;
13
+ export declare function renderPostgresPattern(node: RegexNode): string;
14
14
  /**
15
15
  * Translates a `trilean-regex` AST into a `GLOB` pattern, for binding as `GLOB`/`NOT GLOB`'s right-hand argument. See the "reachable subset" doc comment above for exactly what this does and does not translate.
16
16
  * @throws `PortablePatternUnsupportedError` if `node` uses any construct outside the reachable subset.
17
17
  */
18
- declare function renderSqliteGlobPattern(node: RegexNode): string;
19
- //#endregion
20
- export { PortablePatternUnsupportedError, renderPostgresPattern, renderSqliteGlobPattern };
18
+ export declare function renderSqliteGlobPattern(node: RegexNode): string;
19
+ //#endregion
@@ -3,18 +3,17 @@ import { RegexNode } from "trilean-regex";
3
3
  /**
4
4
  * A `trilean-regex` pattern (or a specific construct within one) this module will not translate for a given target. Distinct from `UnsupportedNodeError`: that class names an unpushable `PredicateNode`/`ExpressionNode`, whereas this names an unpushable construct *inside* a pattern's own AST -- a different tree, one level down. `guard.ts` catches this and folds its `message` into the `textCompare` node's own `UnpushableNode.reason`, so a caller never sees this class directly; it exists to let a compile-time refusal carry a real reason across that boundary without weakening the outer type.
5
5
  */
6
- declare class PortablePatternUnsupportedError extends Error {}
6
+ export declare class PortablePatternUnsupportedError extends Error {}
7
7
  /**
8
8
  * Translates a `trilean-regex` AST into PostgreSQL's own Advanced Regular Expression syntax, for binding as the pattern argument to `~`/`!~`.
9
9
  *
10
10
  * Every construct this grammar accepts translates structurally, `.` included: measured directly against a real PostgreSQL 17 server (see the "PostgreSQL's own engine treats '.' as matching a newline" case in `test/integration/postgres.test.ts`), PostgreSQL's `.` matches a newline by default in the mode this compiler's `~`/`!~` operators run under -- the same as this grammar's own `.` (see trilean-regex's README) -- so no rewriting is needed here. (PostgreSQL's own prose documentation reads, in isolation, as though newline-sensitive matching were the default; it is not the one this operator uses, and the fact was confirmed against the real server rather than trusted from the prose alone -- see the "Verify this assumption" principle this compiler otherwise applies to every other construct too.)
11
11
  * @throws `PortablePatternUnsupportedError` if a bounded repetition exceeds PostgreSQL's own 0-255 bound limit.
12
12
  */
13
- declare function renderPostgresPattern(node: RegexNode): string;
13
+ export declare function renderPostgresPattern(node: RegexNode): string;
14
14
  /**
15
15
  * Translates a `trilean-regex` AST into a `GLOB` pattern, for binding as `GLOB`/`NOT GLOB`'s right-hand argument. See the "reachable subset" doc comment above for exactly what this does and does not translate.
16
16
  * @throws `PortablePatternUnsupportedError` if `node` uses any construct outside the reachable subset.
17
17
  */
18
- declare function renderSqliteGlobPattern(node: RegexNode): string;
19
- //#endregion
20
- export { PortablePatternUnsupportedError, renderPostgresPattern, renderSqliteGlobPattern };
18
+ export declare function renderSqliteGlobPattern(node: RegexNode): string;
19
+ //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trilean-sql",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "Compiles a trilean predicate tree into a parameterised SQL WHERE fragment, pushing three-valued logic down onto the database's own NULL propagation instead of evaluating it in process.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -47,8 +47,8 @@
47
47
  },
48
48
  "license": "MIT",
49
49
  "dependencies": {
50
- "trilean": "1.6.2",
51
- "trilean-regex": "1.0.2"
50
+ "trilean": "1.7.0",
51
+ "trilean-regex": "1.0.3"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "turbo run _build",
@@ -87,8 +87,8 @@
87
87
  "@types/better-sqlite3": "^9.6.0",
88
88
  "@types/node": "^26.4.0",
89
89
  "@types/pg": "^8.15.6",
90
- "@vitest/coverage-v8": "^4.1.11",
91
- "better-sqlite3": "^12.11.1",
90
+ "@vitest/coverage-v8": "^5.0.0",
91
+ "better-sqlite3": "^13.0.3",
92
92
  "eslint": "^10.9.1",
93
93
  "eslint-config-prettier": "^10.1.8",
94
94
  "eslint-plugin-prettier": "^5.5.6",
@@ -96,10 +96,10 @@
96
96
  "pg": "^8.16.3",
97
97
  "prettier": "^3.9.6",
98
98
  "publint": "^0.3.24",
99
- "tsdown": "^0.22.14",
99
+ "tsdown": "^0.23.0",
100
100
  "turbo": "^2.10.12",
101
101
  "typescript": "^6.0.3",
102
102
  "typescript-eslint": "^8.68.0",
103
- "vitest": "^4.1.11"
103
+ "vitest": "^5.0.0"
104
104
  }
105
105
  }