uql-orm 0.54.0 → 0.55.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.
Files changed (131) hide show
  1. package/README.md +2 -2
  2. package/dist/browser/uql-browser.min.js.map +1 -1
  3. package/dist/bunSql/bunSql.util.d.ts +3 -14
  4. package/dist/bunSql/bunSql.util.js +33 -56
  5. package/dist/bunSql/bunSqlQuerier.d.ts +3 -6
  6. package/dist/bunSql/bunSqlQuerier.js +7 -13
  7. package/dist/bunSql/bunSqlQuerierPool.d.ts +10 -5
  8. package/dist/bunSql/bunSqlQuerierPool.js +25 -10
  9. package/dist/cockroachdb/crdbQuerierPool.d.ts +1 -3
  10. package/dist/cockroachdb/crdbQuerierPool.js +0 -4
  11. package/dist/cockroachdb/index.d.ts +0 -1
  12. package/dist/cockroachdb/index.js +0 -1
  13. package/dist/d1/d1SqliteDialect.d.ts +5 -0
  14. package/dist/d1/d1SqliteDialect.js +7 -0
  15. package/dist/dialect/abstractSqlDialect.d.ts +9 -9
  16. package/dist/dialect/abstractSqlDialect.js +38 -51
  17. package/dist/dialect/hydrateColumn.js +2 -2
  18. package/dist/dialect/mergeSqlDialect.d.ts +2 -2
  19. package/dist/dialect/mergeSqlDialect.js +0 -4
  20. package/dist/dialect/pgLikeSqlDialect.d.ts +5 -0
  21. package/dist/dialect/pgLikeSqlDialect.js +12 -2
  22. package/dist/entity/index.d.ts +1 -1
  23. package/dist/entity/index.js +1 -1
  24. package/dist/entity/metadata/definition.d.ts +3 -1
  25. package/dist/entity/metadata/definition.js +8 -0
  26. package/dist/libsql/index.d.ts +0 -1
  27. package/dist/libsql/index.js +0 -1
  28. package/dist/libsql/libsqlQuerierPool.d.ts +3 -5
  29. package/dist/libsql/libsqlQuerierPool.js +2 -5
  30. package/dist/maria/mariadbQuerier.d.ts +0 -3
  31. package/dist/maria/mariadbQuerier.js +6 -7
  32. package/dist/maria/mariadbQuerierPool.js +4 -7
  33. package/dist/migrate/ddl/index.d.ts +3 -3
  34. package/dist/migrate/ddl/index.js +3 -3
  35. package/dist/mongo/index.d.ts +0 -1
  36. package/dist/mongo/index.js +0 -1
  37. package/dist/mongo/mongoDialect.d.ts +0 -1
  38. package/dist/mongo/mongoDialect.js +3 -14
  39. package/dist/mongo/mongodbQuerier.js +6 -5
  40. package/dist/mongo/mongodbQuerierPool.d.ts +2 -2
  41. package/dist/mongo/mongodbQuerierPool.js +2 -2
  42. package/dist/mssql/mssqlDialect.d.ts +3 -5
  43. package/dist/mssql/mssqlDialect.js +9 -8
  44. package/dist/mssql/mssqlQuerier.d.ts +13 -6
  45. package/dist/mssql/mssqlQuerier.js +30 -75
  46. package/dist/mssql/mssqlQuerierPool.js +2 -0
  47. package/dist/mssql/mssqlWireTypes.d.ts +3 -4
  48. package/dist/mssql/mssqlWireTypes.js +5 -8
  49. package/dist/mysql/index.d.ts +0 -1
  50. package/dist/mysql/index.js +0 -1
  51. package/dist/mysql/mysql2Querier.d.ts +1 -4
  52. package/dist/mysql/mysql2Querier.js +0 -3
  53. package/dist/mysql/mysql2QuerierPool.d.ts +2 -2
  54. package/dist/mysql/mysql2QuerierPool.js +5 -3
  55. package/dist/neon/index.d.ts +0 -2
  56. package/dist/neon/index.js +0 -2
  57. package/dist/neon/neonQuerierPool.d.ts +2 -4
  58. package/dist/neon/neonQuerierPool.js +2 -6
  59. package/dist/pglite/index.d.ts +0 -1
  60. package/dist/pglite/index.js +0 -1
  61. package/dist/pglite/pgliteQuerier.d.ts +3 -3
  62. package/dist/pglite/pgliteQuerier.js +1 -1
  63. package/dist/pglite/pgliteQuerierPool.d.ts +7 -2
  64. package/dist/pglite/pgliteQuerierPool.js +16 -6
  65. package/dist/postgres/abstractPgQuerierPool.d.ts +8 -12
  66. package/dist/postgres/abstractPgQuerierPool.js +8 -6
  67. package/dist/postgres/index.d.ts +0 -1
  68. package/dist/postgres/index.js +0 -1
  69. package/dist/postgres/pgNumericTypes.d.ts +5 -5
  70. package/dist/postgres/pgNumericTypes.js +11 -7
  71. package/dist/postgres/pgQuerier.d.ts +22 -4
  72. package/dist/postgres/pgQuerier.js +29 -2
  73. package/dist/postgres/pgQuerierPool.d.ts +2 -4
  74. package/dist/postgres/pgQuerierPool.js +2 -6
  75. package/dist/postgres/postgresDialect.d.ts +5 -5
  76. package/dist/postgres/postgresDialect.js +5 -5
  77. package/dist/postgres/postgresWireDriverCapabilities.d.ts +2 -2
  78. package/dist/postgres/postgresWireDriverCapabilities.js +2 -2
  79. package/dist/querier/abstractPoolQuerier.d.ts +1 -1
  80. package/dist/querier/abstractPoolQuerier.js +1 -1
  81. package/dist/querier/abstractSqlQuerier.d.ts +11 -4
  82. package/dist/querier/abstractSqlQuerier.js +28 -16
  83. package/dist/sqlite/hranaQuerier.d.ts +6 -8
  84. package/dist/sqlite/hranaQuerier.js +13 -30
  85. package/dist/sqlite/hranaQuerierPool.d.ts +3 -4
  86. package/dist/sqlite/hranaQuerierPool.js +2 -1
  87. package/dist/sqlite/localSqliteQuerierPool.d.ts +3 -3
  88. package/dist/sqlite/localSqliteQuerierPool.js +4 -2
  89. package/dist/sqlite/nodeSqliteAdapter.d.ts +0 -1
  90. package/dist/sqlite/nodeSqliteQuerierPool.js +0 -2
  91. package/dist/sqlite/sqlitePragmas.d.ts +12 -0
  92. package/dist/sqlite/sqlitePragmas.js +15 -0
  93. package/dist/sqlite/sqliteQuerierPool.d.ts +0 -5
  94. package/dist/sqlite/sqliteQuerierPool.js +2 -13
  95. package/dist/turso/index.d.ts +0 -1
  96. package/dist/turso/index.js +0 -1
  97. package/dist/turso/tursoLocalQuerier.d.ts +0 -1
  98. package/dist/turso/tursoLocalQuerierPool.js +2 -2
  99. package/dist/turso/tursoQuerierPool.d.ts +1 -3
  100. package/dist/turso/tursoQuerierPool.js +0 -4
  101. package/dist/type/dialect.d.ts +1 -1
  102. package/dist/util/dialect.util.d.ts +1 -1
  103. package/dist/util/dialect.util.js +1 -1
  104. package/dist/util/logger.d.ts +7 -8
  105. package/dist/util/logger.js +18 -11
  106. package/dist/util/raw.js +3 -3
  107. package/dist/util/sqlLiteral.js +3 -8
  108. package/dist/util/string.util.js +2 -6
  109. package/dist/util/wideNumber.d.ts +14 -0
  110. package/dist/util/wideNumber.js +24 -0
  111. package/package.json +1 -1
  112. package/dist/cockroachdb/crdbQuerier.d.ts +0 -8
  113. package/dist/cockroachdb/crdbQuerier.js +0 -6
  114. package/dist/libsql/libsqlQuerier.d.ts +0 -10
  115. package/dist/libsql/libsqlQuerier.js +0 -10
  116. package/dist/mongo/mongodbNativeDialect.d.ts +0 -9
  117. package/dist/mongo/mongodbNativeDialect.js +0 -9
  118. package/dist/mysql/mysql2Dialect.d.ts +0 -9
  119. package/dist/mysql/mysql2Dialect.js +0 -9
  120. package/dist/neon/neonDialect.d.ts +0 -10
  121. package/dist/neon/neonDialect.js +0 -10
  122. package/dist/neon/neonQuerier.d.ts +0 -5
  123. package/dist/neon/neonQuerier.js +0 -3
  124. package/dist/pglite/pgliteDialect.d.ts +0 -14
  125. package/dist/pglite/pgliteDialect.js +0 -14
  126. package/dist/postgres/abstractPgQuerier.d.ts +0 -24
  127. package/dist/postgres/abstractPgQuerier.js +0 -32
  128. package/dist/postgres/pgDialect.d.ts +0 -10
  129. package/dist/postgres/pgDialect.js +0 -10
  130. package/dist/turso/tursoQuerier.d.ts +0 -10
  131. package/dist/turso/tursoQuerier.js +0 -10
