@mantajs/adapter-database-neon 0.2.0-beta.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.
@@ -0,0 +1,28 @@
1
+ import type { DatabaseConfig, IDatabasePort, TransactionOptions } from '@mantajs/core/ports';
2
+ /**
3
+ * NeonDrizzleAdapter — IDatabasePort for Neon serverless PostgreSQL.
4
+ * Uses WebSocket Pool on Vercel, postgres.js TCP locally.
5
+ */
6
+ export declare class NeonDrizzleAdapter implements IDatabasePort {
7
+ private _neonDb;
8
+ private _disposed;
9
+ initialize(config: DatabaseConfig): Promise<void>;
10
+ dispose(): Promise<void>;
11
+ healthCheck(): Promise<boolean>;
12
+ getClient(): unknown;
13
+ /**
14
+ * Rebuild the Drizzle client with the full DML schema. Required for graph
15
+ * queries (IRelationalQueryPort) that use `db.query.*`. Without this, graph
16
+ * reads fall back to the legacy resolver that only does scalar `eq()` and
17
+ * breaks all operator-object filters (`{ $notnull: true }`, `{ $eq: x }`…).
18
+ *
19
+ * Mirrors `DrizzlePgAdapter.setSchema()` so wire-commands can call the same
20
+ * hook regardless of which adapter is active.
21
+ */
22
+ setSchema(schema: Record<string, unknown>): void;
23
+ getPool(): unknown;
24
+ transaction<T>(fn: (tx: unknown) => Promise<T>, _options?: TransactionOptions): Promise<T>;
25
+ raw<T = Record<string, unknown>>(query: string, params?: unknown[]): Promise<T[]>;
26
+ introspect(): Promise<unknown>;
27
+ }
28
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAI5F;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACtD,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,SAAS,CAAQ;IAEnB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IASjD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAqBrC,SAAS,IAAI,OAAO;IAOpB;;;;;;;;OAQG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAOhD,OAAO,IAAI,OAAO;IAUZ,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAO1F,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAKjF,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;CAWrC"}
@@ -0,0 +1,97 @@
1
+ // SPEC-056 — NeonDrizzleAdapter implements IDatabasePort
2
+ // Full Neon adapter wrapping createNeonDatabase() as a proper IDatabasePort.
3
+ import { MantaError } from '@mantajs/core/errors';
4
+ import { createNeonDatabase } from './connection';
5
+ /**
6
+ * NeonDrizzleAdapter — IDatabasePort for Neon serverless PostgreSQL.
7
+ * Uses WebSocket Pool on Vercel, postgres.js TCP locally.
8
+ */
9
+ export class NeonDrizzleAdapter {
10
+ _neonDb = null;
11
+ _disposed = false;
12
+ async initialize(config) {
13
+ if (this._disposed) {
14
+ throw new MantaError('INVALID_STATE', 'Adapter has been disposed');
15
+ }
16
+ console.log(`[neon] Initializing database (url: ${config.url?.replace(/:[^@]+@/, ':***@')})`);
17
+ this._neonDb = await createNeonDatabase({ url: config.url });
18
+ console.log('[neon] Database instance created');
19
+ }
20
+ async dispose() {
21
+ if (this._neonDb) {
22
+ await this._neonDb.close();
23
+ this._neonDb = null;
24
+ }
25
+ this._disposed = true;
26
+ }
27
+ async healthCheck() {
28
+ if (!this._neonDb || this._disposed) {
29
+ console.error('[neon] healthCheck: db not initialized or disposed');
30
+ return false;
31
+ }
32
+ try {
33
+ await Promise.race([
34
+ this._neonDb.rawSql('SELECT 1'),
35
+ new Promise((_, reject) => setTimeout(() => reject(new Error('Health check timeout (5s)')), 5000)),
36
+ ]);
37
+ return true;
38
+ }
39
+ catch (err) {
40
+ console.error('[neon] healthCheck FAILED:', err.message, err.stack?.split('\n').slice(0, 3).join('\n'));
41
+ return false;
42
+ }
43
+ }
44
+ getClient() {
45
+ if (!this._neonDb) {
46
+ throw new MantaError('INVALID_STATE', 'Database not initialized. Call initialize() first.');
47
+ }
48
+ return this._neonDb.db;
49
+ }
50
+ /**
51
+ * Rebuild the Drizzle client with the full DML schema. Required for graph
52
+ * queries (IRelationalQueryPort) that use `db.query.*`. Without this, graph
53
+ * reads fall back to the legacy resolver that only does scalar `eq()` and
54
+ * breaks all operator-object filters (`{ $notnull: true }`, `{ $eq: x }`…).
55
+ *
56
+ * Mirrors `DrizzlePgAdapter.setSchema()` so wire-commands can call the same
57
+ * hook regardless of which adapter is active.
58
+ */
59
+ setSchema(schema) {
60
+ if (!this._neonDb) {
61
+ throw new MantaError('INVALID_STATE', 'Database not initialized. Call initialize() first.');
62
+ }
63
+ this._neonDb.withSchema(schema);
64
+ }
65
+ getPool() {
66
+ if (!this._neonDb) {
67
+ throw new MantaError('INVALID_STATE', 'Database not initialized. Call initialize() first.');
68
+ }
69
+ // Return the pool directly — supports tagged templates (sql`...`) AND .unsafe(query).
70
+ // On Neon HTTP: the neon() function with .unsafe() added.
71
+ // On postgres.js: the native postgres instance.
72
+ return this._neonDb.pool;
73
+ }
74
+ async transaction(fn, _options) {
75
+ const db = this.getClient();
76
+ return await db.transaction(async (tx) => {
77
+ return await fn(tx);
78
+ });
79
+ }
80
+ async raw(query, params) {
81
+ if (!this._neonDb)
82
+ throw new MantaError('INVALID_STATE', 'NeonDrizzleAdapter: not initialized');
83
+ return this._neonDb.rawSql(query, params);
84
+ }
85
+ async introspect() {
86
+ if (!this._neonDb) {
87
+ throw new MantaError('INVALID_STATE', 'Database not initialized. Call initialize() first.');
88
+ }
89
+ return this._neonDb.rawSql(`
90
+ SELECT table_name, column_name, data_type, is_nullable
91
+ FROM information_schema.columns
92
+ WHERE table_schema = 'public'
93
+ ORDER BY table_name, ordinal_position
94
+ `);
95
+ }
96
+ }
97
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,6EAA6E;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEjD;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACrB,OAAO,GAAwB,IAAI,CAAA;IACnC,SAAS,GAAG,KAAK,CAAA;IAEzB,KAAK,CAAC,UAAU,CAAC,MAAsB;QACrC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,IAAI,UAAU,CAAC,eAAe,EAAE,2BAA2B,CAAC,CAAA;QACpE,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,sCAAsC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;QAC7F,IAAI,CAAC,OAAO,GAAG,MAAM,kBAAkB,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,CAAA;QAC5D,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAA;IACjD,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;YAC1B,IAAI,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C7F,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IACjC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,UAAU,CAAC,eAAe,EAAE,oDAAoD,CAAC,CAAA;QAC7F,CAAC;QACD,sFAAsF;QACtF,0DAA0D;QAC1D,gDAAgD;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;IAC1B,CAAC;IAED,KAAK,CAAC,WAAW,CAAI,EAA+B,EAAE,QAA6B;QACjF,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,EAAsE,CAAA;QAC/F,OAAO,MAAM,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YACvC,OAAO,MAAM,EAAE,CAAC,EAAE,CAAC,CAAA;QACrB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAA8B,KAAa,EAAE,MAAkB;QACtE,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,UAAU,CAAC,eAAe,EAAE,qCAAqC,CAAC,CAAA;QAC/F,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAiB,CAAA;IAC3D,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,UAAU,CAAC,eAAe,EAAE,oDAAoD,CAAC,CAAA;QAC7F,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;;;;;KAK1B,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -0,0 +1,37 @@
1
+ import { drizzle as drizzleNeonHttp } from 'drizzle-orm/neon-http';
2
+ import type { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
3
+ export interface NeonDatabaseOptions {
4
+ /** Connection string (postgresql://...) */
5
+ url: string;
6
+ }
7
+ export interface NeonDatabase {
8
+ /** Drizzle db instance — use this for all queries. Read-only accessor so the
9
+ * adapter can swap the underlying client after `withSchema()` re-binds it. */
10
+ readonly db: PostgresJsDatabase | ReturnType<typeof drizzleNeonHttp>;
11
+ /** Raw SQL: (query, params) style — for IDatabasePort.raw() */
12
+ rawSql: (query: string, params?: unknown[]) => Promise<unknown>;
13
+ /**
14
+ * Tagged template SQL — for getPool() consumers that use tagged templates
15
+ * (ensureFrameworkTables, ensureEntityTables, NeonLockingAdapter).
16
+ * On Neon HTTP: the neon() function itself (supports both tagged + regular).
17
+ * On postgres.js: the postgres() instance (supports both tagged + .unsafe()).
18
+ */
19
+ pool: unknown;
20
+ /**
21
+ * Rebuild the Drizzle client with the full DML schema. Required to enable
22
+ * `db.query.*` (relational queries with `with` clauses) — without it, graph
23
+ * queries fall back to a dumb `eq()` resolver that treats `{ $eq: x }` as a
24
+ * scalar object, matching nothing.
25
+ */
26
+ withSchema: (schema: Record<string, unknown>) => void;
27
+ /** Close connections */
28
+ close: () => Promise<void>;
29
+ }
30
+ /**
31
+ * Create a Drizzle database instance optimized for the environment.
32
+ *
33
+ * - On Vercel / serverless + Neon: uses HTTP driver (stateless, no WebSocket needed)
34
+ * - On local dev: uses postgres.js (TCP connection)
35
+ */
36
+ export declare function createNeonDatabase(options: NeonDatabaseOptions): Promise<NeonDatabase>;
37
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,YAAY;IAC3B;kFAC8E;IAC9E,QAAQ,CAAC,EAAE,EAAE,kBAAkB,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;IACpE,+DAA+D;IAC/D,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/D;;;;;OAKG;IACH,IAAI,EAAE,OAAO,CAAA;IACb;;;;;OAKG;IACH,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACrD,wBAAwB;IACxB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,CA+D5F"}
@@ -0,0 +1,68 @@
1
+ // Neon connection — uses HTTP driver on Vercel (stateless, no WebSocket needed),
2
+ // postgres.js TCP driver locally.
3
+ import { neon } from '@neondatabase/serverless';
4
+ import { drizzle as drizzleNeonHttp } from 'drizzle-orm/neon-http';
5
+ /**
6
+ * Create a Drizzle database instance optimized for the environment.
7
+ *
8
+ * - On Vercel / serverless + Neon: uses HTTP driver (stateless, no WebSocket needed)
9
+ * - On local dev: uses postgres.js (TCP connection)
10
+ */
11
+ export async function createNeonDatabase(options) {
12
+ const isCloudflare = process.env.MANTA_DEPLOY_PRESET === 'cloudflare' ||
13
+ process.env.NITRO_PRESET === 'cloudflare_module' ||
14
+ !!process.env.CLOUDFLARE ||
15
+ !!process.env.CF_PAGES ||
16
+ !!process.env.WORKERS_CI;
17
+ const isServerless = isCloudflare || !!process.env.VERCEL || !!process.env.AWS_LAMBDA_FUNCTION_NAME;
18
+ const isNeon = options.url.includes('neon.tech') || options.url.includes('neon.');
19
+ // Serverless + Neon → use HTTP driver for everything (no WebSocket dependency)
20
+ if (isServerless && isNeon) {
21
+ const httpSql = neon(options.url);
22
+ // httpSql supports both tagged templates (sql`...`) AND regular calls (sql(query, params)).
23
+ // Add .unsafe() for ensureEntityTables compatibility.
24
+ const pool = Object.assign(httpSql, {
25
+ unsafe: (query, params) => httpSql(query, params ?? []),
26
+ });
27
+ // Schema-less initial client; re-bound by withSchema() once the DML schema is assembled.
28
+ const state = {
29
+ db: drizzleNeonHttp(httpSql),
30
+ };
31
+ return {
32
+ get db() {
33
+ return state.db;
34
+ },
35
+ rawSql: async (query, params) => httpSql(query, params ?? []),
36
+ pool,
37
+ withSchema: (schema) => {
38
+ state.db = drizzleNeonHttp(httpSql, { schema });
39
+ },
40
+ close: async () => { },
41
+ };
42
+ }
43
+ // Local dev or non-Neon → use postgres.js TCP driver
44
+ const [{ drizzle: drizzlePg }, postgresModule] = await Promise.all([
45
+ import('drizzle-orm/postgres-js'),
46
+ import('postgres'),
47
+ ]);
48
+ const postgres = postgresModule.default;
49
+ const pgSql = postgres(options.url, {
50
+ ssl: isNeon ? 'require' : undefined,
51
+ max: isServerless ? 1 : 5,
52
+ idle_timeout: isServerless ? 0 : 30,
53
+ connect_timeout: 5,
54
+ });
55
+ const state = { db: drizzlePg(pgSql) };
56
+ return {
57
+ get db() {
58
+ return state.db;
59
+ },
60
+ rawSql: async (query, params) => pgSql.unsafe(query, (params ?? [])),
61
+ pool: pgSql, // postgres.js supports tagged templates + .unsafe()
62
+ withSchema: (schema) => {
63
+ state.db = drizzlePg(pgSql, { schema });
64
+ },
65
+ close: () => pgSql.end(),
66
+ };
67
+ }
68
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAC/C,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAgClE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA4B;IACnE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AE,CAAC,KAAK,CAAC,GAAG,EAAE;KACzB,CAAA;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { DrizzleRepository, DrizzleRepositoryFactory, DrizzleSchemaGenerator } from '@mantajs/adapter-database-pg';
2
+ export { NeonDrizzleAdapter } from './adapter';
3
+ export type { NeonDatabase, NeonDatabaseOptions } from './connection';
4
+ export { createNeonDatabase } from './connection';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAClH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ // @mantajs/adapter-database-neon — Neon serverless IDatabasePort adapter
2
+ // Re-export Drizzle tools from @mantajs/adapter-database-pg for convenience
3
+ export { DrizzleRepository, DrizzleRepositoryFactory, DrizzleSchemaGenerator } from '@mantajs/adapter-database-pg';
4
+ export { NeonDrizzleAdapter } from './adapter';
5
+ export { createNeonDatabase } from './connection';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,4EAA4E;AAC5E,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAClH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA"}
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@mantajs/adapter-database-neon",
3
+ "version": "0.2.0-beta.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "drizzle-orm": "^0.35.0",
16
+ "postgres": "^3.4.0",
17
+ "@neondatabase/serverless": "^0.10.0"
18
+ },
19
+ "peerDependencies": {
20
+ "@mantajs/core": "0.2.0-beta.0",
21
+ "@mantajs/adapter-database-pg": "0.2.0-beta.0"
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ]
26
+ }