@event-driven-io/dumbo 0.13.0-beta.2 → 0.13.0-beta.21

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 (90) hide show
  1. package/dist/chunk-65DKXURG.js +481 -0
  2. package/dist/chunk-65DKXURG.js.map +1 -0
  3. package/dist/chunk-7WEBHXZD.cjs +481 -0
  4. package/dist/chunk-7WEBHXZD.cjs.map +1 -0
  5. package/dist/chunk-AMACBMAZ.cjs +556 -0
  6. package/dist/chunk-AMACBMAZ.cjs.map +1 -0
  7. package/dist/chunk-FC4JR2R3.js +83 -0
  8. package/dist/chunk-FC4JR2R3.js.map +1 -0
  9. package/dist/chunk-H7ZKIJHB.cjs +83 -0
  10. package/dist/chunk-H7ZKIJHB.cjs.map +1 -0
  11. package/dist/chunk-IVJ3SNPJ.js +34 -0
  12. package/dist/chunk-IVJ3SNPJ.js.map +1 -0
  13. package/dist/chunk-R7P7CNMK.cjs +34 -0
  14. package/dist/chunk-R7P7CNMK.cjs.map +1 -0
  15. package/dist/{chunk-XVV3OOQX.js → chunk-T4A6BQRA.js} +209 -58
  16. package/dist/chunk-T4A6BQRA.js.map +1 -0
  17. package/dist/{chunk-N7RWT46K.js → chunk-XO5T5N5S.js} +2135 -1613
  18. package/dist/chunk-XO5T5N5S.js.map +1 -0
  19. package/dist/{chunk-OJ34O3Q2.cjs → chunk-XOQHZABK.cjs} +2161 -1639
  20. package/dist/chunk-XOQHZABK.cjs.map +1 -0
  21. package/dist/cloudflare.cjs +451 -0
  22. package/dist/cloudflare.cjs.map +1 -0
  23. package/dist/cloudflare.d.cts +92 -0
  24. package/dist/cloudflare.d.ts +92 -0
  25. package/dist/cloudflare.js +451 -0
  26. package/dist/cloudflare.js.map +1 -0
  27. package/dist/{columnProcessors-DMPpTPqM.d.ts → columnProcessors-C7fRa54L.d.ts} +1 -1
  28. package/dist/{columnProcessors-BX-sH7ah.d.cts → columnProcessors-Difrrk4c.d.cts} +1 -1
  29. package/dist/{connectionString-B1wm0TFc.d.cts → connectionString-oeg1LD5V.d.cts} +352 -137
  30. package/dist/{connectionString-B1wm0TFc.d.ts → connectionString-oeg1LD5V.d.ts} +352 -137
  31. package/dist/index.cjs +96 -4
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +23 -18
  34. package/dist/index.d.ts +23 -18
  35. package/dist/index.js +101 -9
  36. package/dist/index.js.map +1 -1
  37. package/dist/pg.cjs +382 -9
  38. package/dist/pg.cjs.map +1 -1
  39. package/dist/pg.d.cts +81 -105
  40. package/dist/pg.d.ts +81 -105
  41. package/dist/pg.js +434 -61
  42. package/dist/pg.js.map +1 -1
  43. package/dist/postgresql.cjs +50 -0
  44. package/dist/postgresql.cjs.map +1 -0
  45. package/dist/postgresql.d.cts +61 -0
  46. package/dist/postgresql.d.ts +61 -0
  47. package/dist/postgresql.js +50 -0
  48. package/dist/sqlite.cjs +56 -0
  49. package/dist/sqlite.cjs.map +1 -0
  50. package/dist/{index-C0h0c380.d.cts → sqlite.d.cts} +31 -10
  51. package/dist/{index-C2z_XBn6.d.ts → sqlite.d.ts} +31 -10
  52. package/dist/sqlite.js +56 -0
  53. package/dist/sqlite3.cjs +240 -11
  54. package/dist/sqlite3.cjs.map +1 -1
  55. package/dist/sqlite3.d.cts +39 -19
  56. package/dist/sqlite3.d.ts +39 -19
  57. package/dist/sqlite3.js +251 -22
  58. package/dist/sqlite3.js.map +1 -1
  59. package/package.json +69 -29
  60. package/dist/chunk-A7TC7IOP.cjs +0 -55
  61. package/dist/chunk-A7TC7IOP.cjs.map +0 -1
  62. package/dist/chunk-F7JQ7BX7.js +0 -240
  63. package/dist/chunk-F7JQ7BX7.js.map +0 -1
  64. package/dist/chunk-I34X53VL.js +0 -688
  65. package/dist/chunk-I34X53VL.js.map +0 -1
  66. package/dist/chunk-ISNF6USX.cjs +0 -688
  67. package/dist/chunk-ISNF6USX.cjs.map +0 -1
  68. package/dist/chunk-IYEHOE4S.cjs +0 -405
  69. package/dist/chunk-IYEHOE4S.cjs.map +0 -1
  70. package/dist/chunk-L2YZQAG3.cjs +0 -240
  71. package/dist/chunk-L2YZQAG3.cjs.map +0 -1
  72. package/dist/chunk-N7RWT46K.js.map +0 -1
  73. package/dist/chunk-OJ34O3Q2.cjs.map +0 -1
  74. package/dist/chunk-TXSETOGH.js +0 -55
  75. package/dist/chunk-TXSETOGH.js.map +0 -1
  76. package/dist/chunk-XVV3OOQX.js.map +0 -1
  77. package/dist/d1.cjs +0 -277
  78. package/dist/d1.cjs.map +0 -1
  79. package/dist/d1.d.cts +0 -72
  80. package/dist/d1.d.ts +0 -72
  81. package/dist/d1.js +0 -277
  82. package/dist/d1.js.map +0 -1
  83. package/dist/pg-3ACXFMU4.cjs +0 -59
  84. package/dist/pg-3ACXFMU4.cjs.map +0 -1
  85. package/dist/pg-GHOW3XSG.js +0 -59
  86. package/dist/sqlite3-EEIKQCJR.js +0 -25
  87. package/dist/sqlite3-SE4DDYZE.cjs +0 -25
  88. package/dist/sqlite3-SE4DDYZE.cjs.map +0 -1
  89. /package/dist/{pg-GHOW3XSG.js.map → postgresql.js.map} +0 -0
  90. /package/dist/{sqlite3-EEIKQCJR.js.map → sqlite.js.map} +0 -0