@@ -1,5 +1,6 @@
1
1
  import { dialectOptionsFrom } from '../dialect/abstractDialect.js';
2
2
  import { AbstractSharedHandleQuerierPool } from '../querier/abstractSharedHandleQuerierPool.js';
3
+ import { applySqlitePragmas } from '../sqlite/sqlitePragmas.js';
3
4
  import { TursoDialect } from './tursoDialect.js';
4
5
  import { TursoLocalQuerier } from './tursoLocalQuerier.js';
5
6
  /**
@@ -21,8 +22,7 @@ export class TursoLocalQuerierPool extends AbstractSharedHandleQuerierPool {
21
22
  const { connect } = await import('@tursodatabase/database');
22
23
  // Annotated rather than cast, so the structural contract is checked against the real driver.
23
24
  const db = await connect(this.filename, this.opts);
24
- await db.pragma('journal_mode = WAL');
25
- await db.pragma('foreign_keys = ON');
25
+ await applySqlitePragmas(db);
26
26
  return db;
27
27
  }
28
28
  buildQuerier(db) {
@@ -2,7 +2,6 @@ import type { HranaClient } from '../sqlite/hranaQuerier.js';
2
2
  import { AbstractHranaQuerierPool } from '../sqlite/hranaQuerierPool.js';
3
3
  import type { ExtraOptions } from '../type/index.js';
4
4
  import { TursoDialect } from './tursoDialect.js';
5
- import { TursoQuerier } from './tursoQuerier.js';
6
5
  /**
7
6
  * Connection settings for Turso Cloud, mirroring `@tursodatabase/serverless`.
8
7
  *
@@ -26,7 +25,7 @@ export type TursoConfig = {
26
25
  * because over plain HTTP consecutive requests need not share a connection. Compat's session-backed
27
26
  * transaction handle is the piece that makes it work.
28
27
  */
