@lunora/do 1.0.0-alpha.19 → 1.0.0-alpha.20

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.d.mts CHANGED
@@ -2973,7 +2973,12 @@ interface TablePage {
2973
2973
  */
2974
2974
  refs?: Record<string, string>;
2975
2975
  rows: Record<string, unknown>[];
2976
- total: number;
2976
+ /**
2977
+ * Total rows matching the predicate. Absent when the read passed
2978
+ * `skipCount: true` (the caller sources the count from a separate,
2979
+ * predicate-keyed read instead of recomputing it per page).
2980
+ */
2981
+ total?: number;
2977
2982
  }
2978
2983
  /** Comparison a {@link FilterClause} applies. `contains` is a case-sensitive substring (LIKE); the rest are direct SQL comparisons. */
2979
2984
  type FilterOperator = "contains" | "eq" | "gt" | "gte" | "lt" | "lte" | "ne";
@@ -3029,6 +3034,14 @@ interface ReadTablePageOptions {
3029
3034
  * Empty/whitespace is treated as no filter.
3030
3035
  */
3031
3036
  search?: string;
3037
+ /**
3038
+ * Skip the `SELECT COUNT(*)` and return the page with `total` absent. The
3039
+ * data browser splits the row count into a separate predicate-keyed read (one
3040
+ * that excludes `offset`), so paging never re-counts; the page read passes
3041
+ * this to avoid recomputing the same total per offset. Unset → the COUNT runs
3042
+ * (today's behavior) and `total` is populated.
3043
+ */
3044
+ skipCount?: boolean;
3032
3045
  table: string;
3033
3046
  }
3034
3047
  /**
package/dist/index.d.ts CHANGED
@@ -2973,7 +2973,12 @@ interface TablePage {
2973
2973
  */
2974
2974
  refs?: Record<string, string>;
2975
2975
  rows: Record<string, unknown>[];
2976
- total: number;
2976
+ /**
2977
+ * Total rows matching the predicate. Absent when the read passed
2978
+ * `skipCount: true` (the caller sources the count from a separate,
2979
+ * predicate-keyed read instead of recomputing it per page).
2980
+ */
2981
+ total?: number;
2977
2982
  }
2978
2983
  /** Comparison a {@link FilterClause} applies. `contains` is a case-sensitive substring (LIKE); the rest are direct SQL comparisons. */
2979
2984
  type FilterOperator = "contains" | "eq" | "gt" | "gte" | "lt" | "lte" | "ne";
@@ -3029,6 +3034,14 @@ interface ReadTablePageOptions {
3029
3034
  * Empty/whitespace is treated as no filter.
3030
3035
  */
3031
3036
  search?: string;
3037
+ /**
3038
+ * Skip the `SELECT COUNT(*)` and return the page with `total` absent. The
3039
+ * data browser splits the row count into a separate predicate-keyed read (one
3040
+ * that excludes `offset`), so paging never re-counts; the page read passes
3041
+ * this to avoid recomputing the same total per offset. Unset → the COUNT runs
3042
+ * (today's behavior) and `total` is populated.
3043
+ */
3044
+ skipCount?: boolean;
3032
3045
  table: string;
3033
3046
  }
