@syncular/server 0.43.0 → 0.44.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.
- package/dist/d1-storage.js +8 -1
- package/dist/postgres-storage.js +385 -119
- package/dist/push.d.ts +4 -1
- package/dist/push.js +47 -72
- package/dist/relational-rows.d.ts +9 -5
- package/dist/relational-rows.js +29 -11
- package/dist/sqlite-storage.js +8 -7
- package/dist/storage.d.ts +39 -32
- package/package.json +2 -2
- package/src/d1-storage.ts +18 -2
- package/src/postgres-storage.ts +552 -187
- package/src/push.ts +63 -88
- package/src/relational-rows.ts +31 -10
- package/src/sqlite-storage.ts +25 -16
- package/src/storage.ts +48 -36
package/dist/d1-storage.js
CHANGED
|
@@ -308,7 +308,7 @@ class D1Transaction {
|
|
|
308
308
|
}
|
|
309
309
|
return queryAuthoritativeOn(this.#db, this.#partition, this.#prepareQuery(query));
|
|
310
310
|
}
|
|
311
|
-
async
|
|
311
|
+
async preparePushApply(clientId, clientCommitId, runningSchemaVersion, _targets = []) {
|
|
312
312
|
this.#assertOpen();
|
|
313
313
|
if (!this.#pushApplySerialized) {
|
|
314
314
|
throw new Error('D1 push apply requires externally serialized partition writes');
|
|
@@ -316,6 +316,10 @@ class D1Transaction {
|
|
|
316
316
|
// D1 has no interactive lock. The caller explicitly asserted that every
|
|
317
317
|
// write for this partition is already serialized (normally by its DO).
|
|
318
318
|
this.#pushApplyCheckpoint = this.#buffer.length;
|
|
319
|
+
return {
|
|
320
|
+
gate: await this.readServeGate(runningSchemaVersion),
|
|
321
|
+
persisted: await this.getPushResult(clientId, clientCommitId),
|
|
322
|
+
};
|
|
319
323
|
}
|
|
320
324
|
advanceCheckpoint(_name, _ownerEpoch, _watermark, _observedRows, _nowMs) {
|
|
321
325
|
// D1 installs no fence and declares no checkpoints in this release.
|
|
@@ -345,6 +349,9 @@ class D1Transaction {
|
|
|
345
349
|
this.#applicationOpIndexes.clear();
|
|
346
350
|
await this.putPushResult(clientId, clientCommitId, result);
|
|
347
351
|
await this.commit();
|
|
352
|
+
// The idempotency re-check found no record under the serialized apply, so
|
|
353
|
+
// the insert above is the canonical outcome.
|
|
354
|
+
return result;
|
|
348
355
|
}
|
|
349
356
|
async #assertNoUniqueCollision(table, row, opIndex) {
|
|
350
357
|
if (!table.materialize)
|