29
- export declare class TursoQuerierPool extends AbstractHranaQuerierPool<TursoQuerier, TursoDialect> {
28
+ export declare class TursoQuerierPool extends AbstractHranaQuerierPool<TursoDialect> {
30
29
  protected readonly ownsClient: boolean;
31
30
  private readonly conf;
32
31
  /**
@@ -35,5 +34,4 @@ export declare class TursoQuerierPool extends AbstractHranaQuerierPool<TursoQuer
35
34
  */
36
35
  constructor(conf: TursoConfig | HranaClient, extra?: ExtraOptions);
37
36
  protected openClient(): Promise<HranaClient>;
38
- protected buildQuerier(client: HranaClient): TursoQuerier;
39
37
  }
@@ -1,7 +1,6 @@
1
1
  import { dialectOptionsFrom } from '../dialect/abstractDialect.js';
2
2
  import { AbstractHranaQuerierPool } from '../sqlite/hranaQuerierPool.js';
3
3
  import { TursoDialect } from './tursoDialect.js';
4
- import { TursoQuerier } from './tursoQuerier.js';
5
4
  function isClient(conf) {
6
5
  return typeof conf.execute === 'function';
7
6
  }
@@ -33,7 +32,4 @@ export class TursoQuerierPool extends AbstractHranaQuerierPool {
33
32
  const { createClient } = await import('@tursodatabase/serverless/compat');
34
33
  return createClient(this.conf);
35
34
  }
36
- buildQuerier(client) {
37
- return new TursoQuerier(client, this.dialect, this.extra);
38
- }
39
35
  }
