trilean-sql 2.2.41 → 2.3.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/dist/options.cjs CHANGED
@@ -1,41 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_errors = require("./errors.cjs");
3
- // src/options.ts
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
- const POSTGRES_TYPE_NAME = {
6
- text: "text",
7
- number: "double precision",
8
- boolean: "boolean",
9
- timestamp: "timestamptz"
10
- };
11
- const DIALECT_CONFIG = {
12
- postgres: {
13
- matches: "~",
14
- notMatches: "!~",
15
- portableMatches: "~",
16
- portableNotMatches: "!~",
17
- placeholder: (index, castTo) => `$${String(index)}::${POSTGRES_TYPE_NAME[castTo]}`,
18
- emptyMemberOfNullSuffix: "::boolean"
19
- },
20
- sqlite: {
21
- matches: "REGEXP",
22
- notMatches: "NOT REGEXP",
23
- portableMatches: "GLOB",
24
- portableNotMatches: "NOT GLOB",
25
- placeholder: () => "?",
26
- emptyMemberOfNullSuffix: ""
27
- }
28
- };
29
- /**
30
- * Refuses a dialect this version does not implement, before anything indexes a per-dialect table with it.
31
- *
32
- * Both entry points check their own argument, because both are reachable with a name the type describes but cannot enforce -- a dialect is exactly the sort of value that arrives as a configuration string asserted into the union at the boundary. Left unchecked, that name is not caught anywhere: the compiler reads an operator off `undefined` and throws a `TypeError` naming an internal field, and the guard, whose tables are only consulted for a node it actually objects to, answers "pushable" for a tree the compiler then fails on -- the one thing `findUnpushableNodeKind` exists to decide, decided wrongly.
33
- *
34
- * `DIALECT_CONFIG` is the list, rather than a second constant, so implementing a dialect cannot leave this behind.
35
- */
36
- function assertImplementedDialect(dialect) {
37
- if (!Object.hasOwn(DIALECT_CONFIG, dialect)) throw new require_errors.UnknownDialectError(dialect, Object.keys(DIALECT_CONFIG));
38
- }
39
- exports.DIALECT_CONFIG = DIALECT_CONFIG;
40
- exports.POSTGRES_TYPE_NAME = POSTGRES_TYPE_NAME;
41
- exports.assertImplementedDialect = assertImplementedDialect;
2
+ const require_options = require("./options-DOE1_Cwr.cjs");
3
+ exports.DIALECT_CONFIG = require_options.DIALECT_CONFIG;
4
+ exports.POSTGRES_TYPE_NAME = require_options.POSTGRES_TYPE_NAME;
5
+ exports.assertImplementedDialect = require_options.assertImplementedDialect;
@@ -77,6 +77,14 @@ export interface DialectConfig {
77
77
  placeholder: (index: number, castTo: SqlParamType) => string;
78
78
  /** 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. */
79
79
  emptyMemberOfNullSuffix: string;
80
+ /**
81
+ * Renders an instant-valued column expression as the value the dialect compares. PostgreSQL's `timestamptz` already is a point in time and needs nothing; SQLite holds an instant as text in whatever form the writer chose (an offset, a `Z`, any number of fractional digits), and text compares by its characters rather than by the instant, so the text is read as a point in time first: whole milliseconds since the epoch, as an integer.
82
+ */
83
+ instantColumn: (columnSql: string) => string;
84
+ /**
85
+ * The bind value of an `instantLiteral`, for a comparison the dialect makes with {@link DialectConfig.instantColumn}. PostgreSQL parses the text itself and casts it. SQLite compares milliseconds since the epoch, read from a text in the one grammar of `internal/sqlite-instant.ts`; a text outside the grammar of `internal/sqlite-instant.ts` is `null`, which makes the comparison unknown.
86
+ */
87
+ instantParameter: (iso: string) => unknown;
80
88
  }
81
89
  export declare const DIALECT_CONFIG: Readonly<Record<SqlDialect, DialectConfig>>;
