@gscdump/engine 1.4.6 → 1.4.8
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataSource, StorageEngine } from "../storage.mjs";
|
|
2
|
-
import { SearchType } from "gscdump/query";
|
|
3
2
|
import { Row, TableName, TenantCtx } from "@gscdump/contracts";
|
|
3
|
+
import { SearchType } from "gscdump/query";
|
|
4
4
|
interface NodeHarnessOptions {
|
|
5
5
|
dataDir: string;
|
|
6
6
|
/** Tenant user id. Defaults to `'local'` for single-user CLI installs. */
|
package/dist/entities.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { readOptional } from "./adapters/read-optional.mjs";
|
|
|
4
4
|
import { SITEMAP_PROJECTION_GRACE_MS, decodeSitemapProjectionManifest, emptySitemapProjectionManifest, parseSitemapProjectionManifest, selectSitemapProjectionFiles, withSitemapProjectionFeed } from "./sitemap-projection.mjs";
|
|
5
5
|
import { buildQueryDimRecords, createQueryDimStore } from "./query-dim.mjs";
|
|
6
6
|
import { encodeJsonBigintSafe } from "@gscdump/lakehouse/bigint";
|
|
7
|
+
import { GSCDUMP_INDEXING_TRANSITION_FIELDS } from "@gscdump/contracts";
|
|
7
8
|
const YEAR_MONTH_RE = /^(\d{4})-(\d{2})-/;
|
|
8
9
|
const ENTITY_IO_CONCURRENCY = 8;
|
|
9
10
|
async function mapEntityIo(items, fn) {
|
|
@@ -157,14 +158,6 @@ const INSPECTION_EVENT_COLUMNS = [
|
|
|
157
158
|
nullable: true
|
|
158
159
|
}
|
|
159
160
|
];
|
|
160
|
-
const TRANSITION_STATE_FIELDS = [
|
|
161
|
-
"indexStatus",
|
|
162
|
-
"coverageState",
|
|
163
|
-
"robotsTxtState",
|
|
164
|
-
"indexingState",
|
|
165
|
-
"pageFetchState",
|
|
166
|
-
"googleCanonical"
|
|
167
|
-
];
|
|
168
161
|
const INSPECTION_TRANSITION_COLUMNS = [
|
|
169
162
|
{
|
|
170
163
|
name: "urlHash",
|
|
@@ -186,7 +179,7 @@ const INSPECTION_TRANSITION_COLUMNS = [
|
|
|
186
179
|
type: "VARCHAR",
|
|
187
180
|
nullable: false
|
|
188
181
|
},
|
|
189
|
-
...
|
|
182
|
+
...GSCDUMP_INDEXING_TRANSITION_FIELDS.flatMap((field) => {
|
|
190
183
|
const capped = field[0].toUpperCase() + field.slice(1);
|
|
191
184
|
return [{
|
|
192
185
|
name: `from${capped}`,
|
|
@@ -200,7 +193,7 @@ const INSPECTION_TRANSITION_COLUMNS = [
|
|
|
200
193
|
})
|
|
201
194
|
];
|
|
202
195
|
function isStateTransition(before, after) {
|
|
203
|
-
return
|
|
196
|
+
return GSCDUMP_INDEXING_TRANSITION_FIELDS.some((field) => (before[field] ?? null) !== (after[field] ?? null));
|
|
204
197
|
}
|
|
205
198
|
function buildTransitionRow(before, after) {
|
|
206
199
|
const row = {
|
|
@@ -209,7 +202,7 @@ function buildTransitionRow(before, after) {
|
|
|
209
202
|
changedAfter: String(before.inspectedAt ?? ""),
|
|
210
203
|
changedBefore: String(after.inspectedAt ?? "")
|
|
211
204
|
};
|
|
212
|
-
for (const field of
|
|
205
|
+
for (const field of GSCDUMP_INDEXING_TRANSITION_FIELDS) {
|
|
213
206
|
const capped = field[0].toUpperCase() + field.slice(1);
|
|
214
207
|
row[`from${capped}`] = before[field] ?? null;
|
|
215
208
|
row[`to${capped}`] = after[field] ?? null;
|
|
@@ -374,6 +367,7 @@ function createInspectionStore(opts) {
|
|
|
374
367
|
for (const row of baseRows) consider(row);
|
|
375
368
|
let eventsFolded = 0;
|
|
376
369
|
const consumed = [];
|
|
370
|
+
const eventRows = [];
|
|
377
371
|
const eventFiles = await mapEntityIo(eventKeys.sort(), async (key) => {
|
|
378
372
|
const bytes = await readOptional(ds, key);
|
|
379
373
|
if (!bytes) return void 0;
|
|
@@ -386,11 +380,11 @@ function createInspectionStore(opts) {
|
|
|
386
380
|
if (!file) continue;
|
|
387
381
|
const { key, rows } = file;
|
|
388
382
|
consumed.push(key);
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
eventsFolded++;
|
|
392
|
-
}
|
|
383
|
+
eventRows.push(...rows);
|
|
384
|
+
eventsFolded += rows.length;
|
|
393
385
|
}
|
|
386
|
+
eventRows.sort((a, b) => String(a.urlHash).localeCompare(String(b.urlHash)) || String(a.inspectedAt ?? "").localeCompare(String(b.inspectedAt ?? "")));
|
|
387
|
+
for (const row of eventRows) consider(row);
|
|
394
388
|
const merged = [];
|
|
395
389
|
for (const [h, row] of latest) {
|
|
396
390
|
const fc = earliestChecked.get(h);
|
|
@@ -401,8 +395,8 @@ function createInspectionStore(opts) {
|
|
|
401
395
|
columns: INSPECTION_EVENT_COLUMNS,
|
|
402
396
|
sortKey: ["urlHash"]
|
|
403
397
|
});
|
|
404
|
-
await ds.write(baseKey, bytes);
|
|
405
398
|
const transitionsWritten = opts?.transitions ? await appendTransitions(ds, ctx, transitions) : 0;
|
|
399
|
+
await ds.write(baseKey, bytes);
|
|
406
400
|
if (consumed.length > 0) await ds.delete(consumed);
|
|
407
401
|
return {
|
|
408
402
|
baseRowCount: merged.length,
|
package/dist/layout.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CompactionTier, ManifestEntry } from "./storage.mjs";
|
|
2
|
-
import { SearchType } from "gscdump/query";
|
|
3
2
|
import { TableName, TenantCtx } from "@gscdump/contracts";
|
|
3
|
+
import { SearchType } from "gscdump/query";
|
|
4
4
|
declare function dayPartition(date: string): string;
|
|
5
5
|
/**
|
|
6
6
|
* Hourly partition keyed by the PT calendar day (`YYYY-MM-DD`). One parquet
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SearchType as SearchType$1, TableName as TableName$1 } from "../storage.mjs";
|
|
2
2
|
import { ComparisonFilter } from "./types.mjs";
|
|
3
|
-
import { BuilderState } from "gscdump/query";
|
|
4
3
|
import { Grain } from "@gscdump/contracts";
|
|
4
|
+
import { BuilderState } from "gscdump/query";
|
|
5
5
|
interface RunQueryCtx {
|
|
6
6
|
userId: string;
|
|
7
7
|
siteId: string;
|
package/dist/rollups.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import { DataSource, FileSetRef, Row as Row$1, TableName as TableName$1 } from "
|
|
|
2
2
|
import { ColumnDef } from "./schema.mjs";
|
|
3
3
|
import { EngineError } from "./errors.mjs";
|
|
4
4
|
import "./contracts.mjs";
|
|
5
|
-
import { SearchType } from "gscdump/query";
|
|
6
5
|
import { TenantCtx } from "@gscdump/contracts";
|
|
6
|
+
import { SearchType } from "gscdump/query";
|
|
7
7
|
interface RollupCtx extends TenantCtx {
|
|
8
8
|
/** When the rollup was built. Stamped into payload + filename. */
|
|
9
9
|
builtAt: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResolverAdapter } from "../resolver/types.mjs";
|
|
2
2
|
import { PlannerCapabilities } from "gscdump/query/plan";
|
|
3
|
-
import { BuilderState } from "gscdump/query";
|
|
4
3
|
import { TableName } from "@gscdump/contracts";
|
|
4
|
+
import { BuilderState } from "gscdump/query";
|
|
5
5
|
type QueryRow = Record<string, unknown>;
|
|
6
6
|
interface FileSet {
|
|
7
7
|
table: TableName;
|
package/dist/storage.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CompactionThresholds } from "./compaction.mjs";
|
|
2
2
|
import { ParquetQueryFilter } from "./node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/index.mjs";
|
|
3
3
|
import "./node_modules/.pnpm/hyparquet@1.26.2/node_modules/hyparquet/types/node.mjs";
|
|
4
|
-
import { BuilderState, SearchType, SearchType as SearchType$1 } from "gscdump/query";
|
|
5
4
|
import { Grain, Grain as Grain$1, Row, Row as Row$1, TableName, TableName as TableName$1, TenantCtx, TenantCtx as TenantCtx$1 } from "@gscdump/contracts";
|
|
5
|
+
import { BuilderState, SearchType, SearchType as SearchType$1 } from "gscdump/query";
|
|
6
6
|
interface WriteCtx extends TenantCtx {
|
|
7
7
|
table: TableName;
|
|
8
8
|
date?: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/engine",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.8",
|
|
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",
|
|
@@ -181,9 +181,9 @@
|
|
|
181
181
|
"dependencies": {
|
|
182
182
|
"drizzle-orm": "1.0.0-rc.3",
|
|
183
183
|
"proper-lockfile": "^4.1.2",
|
|
184
|
-
"@gscdump/contracts": "^1.4.
|
|
185
|
-
"gscdump": "^1.4.
|
|
186
|
-
"
|
|
184
|
+
"@gscdump/contracts": "^1.4.8",
|
|
185
|
+
"@gscdump/lakehouse": "^1.4.8",
|
|
186
|
+
"gscdump": "^1.4.8"
|
|
187
187
|
},
|
|
188
188
|
"devDependencies": {
|
|
189
189
|
"@duckdb/duckdb-wasm": "1.33.1-dev57.0",
|