@nextlyhq/adapter-drizzle 0.0.2-alpha.68 → 0.0.2-alpha.69

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 (63) hide show
  1. package/dist/adapter-BypoOEEN.d.cts +1166 -0
  2. package/dist/adapter-CSP-Ek-L.d.ts +1166 -0
  3. package/dist/index-BYb6cDli.d.ts +1168 -0
  4. package/dist/index-C4HJsfwA.d.cts +1168 -0
  5. package/dist/index.cjs +2258 -2183
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +5 -10
  8. package/dist/index.d.ts +5 -10
  9. package/dist/index.mjs +2257 -2181
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/migrations.cjs +345 -146
  12. package/dist/migrations.cjs.map +1 -1
  13. package/dist/migrations.d.cts +93 -110
  14. package/dist/migrations.d.ts +93 -110
  15. package/dist/migrations.mjs +344 -144
  16. package/dist/migrations.mjs.map +1 -1
  17. package/dist/schema/index.cjs +21 -6
  18. package/dist/schema/index.cjs.map +1 -1
  19. package/dist/schema/index.d.cts +5 -116
  20. package/dist/schema/index.d.ts +5 -116
  21. package/dist/schema/index.mjs +20 -4
  22. package/dist/schema/index.mjs.map +1 -1
  23. package/dist/schema-Bkkr3JMC.d.cts +264 -0
  24. package/dist/schema-Bkkr3JMC.d.ts +264 -0
  25. package/dist/schema-name.cjs +34 -12
  26. package/dist/schema-name.cjs.map +1 -1
  27. package/dist/schema-name.d.cts +3 -15
  28. package/dist/schema-name.d.ts +3 -15
  29. package/dist/schema-name.mjs +33 -10
  30. package/dist/schema-name.mjs.map +1 -1
  31. package/dist/text-match.cjs +42 -8
  32. package/dist/text-match.cjs.map +1 -1
  33. package/dist/text-match.d.cts +4 -16
  34. package/dist/text-match.d.ts +4 -16
  35. package/dist/text-match.mjs +41 -6
  36. package/dist/text-match.mjs.map +1 -1
  37. package/dist/types/index.cjs +8 -69
  38. package/dist/types/index.d.cts +3 -225
  39. package/dist/types/index.d.ts +3 -225
  40. package/dist/types/index.mjs +1 -64
  41. package/dist/types-CNyA1oIm.cjs +185 -0
  42. package/dist/types-CNyA1oIm.cjs.map +1 -0
  43. package/dist/types-CaF_5jNk.mjs +150 -0
  44. package/dist/types-CaF_5jNk.mjs.map +1 -0
  45. package/dist/version-check.cjs +116 -133
  46. package/dist/version-check.cjs.map +1 -1
  47. package/dist/version-check.d.cts +46 -47
  48. package/dist/version-check.d.ts +46 -47
  49. package/dist/version-check.mjs +115 -131
  50. package/dist/version-check.mjs.map +1 -1
  51. package/package.json +12 -16
  52. package/dist/adapter-bUAaPzjV.d.cts +0 -1143
  53. package/dist/adapter-iJ5hbUvL.d.ts +0 -1143
  54. package/dist/core-CVO7WYDj.d.cts +0 -74
  55. package/dist/core-CVO7WYDj.d.ts +0 -74
  56. package/dist/error-BrdknH2s.d.cts +0 -122
  57. package/dist/error-BrdknH2s.d.ts +0 -122
  58. package/dist/migration-BqHebSwM.d.ts +0 -831
  59. package/dist/migration-Bu0WLdX4.d.cts +0 -831
  60. package/dist/schema-BDn8WfSL.d.cts +0 -200
  61. package/dist/schema-BIQ0YQZ_.d.ts +0 -200
  62. package/dist/types/index.cjs.map +0 -1
  63. package/dist/types/index.mjs.map +0 -1
