@syncular/dialect-d1 0.0.6-73 → 0.0.6-79
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/README.md +6 -2
- package/dist/index.d.ts +0 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -20
package/README.md
CHANGED
|
@@ -13,9 +13,13 @@ npm install @syncular/dialect-d1
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
-
import {
|
|
16
|
+
import { createDatabase } from '@syncular/core';
|
|
17
|
+
import { createD1Dialect } from '@syncular/dialect-d1';
|
|
17
18
|
|
|
18
|
-
const db =
|
|
19
|
+
const db = createDatabase<MyDb>({
|
|
20
|
+
dialect: createD1Dialect(env.DB),
|
|
21
|
+
family: 'sqlite',
|
|
22
|
+
});
|
|
19
23
|
```
|
|
20
24
|
|
|
21
25
|
## Documentation
|
package/dist/index.d.ts
CHANGED
|
@@ -5,22 +5,7 @@
|
|
|
5
5
|
* SQLite-compatible — use with @syncular/server-dialect-sqlite.
|
|
6
6
|
*/
|
|
7
7
|
import type { D1Database } from '@cloudflare/workers-types';
|
|
8
|
-
import { Kysely } from 'kysely';
|
|
9
8
|
import { D1Dialect } from 'kysely-d1';
|
|
10
|
-
/**
|
|
11
|
-
* Create a Kysely instance with Cloudflare D1 dialect.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* export default {
|
|
15
|
-
* async fetch(request: Request, env: Env) {
|
|
16
|
-
* const db = createD1Db<MyDb>(env.DB);
|
|
17
|
-
* const dialect = createSqliteServerDialect();
|
|
18
|
-
* await ensureSyncSchema(db, dialect);
|
|
19
|
-
* // ...
|
|
20
|
-
* }
|
|
21
|
-
* };
|
|
22
|
-
*/
|
|
23
|
-
export declare function createD1Db<T>(database: D1Database): Kysely<T>;
|
|
24
9
|
/**
|
|
25
10
|
* Create the D1 dialect directly.
|
|
26
11
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,UAAU,GAAG,SAAS,CAE/D"}
|
package/dist/index.js
CHANGED
|
@@ -4,26 +4,7 @@
|
|
|
4
4
|
* Provides a Kysely dialect for Cloudflare D1.
|
|
5
5
|
* SQLite-compatible — use with @syncular/server-dialect-sqlite.
|
|
6
6
|
*/
|
|
7
|
-
import { Kysely } from 'kysely';
|
|
8
7
|
import { D1Dialect } from 'kysely-d1';
|
|
9
|
-
/**
|
|
10
|
-
* Create a Kysely instance with Cloudflare D1 dialect.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* export default {
|
|
14
|
-
* async fetch(request: Request, env: Env) {
|
|
15
|
-
* const db = createD1Db<MyDb>(env.DB);
|
|
16
|
-
* const dialect = createSqliteServerDialect();
|
|
17
|
-
* await ensureSyncSchema(db, dialect);
|
|
18
|
-
* // ...
|
|
19
|
-
* }
|
|
20
|
-
* };
|
|
21
|
-
*/
|
|
22
|
-
export function createD1Db(database) {
|
|
23
|
-
return new Kysely({
|
|
24
|
-
dialect: createD1Dialect(database),
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
8
|
/**
|
|
28
9
|
* Create the D1 dialect directly.
|
|
29
10
|
*/
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,QAAoB,EAAa;IAC/D,OAAO,IAAI,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;AAAA,CACpC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -6,28 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { D1Database } from '@cloudflare/workers-types';
|
|
9
|
-
import { Kysely } from 'kysely';
|
|
10
9
|
import { D1Dialect } from 'kysely-d1';
|
|
11
10
|
|
|
12
|
-
/**
|
|
13
|
-
* Create a Kysely instance with Cloudflare D1 dialect.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* export default {
|
|
17
|
-
* async fetch(request: Request, env: Env) {
|
|
18
|
-
* const db = createD1Db<MyDb>(env.DB);
|
|
19
|
-
* const dialect = createSqliteServerDialect();
|
|
20
|
-
* await ensureSyncSchema(db, dialect);
|
|
21
|
-
* // ...
|
|
22
|
-
* }
|
|
23
|
-
* };
|
|
24
|
-
*/
|
|
25
|
-
export function createD1Db<T>(database: D1Database): Kysely<T> {
|
|
26
|
-
return new Kysely<T>({
|
|
27
|
-
dialect: createD1Dialect(database),
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
11
|
/**
|
|
32
12
|
* Create the D1 dialect directly.
|
|
33
13
|
*/
|