@gscdump/cloudflare 0.36.0 → 0.36.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.
@@ -20,6 +20,15 @@ function tableForDimensions(dims) {
20
20
  if (set.has("device")) return "dates";
21
21
  return "pages";
22
22
  }
23
+ function tableForTopNBreakdown(q) {
24
+ const dims = [q.dimension];
25
+ for (const facet of q.facets ?? []) {
26
+ const hasPage = q.dimension === "page" || facet.column === "page";
27
+ const hasQuery = q.dimension === "query" || q.dimension === "queryCanonical" || facet.column === "query" || facet.column === "queryCanonical";
28
+ if (hasPage && hasQuery) dims.push(facet.column);
29
+ }
30
+ return tableForDimensions(dims);
31
+ }
23
32
  function metricExpr(metric) {
24
33
  switch (metric) {
25
34
  case "clicks": return "SUM(clicks) AS clicks";
@@ -176,7 +185,7 @@ function buildEntityDailySparkline(q, pruned, mode) {
176
185
  };
177
186
  }
178
187
  function buildTopNBreakdown(q, pruned, mode) {
179
- const table = tableForDimensions([q.dimension]);
188
+ const table = tableForTopNBreakdown(q);
180
189
  const w = partitionWhere(q, pruned, mode);
181
190
  if (!q.orderBy || !q.orderBy.metric || !q.orderBy.dir) throw new Error(`[archetype-sql] top-n-breakdown requires orderBy.{metric,dir}, got: ${JSON.stringify(q.orderBy)}`);
182
191
  const order = `${metricAlias(q.orderBy.metric)} ${q.orderBy.dir.toUpperCase()}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/cloudflare",
3
3
  "type": "module",
4
- "version": "0.36.0",
4
+ "version": "0.36.2",
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.36.0",
50
- "@gscdump/engine-sqlite": "0.36.0",
51
- "gscdump": "0.36.0",
52
- "@gscdump/engine": "0.36.0"
49
+ "@gscdump/engine": "0.36.2",
50
+ "@gscdump/engine-sqlite": "0.36.2",
51
+ "@gscdump/contracts": "0.36.2",
52
+ "gscdump": "0.36.2"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@cloudflare/vitest-pool-workers": "^0.18.0",