trilean-sql 2.2.34 → 2.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compile-test-helpers.cjs +2 -4
- package/dist/compile-test-helpers.d.cts +1 -3
- package/dist/compile-test-helpers.d.ts +1 -3
- package/dist/compile-test-helpers.js +2 -4
- package/dist/compile.cjs +3 -4
- package/dist/compile.d.cts +1 -3
- package/dist/compile.d.ts +1 -3
- package/dist/compile.js +3 -4
- package/dist/errors.cjs +1 -2
- package/dist/errors.d.cts +1 -3
- package/dist/errors.d.ts +1 -3
- package/dist/errors.js +1 -2
- package/dist/guard-test-helpers.cjs +1 -2
- package/dist/guard-test-helpers.d.cts +1 -3
- package/dist/guard-test-helpers.d.ts +1 -3
- package/dist/guard-test-helpers.js +1 -2
- package/dist/guard.cjs +1 -2
- package/dist/guard.d.cts +1 -3
- package/dist/guard.d.ts +1 -3
- package/dist/guard.js +1 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/options.cjs +1 -2
- package/dist/options.d.cts +1 -3
- package/dist/options.d.ts +1 -3
- package/dist/options.js +1 -2
- package/dist/portable-pattern.cjs +1 -2
- package/dist/portable-pattern.d.cts +1 -3
- package/dist/portable-pattern.d.ts +1 -3
- package/dist/portable-pattern.js +1 -2
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_compile = require("./compile.cjs");
|
|
3
|
-
|
|
3
|
+
// src/test-support/columns.ts
|
|
4
4
|
/**
|
|
5
5
|
* The schema the unit tests and every integration suite compile against, so a fragment asserted as a string in one is the same fragment executed against a real engine in the others.
|
|
6
6
|
*
|
|
@@ -42,8 +42,7 @@ const sqliteSubjectOptions = {
|
|
|
42
42
|
({ ...subjectOptions });
|
|
43
43
|
({ ...subjectOptions });
|
|
44
44
|
({ ...sqliteSubjectOptions });
|
|
45
|
-
|
|
46
|
-
//#region src/compile-test-helpers.ts
|
|
45
|
+
// src/compile-test-helpers.ts
|
|
47
46
|
/** 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. */
|
|
48
47
|
function compile(node, options = subjectOptions) {
|
|
49
48
|
return require_compile.compilePredicateNode(node, options);
|
|
@@ -68,7 +67,6 @@ const ageOver = {
|
|
|
68
67
|
value: 18
|
|
69
68
|
}
|
|
70
69
|
};
|
|
71
|
-
//#endregion
|
|
72
70
|
exports.ADULT_AGE = ADULT_AGE;
|
|
73
71
|
exports.EXCLUDED_AGE = EXCLUDED_AGE;
|
|
74
72
|
exports.LOWER_BOUND = LOWER_BOUND;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CompiledSql, SqlCompileOptions } from "./options.cjs";
|
|
2
2
|
import { PredicateNode } from "trilean";
|
|
3
|
-
//#region src/compile-test-helpers.d.ts
|
|
4
3
|
/** 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
4
|
export declare function compile(node: PredicateNode, options?: Readonly<SqlCompileOptions>): CompiledSql;
|
|
6
5
|
/**
|
|
@@ -11,5 +10,4 @@ export declare const SAMPLE_AGE = 40;
|
|
|
11
10
|
export declare const EXCLUDED_AGE = 7;
|
|
12
11
|
export declare const LOWER_BOUND = 1;
|
|
13
12
|
export declare const UPPER_BOUND = 4;
|
|
14
|
-
export declare const ageOver: PredicateNode;
|
|
15
|
-
//#endregion
|
|
13
|
+
export declare const ageOver: PredicateNode;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CompiledSql, SqlCompileOptions } from "./options.js";
|
|
2
2
|
import { PredicateNode } from "trilean";
|
|
3
|
-
//#region src/compile-test-helpers.d.ts
|
|
4
3
|
/** 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
4
|
export declare function compile(node: PredicateNode, options?: Readonly<SqlCompileOptions>): CompiledSql;
|
|
6
5
|
/**
|
|
@@ -11,5 +10,4 @@ export declare const SAMPLE_AGE = 40;
|
|
|
11
10
|
export declare const EXCLUDED_AGE = 7;
|
|
12
11
|
export declare const LOWER_BOUND = 1;
|
|
13
12
|
export declare const UPPER_BOUND = 4;
|
|
14
|
-
export declare const ageOver: PredicateNode;
|
|
15
|
-
//#endregion
|
|
13
|
+
export declare const ageOver: PredicateNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compilePredicateNode } from "./compile.js";
|
|
2
|
-
|
|
2
|
+
// src/test-support/columns.ts
|
|
3
3
|
/**
|
|
4
4
|
* The schema the unit tests and every integration suite compile against, so a fragment asserted as a string in one is the same fragment executed against a real engine in the others.
|
|
5
5
|
*
|
|
@@ -41,8 +41,7 @@ const sqliteSubjectOptions = {
|
|
|
41
41
|
({ ...subjectOptions });
|
|
42
42
|
({ ...subjectOptions });
|
|
43
43
|
({ ...sqliteSubjectOptions });
|
|
44
|
-
|
|
45
|
-
//#region src/compile-test-helpers.ts
|
|
44
|
+
// src/compile-test-helpers.ts
|
|
46
45
|
/** 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. */
|
|
47
46
|
function compile(node, options = subjectOptions) {
|
|
48
47
|
return compilePredicateNode(node, options);
|
|
@@ -67,5 +66,4 @@ const ageOver = {
|
|
|
67
66
|
value: 18
|
|
68
67
|
}
|
|
69
68
|
};
|
|
70
|
-
//#endregion
|
|
71
69
|
export { ADULT_AGE, EXCLUDED_AGE, LOWER_BOUND, SAMPLE_AGE, UPPER_BOUND, ageOver, compile };
|
package/dist/compile.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_errors = require("./errors.cjs");
|
|
3
|
-
const require_options = require("./options.cjs");
|
|
4
|
-
const require_portable_pattern = require("./portable-pattern.cjs");
|
|
5
3
|
const require_guard = require("./guard.cjs");
|
|
4
|
+
const require_portable_pattern = require("./portable-pattern.cjs");
|
|
5
|
+
const require_options = require("./options.cjs");
|
|
6
6
|
let trilean_regex = require("trilean-regex");
|
|
7
|
-
|
|
7
|
+
// src/compile.ts
|
|
8
8
|
const COMPARISON_SQL = {
|
|
9
9
|
gt: ">",
|
|
10
10
|
gte: ">=",
|
|
@@ -247,5 +247,4 @@ function compilePredicateNode(node, options) {
|
|
|
247
247
|
params: context.params
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
|
-
//#endregion
|
|
251
250
|
exports.compilePredicateNode = compilePredicateNode;
|
package/dist/compile.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CompiledSql, SqlCompileOptions } from "./options.cjs";
|
|
2
2
|
import { PredicateNode } from "trilean";
|
|
3
|
-
//#region src/compile.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Compiles a trilean predicate tree into a parameterised boolean expression in the dialect `options` names.
|
|
6
5
|
*
|
|
@@ -11,5 +10,4 @@ import { PredicateNode } from "trilean";
|
|
|
11
10
|
* @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
11
|
* @throws `InvalidColumnError` if `columnFor` returns a column that cannot be rendered as an identifier.
|
|
13
12
|
*/
|
|
14
|
-
export declare function compilePredicateNode(node: PredicateNode, options: Readonly<SqlCompileOptions>): CompiledSql;
|
|
15
|
-
//#endregion
|
|
13
|
+
export declare function compilePredicateNode(node: PredicateNode, options: Readonly<SqlCompileOptions>): CompiledSql;
|
package/dist/compile.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CompiledSql, SqlCompileOptions } from "./options.js";
|
|
2
2
|
import { PredicateNode } from "trilean";
|
|
3
|
-
//#region src/compile.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Compiles a trilean predicate tree into a parameterised boolean expression in the dialect `options` names.
|
|
6
5
|
*
|
|
@@ -11,5 +10,4 @@ import { PredicateNode } from "trilean";
|
|
|
11
10
|
* @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
11
|
* @throws `InvalidColumnError` if `columnFor` returns a column that cannot be rendered as an identifier.
|
|
13
12
|
*/
|
|
14
|
-
export declare function compilePredicateNode(node: PredicateNode, options: Readonly<SqlCompileOptions>): CompiledSql;
|
|
15
|
-
//#endregion
|
|
13
|
+
export declare function compilePredicateNode(node: PredicateNode, options: Readonly<SqlCompileOptions>): CompiledSql;
|
package/dist/compile.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { InvalidCollectionTableError, InvalidColumnError, UnsupportedNodeError } from "./errors.js";
|
|
2
|
-
import { DIALECT_CONFIG, assertImplementedDialect } from "./options.js";
|
|
3
|
-
import { renderPostgresPattern, renderSqliteGlobPattern } from "./portable-pattern.js";
|
|
4
2
|
import { findUnpushableNodeKind } from "./guard.js";
|
|
3
|
+
import { renderPostgresPattern, renderSqliteGlobPattern } from "./portable-pattern.js";
|
|
4
|
+
import { DIALECT_CONFIG, assertImplementedDialect } from "./options.js";
|
|
5
5
|
import { parseRegex } from "trilean-regex";
|
|
6
|
-
|
|
6
|
+
// src/compile.ts
|
|
7
7
|
const COMPARISON_SQL = {
|
|
8
8
|
gt: ">",
|
|
9
9
|
gte: ">=",
|
|
@@ -246,5 +246,4 @@ function compilePredicateNode(node, options) {
|
|
|
246
246
|
params: context.params
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
-
//#endregion
|
|
250
249
|
export { compilePredicateNode };
|
package/dist/errors.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// src/errors.ts
|
|
3
3
|
/** 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). */
|
|
4
4
|
var TrileanSqlError = class extends Error {
|
|
5
5
|
constructor(message) {
|
|
@@ -73,7 +73,6 @@ var InvalidCollectionTableError = class extends TrileanSqlError {
|
|
|
73
73
|
this.table = table;
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
//#endregion
|
|
77
76
|
exports.InvalidCollectionTableError = InvalidCollectionTableError;
|
|
78
77
|
exports.InvalidColumnError = InvalidColumnError;
|
|
79
78
|
exports.TrileanSqlError = TrileanSqlError;
|
package/dist/errors.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/errors.d.ts
|
|
2
1
|
/** 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
2
|
export declare class TrileanSqlError extends Error {
|
|
4
3
|
constructor(message: string);
|
|
@@ -51,5 +50,4 @@ export declare class InvalidCollectionTableError extends TrileanSqlError {
|
|
|
51
50
|
readonly collectionKey: string;
|
|
52
51
|
readonly table: string;
|
|
53
52
|
constructor(collectionKey: string, table: string, reason: string);
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
53
|
+
}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/errors.d.ts
|
|
2
1
|
/** 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
2
|
export declare class TrileanSqlError extends Error {
|
|
4
3
|
constructor(message: string);
|
|
@@ -51,5 +50,4 @@ export declare class InvalidCollectionTableError extends TrileanSqlError {
|
|
|
51
50
|
readonly collectionKey: string;
|
|
52
51
|
readonly table: string;
|
|
53
52
|
constructor(collectionKey: string, table: string, reason: string);
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
53
|
+
}
|
package/dist/errors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/errors.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
3
|
var TrileanSqlError = class extends Error {
|
|
4
4
|
constructor(message) {
|
|
@@ -72,5 +72,4 @@ var InvalidCollectionTableError = class extends TrileanSqlError {
|
|
|
72
72
|
this.table = table;
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
//#endregion
|
|
76
75
|
export { InvalidCollectionTableError, InvalidColumnError, TrileanSqlError, UnknownDialectError, UnsupportedNodeError };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// src/guard-test-helpers.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
4
|
const ageOver = {
|
|
5
5
|
kind: "compare",
|
|
@@ -13,5 +13,4 @@ const ageOver = {
|
|
|
13
13
|
value: 18
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
//#endregion
|
|
17
16
|
exports.ageOver = ageOver;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { PredicateNode } from "trilean";
|
|
2
|
-
//#region src/guard-test-helpers.d.ts
|
|
3
2
|
/** 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
|
-
export declare const ageOver: PredicateNode;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare const ageOver: PredicateNode;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { PredicateNode } from "trilean";
|
|
2
|
-
//#region src/guard-test-helpers.d.ts
|
|
3
2
|
/** 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
|
-
export declare const ageOver: PredicateNode;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare const ageOver: PredicateNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/guard-test-helpers.ts
|
|
2
2
|
/** 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). */
|
|
3
3
|
const ageOver = {
|
|
4
4
|
kind: "compare",
|
|
@@ -12,5 +12,4 @@ const ageOver = {
|
|
|
12
12
|
value: 18
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { ageOver };
|
package/dist/guard.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_options = require("./options.cjs");
|
|
3
3
|
const require_portable_pattern = require("./portable-pattern.cjs");
|
|
4
4
|
let trilean_regex = require("trilean-regex");
|
|
5
|
-
|
|
5
|
+
// src/guard.ts
|
|
6
6
|
const STATIC_KIND_OF_PARAM_TYPE = {
|
|
7
7
|
text: "text",
|
|
8
8
|
number: "number",
|
|
@@ -340,5 +340,4 @@ function findUnpushableNodeKind(node, options) {
|
|
|
340
340
|
require_options.assertImplementedDialect(dialect);
|
|
341
341
|
return findUnpushablePredicate(node, "$", options, DIALECT_DIVERGENCE[dialect]);
|
|
342
342
|
}
|
|
343
|
-
//#endregion
|
|
344
343
|
exports.findUnpushableNodeKind = findUnpushableNodeKind;
|
package/dist/guard.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SqlCompileOptions } from "./options.cjs";
|
|
2
2
|
import { PredicateNode } from "trilean";
|
|
3
|
-
//#region src/guard.d.ts
|
|
4
3
|
/** 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
4
|
export interface UnpushableNode {
|
|
6
5
|
kind: string;
|
|
@@ -20,5 +19,4 @@ export interface UnpushableNode {
|
|
|
20
19
|
* 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
20
|
* @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
21
|
*/
|
|
23
|
-
export declare function findUnpushableNodeKind(node: PredicateNode, options?: SqlCompileOptions): UnpushableNode | undefined;
|
|
24
|
-
//#endregion
|
|
22
|
+
export declare function findUnpushableNodeKind(node: PredicateNode, options?: SqlCompileOptions): UnpushableNode | undefined;
|
package/dist/guard.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SqlCompileOptions } from "./options.js";
|
|
2
2
|
import { PredicateNode } from "trilean";
|
|
3
|
-
//#region src/guard.d.ts
|
|
4
3
|
/** 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
4
|
export interface UnpushableNode {
|
|
6
5
|
kind: string;
|
|
@@ -20,5 +19,4 @@ export interface UnpushableNode {
|
|
|
20
19
|
* 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
20
|
* @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
21
|
*/
|
|
23
|
-
export declare function findUnpushableNodeKind(node: PredicateNode, options?: SqlCompileOptions): UnpushableNode | undefined;
|
|
24
|
-
//#endregion
|
|
22
|
+
export declare function findUnpushableNodeKind(node: PredicateNode, options?: SqlCompileOptions): UnpushableNode | undefined;
|
package/dist/guard.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assertImplementedDialect } from "./options.js";
|
|
2
2
|
import { renderPostgresPattern, renderSqliteGlobPattern } from "./portable-pattern.js";
|
|
3
3
|
import { parseRegex } from "trilean-regex";
|
|
4
|
-
|
|
4
|
+
// src/guard.ts
|
|
5
5
|
const STATIC_KIND_OF_PARAM_TYPE = {
|
|
6
6
|
text: "text",
|
|
7
7
|
number: "number",
|
|
@@ -339,5 +339,4 @@ function findUnpushableNodeKind(node, options) {
|
|
|
339
339
|
assertImplementedDialect(dialect);
|
|
340
340
|
return findUnpushablePredicate(node, "$", options, DIALECT_DIVERGENCE[dialect]);
|
|
341
341
|
}
|
|
342
|
-
//#endregion
|
|
343
342
|
export { findUnpushableNodeKind };
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_errors = require("./errors.cjs");
|
|
3
2
|
const require_guard = require("./guard.cjs");
|
|
4
3
|
const require_compile = require("./compile.cjs");
|
|
4
|
+
const require_errors = require("./errors.cjs");
|
|
5
5
|
exports.InvalidColumnError = require_errors.InvalidColumnError;
|
|
6
6
|
exports.TrileanSqlError = require_errors.TrileanSqlError;
|
|
7
7
|
exports.UnknownDialectError = require_errors.UnknownDialectError;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CompiledSql, SqlColumnBinding, SqlCompileOptions, SqlDialect, SqlParamType } from "./options.cjs";
|
|
2
|
+
import { UnpushableNode, findUnpushableNodeKind } from "./guard.cjs";
|
|
2
3
|
import { compilePredicateNode } from "./compile.cjs";
|
|
3
4
|
import { InvalidColumnError, TrileanSqlError, UnknownDialectError, UnsupportedNodeError } from "./errors.cjs";
|
|
4
|
-
import { UnpushableNode, findUnpushableNodeKind } from "./guard.cjs";
|
|
5
5
|
export { type CompiledSql, InvalidColumnError, type SqlColumnBinding, type SqlCompileOptions, type SqlDialect, type SqlParamType, TrileanSqlError, UnknownDialectError, type UnpushableNode, UnsupportedNodeError, compilePredicateNode, findUnpushableNodeKind };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CompiledSql, SqlColumnBinding, SqlCompileOptions, SqlDialect, SqlParamType } from "./options.js";
|
|
2
|
+
import { UnpushableNode, findUnpushableNodeKind } from "./guard.js";
|
|
2
3
|
import { compilePredicateNode } from "./compile.js";
|
|
3
4
|
import { InvalidColumnError, TrileanSqlError, UnknownDialectError, UnsupportedNodeError } from "./errors.js";
|
|
4
|
-
import { UnpushableNode, findUnpushableNodeKind } from "./guard.js";
|
|
5
5
|
export { type CompiledSql, InvalidColumnError, type SqlColumnBinding, type SqlCompileOptions, type SqlDialect, type SqlParamType, TrileanSqlError, UnknownDialectError, type UnpushableNode, UnsupportedNodeError, compilePredicateNode, findUnpushableNodeKind };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvalidColumnError, TrileanSqlError, UnknownDialectError, UnsupportedNodeError } from "./errors.js";
|
|
2
1
|
import { findUnpushableNodeKind } from "./guard.js";
|
|
3
2
|
import { compilePredicateNode } from "./compile.js";
|
|
3
|
+
import { InvalidColumnError, TrileanSqlError, UnknownDialectError, UnsupportedNodeError } from "./errors.js";
|
|
4
4
|
export { InvalidColumnError, TrileanSqlError, UnknownDialectError, UnsupportedNodeError, compilePredicateNode, findUnpushableNodeKind };
|
package/dist/options.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_errors = require("./errors.cjs");
|
|
3
|
-
|
|
3
|
+
// src/options.ts
|
|
4
4
|
/** 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. */
|
|
5
5
|
const POSTGRES_TYPE_NAME = {
|
|
6
6
|
text: "text",
|
|
@@ -36,7 +36,6 @@ const DIALECT_CONFIG = {
|
|
|
36
36
|
function assertImplementedDialect(dialect) {
|
|
37
37
|
if (!Object.hasOwn(DIALECT_CONFIG, dialect)) throw new require_errors.UnknownDialectError(dialect, Object.keys(DIALECT_CONFIG));
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
exports.DIALECT_CONFIG = DIALECT_CONFIG;
|
|
41
40
|
exports.POSTGRES_TYPE_NAME = POSTGRES_TYPE_NAME;
|
|
42
41
|
exports.assertImplementedDialect = assertImplementedDialect;
|
package/dist/options.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/options.d.ts
|
|
2
1
|
/** The declared SQL value kind of a mapped column. `"timestamp"` names trilean's `instant` kind, whose values are ISO-8601 strings. */
|
|
3
2
|
export type SqlParamType = "text" | "number" | "boolean" | "timestamp";
|
|
4
3
|
/** 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. */
|
|
@@ -87,5 +86,4 @@ export declare const DIALECT_CONFIG: Readonly<Record<SqlDialect, DialectConfig>>
|
|
|
87
86
|
*
|
|
88
87
|
* `DIALECT_CONFIG` is the list, rather than a second constant, so implementing a dialect cannot leave this behind.
|
|
89
88
|
*/
|
|
90
|
-
export declare function assertImplementedDialect(dialect: SqlDialect): void;
|
|
91
|
-
//#endregion
|
|
89
|
+
export declare function assertImplementedDialect(dialect: SqlDialect): void;
|
package/dist/options.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/options.d.ts
|
|
2
1
|
/** The declared SQL value kind of a mapped column. `"timestamp"` names trilean's `instant` kind, whose values are ISO-8601 strings. */
|
|
3
2
|
export type SqlParamType = "text" | "number" | "boolean" | "timestamp";
|
|
4
3
|
/** 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. */
|
|
@@ -87,5 +86,4 @@ export declare const DIALECT_CONFIG: Readonly<Record<SqlDialect, DialectConfig>>
|
|
|
87
86
|
*
|
|
88
87
|
* `DIALECT_CONFIG` is the list, rather than a second constant, so implementing a dialect cannot leave this behind.
|
|
89
88
|
*/
|
|
90
|
-
export declare function assertImplementedDialect(dialect: SqlDialect): void;
|
|
91
|
-
//#endregion
|
|
89
|
+
export declare function assertImplementedDialect(dialect: SqlDialect): void;
|
package/dist/options.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnknownDialectError } from "./errors.js";
|
|
2
|
-
|
|
2
|
+
// src/options.ts
|
|
3
3
|
/** 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. */
|
|
4
4
|
const POSTGRES_TYPE_NAME = {
|
|
5
5
|
text: "text",
|
|
@@ -35,5 +35,4 @@ const DIALECT_CONFIG = {
|
|
|
35
35
|
function assertImplementedDialect(dialect) {
|
|
36
36
|
if (!Object.hasOwn(DIALECT_CONFIG, dialect)) throw new UnknownDialectError(dialect, Object.keys(DIALECT_CONFIG));
|
|
37
37
|
}
|
|
38
|
-
//#endregion
|
|
39
38
|
export { DIALECT_CONFIG, POSTGRES_TYPE_NAME, assertImplementedDialect };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// src/portable-pattern.ts
|
|
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
|
*/
|
|
@@ -145,7 +145,6 @@ function renderSqliteGlobPattern(node) {
|
|
|
145
145
|
const body = plan.body.map((atom) => renderGlobAtom(atom)).join("");
|
|
146
146
|
return `${plan.anchoredStart ? "" : "*"}${body}${plan.anchoredEnd ? "" : "*"}`.replaceAll(/\*{2,}/g, "*");
|
|
147
147
|
}
|
|
148
|
-
//#endregion
|
|
149
148
|
exports.PortablePatternUnsupportedError = PortablePatternUnsupportedError;
|
|
150
149
|
exports.renderPostgresPattern = renderPostgresPattern;
|
|
151
150
|
exports.renderSqliteGlobPattern = renderSqliteGlobPattern;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RegexNode } from "trilean-regex";
|
|
2
|
-
//#region src/portable-pattern.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* 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
4
|
*/
|
|
@@ -15,5 +14,4 @@ export declare function renderPostgresPattern(node: RegexNode): string;
|
|
|
15
14
|
* 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
15
|
* @throws `PortablePatternUnsupportedError` if `node` uses any construct outside the reachable subset.
|
|
17
16
|
*/
|
|
18
|
-
export declare function renderSqliteGlobPattern(node: RegexNode): string;
|
|
19
|
-
//#endregion
|
|
17
|
+
export declare function renderSqliteGlobPattern(node: RegexNode): string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RegexNode } from "trilean-regex";
|
|
2
|
-
//#region src/portable-pattern.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* 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
4
|
*/
|
|
@@ -15,5 +14,4 @@ export declare function renderPostgresPattern(node: RegexNode): string;
|
|
|
15
14
|
* 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
15
|
* @throws `PortablePatternUnsupportedError` if `node` uses any construct outside the reachable subset.
|
|
17
16
|
*/
|
|
18
|
-
export declare function renderSqliteGlobPattern(node: RegexNode): string;
|
|
19
|
-
//#endregion
|
|
17
|
+
export declare function renderSqliteGlobPattern(node: RegexNode): string;
|
package/dist/portable-pattern.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/portable-pattern.ts
|
|
2
2
|
/**
|
|
3
3
|
* 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.
|
|
4
4
|
*/
|
|
@@ -144,5 +144,4 @@ function renderSqliteGlobPattern(node) {
|
|
|
144
144
|
const body = plan.body.map((atom) => renderGlobAtom(atom)).join("");
|
|
145
145
|
return `${plan.anchoredStart ? "" : "*"}${body}${plan.anchoredEnd ? "" : "*"}`.replaceAll(/\*{2,}/g, "*");
|
|
146
146
|
}
|
|
147
|
-
//#endregion
|
|
148
147
|
export { PortablePatternUnsupportedError, renderPostgresPattern, renderSqliteGlobPattern };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trilean-sql",
|
|
3
3
|
"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.",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.35",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/ExaDev/trilean/issues"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"trilean": "1.13.
|
|
10
|
-
"trilean-regex": "1.0.
|
|
9
|
+
"trilean": "1.13.7",
|
|
10
|
+
"trilean-regex": "1.0.20"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"pg": "^8.23.1",
|
|
27
27
|
"prettier": "^3.9.10",
|
|
28
28
|
"publint": "^0.3.25",
|
|
29
|
-
"tsdown": "^0.23.
|
|
29
|
+
"tsdown": "^0.23.7",
|
|
30
30
|
"turbo": "^2.11.10",
|
|
31
31
|
"typescript": "^6.0.3",
|
|
32
32
|
"typescript-eslint": "^8.71.1",
|