@gscdump/cloudflare 0.28.3 → 0.29.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.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,5 @@
1
- import { DuckDBFactory, ParquetCodec, QueryExecutor, Row, createStorageEngine } from "@gscdump/engine";
1
+ import { ParquetCodec, QueryExecutor, createStorageEngine } from "@gscdump/engine";
2
2
  import { H3Event } from "h3";
3
- declare function getWasmDuckDBFactory(): DuckDBFactory;
4
- declare function resetWasmDuckDB(): void;
5
3
  interface AnalyticsEnv {
6
4
  /** R2 bucket holding parquet + rollup + entity data. Required in origin mode. */
7
5
  R2_DATA?: R2Bucket;
@@ -88,4 +86,4 @@ interface DucklingsExecutorOptions {
88
86
  ipcTotalBytes?: number;
89
87
  }
90
88
  declare function createDucklingsExecutor(env: AnalyticsEnv, opts?: DucklingsExecutorOptions): QueryExecutor;
91
- export { type AnalyticsEngineHooks, type AnalyticsEnv, type HostedR2QueryKeyInput, type InflightDedupe, type Row, createDucklingsCodec, createDucklingsExecutor, createInflightDedupe, getAnalyticsEngine, getHostedR2QueryKey, getWasmDuckDBFactory, resetWasmDuckDB, signSizeHint, useAnalyticsEnv, verifySizeHint };
89
+ export { type AnalyticsEngineHooks, type AnalyticsEnv, type HostedR2QueryKeyInput, type InflightDedupe, createDucklingsCodec, createDucklingsExecutor, createInflightDedupe, getAnalyticsEngine, getHostedR2QueryKey, signSizeHint, useAnalyticsEnv, verifySizeHint };
package/dist/index.mjs CHANGED
@@ -4,19 +4,6 @@ import { createR2DataSource } from "@gscdump/engine/r2";
4
4
  import { createHyparquetCodec, decodeParquetToRows } from "@gscdump/engine/hyparquet";
5
5
  import { float64, int32, int64, tableFromArrays, tableToIPC, utf8 } from "@uwdata/flechette";
6
6
  import { createError } from "h3";
7
- let handle = null;
8
- async function initHandle() {
9
- throw new Error("DuckDB-WASM handle not wired for Cloudflare Workers yet. Complete duckdb-wasm-handle.ts before enabling dual-write (user.migration_phase != 'd1').");
10
- }
11
- function getWasmDuckDBFactory() {
12
- return { getDuckDB() {
13
- if (!handle) handle = initHandle();
14
- return handle;
15
- } };
16
- }
17
- function resetWasmDuckDB() {
18
- handle = null;
19
- }
20
7
  function arrowTypeForColumn(type) {
21
8
  switch (type) {
22
9
  case "VARCHAR":
@@ -245,7 +232,7 @@ function rowCachePut(key, rows) {
245
232
  rowCacheBytes += bytes;
246
233
  }
247
234
  function createDucklingsExecutor(env, opts = {}) {
248
- return { async execute({ sql, params, fileKeys, placeholderTables, dataSource, signal, table }) {
235
+ return { async execute({ sql, params, fileKeys, placeholderTables, pushdownFilters, dataSource, signal, table }) {
249
236
  signal?.throwIfAborted();
250
237
  const svc = resolveSvc(env);
251
238
  assertWorkerReadBudget({ fileKeys });
@@ -269,14 +256,17 @@ function createDucklingsExecutor(env, opts = {}) {
269
256
  const maxTotalBytes = opts.ipcTotalBytes ?? IPC_STAGED_TOTAL_BUDGET;
270
257
  for (const [placeholder, keys] of Object.entries(fileKeys)) {
271
258
  signal?.throwIfAborted();
259
+ const filter = pushdownFilters?.[placeholder];
272
260
  const perFile = await mapLimit(keys, WORKER_R2_DECODE_CONCURRENCY, async (key) => {
273
- const cached = rowCacheGet(key);
274
- if (cached) return cached;
261
+ if (!filter) {
262
+ const cached = rowCacheGet(key);
263
+ if (cached) return cached;
264
+ }
275
265
  signal?.throwIfAborted();
276
266
  const bytes = await dataSource.read(key, void 0, signal);
277
267
  signal?.throwIfAborted();
278
- const rows = await decodeParquetToRows(bytes);
279
- rowCachePut(key, rows);
268
+ const rows = await decodeParquetToRows(bytes, filter ? { filter } : {});
269
+ if (!filter) rowCachePut(key, rows);
280
270
  return rows;
281
271
  });
282
272
  const merged = [];
@@ -446,4 +436,4 @@ async function verifySizeHint(env, key, bytes, providedHex) {
446
436
  for (let i = 0; i < SIG_HEX_LEN; i++) diff |= expected.charCodeAt(i) ^ providedHex.charCodeAt(i);
447
437
  return diff === 0;
448
438
  }
449
- export { createDucklingsCodec, createDucklingsExecutor, createInflightDedupe, getAnalyticsEngine, getHostedR2QueryKey, getWasmDuckDBFactory, resetWasmDuckDB, signSizeHint, useAnalyticsEnv, verifySizeHint };
439
+ export { createDucklingsCodec, createDucklingsExecutor, createInflightDedupe, getAnalyticsEngine, getHostedR2QueryKey, signSizeHint, useAnalyticsEnv, verifySizeHint };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/cloudflare",
3
3
  "type": "module",
4
- "version": "0.28.3",
4
+ "version": "0.29.0",
5
5
  "description": "Cloudflare-Workers-flavored helpers for the gscdump analytics stack: AnalyticsEnv binding contract, R2 SigV4 presigner, size-hint HMAC, DuckDB Workers shims, engine factory.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -46,17 +46,17 @@
46
46
  "dependencies": {
47
47
  "@uwdata/flechette": "^2.5.0",
48
48
  "aws4fetch": "^1.0.20",
49
- "@gscdump/contracts": "0.28.3",
50
- "@gscdump/engine": "0.28.3",
51
- "gscdump": "0.28.3",
52
- "@gscdump/engine-sqlite": "0.28.3"
49
+ "@gscdump/contracts": "0.29.0",
50
+ "@gscdump/engine": "0.29.0",
51
+ "@gscdump/engine-sqlite": "0.29.0",
52
+ "gscdump": "0.29.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@cloudflare/vitest-pool-workers": "^0.16.16",
56
- "@cloudflare/workers-types": "^4.20260617.1",
55
+ "@cloudflare/vitest-pool-workers": "^0.16.18",
56
+ "@cloudflare/workers-types": "^4.20260621.1",
57
57
  "h3": "^1.15.11",
58
58
  "typescript": "^6.0.3",
59
- "wrangler": "^4.101.0"
59
+ "wrangler": "^4.103.0"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "obuild",