@gscdump/engine-gsc-api 5.3.0 → 5.6.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/index.d.mts CHANGED
@@ -2,5 +2,5 @@ import { CreateLiveGscSourceOptions, canProxyToGsc, createLiveGscSource } from "
2
2
  import { FetchTopNOptions, GscDailyRow, GscRange, GscTopNRow, fetchGscDaily, fetchGscTopN } from "./rollup-synth.mjs";
3
3
  import { GSC_API_CAPABILITIES, GscApiQuerySourceOptions, createGscApiQuerySource } from "./source.mjs";
4
4
  import { GscSyncEntryWork, GscSyncFanoutEntry, GscSyncLedgerRow, GscSyncWindow, GscSyncWorkPlan, PlanGscBackfillDatesOptions, PlanGscBackwardDatesOptions, PlanGscSyncWorkOptions, gscSyncFanout, ledgerTablesForGscSync, planGscBackfillDates, planGscSyncWork, tablesCoveredByGscSync } from "./sync-plan.mjs";
5
- import { GscAggregation, GscApiRow, RunGscSearchAppearanceContextSliceOptions, RunGscSearchAppearanceContextSliceResult, RunGscSyncSliceOptions, RunGscSyncSliceResult, SearchAppearanceContextGrain, SearchAppearanceContextTable, SyncSliceDimensionFilter, SyncSliceDomainFilter, hostPagePattern, requestAggregation, runGscSearchAppearanceContextSlice, runGscSyncSlice } from "./sync-slice.mjs";
6
- export { type CreateLiveGscSourceOptions, type FetchTopNOptions, GSC_API_CAPABILITIES, type GscAggregation, type GscApiQuerySourceOptions, type GscApiRow, type GscDailyRow, type GscRange, type GscSyncEntryWork, type GscSyncFanoutEntry, type GscSyncLedgerRow, type GscSyncWindow, type GscSyncWorkPlan, type GscTopNRow, type PlanGscBackfillDatesOptions, type PlanGscBackwardDatesOptions, type PlanGscSyncWorkOptions, type RunGscSearchAppearanceContextSliceOptions, type RunGscSearchAppearanceContextSliceResult, type RunGscSyncSliceOptions, type RunGscSyncSliceResult, type SearchAppearanceContextGrain, type SearchAppearanceContextTable, type SyncSliceDimensionFilter, type SyncSliceDomainFilter, canProxyToGsc, createGscApiQuerySource, createLiveGscSource, fetchGscDaily, fetchGscTopN, gscSyncFanout, hostPagePattern, ledgerTablesForGscSync, planGscBackfillDates, planGscSyncWork, requestAggregation, runGscSearchAppearanceContextSlice, runGscSyncSlice, tablesCoveredByGscSync };
5
+ import { GscAggregation, GscApiRow, GscCommittedPage, RunGscSearchAppearanceContextSliceOptions, RunGscSearchAppearanceContextSliceResult, RunGscSyncSliceOptions, RunGscSyncSliceResult, SearchAppearanceContextGrain, SearchAppearanceContextTable, SyncSliceDimensionFilter, SyncSliceDomainFilter, hostPagePattern, requestAggregation, runGscSearchAppearanceContextSlice, runGscSyncSlice } from "./sync-slice.mjs";
6
+ export { type CreateLiveGscSourceOptions, type FetchTopNOptions, GSC_API_CAPABILITIES, type GscAggregation, type GscApiQuerySourceOptions, type GscApiRow, type GscCommittedPage, type GscDailyRow, type GscRange, type GscSyncEntryWork, type GscSyncFanoutEntry, type GscSyncLedgerRow, type GscSyncWindow, type GscSyncWorkPlan, type GscTopNRow, type PlanGscBackfillDatesOptions, type PlanGscBackwardDatesOptions, type PlanGscSyncWorkOptions, type RunGscSearchAppearanceContextSliceOptions, type RunGscSearchAppearanceContextSliceResult, type RunGscSyncSliceOptions, type RunGscSyncSliceResult, type SearchAppearanceContextGrain, type SearchAppearanceContextTable, type SyncSliceDimensionFilter, type SyncSliceDomainFilter, canProxyToGsc, createGscApiQuerySource, createLiveGscSource, fetchGscDaily, fetchGscTopN, gscSyncFanout, hostPagePattern, ledgerTablesForGscSync, planGscBackfillDates, planGscSyncWork, requestAggregation, runGscSearchAppearanceContextSlice, runGscSyncSlice, tablesCoveredByGscSync };
@@ -1,4 +1,4 @@
1
- import { GoogleSearchConsoleClient } from "gscdump";
1
+ import { GoogleSearchConsoleClient, SearchAnalyticsQuery } from "gscdump";
2
2
  import { SearchType } from "@gscdump/engine";
