@sqlite-sync/cloudflare 0.3.0 → 0.4.1

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -0
  3. package/package.json +5 -5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sqlite-sync contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @sqlite-sync/cloudflare
2
+
3
+ Cloudflare backend utilities for [sqlite-sync](https://github.com/krolebord-dev/sqlite-sync) — a local-first SQLite sync engine for web apps, with reactive queries, offline persistence, and CRDT-based replication.
4
+
5
+ This package provides a Durable Object adapter and execution helpers for running the sync backend on Cloudflare, so clients built with [`@sqlite-sync/core`](https://www.npmjs.com/package/@sqlite-sync/core) can sync CRDT event batches with a remote server.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add @sqlite-sync/cloudflare
11
+ ```
12
+
13
+ ## Quick start
14
+
15
+ ```ts
16
+ // event-log-server.ts
17
+ import { durableObjectAdapter, type RemoteHandler } from "@sqlite-sync/cloudflare";
18
+ import { type Connection, routePartykitRequest, Server } from "partyserver";
19
+ import { syncDbSchema } from "../src/db-schema";
20
+
21
+ export class EventLogServer extends Server<Env> {
22
+ private remoteHandler!: RemoteHandler;
23
+
24
+ onStart() {
25
+ const { remoteHandler } = durableObjectAdapter.createCrdtStorage({
26
+ storage: this.ctx.storage,
27
+ nodeId: this.ctx.id.toString(),
28
+ syncDbSchema,
29
+ crdtEventsTable: "crdt_events",
30
+ batchSize: 100,
31
+ broadcastPayload: (payload) => this.broadcast(payload),
32
+ });
33
+ this.remoteHandler = remoteHandler;
34
+ }
35
+
36
+ onMessage(connection: Connection, message: string) {
37
+ const result = this.remoteHandler.handleMessage(message);
38
+ if (result.success) {
39
+ connection.send(result.payload);
40
+ }
41
+ }
42
+ }
43
+
44
+ export default {
45
+ fetch: (request: Request, env: Env) =>
46
+ routePartykitRequest(request, env).then(
47
+ (res) => res || new Response("Not Found", { status: 404 }),
48
+ ),
49
+ } satisfies ExportedHandler<Env>;
50
+ ```
51
+
52
+ ## Documentation
53
+
54
+ See the [full documentation](https://github.com/krolebord-dev/sqlite-sync/blob/main/docs.md) and the [project README](https://github.com/krolebord-dev/sqlite-sync) for how sync works and client setup.
55
+
56
+ ## License
57
+
58
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sqlite-sync/cloudflare",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Cloudflare utilities for @sqlite-sync/core",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,17 +30,17 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@sqlite-sync/core": "0.3.0"
33
+ "@sqlite-sync/core": "0.4.1"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@cloudflare/workers-types": "^4.0.0",
37
- "kysely": "^0.28.0"
37
+ "kysely": "^0.28.0 || ^0.29.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@cloudflare/workers-types": "^4.20260124.0",
40
+ "@cloudflare/workers-types": "^4.20260609.1",
41
41
  "kysely": "^0.28.10",
42
42
  "tsup": "^8.3.5",
43
- "typescript": "~5.9.3"
43
+ "typescript": "~6.0.3"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsup",