@korajs/sync 1.0.0-beta.11 → 1.0.0-beta.12
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/index.cjs +164 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -2
- package/dist/index.d.ts +27 -2
- package/dist/index.js +164 -12
- package/dist/index.js.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/{transport-iXX0KA_W.d.cts → transport-CJvRO5ix.d.cts} +18 -0
- package/dist/{transport-iXX0KA_W.d.ts → transport-CJvRO5ix.d.ts} +18 -0
- package/package.json +3 -3
package/dist/internal.d.cts
CHANGED
|
@@ -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-
|
|
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-CJvRO5ix.cjs';
|
|
2
2
|
import { Operation } from '@korajs/core';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/internal.d.ts
CHANGED
|
@@ -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-
|
|
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-CJvRO5ix.js';
|
|
2
2
|
import { Operation } from '@korajs/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -195,6 +195,8 @@ interface SyncConfig {
|
|
|
195
195
|
querySubsets?: {
|
|
196
196
|
mode?: 'reactive' | 'static' | 'disabled';
|
|
197
197
|
};
|
|
198
|
+
/** Client-local behavior for records leaving the accepted downlink scope. Defaults to `retain`. */
|
|
199
|
+
scopeExit?: 'retain' | 'retract';
|
|
198
200
|
/** Sync scopes per collection. Limits which records sync to this client. */
|
|
199
201
|
scopes?: Record<string, (ctx: SyncScopeContext) => Record<string, unknown>>;
|
|
200
202
|
/**
|
|
@@ -211,6 +213,10 @@ interface SyncConfig {
|
|
|
211
213
|
* Defaults to 30000ms. Set to 0 to disable the watchdog.
|
|
212
214
|
*/
|
|
213
215
|
outboundAckTimeoutMs?: number;
|
|
216
|
+
/** Initial delay before resending a transiently rejected outbound operation. Defaults to 250ms. */
|
|
217
|
+
outboundRetryBaseDelayMs?: number;
|
|
218
|
+
/** Maximum transient-operation retry delay. Defaults to 30000ms. */
|
|
219
|
+
outboundRetryMaxDelayMs?: number;
|
|
214
220
|
/** Initial reconnection delay in ms. Defaults to 1000. */
|
|
215
221
|
reconnectInterval?: number;
|
|
216
222
|
/** Maximum reconnection delay in ms. Defaults to 30000. */
|
|
@@ -423,6 +429,8 @@ interface HandshakeMessage {
|
|
|
423
429
|
* cursor for the server->client direction. Optional, so old servers ignore it.
|
|
424
430
|
*/
|
|
425
431
|
lastDeliverySequence?: number;
|
|
432
|
+
/** Opt in to client-local removal when records leave the accepted downlink view. */
|
|
433
|
+
scopeExitPolicy?: 'retain' | 'retract';
|
|
426
434
|
}
|
|
427
435
|
/**
|
|
428
436
|
* Server response to a handshake.
|
|
@@ -442,6 +450,10 @@ interface HandshakeResponseMessage {
|
|
|
442
450
|
selectedWireFormat?: WireFormat;
|
|
443
451
|
/** The server-accepted per-collection sync scope. Confirms what data will be synced. */
|
|
444
452
|
acceptedScope?: Record<string, Record<string, unknown>>;
|
|
453
|
+
/** Server-authoritative scope for records delivered to this client. */
|
|
454
|
+
acceptedDownlinkScopes?: Record<string, Record<string, unknown>>;
|
|
455
|
+
/** Server-authoritative scope for operations uploaded by this client. */
|
|
456
|
+
acceptedUplinkScopes?: Record<string, Record<string, unknown>>;
|
|
445
457
|
/** Server wall-clock time (ms since epoch) at response creation. Lets clients measure their own clock skew. */
|
|
446
458
|
serverTime?: number;
|
|
447
459
|
/**
|
|
@@ -465,6 +477,8 @@ interface OperationBatchMessage {
|
|
|
465
477
|
type: 'operation-batch';
|
|
466
478
|
messageId: string;
|
|
467
479
|
operations: SerializedOperation[];
|
|
480
|
+
/** Client-local authorization removals; these are never domain delete operations. */
|
|
481
|
+
retractions?: ScopeRetraction[];
|
|
468
482
|
/** True if this is the last batch in the delta exchange phase */
|
|
469
483
|
isFinal: boolean;
|
|
470
484
|
/** Index of this batch (0-based) for ordering */
|
|
@@ -488,6 +502,10 @@ interface OperationBatchMessage {
|
|
|
488
502
|
baseDeliverySequence?: number;
|
|
489
503
|
maxDeliverySequence?: number;
|
|
490
504
|
}
|
|
505
|
+
interface ScopeRetraction {
|
|
506
|
+
collection: string;
|
|
507
|
+
recordId: string;
|
|
508
|
+
}
|
|
491
509
|
/**
|
|
492
510
|
* Acknowledgment of a received message.
|
|
493
511
|
*/
|
|
@@ -195,6 +195,8 @@ interface SyncConfig {
|
|
|
195
195
|
querySubsets?: {
|
|
196
196
|
mode?: 'reactive' | 'static' | 'disabled';
|
|
197
197
|
};
|
|
198
|
+
/** Client-local behavior for records leaving the accepted downlink scope. Defaults to `retain`. */
|
|
199
|
+
scopeExit?: 'retain' | 'retract';
|
|
198
200
|
/** Sync scopes per collection. Limits which records sync to this client. */
|
|
199
201
|
scopes?: Record<string, (ctx: SyncScopeContext) => Record<string, unknown>>;
|
|
200
202
|
/**
|
|
@@ -211,6 +213,10 @@ interface SyncConfig {
|
|
|
211
213
|
* Defaults to 30000ms. Set to 0 to disable the watchdog.
|
|
212
214
|
*/
|
|
213
215
|
outboundAckTimeoutMs?: number;
|
|
216
|
+
/** Initial delay before resending a transiently rejected outbound operation. Defaults to 250ms. */
|
|
217
|
+
outboundRetryBaseDelayMs?: number;
|
|
218
|
+
/** Maximum transient-operation retry delay. Defaults to 30000ms. */
|
|
219
|
+
outboundRetryMaxDelayMs?: number;
|
|
214
220
|
/** Initial reconnection delay in ms. Defaults to 1000. */
|
|
215
221
|
reconnectInterval?: number;
|
|
216
222
|
/** Maximum reconnection delay in ms. Defaults to 30000. */
|
|
@@ -423,6 +429,8 @@ interface HandshakeMessage {
|
|
|
423
429
|
* cursor for the server->client direction. Optional, so old servers ignore it.
|
|
424
430
|
*/
|
|
425
431
|
lastDeliverySequence?: number;
|
|
432
|
+
/** Opt in to client-local removal when records leave the accepted downlink view. */
|
|
433
|
+
scopeExitPolicy?: 'retain' | 'retract';
|
|
426
434
|
}
|
|
427
435
|
/**
|
|
428
436
|
* Server response to a handshake.
|
|
@@ -442,6 +450,10 @@ interface HandshakeResponseMessage {
|
|
|
442
450
|
selectedWireFormat?: WireFormat;
|
|
443
451
|
/** The server-accepted per-collection sync scope. Confirms what data will be synced. */
|
|
444
452
|
acceptedScope?: Record<string, Record<string, unknown>>;
|
|
453
|
+
/** Server-authoritative scope for records delivered to this client. */
|
|
454
|
+
acceptedDownlinkScopes?: Record<string, Record<string, unknown>>;
|
|
455
|
+
/** Server-authoritative scope for operations uploaded by this client. */
|
|
456
|
+
acceptedUplinkScopes?: Record<string, Record<string, unknown>>;
|
|
445
457
|
/** Server wall-clock time (ms since epoch) at response creation. Lets clients measure their own clock skew. */
|
|
446
458
|
serverTime?: number;
|
|
447
459
|
/**
|
|
@@ -465,6 +477,8 @@ interface OperationBatchMessage {
|
|
|
465
477
|
type: 'operation-batch';
|
|
466
478
|
messageId: string;
|
|
467
479
|
operations: SerializedOperation[];
|
|
480
|
+
/** Client-local authorization removals; these are never domain delete operations. */
|
|
481
|
+
retractions?: ScopeRetraction[];
|
|
468
482
|
/** True if this is the last batch in the delta exchange phase */
|
|
469
483
|
isFinal: boolean;
|
|
470
484
|
/** Index of this batch (0-based) for ordering */
|
|
@@ -488,6 +502,10 @@ interface OperationBatchMessage {
|
|
|
488
502
|
baseDeliverySequence?: number;
|
|
489
503
|
maxDeliverySequence?: number;
|
|
490
504
|
}
|
|
505
|
+
interface ScopeRetraction {
|
|
506
|
+
collection: string;
|
|
507
|
+
recordId: string;
|
|
508
|
+
}
|
|
491
509
|
/**
|
|
492
510
|
* Acknowledgment of a received message.
|
|
493
511
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@korajs/sync",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.12",
|
|
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",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"protobufjs": "^8.0.1",
|
|
37
|
-
"@korajs/core": "1.0.0-beta.
|
|
38
|
-
"@korajs/merge": "1.0.0-beta.
|
|
37
|
+
"@korajs/core": "1.0.0-beta.12",
|
|
38
|
+
"@korajs/merge": "1.0.0-beta.12"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@fast-check/vitest": "0.2.0",
|