@@ -1,69 +1,8 @@
1
- 'use strict';
2
-
3
- // src/types/query.ts
4
- var WHERE_OPERATORS = [
5
- "=",
6
- "!=",
7
- "<",
8
- ">",
9
- "<=",
10
- ">=",
11
- "IN",
12
- "NOT IN",
13
- "LIKE",
14
- "ILIKE",
15
- "IS NULL",
16
- "IS NOT NULL",
17
- "BETWEEN",
18
- "NOT BETWEEN",
19
- // Substring match on a TEXT column, with the value taken literally. Despite the name it is
20
- // not JSON containment, and it is not safe to point at a JSON column: the builder emits a
21
- // bare `LIKE` with no cast, so on PostgreSQL a `json`/`jsonb` column has no matching operator
22
- // and the statement ERRORS (`operator does not exist: jsonb ~~ text`). MySQL and SQLite
23
- // coerce, and there it searches the serialized text — which hits a key name as readily as a
24
- // value. Text columns only, and a search rather than a containment check.
25
- "CONTAINS",
26
- // CONTAINS without regard to case: a substring match on a TEXT column with the value taken
27
- // literally (`%` and `_` are characters to find, not wildcards), ignoring case on every
28
- // dialect even where the column's collation is case-sensitive. Which letters fold is the
29
- // database's `lower()` under the column's collation: the collation's Unicode version on
30
- // MySQL; non-ASCII too under a linguistic PostgreSQL collation; ASCII letters only on
31
- // SQLite and under PostgreSQL's `C` or `POSIX`.
32
- "ICONTAINS",
33
- // Declared, never implemented — the builder throws `Unsupported operator: OVERLAPS`. Kept in
34
- // the union because removing it would be a breaking change to a published type; the refusal
35
- // is pinned by a test so implementing it has to come through here.
36
- "OVERLAPS"
37
- ];
38
-
39
- // src/types/error.ts
40
- function isDatabaseError(error) {
41
- return typeof error === "object" && error !== null && "kind" in error && typeof error.kind === "string";
42
- }
43
- var APPLICATION_ERROR_BRAND = Symbol.for("nextly/NextlyError");
44
- function isApplicationError(error) {
45
- if (error === null || typeof error !== "object" && typeof error !== "function") {
46
- return false;
47
- }
48
- return error[APPLICATION_ERROR_BRAND] === true;
49
- }
50
- function createDatabaseError(options) {
51
- const error = new Error(options.message);
52
- error.name = "DatabaseError";
53
- error.kind = options.kind;
54
- if (options.code !== void 0) error.code = options.code;
55
- if (options.constraint !== void 0) error.constraint = options.constraint;
56
- if (options.table !== void 0) error.table = options.table;
57
- if (options.column !== void 0) error.column = options.column;
58
- if (options.detail !== void 0) error.detail = options.detail;
59
- if (options.hint !== void 0) error.hint = options.hint;
60
- if (options.cause !== void 0) error.cause = options.cause;
61
- return error;
62
- }
63
-
64
- exports.WHERE_OPERATORS = WHERE_OPERATORS;
65
- exports.createDatabaseError = createDatabaseError;
66
- exports.isApplicationError = isApplicationError;
67
- exports.isDatabaseError = isDatabaseError;
68
- //# sourceMappingURL=index.cjs.map
69
- //# sourceMappingURL=index.cjs.map
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_types = require("../types-CNyA1oIm.cjs");
3
+ exports.POOL_WAIT_TIMEOUT_CODE = require_types.POOL_WAIT_TIMEOUT_CODE;
4
+ exports.WHERE_OPERATORS = require_types.WHERE_OPERATORS;
5
+ exports.createDatabaseError = require_types.createDatabaseError;
6
+ exports.isApplicationError = require_types.isApplicationError;
7
+ exports.isDatabaseError = require_types.isDatabaseError;
8
+ exports.poolWaitTimeoutError = require_types.poolWaitTimeoutError;
@@ -1,225 +1,3 @@
1
- import { a as SqlParam } from '../core-CVO7WYDj.cjs';
2
- export { J as JsonArray, b as JsonObject, c as JsonValue, S as SupportedDialect, T as TableResolver } from '../core-CVO7WYDj.cjs';
3
- export { C as CountOptions, f as DatabaseCapabilities, D as DeleteOptions, I as InsertOptions, J as JoinSpec, a as Migration, c as MigrationOptions, M as MigrationRecord, d as MigrationResult, b as MigrationStatus, O as OrderBySpec, P as PoolStats, S as SelectOptions, T as TransactionContext, h as TransactionIsolationLevel, e as TransactionOptions, g as UpdateOptions, U as UpsertOptions, i as WHERE_OPERATORS, W as WhereClause, j as WhereCondition, k as WhereOperator } from '../migration-Bu0WLdX4.cjs';
4
- export { A as AlterTableOperation, a as AlterTableOptions, b as ColumnDefinition, C as CreateTableOptions, D as DropTableOptions, I as IndexDefinition, c as TableConstraint, T as TableDefinition } from '../schema-BDn8WfSL.cjs';
5
- export { a as DatabaseError, D as DatabaseErrorKind, b as DatabaseErrorOptions, c as createDatabaseError, i as isApplicationError, d as isDatabaseError } from '../error-BrdknH2s.cjs';
6
- import 'drizzle-orm';
7
-
8
- /**
9
- * Database adapter configuration type definitions.
10
- *
11
- * @packageDocumentation
12
- */
13
-
14
- /**
15
- * Logger interface for adapter operations.
16
- *
17
- * @remarks
18
- * Adapters use this interface to log queries, errors, and performance metrics.
19
- *
20
- * @public
21
- */
22
- interface AdapterLogger {
23
- /**
24
- * Log a query execution.
25
- *
26
- * @param sql - SQL statement
27
- * @param params - Query parameters
28
- * @param durationMs - Query execution time in milliseconds
29
- */
30
- query?: (sql: string, params?: SqlParam[], durationMs?: number) => void;
31
- /**
32
- * Log an error.
33
- *
34
- * @param error - Error object
35
- * @param context - Additional context about the error
36
- */
37
- error?: (error: Error, context?: Record<string, unknown>) => void;
38
- /**
39
- * Log a debug message.
40
- *
41
- * @param message - Debug message
42
- * @param context - Additional context
43
- */
44
- debug?: (message: string, context?: Record<string, unknown>) => void;
45
- /**
46
- * Log a warning.
47
- *
48
- * @param message - Warning message
49
- * @param context - Additional context
50
- */
51
- warn?: (message: string, context?: Record<string, unknown>) => void;
52
- /**
53
- * Log an info message.
54
- *
55
- * @param message - Info message
56
- * @param context - Additional context
57
- */
58
- info?: (message: string, context?: Record<string, unknown>) => void;
59
- }
60
- /**
61
- * Connection pool configuration.
62
- *
63
- * @remarks
64
- * Controls connection pooling behavior. SQLite adapters ignore these
65
- * settings as SQLite uses a single connection.
66
- *
67
- * @public
68
- */
69
- interface PoolConfig {
70
- /** Minimum number of connections in the pool */
71
- min?: number;
72
- /** Maximum number of connections in the pool */
73
- max?: number;
74
- /** Time (ms) before an idle connection is closed */
75
- idleTimeoutMs?: number;
76
- /** Time (ms) to wait for a connection before timing out */
77
- connectionTimeoutMs?: number;
78
- /** Time (ms) before considering an unused connection stale */
79
- maxLifetimeMs?: number;
80
- }
81
- /**
82
- * SSL/TLS configuration for database connections.
83
- *
84
- * @remarks
85
- * Relevant for PostgreSQL and MySQL. SQLite doesn't use network connections.
86
- *
87
- * @public
88
- */
89
- interface SslConfig {
90
- /** Reject unauthorized certificates (default: true for production) */
91
- rejectUnauthorized?: boolean;
92
- /** Path to CA certificate file */
93
- ca?: string;
94
- /** Path to client certificate file */
95
- cert?: string;
96
- /** Path to client private key file */
97
- key?: string;
98
- }
99
- /**
100
- * Base adapter configuration.
101
- *
102
- * @remarks
103
- * Common configuration options for all database adapters. Dialect-specific
104
- * adapters may extend this interface with additional options.
105
- *
106
- * @public
107
- */
108
- interface BaseAdapterConfig {
109
- /**
110
- * Database connection URL.
111
- *
112
- * @remarks
113
- * Examples:
114
- * - PostgreSQL: `postgres://user:pass@localhost:5432/dbname`
115
- * - MySQL: `mysql://user:pass@localhost:3306/dbname`
116
- * - SQLite: `file:./data/app.db` or `file::memory:`
117
- */
118
- url?: string;
119
- /** Database host (alternative to URL) */
120
- host?: string;
121
- /** Database port (alternative to URL) */
122
- port?: number;
123
- /** Database name (alternative to URL) */
124
- database?: string;
125
- /** Database user (alternative to URL) */
126
- user?: string;
127
- /** Database password (alternative to URL) */
128
- password?: string;
129
- /** Connection pool configuration */
130
- pool?: PoolConfig;
131
- /** Logger instance for queries and errors */
132
- logger?: AdapterLogger;
133
- /**
134
- * Schema name (PostgreSQL only).
135
- *
136
- * Applied as `search_path` in the pool's startup options, which is the
137
- * pooled-safe way to set it: a `SET search_path` issued as a query belongs
138
- * to whichever pooled connection happened to run it, so the next checkout
139
- * would see the default again.
140
- *
141
- * The adapter creates the schema if it is missing, because `search_path`
142
- * naming a schema that does not exist does not fail — it falls through, and
143
- * the tables land somewhere else.
144
- *
145
- * Declared here since the first release and read by nothing until now, which
146
- * is why setting it appeared to work and changed nothing.
147
- */
148
- schema?: string;
149
- /** SSL/TLS configuration */
150
- ssl?: SslConfig | boolean;
151
- /**
152
- * Default query timeout in milliseconds.
153
- *
154
- * @remarks
155
- * Queries exceeding this limit will be aborted and throw a DatabaseError
156
- * with kind 'timeout'. This prevents runaway queries from blocking the
157
- * system indefinitely.
158
- *
159
- * Can be overridden per-transaction via TransactionOptions.timeoutMs.
160
- *
161
- * Set to 0 or undefined to disable timeout (not recommended for production).
162
- *
163
- * @default 15000 (15 seconds)
164
- *
165
- * @example
166
- * ```typescript
167
- * const adapter = createPostgresAdapter({
168
- * url: 'postgres://localhost/mydb',
169
- * queryTimeoutMs: 30000, // 30 seconds
170
- * });
171
- * ```
172
- */
173
- queryTimeoutMs?: number;
174
- /** Additional connection options (driver-specific) */
175
- options?: Record<string, unknown>;
176
- }
177
- /**
178
- * PostgreSQL-specific adapter configuration.
179
- *
180
- * @public
181
- */
182
- interface PostgresAdapterConfig extends BaseAdapterConfig {
183
- /** Application name for connection tracking */
184
- applicationName?: string;
185
- /** Statement timeout in milliseconds */
186
- statementTimeout?: number;
187
- /** Query timeout in milliseconds */
188
- queryTimeout?: number;
189
- /** Enable prepared statements (default: true) */
190
- preparedStatements?: boolean;
191
- }
192
- /**
193
- * MySQL-specific adapter configuration.
194
- *
195
- * @public
196
- */
197
- interface MySqlAdapterConfig extends BaseAdapterConfig {
198
- /** Character set (default: utf8mb4) */
199
- charset?: string;
200
- /** Timezone (default: 'local') */
201
- timezone?: string;
202
- /** Enable multiple statements per query (default: false, security risk) */
203
- multipleStatements?: boolean;
204
- /** Date strings instead of Date objects (default: false) */
205
- dateStrings?: boolean;
206
- }
207
- /**
208
- * SQLite-specific adapter configuration.
209
- *
210
- * @public
211
- */
212
- interface SqliteAdapterConfig extends BaseAdapterConfig {
213
- /** Enable WAL mode (default: true) */
214
- wal?: boolean;
215
- /** Busy timeout in milliseconds (default: 5000) */
216
- busyTimeout?: number;
217
- /** Enable foreign keys (default: true) */
218
- foreignKeys?: boolean;
219
- /** Memory-only database (overrides url) */
220
- memory?: boolean;
221
- /** Read-only mode (default: false) */
222
- readonly?: boolean;
223
- }
224
-
225
- export { type AdapterLogger, type BaseAdapterConfig, type MySqlAdapterConfig, type PoolConfig, type PostgresAdapterConfig, SqlParam, type SqliteAdapterConfig, type SslConfig };
1
+ import { a as DropTableOptions, c as TableDefinition, d as JsonValue, f as SqlParam, i as CreateTableOptions, l as JsonArray, m as TableResolver, n as AlterTableOptions, o as IndexDefinition, p as SupportedDialect, r as ColumnDefinition, s as TableConstraint, t as AlterTableOperation, u as JsonObject } from "../schema-Bkkr3JMC.cjs";
2
+ import { A as UpdateOptions, C as TransactionContext, D as DeleteOptions, E as CountOptions, F as WhereClause, I as WhereCondition, L as WhereOperator, M as JoinSpec, N as OrderBySpec, O as InsertOptions, P as WHERE_OPERATORS, S as PoolStats, T as TransactionOptions, _ as MigrationOptions, a as PostgresAdapterConfig, b as MigrationStatus, c as DatabaseError, d as POOL_WAIT_TIMEOUT_CODE, f as createDatabaseError, g as Migration, h as poolWaitTimeoutError, i as PoolConfig, j as UpsertOptions, k as SelectOptions, l as DatabaseErrorKind, m as isDatabaseError, n as BaseAdapterConfig, o as SqliteAdapterConfig, p as isApplicationError, r as MySqlAdapterConfig, s as SslConfig, t as AdapterLogger, u as DatabaseErrorOptions, v as MigrationRecord, w as TransactionIsolationLevel, x as DatabaseCapabilities, y as MigrationResult } from "../index-C4HJsfwA.cjs";
3
+ export { type AdapterLogger, type AlterTableOperation, type AlterTableOptions, type BaseAdapterConfig, type ColumnDefinition, type CountOptions, type CreateTableOptions, type DatabaseCapabilities, type DatabaseError, type DatabaseErrorKind, type DatabaseErrorOptions, type DeleteOptions, type DropTableOptions, type IndexDefinition, type InsertOptions, type JoinSpec, type JsonArray, type JsonObject, type JsonValue, type Migration, type MigrationOptions, type MigrationRecord, type MigrationResult, type MigrationStatus, type MySqlAdapterConfig, type OrderBySpec, POOL_WAIT_TIMEOUT_CODE, type PoolConfig, type PoolStats, type PostgresAdapterConfig, type SelectOptions, type SqlParam, type SqliteAdapterConfig, type SslConfig, type SupportedDialect, type TableConstraint, type TableDefinition, type TableResolver, type TransactionContext, type TransactionIsolationLevel, type TransactionOptions, type UpdateOptions, type UpsertOptions, WHERE_OPERATORS, type WhereClause, type WhereCondition, type WhereOperator, createDatabaseError, isApplicationError, isDatabaseError, poolWaitTimeoutError };
@@ -1,225 +1,3 @@
1
- import { a as SqlParam } from '../core-CVO7WYDj.js';
2
- export { J as JsonArray, b as JsonObject, c as JsonValue, S as SupportedDialect, T as TableResolver } from '../core-CVO7WYDj.js';
3
- export { C as CountOptions, f as DatabaseCapabilities, D as DeleteOptions, I as InsertOptions, J as JoinSpec, a as Migration, c as MigrationOptions, M as MigrationRecord, d as MigrationResult, b as MigrationStatus, O as OrderBySpec, P as PoolStats, S as SelectOptions, T as TransactionContext, h as TransactionIsolationLevel, e as TransactionOptions, g as UpdateOptions, U as UpsertOptions, i as WHERE_OPERATORS, W as WhereClause, j as WhereCondition, k as WhereOperator } from '../migration-BqHebSwM.js';
4
- export { A as AlterTableOperation, a as AlterTableOptions, b as ColumnDefinition, C as CreateTableOptions, D as DropTableOptions, I as IndexDefinition, c as TableConstraint, T as TableDefinition } from '../schema-BIQ0YQZ_.js';
5
- export { a as DatabaseError, D as DatabaseErrorKind, b as DatabaseErrorOptions, c as createDatabaseError, i as isApplicationError, d as isDatabaseError } from '../error-BrdknH2s.js';
6
- import 'drizzle-orm';
7
-
8
- /**
9
- * Database adapter configuration type definitions.
10
- *
11
- * @packageDocumentation
12
- */
13
-
14
- /**
15
- * Logger interface for adapter operations.
16
- *
17
- * @remarks
18
- * Adapters use this interface to log queries, errors, and performance metrics.
19
- *
20
- * @public
21
- */
22
- interface AdapterLogger {
23
- /**
24
- * Log a query execution.
25
- *
26
- * @param sql - SQL statement
27
- * @param params - Query parameters
28
- * @param durationMs - Query execution time in milliseconds
29
- */
30
- query?: (sql: string, params?: SqlParam[], durationMs?: number) => void;
31
- /**
32
- * Log an error.
33
- *
34
- * @param error - Error object
35
- * @param context - Additional context about the error
36
- */
37
- error?: (error: Error, context?: Record<string, unknown>) => void;
38
- /**
39
- * Log a debug message.
40
- *
41
- * @param message - Debug message
42
- * @param context - Additional context
43
- */
44
- debug?: (message: string, context?: Record<string, unknown>) => void;
45
- /**
46
- * Log a warning.
47
- *
48
- * @param message - Warning message
49
- * @param context - Additional context
50
- */
51
- warn?: (message: string, context?: Record<string, unknown>) => void;
52
- /**
53
- * Log an info message.
54
- *
55
- * @param message - Info message
56
- * @param context - Additional context
57
- */
58
- info?: (message: string, context?: Record<string, unknown>) => void;
59
- }
60
- /**
61
- * Connection pool configuration.
62
- *
63
- * @remarks
64
- * Controls connection pooling behavior. SQLite adapters ignore these
65
- * settings as SQLite uses a single connection.
66
- *
67
- * @public
68
- */
69
- interface PoolConfig {
70
- /** Minimum number of connections in the pool */
71
- min?: number;
72
- /** Maximum number of connections in the pool */
73
- max?: number;
74
- /** Time (ms) before an idle connection is closed */
75
- idleTimeoutMs?: number;
76
- /** Time (ms) to wait for a connection before timing out */
77
- connectionTimeoutMs?: number;
78
- /** Time (ms) before considering an unused connection stale */
79
- maxLifetimeMs?: number;
80
- }
81
- /**
82
- * SSL/TLS configuration for database connections.
83
- *
84
- * @remarks
85
- * Relevant for PostgreSQL and MySQL. SQLite doesn't use network connections.
86
- *
87
- * @public
88
- */
89
- interface SslConfig {
90
- /** Reject unauthorized certificates (default: true for production) */
91
- rejectUnauthorized?: boolean;
92
- /** Path to CA certificate file */
93
- ca?: string;
94
- /** Path to client certificate file */
95
- cert?: string;
96
- /** Path to client private key file */
97
- key?: string;
98
- }
99
- /**
100
- * Base adapter configuration.
101
- *
102
- * @remarks
103
- * Common configuration options for all database adapters. Dialect-specific
104
- * adapters may extend this interface with additional options.
105
- *
106
- * @public
107
- */
108
- interface BaseAdapterConfig {
109
- /**
110
- * Database connection URL.
111
- *
112
- * @remarks
113
- * Examples:
114
- * - PostgreSQL: `postgres://user:pass@localhost:5432/dbname`
115
- * - MySQL: `mysql://user:pass@localhost:3306/dbname`
116
- * - SQLite: `file:./data/app.db` or `file::memory:`
117
- */
118
- url?: string;
119
- /** Database host (alternative to URL) */
120
- host?: string;
121
- /** Database port (alternative to URL) */
122
- port?: number;
123
- /** Database name (alternative to URL) */
124
- database?: string;
125
- /** Database user (alternative to URL) */
126
- user?: string;
127
- /** Database password (alternative to URL) */
128
- password?: string;
129
- /** Connection pool configuration */
130
- pool?: PoolConfig;
131
- /** Logger instance for queries and errors */
132
- logger?: AdapterLogger;
133
- /**
134
- * Schema name (PostgreSQL only).
135
- *
136
- * Applied as `search_path` in the pool's startup options, which is the
137
- * pooled-safe way to set it: a `SET search_path` issued as a query belongs
138
- * to whichever pooled connection happened to run it, so the next checkout
139
- * would see the default again.
140
- *
141
- * The adapter creates the schema if it is missing, because `search_path`
142
- * naming a schema that does not exist does not fail — it falls through, and
143
- * the tables land somewhere else.
144
- *
145
- * Declared here since the first release and read by nothing until now, which
146
- * is why setting it appeared to work and changed nothing.
147
- */
148
- schema?: string;
149
- /** SSL/TLS configuration */
150
- ssl?: SslConfig | boolean;
151
- /**
152
- * Default query timeout in milliseconds.
153
- *
154
- * @remarks
155
- * Queries exceeding this limit will be aborted and throw a DatabaseError
156
- * with kind 'timeout'. This prevents runaway queries from blocking the
157
- * system indefinitely.
158
- *
159
- * Can be overridden per-transaction via TransactionOptions.timeoutMs.
160
- *
161
- * Set to 0 or undefined to disable timeout (not recommended for production).
162
- *
163
- * @default 15000 (15 seconds)
164
- *
165
- * @example
166
- * ```typescript
167
- * const adapter = createPostgresAdapter({
168
- * url: 'postgres://localhost/mydb',
169
- * queryTimeoutMs: 30000, // 30 seconds
170
- * });
171
- * ```
172
- */
173
- queryTimeoutMs?: number;
174
- /** Additional connection options (driver-specific) */
175
- options?: Record<string, unknown>;
176
- }
177
- /**
178
- * PostgreSQL-specific adapter configuration.
179
- *
180
- * @public
181
- */
182
- interface PostgresAdapterConfig extends BaseAdapterConfig {
183
- /** Application name for connection tracking */
184
- applicationName?: string;
185
- /** Statement timeout in milliseconds */
186
- statementTimeout?: number;
187
- /** Query timeout in milliseconds */
188
- queryTimeout?: number;
189
- /** Enable prepared statements (default: true) */
190
- preparedStatements?: boolean;
191
- }
192
- /**
193
- * MySQL-specific adapter configuration.
194
- *
195
- * @public
196
- */
197
- interface MySqlAdapterConfig extends BaseAdapterConfig {
198
- /** Character set (default: utf8mb4) */
199
- charset?: string;
200
- /** Timezone (default: 'local') */
201
- timezone?: string;
202
- /** Enable multiple statements per query (default: false, security risk) */
203
- multipleStatements?: boolean;
204
- /** Date strings instead of Date objects (default: false) */
205
- dateStrings?: boolean;
206
- }
207
- /**
208
- * SQLite-specific adapter configuration.
209
- *
210
- * @public
211
- */
212
- interface SqliteAdapterConfig extends BaseAdapterConfig {
213
- /** Enable WAL mode (default: true) */
214
- wal?: boolean;
215
- /** Busy timeout in milliseconds (default: 5000) */
216
- busyTimeout?: number;
217
- /** Enable foreign keys (default: true) */
218
- foreignKeys?: boolean;
219
- /** Memory-only database (overrides url) */
220
- memory?: boolean;
221
- /** Read-only mode (default: false) */
222
- readonly?: boolean;
223
- }
224
-
225
- export { type AdapterLogger, type BaseAdapterConfig, type MySqlAdapterConfig, type PoolConfig, type PostgresAdapterConfig, SqlParam, type SqliteAdapterConfig, type SslConfig };
1
+ import { a as DropTableOptions, c as TableDefinition, d as JsonValue, f as SqlParam, i as CreateTableOptions, l as JsonArray, m as TableResolver, n as AlterTableOptions, o as IndexDefinition, p as SupportedDialect, r as ColumnDefinition, s as TableConstraint, t as AlterTableOperation, u as JsonObject } from "../schema-Bkkr3JMC.js";
2
+ import { A as UpdateOptions, C as TransactionContext, D as DeleteOptions, E as CountOptions, F as WhereClause, I as WhereCondition, L as WhereOperator, M as JoinSpec, N as OrderBySpec, O as InsertOptions, P as WHERE_OPERATORS, S as PoolStats, T as TransactionOptions, _ as MigrationOptions, a as PostgresAdapterConfig, b as MigrationStatus, c as DatabaseError, d as POOL_WAIT_TIMEOUT_CODE, f as createDatabaseError, g as Migration, h as poolWaitTimeoutError, i as PoolConfig, j as UpsertOptions, k as SelectOptions, l as DatabaseErrorKind, m as isDatabaseError, n as BaseAdapterConfig, o as SqliteAdapterConfig, p as isApplicationError, r as MySqlAdapterConfig, s as SslConfig, t as AdapterLogger, u as DatabaseErrorOptions, v as MigrationRecord, w as TransactionIsolationLevel, x as DatabaseCapabilities, y as MigrationResult } from "../index-BYb6cDli.js";
3
+ export { type AdapterLogger, type AlterTableOperation, type AlterTableOptions, type BaseAdapterConfig, type ColumnDefinition, type CountOptions, type CreateTableOptions, type DatabaseCapabilities, type DatabaseError, type DatabaseErrorKind, type DatabaseErrorOptions, type DeleteOptions, type DropTableOptions, type IndexDefinition, type InsertOptions, type JoinSpec, type JsonArray, type JsonObject, type JsonValue, type Migration, type MigrationOptions, type MigrationRecord, type MigrationResult, type MigrationStatus, type MySqlAdapterConfig, type OrderBySpec, POOL_WAIT_TIMEOUT_CODE, type PoolConfig, type PoolStats, type PostgresAdapterConfig, type SelectOptions, type SqlParam, type SqliteAdapterConfig, type SslConfig, type SupportedDialect, type TableConstraint, type TableDefinition, type TableResolver, type TransactionContext, type TransactionIsolationLevel, type TransactionOptions, type UpdateOptions, type UpsertOptions, WHERE_OPERATORS, type WhereClause, type WhereCondition, type WhereOperator, createDatabaseError, isApplicationError, isDatabaseError, poolWaitTimeoutError };
@@ -1,64 +1 @@
1
- // src/types/query.ts
2
- var WHERE_OPERATORS = [
3
- "=",
4
- "!=",
5
- "<",
6
- ">",
7
- "<=",
8
- ">=",
9
- "IN",
10
- "NOT IN",
11
- "LIKE",
12
- "ILIKE",
13
- "IS NULL",
14
- "IS NOT NULL",
15
- "BETWEEN",
16
- "NOT BETWEEN",
17
- // Substring match on a TEXT column, with the value taken literally. Despite the name it is
18
- // not JSON containment, and it is not safe to point at a JSON column: the builder emits a
19
- // bare `LIKE` with no cast, so on PostgreSQL a `json`/`jsonb` column has no matching operator
20
- // and the statement ERRORS (`operator does not exist: jsonb ~~ text`). MySQL and SQLite
21
- // coerce, and there it searches the serialized text — which hits a key name as readily as a
22
- // value. Text columns only, and a search rather than a containment check.
23
- "CONTAINS",
24
- // CONTAINS without regard to case: a substring match on a TEXT column with the value taken
25
- // literally (`%` and `_` are characters to find, not wildcards), ignoring case on every
26
- // dialect even where the column's collation is case-sensitive. Which letters fold is the
27
- // database's `lower()` under the column's collation: the collation's Unicode version on
28
- // MySQL; non-ASCII too under a linguistic PostgreSQL collation; ASCII letters only on
29
- // SQLite and under PostgreSQL's `C` or `POSIX`.
30
- "ICONTAINS",
31
- // Declared, never implemented — the builder throws `Unsupported operator: OVERLAPS`. Kept in
32
- // the union because removing it would be a breaking change to a published type; the refusal
33
- // is pinned by a test so implementing it has to come through here.
34
- "OVERLAPS"
35
- ];
36
-
37
- // src/types/error.ts
38
- function isDatabaseError(error) {
39
- return typeof error === "object" && error !== null && "kind" in error && typeof error.kind === "string";
40
- }
41
- var APPLICATION_ERROR_BRAND = Symbol.for("nextly/NextlyError");
42
- function isApplicationError(error) {
43
- if (error === null || typeof error !== "object" && typeof error !== "function") {
44
- return false;
45
- }
46
- return error[APPLICATION_ERROR_BRAND] === true;
47
- }
48
- function createDatabaseError(options) {
49
- const error = new Error(options.message);
50
- error.name = "DatabaseError";
51
- error.kind = options.kind;
52
- if (options.code !== void 0) error.code = options.code;
53
- if (options.constraint !== void 0) error.constraint = options.constraint;
54
- if (options.table !== void 0) error.table = options.table;
55
- if (options.column !== void 0) error.column = options.column;
56
- if (options.detail !== void 0) error.detail = options.detail;
57
- if (options.hint !== void 0) error.hint = options.hint;
58
- if (options.cause !== void 0) error.cause = options.cause;
59
- return error;
60
- }
61
-
62
- export { WHERE_OPERATORS, createDatabaseError, isApplicationError, isDatabaseError };
63
- //# sourceMappingURL=index.mjs.map
64
- //# sourceMappingURL=index.mjs.map
1
+ export { t as POOL_WAIT_TIMEOUT_CODE, o as WHERE_OPERATORS, n as createDatabaseError, r as isApplicationError, i as isDatabaseError, a as poolWaitTimeoutError } from "../types-CaF_5jNk.mjs";