@happyvertical/sql 0.102.2 → 0.102.4
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/AGENT.md +1 -1
- package/README.md +99 -4
- package/dist/chunks/{duckdb-DfikVgov.js → duckdb-LMyfKZGi.js} +3 -3
- package/dist/chunks/{duckdb-DfikVgov.js.map → duckdb-LMyfKZGi.js.map} +1 -1
- package/dist/chunks/postgres-dialect-Bfswr4Vs.js +2728 -0
- package/dist/chunks/postgres-dialect-Bfswr4Vs.js.map +1 -0
- package/dist/chunks/{sqlite-Cz2NMiDs.js → sqlite-0PMv1va2.js} +5 -5
- package/dist/chunks/{sqlite-Cz2NMiDs.js.map → sqlite-0PMv1va2.js.map} +1 -1
- package/dist/chunks/{sqlite-connection-cache-BAakj2HO.js → sqlite-connection-cache-ChWav9iY.js} +2 -2
- package/dist/chunks/{sqlite-connection-cache-BAakj2HO.js.map → sqlite-connection-cache-ChWav9iY.js.map} +1 -1
- package/dist/chunks/{sqlite-native-ByGwGEbS.js → sqlite-native--z4BnolL.js} +4 -4
- package/dist/chunks/{sqlite-native-ByGwGEbS.js.map → sqlite-native--z4BnolL.js.map} +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +163 -1365
- package/dist/index.js.map +1 -1
- package/dist/pglite.d.ts +150 -0
- package/dist/pglite.d.ts.map +1 -0
- package/dist/pglite.js +339 -0
- package/dist/pglite.js.map +1 -0
- package/dist/postgres.d.ts.map +1 -1
- package/dist/shared/postgres-dialect.d.ts +153 -0
- package/dist/shared/postgres-dialect.d.ts.map +1 -0
- package/dist/shared/types.d.ts +4 -4
- package/metadata.json +1 -0
- package/package.json +13 -2
- package/dist/chunks/connection-cache-Da5UcY5u.js +0 -1305
- package/dist/chunks/connection-cache-Da5UcY5u.js.map +0 -1
- package/dist/chunks/types-CwWJ-yju.js +0 -139
- package/dist/chunks/types-CwWJ-yju.js.map +0 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PostgreSQL dialect logic shared by every adapter that speaks to a Postgres
|
|
3
|
+
* server: the `pg` adapter (`../postgres`) and the PGlite adapter
|
|
4
|
+
* (`../pglite`).
|
|
5
|
+
*
|
|
6
|
+
* Everything here runs on a {@link PostgresQueryExecutor}, so the SQL the two
|
|
7
|
+
* adapters emit is the same code rather than two copies that drift. The module
|
|
8
|
+
* must stay browser-safe: no `node:` built-ins and no import of `pg`, because
|
|
9
|
+
* the PGlite adapter's import graph reaches it.
|
|
10
|
+
*/
|
|
11
|
+
import type { QueryResult as BaseQueryResult, ColumnDefinitionWithName, DatabaseInterface, IndexDefinition, TableInterface, TableSchemaInfo, UpsertOptions, VectorCapabilities } from "./types.js";
|
|
12
|
+
/** The one method every statement runs through. */
|
|
13
|
+
export type PostgresQueryExecutor = {
|
|
14
|
+
query: (sql: string, values?: any[]) => Promise<{
|
|
15
|
+
rows: any[];
|
|
16
|
+
rowCount: number | null;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
export declare function normalizePostgresRawQuery(sql: string, values: any[]): {
|
|
20
|
+
sql: string;
|
|
21
|
+
values: any[];
|
|
22
|
+
};
|
|
23
|
+
export declare function createVectorCapabilities(pool: PostgresQueryExecutor): VectorCapabilities;
|
|
24
|
+
/**
|
|
25
|
+
* Keeps the first PostgreSQL statement failure attached to a transaction.
|
|
26
|
+
*
|
|
27
|
+
* PostgreSQL reports every later statement in an aborted transaction as
|
|
28
|
+
* 25P02. Replacing the first failure with that generic state error hides the
|
|
29
|
+
* actionable code and diagnostics from callers, so the tracker rethrows the
|
|
30
|
+
* first failure whenever PostgreSQL reports 25P02, and exposes the recorded
|
|
31
|
+
* failure so a swallowed statement error cannot make COMMIT's implicit
|
|
32
|
+
* rollback look successful: PostgreSQL answers COMMIT on an aborted
|
|
33
|
+
* transaction with a ROLLBACK tag and no error.
|
|
34
|
+
*
|
|
35
|
+
* @param isStatementError - Recognizes the driver's server-reported error
|
|
36
|
+
* class (`pg`'s or PGlite's `DatabaseError`). Anything else is an
|
|
37
|
+
* unconfirmed failure — it may be the transport, not the statement.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createTransactionErrorTracker(isStatementError: (error: unknown) => boolean): {
|
|
40
|
+
pending: Set<Promise<unknown>>;
|
|
41
|
+
preserve: (error: unknown) => unknown;
|
|
42
|
+
confirm: (query: unknown) => void;
|
|
43
|
+
track: <T>(operation: Promise<T>, query: unknown) => Promise<T>;
|
|
44
|
+
clearError: () => void;
|
|
45
|
+
drain: () => Promise<void>;
|
|
46
|
+
getError: () => unknown;
|
|
47
|
+
getUnconfirmedError: () => unknown;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* What an adapter supplies to the shared dialect.
|
|
51
|
+
*/
|
|
52
|
+
export interface PostgresDialectHost {
|
|
53
|
+
/** Executor for statements outside any transaction. */
|
|
54
|
+
client: PostgresQueryExecutor;
|
|
55
|
+
/**
|
|
56
|
+
* Runs `work` inside a short transaction of its own. Used by a null-aware
|
|
57
|
+
* upsert issued outside a transaction, which needs its advisory lock and the
|
|
58
|
+
* following update/insert to share one.
|
|
59
|
+
*/
|
|
60
|
+
runInTransaction<T>(work: (executor: PostgresQueryExecutor) => Promise<T>): Promise<T>;
|
|
61
|
+
/**
|
|
62
|
+
* Executor for read-only catalog probes (server version, index flags).
|
|
63
|
+
*
|
|
64
|
+
* A pooled adapter answers with the pool, so a failing probe cannot abort the
|
|
65
|
+
* caller's transaction. A single-connection adapter has no second connection
|
|
66
|
+
* and must answer with the executor it was handed.
|
|
67
|
+
*/
|
|
68
|
+
probeExecutor(executor: PostgresQueryExecutor): PostgresQueryExecutor;
|
|
69
|
+
}
|
|
70
|
+
/** One level of nested-transaction queueing. */
|
|
71
|
+
export interface NestedScope {
|
|
72
|
+
tail: Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Ambient scope tracking for nested transactions.
|
|
76
|
+
*
|
|
77
|
+
* With one, a nested callback may call the *outer* transaction handle and still
|
|
78
|
+
* be queued under its own scope (the `pg` adapter uses `AsyncLocalStorage`).
|
|
79
|
+
* Without one (browsers have no `AsyncLocalStorage`), each nested callback is
|
|
80
|
+
* handed a handle bound to its own scope instead, so nested work must use the
|
|
81
|
+
* handle it is given.
|
|
82
|
+
*/
|
|
83
|
+
export interface NestedScopeContext {
|
|
84
|
+
getStore(): NestedScope | undefined;
|
|
85
|
+
run<R>(scope: NestedScope, fn: () => R): R;
|
|
86
|
+
}
|
|
87
|
+
export type NestedTransaction = (<T>(callback: (tx: DatabaseInterface) => Promise<T>) => Promise<T>) & {
|
|
88
|
+
drain: () => Promise<void>;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Creates the dialect: every statement-level method plus nested-transaction
|
|
92
|
+
* and schema-introspection builders, all bound to `host`.
|
|
93
|
+
*/
|
|
94
|
+
export declare function createPostgresDialect(host: PostgresDialectHost): {
|
|
95
|
+
serializeRecord: (record: Record<string, any>) => Record<string, any>;
|
|
96
|
+
createClientMethods: (executor: PostgresQueryExecutor, inTransaction: boolean, serialize: (record: Record<string, any>) => Record<string, any>, clearTransactionError?: () => void) => {
|
|
97
|
+
insert: (table: string, data: Record<string, any> | Record<string, any>[]) => Promise<BaseQueryResult>;
|
|
98
|
+
get: (table: string, where: Record<string, any>) => Promise<Record<string, any> | null>;
|
|
99
|
+
list: (table: string, where: Record<string, any>) => Promise<Record<string, any>[]>;
|
|
100
|
+
update: (table: string, where: Record<string, any>, data: Record<string, any>) => Promise<BaseQueryResult>;
|
|
101
|
+
upsert: (table: string, conflictColumns: string[], data: Record<string, any>, options?: UpsertOptions) => Promise<BaseQueryResult>;
|
|
102
|
+
getOrInsert: (table: string, where: Record<string, any>, data: Record<string, any>) => Promise<Record<string, any>>;
|
|
103
|
+
delete: (table: string, where: Record<string, any>) => Promise<BaseQueryResult>;
|
|
104
|
+
count: (table: string, where?: Record<string, any>) => Promise<number>;
|
|
105
|
+
table: (tableName: string) => TableInterface;
|
|
106
|
+
many: (strings: TemplateStringsArray, ...vars: any[]) => Promise<Record<string, any>[]>;
|
|
107
|
+
single: (strings: TemplateStringsArray, ...vars: any[]) => Promise<Record<string, any> | null>;
|
|
108
|
+
pluck: (strings: TemplateStringsArray, ...vars: any[]) => Promise<any>;
|
|
109
|
+
execute: (strings: TemplateStringsArray, ...vars: any[]) => Promise<void>;
|
|
110
|
+
query: (sql: string, ...values: any[]) => Promise<{
|
|
111
|
+
rows: Record<string, any>[];
|
|
112
|
+
rowCount: number;
|
|
113
|
+
}>;
|
|
114
|
+
oo: (strings: TemplateStringsArray, ...vars: any[]) => Promise<Record<string, any>[]>;
|
|
115
|
+
oO: (strings: TemplateStringsArray, ...vars: any[]) => Promise<Record<string, any> | null>;
|
|
116
|
+
ox: (strings: TemplateStringsArray, ...vars: any[]) => Promise<any>;
|
|
117
|
+
xx: (strings: TemplateStringsArray, ...vars: any[]) => Promise<void>;
|
|
118
|
+
tableExists: (tableName: string) => Promise<boolean>;
|
|
119
|
+
syncSchema: (schema: string) => Promise<void>;
|
|
120
|
+
};
|
|
121
|
+
createNestedTransaction: (executor: PostgresQueryExecutor, scopeFor: (override?: NestedTransaction) => DatabaseInterface, clearTransactionError: () => void, scopes?: NestedScopeContext) => NestedTransaction;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Builds `getTableSchema` on top of a dialect's statement methods.
|
|
125
|
+
*/
|
|
126
|
+
export declare function createGetTableSchema(methods: {
|
|
127
|
+
many: (strings: TemplateStringsArray, ...vars: any[]) => Promise<Record<string, any>[]>;
|
|
128
|
+
tableExists: (tableName: string) => Promise<boolean>;
|
|
129
|
+
}): (table: string) => Promise<TableSchemaInfo | null>;
|
|
130
|
+
/**
|
|
131
|
+
* Builds the `alterTable` operations on top of a statement executor.
|
|
132
|
+
*/
|
|
133
|
+
export declare function createAlterTable(client: PostgresQueryExecutor): {
|
|
134
|
+
/**
|
|
135
|
+
* Adds a new column to an existing table
|
|
136
|
+
*
|
|
137
|
+
* @param table - Table name
|
|
138
|
+
* @param column - Column definition with name
|
|
139
|
+
* @returns Promise that resolves when column is added
|
|
140
|
+
* @throws Error if the alter operation fails
|
|
141
|
+
*/
|
|
142
|
+
addColumn: (table: string, column: ColumnDefinitionWithName) => Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Adds a new index to an existing table
|
|
145
|
+
*
|
|
146
|
+
* @param table - Table name
|
|
147
|
+
* @param index - Index definition
|
|
148
|
+
* @returns Promise that resolves when index is created
|
|
149
|
+
* @throws Error if the create index operation fails
|
|
150
|
+
*/
|
|
151
|
+
addIndex: (table: string, index: IndexDefinition) => Promise<void>;
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=postgres-dialect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-dialect.d.ts","sourceRoot":"","sources":["../../src/shared/postgres-dialect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAE9B,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACb,kBAAkB,EAInB,MAAM,YAAS,CAAC;AAQjB,mDAAmD;AACnD,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,GAAG,EAAE,KACX,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CACxD,CAAC;AA2MF,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,GAAG,EAAE,GACZ;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,EAAE,CAAA;CAAE,CAqBhC;AAgED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,qBA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AS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACtD,WAUU,MAAM,KACZ,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAgKnC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,qBAAqB;IAE1D;;;;;;;OAOG;uBAEM,MAAM,UACL,wBAAwB,KAC/B,OAAO,CAAC,IAAI,CAAC;IAiBhB;;;;;;;OAOG;sBACqB,MAAM,SAAS,eAAe,KAAG,OAAO,CAAC,IAAI,CAAC;EAqBzE"}
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -93,7 +93,7 @@ export interface DatabaseOptions extends DatabaseCacheOptions {
|
|
|
93
93
|
* How long a queued transaction waits for the connection, in milliseconds.
|
|
94
94
|
*
|
|
95
95
|
* Applies to the single-connection adapters — SQLite (both the LibSQL and
|
|
96
|
-
* native paths), DuckDB and
|
|
96
|
+
* native paths), DuckDB, JSON and PGlite. Those drive one connection, so transactions
|
|
97
97
|
* run one at a time and an overlapping `transaction()` waits its turn.
|
|
98
98
|
* PostgreSQL pools and ignores this.
|
|
99
99
|
*
|
|
@@ -212,7 +212,7 @@ export interface JSONOptions extends DatabaseOptions {
|
|
|
212
212
|
* How long a queued transaction waits for the connection, in milliseconds.
|
|
213
213
|
*
|
|
214
214
|
* Applies to the single-connection adapters — SQLite (both the LibSQL and
|
|
215
|
-
* native paths), DuckDB and
|
|
215
|
+
* native paths), DuckDB, JSON and PGlite. Those drive one connection, so transactions
|
|
216
216
|
* run one at a time and an overlapping `transaction()` waits its turn.
|
|
217
217
|
* PostgreSQL pools and ignores this.
|
|
218
218
|
*
|
|
@@ -961,8 +961,8 @@ export interface DatabaseInterface {
|
|
|
961
961
|
* parameter rather than opening a nested one.
|
|
962
962
|
*
|
|
963
963
|
* **Transactions are serialized per connection on the single-connection
|
|
964
|
-
* adapters** — SQLite (both paths), DuckDB and
|
|
965
|
-
* a connection can only be in one transaction at a time, so a concurrent
|
|
964
|
+
* adapters** — SQLite (both paths), DuckDB, JSON and PGlite drive one
|
|
965
|
+
* connection, and a connection can only be in one transaction at a time, so a concurrent
|
|
966
966
|
* `transaction()` waits for the one in progress rather than corrupting it. A
|
|
967
967
|
* queued call that waits longer than `transactionQueueTimeout` (30s by
|
|
968
968
|
* default) rejects rather than stalling indefinitely. Re-entrant calls do not
|
package/metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/sql",
|
|
3
|
-
"version": "0.102.
|
|
3
|
+
"version": "0.102.4",
|
|
4
4
|
"description": "Database interface with support for SQLite, PostgreSQL, and DuckDB",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"./backup": {
|
|
37
37
|
"import": "./dist/backup/index.js",
|
|
38
38
|
"types": "./dist/backup/index.d.ts"
|
|
39
|
+
},
|
|
40
|
+
"./pglite": {
|
|
41
|
+
"import": "./dist/pglite.js",
|
|
42
|
+
"types": "./dist/pglite.d.ts"
|
|
39
43
|
}
|
|
40
44
|
},
|
|
41
45
|
"keywords": [],
|
|
@@ -43,16 +47,20 @@
|
|
|
43
47
|
"license": "ISC",
|
|
44
48
|
"dependencies": {
|
|
45
49
|
"@duckdb/node-api": "1.4.3-r.3",
|
|
46
|
-
"@happyvertical/utils": "0.102.
|
|
50
|
+
"@happyvertical/utils": "0.102.4",
|
|
47
51
|
"@libsql/client": "0.17.2",
|
|
48
52
|
"pg": "^8.20.0",
|
|
49
53
|
"sqlite-vss": "^0.1.2"
|
|
50
54
|
},
|
|
51
55
|
"peerDependencies": {
|
|
56
|
+
"@electric-sql/pglite": ">=0.5.0 <1",
|
|
52
57
|
"@russellthehippo/honker-node": "^0.3.3",
|
|
53
58
|
"@sqliteai/sqlite-vector": "^1.0.0"
|
|
54
59
|
},
|
|
55
60
|
"peerDependenciesMeta": {
|
|
61
|
+
"@electric-sql/pglite": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
56
64
|
"@russellthehippo/honker-node": {
|
|
57
65
|
"optional": true
|
|
58
66
|
},
|
|
@@ -61,6 +69,9 @@
|
|
|
61
69
|
}
|
|
62
70
|
},
|
|
63
71
|
"devDependencies": {
|
|
72
|
+
"@electric-sql/pglite": "^0.5.8",
|
|
73
|
+
"@electric-sql/pglite-pgvector": "^0.0.9",
|
|
74
|
+
"@types/emscripten": "^1.41.1",
|
|
64
75
|
"@types/node": "25.0.10",
|
|
65
76
|
"@types/pg": "^8.20.0",
|
|
66
77
|
"typescript": "5.9.3",
|