@gscdump/engine-sqlite 0.8.1 → 0.9.0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +17 -7
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -252,16 +252,26 @@ function tierMatchCond(target) {
252
252
  }
253
253
  function createD1ManifestStore(db) {
254
254
  async function listByFilter(filter, liveOnly) {
255
- const conds = [eq$1(r2Manifest.userId, Number(filter.userId))];
256
- if (liveOnly) conds.push(isNull(r2Manifest.retiredAt));
257
- if (filter.siteId !== void 0) conds.push(eq$1(r2Manifest.siteId, filter.siteId));
258
- if (filter.table !== void 0) conds.push(eq$1(r2Manifest.table, filter.table));
259
- if (filter.partitions && filter.partitions.length > 0) conds.push(inArray(r2Manifest.partition, filter.partitions));
255
+ const baseConds = [eq$1(r2Manifest.userId, Number(filter.userId))];
256
+ if (liveOnly) baseConds.push(isNull(r2Manifest.retiredAt));
257
+ if (filter.siteId !== void 0) baseConds.push(eq$1(r2Manifest.siteId, filter.siteId));
258
+ if (filter.table !== void 0) baseConds.push(eq$1(r2Manifest.table, filter.table));
260
259
  if (filter.tier !== void 0) {
261
260
  const cond = tierMatchCond(filter.tier);
262
- if (cond) conds.push(cond);
261
+ if (cond) baseConds.push(cond);
263
262
  }
264
- return (await db.select().from(r2Manifest).where(and$1(...conds))).map(fromRow);
263
+ const PARTITION_CHUNK = 80;
264
+ if (filter.partitions && filter.partitions.length > 0) {
265
+ const out = [];
266
+ for (let i = 0; i < filter.partitions.length; i += PARTITION_CHUNK) {
267
+ const slice = filter.partitions.slice(i, i + PARTITION_CHUNK);
268
+ const conds = [...baseConds, inArray(r2Manifest.partition, slice)];
269
+ const rows = await db.select().from(r2Manifest).where(and$1(...conds));
270
+ for (const r of rows) out.push(fromRow(r));
271
+ }
272
+ return out;
273
+ }
274
+ return (await db.select().from(r2Manifest).where(and$1(...baseConds))).map(fromRow);
265
275
  }
266
276
  const listLive = (filter) => listByFilter(filter, true);
267
277
  const listAll = (filter) => listByFilter(filter, false);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/engine-sqlite",
3
3
  "type": "module",
4
- "version": "0.8.1",
4
+ "version": "0.9.0",
5
5
  "description": "SQLite / D1 engine adapter for @gscdump/analysis — typed analytics over sqlite-proxy executors (Cloudflare D1, libsql).",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -44,8 +44,8 @@
44
44
  "drizzle-orm": "^0.45.2"
45
45
  },
46
46
  "dependencies": {
47
- "@gscdump/engine": "0.8.1",
48
- "gscdump": "0.8.1"
47
+ "@gscdump/engine": "0.9.0",
48
+ "gscdump": "0.9.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "drizzle-orm": "^0.45.2",