3
3
  import { GscDataState, GscSearchAnalyticsMetadata } from "gscdump/contracts";
4
4
  export interface GscApiRow {
@@ -8,6 +8,14 @@ export interface GscApiRow {
8
8
  ctr: number;
9
9
  position: number;
10
10
  }
11
+ export interface GscCommittedPage {
12
+ siteUrl: string;
13
+ request: SearchAnalyticsQuery;
14
+ rows: GscApiRow[];
15
+ terminal: boolean;
16
+ aggregation: GscAggregation;
17
+ metadata: GscSearchAnalyticsMetadata | undefined;
18
+ }
11
19
  export interface SyncSliceDomainFilter {
12
20
  /**
13
21
  * Exact registered host to scope the slice to, without a protocol.
@@ -67,6 +75,8 @@ export interface RunGscSyncSliceOptions {
67
75
  searchType: SearchType;
68
76
  rowsThisPage: number;
69
77
  }) => void;
78
+ /** Durable outcomes include empty terminal pages and follow successful batch commits. */
79
+ onCommittedPage?: (page: GscCommittedPage) => Promise<void>;
70
80
  }
71
81
  /**
72
82
  * How GSC counted impressions for a request. Grouping or filtering by `page`
@@ -116,6 +126,7 @@ export interface RunGscSearchAppearanceContextSliceOptions {
116
126
  searchType: SearchType;
117
127
  rowsThisPage: number;
118
128
  }) => void;
129
+ onCommittedPage?: (page: GscCommittedPage) => Promise<void>;
119
130
  continuation?: SearchAppearanceContinuation;
120
131
  }
121
132
  export type SearchAppearanceContinuation = {
@@ -75,6 +75,7 @@ async function runGscSyncSlice(opts) {
75
75
  return {
76
76
  kind: "ok",
77
77
  startRow: row,
78
+ request: query,
78
79
  reported: reportedAggregation(response.responseAggregationType),
79
80
  rows: response.rows ?? [],
80
81
  metadata: response.metadata
@@ -138,6 +139,14 @@ async function runGscSyncSlice(opts) {
138
139
  aggregation
139
140
  };
140
141
  }
142
+ await opts.onCommittedPage?.({
143
+ siteUrl: opts.siteUrl,
144
+ request: page.request,
145
+ rows,
146
+ terminal: isLastPage,
147
+ aggregation,
148
+ metadata: page.metadata
149
+ });
141
150
  if (isLastPage) return {
142
151
  totalRows,
143
152
  hasMore: false,
@@ -193,6 +202,7 @@ async function runGscSearchAppearanceContextSlice(opts) {
193
202
  searchType: opts.searchType,
194
203
  initialStartRow: opts.continuation?.phase === "discovery" ? opts.continuation.nextStartRow : void 0,
195
204
  onPage: opts.onPage,
205
+ onCommittedPage: opts.onCommittedPage,
196
206
  onBatch: async (rows) => {
197
207
  for (const row of rows) {
198
208
  const value = String(row.keys?.[0] ?? "");
@@ -241,6 +251,7 @@ async function runGscSearchAppearanceContextSlice(opts) {
241
251
  searchType: opts.searchType,
242
252
  initialStartRow: i === startIndex ? startRow : void 0,
243
253
  onPage: opts.onPage,
254
+ onCommittedPage: opts.onCommittedPage,
244
255
  onBatch: (rows) => opts.onContextBatch({
245
256
  searchAppearance,
246
257
  table,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/engine-gsc-api",
3
3
  "type": "module",
4
- "version": "5.3.0",
4
+ "version": "5.6.0",
5
5
  "description": "GSC live-API engine adapter — wraps the Search Analytics REST API as an AnalysisQuerySource for typed analyzer dispatch.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -36,8 +36,8 @@
36
36
  "node": ">=22.13.0"
37
37
  },
38
38
  "dependencies": {
39
- "@gscdump/engine": "^5.3.0",
40
- "gscdump": "^5.3.0"
39
+ "@gscdump/engine": "^5.6.0",
40
+ "gscdump": "^5.6.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "vitest": "^5.0.1"