@korajs/server 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 +216 -53
- 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 +216 -53
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -314,6 +314,10 @@ interface ServerMetricsSnapshot {
|
|
|
314
314
|
peakConnections: number;
|
|
315
315
|
connectionsTotal: number;
|
|
316
316
|
operationsReceived: number;
|
|
317
|
+
batchesReceived: number;
|
|
318
|
+
uniqueOperationsReceived: number;
|
|
319
|
+
duplicateOperationsReceived: number;
|
|
320
|
+
rejectedOperations: number;
|
|
317
321
|
operationsSent: number;
|
|
318
322
|
bytesReceived: number;
|
|
319
323
|
bytesSent: number;
|
|
@@ -332,6 +336,10 @@ interface ClientMetrics {
|
|
|
332
336
|
state: SessionState$1;
|
|
333
337
|
connectedAt: number;
|
|
334
338
|
operationsReceived: number;
|
|
339
|
+
batchesReceived: number;
|
|
340
|
+
uniqueOperationsReceived: number;
|
|
341
|
+
duplicateOperationsReceived: number;
|
|
342
|
+
rejectedOperations: number;
|
|
335
343
|
operationsSent: number;
|
|
336
344
|
authContext: AuthContext | null;
|
|
337
345
|
}
|
|
@@ -340,6 +348,10 @@ declare class ServerMetricsCollector {
|
|
|
340
348
|
private peakConnections;
|
|
341
349
|
private connectionsTotal;
|
|
342
350
|
private operationsReceived;
|
|
351
|
+
private batchesReceived;
|
|
352
|
+
private uniqueOperationsReceived;
|
|
353
|
+
private duplicateOperationsReceived;
|
|
354
|
+
private rejectedOperations;
|
|
343
355
|
private operationsSent;
|
|
344
356
|
private bytesReceived;
|
|
345
357
|
private bytesSent;
|
|
@@ -357,7 +369,11 @@ declare class ServerMetricsCollector {
|
|
|
357
369
|
/** Record authentication context for a session. */
|
|
358
370
|
recordAuth(sessionId: string, authContext: AuthContext | null): void;
|
|
359
371
|
/** Record operations received from a client. */
|
|
360
|
-
recordReceived(sessionId: string, count: number, byteSize: number
|
|
372
|
+
recordReceived(sessionId: string, count: number, byteSize: number, outcomes?: {
|
|
373
|
+
unique: number;
|
|
374
|
+
duplicates: number;
|
|
375
|
+
rejected: number;
|
|
376
|
+
}): void;
|
|
361
377
|
/** Record operations sent to a client. */
|
|
362
378
|
recordSent(sessionId: string, count: number, byteSize: number): void;
|
|
363
379
|
/** Record an error. */
|
|
@@ -798,6 +814,10 @@ interface AuthContext {
|
|
|
798
814
|
userId: string;
|
|
799
815
|
/** Per-collection sync scopes (optional) */
|
|
800
816
|
scopes?: Record<string, Record<string, unknown>>;
|
|
817
|
+
/** Server-authoritative records this session may receive. Overrides `scopes`. */
|
|
818
|
+
downlinkScopes?: Record<string, Record<string, unknown>>;
|
|
819
|
+
/** Server-authoritative records this session may upload. Overrides `scopes`. */
|
|
820
|
+
uplinkScopes?: Record<string, Record<string, unknown>>;
|
|
801
821
|
/** Arbitrary metadata about the authenticated user */
|
|
802
822
|
metadata?: Record<string, unknown>;
|
|
803
823
|
}
|
|
@@ -1169,6 +1189,7 @@ declare class ClientSession {
|
|
|
1169
1189
|
private clientNodeId;
|
|
1170
1190
|
private authContext;
|
|
1171
1191
|
private syncQuerySubsets;
|
|
1192
|
+
private scopeExitPolicy;
|
|
1172
1193
|
private resumeDeltaCursor;
|
|
1173
1194
|
/**
|
|
1174
1195
|
* The delivery watermark the client reported at handshake, or null when the client
|
|
@@ -1193,7 +1214,7 @@ declare class ClientSession {
|
|
|
1193
1214
|
* batches every server tick while the first batch is still being applied.
|
|
1194
1215
|
*/
|
|
1195
1216
|
private lastDeliveryPushAttemptAtMs;
|
|
1196
|
-
private
|
|
1217
|
+
private outstandingDelivery;
|
|
1197
1218
|
/** Serializes incremental delivery pushes so their batches never interleave. */
|
|
1198
1219
|
private deliveryPushChain;
|
|
1199
1220
|
/**
|
|
@@ -1264,6 +1285,7 @@ declare class ClientSession {
|
|
|
1264
1285
|
*/
|
|
1265
1286
|
pushDeliveryStreamIfSupported(staleMs?: number, options?: {
|
|
1266
1287
|
trackStall?: boolean;
|
|
1288
|
+
serverFrontier?: number;
|
|
1267
1289
|
}): void;
|
|
1268
1290
|
/**
|
|
1269
1291
|
* Close this session.
|
|
@@ -1322,6 +1344,9 @@ declare class ClientSession {
|
|
|
1322
1344
|
/** Build, track, and send one chained delivery-stream batch. */
|
|
1323
1345
|
private sendDeliveryBatch;
|
|
1324
1346
|
private operationVisibleToClient;
|
|
1347
|
+
/** Upload authorization is independent from the client's downloaded/query view. */
|
|
1348
|
+
private operationAllowedFromClient;
|
|
1349
|
+
private scopeRetractionFor;
|
|
1325
1350
|
/**
|
|
1326
1351
|
* Read a record's current field values from the materialized store for scope /
|
|
1327
1352
|
* query-subset backfill. Includes soft-deleted rows so a relayed delete (whose op
|
package/dist/index.d.ts
CHANGED
|
@@ -314,6 +314,10 @@ interface ServerMetricsSnapshot {
|
|
|
314
314
|
peakConnections: number;
|
|
315
315
|
connectionsTotal: number;
|
|
316
316
|
operationsReceived: number;
|
|
317
|
+
batchesReceived: number;
|
|
318
|
+
uniqueOperationsReceived: number;
|
|
319
|
+
duplicateOperationsReceived: number;
|
|
320
|
+
rejectedOperations: number;
|
|
317
321
|
operationsSent: number;
|
|
318
322
|
bytesReceived: number;
|
|
319
323
|
bytesSent: number;
|
|
@@ -332,6 +336,10 @@ interface ClientMetrics {
|
|
|
332
336
|
state: SessionState$1;
|
|
333
337
|
connectedAt: number;
|
|
334
338
|
operationsReceived: number;
|
|
339
|
+
batchesReceived: number;
|
|
340
|
+
uniqueOperationsReceived: number;
|
|
341
|
+
duplicateOperationsReceived: number;
|
|
342
|
+
rejectedOperations: number;
|
|
335
343
|
operationsSent: number;
|
|
336
344
|
authContext: AuthContext | null;
|
|
337
345
|
}
|
|
@@ -340,6 +348,10 @@ declare class ServerMetricsCollector {
|
|
|
340
348
|
private peakConnections;
|
|
341
349
|
private connectionsTotal;
|
|
342
350
|
private operationsReceived;
|
|
351
|
+
private batchesReceived;
|
|
352
|
+
private uniqueOperationsReceived;
|
|
353
|
+
private duplicateOperationsReceived;
|
|
354
|
+
private rejectedOperations;
|
|
343
355
|
private operationsSent;
|
|
344
356
|
private bytesReceived;
|
|
345
357
|
private bytesSent;
|
|
@@ -357,7 +369,11 @@ declare class ServerMetricsCollector {
|
|
|
357
369
|
/** Record authentication context for a session. */
|
|
358
370
|
recordAuth(sessionId: string, authContext: AuthContext | null): void;
|
|
359
371
|
/** Record operations received from a client. */
|
|
360
|
-
recordReceived(sessionId: string, count: number, byteSize: number
|
|
372
|
+
recordReceived(sessionId: string, count: number, byteSize: number, outcomes?: {
|
|
373
|
+
unique: number;
|
|
374
|
+
duplicates: number;
|
|
375
|
+
rejected: number;
|
|
376
|
+
}): void;
|
|
361
377
|
/** Record operations sent to a client. */
|
|
362
378
|
recordSent(sessionId: string, count: number, byteSize: number): void;
|
|
363
379
|
/** Record an error. */
|
|
@@ -798,6 +814,10 @@ interface AuthContext {
|
|
|
798
814
|
userId: string;
|
|
799
815
|
/** Per-collection sync scopes (optional) */
|
|
800
816
|
scopes?: Record<string, Record<string, unknown>>;
|
|
817
|
+
/** Server-authoritative records this session may receive. Overrides `scopes`. */
|
|
818
|
+
downlinkScopes?: Record<string, Record<string, unknown>>;
|
|
819
|
+
/** Server-authoritative records this session may upload. Overrides `scopes`. */
|
|
820
|
+
uplinkScopes?: Record<string, Record<string, unknown>>;
|
|
801
821
|
/** Arbitrary metadata about the authenticated user */
|
|
802
822
|
metadata?: Record<string, unknown>;
|
|
803
823
|
}
|
|
@@ -1169,6 +1189,7 @@ declare class ClientSession {
|
|
|
1169
1189
|
private clientNodeId;
|
|
1170
1190
|
private authContext;
|
|
1171
1191
|
private syncQuerySubsets;
|
|
1192
|
+
private scopeExitPolicy;
|
|
1172
1193
|
private resumeDeltaCursor;
|
|
1173
1194
|
/**
|
|
1174
1195
|
* The delivery watermark the client reported at handshake, or null when the client
|
|
@@ -1193,7 +1214,7 @@ declare class ClientSession {
|
|
|
1193
1214
|
* batches every server tick while the first batch is still being applied.
|
|
1194
1215
|
*/
|
|
1195
1216
|
private lastDeliveryPushAttemptAtMs;
|
|
1196
|
-
private
|
|
1217
|
+
private outstandingDelivery;
|
|
1197
1218
|
/** Serializes incremental delivery pushes so their batches never interleave. */
|
|
1198
1219
|
private deliveryPushChain;
|
|
1199
1220
|
/**
|
|
@@ -1264,6 +1285,7 @@ declare class ClientSession {
|
|
|
1264
1285
|
*/
|
|
1265
1286
|
pushDeliveryStreamIfSupported(staleMs?: number, options?: {
|
|
1266
1287
|
trackStall?: boolean;
|
|
1288
|
+
serverFrontier?: number;
|
|
1267
1289
|
}): void;
|
|
1268
1290
|
/**
|
|
1269
1291
|
* Close this session.
|
|
@@ -1322,6 +1344,9 @@ declare class ClientSession {
|
|
|
1322
1344
|
/** Build, track, and send one chained delivery-stream batch. */
|
|
1323
1345
|
private sendDeliveryBatch;
|
|
1324
1346
|
private operationVisibleToClient;
|
|
1347
|
+
/** Upload authorization is independent from the client's downloaded/query view. */
|
|
1348
|
+
private operationAllowedFromClient;
|
|
1349
|
+
private scopeRetractionFor;
|
|
1325
1350
|
/**
|
|
1326
1351
|
* Read a record's current field values from the materialized store for scope /
|
|
1327
1352
|
* query-subset backfill. Includes soft-deleted rows so a relayed delete (whose op
|