@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.
@@ -308,7 +308,7 @@ class D1Transaction {
308
308
  }
309
309
  return queryAuthoritativeOn(this.#db, this.#partition, this.#prepareQuery(query));
310
310
  }
311
- async lockPartitionForPush() {
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)