@@ -59,7 +59,7 @@ export interface DriverCapabilities {
59
59
  readonly explicitJsonCast: boolean;
60
60
  /**
61
61
  * Whether the driver natively supports JS arrays for the underlying database type.
62
- * `PgDialect` keeps this `true` for node-postgres; Bun SQL PostgreSQL uses `false` and
62
+ * `PgQuerierPool` keeps this `true` for node-postgres; `BunSqlQuerierPool` sets `false` and binds
63
63
  * `toPgArray` string literals instead.
64
64
  */
65
65
  readonly nativeArrays: boolean;
@@ -170,4 +170,4 @@ export declare function assertNonNegativeInteger(value: number, clause: string):
170
170
  */
171
171
  export declare function throwUnknownAggregateColumn(key: string, clause: string): never;
172
172
  /** {@link throwUnknownAggregateColumn} over every key of a clause, for backends that check up front. */
173
- export declare function assertAggregateColumns(clauseMap: object | undefined, emitted: ReadonlySet<string>, clause: string): void;
173
+ export declare function assertAggregateColumns(clauseMap: object, emitted: ReadonlySet<string>, clause: string): void;
@@ -418,7 +418,7 @@ export function throwUnknownAggregateColumn(key, clause) {
418
418
  }
419
419
  /** {@link throwUnknownAggregateColumn} over every key of a clause, for backends that check up front. */
420
420
  export function assertAggregateColumns(clauseMap, emitted, clause) {
421
- for (const key of getKeys(clauseMap ?? {})) {
421
+ for (const key of getKeys(clauseMap)) {
422
422
  if (!emitted.has(key)) {
423
423
  throwUnknownAggregateColumn(key, clause);
424
424
  }
@@ -54,12 +54,11 @@ export interface ErrorEmittingPool {
54
54
  on(event: 'error', listener: (err: Error) => void): unknown;
55
55
  }
56
56
  /**
57
- * Attaches an error listener to a connection pool so a dropped connection is
58
- * logged instead of left unhandled - which crashes the process for drivers
59
- * that don't guard against it themselves (node-postgres), or silently
60
- * swallowed with zero visibility for drivers that already install their own
61
- * no-op safety net (`mariadb`'s `createPool`). Always logs via a dedicated
62
- * logger (ignoring the consumer's configured log level) since a silently
63
- * swallowed pool error is exactly the failure mode this guards against.
57
+ * Attaches an error listener to a connection pool so a dropped connection is logged instead of left
58
+ * unhandled - which crashes the process for drivers that don't guard against it themselves
59
+ * (node-postgres, `mssql`), or is silently swallowed by those that install a no-op of their own
60
+ * (`mariadb`). Reported through the pool's own logger when it has one, and through the default one
61
+ * otherwise: never dropped, whatever levels were configured, since a swallowed pool error is exactly
62
+ * the failure this guards against.
64
63
  */
65
- export declare function attachPoolErrorHandler(pool: ErrorEmittingPool, message: string): void;
64
+ export declare function attachPoolErrorHandler(pool: ErrorEmittingPool, message: string, logging?: LoggingOptions): void;
@@ -7,18 +7,22 @@ const DEFAULT_LOG_LEVELS = [
7
7
  'migration',
8
8
  'skippedMigration',
9
9
  ];
10
+ /** Bound values as JSON, a `bigint` by its digits: `JSON.stringify` refuses one outright. */
11
+ function renderValues(values) {
12
+ return JSON.stringify(values, (_key, value) => (typeof value === 'bigint' ? value.toString() : value));
13
+ }
10
14
  /**
11
15
  * Default implementation of the Logger interface using console methods.
12
16
  */
13
17
  export class DefaultLogger {
14
18
  logQuery(query, values, duration) {
15
19
  const time = duration !== undefined ? ` [${duration}ms]` : '';
16
- const params = values?.length ? ` -- ${JSON.stringify(values)}` : '';
20
+ const params = values?.length ? ` -- ${renderValues(values)}` : '';
17
21
  console.log(`\x1b[36mquery:\x1b[0m ${query}${params}\x1b[32m${time}\x1b[0m`);
18
22
  }
19
23
  logSlowQuery(query, values, duration) {
20
24
  const time = duration !== undefined ? ` [${duration}ms]` : '';
21
- const params = values?.length ? ` -- ${JSON.stringify(values)}` : '';
25
+ const params = values?.length ? ` -- ${renderValues(values)}` : '';
22
26
  console.warn(`\x1b[33mslow query:\x1b[0m ${query}${params}\x1b[31m${time}\x1b[0m`);
23
27
  }
24
28
  logWarn(message) {
@@ -133,17 +137,20 @@ export class LoggerWrapper {
133
137
  }
134
138
  }
135
139
  /**
136
- * Attaches an error listener to a connection pool so a dropped connection is
137
- * logged instead of left unhandled - which crashes the process for drivers
138
- * that don't guard against it themselves (node-postgres), or silently
139
- * swallowed with zero visibility for drivers that already install their own
140
- * no-op safety net (`mariadb`'s `createPool`). Always logs via a dedicated
141
- * logger (ignoring the consumer's configured log level) since a silently
142
- * swallowed pool error is exactly the failure mode this guards against.
140
+ * Attaches an error listener to a connection pool so a dropped connection is logged instead of left
141
+ * unhandled - which crashes the process for drivers that don't guard against it themselves
142
+ * (node-postgres, `mssql`), or is silently swallowed by those that install a no-op of their own
143
+ * (`mariadb`). Reported through the pool's own logger when it has one, and through the default one
144
+ * otherwise: never dropped, whatever levels were configured, since a swallowed pool error is exactly
145
+ * the failure this guards against.
143
146
  */
144
- export function attachPoolErrorHandler(pool, message) {
145
- const logger = new LoggerWrapper(true);
147
+ export function attachPoolErrorHandler(pool, message, logging) {
148
+ const logger = new LoggerWrapper(isOwnLogger(logging) ? logging : true);
146
149
  pool.on('error', (err) => {
147
150
  logger.logError(message, err);
148
151
  });
149
152
  }
153
+ /** A logger the consumer wrote, as opposed to a switch or a level list for the default one. */
154
+ function isOwnLogger(logging) {
155
+ return typeof logging === 'function' || (typeof logging === 'object' && !Array.isArray(logging));
156
+ }
package/dist/util/raw.js CHANGED
@@ -7,11 +7,11 @@ export function raw(value, ...rest) {
7
7
  if (!rest.length) {
8
8
  // Nothing to bind, so this is the string form: keep it one, for the DDL paths that need to read
9
9
  // the expression back as text (an index expression cannot carry a parameter).
10
- return new QueryRaw(value[0] ?? '');
10
+ return new QueryRaw(value[0]);
11
11
  }
12
12
  return new QueryRaw((opts) => {
13
13
  const { ctx } = opts;
14
- ctx.append(value[0] ?? '');
14
+ ctx.append(value[0]);
15
15
  rest.forEach((interpolated, i) => {
16
16
  if (interpolated instanceof QueryRaw) {
17
17
  interpolated.render(opts);
@@ -19,7 +19,7 @@ export function raw(value, ...rest) {
19
19
  else {
20
20
  ctx.addValue(interpolated);
21
21
  }
22
- ctx.append(value[i + 1] ?? '');
22
+ ctx.append(value[i + 1]);
23
23
  });
24
24
  });
25
25
  }
@@ -33,9 +33,6 @@ const MYSQL_ESCAPES = {
33
33
  };
34
34
  const mysqlStringLiteral = (val) => `'${val.replace(MYSQL_SPECIALS, (char) => MYSQL_ESCAPES[char])}'`;
35
35
  const pad = (value, len) => String(value).padStart(len, '0');
36
- function isByteSource(val) {
37
- return (typeof Buffer !== 'undefined' && Buffer.isBuffer(val)) || val instanceof Uint8Array;
38
- }
39
36
  const HEX_BYTES = Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, '0'));
40
37
  /** Native hex encoder where available (~130x faster on 4 KB); lookup table for browsers. */
41
38
  function bytesToHexLiteral(bytes) {
@@ -72,7 +69,8 @@ function createEscaper(escapeString) {
72
69
  if (Array.isArray(value)) {
73
70
  return sqlList(value);
74
71
  }
75
- if (isByteSource(value)) {
72
+ // A Node `Buffer` is a `Uint8Array` too.
73
+ if (value instanceof Uint8Array) {
76
74
  return bytesToHexLiteral(value);
77
75
  }
78
76
  if ('toSqlString' in value && typeof value.toSqlString === 'function') {
@@ -95,11 +93,8 @@ function createEscaper(escapeString) {
95
93
  return escapeString(value);
96
94
  case 'object':
97
95
  return escapeObject(value);
98
- case 'symbol':
99
- case 'function':
100
- throw new TypeError('escapeSqlLiteral: symbol and function values are not supported; use bound parameters.');
101
96
  default:
102
- // Unreachable today; throwing keeps a future JS type from silently becoming SQL.
97
+ // A symbol or a function, or a future JS type: none of them may silently become SQL.
103
98
  throw new TypeError(`escapeSqlLiteral: unsupported value type '${typeof value}'; use bound parameters.`);
104
99
  }
105
100
  };
@@ -6,14 +6,10 @@ export function kebabCase(val) {
6
6
  return resp;
7
7
  }
8
8
  export function upperFirst(text) {
9
- if (!text)
10
- return text;
11
- return text[0].toUpperCase() + text.slice(1);
9
+ return text.charAt(0).toUpperCase() + text.slice(1);
12
10
  }
13
11
  export function lowerFirst(text) {
14
- if (!text)
15
- return text;
16
- return text[0].toLowerCase() + text.slice(1);
12
+ return text.charAt(0).toLowerCase() + text.slice(1);
17
13
  }
18
14
  export function snakeCase(val) {
19
15
  if (val === null || val === undefined)
@@ -0,0 +1,14 @@
1
+ import type { RawRow } from '../type/index.js';
2
+ /**
3
+ * A wide number as a JS number where that number is exact, and as its exact decimal text where it is
4
+ * not - past 2^53, where a number silently rounds. The one rule every driver decodes a BIGINT by, and
5
+ * hydration a numeric column a driver handed back as text: never a wrong number. `type: BigInt` is the
6
+ * declared way to a typed exact integer.
7
+ */
8
+ export declare function decodeWideNumber(value: string | bigint): number | string;
9
+ /**
10
+ * {@link decodeWideNumber} over every `bigint` cell of a row, for the drivers that hand a BIGINT back
11
+ * as one (`bun:sql` with `bigint: true`, `mariadb`). In place: the row is the driver's fresh object, and
12
+ * a copy per row cost more than the decode it carried.
13
+ */
14
+ export declare function decodeBigInts(row: RawRow): RawRow;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A wide number as a JS number where that number is exact, and as its exact decimal text where it is
3
+ * not - past 2^53, where a number silently rounds. The one rule every driver decodes a BIGINT by, and
4
+ * hydration a numeric column a driver handed back as text: never a wrong number. `type: BigInt` is the
5
+ * declared way to a typed exact integer.
6
+ */
7
+ export function decodeWideNumber(value) {
8
+ const decoded = Number(value);
9
+ return Math.abs(decoded) <= Number.MAX_SAFE_INTEGER ? decoded : String(value);
10
+ }
11
+ /**
12
+ * {@link decodeWideNumber} over every `bigint` cell of a row, for the drivers that hand a BIGINT back
13
+ * as one (`bun:sql` with `bigint: true`, `mariadb`). In place: the row is the driver's fresh object, and
14
+ * a copy per row cost more than the decode it carried.
15
+ */
16
+ export function decodeBigInts(row) {
17
+ for (const key in row) {
18
+ const value = row[key];
19
+ if (typeof value === 'bigint') {
20
+ row[key] = decodeWideNumber(value);
21
+ }
22
+ }
23
+ return row;
24
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "homepage": "https://uql-orm.dev",
4
4
  "description": "The JSON-native TypeScript ORM for Bun, Browsers, Edge, Deno, Node, Workers. Supports PostgreSQL, PGlite, MySQL, MariaDB, SQLite, CockroachDB, SQL Server, Turso, Neon, Cloudflare D1 and MongoDB. Queries are plain JSON, typed to the leaf.",
5
5
  "license": "MIT",
6
- "version": "0.54.0",
6
+ "version": "0.55.0",
7
7
  "type": "module",
8
8
  "engines": {
9
9
  "node": ">=24"
@@ -1,8 +0,0 @@
1
- import type { PoolClient } from 'pg';
2
- import { AbstractPgQuerier } from '../postgres/abstractPgQuerier.js';
3
- import type { CockroachDialect } from './cockroachDialect.js';
4
- /**
5
- * Querier for CockroachDB utilizing the standard `pg` PoolClient.
6
- */
7
- export declare class CrdbQuerier extends AbstractPgQuerier<PoolClient, CockroachDialect> {
8
- }
@@ -1,6 +0,0 @@
1
- import { AbstractPgQuerier } from '../postgres/abstractPgQuerier.js';
2
- /**
3
- * Querier for CockroachDB utilizing the standard `pg` PoolClient.
4
- */
5
- export class CrdbQuerier extends AbstractPgQuerier {
6
- }
@@ -1,10 +0,0 @@
1
- import { HranaQuerier } from '../sqlite/hranaQuerier.js';
2
- /**
3
- * Querier for the `@libsql/client` driver.
4
- *
5
- * @remarks Empty subclass by design: that client speaks the Hrana protocol, so the whole
6
- * implementation is inherited. Kept as a distinct type for `LibsqlQuerierPool` and as a hook for
7
- * future libsql-specific behavior.
8
- */
9
- export declare class LibsqlQuerier extends HranaQuerier {
10
- }
@@ -1,10 +0,0 @@
1
- import { HranaQuerier } from '../sqlite/hranaQuerier.js';
2
- /**
3
- * Querier for the `@libsql/client` driver.
4
- *
5
- * @remarks Empty subclass by design: that client speaks the Hrana protocol, so the whole
6
- * implementation is inherited. Kept as a distinct type for `LibsqlQuerierPool` and as a hook for
7
- * future libsql-specific behavior.
8
- */
9
- export class LibsqlQuerier extends HranaQuerier {
10
- }
@@ -1,9 +0,0 @@
1
- import { MongoDialect } from './mongoDialect.js';
2
- /**
3
- * MongoDB Dialect specialization for the official `mongodb` driver.
4
- *
5
- * @remarks Empty subclass by design: distinct type for `MongodbQuerierPool` and a hook
6
- * for future driver-specific behavior.
7
- */
8
- export declare class MongodbNativeDialect extends MongoDialect {
9
- }
@@ -1,9 +0,0 @@
1
- import { MongoDialect } from './mongoDialect.js';
2
- /**
3
- * MongoDB Dialect specialization for the official `mongodb` driver.
4
- *
5
- * @remarks Empty subclass by design: distinct type for `MongodbQuerierPool` and a hook
6
- * for future driver-specific behavior.
7
- */
8
- export class MongodbNativeDialect extends MongoDialect {
9
- }
@@ -1,9 +0,0 @@
1
- import { MySqlDialect } from './mysqlDialect.js';
2
- /**
3
- * MySQL Dialect specialization for the `mysql2` driver.
4
- *
5
- * @remarks Empty subclass by design: distinct type for `Mysql2QuerierPool` and a place
6
- * for future mysql2-specific query or capability overrides.
7
- */
8
- export declare class MySql2Dialect extends MySqlDialect {
9
- }
@@ -1,9 +0,0 @@
1
- import { MySqlDialect } from './mysqlDialect.js';
2
- /**
3
- * MySQL Dialect specialization for the `mysql2` driver.
4
- *
5
- * @remarks Empty subclass by design: distinct type for `Mysql2QuerierPool` and a place
6
- * for future mysql2-specific query or capability overrides.
7
- */
8
- export class MySql2Dialect extends MySqlDialect {
9
- }
@@ -1,10 +0,0 @@
1
- import { PostgresDialect } from '../postgres/postgresDialect.js';
2
- /**
3
- * Postgres dialect marker for the `@neondatabase/serverless` driver.
4
- *
5
- * @remarks Extends {@link PostgresDialect} with identical defaults (`explicitJsonCast: false`,
6
- * `nativeArrays: true`, etc.). Kept as a distinct class for `NeonQuerierPool` typing and for
7
- * Neon-only capability tweaks later without affecting `pg` or Bun pools.
8
- */
9
- export declare class NeonDialect extends PostgresDialect {
10
- }
@@ -1,10 +0,0 @@
1
- import { PostgresDialect } from '../postgres/postgresDialect.js';
2
- /**
3
- * Postgres dialect marker for the `@neondatabase/serverless` driver.
4
- *
5
- * @remarks Extends {@link PostgresDialect} with identical defaults (`explicitJsonCast: false`,
6
- * `nativeArrays: true`, etc.). Kept as a distinct class for `NeonQuerierPool` typing and for
7
- * Neon-only capability tweaks later without affecting `pg` or Bun pools.
8
- */
9
- export class NeonDialect extends PostgresDialect {
10
- }
@@ -1,5 +0,0 @@
1
- import type { PoolClient } from '@neondatabase/serverless';
2
- import { AbstractPgQuerier } from '../postgres/abstractPgQuerier.js';
3
- import type { PostgresDialect } from '../postgres/postgresDialect.js';
4
- export declare class NeonQuerier extends AbstractPgQuerier<PoolClient, PostgresDialect> {
5
- }
@@ -1,3 +0,0 @@
1
- import { AbstractPgQuerier } from '../postgres/abstractPgQuerier.js';
2
- export class NeonQuerier extends AbstractPgQuerier {
3
- }
@@ -1,14 +0,0 @@
1
- import { PostgresDialect } from '../postgres/postgresDialect.js';
2
- /**
3
- * Postgres dialect for PGlite, the WASM Postgres build.
4
- *
5
- * @remarks Keeps every {@link PostgresDialect} default, `dialectName` included: PGlite *is* Postgres,
6
- * so the introspector, schema generator and CLI must all resolve to the Postgres ones. Both driver
7
- * capabilities are inherited deliberately rather than by omission. `nativeArrays: true` holds because
8
- * PGlite registers an array serializer for every built-in array type at boot and resolves each
9
- * parameter's type from a server-side `Describe` before binding; `explicitJsonCast: false` holds
10
- * because `PgLikeSqlDialect` already emits `$n::jsonb`, which is what makes that `Describe` report
11
- * JSONB and select PGlite's `JSON.stringify` serializer. A bare `$n` would bind `[object Object]`.
12
- */
13
- export declare class PgliteDialect extends PostgresDialect {
14
- }
@@ -1,14 +0,0 @@
1
- import { PostgresDialect } from '../postgres/postgresDialect.js';
2
- /**
3
- * Postgres dialect for PGlite, the WASM Postgres build.
4
- *
5
- * @remarks Keeps every {@link PostgresDialect} default, `dialectName` included: PGlite *is* Postgres,
6
- * so the introspector, schema generator and CLI must all resolve to the Postgres ones. Both driver
7
- * capabilities are inherited deliberately rather than by omission. `nativeArrays: true` holds because
8
- * PGlite registers an array serializer for every built-in array type at boot and resolves each
9
- * parameter's type from a server-side `Describe` before binding; `explicitJsonCast: false` holds
10
- * because `PgLikeSqlDialect` already emits `$n::jsonb`, which is what makes that `Describe` report
11
- * JSONB and select PGlite's `JSON.stringify` serializer. A bare `$n` would bind `[object Object]`.
12
- */
13
- export class PgliteDialect extends PostgresDialect {
14
- }
@@ -1,24 +0,0 @@
1
- import type { AbstractSqlDialect } from '../dialect/index.js';
2
- import { AbstractPoolQuerier } from '../querier/abstractPoolQuerier.js';
3
- import type { ExtraOptions, RawRow } from '../type/index.js';
4
- export interface PgAnyClient {
5
- query(text: string, values?: unknown[]): Promise<{
6
- rows: RawRow[];
7
- rowCount: number | null;
8
- }>;
9
- query(stream: object): AsyncIterable<RawRow> & {
10
- destroy(): void;
11
- };
12
- /** Any truthy argument makes `pg-pool` evict the client instead of returning it to the idle list. */
13
- release(discard?: boolean): void | Promise<void>;
14
- }
15
- /**
16
- * Shared base class for Postgres-compatible queriers (standard pg, CockroachDB, Neon).
17
- */
18
- export declare abstract class AbstractPgQuerier<C extends PgAnyClient, D extends AbstractSqlDialect> extends AbstractPoolQuerier<C> {
19
- constructor(connect: () => Promise<C>, dialect: D, extra?: ExtraOptions);
20
- internalAll<T>(query: string, values?: unknown[]): Promise<T[]>;
21
- internalRun(query: string, values?: unknown[]): Promise<import("../type/query.js").QueryUpdateResult>;
22
- internalStream<T>(query: string, values?: unknown[]): AsyncGenerator<Awaited<T>, void, unknown>;
23
- protected releaseConn(conn: C, discard: boolean): Promise<void>;
24
- }
@@ -1,32 +0,0 @@
1
- import { AbstractPoolQuerier } from '../querier/abstractPoolQuerier.js';
2
- /**
3
- * Shared base class for Postgres-compatible queriers (standard pg, CockroachDB, Neon).
4
- */
5
- export class AbstractPgQuerier extends AbstractPoolQuerier {
6
- constructor(connect, dialect, extra) {
7
- super(dialect, connect, extra);
8
- }
9
- async internalAll(query, values) {
10
- const res = await this.getConn().query(query, values);
11
- return res.rows;
12
- }
13
- async internalRun(query, values) {
14
- const res = await this.getConn().query(query, values);
15
- return this.buildUpdateResult({ rows: res.rows, changes: res.rowCount ?? 0 });
16
- }
17
- async *internalStream(query, values) {
18
- const { default: QueryStream } = await import('pg-query-stream');
19
- const stream = this.getConn().query(new QueryStream(query, values));
20
- try {
21
- for await (const row of stream) {
22
- yield row;
23
- }
24
- }
25
- finally {
26
- stream.destroy();
27
- }
28
- }
29
- async releaseConn(conn, discard) {
30
- await conn.release(discard);
31
- }
32
- }
@@ -1,10 +0,0 @@
1
- import { PostgresDialect } from './postgresDialect.js';
2
- /**
3
- * Postgres dialect for the Node.js `pg` driver.
4
- *
5
- * @remarks Uses base {@link PostgresDialect} capabilities: native JS arrays for `ANY` / `ALL`
6
- * (`nativeArrays: true`) and `$n::jsonb` without a text re-cast. Bun SQL Postgres needs
7
- * `BunSqlQuerierPool` from `uql-orm/bunSql` instead (wire array literals + text json cast).
8
- */
9
- export declare class PgDialect extends PostgresDialect {
10
- }
@@ -1,10 +0,0 @@
1
- import { PostgresDialect } from './postgresDialect.js';
2
- /**
3
- * Postgres dialect for the Node.js `pg` driver.
4
- *
5
- * @remarks Uses base {@link PostgresDialect} capabilities: native JS arrays for `ANY` / `ALL`
6
- * (`nativeArrays: true`) and `$n::jsonb` without a text re-cast. Bun SQL Postgres needs
7
- * `BunSqlQuerierPool` from `uql-orm/bunSql` instead (wire array literals + text json cast).
8
- */
9
- export class PgDialect extends PostgresDialect {
10
- }
@@ -1,10 +0,0 @@
1
- import { HranaQuerier } from '../sqlite/hranaQuerier.js';
2
- /**
3
- * Querier for remote Turso Cloud databases over `@tursodatabase/serverless/compat`.
4
- *
5
- * @remarks Empty subclass by design: that compat client speaks the Hrana protocol, so the whole
6
- * implementation is inherited. Kept as a distinct type so `TursoQuerierPool` does not expose a
7
- * libsql-named class.
8
- */
9
- export declare class TursoQuerier extends HranaQuerier {
10
- }
@@ -1,10 +0,0 @@
1
- import { HranaQuerier } from '../sqlite/hranaQuerier.js';
2
- /**
3
- * Querier for remote Turso Cloud databases over `@tursodatabase/serverless/compat`.
4
- *
5
- * @remarks Empty subclass by design: that compat client speaks the Hrana protocol, so the whole
6
- * implementation is inherited. Kept as a distinct type so `TursoQuerierPool` does not expose a
7
- * libsql-named class.
8
- */
9
- export class TursoQuerier extends HranaQuerier {
10
- }