package/dist/pg.d.cts CHANGED
@@ -1,68 +1,48 @@
1
- import { dv as DatabaseConnectionString, as as SQLExecutor, aC as AcquireDatabaseLockOptions, aD as ReleaseDatabaseLockOptions, aF as DatabaseLock, aA as DatabaseLockOptions, aB as AcquireDatabaseLockMode, M as MigratorOptions, cU as SQL, b as ConnectionPool, S as SQLFormatter, q as DatabaseDriverType, C as Connection, cy as JSONSerializer, D as DatabaseTransaction, v as AnyConnection, a as DatabaseTransactionOptions, c as DbSQLExecutor, d as DumboDatabaseDriver } from './connectionString-B1wm0TFc.cjs';
1
+ import { PostgreSQLDriverType } from './postgresql.cjs';
2
+ export { AdvisoryLock, DefaultPostgreSQLMigratorOptions, PostgreSQLArrayProcessor, PostgreSQLConnectionString, PostgreSQLDatabaseName, PostgreSQLExpandSQLInProcessor, acquireAdvisoryLock, advisoryLock, defaultPostgreSQLConnectionString, defaultPostgreSqlDatabase, functionExists, functionExistsSQL, mapPostgresError, parseDatabaseName, pgFormatter, postgreSQLColumnProcessors, postgreSQLMetadata, releaseAdvisoryLock, tableExists, tableExistsSQL, tryAcquireAdvisoryLock } from './postgresql.cjs';
3
+ import { g as DatabaseTransactionOptions, h as DatabaseTransaction, A as AnyConnection, J as JSONSerializer, C as Connection, i as ConnectionPool, I as InferTransactionFromConnection, j as InferTransactionOptionsFromConnection, k as JSONSerializationOptions, l as DbSQLExecutor, c as DumboDatabaseDriver } from './connectionString-oeg1LD5V.cjs';
2
4
  import pg from 'pg';
3
- import { D as DefaultSQLColumnProcessors } from './columnProcessors-BX-sH7ah.cjs';
5
+ import './columnProcessors-Difrrk4c.cjs';
4
6
 
