@recordtimelabel/core 0.6.12 → 0.6.13

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
@@ -17,10 +17,10 @@ During local development an app can consume a sibling checkout with:
17
17
  "@recordtimelabel/core": "file:../recordtimelabel-core"
18
18
  ```
19
19
 
20
- For release builds, consume a fixed npm package, git tag, or private registry version so builds do not depend on a sibling folder path. The release target is `0.6.12`; verify that its registry tarball and lockfile integrity are available before updating consumers:
20
+ For release builds, consume a fixed npm package, git tag, or private registry version so builds do not depend on a sibling folder path. The release target is `0.6.13`; verify that its registry tarball and lockfile integrity are available before updating consumers:
21
21
 
22
22
  ```json
23
- "@recordtimelabel/core": "0.6.12"
23
+ "@recordtimelabel/core": "0.6.13"
24
24
  ```
25
25
 
26
26
  If this checkout's `package.json` is ahead of the published version, publish the new package before updating consumers to that version.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recordtimelabel/core",
3
- "version": "0.6.12",
3
+ "version": "0.6.13",
4
4
  "type": "module",
5
5
  "description": "Shared RecordTimeLabel data model, merge logic, operations, and sync engine.",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -147,7 +147,7 @@ export {
147
147
  selectBestMatchingTwitchVod
148
148
  };
149
149
 
150
- export const RECORD_TIMELABEL_CORE_VERSION = '0.6.12';
150
+ export const RECORD_TIMELABEL_CORE_VERSION = '0.6.13';
151
151
  export const RTL_SYNC_PROTOCOL_VERSION = 2;
152
152
  export const RECORD_TIMELABEL_DURABLE_ENGINE_CAPABILITIES = Object.freeze([
153
153
  'fifo-retry-fence',
@@ -5412,6 +5412,21 @@ export const createRecordTimeLabelSyncEngine = ({
5412
5412
  latestRootObservationRevision ?? 0,
5413
5413
  observedRevision
5414
5414
  );
5415
+ // A successful root callback has already processed (or proven) this
5416
+ // revision. Prefer that proof over an adapter-ready receipt that may
5417
+ // have resolved earlier with an older revision.
5418
+ const currentRevision = Number(adapterCatchUpProof?.revision);
5419
+ const currentCaughtUp = Number(adapterCatchUpProof?.caughtUpToRevision);
5420
+ adapterCatchUpProof = {
5421
+ ...(adapterCatchUpProof || {}),
5422
+ success: true,
5423
+ revision: Number.isSafeInteger(currentRevision)
5424
+ ? Math.max(currentRevision, observedRevision)
5425
+ : observedRevision,
5426
+ caughtUpToRevision: Number.isSafeInteger(currentCaughtUp)
5427
+ ? Math.max(currentCaughtUp, observedRevision)
5428
+ : observedRevision
5429
+ };
5415
5430
  }
5416
5431
  if (!adapterReadyExpected) {
5417
5432
  adapterCatchUpProof = {
@@ -5483,9 +5498,20 @@ export const createRecordTimeLabelSyncEngine = ({
5483
5498
  }
5484
5499
  ));
5485
5500
  } else {
5486
- adapterCatchUpProof = result && typeof result === 'object'
5501
+ const nextProof = result && typeof result === 'object'
5487
5502
  ? {...result, success: true}
5488
5503
  : {success: true};
5504
+ const currentRevision = Number(adapterCatchUpProof?.revision);
5505
+ const currentCaughtUp = Number(adapterCatchUpProof?.caughtUpToRevision);
5506
+ adapterCatchUpProof = {
5507
+ ...nextProof,
5508
+ ...(Number.isSafeInteger(currentRevision) && Number.isSafeInteger(Number(nextProof.revision))
5509
+ ? {revision: Math.max(currentRevision, Number(nextProof.revision))}
5510
+ : {}),
5511
+ ...(Number.isSafeInteger(currentCaughtUp) && Number.isSafeInteger(Number(nextProof.caughtUpToRevision))
5512
+ ? {caughtUpToRevision: Math.max(currentCaughtUp, Number(nextProof.caughtUpToRevision))}
5513
+ : {})
5514
+ };
5489
5515
  settleReadyIfProven();
5490
5516
  }
5491
5517
  }).catch((error) => {