@korajs/sync 0.6.1 → 1.0.0-beta.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.
@@ -1,4 +1,4 @@
1
- import { c as SyncTransport, T as TransportOptions, a as SyncMessage, d as TransportMessageHandler, e as TransportCloseHandler, f as TransportErrorHandler, Q as QueueStorage } from './transport-BrdBj7rH.cjs';
1
+ import { c as SyncTransport, T as TransportOptions, a as SyncMessage, d as TransportMessageHandler, e as TransportCloseHandler, f as TransportErrorHandler, Q as QueueStorage } from './transport-BMesMB6s.cjs';
2
2
  import { Operation } from '@korajs/core';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { c as SyncTransport, T as TransportOptions, a as SyncMessage, d as TransportMessageHandler, e as TransportCloseHandler, f as TransportErrorHandler, Q as QueueStorage } from './transport-BrdBj7rH.js';
1
+ import { c as SyncTransport, T as TransportOptions, a as SyncMessage, d as TransportMessageHandler, e as TransportCloseHandler, f as TransportErrorHandler, Q as QueueStorage } from './transport-BMesMB6s.js';
2
2
  import { Operation } from '@korajs/core';
3
3
 
4
4
  /**
@@ -93,7 +93,7 @@ type SyncState = (typeof SYNC_STATES)[number];
93
93
  /**
94
94
  * Developer-facing sync status. Simplified view of the internal state.
95
95
  */
96
- declare const SYNC_STATUSES: readonly ["connected", "syncing", "synced", "offline", "error", "schema-mismatch"];
96
+ declare const SYNC_STATUSES: readonly ["connected", "syncing", "synced", "offline", "clock-error", "error", "schema-mismatch"];
97
97
  type SyncStatus = (typeof SYNC_STATUSES)[number];
98
98
  /**
99
99
  * Sync status information exposed to developers.
@@ -111,6 +111,8 @@ interface SyncStatusInfo {
111
111
  lastSuccessfulPull: number | null;
112
112
  /** Number of merge conflicts encountered during this session */
113
113
  conflicts: number;
114
+ /** serverTime - localTime in ms measured at the last handshake, or null before first connect. Negative = this device's clock is fast. */
115
+ clockSkewMs: number | null;
114
116
  }
115
117
  /**
116
118
  * Per-collection sync scope map. Maps collection names to field-value filters.
@@ -303,6 +305,8 @@ interface HandshakeResponseMessage {
303
305
  selectedWireFormat?: WireFormat;
304
306
  /** The server-accepted per-collection sync scope. Confirms what data will be synced. */
305
307
  acceptedScope?: Record<string, Record<string, unknown>>;
308
+ /** Server wall-clock time (ms since epoch) at response creation. Lets clients measure their own clock skew. */
309
+ serverTime?: number;
306
310
  }
307
311
  /**
308
312
  * Batch of operations sent during delta exchange or streaming.
@@ -93,7 +93,7 @@ type SyncState = (typeof SYNC_STATES)[number];
93
93
  /**
94
94
  * Developer-facing sync status. Simplified view of the internal state.
95
95
  */
96
- declare const SYNC_STATUSES: readonly ["connected", "syncing", "synced", "offline", "error", "schema-mismatch"];
96
+ declare const SYNC_STATUSES: readonly ["connected", "syncing", "synced", "offline", "clock-error", "error", "schema-mismatch"];
97
97
  type SyncStatus = (typeof SYNC_STATUSES)[number];
98
98
  /**
99
99
  * Sync status information exposed to developers.
@@ -111,6 +111,8 @@ interface SyncStatusInfo {
111
111
  lastSuccessfulPull: number | null;
112
112
  /** Number of merge conflicts encountered during this session */
113
113
  conflicts: number;
114
+ /** serverTime - localTime in ms measured at the last handshake, or null before first connect. Negative = this device's clock is fast. */
115
+ clockSkewMs: number | null;
114
116
  }
115
117
  /**
116
118
  * Per-collection sync scope map. Maps collection names to field-value filters.
@@ -303,6 +305,8 @@ interface HandshakeResponseMessage {
303
305
  selectedWireFormat?: WireFormat;
304
306
  /** The server-accepted per-collection sync scope. Confirms what data will be synced. */
305
307
  acceptedScope?: Record<string, Record<string, unknown>>;
308
+ /** Server wall-clock time (ms since epoch) at response creation. Lets clients measure their own clock skew. */
309
+ serverTime?: number;
306
310
  }
307
311
  /**
308
312
  * Batch of operations sent during delta exchange or streaming.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@korajs/sync",
3
- "version": "0.6.1",
3
+ "version": "1.0.0-beta.0",
4
4
  "description": "Sync protocol and transports for Kora.js with delta sync, causal ordering, and automatic reconnection",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -33,8 +33,8 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "protobufjs": "^8.0.1",
36
- "@korajs/merge": "0.6.0",
37
- "@korajs/core": "0.6.0"
36
+ "@korajs/merge": "1.0.0-beta.0",
37
+ "@korajs/core": "1.0.0-beta.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@fast-check/vitest": "0.2.0",