@syncular/server-workers 0.15.44 → 0.15.46

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @syncular/server-workers
2
2
 
3
- The Cloudflare Workers entry for the Syncular sync server (TODO §4.2). It
3
+ The Cloudflare Workers entry for the Syncular sync server. It
4
4
  wires the runtime-neutral server core to Workers bindings — **D1** for
5
5
  storage, **R2** for durable segment/blob bytes, secrets for signing and
6
6
  auth — behind a standard Workers module `fetch` handler.
@@ -113,7 +113,9 @@ wrangler d1 migrations apply syncular
113
113
 
114
114
  The schema is plain SQLite DDL (shared with `bun:sqlite` via
115
115
  `sqlite-dialect.ts`), so it is portable across the two SQLite-family
116
- storages.
116
+ storages. Regenerate and apply a migration when upgrading Syncular adds a core
117
+ table. The durable reaction queue uses `sync_reactions`; a Worker running a
118
+ reaction planner or runner fails closed if that migration is absent.
117
119
 
118
120
  ## Storage: D1 (`D1ServerStorage`)
119
121
 
@@ -129,6 +131,19 @@ immediately (autocommit) and **buffers** writes, flushing them as one atomic
129
131
  rolls back by never flushing). A read-your-own-writes overlay makes `getRow`
130
132
  see buffered writes of the same commit.
131
133
 
134
+ Durable reactions use the same model. Planned rows join the source commit's
135
+ atomic batch. `ReactionRunner` claims due rows with one
136
+ `UPDATE ... RETURNING` statement, so concurrent Workers have no select/update
137
+ gap. Reaction handlers execute outside the source transaction. Run the runner
138
+ from a Worker scheduler, queue consumer, Workflow step, or Durable Object
139
+ alarm according to the application's hosting model.
140
+
141
+ Schedule `pruneReactions` per partition as a separate maintenance pass.
142
+ Defaults retain completed rows for 30 days and dead-lettered rows for 90 days,
143
+ with at most 1,000 deletions per pass. Repeat while `mayHaveMore` is true.
144
+ Pending and leased rows are never eligible. D1 executes each bounded cleanup
145
+ as one `DELETE ... RETURNING` statement.
146
+
132
147
  **Concurrency posture.** Every push, not only whole-commit validation, must
133
148
  serialize before operation reads and re-check idempotency under that boundary.
134
149
  `createWorkersFetchHandler` forwards `/sync` to one DO per authenticated
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@syncular/server-workers` — the Cloudflare Workers entry (TODO §4.2).
2
+ * `@syncular/server-workers` — the Cloudflare Workers entry.
3
3
  *
4
4
  * This is deliberately thin. `createSyncularHono` (server-hono) is already
5
5
  * Workers-native: it routes with Hono (which runs unmodified on `workerd`)
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@syncular/server-workers` — the Cloudflare Workers entry (TODO §4.2).
2
+ * `@syncular/server-workers` — the Cloudflare Workers entry.
3
3
  *
4
4
  * This is deliberately thin. `createSyncularHono` (server-hono) is already
5
5
  * Workers-native: it routes with Hono (which runs unmodified on `workerd`)
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * `SyncularRealtimeDO` — the Cloudflare Durable Object realtime host (§8, the
3
- * second binding of §1.1). ROADMAP block 2: the designed-but-deferred half of
3
+ * second binding of §1.1). The deferred half of
4
4
  * the Workers deployment matrix, now built.
5
5
  *
6
6
  * ## The shape
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * `SyncularRealtimeDO` — the Cloudflare Durable Object realtime host (§8, the
3
- * second binding of §1.1). ROADMAP block 2: the designed-but-deferred half of
3
+ * second binding of §1.1). The deferred half of
4
4
  * the Workers deployment matrix, now built.
5
5
  *
6
6
  * ## The shape
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/server-workers",
3
- "version": "0.15.44",
3
+ "version": "0.15.46",
4
4
  "description": "Cloudflare Workers adapter for the Syncular sync server",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Benjamin Kniffler",
@@ -45,11 +45,10 @@
45
45
  "!dist/**/*.test.d.ts"
46
46
  ],
47
47
  "dependencies": {
48
- "@syncular/server": "0.15.44",
49
- "@syncular/server-hono": "0.15.44",
50
- "hono": "^4.11.0"
48
+ "@syncular/server": "0.15.46",
49
+ "@syncular/server-hono": "0.15.46"
51
50
  },
52
51
  "devDependencies": {
53
- "@syncular/core": "0.15.44"
52
+ "@syncular/core": "0.15.46"
54
53
  }
55
54
  }
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@syncular/server-workers` — the Cloudflare Workers entry (TODO §4.2).
2
+ * `@syncular/server-workers` — the Cloudflare Workers entry.
3
3
  *
4
4
  * This is deliberately thin. `createSyncularHono` (server-hono) is already
5
5
  * Workers-native: it routes with Hono (which runs unmodified on `workerd`)
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * `SyncularRealtimeDO` — the Cloudflare Durable Object realtime host (§8, the
3
- * second binding of §1.1). ROADMAP block 2: the designed-but-deferred half of
3
+ * second binding of §1.1). The deferred half of
4
4
  * the Workers deployment matrix, now built.
5
5
  *
6
6
  * ## The shape