5
- declare const defaultPostgreSQLConnectionString: PostgreSQLConnectionString;
6
- declare const getDatabaseNameOrDefault: (connectionString: string) => string;
7
- type PostgreSQLConnectionString = DatabaseConnectionString<'PostgreSQL', `postgresql://${string}` | `postgres://${string}`>;
8
- declare const PostgreSQLConnectionString: (connectionString: string) => PostgreSQLConnectionString;
9
-
10
- declare const tryAcquireAdvisoryLock: (execute: SQLExecutor, options: AcquireDatabaseLockOptions) => Promise<boolean>;
11
- declare const releaseAdvisoryLock: (execute: SQLExecutor, options: ReleaseDatabaseLockOptions) => Promise<boolean>;
12
- declare const acquireAdvisoryLock: (execute: SQLExecutor, options: AcquireDatabaseLockOptions) => Promise<void>;
13
- declare const AdvisoryLock: DatabaseLock;
14
- declare const advisoryLock: (execute: SQLExecutor, options: DatabaseLockOptions) => {
15
- acquire: (acquireOptions?: {
16
- mode: AcquireDatabaseLockMode;
17
- }) => Promise<void>;
18
- tryAcquire: (acquireOptions?: {
19
- mode: AcquireDatabaseLockMode;
20
- }) => Promise<boolean>;
21
- release: () => Promise<boolean>;
22
- withAcquire: <Result>(handle: () => Promise<Result>, acquireOptions?: {
23
- mode: AcquireDatabaseLockMode;
24
- }) => Promise<Result>;
7
+ type PgTransaction = DatabaseTransaction<PgConnection>;
8
+ type PgIsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SERIALIZABLE';
9
+ type PgTransactionOptions = DatabaseTransactionOptions & {
10
+ isolationLevel?: PgIsolationLevel;
25
11
  };
12
+ declare const pgTransaction: <ConnectionType extends AnyConnection = AnyConnection>(connection: () => ConnectionType, serializer: JSONSerializer) => <DbClient extends PgPoolOrClient = PgPoolOrClient>(getClient: Promise<DbClient>, options?: {
13
+ close: (client: DbClient, error?: unknown) => Promise<void>;
14
+ } & PgTransactionOptions) => DatabaseTransaction<ConnectionType>;
26
15
 
27
- declare const DefaultPostgreSQLMigratorOptions: MigratorOptions;
28
-
29
- declare const defaultPostgreSqlDatabase = "postgres";
30
- declare const tableExistsSQL: (tableName: string) => SQL;
31
- declare const tableExists: (pool: ConnectionPool, tableName: string) => Promise<boolean>;
32
- declare const functionExistsSQL: (functionName: string) => SQL;
33
- declare const functionExists: (pool: ConnectionPool, tableName: string) => Promise<boolean>;
34
-
35
- declare const pgFormatter: SQLFormatter;
36
-
37
- declare const postgreSQLColumnProcessors: DefaultSQLColumnProcessors;
38
-
39
- type PostgreSQLDatabaseName = 'PostgreSQL';
40
- declare const PostgreSQLDatabaseName = "PostgreSQL";
41
- type PostgreSQLDriverType<DriverName extends string = string> = DatabaseDriverType<PostgreSQLDatabaseName, DriverName>;
42
-
43
- type NodePostgresDriverType = PostgreSQLDriverType<'pg'>;
44
- declare const NodePostgresDriverType: NodePostgresDriverType;
45
- type NodePostgresPoolClient = pg.PoolClient;
46
- type NodePostgresClient = pg.Client;
47
- type NodePostgresClientOrPoolClient = NodePostgresPoolClient | NodePostgresClient;
48
- type NodePostgresPoolOrClient = pg.Pool | NodePostgresPoolClient | NodePostgresClient;
49
- type NodePostgresClientConnection = Connection<NodePostgresClientConnection, NodePostgresDriverType, NodePostgresClient>;
50
- type NodePostgresPoolClientConnection = Connection<NodePostgresPoolClientConnection, NodePostgresDriverType, NodePostgresPoolClient>;
51
- type NodePostgresConnection = NodePostgresPoolClientConnection | NodePostgresClientConnection;
52
- type NodePostgresPoolClientOptions = {
16
+ type PgDriverType = PostgreSQLDriverType<'pg'>;
17
+ declare const PgDriverType: PgDriverType;
18
+ type PgPoolClient = pg.PoolClient;
19
+ type PgClient = pg.Client;
20
+ type PgClientOrPoolClient = PgPoolClient | PgClient;
21
+ type PgPoolOrClient = pg.Pool | PgPoolClient | PgClient;
22
+ type PgClientConnection = Connection<PgClientConnection, PgDriverType, PgClient, DatabaseTransaction<PgClientConnection>, PgTransactionOptions>;
23
+ type PgPoolClientConnection = Connection<PgPoolClientConnection, PgDriverType, PgPoolClient, DatabaseTransaction<PgPoolClientConnection>, PgTransactionOptions>;
24
+ type PgConnection = PgPoolClientConnection | PgClientConnection;
25
+ type PgPoolClientOptions = {
53
26
  type: 'PoolClient';
54
- connect: () => Promise<NodePostgresPoolClient>;
55
- close: (client: NodePostgresPoolClient) => Promise<void>;
27
+ connect: () => Promise<PgPoolClient>;
28
+ close: (client: PgPoolClient) => Promise<void>;
56
29
  };
57
- type NodePostgresClientOptions = {
30
+ type PgClientOptions = {
58
31
  type: 'Client';
59
- connect: () => Promise<NodePostgresClient>;
60
- close: (client: NodePostgresClient) => Promise<void>;
32
+ connect: () => Promise<PgClient>;
33
+ close: (client: PgClient) => Promise<void>;
61
34
  };
62
- declare const nodePostgresClientConnection: (options: NodePostgresClientOptions) => NodePostgresClientConnection;
63
- declare const nodePostgresPoolClientConnection: (options: NodePostgresPoolClientOptions) => NodePostgresPoolClientConnection;
64
- declare function nodePostgresConnection(options: NodePostgresPoolClientOptions): NodePostgresPoolClientConnection;
65
- declare function nodePostgresConnection(options: NodePostgresClientOptions): NodePostgresClientConnection;
35
+ type PgClientConnectionOptions = PgClientOptions & {
36
+ serializer: JSONSerializer;
37
+ };
38
+ type PgPoolClientConnectionOptions = PgPoolClientOptions & {
39
+ serializer: JSONSerializer;
40
+ };
41
+ declare const pgClientConnection: (options: PgClientConnectionOptions) => PgClientConnection;
42
+ declare const pgPoolClientConnection: (options: PgPoolClientConnectionOptions) => PgPoolClientConnection;
43
+ type PgConnectionOptions = PgPoolClientConnectionOptions | PgClientConnectionOptions;
44
+ declare function pgConnection(options: PgPoolClientConnectionOptions): PgPoolClientConnection;
45
+ declare function pgConnection(options: PgClientConnectionOptions): PgClientConnection;
66
46
  type ConnectionCheckResult = {
67
47
  successful: true;
68
48
  } | {
@@ -73,28 +53,32 @@ type ConnectionCheckResult = {
73
53
  };
74
54
  declare const checkConnection: (connectionString: string) => Promise<ConnectionCheckResult>;
75
55
 
76
- type NodePostgresNativePool = ConnectionPool<NodePostgresPoolClientConnection>;
77
- type NodePostgresAmbientClientPool = ConnectionPool<NodePostgresClientConnection>;
78
- type NodePostgresAmbientConnectionPool = ConnectionPool<NodePostgresPoolClientConnection | NodePostgresClientConnection>;
79
- type NodePostgresPool = NodePostgresNativePool | NodePostgresAmbientClientPool | NodePostgresAmbientConnectionPool;
80
- declare const nodePostgresNativePool: (options: {
56
+ type PgNativePool = ConnectionPool<PgPoolClientConnection, InferTransactionFromConnection<PgPoolClientConnection>, InferTransactionOptionsFromConnection<PgPoolClientConnection>>;
57
+ type PgAmbientClientPool = ConnectionPool<PgClientConnection, InferTransactionFromConnection<PgClientConnection>, InferTransactionOptionsFromConnection<PgClientConnection>>;
58
+ type PgAmbientConnectionPool = ConnectionPool<PgPoolClientConnection | PgClientConnection>;
59
+ type PgPool = PgNativePool | PgAmbientClientPool | PgAmbientConnectionPool;
60
+ declare const pgNativePool: (options: {
81
61
  connectionString: string;
82
62
  database?: string | undefined;
83
- }) => NodePostgresNativePool;
84
- declare const nodePostgresAmbientNativePool: (options: {
63
+ serializer: JSONSerializer;
64
+ }) => PgNativePool;
65
+ declare const pgAmbientNativePool: (options: {
85
66
  pool: pg.Pool;
86
- }) => NodePostgresNativePool;
87
- declare const nodePostgresAmbientConnectionPool: (options: {
88
- connection: NodePostgresPoolClientConnection | NodePostgresClientConnection;
89
- }) => NodePostgresAmbientConnectionPool;
90
- declare const nodePostgresClientPool: (options: {
67
+ serializer: JSONSerializer;
68
+ }) => PgNativePool;
69
+ declare const pgAmbientConnectionPool: (options: {
70
+ connection: PgPoolClientConnection | PgClientConnection;
71
+ }) => PgAmbientConnectionPool;
72
+ declare const pgClientPool: (options: {
91
73
  connectionString: string;
92
74
  database?: string | undefined;
93
- }) => NodePostgresAmbientClientPool;
94
- declare const nodePostgresAmbientClientPool: (options: {
75
+ serializer: JSONSerializer;
76
+ }) => PgAmbientClientPool;
77
+ declare const pgAmbientClientPool: (options: {
95
78
  client: pg.Client;
96
- }) => NodePostgresAmbientClientPool;
97
- type NodePostgresPoolPooledOptions = {
79
+ serializer: JSONSerializer;
80
+ }) => PgAmbientClientPool;
81
+ type PgPoolPooledOptions = {
98
82
  connectionString: string;
99
83
  database?: string;
100
84
  pooled: true;
@@ -111,7 +95,7 @@ type NodePostgresPoolPooledOptions = {
111
95
  connectionString: string;
112
96
  database?: string;
113
97
  };
114
- type NodePostgresPoolNotPooledOptions = {
98
+ type PgPoolNotPooledOptions = {
115
99
  connectionString: string;
116
100
  database?: string;
117
101
  pooled: false;
@@ -127,45 +111,37 @@ type NodePostgresPoolNotPooledOptions = {
127
111
  } | {
128
112
  connectionString: string;
129
113
  database?: string;
130
- connection: NodePostgresPoolClientConnection | NodePostgresClientConnection;
114
+ connection: PgPoolClientConnection | PgClientConnection;
131
115
  pooled?: false;
132
116
  };
133
- type NodePostgresPoolOptions = (NodePostgresPoolPooledOptions | NodePostgresPoolNotPooledOptions) & {
134
- serializer?: JSONSerializer;
135
- };
136
- declare function nodePostgresPool(options: NodePostgresPoolPooledOptions): NodePostgresNativePool;
137
- declare function nodePostgresPool(options: NodePostgresPoolNotPooledOptions): NodePostgresAmbientClientPool;
138
- declare const getPool: (connectionStringOrOptions: string | pg.PoolConfig) => pg.Pool;
139
- declare const endPool: ({ connectionString, database, force, }: {
117
+ type PgPoolOptions = (PgPoolPooledOptions | PgPoolNotPooledOptions) & JSONSerializationOptions;
118
+ declare function pgPool(options: PgPoolPooledOptions): PgNativePool;
119
+ declare function pgPool(options: PgPoolNotPooledOptions): PgAmbientClientPool;
120
+ declare const getPgPool: (connectionStringOrOptions: string | pg.PoolConfig) => pg.Pool;
121
+ declare const endPgPool: ({ connectionString, database, force, }: {
140
122
  connectionString: string;
141
123
  database?: string | undefined;
142
124
  force?: boolean;
143
125
  }) => Promise<void>;
144
126
  declare const onEndPool: (lookupKey: string, pool: pg.Pool) => Promise<void>;
145
- declare const endAllPools: () => Promise<void[]>;
146
-
147
- type NodePostgresTransaction = DatabaseTransaction<NodePostgresConnection>;
148
- declare const nodePostgresTransaction: <ConnectionType extends AnyConnection = AnyConnection>(connection: () => ConnectionType) => <DbClient extends NodePostgresPoolOrClient = NodePostgresPoolOrClient>(getClient: Promise<DbClient>, options?: {
149
- close: (client: DbClient, error?: unknown) => Promise<void>;
150
- } & DatabaseTransactionOptions) => DatabaseTransaction<ConnectionType>;
151
-
152
- declare const isNodePostgresNativePool: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.Pool;
153
- declare const isNodePostgresClient: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.Client;
154
- declare const isNodePostgresPoolClient: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.PoolClient;
155
- declare const nodePostgresExecute: <Result = void>(poolOrClient: pg.Pool | pg.PoolClient | pg.Client, handle: (client: pg.PoolClient | pg.Client) => Promise<Result>) => Promise<Result>;
156
- type NodePostgresSQLExecutor = DbSQLExecutor<NodePostgresDriverType, NodePostgresClientOrPoolClient>;
157
- declare const nodePostgresSQLExecutor: () => NodePostgresSQLExecutor;
127
+ declare const endAllPgPools: () => Promise<void[]>;
158
128
 
159
- declare const setNodePostgresTypeParser: (jsonSerializer: JSONSerializer) => void;
129
+ declare const isPgNativePool: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.Pool;
130
+ declare const isPgClient: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.Client;
131
+ declare const isPgPoolClient: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.PoolClient;
132
+ declare const pgExecute: <Result = void>(poolOrClient: pg.Pool | pg.PoolClient | pg.Client, handle: (client: pg.PoolClient | pg.Client) => Promise<Result>) => Promise<Result>;
133
+ type PgSQLExecutor = DbSQLExecutor<PgDriverType, PgClientOrPoolClient>;
134
+ declare const pgSQLExecutor: ({ serializer, }: {
135
+ serializer: JSONSerializer;
136
+ }) => PgSQLExecutor;
160
137
 
161
- declare const pgDatabaseDriver: DumboDatabaseDriver<NodePostgresConnection, NodePostgresPoolOptions>;
162
- declare const usePgDatabaseDriver: () => void;
138
+ declare const setPgTypeParser: (client: pg.Client | pg.PoolClient, options?: {
139
+ parseBigInts?: boolean;
140
+ serializer: JSONSerializer;
141
+ }) => void;
163
142
 
164
- type PostgresDriverType = NodePostgresDriverType;
165
- type PostgresPool = NodePostgresPool;
166
- type PostgresConnection = NodePostgresConnection;
167
- type PostgresPoolOptions = NodePostgresPoolOptions;
168
- declare const postgresPool: typeof nodePostgresPool;
169
- declare const connectionPool: typeof nodePostgresPool;
143
+ declare const pgDumboDriver: DumboDatabaseDriver<PgConnection, PgPoolOptions, PgPool>;
144
+ declare const usePgDumboDriver: () => void;
145
+ type PgDumboOptions = PgPoolOptions;
170
146
 
171
- export { AdvisoryLock, type ConnectionCheckResult, DefaultPostgreSQLMigratorOptions, type NodePostgresAmbientClientPool, type NodePostgresAmbientConnectionPool, type NodePostgresClient, type NodePostgresClientConnection, type NodePostgresClientOptions, type NodePostgresClientOrPoolClient, type NodePostgresConnection, NodePostgresDriverType, type NodePostgresNativePool, type NodePostgresPool, type NodePostgresPoolClient, type NodePostgresPoolClientConnection, type NodePostgresPoolClientOptions, type NodePostgresPoolNotPooledOptions, type NodePostgresPoolOptions, type NodePostgresPoolOrClient, type NodePostgresPoolPooledOptions, type NodePostgresSQLExecutor, type NodePostgresTransaction, PostgreSQLConnectionString, PostgreSQLDatabaseName, type PostgreSQLDriverType, type PostgresConnection, type PostgresDriverType, type PostgresPool, type PostgresPoolOptions, acquireAdvisoryLock, advisoryLock, checkConnection, connectionPool, pgDatabaseDriver as databaseDriver, defaultPostgreSQLConnectionString, defaultPostgreSqlDatabase, endAllPools, endPool, functionExists, functionExistsSQL, getDatabaseNameOrDefault, getPool, isNodePostgresClient, isNodePostgresNativePool, isNodePostgresPoolClient, nodePostgresAmbientClientPool, nodePostgresAmbientConnectionPool, nodePostgresAmbientNativePool, nodePostgresClientConnection, nodePostgresClientPool, nodePostgresConnection, nodePostgresExecute, nodePostgresNativePool, nodePostgresPool, nodePostgresPoolClientConnection, nodePostgresSQLExecutor, nodePostgresTransaction, onEndPool, pgDatabaseDriver, pgFormatter, postgreSQLColumnProcessors, postgresPool, releaseAdvisoryLock, setNodePostgresTypeParser, tableExists, tableExistsSQL, tryAcquireAdvisoryLock, usePgDatabaseDriver };
147
+ export { type ConnectionCheckResult, type PgAmbientClientPool, type PgAmbientConnectionPool, type PgClient, type PgClientConnection, type PgClientConnectionOptions, type PgClientOptions, type PgClientOrPoolClient, type PgConnection, type PgConnectionOptions, PgDriverType, type PgDumboOptions, type PgIsolationLevel, type PgNativePool, type PgPool, type PgPoolClient, type PgPoolClientConnection, type PgPoolClientConnectionOptions, type PgPoolClientOptions, type PgPoolNotPooledOptions, type PgPoolOptions, type PgPoolOrClient, type PgPoolPooledOptions, type PgSQLExecutor, type PgTransaction, type PgTransactionOptions, PostgreSQLDriverType, checkConnection, endAllPgPools, endPgPool, getPgPool, isPgClient, isPgNativePool, isPgPoolClient, onEndPool, pgAmbientClientPool, pgAmbientConnectionPool, pgAmbientNativePool, pgClientConnection, pgClientPool, pgConnection, pgDumboDriver, pgExecute, pgNativePool, pgPool, pgPoolClientConnection, pgSQLExecutor, pgTransaction, setPgTypeParser, usePgDumboDriver };
package/dist/pg.d.ts CHANGED
@@ -1,68 +1,48 @@
1
- import { dv as DatabaseConnectionString, as as SQLExecutor, aC as AcquireDatabaseLockOptions, aD as ReleaseDatabaseLockOptions, aF as DatabaseLock, aA as DatabaseLockOptions, aB as AcquireDatabaseLockMode, M as MigratorOptions, cU as SQL, b as ConnectionPool, S as SQLFormatter, q as DatabaseDriverType, C as Connection, cy as JSONSerializer, D as DatabaseTransaction, v as AnyConnection, a as DatabaseTransactionOptions, c as DbSQLExecutor, d as DumboDatabaseDriver } from './connectionString-B1wm0TFc.js';
1
+ import { PostgreSQLDriverType } from './postgresql.js';
2
+ export { AdvisoryLock, DefaultPostgreSQLMigratorOptions, PostgreSQLArrayProcessor, PostgreSQLConnectionString, PostgreSQLDatabaseName, PostgreSQLExpandSQLInProcessor, acquireAdvisoryLock, advisoryLock, defaultPostgreSQLConnectionString, defaultPostgreSqlDatabase, functionExists, functionExistsSQL, mapPostgresError, parseDatabaseName, pgFormatter, postgreSQLColumnProcessors, postgreSQLMetadata, releaseAdvisoryLock, tableExists, tableExistsSQL, tryAcquireAdvisoryLock } from './postgresql.js';
3
+ import { g as DatabaseTransactionOptions, h as DatabaseTransaction, A as AnyConnection, J as JSONSerializer, C as Connection, i as ConnectionPool, I as InferTransactionFromConnection, j as InferTransactionOptionsFromConnection, k as JSONSerializationOptions, l as DbSQLExecutor, c as DumboDatabaseDriver } from './connectionString-oeg1LD5V.js';
2
4
  import pg from 'pg';
3
- import { D as DefaultSQLColumnProcessors } from './columnProcessors-DMPpTPqM.js';
5
+ import './columnProcessors-C7fRa54L.js';
4
6
 
5
- declare const defaultPostgreSQLConnectionString: PostgreSQLConnectionString;
6
- declare const getDatabaseNameOrDefault: (connectionString: string) => string;
7
- type PostgreSQLConnectionString = DatabaseConnectionString<'PostgreSQL', `postgresql://${string}` | `postgres://${string}`>;
8
- declare const PostgreSQLConnectionString: (connectionString: string) => PostgreSQLConnectionString;
9
-
10
- declare const tryAcquireAdvisoryLock: (execute: SQLExecutor, options: AcquireDatabaseLockOptions) => Promise<boolean>;
11
- declare const releaseAdvisoryLock: (execute: SQLExecutor, options: ReleaseDatabaseLockOptions) => Promise<boolean>;
12
- declare const acquireAdvisoryLock: (execute: SQLExecutor, options: AcquireDatabaseLockOptions) => Promise<void>;
13
- declare const AdvisoryLock: DatabaseLock;
14
- declare const advisoryLock: (execute: SQLExecutor, options: DatabaseLockOptions) => {
15
- acquire: (acquireOptions?: {
16
- mode: AcquireDatabaseLockMode;
17
- }) => Promise<void>;
18
- tryAcquire: (acquireOptions?: {
19
- mode: AcquireDatabaseLockMode;
20
- }) => Promise<boolean>;
21
- release: () => Promise<boolean>;
22
- withAcquire: <Result>(handle: () => Promise<Result>, acquireOptions?: {
23
- mode: AcquireDatabaseLockMode;
24
- }) => Promise<Result>;
7
+ type PgTransaction = DatabaseTransaction<PgConnection>;
8
+ type PgIsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SERIALIZABLE';
9
+ type PgTransactionOptions = DatabaseTransactionOptions & {
10
+ isolationLevel?: PgIsolationLevel;
25
11
  };
12
+ declare const pgTransaction: <ConnectionType extends AnyConnection = AnyConnection>(connection: () => ConnectionType, serializer: JSONSerializer) => <DbClient extends PgPoolOrClient = PgPoolOrClient>(getClient: Promise<DbClient>, options?: {
13
+ close: (client: DbClient, error?: unknown) => Promise<void>;
14
+ } & PgTransactionOptions) => DatabaseTransaction<ConnectionType>;
26
15
 
27
- declare const DefaultPostgreSQLMigratorOptions: MigratorOptions;
28
-
29
- declare const defaultPostgreSqlDatabase = "postgres";
30
- declare const tableExistsSQL: (tableName: string) => SQL;
31
- declare const tableExists: (pool: ConnectionPool, tableName: string) => Promise<boolean>;
32
- declare const functionExistsSQL: (functionName: string) => SQL;
33
- declare const functionExists: (pool: ConnectionPool, tableName: string) => Promise<boolean>;
34
-
35
- declare const pgFormatter: SQLFormatter;
36
-
37
- declare const postgreSQLColumnProcessors: DefaultSQLColumnProcessors;
38
-
39
- type PostgreSQLDatabaseName = 'PostgreSQL';
40
- declare const PostgreSQLDatabaseName = "PostgreSQL";
41
- type PostgreSQLDriverType<DriverName extends string = string> = DatabaseDriverType<PostgreSQLDatabaseName, DriverName>;
42
-
43
- type NodePostgresDriverType = PostgreSQLDriverType<'pg'>;
44
- declare const NodePostgresDriverType: NodePostgresDriverType;
45
- type NodePostgresPoolClient = pg.PoolClient;
46
- type NodePostgresClient = pg.Client;
47
- type NodePostgresClientOrPoolClient = NodePostgresPoolClient | NodePostgresClient;
48
- type NodePostgresPoolOrClient = pg.Pool | NodePostgresPoolClient | NodePostgresClient;
49
- type NodePostgresClientConnection = Connection<NodePostgresClientConnection, NodePostgresDriverType, NodePostgresClient>;
50
- type NodePostgresPoolClientConnection = Connection<NodePostgresPoolClientConnection, NodePostgresDriverType, NodePostgresPoolClient>;
51
- type NodePostgresConnection = NodePostgresPoolClientConnection | NodePostgresClientConnection;
52
- type NodePostgresPoolClientOptions = {
16
+ type PgDriverType = PostgreSQLDriverType<'pg'>;
17
+ declare const PgDriverType: PgDriverType;
18
+ type PgPoolClient = pg.PoolClient;
19
+ type PgClient = pg.Client;
20
+ type PgClientOrPoolClient = PgPoolClient | PgClient;
21
+ type PgPoolOrClient = pg.Pool | PgPoolClient | PgClient;
22
+ type PgClientConnection = Connection<PgClientConnection, PgDriverType, PgClient, DatabaseTransaction<PgClientConnection>, PgTransactionOptions>;
23
+ type PgPoolClientConnection = Connection<PgPoolClientConnection, PgDriverType, PgPoolClient, DatabaseTransaction<PgPoolClientConnection>, PgTransactionOptions>;
24
+ type PgConnection = PgPoolClientConnection | PgClientConnection;
25
+ type PgPoolClientOptions = {
53
26
  type: 'PoolClient';
54
- connect: () => Promise<NodePostgresPoolClient>;
55
- close: (client: NodePostgresPoolClient) => Promise<void>;
27
+ connect: () => Promise<PgPoolClient>;
28
+ close: (client: PgPoolClient) => Promise<void>;
56
29
  };
57
- type NodePostgresClientOptions = {
30
+ type PgClientOptions = {
58
31
  type: 'Client';
59
- connect: () => Promise<NodePostgresClient>;
60
- close: (client: NodePostgresClient) => Promise<void>;
32
+ connect: () => Promise<PgClient>;
33
+ close: (client: PgClient) => Promise<void>;
61
34
  };
62
- declare const nodePostgresClientConnection: (options: NodePostgresClientOptions) => NodePostgresClientConnection;
63
- declare const nodePostgresPoolClientConnection: (options: NodePostgresPoolClientOptions) => NodePostgresPoolClientConnection;
64
- declare function nodePostgresConnection(options: NodePostgresPoolClientOptions): NodePostgresPoolClientConnection;
65
- declare function nodePostgresConnection(options: NodePostgresClientOptions): NodePostgresClientConnection;
35
+ type PgClientConnectionOptions = PgClientOptions & {
36
+ serializer: JSONSerializer;
37
+ };
38
+ type PgPoolClientConnectionOptions = PgPoolClientOptions & {
39
+ serializer: JSONSerializer;
40
+ };
41
+ declare const pgClientConnection: (options: PgClientConnectionOptions) => PgClientConnection;
42
+ declare const pgPoolClientConnection: (options: PgPoolClientConnectionOptions) => PgPoolClientConnection;
43
+ type PgConnectionOptions = PgPoolClientConnectionOptions | PgClientConnectionOptions;
44
+ declare function pgConnection(options: PgPoolClientConnectionOptions): PgPoolClientConnection;
45
+ declare function pgConnection(options: PgClientConnectionOptions): PgClientConnection;
66
46
  type ConnectionCheckResult = {
67
47
  successful: true;
68
48
  } | {
@@ -73,28 +53,32 @@ type ConnectionCheckResult = {
73
53
  };
74
54
  declare const checkConnection: (connectionString: string) => Promise<ConnectionCheckResult>;
75
55
 
76
- type NodePostgresNativePool = ConnectionPool<NodePostgresPoolClientConnection>;
77
- type NodePostgresAmbientClientPool = ConnectionPool<NodePostgresClientConnection>;
78
- type NodePostgresAmbientConnectionPool = ConnectionPool<NodePostgresPoolClientConnection | NodePostgresClientConnection>;
79
- type NodePostgresPool = NodePostgresNativePool | NodePostgresAmbientClientPool | NodePostgresAmbientConnectionPool;
80
- declare const nodePostgresNativePool: (options: {
56
+ type PgNativePool = ConnectionPool<PgPoolClientConnection, InferTransactionFromConnection<PgPoolClientConnection>, InferTransactionOptionsFromConnection<PgPoolClientConnection>>;
57
+ type PgAmbientClientPool = ConnectionPool<PgClientConnection, InferTransactionFromConnection<PgClientConnection>, InferTransactionOptionsFromConnection<PgClientConnection>>;
58
+ type PgAmbientConnectionPool = ConnectionPool<PgPoolClientConnection | PgClientConnection>;
59
+ type PgPool = PgNativePool | PgAmbientClientPool | PgAmbientConnectionPool;
60
+ declare const pgNativePool: (options: {
81
61
  connectionString: string;
82
62
  database?: string | undefined;
83
- }) => NodePostgresNativePool;
84
- declare const nodePostgresAmbientNativePool: (options: {
63
+ serializer: JSONSerializer;
64
+ }) => PgNativePool;
65
+ declare const pgAmbientNativePool: (options: {
85
66
  pool: pg.Pool;
86
- }) => NodePostgresNativePool;
87
- declare const nodePostgresAmbientConnectionPool: (options: {
88
- connection: NodePostgresPoolClientConnection | NodePostgresClientConnection;
89
- }) => NodePostgresAmbientConnectionPool;
90
- declare const nodePostgresClientPool: (options: {
67
+ serializer: JSONSerializer;
68
+ }) => PgNativePool;
69
+ declare const pgAmbientConnectionPool: (options: {
70
+ connection: PgPoolClientConnection | PgClientConnection;
71
+ }) => PgAmbientConnectionPool;
72
+ declare const pgClientPool: (options: {
91
73
  connectionString: string;
92
74
  database?: string | undefined;
93
- }) => NodePostgresAmbientClientPool;
94
- declare const nodePostgresAmbientClientPool: (options: {
75
+ serializer: JSONSerializer;
76
+ }) => PgAmbientClientPool;
77
+ declare const pgAmbientClientPool: (options: {
95
78
  client: pg.Client;
96
- }) => NodePostgresAmbientClientPool;
97
- type NodePostgresPoolPooledOptions = {
79
+ serializer: JSONSerializer;
80
+ }) => PgAmbientClientPool;
81
+ type PgPoolPooledOptions = {
98
82
  connectionString: string;
99
83
  database?: string;
100
84
  pooled: true;
@@ -111,7 +95,7 @@ type NodePostgresPoolPooledOptions = {
111
95
  connectionString: string;
112
96
  database?: string;
113
97
  };
114
- type NodePostgresPoolNotPooledOptions = {
98
+ type PgPoolNotPooledOptions = {
115
99
  connectionString: string;
116
100
  database?: string;
117
101
  pooled: false;
@@ -127,45 +111,37 @@ type NodePostgresPoolNotPooledOptions = {
127
111
  } | {
128
112
  connectionString: string;
129
113
  database?: string;
130
- connection: NodePostgresPoolClientConnection | NodePostgresClientConnection;
114
+ connection: PgPoolClientConnection | PgClientConnection;
131
115
  pooled?: false;
132
116
  };
133
- type NodePostgresPoolOptions = (NodePostgresPoolPooledOptions | NodePostgresPoolNotPooledOptions) & {
134
- serializer?: JSONSerializer;
135
- };
136
- declare function nodePostgresPool(options: NodePostgresPoolPooledOptions): NodePostgresNativePool;
137
- declare function nodePostgresPool(options: NodePostgresPoolNotPooledOptions): NodePostgresAmbientClientPool;
138
- declare const getPool: (connectionStringOrOptions: string | pg.PoolConfig) => pg.Pool;
139
- declare const endPool: ({ connectionString, database, force, }: {
117
+ type PgPoolOptions = (PgPoolPooledOptions | PgPoolNotPooledOptions) & JSONSerializationOptions;
118
+ declare function pgPool(options: PgPoolPooledOptions): PgNativePool;
119
+ declare function pgPool(options: PgPoolNotPooledOptions): PgAmbientClientPool;
120
+ declare const getPgPool: (connectionStringOrOptions: string | pg.PoolConfig) => pg.Pool;
121
+ declare const endPgPool: ({ connectionString, database, force, }: {
140
122
  connectionString: string;
141
123
  database?: string | undefined;
142
124
  force?: boolean;
143
125
  }) => Promise<void>;
144
126
  declare const onEndPool: (lookupKey: string, pool: pg.Pool) => Promise<void>;
145
- declare const endAllPools: () => Promise<void[]>;
146
-
147
- type NodePostgresTransaction = DatabaseTransaction<NodePostgresConnection>;
148
- declare const nodePostgresTransaction: <ConnectionType extends AnyConnection = AnyConnection>(connection: () => ConnectionType) => <DbClient extends NodePostgresPoolOrClient = NodePostgresPoolOrClient>(getClient: Promise<DbClient>, options?: {
149
- close: (client: DbClient, error?: unknown) => Promise<void>;
150
- } & DatabaseTransactionOptions) => DatabaseTransaction<ConnectionType>;
151
-
152
- declare const isNodePostgresNativePool: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.Pool;
153
- declare const isNodePostgresClient: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.Client;
154
- declare const isNodePostgresPoolClient: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.PoolClient;
155
- declare const nodePostgresExecute: <Result = void>(poolOrClient: pg.Pool | pg.PoolClient | pg.Client, handle: (client: pg.PoolClient | pg.Client) => Promise<Result>) => Promise<Result>;
156
- type NodePostgresSQLExecutor = DbSQLExecutor<NodePostgresDriverType, NodePostgresClientOrPoolClient>;
157
- declare const nodePostgresSQLExecutor: () => NodePostgresSQLExecutor;
127
+ declare const endAllPgPools: () => Promise<void[]>;
158
128
 
159
- declare const setNodePostgresTypeParser: (jsonSerializer: JSONSerializer) => void;
129
+ declare const isPgNativePool: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.Pool;
130
+ declare const isPgClient: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.Client;
131
+ declare const isPgPoolClient: (poolOrClient: pg.Pool | pg.PoolClient | pg.Client) => poolOrClient is pg.PoolClient;
132
+ declare const pgExecute: <Result = void>(poolOrClient: pg.Pool | pg.PoolClient | pg.Client, handle: (client: pg.PoolClient | pg.Client) => Promise<Result>) => Promise<Result>;
133
+ type PgSQLExecutor = DbSQLExecutor<PgDriverType, PgClientOrPoolClient>;
134
+ declare const pgSQLExecutor: ({ serializer, }: {
135
+ serializer: JSONSerializer;
136
+ }) => PgSQLExecutor;
160
137
 
161
- declare const pgDatabaseDriver: DumboDatabaseDriver<NodePostgresConnection, NodePostgresPoolOptions>;
162
- declare const usePgDatabaseDriver: () => void;
138
+ declare const setPgTypeParser: (client: pg.Client | pg.PoolClient, options?: {
139
+ parseBigInts?: boolean;
140
+ serializer: JSONSerializer;
141
+ }) => void;
163
142
 
164
- type PostgresDriverType = NodePostgresDriverType;
165
- type PostgresPool = NodePostgresPool;
166
- type PostgresConnection = NodePostgresConnection;
167
- type PostgresPoolOptions = NodePostgresPoolOptions;
168
- declare const postgresPool: typeof nodePostgresPool;
169
- declare const connectionPool: typeof nodePostgresPool;
143
+ declare const pgDumboDriver: DumboDatabaseDriver<PgConnection, PgPoolOptions, PgPool>;
144
+ declare const usePgDumboDriver: () => void;
145
+ type PgDumboOptions = PgPoolOptions;
170
146
 
171
- export { AdvisoryLock, type ConnectionCheckResult, DefaultPostgreSQLMigratorOptions, type NodePostgresAmbientClientPool, type NodePostgresAmbientConnectionPool, type NodePostgresClient, type NodePostgresClientConnection, type NodePostgresClientOptions, type NodePostgresClientOrPoolClient, type NodePostgresConnection, NodePostgresDriverType, type NodePostgresNativePool, type NodePostgresPool, type NodePostgresPoolClient, type NodePostgresPoolClientConnection, type NodePostgresPoolClientOptions, type NodePostgresPoolNotPooledOptions, type NodePostgresPoolOptions, type NodePostgresPoolOrClient, type NodePostgresPoolPooledOptions, type NodePostgresSQLExecutor, type NodePostgresTransaction, PostgreSQLConnectionString, PostgreSQLDatabaseName, type PostgreSQLDriverType, type PostgresConnection, type PostgresDriverType, type PostgresPool, type PostgresPoolOptions, acquireAdvisoryLock, advisoryLock, checkConnection, connectionPool, pgDatabaseDriver as databaseDriver, defaultPostgreSQLConnectionString, defaultPostgreSqlDatabase, endAllPools, endPool, functionExists, functionExistsSQL, getDatabaseNameOrDefault, getPool, isNodePostgresClient, isNodePostgresNativePool, isNodePostgresPoolClient, nodePostgresAmbientClientPool, nodePostgresAmbientConnectionPool, nodePostgresAmbientNativePool, nodePostgresClientConnection, nodePostgresClientPool, nodePostgresConnection, nodePostgresExecute, nodePostgresNativePool, nodePostgresPool, nodePostgresPoolClientConnection, nodePostgresSQLExecutor, nodePostgresTransaction, onEndPool, pgDatabaseDriver, pgFormatter, postgreSQLColumnProcessors, postgresPool, releaseAdvisoryLock, setNodePostgresTypeParser, tableExists, tableExistsSQL, tryAcquireAdvisoryLock, usePgDatabaseDriver };
147
+ export { type ConnectionCheckResult, type PgAmbientClientPool, type PgAmbientConnectionPool, type PgClient, type PgClientConnection, type PgClientConnectionOptions, type PgClientOptions, type PgClientOrPoolClient, type PgConnection, type PgConnectionOptions, PgDriverType, type PgDumboOptions, type PgIsolationLevel, type PgNativePool, type PgPool, type PgPoolClient, type PgPoolClientConnection, type PgPoolClientConnectionOptions, type PgPoolClientOptions, type PgPoolNotPooledOptions, type PgPoolOptions, type PgPoolOrClient, type PgPoolPooledOptions, type PgSQLExecutor, type PgTransaction, type PgTransactionOptions, PostgreSQLDriverType, checkConnection, endAllPgPools, endPgPool, getPgPool, isPgClient, isPgNativePool, isPgPoolClient, onEndPool, pgAmbientClientPool, pgAmbientConnectionPool, pgAmbientNativePool, pgClientConnection, pgClientPool, pgConnection, pgDumboDriver, pgExecute, pgNativePool, pgPool, pgPoolClientConnection, pgSQLExecutor, pgTransaction, setPgTypeParser, usePgDumboDriver };