@gscdump/cli 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.
Files changed (2) hide show
  1. package/dist/index.mjs +10 -7
  2. package/package.json +6 -6
package/dist/index.mjs CHANGED
@@ -20,11 +20,12 @@ import { createConsola } from "consola";
20
20
  import { SearchTypes, and, between, contains, country, date, device, eq, gsc, hour, isQueryError, notRegex, page, query, regex, searchAppearance } from "gscdump/query";
21
21
  import { createNodeHarness } from "@gscdump/engine/node";
22
22
  import { TABLE_DIMS, transformGscRow } from "@gscdump/engine/ingest";
23
- import { allTables, inferTable } from "@gscdump/engine/schema";
23
+ import { allTables, dateColumnsFor, inferTable } from "@gscdump/engine/schema";
24
24
  import { isAnalysisError } from "@gscdump/analysis/errors";
25
25
  import { isEngineError } from "@gscdump/engine/errors";
26
26
  import { DuckDBInstance } from "@duckdb/node-api";
27
27
  import { sqlEscape } from "@gscdump/engine/sql";
28
+ import { dateReplaceClause } from "@gscdump/engine/sql-fragments";
28
29
  import { createEmptyTypesStore, createIndexingMetadataStore, createInspectionStore, createSitemapStore } from "@gscdump/engine/entities";
29
30
  import { daysAgo, getDateRange, progressBar } from "gscdump";
30
31
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -135,7 +136,7 @@ function loadEnvFromCwd() {
135
136
  }
136
137
  return applied;
137
138
  }
138
- var version = "0.28.3";
139
+ var version = "0.29.0";
139
140
  const ALL_SEARCH_TYPES$1 = Object.values(SearchTypes);
140
141
  const VERSION = version;
141
142
  function noSubcommandSelected(parent, subNames) {
@@ -2061,7 +2062,7 @@ const VALID_KEYS = [
2061
2062
  "defaultDataState",
2062
2063
  "serviceAccountPath"
2063
2064
  ];
2064
- const NUMERIC_KEYS = new Set(["defaultLimit"]);
2065
+ const NUMERIC_KEYS = /* @__PURE__ */ new Set(["defaultLimit"]);
2065
2066
  const configCommand = defineCommand({
2066
2067
  meta: {
2067
2068
  name: "config",
@@ -2785,7 +2786,7 @@ async function dumpRowFormat(store, entries, outDir, siteUrl, format) {
2785
2786
  let files = 0;
2786
2787
  let totalRows = 0;
2787
2788
  for (const [table, tableEntries] of byTable) {
2788
- const rows = await readTableRows(tableEntries.map((e) => path.join(store.dataDir, e.objectKey)));
2789
+ const rows = await readTableRows(tableEntries.map((e) => path.join(store.dataDir, e.objectKey)), table);
2789
2790
  const ext = format === "csv" ? "csv" : format === "ndjson" ? "ndjson" : "json";
2790
2791
  const target = path.join(siteDir, `${table}.${ext}`);
2791
2792
  let body;
@@ -2801,12 +2802,13 @@ async function dumpRowFormat(store, entries, outDir, siteUrl, format) {
2801
2802
  rows: totalRows
2802
2803
  };
2803
2804
  }
2804
- async function readTableRows(filePaths) {
2805
+ async function readTableRows(filePaths, table) {
2805
2806
  const instance = await DuckDBInstance.create(":memory:");
2806
2807
  const conn = await instance.connect();
2807
2808
  try {
2808
2809
  const fileList = filePaths.map((p) => `'${sqlEscape(p)}'`).join(", ");
2809
- return (await conn.runAndReadAll(`SELECT * FROM read_parquet([${fileList}], union_by_name=true)`)).getRowObjects();
2810
+ const replace = dateReplaceClause(dateColumnsFor(table), "string");
2811
+ return (await conn.runAndReadAll(`SELECT * ${replace} FROM read_parquet([${fileList}], union_by_name=true)`)).getRowObjects();
2810
2812
  } finally {
2811
2813
  conn.closeSync();
2812
2814
  instance.closeSync();
@@ -6204,7 +6206,8 @@ async function exportToDuckDB(opts) {
6204
6206
  });
6205
6207
  if (entries.length === 0) continue;
6206
6208
  const fileList = entries.map((e) => path.join(opts.dataDir, e.objectKey)).map((p) => `'${sqlEscape(p)}'`).join(", ");
6207
- await conn.run(`CREATE OR REPLACE TABLE ${table} AS SELECT * FROM read_parquet([${fileList}], union_by_name=true)`);
6209
+ const replace = dateReplaceClause(dateColumnsFor(table), "date");
6210
+ await conn.run(`CREATE OR REPLACE TABLE ${table} AS SELECT * ${replace} FROM read_parquet([${fileList}], union_by_name=true)`);
6208
6211
  const rows = (await conn.runAndReadAll(`SELECT count(*)::BIGINT AS n FROM ${table}`)).getRowObjects();
6209
6212
  const rowCount = Number(rows[0]?.n ?? 0);
6210
6213
  tables.push({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/cli",
3
3
  "type": "module",
4
- "version": "0.28.3",
4
+ "version": "0.29.0",
5
5
  "description": "CLI for Google Search Console - dump, query, and run MCP server",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -35,7 +35,7 @@
35
35
  "dist"
36
36
  ],
37
37
  "dependencies": {
38
- "@clack/prompts": "^1.5.1",
38
+ "@clack/prompts": "^1.6.0",
39
39
  "@modelcontextprotocol/sdk": "^1.29.0",
40
40
  "citty": "^0.2.2",
41
41
  "consola": "^3.4.2",
@@ -43,10 +43,10 @@
43
43
  "ofetch": "^1.5.1",
44
44
  "open": "^11.0.0",
45
45
  "zod": "^4.4.3",
46
- "@gscdump/analysis": "0.28.3",
47
- "@gscdump/engine": "0.28.3",
48
- "@gscdump/engine-gsc-api": "0.28.3",
49
- "gscdump": "0.28.3"
46
+ "@gscdump/analysis": "0.29.0",
47
+ "@gscdump/engine-gsc-api": "0.29.0",
48
+ "@gscdump/engine": "0.29.0",
49
+ "gscdump": "0.29.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@duckdb/node-api": "1.5.1-r.2",