@gscdump/cloudflare 0.37.5 → 0.37.6

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.
@@ -185,7 +185,7 @@ function buildEntityDailySparkline(q, pruned, mode) {
185
185
  return {
186
186
  table,
187
187
  params: w.params,
188
- sql: `SELECT date, ${dimSelect(q.dimension)}, ${metricExpr(q.metric)} FROM ${factTableRef()} WHERE ${w.clause} AND ${col} IN (${inList}) GROUP BY date, ${col} ORDER BY date ASC`
188
+ sql: `SELECT date, ${col} AS entity, ${metricExpr(q.metric)} FROM ${factTableRef()} WHERE ${w.clause} AND ${col} IN (${inList}) GROUP BY date, ${col} ORDER BY date ASC`
189
189
  };
190
190
  }
191
191
  function buildTopNBreakdown(q, pruned, mode) {
@@ -355,12 +355,18 @@ function routingErrorToException(error) {
355
355
  function hasRegexFacet(query) {
356
356
  return query.facets?.some((f) => f.op === "regex" || f.op === "notRegex") ?? false;
357
357
  }
358
+ function referencesQueryDim(query) {
359
+ const q = query;
360
+ if (q.dimension === "queryCanonical" || q.seriesDimension === "queryCanonical") return true;
361
+ if (q.match && "queryCanonical" in q.match) return true;
362
+ return q.facets?.some((f) => f.column === "queryCanonical") ?? false;
363
+ }
358
364
  function resolveServerTailEngineResult(query) {
359
365
  const cls = ARCHETYPE_EXECUTION_CLASS[query.archetype];
360
366
  if (cls === "cloud-only") return err(new ServerTailRoutingError(`archetype '${query.archetype}' is cloud-only — not a server-tail query`));
361
367
  if (cls === "duckdb") return ok("duckdb");
362
368
  if (query.archetype === "top-n-breakdown" && query.offset && query.offset > 0) return ok("duckdb");
363
- if (query.archetype === "top-n-breakdown" && query.dimension === "queryCanonical") return ok("duckdb");
369
+ if (referencesQueryDim(query)) return ok("duckdb");
364
370
  if (hasRegexFacet(query)) return ok("duckdb");
365
371
  return ok("r2-sql");
366
372
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/cloudflare",
3
3
  "type": "module",
4
- "version": "0.37.5",
4
+ "version": "0.37.6",
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,10 +46,10 @@
46
46
  "dependencies": {
47
47
  "@uwdata/flechette": "^2.5.0",
48
48
  "aws4fetch": "^1.0.20",
49
- "@gscdump/contracts": "0.37.5",
50
- "@gscdump/engine": "0.37.5",
51
- "@gscdump/engine-sqlite": "0.37.5",
52
- "gscdump": "0.37.5"
49
+ "@gscdump/contracts": "0.37.6",
50
+ "@gscdump/engine": "0.37.6",
51
+ "@gscdump/engine-sqlite": "0.37.6",
52
+ "gscdump": "0.37.6"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@cloudflare/vitest-pool-workers": "^0.18.0",