@syncular/dialect-neon 0.0.1-100
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/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
- package/src/index.ts +45 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @syncular/dialect-neon - Neon serverless Postgres dialect for sync
|
|
3
|
+
*
|
|
4
|
+
* Provides a Kysely dialect for Neon serverless Postgres (HTTP).
|
|
5
|
+
* Postgres-compatible — use with @syncular/server-dialect-postgres.
|
|
6
|
+
*
|
|
7
|
+
* Note: Uses Neon's HTTP driver for stateless queries — ideal for
|
|
8
|
+
* serverless/edge environments. Does not support interactive transactions.
|
|
9
|
+
* For transaction support, use Neon's WebSocket pool with Kysely's
|
|
10
|
+
* built-in PostgresDialect instead.
|
|
11
|
+
*/
|
|
12
|
+
import { Kysely } from 'kysely';
|
|
13
|
+
import { NeonDialect } from 'kysely-neon';
|
|
14
|
+
export interface NeonOptions {
|
|
15
|
+
/** Neon Postgres connection string */
|
|
16
|
+
connectionString: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a Kysely instance with Neon serverless Postgres dialect.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const db = createNeonDb<MyDb>({
|
|
23
|
+
* connectionString: process.env.DATABASE_URL!,
|
|
24
|
+
* });
|
|
25
|
+
* const dialect = createPostgresServerDialect();
|
|
26
|
+
* await ensureSyncSchema(db, dialect);
|
|
27
|
+
*/
|
|
28
|
+
export declare function createNeonDb<T>(options: NeonOptions): Kysely<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Create the Neon dialect directly.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createNeonDialect(options: NeonOptions): NeonDialect;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAI/D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,CAInE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @syncular/dialect-neon - Neon serverless Postgres dialect for sync
|
|
3
|
+
*
|
|
4
|
+
* Provides a Kysely dialect for Neon serverless Postgres (HTTP).
|
|
5
|
+
* Postgres-compatible — use with @syncular/server-dialect-postgres.
|
|
6
|
+
*
|
|
7
|
+
* Note: Uses Neon's HTTP driver for stateless queries — ideal for
|
|
8
|
+
* serverless/edge environments. Does not support interactive transactions.
|
|
9
|
+
* For transaction support, use Neon's WebSocket pool with Kysely's
|
|
10
|
+
* built-in PostgresDialect instead.
|
|
11
|
+
*/
|
|
12
|
+
import { neon } from '@neondatabase/serverless';
|
|
13
|
+
import { Kysely } from 'kysely';
|
|
14
|
+
import { NeonDialect } from 'kysely-neon';
|
|
15
|
+
/**
|
|
16
|
+
* Create a Kysely instance with Neon serverless Postgres dialect.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const db = createNeonDb<MyDb>({
|
|
20
|
+
* connectionString: process.env.DATABASE_URL!,
|
|
21
|
+
* });
|
|
22
|
+
* const dialect = createPostgresServerDialect();
|
|
23
|
+
* await ensureSyncSchema(db, dialect);
|
|
24
|
+
*/
|
|
25
|
+
export function createNeonDb(options) {
|
|
26
|
+
return new Kysely({
|
|
27
|
+
dialect: createNeonDialect(options),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create the Neon dialect directly.
|
|
32
|
+
*/
|
|
33
|
+
export function createNeonDialect(options) {
|
|
34
|
+
return new NeonDialect({
|
|
35
|
+
neon: neon(options.connectionString),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAI,OAAoB,EAAa;IAC/D,OAAO,IAAI,MAAM,CAAI;QACnB,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC;KACpC,CAAC,CAAC;AAAA,CACJ;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAoB,EAAe;IACnE,OAAO,IAAI,WAAW,CAAC;QACrB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;KACrC,CAAC,CAAC;AAAA,CACJ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@syncular/dialect-neon",
|
|
3
|
+
"version": "0.0.1-100",
|
|
4
|
+
"description": "Neon serverless Postgres dialect for the Syncular client",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Benjamin Kniffler",
|
|
7
|
+
"homepage": "https://syncular.dev",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/syncular/syncular.git",
|
|
11
|
+
"directory": "packages/dialect-neon"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/syncular/syncular/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"sync",
|
|
18
|
+
"offline-first",
|
|
19
|
+
"realtime",
|
|
20
|
+
"database",
|
|
21
|
+
"typescript",
|
|
22
|
+
"neon",
|
|
23
|
+
"postgres",
|
|
24
|
+
"serverless"
|
|
25
|
+
],
|
|
26
|
+
"private": false,
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"type": "module",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"bun": "./src/index.ts",
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"tsgo": "tsgo --noEmit",
|
|
42
|
+
"build": "tsgo",
|
|
43
|
+
"release": "bunx syncular-publish"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@neondatabase/serverless": "^1.0.2",
|
|
47
|
+
"kysely-neon": "^2.0.2"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"kysely": "^0.28.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@syncular/config": "0.0.0",
|
|
54
|
+
"kysely": "*"
|
|
55
|
+
},
|
|
56
|
+
"files": [
|
|
57
|
+
"dist",
|
|
58
|
+
"src"
|
|
59
|
+
]
|
|
60
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @syncular/dialect-neon - Neon serverless Postgres dialect for sync
|
|
3
|
+
*
|
|
4
|
+
* Provides a Kysely dialect for Neon serverless Postgres (HTTP).
|
|
5
|
+
* Postgres-compatible — use with @syncular/server-dialect-postgres.
|
|
6
|
+
*
|
|
7
|
+
* Note: Uses Neon's HTTP driver for stateless queries — ideal for
|
|
8
|
+
* serverless/edge environments. Does not support interactive transactions.
|
|
9
|
+
* For transaction support, use Neon's WebSocket pool with Kysely's
|
|
10
|
+
* built-in PostgresDialect instead.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { neon } from '@neondatabase/serverless';
|
|
14
|
+
import { Kysely } from 'kysely';
|
|
15
|
+
import { NeonDialect } from 'kysely-neon';
|
|
16
|
+
|
|
17
|
+
export interface NeonOptions {
|
|
18
|
+
/** Neon Postgres connection string */
|
|
19
|
+
connectionString: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Create a Kysely instance with Neon serverless Postgres dialect.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const db = createNeonDb<MyDb>({
|
|
27
|
+
* connectionString: process.env.DATABASE_URL!,
|
|
28
|
+
* });
|
|
29
|
+
* const dialect = createPostgresServerDialect();
|
|
30
|
+
* await ensureSyncSchema(db, dialect);
|
|
31
|
+
*/
|
|
32
|
+
export function createNeonDb<T>(options: NeonOptions): Kysely<T> {
|
|
33
|
+
return new Kysely<T>({
|
|
34
|
+
dialect: createNeonDialect(options),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create the Neon dialect directly.
|
|
40
|
+
*/
|
|
41
|
+
export function createNeonDialect(options: NeonOptions): NeonDialect {
|
|
42
|
+
return new NeonDialect({
|
|
43
|
+
neon: neon(options.connectionString),
|
|
44
|
+
});
|
|
45
|
+
}
|