@syncular/server 0.31.0 → 0.32.1

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/storage.d.ts CHANGED
@@ -303,13 +303,55 @@ export interface CommitMetadata {
303
303
  readonly createdAtMs: number;
304
304
  readonly changeCount: number;
305
305
  readonly tables: readonly string[];
306
+ /** The first `changeSample` changes in commit order, when requested. */
307
+ readonly sample?: readonly CommitChangeSummary[];
308
+ }
309
+ /** One change without its payload, for commit lists. */
310
+ export interface CommitChangeSummary {
311
+ readonly table: string;
312
+ readonly rowId: string;
313
+ readonly op: 'upsert' | 'delete';
306
314
  }
307
315
  export interface CommitMetadataQuery {
308
- /** Window `afterSeq < commitSeq`, oldest first. */
316
+ /** Window lower bound, exclusive: `afterSeq < commitSeq`. */
309
317
  readonly afterSeq: number;
318
+ /** Window upper bound, exclusive: `commitSeq < beforeSeq` (older pages). */
319
+ readonly beforeSeq?: number;
320
+ /** Newest first, at most `limit` commits. */
310
321
  readonly limit: number;
311
322
  /** Restrict to commits that touched this table (via the change index). */
312
323
  readonly table?: string;
324
+ /** Attach the first N changes of each commit as `sample`. */
325
+ readonly changeSample?: number;
326
+ }
327
+ export interface RowListQuery {
328
+ readonly table: string;
329
+ /** Resume after this rowId (exclusive); `null` = start of table. */
330
+ readonly afterRowId: string | null;
331
+ readonly limit: number;
332
+ }
333
+ /** A stored push outcome with the client that sent it. */
334
+ export interface ClientPushResult {
335
+ readonly clientId: string;
336
+ readonly result: StoredPushResult;
337
+ }
338
+ /** One retained commit with its changes, for the admin commit drill-down. */
339
+ export interface CommitDetail extends CommitMetadata {
340
+ readonly changes: readonly StoredChange[];
341
+ }
342
+ /** One retained change to a single row, for the admin row history. */
343
+ export interface RowChangeRecord {
344
+ readonly commitSeq: number;
345
+ readonly op: 'upsert' | 'delete';
346
+ readonly rowVersion?: number;
347
+ readonly actorId: string;
348
+ readonly clientId: string;
349
+ readonly createdAtMs: number;
350
+ }
351
+ export interface RowChangesQuery {
352
+ readonly table: string;
353
+ readonly rowId: string;
354
+ readonly limit: number;
313
355
  }
314
356
  /** One recent commit touching a scope key, for the admin scope activity view. */
315
357
  export interface ScopeCommitActivity {
@@ -671,18 +713,27 @@ export interface ServerStorage {
671
713
  * touched tables), the newest-oriented window an operator inspects.
672
714
  * `scopeActivity`: the recent commits touching one scope key, via the
673
715
  * change scope index (never a log scan).
674
- * `getRowScopes`: the (table, rowId) row's current server_version and
675
- * stored scopes without decoding its payload — the row inspector.
716
+ * `getCommit`: one retained commit with its changes and payloads;
717
+ * `undefined` when the commit does not exist or was pruned.
718
+ * `listRowChanges`: the retained changes to one row, newest first. It
719
+ * reads the partition's retained log without a dedicated index, so the
720
+ * write path pays nothing for it and its cost is bounded by retention.
721
+ * `listRows`: one table's rows ordered by rowId, without a scope filter.
722
+ * `countRows`: one table's row count.
723
+ * `listPushResults`: every stored idempotency outcome for one
724
+ * clientCommitId across the partition's clients, scanning the retained
725
+ * outcomes without a dedicated index.
676
726
  * `listPartitions`: the partition-only compatibility view of
677
727
  * `listPartitionRegistry`, sorted.
678
728
  */
679
729
  listClientRecords?(partition: string): Promise<ClientRecord[]>;
680
730
  listCommitMetadata?(partition: string, query: CommitMetadataQuery): Promise<CommitMetadata[]>;
681
731
  scopeActivity?(partition: string, query: ScopeActivityQuery): Promise<ScopeCommitActivity[]>;
682
- getRowScopes?(partition: string, table: string, rowId: string): Promise<{
683
- serverVersion: number;
684
- scopes: Record<string, string>;
685
- } | undefined>;
732
+ getCommit?(partition: string, commitSeq: number): Promise<CommitDetail | undefined>;
733
+ listRowChanges?(partition: string, query: RowChangesQuery): Promise<RowChangeRecord[]>;
734
+ listRows?(partition: string, query: RowListQuery): Promise<StoredRow[]>;
735
+ countRows?(partition: string, table: string): Promise<number>;
736
+ listPushResults?(partition: string, clientCommitId: string): Promise<ClientPushResult[]>;
686
737
  listPartitions(): Promise<string[]>;
687
738
  }
688
739
  /** A row referencing a blob, with the scopes needed to authorize download. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/server",
3
- "version": "0.31.0",
3
+ "version": "0.32.1",
4
4
  "description": "Syncular server: handleSyncRequest + storage/auth interfaces for the sync protocol",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Benjamin Kniffler",
@@ -68,7 +68,7 @@
68
68
  "verify:node": "cd ../.. && bun build ./packages/server/test/sqlite-runtime/verify-node.mjs --target=node --conditions=bun --outfile=./packages/server/.verify-node.built.mjs && node ./packages/server/.verify-node.built.mjs"
69
69
  },
70
70
  "dependencies": {
71
- "@syncular/core": "0.31.0"
71
+ "@syncular/core": "0.32.1"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@electric-sql/pglite": "^0.5.4"