@syncular/server 0.15.47 → 0.15.48
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 +7 -1
- package/dist/admin.d.ts +1 -5
- package/dist/admin.js +2 -7
- package/dist/blob-handlers.js +4 -1
- package/dist/context.d.ts +3 -1
- package/dist/context.js +4 -0
- package/dist/d1-storage.d.ts +4 -1
- package/dist/d1-storage.js +75 -11
- package/dist/errors.js +6 -0
- package/dist/events.d.ts +2 -1
- package/dist/frame-bytes.d.ts +2 -2
- package/dist/frame-bytes.js +33 -14
- package/dist/handler.js +58 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/operations.js +2 -1
- package/dist/postgres-storage.d.ts +5 -2
- package/dist/postgres-storage.js +71 -10
- package/dist/pull.d.ts +1 -1
- package/dist/pull.js +11 -5
- package/dist/realtime.d.ts +4 -1
- package/dist/realtime.js +33 -9
- package/dist/restore.d.ts +13 -0
- package/dist/restore.js +13 -0
- package/dist/s3-segment-store.js +10 -1
- package/dist/seed.js +36 -4
- package/dist/segment-download.js +5 -2
- package/dist/segment-store.d.ts +3 -0
- package/dist/segment-store.js +1 -0
- package/dist/sqlite-bun-driver.d.ts +2 -1
- package/dist/sqlite-bun-driver.js +5 -2
- package/dist/sqlite-dialect.d.ts +1 -1
- package/dist/sqlite-dialect.js +7 -0
- package/dist/sqlite-segment-store.js +14 -5
- package/dist/sqlite-storage.d.ts +4 -1
- package/dist/sqlite-storage.js +81 -11
- package/dist/storage.d.ts +18 -5
- package/package.json +2 -2
- package/src/admin.ts +3 -9
- package/src/blob-handlers.ts +8 -1
- package/src/context.ts +16 -1
- package/src/d1-storage.ts +107 -12
- package/src/errors.ts +6 -0
- package/src/events.ts +2 -1
- package/src/frame-bytes.ts +40 -14
- package/src/handler.ts +102 -29
- package/src/index.ts +1 -0
- package/src/operations.ts +6 -1
- package/src/postgres-storage.ts +102 -13
- package/src/pull.ts +11 -0
- package/src/realtime.ts +46 -7
- package/src/restore.ts +28 -0
- package/src/s3-segment-store.ts +10 -1
- package/src/seed.ts +46 -4
- package/src/segment-download.ts +11 -2
- package/src/segment-store.ts +4 -0
- package/src/sqlite-bun-driver.ts +6 -2
- package/src/sqlite-dialect.ts +7 -0
- package/src/sqlite-segment-store.ts +18 -4
- package/src/sqlite-storage.ts +118 -12
- package/src/storage.ts +28 -5
package/src/storage.ts
CHANGED
|
@@ -164,6 +164,8 @@ export interface ClientSubscription {
|
|
|
164
164
|
export interface ClientRecord {
|
|
165
165
|
readonly clientId: string;
|
|
166
166
|
readonly actorId: string;
|
|
167
|
+
/** SSP2 version last accepted from this client; selects realtime deltas. */
|
|
168
|
+
readonly wireVersion: number;
|
|
167
169
|
/** Minimum `nextCursor` across the last pull's active subscriptions. */
|
|
168
170
|
readonly cursor: number;
|
|
169
171
|
readonly updatedAtMs: number;
|
|
@@ -220,6 +222,14 @@ export interface ClientCursorInfo {
|
|
|
220
222
|
readonly updatedAtMs: number;
|
|
221
223
|
}
|
|
222
224
|
|
|
225
|
+
/** Durable partition identity refreshed after host authentication (§2.1). */
|
|
226
|
+
export interface PartitionRegistryEntry {
|
|
227
|
+
readonly partition: string;
|
|
228
|
+
readonly logEpoch: string;
|
|
229
|
+
readonly epochRequired: boolean;
|
|
230
|
+
readonly lastAuthenticatedAtMs: number;
|
|
231
|
+
}
|
|
232
|
+
|
|
223
233
|
/**
|
|
224
234
|
* Commit-log metadata (no change payloads) for the admin/console read
|
|
225
235
|
* surface. `changeCount` is the number of changes the commit carries;
|
|
@@ -397,6 +407,21 @@ export interface ServerStorage {
|
|
|
397
407
|
*/
|
|
398
408
|
ensureSchema(schema: CompiledSchema): Promise<void>;
|
|
399
409
|
|
|
410
|
+
/** Create or refresh the authenticated partition registry row (§2.1). */
|
|
411
|
+
touchPartition(
|
|
412
|
+
partition: string,
|
|
413
|
+
authenticatedAtMs: number,
|
|
414
|
+
initialLogEpoch: string,
|
|
415
|
+
): Promise<PartitionRegistryEntry>;
|
|
416
|
+
/** Rotate log continuity after restore and discard stale cursor records. */
|
|
417
|
+
rotatePartitionLogEpoch(
|
|
418
|
+
partition: string,
|
|
419
|
+
logEpoch: string,
|
|
420
|
+
authenticatedAtMs: number,
|
|
421
|
+
): Promise<PartitionRegistryEntry>;
|
|
422
|
+
/** Registry entries ordered by partition for maintenance loops. */
|
|
423
|
+
listPartitionRegistry(): Promise<PartitionRegistryEntry[]>;
|
|
424
|
+
|
|
400
425
|
begin(partition: string): Promise<StorageTransaction>;
|
|
401
426
|
|
|
402
427
|
getMaxCommitSeq(partition: string): Promise<number>;
|
|
@@ -551,10 +576,8 @@ export interface ServerStorage {
|
|
|
551
576
|
* change scope index (never a log scan).
|
|
552
577
|
* `getRowScopes`: the (table, rowId) row's current server_version and
|
|
553
578
|
* stored scopes without decoding its payload — the row inspector.
|
|
554
|
-
* `listPartitions`:
|
|
555
|
-
*
|
|
556
|
-
* records, sorted. Powers the console's fleet view / partition picker;
|
|
557
|
-
* deliberately NOT partition-scoped (the one cross-partition read).
|
|
579
|
+
* `listPartitions`: the partition-only compatibility view of
|
|
580
|
+
* `listPartitionRegistry`, sorted.
|
|
558
581
|
*/
|
|
559
582
|
listClientRecords?(partition: string): Promise<ClientRecord[]>;
|
|
560
583
|
listCommitMetadata?(
|
|
@@ -572,7 +595,7 @@ export interface ServerStorage {
|
|
|
572
595
|
): Promise<
|
|
573
596
|
{ serverVersion: number; scopes: Record<string, string> } | undefined
|
|
574
597
|
>;
|
|
575
|
-
listPartitions
|
|
598
|
+
listPartitions(): Promise<string[]>;
|
|
576
599
|
}
|
|
577
600
|
|
|
578
601
|
/** A row referencing a blob, with the scopes needed to authorize download. */
|