@gscdump/engine 0.11.5 → 0.13.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/_chunks/coerce.mjs +14 -0
- package/dist/_chunks/dispatch.mjs +1 -0
- package/dist/_chunks/duckdb.d.mts +1 -1
- package/dist/_chunks/engine.mjs +1 -129
- package/dist/_chunks/planner.d.mts +1 -1
- package/dist/_chunks/registry.d.mts +8 -9
- package/dist/_chunks/resolver.mjs +704 -3
- package/dist/_chunks/storage.d.mts +1 -50
- package/dist/_chunks/types.d.mts +1 -0
- package/dist/adapters/filesystem.d.mts +1 -1
- package/dist/adapters/hyparquet.d.mts +1 -1
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/r2-manifest.d.mts +1 -1
- package/dist/adapters/r2.d.mts +1 -1
- package/dist/contracts.d.mts +1 -1
- package/dist/entities.d.mts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -13
- package/dist/ingest.d.mts +1 -1
- package/dist/planner.d.mts +1 -1
- package/dist/resolver/index.d.mts +1 -0
- package/dist/resolver/index.mjs +1 -2
- package/dist/rollups.d.mts +1 -1
- package/dist/source/index.d.mts +5 -4
- package/dist/source/index.mjs +9 -12
- package/package.json +3 -3
- package/dist/_chunks/pg-adapter.mjs +0 -667
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { t as ComparisonFilter } from "./types.mjs";
|
|
2
1
|
import { Row, Row as Row$1, TableName, TableName as TableName$1, TenantCtx, TenantCtx as TenantCtx$1 } from "@gscdump/contracts";
|
|
3
2
|
import { BuilderState, SearchType, SearchType as SearchType$1 } from "gscdump/query";
|
|
4
3
|
/**
|
|
@@ -298,25 +297,6 @@ interface QueryResult {
|
|
|
298
297
|
sql: string;
|
|
299
298
|
objectKeys: string[];
|
|
300
299
|
}
|
|
301
|
-
interface ComparisonResult {
|
|
302
|
-
rows: Row[];
|
|
303
|
-
totalCount: number;
|
|
304
|
-
totals: Record<string, unknown>;
|
|
305
|
-
}
|
|
306
|
-
interface ExtraResult {
|
|
307
|
-
key: string;
|
|
308
|
-
rows: Row[];
|
|
309
|
-
}
|
|
310
|
-
interface OptimizedQueryResult {
|
|
311
|
-
rows: Row[];
|
|
312
|
-
totalCount: number;
|
|
313
|
-
totals: {
|
|
314
|
-
clicks: number;
|
|
315
|
-
impressions: number;
|
|
316
|
-
ctr: number;
|
|
317
|
-
position: number;
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
300
|
interface QueryExecuteOptions {
|
|
321
301
|
sql: string;
|
|
322
302
|
params: unknown[];
|
|
@@ -403,35 +383,6 @@ interface RunSQLOptions {
|
|
|
403
383
|
interface StorageEngine {
|
|
404
384
|
writeDay: (ctx: WriteCtx, rows: Row[]) => Promise<void>;
|
|
405
385
|
query: (ctx: QueryCtx, state: BuilderState) => Promise<QueryResult>;
|
|
406
|
-
/**
|
|
407
|
-
* Two-window comparison query (resolver-compiled). Joins a `current` and
|
|
408
|
-
* `previous` window CTE on dimensions, applies an optional row filter
|
|
409
|
-
* (`new`/`lost`/`improving`/`declining`), and returns the merged rows plus
|
|
410
|
-
* total count and unfiltered totals.
|
|
411
|
-
*
|
|
412
|
-
* Tenant scoping comes from `ctx.userId`/`ctx.siteId` (manifest lookup) —
|
|
413
|
-
* the SQL itself is single-tenant against the parquet adapter, which has
|
|
414
|
-
* `includeSiteId: false`.
|
|
415
|
-
*
|
|
416
|
-
* Throws if `current` and `previous` resolve to different tables.
|
|
417
|
-
*/
|
|
418
|
-
queryComparison: (ctx: QueryCtx, current: BuilderState, previous: BuilderState, filter?: ComparisonFilter) => Promise<ComparisonResult>;
|
|
419
|
-
/**
|
|
420
|
-
* Canonical-variant enrichment queries. Returns one result per extra
|
|
421
|
-
* surface; today only `queryCanonical` triggers an extra. Empty array
|
|
422
|
-
* when the state has no extras-eligible dimensions.
|
|
423
|
-
*/
|
|
424
|
-
queryExtras: (ctx: QueryCtx, state: BuilderState) => Promise<ExtraResult[]>;
|
|
425
|
-
/**
|
|
426
|
-
* Single-scan variant of {@link query} that piggy-backs `totalCount` and
|
|
427
|
-
* unfiltered metric totals onto the dimensioned result via window functions.
|
|
428
|
-
* Replaces the host-side rows + totals + count fan-out with one DuckDB
|
|
429
|
-
* execution. Window-function output columns (`totalCount`, `totalClicks`,
|
|
430
|
-
* `totalImpressions`, `totalCtr`, `totalPosition`) are stripped from `rows`
|
|
431
|
-
* before return; missing per-metric totals (when the metric was not
|
|
432
|
-
* requested in `state.metrics`) default to 0.
|
|
433
|
-
*/
|
|
434
|
-
queryOptimized: (ctx: QueryCtx, state: BuilderState) => Promise<OptimizedQueryResult>;
|
|
435
386
|
/**
|
|
436
387
|
* Run arbitrary SQL resolved against named partition sets. Composes
|
|
437
388
|
* manifest lookup + object reads + placeholder substitution + execution
|
|
@@ -490,4 +441,4 @@ interface EngineOptions {
|
|
|
490
441
|
}
|
|
491
442
|
declare function dayPartition(date: string): string;
|
|
492
443
|
declare function objectKey(ctx: TenantCtx, table: TableName, partition: string, version: number, searchType?: SearchType): string;
|
|
493
|
-
export {
|
|
444
|
+
export { SyncStateScope as A, inferSearchType as B, RunSQLOptions as C, SyncStateDetail as D, SyncState as E, WatermarkScope as F, CompactionThresholds as H, WriteCtx as I, WriteResult as L, TenantCtx$1 as M, Watermark as N, SyncStateFilter as O, WatermarkFilter as P, dayPartition as R, Row$1 as S, StorageEngine as T, enumeratePartitions as U, objectKey as V, QueryCtx as _, EngineOptions as a, QueryExecutor as b, ListLiveFilter as c, ManifestPurgeResult as d, ManifestStore as f, PurgeUrlsResult as g, PurgeResult as h, DataSource as i, TableName$1 as j, SyncStateKind as k, LockScope as l, PurgeFilter as m, CompactionTier as n, FileSetRef as o, ParquetCodec as p, DEFAULT_SEARCH_TYPE as r, GcCtx as s, CodecCtx as t, ManifestEntry as u, QueryExecuteOptions as v, SearchType$1 as w, QueryResult as x, QueryExecuteResult as y, inferLegacyTier as z };
|
package/dist/_chunks/types.d.mts
CHANGED
|
@@ -17,6 +17,7 @@ interface ResolverAdapter<TableKey extends string = string> {
|
|
|
17
17
|
metricSql: (metric: Metric, tableKey: TableKey) => SQL;
|
|
18
18
|
dimensionPredicates: (filters: InternalFilter[], tableKey: TableKey) => SQL[];
|
|
19
19
|
havingPredicates: (filters: InternalFilter[], tableKey: TableKey) => SQL[];
|
|
20
|
+
prefilterPredicates: (filters: InternalFilter[], tableKey: TableKey) => SQL[];
|
|
20
21
|
topLevelPredicate: (filters: InternalFilter[], tableKey: TableKey) => SQL | undefined;
|
|
21
22
|
compile: (query: SQL) => {
|
|
22
23
|
sql: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as Row, i as DataSource, j as TableName, p as ParquetCodec, t as CodecCtx } from "../_chunks/storage.mjs";
|
|
2
2
|
import { t as ColumnDef } from "../_chunks/schema.mjs";
|
|
3
3
|
declare function encodeRowsToParquet(table: TableName, rows: readonly Row[]): Uint8Array;
|
|
4
4
|
interface EncodeFlexOptions {
|
package/dist/adapters/node.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as StorageEngine, i as DataSource } from "../_chunks/storage.mjs";
|
|
2
2
|
import { NodeDuckDBOptions, createNodeDuckDBHandle, resetNodeDuckDB } from "./duckdb-node.mjs";
|
|
3
3
|
import { t as SnapshotIndex } from "../_chunks/snapshot.mjs";
|
|
4
4
|
import { Row, TableName } from "@gscdump/contracts";
|
package/dist/adapters/r2.d.mts
CHANGED
package/dist/contracts.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as SyncStateScope, C as RunSQLOptions, D as SyncStateDetail, E as SyncState, F as WatermarkScope, I as WriteCtx, L as WriteResult, M as TenantCtx, N as Watermark, O as SyncStateFilter, P as WatermarkFilter, S as Row, T as StorageEngine, _ as QueryCtx, a as EngineOptions, b as QueryExecutor, c as ListLiveFilter, f as ManifestStore, i as DataSource, j as TableName, k as SyncStateKind, l as LockScope, n as CompactionTier, o as FileSetRef, p as ParquetCodec, s as GcCtx, t as CodecCtx, u as ManifestEntry, v as QueryExecuteOptions, w as SearchType, x as QueryResult, y as QueryExecuteResult } from "./_chunks/storage.mjs";
|
|
2
2
|
export { CodecCtx, CompactionTier, DataSource, EngineOptions, FileSetRef, GcCtx, ListLiveFilter, LockScope, ManifestEntry, ManifestStore, ParquetCodec, QueryCtx, QueryExecuteOptions, QueryExecuteResult, QueryExecutor, QueryResult, Row, RunSQLOptions, SearchType, StorageEngine, SyncState, SyncStateDetail, SyncStateFilter, SyncStateKind, SyncStateScope, TableName, TenantCtx, Watermark, WatermarkFilter, WatermarkScope, WriteCtx, WriteResult };
|
package/dist/entities.d.mts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as SyncStateScope, B as inferSearchType, C as RunSQLOptions, D as SyncStateDetail, E as SyncState, F as WatermarkScope, H as CompactionThresholds, I as WriteCtx, L as WriteResult, M as TenantCtx, N as Watermark, O as SyncStateFilter, P as WatermarkFilter, R as dayPartition, S as Row, T as StorageEngine, U as enumeratePartitions, V as objectKey, _ as QueryCtx, a as EngineOptions, b as QueryExecutor, c as ListLiveFilter, d as ManifestPurgeResult, f as ManifestStore, g as PurgeUrlsResult, h as PurgeResult, i as DataSource, j as TableName, k as SyncStateKind, l as LockScope, m as PurgeFilter, n as CompactionTier, o as FileSetRef, p as ParquetCodec, r as DEFAULT_SEARCH_TYPE, s as GcCtx, t as CodecCtx, u as ManifestEntry, v as QueryExecuteOptions, w as SearchType, x as QueryResult, y as QueryExecuteResult, z as inferLegacyTier } from "./_chunks/storage.mjs";
|
|
2
2
|
import { a as createDuckDBExecutor, i as createDuckDBCodec, n as DuckDBHandle, r as canonicalEmptyParquetSchema, t as DuckDBFactory } from "./_chunks/duckdb.mjs";
|
|
3
3
|
import { _ as pages, a as allTables, c as inferTable, d as TABLE_METADATA, f as countries, g as page_keywords, h as keywords, i as TableSchema, m as drizzleSchema, n as ColumnType, o as currentSchemaVersion, p as devices, r as SCHEMAS, s as dimensionToColumn, t as ColumnDef, u as DrizzleSchema } from "./_chunks/schema.mjs";
|
|
4
4
|
import { InspectionVerdict, SchedulePolicy, ScheduleState, fixedPolicy, inspectionPolicy, sitemapPolicy } from "./schedule.mjs";
|
|
@@ -10,4 +10,4 @@ declare function coerceRow(row: Row$1): Row$1;
|
|
|
10
10
|
declare function coerceRows(rows: readonly Row$1[]): Row$1[];
|
|
11
11
|
declare const MAX_DAY_BYTES: number;
|
|
12
12
|
declare function createStorageEngine(opts: EngineOptions): StorageEngine;
|
|
13
|
-
export { type CodecCtx, type ColumnDef, type ColumnType, type CompactionThresholds, type CompactionTier,
|
|
13
|
+
export { type CodecCtx, type ColumnDef, type ColumnType, type CompactionThresholds, type CompactionTier, DEFAULT_SEARCH_TYPE, type DataSource, type DrizzleSchema, type DuckDBFactory, type DuckDBHandle, type EngineOptions, FILES_PLACEHOLDER, type FileSetRef, type GcCtx, type GscApiRow, type IngestOptions, type InspectionVerdict, type ListLiveFilter, type LockScope, MAX_DAY_BYTES, type ManifestEntry, type ManifestPurgeResult, type ManifestStore, type ParquetCodec, type PurgeFilter, type PurgeResult, type PurgeUrlsResult, type QueryCtx, type QueryExecuteOptions, type QueryExecuteResult, type QueryExecutor, type QueryResult, type ResolvedQuery, type Row, type RowAccumulator, type RowAccumulatorOptions, type RunSQLOptions, SCHEMAS, type SchedulePolicy, type ScheduleState, type SearchType, type StorageEngine, type SyncState, type SyncStateDetail, type SyncStateFilter, type SyncStateKind, type SyncStateScope, TABLE_METADATA, type TableName, type TableSchema, type TenantCtx, type Watermark, type WatermarkFilter, type WatermarkScope, type WriteCtx, type WriteResult, allTables, bindLiterals, canonicalEmptyParquetSchema, coerceRow, coerceRows, countries, createDuckDBCodec, createDuckDBExecutor, createRowAccumulator, createStorageEngine, currentSchemaVersion, dayPartition, devices, dimensionToColumn, drizzleSchema, enumeratePartitions, fixedPolicy, formatLiteral, inferLegacyTier, inferSearchType, inferTable, inspectionPolicy, keywords, objectKey, page_keywords, pages, resolveToSQL, sitemapPolicy, substituteNamedFiles, toPath, toSumPosition, transformGscRow };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as coerceRows, t as coerceRow } from "./_chunks/coerce.mjs";
|
|
1
2
|
import { a as inferTable, c as countries, d as keywords, f as page_keywords, i as dimensionToColumn, l as devices, n as allTables, p as pages, r as currentSchemaVersion, s as TABLE_METADATA, t as SCHEMAS, u as drizzleSchema } from "./_chunks/schema.mjs";
|
|
2
3
|
import { i as inferSearchType, n as dayPartition, r as inferLegacyTier, s as objectKey, t as DEFAULT_SEARCH_TYPE } from "./_chunks/storage.mjs";
|
|
3
4
|
import { i as substituteNamedFiles, o as enumeratePartitions, r as resolveToSQL, t as FILES_PLACEHOLDER } from "./_chunks/compiler.mjs";
|
|
@@ -6,17 +7,4 @@ import { a as createDuckDBExecutor, i as createDuckDBCodec, n as createStorageEn
|
|
|
6
7
|
import { createRowAccumulator, toPath, toSumPosition, transformGscRow } from "./ingest.mjs";
|
|
7
8
|
import "./planner.mjs";
|
|
8
9
|
import { fixedPolicy, inspectionPolicy, sitemapPolicy } from "./schedule.mjs";
|
|
9
|
-
function coerceRow(row) {
|
|
10
|
-
let mutated = null;
|
|
11
|
-
for (const [k, v] of Object.entries(row)) if (typeof v === "bigint") {
|
|
12
|
-
if (!mutated) mutated = { ...row };
|
|
13
|
-
mutated[k] = Number(v);
|
|
14
|
-
}
|
|
15
|
-
return mutated ?? row;
|
|
16
|
-
}
|
|
17
|
-
function coerceRows(rows) {
|
|
18
|
-
const out = Array.from({ length: rows.length });
|
|
19
|
-
for (let i = 0; i < rows.length; i++) out[i] = coerceRow(rows[i]);
|
|
20
|
-
return out;
|
|
21
|
-
}
|
|
22
10
|
export { DEFAULT_SEARCH_TYPE, FILES_PLACEHOLDER, MAX_DAY_BYTES, SCHEMAS, TABLE_METADATA, allTables, bindLiterals, canonicalEmptyParquetSchema, coerceRow, coerceRows, countries, createDuckDBCodec, createDuckDBExecutor, createRowAccumulator, createStorageEngine, currentSchemaVersion, dayPartition, devices, dimensionToColumn, drizzleSchema, enumeratePartitions, fixedPolicy, formatLiteral, inferLegacyTier, inferSearchType, inferTable, inspectionPolicy, keywords, objectKey, page_keywords, pages, resolveToSQL, sitemapPolicy, substituteNamedFiles, toPath, toSumPosition, transformGscRow };
|
package/dist/ingest.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as Row, j as TableName } from "./_chunks/storage.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* Canonical GSC API dimension order per table. Consumers hitting the raw
|
|
4
4
|
* `searchanalytics.query` endpoint must request dimensions in this order so
|
package/dist/planner.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { U as enumeratePartitions } from "./_chunks/storage.mjs";
|
|
2
2
|
import { a as substituteNamedFiles, i as resolveToSQL, n as ResolvedQuery, r as compileLogicalQueryPlan, t as FILES_PLACEHOLDER } from "./_chunks/planner.mjs";
|
|
3
3
|
export { FILES_PLACEHOLDER, ResolvedQuery, compileLogicalQueryPlan, enumeratePartitions, resolveToSQL, substituteNamedFiles };
|
|
@@ -49,6 +49,7 @@ interface SqlFragments<TableKey extends string> {
|
|
|
49
49
|
dimExprSql: (dim: Dimension, tableKey: TableKey) => SQL;
|
|
50
50
|
metricSql: (metric: Metric, tableKey: TableKey) => SQL;
|
|
51
51
|
havingPredicates: (filters: InternalFilter[], tableKey: TableKey) => SQL[];
|
|
52
|
+
prefilterPredicates: (filters: InternalFilter[], tableKey: TableKey) => SQL[];
|
|
52
53
|
dimensionPredicates: (filters: InternalFilter[], tableKey: TableKey) => SQL[];
|
|
53
54
|
topLevelPredicate: (filters: InternalFilter[], tableKey: TableKey) => SQL | undefined;
|
|
54
55
|
}
|
package/dist/resolver/index.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { a as DIMENSION_SURFACES, c as
|
|
2
|
-
import { a as getInternalFilters, c as matchesTopLevelPage, i as getFilterDimensions, l as metricValue, n as dimensionValue, o as matchesDimensionFilter, r as getDimensionFilters, s as matchesMetricFilter, t as assertSchemaInSync } from "../_chunks/resolver.mjs";
|
|
1
|
+
import { C as dimensionColumn, S as assertDimensionsSupported, T as supportsDimensionOnSurface, _ as resolveToSQLOptimized, a as getDimensionFilters, b as DIMENSION_SURFACES, c as matchesDimensionFilter, d as metricValue, f as buildExtrasQueries, g as resolveToSQL, h as resolveComparisonSQL, i as dimensionValue, l as matchesMetricFilter, m as mergeExtras, n as createParquetResolverAdapter, o as getFilterDimensions, p as buildTotalsSql, r as pgResolverAdapter, s as getInternalFilters, t as assertSchemaInSync, u as matchesTopLevelPage, v as createResolverAdapter, w as inferLogicalDataset, x as LOGICAL_DATASETS, y as createSqlFragments } from "../_chunks/resolver.mjs";
|
|
3
2
|
export { DIMENSION_SURFACES, LOGICAL_DATASETS, assertDimensionsSupported, assertSchemaInSync, buildExtrasQueries, buildTotalsSql, createParquetResolverAdapter, createResolverAdapter, createSqlFragments, dimensionColumn, dimensionValue, getDimensionFilters, getFilterDimensions, getInternalFilters, inferLogicalDataset, matchesDimensionFilter, matchesMetricFilter, matchesTopLevelPage, mergeExtras, metricValue, pgResolverAdapter, resolveComparisonSQL, resolveToSQL, resolveToSQLOptimized, supportsDimensionOnSurface };
|
package/dist/rollups.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as DataSource, o as FileSetRef } from "./_chunks/storage.mjs";
|
|
2
2
|
import { t as ColumnDef } from "./_chunks/schema.mjs";
|
|
3
3
|
import { TenantCtx } from "@gscdump/contracts";
|
|
4
4
|
import * as _$_gscdump_engine_contracts0 from "@gscdump/engine/contracts";
|
package/dist/source/index.d.mts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as ResolverAdapter } from "../_chunks/types.mjs";
|
|
1
|
+
import { M as TenantCtx, S as Row, T as StorageEngine } from "../_chunks/storage.mjs";
|
|
3
2
|
import { n as AnalysisResult, t as AnalysisParams } from "../_chunks/analysis-types.mjs";
|
|
3
|
+
import { o as ResolverAdapter } from "../_chunks/types.mjs";
|
|
4
4
|
import { C as ExecuteSqlOptions, E as SourceCapabilities, S as AnalysisSourceKind, T as QueryRow, t as AnalyzerRegistry, w as FileSet, x as AnalysisQuerySource } from "../_chunks/registry.mjs";
|
|
5
5
|
import { PlannerCapabilities } from "gscdump/query/plan";
|
|
6
6
|
import { BuilderState } from "gscdump/query";
|
|
7
7
|
interface AttachedTableRunner {
|
|
8
8
|
/**
|
|
9
9
|
* Run a query with positional (`?`) bound parameters. Return objects keyed
|
|
10
|
-
* by column name.
|
|
11
|
-
*
|
|
10
|
+
* by column name. BIGINT → number coercion is applied by the source factory
|
|
11
|
+
* (see `coerceRows`); runners only need to handle DATE → ISO string (or
|
|
12
|
+
* let the analyzer reducer normalize via `num(v)`/`str(v)`).
|
|
12
13
|
*/
|
|
13
14
|
query: (sql: string, params?: unknown[], signal?: AbortSignal) => Promise<Row[]>;
|
|
14
15
|
}
|
package/dist/source/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as coerceRows } from "../_chunks/coerce.mjs";
|
|
2
|
+
import { S as assertDimensionsSupported, g as resolveToSQL, o as getFilterDimensions, r as pgResolverAdapter } from "../_chunks/resolver.mjs";
|
|
3
3
|
import { n as runAnalyzerFromSource } from "../_chunks/dispatch.mjs";
|
|
4
4
|
var AttachedTableMissingError = class extends Error {
|
|
5
5
|
missing;
|
|
@@ -12,8 +12,7 @@ var AttachedTableMissingError = class extends Error {
|
|
|
12
12
|
const ATTACHED_TABLE_CAPABILITIES = {
|
|
13
13
|
fileSets: true,
|
|
14
14
|
attachedTables: true,
|
|
15
|
-
regex: true
|
|
16
|
-
executeSql: true
|
|
15
|
+
regex: true
|
|
17
16
|
};
|
|
18
17
|
const ATTACHED_TABLE_CAPABILITIES_WITH_ADAPTER = {
|
|
19
18
|
...ATTACHED_TABLE_CAPABILITIES,
|
|
@@ -47,7 +46,7 @@ function createAttachedTableSource(runner, options) {
|
|
|
47
46
|
if (missing.length > 0) throw new AttachedTableMissingError(missing);
|
|
48
47
|
}
|
|
49
48
|
const rewritten = rewriteForTableSource(sql, schema, fileSets);
|
|
50
|
-
return await runner.query(rewritten, params ?? [], signal);
|
|
49
|
+
return coerceRows(await runner.query(rewritten, params ?? [], signal));
|
|
51
50
|
}
|
|
52
51
|
};
|
|
53
52
|
}
|
|
@@ -59,7 +58,6 @@ function createSqlQuerySource(options) {
|
|
|
59
58
|
capabilities: {
|
|
60
59
|
...adapter.capabilities,
|
|
61
60
|
...extraCapabilities,
|
|
62
|
-
executeSql: true,
|
|
63
61
|
adapter: true
|
|
64
62
|
},
|
|
65
63
|
adapter,
|
|
@@ -69,10 +67,10 @@ function createSqlQuerySource(options) {
|
|
|
69
67
|
adapter,
|
|
70
68
|
siteId
|
|
71
69
|
});
|
|
72
|
-
return execute(resolved.sql, resolved.params);
|
|
70
|
+
return coerceRows(await execute(resolved.sql, resolved.params));
|
|
73
71
|
},
|
|
74
|
-
executeSql(sql, params) {
|
|
75
|
-
return execute(sql, params ?? []);
|
|
72
|
+
async executeSql(sql, params) {
|
|
73
|
+
return coerceRows(await execute(sql, params ?? []));
|
|
76
74
|
}
|
|
77
75
|
};
|
|
78
76
|
}
|
|
@@ -93,7 +91,6 @@ const ENGINE_QUERY_CAPABILITIES = {
|
|
|
93
91
|
const ENGINE_SOURCE_CAPABILITIES = {
|
|
94
92
|
...ENGINE_QUERY_CAPABILITIES,
|
|
95
93
|
fileSets: true,
|
|
96
|
-
executeSql: true,
|
|
97
94
|
adapter: true
|
|
98
95
|
};
|
|
99
96
|
function createEngineQuerySource(options) {
|
|
@@ -107,7 +104,7 @@ function createEngineQuerySource(options) {
|
|
|
107
104
|
const filterDims = getFilterDimensions(state.filter, isMetricDimension);
|
|
108
105
|
assertDimensionsSupported([...state.dimensions, ...filterDims], "stored", "engine query source");
|
|
109
106
|
if (state.dimensions.includes("queryCanonical") || filterDims.includes("queryCanonical")) throw new Error("engine query source does not support queryCanonical; use browser/sqlite query sources for derived dimensions");
|
|
110
|
-
return (await engine.query(ctx, state)).rows;
|
|
107
|
+
return coerceRows((await engine.query(ctx, state)).rows);
|
|
111
108
|
},
|
|
112
109
|
async executeSql(sql, params, opts) {
|
|
113
110
|
const fileSets = opts?.fileSets;
|
|
@@ -119,7 +116,7 @@ function createEngineQuerySource(options) {
|
|
|
119
116
|
sql,
|
|
120
117
|
params: params ?? []
|
|
121
118
|
});
|
|
122
|
-
return rows;
|
|
119
|
+
return coerceRows(rows);
|
|
123
120
|
}
|
|
124
121
|
};
|
|
125
122
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/engine",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.13.0",
|
|
5
5
|
"description": "Append-only Parquet/DuckDB storage engine + planner + adapters for the gscdump pipeline. Node + edge runtimes; opt-in heavy peers.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -169,8 +169,8 @@
|
|
|
169
169
|
"dependencies": {
|
|
170
170
|
"drizzle-orm": "^0.45.2",
|
|
171
171
|
"proper-lockfile": "^4.1.2",
|
|
172
|
-
"gscdump": "0.
|
|
173
|
-
"
|
|
172
|
+
"@gscdump/contracts": "0.13.0",
|
|
173
|
+
"gscdump": "0.13.0"
|
|
174
174
|
},
|
|
175
175
|
"devDependencies": {
|
|
176
176
|
"@duckdb/duckdb-wasm": "^1.32.0",
|