82
90
  /**
package/dist/options.d.ts CHANGED
@@ -77,6 +77,14 @@ export interface DialectConfig {
77
77
  placeholder: (index: number, castTo: SqlParamType) => string;
78
78
  /** 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. */
79
79
  emptyMemberOfNullSuffix: string;
80
+ /**
81
+ * Renders an instant-valued column expression as the value the dialect compares. PostgreSQL's `timestamptz` already is a point in time and needs nothing; SQLite holds an instant as text in whatever form the writer chose (an offset, a `Z`, any number of fractional digits), and text compares by its characters rather than by the instant, so the text is read as a point in time first: whole milliseconds since the epoch, as an integer.
82
+ */
83
+ instantColumn: (columnSql: string) => string;
84
+ /**
85
+ * The bind value of an `instantLiteral`, for a comparison the dialect makes with {@link DialectConfig.instantColumn}. PostgreSQL parses the text itself and casts it. SQLite compares milliseconds since the epoch, read from a text in the one grammar of `internal/sqlite-instant.ts`; a text outside the grammar of `internal/sqlite-instant.ts` is `null`, which makes the comparison unknown.
86
+ */
87
+ instantParameter: (iso: string) => unknown;
80
88
  }
81
89
  export declare const DIALECT_CONFIG: Readonly<Record<SqlDialect, DialectConfig>>;
82
90
  /**
package/dist/options.js CHANGED
@@ -1,38 +1 @@
1
- import { UnknownDialectError } from "./errors.js";
2
- // src/options.ts
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
- const POSTGRES_TYPE_NAME = {
5
- text: "text",
6
- number: "double precision",
7
- boolean: "boolean",
8
- timestamp: "timestamptz"
9
- };
10
- const DIALECT_CONFIG = {
11
- postgres: {
12
- matches: "~",
13
- notMatches: "!~",
14
- portableMatches: "~",
15
- portableNotMatches: "!~",
16
- placeholder: (index, castTo) => `$${String(index)}::${POSTGRES_TYPE_NAME[castTo]}`,
17
- emptyMemberOfNullSuffix: "::boolean"
18
- },
19
- sqlite: {
20
- matches: "REGEXP",
21
- notMatches: "NOT REGEXP",
22
- portableMatches: "GLOB",
23
- portableNotMatches: "NOT GLOB",
24
- placeholder: () => "?",
25
- emptyMemberOfNullSuffix: ""
26
- }
27
- };
28
- /**
29
- * Refuses a dialect this version does not implement, before anything indexes a per-dialect table with it.
30
- *
31
- * Both entry points check their own argument, because both are reachable with a name the type describes but cannot enforce -- a dialect is exactly the sort of value that arrives as a configuration string asserted into the union at the boundary. Left unchecked, that name is not caught anywhere: the compiler reads an operator off `undefined` and throws a `TypeError` naming an internal field, and the guard, whose tables are only consulted for a node it actually objects to, answers "pushable" for a tree the compiler then fails on -- the one thing `findUnpushableNodeKind` exists to decide, decided wrongly.
32
- *
33
- * `DIALECT_CONFIG` is the list, rather than a second constant, so implementing a dialect cannot leave this behind.
34
- */
35
- function assertImplementedDialect(dialect) {
36
- if (!Object.hasOwn(DIALECT_CONFIG, dialect)) throw new UnknownDialectError(dialect, Object.keys(DIALECT_CONFIG));
37
- }
38
- export { DIALECT_CONFIG, POSTGRES_TYPE_NAME, assertImplementedDialect };
1
+ export { t as DIALECT_CONFIG, n as POSTGRES_TYPE_NAME, r as assertImplementedDialect } from "./options-c1nHisgX.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.41",
4
+ "version": "2.3.0",
5
5
  "bugs": {
6
6
  "url": "https://github.com/ExaDev/trilean/issues"
7
7
  },