@starkeep/storage-sqlite 0.6.0 → 0.6.2

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.js CHANGED
@@ -22,9 +22,9 @@ import {
22
22
  sharedQueryTableName,
23
23
  SQLITE_APP_QUERY_DIALECT,
24
24
  buildGetLabel,
25
- buildLabelNodeWatermarks,
26
25
  buildBucketDigest,
27
26
  buildScanSinceForNode,
27
+ buildNodeWatermarks,
28
28
  collectSince,
29
29
  mergeDigestBuckets,
30
30
  planNodeScans,
@@ -389,7 +389,7 @@ var SqliteDatabaseAdapter = class {
389
389
  this.runStmt(query.sql, ...query.parameters);
390
390
  }
391
391
  async getNodeWatermarks() {
392
- const watermarksQuery = compiler.selectFrom("shared_records").select(({ fn }) => ["node_id", fn.max("updated_at").as("max_updated_at")]).groupBy("node_id").compile();
392
+ const watermarksQuery = buildNodeWatermarks(compiler, RECORDS);
393
393
  const rows = this.allRows(watermarksQuery.sql);
394
394
  const out = {};
395
395
  for (const row of rows) {
@@ -653,7 +653,7 @@ var SqliteDatabaseAdapter = class {
653
653
  return paginateLabelScan(rows, query.limit);
654
654
  }
655
655
  async getLabelNodeWatermarks() {
656
- const query = buildLabelNodeWatermarks(compiler, LABELS);
656
+ const query = buildNodeWatermarks(compiler, LABELS.table);
657
657
  const rows = this.allRows(query.sql);
658
658
  const out = {};
659
659
  for (const row of rows) out[row.node_id] = deserializeHLC2(row.max_updated_at);
@@ -815,6 +815,7 @@ import {
815
815
  collectRowPage as collectRowPage2,
816
816
  SQLITE_APP_QUERY_DIALECT as SQLITE_APP_QUERY_DIALECT2,
817
817
  buildBucketDigest as buildBucketDigest2,
818
+ buildNodeWatermarks as buildNodeWatermarks2,
818
819
  buildScanSinceForNode as buildScanSinceForNode2,
819
820
  collectSince as collectSince2,
820
821
  planNodeScans as planNodeScans2,
@@ -973,7 +974,7 @@ var SqliteAppSyncableApplier = class {
973
974
  if (!this.tableExists(fullName)) return {};
974
975
  const rows = allCompiled(
975
976
  this.db,
976
- compiler.selectFrom(fullName).select(({ fn }) => ["node_id", fn.max("updated_at").as("max_updated_at")]).groupBy("node_id").compile()
977
+ buildNodeWatermarks2(compiler, fullName)
977
978
  );
978
979
  const out = {};
979
980
  for (const row of rows) {