3034
3047
  /**
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ export { diffExternalSource } from './packem_shared/diffExternalSource-Cx9HUPJj.
11
11
  export { materializeExternalRows, readExternalSourceBaseline, runExternalSourceTick } from './packem_shared/materializeExternalRows-Bj6EXy50.mjs';
12
12
  export { isSourceDue, liftSourceId, pullExternalSourceTick } from './packem_shared/isSourceDue-9mJRJ9Ld.mjs';
13
13
  export { FUNCTION_METRICS_BUCKETS_TABLE, FUNCTION_METRICS_BUCKET_MS, FUNCTION_METRICS_BUCKET_RETENTION, FUNCTION_METRICS_INDEX_TABLE, FUNCTION_METRICS_TABLE, ensureFunctionMetricsTables, readFunctionMetricBuckets, readFunctionMetricIndexHits, readFunctionMetrics, readFunctionMetricsTotals, recordFunctionMetric } from './packem_shared/FUNCTION_METRICS_BUCKETS_TABLE-UDNVD7FS.mjs';
14
- export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, FLAGS_FUNCTION_PREFIX, RELATION_FUNCTION_PREFIX, facetColumn, listTables, readTablePage, selectMatchingIds } from './packem_shared/ADMIN_FUNCTIONS-BvGiv2u6.mjs';
14
+ export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, FLAGS_FUNCTION_PREFIX, RELATION_FUNCTION_PREFIX, facetColumn, listTables, readTablePage, selectMatchingIds } from './packem_shared/ADMIN_FUNCTIONS-DSUQ5fX9.mjs';
15
15
  export { LogBuffer } from './packem_shared/LogBuffer-B_Ezju_N.mjs';
16
16
  export { MAIL_RETENTION, MAIL_TABLE, clearCapturedMail, ensureMailTable, readCapturedMail, recordCapturedMail } from './packem_shared/MAIL_RETENTION-CPpgl-dX.mjs';
17
17
  export { default as NotFoundError } from './packem_shared/NotFoundError-CMuMZt81.mjs';
@@ -19,14 +19,14 @@ export { armRestore, readBookmark } from './packem_shared/armRestore-BJk53Ro8.mj
19
19
  export { applySelect, buildSeekWhere, decodeCursor, encodeCursor, normalizeOrderKeys, softDeleteScope } from './packem_shared/applySelect-BvZdFUBT.mjs';
20
20
  export { RANK_TIEBREAK, encodePartitionKey, matchesRankStaticWhere, rankTableName, resolveRankPartition, sortColumnName } from './packem_shared/RANK_TIEBREAK-CXhdcA1o.mjs';
21
21
  export { ReactiveCache, reactiveCacheKey } from './packem_shared/ReactiveCache-BYlSGY0N.mjs';
22
- export { serveRelationFanout } from './packem_shared/serveRelationFanout-BuSmWawx.mjs';
22
+ export { serveRelationFanout } from './packem_shared/serveRelationFanout-C5axmGDj.mjs';
23
23
  export { DEFAULT_MAX_RELATION_KEYS, assertFlatPredicate, assertShapeShardable, containsRelationPredicate, isRelationPredicate, resolveRelationPredicates } from './packem_shared/DEFAULT_MAX_RELATION_KEYS-DU-Y4-LJ.mjs';
24
24
  export { applyOnDelete, fanOutScalarCounts, resolveWith, runRowValidators } from './packem_shared/applyOnDelete-BQ-8ZlZ1.mjs';
25
25
  export { RLS_UNWRAP_SYMBOL, RlsRequiredError, guardWriter } from './packem_shared/RLS_UNWRAP_SYMBOL-EtGQdC9d.mjs';
26
26
  export { buildFtsMatch, ftsTableName, scoreDocument, stringifySearchText, tokenizeSearch } from './packem_shared/buildFtsMatch-BLEMawrp.mjs';
27
27
  export { M as MIN_ADMIN_TOKEN_LENGTH, a as MIN_AUTH_SECRET_LENGTH, b as buildSecurityAudit } from './packem_shared/security-audit-CucgBice.mjs';
28
28
  export { SESSION_DO_TTL_DEFAULT, SessionDO } from './packem_shared/SESSION_DO_TTL_DEFAULT-ilPZsVwu.mjs';
29
- export { ROOT_DO_SIZE_WARN_BYTES, ROOT_SHARD_NAME, ShardDO } from './packem_shared/ROOT_DO_SIZE_WARN_BYTES-DlFX7CLL.mjs';
29
+ export { ROOT_DO_SIZE_WARN_BYTES, ROOT_SHARD_NAME, ShardDO } from './packem_shared/ROOT_DO_SIZE_WARN_BYTES-BbHQKxG6.mjs';
30
30
  export { SHARD_REGISTRY_DO_NAME, ShardRegistryDO } from './packem_shared/SHARD_REGISTRY_DO_NAME-BsAbi5Mn.mjs';
31
31
  export { MAX_SQL_ROWS, assertReadonly, runReadonlySql } from './packem_shared/MAX_SQL_ROWS-dDcFE1YZ.mjs';
32
32
  export { createSystemReader } from './packem_shared/createSystemReader-8CzSZP9V.mjs';
@@ -200,7 +200,10 @@ const readTablePage = (sql, options) => {
200
200
  const orderSql = order === void 0 ? "" : ` ORDER BY ${order.sql}`;
201
201
  const whereParams = predicate?.parameters ?? [];
202
202
  const orderParams = order?.params ?? [];
203
- const total = predicate === void 0 ? countRows(sql, quoted) : Number(sql.exec(`SELECT COUNT(*) AS c FROM ${quoted}${whereSql}`, ...whereParams).one().c);
203
+ let total;
204
+ if (!options.skipCount) {
205
+ total = predicate === void 0 ? countRows(sql, quoted) : Number(sql.exec(`SELECT COUNT(*) AS c FROM ${quoted}${whereSql}`, ...whereParams).one().c);
206
+ }
204
207
  const rawRows = sql.exec(`SELECT * FROM ${quoted}${whereSql}${orderSql} LIMIT ? OFFSET ?`, ...whereParams, ...orderParams, limit, offset).toArray();
205
208
  return withReferences({ ...expandDocumentRows(columns, rawRows), total });
206
209
  };
@@ -5,7 +5,7 @@ import { recordAuthEvent, readAuthMetrics } from './AUTH_METRICS_BUCKETS_TABLE-C
5
5
  import { DATA_MIGRATION_STATE_TABLE, readMigrationStatus } from './DATA_MIGRATION_STATE_TABLE-DfPxn8I0.mjs';
6
6
  import { SCAN_DEP, createDependencyTracker, tableFromDepKey } from './SCAN_DEP-DLJF8dsj.mjs';
7
7
  import { readFunctionMetricsTotals, readFunctionMetricIndexHits, recordFunctionMetric, mergeScanAttribution, readFunctionMetrics, readFunctionMetricBuckets } from './FUNCTION_METRICS_BUCKETS_TABLE-UDNVD7FS.mjs';
8
- import { createFanoutCounters, ADMIN_FUNCTION_PREFIX, RELATION_FUNCTION_PREFIX, selectMatchingIds, ADMIN_FUNCTIONS, findStorageReferences, listTables, summarizeSubscriptions, summarizeFanoutTopics, readTablePage, facetColumn, FLAGS_FUNCTION_PREFIX, recordFanoutPass, MAX_PAGE_SIZE } from './ADMIN_FUNCTIONS-BvGiv2u6.mjs';
8
+ import { createFanoutCounters, ADMIN_FUNCTION_PREFIX, RELATION_FUNCTION_PREFIX, selectMatchingIds, ADMIN_FUNCTIONS, findStorageReferences, listTables, summarizeSubscriptions, summarizeFanoutTopics, readTablePage, facetColumn, FLAGS_FUNCTION_PREFIX, recordFanoutPass, MAX_PAGE_SIZE } from './ADMIN_FUNCTIONS-DSUQ5fX9.mjs';
9
9
  import { LogBuffer } from './LogBuffer-B_Ezju_N.mjs';
10
10
  import { recordCapturedMail, clearCapturedMail, readCapturedMail, MAIL_TABLE } from './MAIL_RETENTION-CPpgl-dX.mjs';
11
11
  import { readBookmark, armRestore } from './armRestore-BJk53Ro8.mjs';
@@ -4870,6 +4870,7 @@ class ShardDO {
4870
4870
  orderBy: parseTablePageOrderBy(args["orderBy"]),
4871
4871
  refs: this.tableRefs(table),
4872
4872
  search: typeof args["search"] === "string" ? args["search"] : void 0,
4873
+ skipCount: typeof args["skipCount"] === "boolean" ? args["skipCount"] : void 0,
4873
4874
  table
4874
4875
  });
4875
4876
  return { result: page, tables: /* @__PURE__ */ new Set([table === "" ? ADMIN_WILDCARD : table]) };
@@ -1,4 +1,4 @@
1
- import { RELATION_FUNCTION_PREFIX } from './ADMIN_FUNCTIONS-BvGiv2u6.mjs';
1
+ import { RELATION_FUNCTION_PREFIX } from './ADMIN_FUNCTIONS-DSUQ5fX9.mjs';
2
2
 
3
3
  const serveRelationFanout = async (schema, database, functionPath, args) => {
4
4
  const table = typeof args["table"] === "string" ? args["table"] : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/do",
3
- "version": "1.0.0-alpha.19",
3
+ "version": "1.0.0-alpha.20",
4
4
  "description": "Lunora Durable Objects: ShardDO (SQLite, OCC, hibernated WebSocket subscriptions) and SessionDO",
5
5
  "keywords": [
6
6
  "cloudflare",