@gscdump/analysis 0.20.3 → 0.21.1

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.
@@ -67,7 +67,7 @@ interface BaseMetrics {
67
67
  position: number;
68
68
  }
69
69
  /** Keyword row from query */
70
- interface KeywordRow extends BaseMetrics {
70
+ interface QueriesRow extends BaseMetrics {
71
71
  query: string;
72
72
  page?: string;
73
73
  }
@@ -89,8 +89,8 @@ interface BrandSummary {
89
89
  nonBrandImpressions: number;
90
90
  }
91
91
  interface BrandSegmentationResult {
92
- brand: KeywordRow[];
93
- nonBrand: KeywordRow[];
92
+ brand: QueriesRow[];
93
+ nonBrand: QueriesRow[];
94
94
  summary: BrandSummary;
95
95
  }
96
96
  interface BrandResultRow {
@@ -191,7 +191,7 @@ interface ClusteringOptions {
191
191
  interface KeywordCluster {
192
192
  clusterName: string;
193
193
  clusterType: 'prefix' | 'intent';
194
- keywords: KeywordRow[];
194
+ keywords: QueriesRow[];
195
195
  totalClicks: number;
196
196
  totalImpressions: number;
197
197
  avgPosition: number;
@@ -199,7 +199,7 @@ interface KeywordCluster {
199
199
  }
200
200
  interface ClusteringResult {
201
201
  clusters: KeywordCluster[];
202
- unclustered: KeywordRow[];
202
+ unclustered: QueriesRow[];
203
203
  }
204
204
  declare const clusteringAnalyzer: import("@gscdump/engine/analyzer").DefinedAnalyzer;
205
205
  type ConcentrationRiskLevel = 'low' | 'medium' | 'high';
@@ -430,8 +430,8 @@ interface MoversOptions {
430
430
  sortBy?: MoversSortMetric;
431
431
  }
432
432
  interface MoversInput {
433
- current: KeywordRow[];
434
- previous: KeywordRow[];
433
+ current: QueriesRow[];
434
+ previous: QueriesRow[];
435
435
  /** If periods have different lengths, provide normalization factor (previous/current) */
436
436
  normalizationFactor?: number;
437
437
  }
@@ -702,7 +702,7 @@ interface ZeroClickResult {
702
702
  position: number;
703
703
  }
704
704
  declare const zeroClickAnalyzer: import("@gscdump/engine/analyzer").DefinedAnalyzer;
705
- declare function keywordsQueryState(period: AnalysisPeriod, limit?: number): BuilderState;
705
+ declare function queriesQueryState(period: AnalysisPeriod, limit?: number): BuilderState;
706
706
  declare function pagesQueryState(period: AnalysisPeriod, limit?: number): BuilderState;
707
707
  declare function datesQueryState(period: AnalysisPeriod, limit?: number): BuilderState;
708
708
  /**
@@ -746,4 +746,4 @@ declare function resolveSort<K extends string>(input: {
746
746
  sortBy: K;
747
747
  sortDir: 'asc' | 'desc';
748
748
  };
749
- export { type BayesianCtrResult, type BipartitePagerankNode, type BipartitePagerankResult, type BrandResultRow, type BrandSegmentationOptions, type BrandSegmentationResult, type BrandSummary, type CannibalizationCompetitor, type CannibalizationEvent, type CannibalizationOptions, type CannibalizationPage, type CannibalizationResult, type CannibalizationSortMetric, type ChangePointResult, type ChangePointSeriesPoint, type ClusterType, type ClusteringOptions, type ClusteringResult, type ConcentrationInput, type ConcentrationItem, type ConcentrationOptions, type ConcentrationResult, type ConcentrationRiskLevel, type ContentVelocityWeek, type CtrAnomalyResult, type CtrAnomalySeriesPoint, type CtrCurveBucket, type CtrCurveOutlier, type DarkTrafficResult, type DataDetailResult, type DataQueryResult, type DecayInput, type DecayOptions, type DecayResult, type DecaySeriesPoint, type DecaySortMetric, type DeviceGapResult, type IntentAtlasResult, type KeywordBreadthResult, type KeywordCluster, type LongTailResult, type MonthlyData, type MoverData, type MoversInput, type MoversOptions, type MoversResult, type MoversResultRow, type MoversSeriesPoint, type MoversSortMetric, type OpportunityResult, type PaginateInput, type PositionDistributionResult, type PositionVolatilityDay, type PositionVolatilityResult, type QueryMigrationExample, type QueryMigrationResult, type SeasonalityMetric, type SeasonalityOptions, type SeasonalityResult, type StlDecomposeResult, type StlDecomposeSeriesPoint, type StrikingDistanceInputRow, type StrikingDistanceResult, type SurvivalCurvePoint, type SurvivalResult, type TrendCategory, type TrendSeriesPoint, type TrendsResult, type ZeroClickResult, bayesianCtrAnalyzer, bipartitePagerankAnalyzer, brandAnalyzer, cannibalizationAnalyzer, changePointAnalyzer, clampLimit, clampOffset, clusteringAnalyzer, concentrationAnalyzer, contentVelocityAnalyzer, ctrAnomalyAnalyzer, ctrCurveAnalyzer, darkTrafficAnalyzer, dataDetailAnalyzer, dataQueryAnalyzer, datesQueryState, decayAnalyzer, deviceGapAnalyzer, intentAtlasAnalyzer, keywordBreadthAnalyzer, keywordsQueryState, longTailAnalyzer, moversAnalyzer, opportunityAnalyzer, pagesQueryState, paginateClause, paginateInMemory, positionDistributionAnalyzer, positionVolatilityAnalyzer, queryMigrationAnalyzer, resolveSort, seasonalityAnalyzer, stlDecomposeAnalyzer, strikingDistanceAnalyzer, survivalAnalyzer, trendsAnalyzer, zeroClickAnalyzer };
749
+ export { type BayesianCtrResult, type BipartitePagerankNode, type BipartitePagerankResult, type BrandResultRow, type BrandSegmentationOptions, type BrandSegmentationResult, type BrandSummary, type CannibalizationCompetitor, type CannibalizationEvent, type CannibalizationOptions, type CannibalizationPage, type CannibalizationResult, type CannibalizationSortMetric, type ChangePointResult, type ChangePointSeriesPoint, type ClusterType, type ClusteringOptions, type ClusteringResult, type ConcentrationInput, type ConcentrationItem, type ConcentrationOptions, type ConcentrationResult, type ConcentrationRiskLevel, type ContentVelocityWeek, type CtrAnomalyResult, type CtrAnomalySeriesPoint, type CtrCurveBucket, type CtrCurveOutlier, type DarkTrafficResult, type DataDetailResult, type DataQueryResult, type DecayInput, type DecayOptions, type DecayResult, type DecaySeriesPoint, type DecaySortMetric, type DeviceGapResult, type IntentAtlasResult, type KeywordBreadthResult, type KeywordCluster, type LongTailResult, type MonthlyData, type MoverData, type MoversInput, type MoversOptions, type MoversResult, type MoversResultRow, type MoversSeriesPoint, type MoversSortMetric, type OpportunityResult, type PaginateInput, type PositionDistributionResult, type PositionVolatilityDay, type PositionVolatilityResult, type QueryMigrationExample, type QueryMigrationResult, type SeasonalityMetric, type SeasonalityOptions, type SeasonalityResult, type StlDecomposeResult, type StlDecomposeSeriesPoint, type StrikingDistanceInputRow, type StrikingDistanceResult, type SurvivalCurvePoint, type SurvivalResult, type TrendCategory, type TrendSeriesPoint, type TrendsResult, type ZeroClickResult, bayesianCtrAnalyzer, bipartitePagerankAnalyzer, brandAnalyzer, cannibalizationAnalyzer, changePointAnalyzer, clampLimit, clampOffset, clusteringAnalyzer, concentrationAnalyzer, contentVelocityAnalyzer, ctrAnomalyAnalyzer, ctrCurveAnalyzer, darkTrafficAnalyzer, dataDetailAnalyzer, dataQueryAnalyzer, datesQueryState, decayAnalyzer, deviceGapAnalyzer, intentAtlasAnalyzer, keywordBreadthAnalyzer, longTailAnalyzer, moversAnalyzer, opportunityAnalyzer, pagesQueryState, paginateClause, paginateInMemory, positionDistributionAnalyzer, positionVolatilityAnalyzer, queriesQueryState, queryMigrationAnalyzer, resolveSort, seasonalityAnalyzer, stlDecomposeAnalyzer, strikingDistanceAnalyzer, survivalAnalyzer, trendsAnalyzer, zeroClickAnalyzer };
@@ -145,7 +145,7 @@ const bayesianCtrAnalyzer = defineAnalyzer({
145
145
  minImpressions
146
146
  ],
147
147
  current: {
148
- table: "page_keywords",
148
+ table: "page_queries",
149
149
  partitions: enumeratePartitions(startDate, endDate)
150
150
  }
151
151
  };
@@ -395,7 +395,7 @@ const bipartitePagerankAnalyzer = defineAnalyzer({
395
395
  minImpressions
396
396
  ],
397
397
  current: {
398
- table: "page_keywords",
398
+ table: "page_queries",
399
399
  partitions: enumeratePartitions(startDate, endDate)
400
400
  }
401
401
  };
@@ -436,7 +436,7 @@ const bipartitePagerankAnalyzer = defineAnalyzer({
436
436
  }
437
437
  });
438
438
  const DEFAULT_LIMIT$1 = 25e3;
439
- function keywordsQueryState(period, limit = DEFAULT_LIMIT$1) {
439
+ function queriesQueryState(period, limit = DEFAULT_LIMIT$1) {
440
440
  return gsc.select(query, page).where(between(date, period.startDate, period.endDate)).limit(limit).getState();
441
441
  }
442
442
  function pagesQueryState(period, limit = DEFAULT_LIMIT$1) {
@@ -513,7 +513,7 @@ const brandAnalyzer = defineAnalyzer({
513
513
  regex
514
514
  ],
515
515
  current: {
516
- table: "page_keywords",
516
+ table: "page_queries",
517
517
  partitions: enumeratePartitions(startDate, endDate)
518
518
  }
519
519
  };
@@ -555,7 +555,7 @@ const brandAnalyzer = defineAnalyzer({
555
555
  };
556
556
  },
557
557
  buildRows(params) {
558
- return { keywords: keywordsQueryState(periodOf(params), params.limit) };
558
+ return { queries: queriesQueryState(periodOf(params), params.limit) };
559
559
  },
560
560
  reduceRows(rows, params) {
561
561
  if (!params.brandTerms?.length) throw new Error("Brand analysis requires brandTerms");
@@ -759,7 +759,7 @@ const cannibalizationAnalyzer = defineAnalyzer({
759
759
  minQueryImpressions
760
760
  ],
761
761
  current: {
762
- table: "page_keywords",
762
+ table: "page_queries",
763
763
  partitions: enumeratePartitions(startDate, endDate)
764
764
  }
765
765
  };
@@ -841,7 +841,7 @@ const cannibalizationAnalyzer = defineAnalyzer({
841
841
  };
842
842
  },
843
843
  buildRows(params) {
844
- return { rows: keywordsQueryState(periodOf(params), params.limit) };
844
+ return { rows: queriesQueryState(periodOf(params), params.limit) };
845
845
  },
846
846
  reduceRows(rows, params) {
847
847
  const results = analyzeCannibalization(Array.isArray(rows) ? rows : [], {
@@ -1014,7 +1014,7 @@ const changePointAnalyzer = defineAnalyzer({
1014
1014
  minImpressions
1015
1015
  ],
1016
1016
  current: {
1017
- table: "page_keywords",
1017
+ table: "page_queries",
1018
1018
  partitions: enumeratePartitions(startDate, endDate)
1019
1019
  }
1020
1020
  };
@@ -1220,7 +1220,7 @@ const clusteringAnalyzer = defineAnalyzer({
1220
1220
  minClusterSize
1221
1221
  ],
1222
1222
  current: {
1223
- table: "keywords",
1223
+ table: "queries",
1224
1224
  partitions: enumeratePartitions(startDate, endDate)
1225
1225
  }
1226
1226
  };
@@ -1250,7 +1250,7 @@ const clusteringAnalyzer = defineAnalyzer({
1250
1250
  };
1251
1251
  },
1252
1252
  buildRows(params) {
1253
- return { keywords: keywordsQueryState(periodOf(params), params.limit) };
1253
+ return { queries: queriesQueryState(periodOf(params), params.limit) };
1254
1254
  },
1255
1255
  reduceRows(rows, params) {
1256
1256
  const result = analyzeClustering(Array.isArray(rows) ? rows : [], {
@@ -1343,7 +1343,7 @@ const concentrationAnalyzer = defineAnalyzer({
1343
1343
  const { startDate, endDate } = periodOf(params);
1344
1344
  const dim = params.dimension || "pages";
1345
1345
  const topN = params.topN ?? 10;
1346
- const table = dim === "keywords" ? "keywords" : "pages";
1346
+ const table = dim === "keywords" ? "queries" : "pages";
1347
1347
  const keyCol = dim === "keywords" ? "query" : "url";
1348
1348
  return {
1349
1349
  sql: `
@@ -1441,12 +1441,12 @@ const concentrationAnalyzer = defineAnalyzer({
1441
1441
  const period = periodOf(params);
1442
1442
  const out = {};
1443
1443
  if (dim === "pages") out.pages = pagesQueryState(period, params.limit);
1444
- else out.keywords = keywordsQueryState(period, params.limit);
1444
+ else out.queries = queriesQueryState(period, params.limit);
1445
1445
  return out;
1446
1446
  },
1447
1447
  reduceRows(rows, params) {
1448
1448
  const dim = params.dimension || "pages";
1449
- const arr = Array.isArray(rows) ? rows : rows[dim] ?? [];
1449
+ const arr = Array.isArray(rows) ? rows : rows[dim === "pages" ? "pages" : "queries"] ?? [];
1450
1450
  return {
1451
1451
  results: [dim === "pages" ? analyzePageConcentration(arr, { topN: params.topN }) : analyzeKeywordConcentration(arr, { topN: params.topN })],
1452
1452
  meta: { dimension: dim }
@@ -1506,7 +1506,7 @@ const contentVelocityAnalyzer = defineAnalyzer({
1506
1506
  `,
1507
1507
  params: [startDate, endDate],
1508
1508
  current: {
1509
- table: "keywords",
1509
+ table: "queries",
1510
1510
  partitions: enumeratePartitions(startDate, endDate)
1511
1511
  }
1512
1512
  };
@@ -1696,7 +1696,7 @@ const ctrAnomalyAnalyzer = defineAnalyzer({
1696
1696
  minDailyImpressions
1697
1697
  ],
1698
1698
  current: {
1699
- table: "page_keywords",
1699
+ table: "page_queries",
1700
1700
  partitions: enumeratePartitions(startDate, endDate)
1701
1701
  }
1702
1702
  };
@@ -1845,7 +1845,7 @@ const ctrCurveAnalyzer = defineAnalyzer({
1845
1845
  `,
1846
1846
  params: [startDate, endDate],
1847
1847
  current: {
1848
- table: "keywords",
1848
+ table: "queries",
1849
1849
  partitions: enumeratePartitions(startDate, endDate)
1850
1850
  }
1851
1851
  };
@@ -1971,11 +1971,11 @@ const darkTrafficAnalyzer = defineAnalyzer({
1971
1971
  },
1972
1972
  extraFiles: {
1973
1973
  KEYWORDS: {
1974
- table: "keywords",
1974
+ table: "queries",
1975
1975
  partitions: enumeratePartitions(startDate, endDate)
1976
1976
  },
1977
1977
  PAGE_KEYWORDS: {
1978
- table: "page_keywords",
1978
+ table: "page_queries",
1979
1979
  partitions: enumeratePartitions(startDate, endDate)
1980
1980
  }
1981
1981
  }
@@ -2598,7 +2598,7 @@ const deviceGapAnalyzer = defineAnalyzer({
2598
2598
  `,
2599
2599
  params: [startDate, endDate],
2600
2600
  current: {
2601
- table: "devices",
2601
+ table: "dates",
2602
2602
  partitions: enumeratePartitions(startDate, endDate)
2603
2603
  }
2604
2604
  };
@@ -2832,7 +2832,7 @@ const intentAtlasAnalyzer = defineAnalyzer({
2832
2832
  minQueryImpressions
2833
2833
  ],
2834
2834
  current: {
2835
- table: "keywords",
2835
+ table: "queries",
2836
2836
  partitions: enumeratePartitions(startDate, endDate)
2837
2837
  }
2838
2838
  };
@@ -2940,7 +2940,7 @@ const keywordBreadthAnalyzer = defineAnalyzer({
2940
2940
  `,
2941
2941
  params: [startDate, endDate],
2942
2942
  current: {
2943
- table: "page_keywords",
2943
+ table: "page_queries",
2944
2944
  partitions: enumeratePartitions(startDate, endDate)
2945
2945
  }
2946
2946
  };
@@ -3101,7 +3101,7 @@ const longTailAnalyzer = defineAnalyzer({
3101
3101
  minQueryImpressions
3102
3102
  ],
3103
3103
  current: {
3104
- table: "page_keywords",
3104
+ table: "page_queries",
3105
3105
  partitions: enumeratePartitions(startDate, endDate)
3106
3106
  }
3107
3107
  };
@@ -3319,11 +3319,11 @@ const moversAnalyzer = defineAnalyzer({
3319
3319
  changeThreshold
3320
3320
  ],
3321
3321
  current: {
3322
- table: "page_keywords",
3322
+ table: "page_queries",
3323
3323
  partitions: enumeratePartitions(cur.startDate, cur.endDate)
3324
3324
  },
3325
3325
  previous: {
3326
- table: "page_keywords",
3326
+ table: "page_queries",
3327
3327
  partitions: enumeratePartitions(prev.startDate, prev.endDate)
3328
3328
  }
3329
3329
  };
@@ -3366,8 +3366,8 @@ const moversAnalyzer = defineAnalyzer({
3366
3366
  buildRows(params) {
3367
3367
  const { current, previous } = comparisonOf(params);
3368
3368
  return {
3369
- current: keywordsQueryState(current, params.limit),
3370
- previous: keywordsQueryState(previous, params.limit)
3369
+ current: queriesQueryState(current, params.limit),
3370
+ previous: queriesQueryState(previous, params.limit)
3371
3371
  };
3372
3372
  },
3373
3373
  reduceRows(rows, params) {
@@ -3545,7 +3545,7 @@ const opportunityAnalyzer = defineAnalyzer({
3545
3545
  minImpressions
3546
3546
  ],
3547
3547
  current: {
3548
- table: "page_keywords",
3548
+ table: "page_queries",
3549
3549
  partitions: enumeratePartitions(startDate, endDate)
3550
3550
  }
3551
3551
  };
@@ -3572,7 +3572,7 @@ const opportunityAnalyzer = defineAnalyzer({
3572
3572
  };
3573
3573
  },
3574
3574
  buildRows(params) {
3575
- return { keywords: keywordsQueryState(periodOf(params), params.limit) };
3575
+ return { queries: queriesQueryState(periodOf(params), params.limit) };
3576
3576
  },
3577
3577
  reduceRows(rows, params) {
3578
3578
  const keywords = (Array.isArray(rows) ? rows : []) ?? [];
@@ -3654,7 +3654,7 @@ const positionDistributionAnalyzer = defineAnalyzer({
3654
3654
  `,
3655
3655
  params: [startDate, endDate],
3656
3656
  current: {
3657
- table: "keywords",
3657
+ table: "queries",
3658
3658
  partitions: enumeratePartitions(startDate, endDate)
3659
3659
  }
3660
3660
  };
@@ -3772,7 +3772,7 @@ const positionVolatilityAnalyzer = defineAnalyzer({
3772
3772
  minDays
3773
3773
  ],
3774
3774
  current: {
3775
- table: "page_keywords",
3775
+ table: "page_queries",
3776
3776
  partitions: enumeratePartitions(startDate, endDate)
3777
3777
  }
3778
3778
  };
@@ -3929,11 +3929,11 @@ const queryMigrationAnalyzer = defineAnalyzer({
3929
3929
  minImpressions
3930
3930
  ],
3931
3931
  current: {
3932
- table: "page_keywords",
3932
+ table: "page_queries",
3933
3933
  partitions: enumeratePartitions(cur.startDate, cur.endDate)
3934
3934
  },
3935
3935
  previous: {
3936
- table: "page_keywords",
3936
+ table: "page_queries",
3937
3937
  partitions: enumeratePartitions(prevStart, prevEnd)
3938
3938
  }
3939
3939
  };
@@ -4291,7 +4291,7 @@ const stlDecomposeAnalyzer = defineAnalyzer({
4291
4291
  minImpressions
4292
4292
  ],
4293
4293
  current: {
4294
- table: "page_keywords",
4294
+ table: "page_queries",
4295
4295
  partitions: enumeratePartitions(startDate, endDate)
4296
4296
  }
4297
4297
  };
@@ -4388,13 +4388,13 @@ const strikingDistanceAnalyzer = defineAnalyzer({
4388
4388
  `,
4389
4389
  params: [startDate, endDate],
4390
4390
  current: {
4391
- table: "page_keywords",
4391
+ table: "page_queries",
4392
4392
  partitions: enumeratePartitions(startDate, endDate)
4393
4393
  }
4394
4394
  };
4395
4395
  },
4396
4396
  buildRows(params) {
4397
- return { keywords: keywordsQueryState(periodOf(params), params.limit ?? DEFAULT_ROW_LIMIT$1) };
4397
+ return { queries: queriesQueryState(periodOf(params), params.limit ?? DEFAULT_ROW_LIMIT$1) };
4398
4398
  }
4399
4399
  });
4400
4400
  function str$1(v) {
@@ -4549,7 +4549,7 @@ const survivalAnalyzer = defineAnalyzer({
4549
4549
  minImpressions
4550
4550
  ],
4551
4551
  current: {
4552
- table: "page_keywords",
4552
+ table: "page_queries",
4553
4553
  partitions: enumeratePartitions(startDate, endDate)
4554
4554
  }
4555
4555
  };
@@ -4621,7 +4621,7 @@ const trendsAnalyzer = defineAnalyzer({
4621
4621
  const minWeeksWithData = params.minWeeksWithData ?? Math.max(2, Math.floor(weeks / 4));
4622
4622
  const limit = params.limit ?? 500;
4623
4623
  const dim = params.dimension === "keywords" ? "keywords" : "pages";
4624
- const table = dim === "keywords" ? "keywords" : "pages";
4624
+ const table = dim === "keywords" ? "queries" : "pages";
4625
4625
  return {
4626
4626
  sql: `
4627
4627
  WITH bucketed AS (
@@ -4810,7 +4810,7 @@ const zeroClickAnalyzer = defineAnalyzer({
4810
4810
  maxCtr
4811
4811
  ],
4812
4812
  current: {
4813
- table: "page_keywords",
4813
+ table: "page_queries",
4814
4814
  partitions: enumeratePartitions(startDate, endDate)
4815
4815
  }
4816
4816
  };
@@ -4877,4 +4877,4 @@ const zeroClickAnalyzer = defineAnalyzer({
4877
4877
  };
4878
4878
  }
4879
4879
  });
4880
- export { bayesianCtrAnalyzer, bipartitePagerankAnalyzer, brandAnalyzer, cannibalizationAnalyzer, changePointAnalyzer, clampLimit, clampOffset, clusteringAnalyzer, concentrationAnalyzer, contentVelocityAnalyzer, ctrAnomalyAnalyzer, ctrCurveAnalyzer, darkTrafficAnalyzer, dataDetailAnalyzer, dataQueryAnalyzer, datesQueryState, decayAnalyzer, deviceGapAnalyzer, intentAtlasAnalyzer, keywordBreadthAnalyzer, keywordsQueryState, longTailAnalyzer, moversAnalyzer, opportunityAnalyzer, pagesQueryState, paginateClause, paginateInMemory, positionDistributionAnalyzer, positionVolatilityAnalyzer, queryMigrationAnalyzer, resolveSort, seasonalityAnalyzer, stlDecomposeAnalyzer, strikingDistanceAnalyzer, survivalAnalyzer, trendsAnalyzer, zeroClickAnalyzer };
4880
+ export { bayesianCtrAnalyzer, bipartitePagerankAnalyzer, brandAnalyzer, cannibalizationAnalyzer, changePointAnalyzer, clampLimit, clampOffset, clusteringAnalyzer, concentrationAnalyzer, contentVelocityAnalyzer, ctrAnomalyAnalyzer, ctrCurveAnalyzer, darkTrafficAnalyzer, dataDetailAnalyzer, dataQueryAnalyzer, datesQueryState, decayAnalyzer, deviceGapAnalyzer, intentAtlasAnalyzer, keywordBreadthAnalyzer, longTailAnalyzer, moversAnalyzer, opportunityAnalyzer, pagesQueryState, paginateClause, paginateInMemory, positionDistributionAnalyzer, positionVolatilityAnalyzer, queriesQueryState, queryMigrationAnalyzer, resolveSort, seasonalityAnalyzer, stlDecomposeAnalyzer, strikingDistanceAnalyzer, survivalAnalyzer, trendsAnalyzer, zeroClickAnalyzer };
@@ -145,7 +145,7 @@ const bayesianCtrAnalyzer = defineAnalyzer({
145
145
  minImpressions
146
146
  ],
147
147
  current: {
148
- table: "page_keywords",
148
+ table: "page_queries",
149
149
  partitions: enumeratePartitions(startDate, endDate)
150
150
  }
151
151
  };
@@ -395,7 +395,7 @@ const bipartitePagerankAnalyzer = defineAnalyzer({
395
395
  minImpressions
396
396
  ],
397
397
  current: {
398
- table: "page_keywords",
398
+ table: "page_queries",
399
399
  partitions: enumeratePartitions(startDate, endDate)
400
400
  }
401
401
  };
@@ -436,7 +436,7 @@ const bipartitePagerankAnalyzer = defineAnalyzer({
436
436
  }
437
437
  });
438
438
  const DEFAULT_LIMIT$1 = 25e3;
439
- function keywordsQueryState(period, limit = DEFAULT_LIMIT$1) {
439
+ function queriesQueryState(period, limit = DEFAULT_LIMIT$1) {
440
440
  return gsc.select(query, page).where(between(date, period.startDate, period.endDate)).limit(limit).getState();
441
441
  }
442
442
  function pagesQueryState(period, limit = DEFAULT_LIMIT$1) {
@@ -513,7 +513,7 @@ const brandAnalyzer = defineAnalyzer({
513
513
  regex
514
514
  ],
515
515
  current: {
516
- table: "page_keywords",
516
+ table: "page_queries",
517
517
  partitions: enumeratePartitions(startDate, endDate)
518
518
  }
519
519
  };
@@ -555,7 +555,7 @@ const brandAnalyzer = defineAnalyzer({
555
555
  };
556
556
  },
557
557
  buildRows(params) {
558
- return { keywords: keywordsQueryState(periodOf(params), params.limit) };
558
+ return { queries: queriesQueryState(periodOf(params), params.limit) };
559
559
  },
560
560
  reduceRows(rows, params) {
561
561
  if (!params.brandTerms?.length) throw new Error("Brand analysis requires brandTerms");
@@ -759,7 +759,7 @@ const cannibalizationAnalyzer = defineAnalyzer({
759
759
  minQueryImpressions
760
760
  ],
761
761
  current: {
762
- table: "page_keywords",
762
+ table: "page_queries",
763
763
  partitions: enumeratePartitions(startDate, endDate)
764
764
  }
765
765
  };
@@ -841,7 +841,7 @@ const cannibalizationAnalyzer = defineAnalyzer({
841
841
  };
842
842
  },
843
843
  buildRows(params) {
844
- return { rows: keywordsQueryState(periodOf(params), params.limit) };
844
+ return { rows: queriesQueryState(periodOf(params), params.limit) };
845
845
  },
846
846
  reduceRows(rows, params) {
847
847
  const results = analyzeCannibalization(Array.isArray(rows) ? rows : [], {
@@ -1014,7 +1014,7 @@ const changePointAnalyzer = defineAnalyzer({
1014
1014
  minImpressions
1015
1015
  ],
1016
1016
  current: {
1017
- table: "page_keywords",
1017
+ table: "page_queries",
1018
1018
  partitions: enumeratePartitions(startDate, endDate)
1019
1019
  }
1020
1020
  };
@@ -1220,7 +1220,7 @@ const clusteringAnalyzer = defineAnalyzer({
1220
1220
  minClusterSize
1221
1221
  ],
1222
1222
  current: {
1223
- table: "keywords",
1223
+ table: "queries",
1224
1224
  partitions: enumeratePartitions(startDate, endDate)
1225
1225
  }
1226
1226
  };
@@ -1250,7 +1250,7 @@ const clusteringAnalyzer = defineAnalyzer({
1250
1250
  };
1251
1251
  },
1252
1252
  buildRows(params) {
1253
- return { keywords: keywordsQueryState(periodOf(params), params.limit) };
1253
+ return { queries: queriesQueryState(periodOf(params), params.limit) };
1254
1254
  },
1255
1255
  reduceRows(rows, params) {
1256
1256
  const result = analyzeClustering(Array.isArray(rows) ? rows : [], {
@@ -1343,7 +1343,7 @@ const concentrationAnalyzer = defineAnalyzer({
1343
1343
  const { startDate, endDate } = periodOf(params);
1344
1344
  const dim = params.dimension || "pages";
1345
1345
  const topN = params.topN ?? 10;
1346
- const table = dim === "keywords" ? "keywords" : "pages";
1346
+ const table = dim === "keywords" ? "queries" : "pages";
1347
1347
  const keyCol = dim === "keywords" ? "query" : "url";
1348
1348
  return {
1349
1349
  sql: `
@@ -1441,12 +1441,12 @@ const concentrationAnalyzer = defineAnalyzer({
1441
1441
  const period = periodOf(params);
1442
1442
  const out = {};
1443
1443
  if (dim === "pages") out.pages = pagesQueryState(period, params.limit);
1444
- else out.keywords = keywordsQueryState(period, params.limit);
1444
+ else out.queries = queriesQueryState(period, params.limit);
1445
1445
  return out;
1446
1446
  },
1447
1447
  reduceRows(rows, params) {
1448
1448
  const dim = params.dimension || "pages";
1449
- const arr = Array.isArray(rows) ? rows : rows[dim] ?? [];
1449
+ const arr = Array.isArray(rows) ? rows : rows[dim === "pages" ? "pages" : "queries"] ?? [];
1450
1450
  return {
1451
1451
  results: [dim === "pages" ? analyzePageConcentration(arr, { topN: params.topN }) : analyzeKeywordConcentration(arr, { topN: params.topN })],
1452
1452
  meta: { dimension: dim }
@@ -1506,7 +1506,7 @@ const contentVelocityAnalyzer = defineAnalyzer({
1506
1506
  `,
1507
1507
  params: [startDate, endDate],
1508
1508
  current: {
1509
- table: "keywords",
1509
+ table: "queries",
1510
1510
  partitions: enumeratePartitions(startDate, endDate)
1511
1511
  }
1512
1512
  };
@@ -1696,7 +1696,7 @@ const ctrAnomalyAnalyzer = defineAnalyzer({
1696
1696
  minDailyImpressions
1697
1697
  ],
1698
1698
  current: {
1699
- table: "page_keywords",
1699
+ table: "page_queries",
1700
1700
  partitions: enumeratePartitions(startDate, endDate)
1701
1701
  }
1702
1702
  };
@@ -1845,7 +1845,7 @@ const ctrCurveAnalyzer = defineAnalyzer({
1845
1845
  `,
1846
1846
  params: [startDate, endDate],
1847
1847
  current: {
1848
- table: "keywords",
1848
+ table: "queries",
1849
1849
  partitions: enumeratePartitions(startDate, endDate)
1850
1850
  }
1851
1851
  };
@@ -1971,11 +1971,11 @@ const darkTrafficAnalyzer = defineAnalyzer({
1971
1971
  },
1972
1972
  extraFiles: {
1973
1973
  KEYWORDS: {
1974
- table: "keywords",
1974
+ table: "queries",
1975
1975
  partitions: enumeratePartitions(startDate, endDate)
1976
1976
  },
1977
1977
  PAGE_KEYWORDS: {
1978
- table: "page_keywords",
1978
+ table: "page_queries",
1979
1979
  partitions: enumeratePartitions(startDate, endDate)
1980
1980
  }
1981
1981
  }
@@ -2598,7 +2598,7 @@ const deviceGapAnalyzer = defineAnalyzer({
2598
2598
  `,
2599
2599
  params: [startDate, endDate],
2600
2600
  current: {
2601
- table: "devices",
2601
+ table: "dates",
2602
2602
  partitions: enumeratePartitions(startDate, endDate)
2603
2603
  }
2604
2604
  };
@@ -2832,7 +2832,7 @@ const intentAtlasAnalyzer = defineAnalyzer({
2832
2832
  minQueryImpressions
2833
2833
  ],
2834
2834
  current: {
2835
- table: "keywords",
2835
+ table: "queries",
2836
2836
  partitions: enumeratePartitions(startDate, endDate)
2837
2837
  }
2838
2838
  };
@@ -2940,7 +2940,7 @@ const keywordBreadthAnalyzer = defineAnalyzer({
2940
2940
  `,
2941
2941
  params: [startDate, endDate],
2942
2942
  current: {
2943
- table: "page_keywords",
2943
+ table: "page_queries",
2944
2944
  partitions: enumeratePartitions(startDate, endDate)
2945
2945
  }
2946
2946
  };
@@ -3101,7 +3101,7 @@ const longTailAnalyzer = defineAnalyzer({
3101
3101
  minQueryImpressions
3102
3102
  ],
3103
3103
  current: {
3104
- table: "page_keywords",
3104
+ table: "page_queries",
3105
3105
  partitions: enumeratePartitions(startDate, endDate)
3106
3106
  }
3107
3107
  };
@@ -3319,11 +3319,11 @@ const moversAnalyzer = defineAnalyzer({
3319
3319
  changeThreshold
3320
3320
  ],
3321
3321
  current: {
3322
- table: "page_keywords",
3322
+ table: "page_queries",
3323
3323
  partitions: enumeratePartitions(cur.startDate, cur.endDate)
3324
3324
  },
3325
3325
  previous: {
3326
- table: "page_keywords",
3326
+ table: "page_queries",
3327
3327
  partitions: enumeratePartitions(prev.startDate, prev.endDate)
3328
3328
  }
3329
3329
  };
@@ -3366,8 +3366,8 @@ const moversAnalyzer = defineAnalyzer({
3366
3366
  buildRows(params) {
3367
3367
  const { current, previous } = comparisonOf(params);
3368
3368
  return {
3369
- current: keywordsQueryState(current, params.limit),
3370
- previous: keywordsQueryState(previous, params.limit)
3369
+ current: queriesQueryState(current, params.limit),
3370
+ previous: queriesQueryState(previous, params.limit)
3371
3371
  };
3372
3372
  },
3373
3373
  reduceRows(rows, params) {
@@ -3539,7 +3539,7 @@ const opportunityAnalyzer = defineAnalyzer({
3539
3539
  minImpressions
3540
3540
  ],
3541
3541
  current: {
3542
- table: "page_keywords",
3542
+ table: "page_queries",
3543
3543
  partitions: enumeratePartitions(startDate, endDate)
3544
3544
  }
3545
3545
  };
@@ -3566,7 +3566,7 @@ const opportunityAnalyzer = defineAnalyzer({
3566
3566
  };
3567
3567
  },
3568
3568
  buildRows(params) {
3569
- return { keywords: keywordsQueryState(periodOf(params), params.limit) };
3569
+ return { queries: queriesQueryState(periodOf(params), params.limit) };
3570
3570
  },
3571
3571
  reduceRows(rows, params) {
3572
3572
  const keywords = (Array.isArray(rows) ? rows : []) ?? [];
@@ -3648,7 +3648,7 @@ const positionDistributionAnalyzer = defineAnalyzer({
3648
3648
  `,
3649
3649
  params: [startDate, endDate],
3650
3650
  current: {
3651
- table: "keywords",
3651
+ table: "queries",
3652
3652
  partitions: enumeratePartitions(startDate, endDate)
3653
3653
  }
3654
3654
  };
@@ -3766,7 +3766,7 @@ const positionVolatilityAnalyzer = defineAnalyzer({
3766
3766
  minDays
3767
3767
  ],
3768
3768
  current: {
3769
- table: "page_keywords",
3769
+ table: "page_queries",
3770
3770
  partitions: enumeratePartitions(startDate, endDate)
3771
3771
  }
3772
3772
  };
@@ -3923,11 +3923,11 @@ const queryMigrationAnalyzer = defineAnalyzer({
3923
3923
  minImpressions
3924
3924
  ],
3925
3925
  current: {
3926
- table: "page_keywords",
3926
+ table: "page_queries",
3927
3927
  partitions: enumeratePartitions(cur.startDate, cur.endDate)
3928
3928
  },
3929
3929
  previous: {
3930
- table: "page_keywords",
3930
+ table: "page_queries",
3931
3931
  partitions: enumeratePartitions(prevStart, prevEnd)
3932
3932
  }
3933
3933
  };
@@ -4285,7 +4285,7 @@ const stlDecomposeAnalyzer = defineAnalyzer({
4285
4285
  minImpressions
4286
4286
  ],
4287
4287
  current: {
4288
- table: "page_keywords",
4288
+ table: "page_queries",
4289
4289
  partitions: enumeratePartitions(startDate, endDate)
4290
4290
  }
4291
4291
  };
@@ -4382,13 +4382,13 @@ const strikingDistanceAnalyzer = defineAnalyzer({
4382
4382
  `,
4383
4383
  params: [startDate, endDate],
4384
4384
  current: {
4385
- table: "page_keywords",
4385
+ table: "page_queries",
4386
4386
  partitions: enumeratePartitions(startDate, endDate)
4387
4387
  }
4388
4388
  };
4389
4389
  },
4390
4390
  buildRows(params) {
4391
- return { keywords: keywordsQueryState(periodOf(params), params.limit ?? DEFAULT_ROW_LIMIT$1) };
4391
+ return { queries: queriesQueryState(periodOf(params), params.limit ?? DEFAULT_ROW_LIMIT$1) };
4392
4392
  }
4393
4393
  });
4394
4394
  function str$1(v) {
@@ -4543,7 +4543,7 @@ const survivalAnalyzer = defineAnalyzer({
4543
4543
  minImpressions
4544
4544
  ],
4545
4545
  current: {
4546
- table: "page_keywords",
4546
+ table: "page_queries",
4547
4547
  partitions: enumeratePartitions(startDate, endDate)
4548
4548
  }
4549
4549
  };
@@ -4615,7 +4615,7 @@ const trendsAnalyzer = defineAnalyzer({
4615
4615
  const minWeeksWithData = params.minWeeksWithData ?? Math.max(2, Math.floor(weeks / 4));
4616
4616
  const limit = params.limit ?? 500;
4617
4617
  const dim = params.dimension === "keywords" ? "keywords" : "pages";
4618
- const table = dim === "keywords" ? "keywords" : "pages";
4618
+ const table = dim === "keywords" ? "queries" : "pages";
4619
4619
  return {
4620
4620
  sql: `
4621
4621
  WITH bucketed AS (
@@ -4833,7 +4833,7 @@ const defaultAnalyzerRegistry = createAnalyzerRegistry({ defined: [
4833
4833
  maxCtr
4834
4834
  ],
4835
4835
  current: {
4836
- table: "page_keywords",
4836
+ table: "page_queries",
4837
4837
  partitions: enumeratePartitions(startDate, endDate)
4838
4838
  }
4839
4839
  };
package/dist/index.d.mts CHANGED
@@ -52,7 +52,7 @@ interface BaseMetrics {
52
52
  position: number;
53
53
  }
54
54
  /** Keyword row from query */
55
- interface KeywordRow extends BaseMetrics {
55
+ interface QueriesRow extends BaseMetrics {
56
56
  query: string;
57
57
  page?: string;
58
58
  }
@@ -85,15 +85,15 @@ interface BrandSummary {
85
85
  nonBrandImpressions: number;
86
86
  }
87
87
  interface BrandSegmentationResult {
88
- brand: KeywordRow[];
89
- nonBrand: KeywordRow[];
88
+ brand: QueriesRow[];
89
+ nonBrand: QueriesRow[];
90
90
  summary: BrandSummary;
91
91
  }
92
92
  /**
93
93
  * Pure helper: segment keywords into brand and non-brand based on provided
94
94
  * brand terms. Re-exported from `@gscdump/analysis` for portable callers.
95
95
  */
96
- declare function analyzeBrandSegmentation(keywords: KeywordRow[], options: BrandSegmentationOptions): BrandSegmentationResult;
96
+ declare function analyzeBrandSegmentation(keywords: QueriesRow[], options: BrandSegmentationOptions): BrandSegmentationResult;
97
97
  type CannibalizationSortMetric = 'clicks' | 'impressions' | 'positionSpread' | 'pageCount';
98
98
  interface CannibalizationOptions {
99
99
  /** Minimum impressions for a query to be considered. Default: 10 */
@@ -162,7 +162,7 @@ interface ClusteringOptions {
162
162
  interface KeywordCluster {
163
163
  clusterName: string;
164
164
  clusterType: 'prefix' | 'intent';
165
- keywords: KeywordRow[];
165
+ keywords: QueriesRow[];
166
166
  totalClicks: number;
167
167
  totalImpressions: number;
168
168
  avgPosition: number;
@@ -170,13 +170,13 @@ interface KeywordCluster {
170
170
  }
171
171
  interface ClusteringResult {
172
172
  clusters: KeywordCluster[];
173
- unclustered: KeywordRow[];
173
+ unclustered: QueriesRow[];
174
174
  }
175
175
  /**
176
176
  * Pure helper: clusters keywords by intent prefix or common word prefix.
177
177
  * Re-exported from `@gscdump/analysis` for portable callers.
178
178
  */
179
- declare function analyzeClustering(keywords: KeywordRow[], options?: ClusteringOptions): ClusteringResult;
179
+ declare function analyzeClustering(keywords: QueriesRow[], options?: ClusteringOptions): ClusteringResult;
180
180
  type ConcentrationRiskLevel = 'low' | 'medium' | 'high';
181
181
  interface ConcentrationOptions {
182
182
  /** Number of top items to report. Default: 10 */
@@ -216,7 +216,7 @@ declare function analyzePageConcentration(pages: PageRow[], options?: Concentrat
216
216
  /**
217
217
  * Keyword concentration analysis.
218
218
  */
219
- declare function analyzeKeywordConcentration(keywords: KeywordRow[], options?: ConcentrationOptions): ConcentrationResult;
219
+ declare function analyzeKeywordConcentration(keywords: QueriesRow[], options?: ConcentrationOptions): ConcentrationResult;
220
220
  type DecaySortMetric = 'lostClicks' | 'declinePercent' | 'currentClicks';
221
221
  interface DecayOptions {
222
222
  /** Minimum clicks in previous period to consider. Default: 50 */
@@ -261,8 +261,8 @@ interface MoversOptions {
261
261
  sortBy?: MoversSortMetric;
262
262
  }
263
263
  interface MoversInput {
264
- current: KeywordRow[];
265
- previous: KeywordRow[];
264
+ current: QueriesRow[];
265
+ previous: QueriesRow[];
266
266
  /** If periods have different lengths, provide normalization factor (previous/current) */
267
267
  normalizationFactor?: number;
268
268
  }
@@ -498,4 +498,4 @@ interface InMemoryQuerySourceOptions {
498
498
  }
499
499
  declare function createInMemoryQuerySource(options: InMemoryQuerySourceOptions): AnalysisQuerySource$1;
500
500
  declare const SQL_ANALYZERS: readonly Analyzer$1[];
501
- export { type ActionPriorityResult, type ActionPrioritySourceState, type ActionPrioritySourceStatus, type ActionSource, type AnalysisParams, type AnalysisPeriod, type AnalysisQuerySource, type AnalysisResult, type AnalysisSourceKind, type AnalysisTool, type Analyzer, AnalyzerCapabilityError, type AnalyzerRegistry, type AnalyzerRegistryInit, type AnalyzerRunner, type AnalyzerVariants, type BaseMetrics, type BrandSegmentationOptions, type BrandSegmentationResult, type BrandSummary, type BrowserAnalyzeOptions, type CannibalizationCompetitor, type CannibalizationEvent, type CannibalizationOptions, type CannibalizationPage, type CannibalizationResult, type CannibalizationSortMetric, type ClusterType, type ClusteringOptions, type ClusteringResult, type ComparisonMode, type ComparisonPeriod, type CompositeSourceOptions, type ConcentrationInput, type ConcentrationItem, type ConcentrationOptions, type ConcentrationResult, type ConcentrationRiskLevel, DEFAULT_PRIORITY_SOURCES, type DateRow, type DecayInput, type DecayOptions, type DecayResult, type DecaySeriesPoint, type DecaySortMetric, type DefineAnalyzerOptions, type DefineReportOptions, type DefinedAnalyzer, type DefinedReport, type DryRunReportResult, ENGINE_QUERY_CAPABILITIES, type Effort, type EngineQuerySourceOptions, type ExecuteSqlOptions, type FileSet, type FormatReportOptions, IN_MEMORY_DEFAULT_CAPABILITIES, type InMemoryQuerySourceOptions, type KeywordCluster, type KeywordRow, type MonthlyData, type MoverData, type MoversInput, type MoversOptions, type MoversResult, type MoversSortMetric, type OpportunityResult, type PadTimeseriesOptions, type PageRow, type Plan, type PriorityAction, type QueryPageRow, type QueryRow, REPORTS, ROW_ANALYZERS, type ReduceContext, type ReduceCtx, type Reducer, type ReportAction, type ReportContext, type ReportFinding, type ReportPlanStep, type ReportResult, type ReportSection, type RequiredCapability, type ResolveWindowOptions, type ResolvedWindow, type RowQueriesPlan, type RunReportOptions, SQL_ANALYZERS, type SeasonalityMetric, type SeasonalityOptions, type SeasonalityResult, type SitemapDelta, type SitemapHealthDiff, type SitemapHealthInput, type SitemapHealthRow, type SitemapHealthTotals, type SortOrder, type SourceCapabilities, type SqlExtraQuery, type SqlPlan, type SqlPlanSpec, type StrikingDistanceInputRow, type StrikingDistanceResult, type TypedQuery, type TypedRowQuery, type WindowPreset, type ZeroClickResult, analyzeBrandSegmentation, analyzeCannibalization, analyzeClustering, analyzeConcentration, analyzeDecay, analyzeInBrowser, analyzeKeywordConcentration, analyzeMovers, analyzePageConcentration, analyzeSeasonality, comparisonOf, createAnalyzerRegistry, createCompositeSource, createEngineQuerySource, createInMemoryQuerySource, createSorter, defaultAnalyzerRegistry, defaultReportRegistry, defineAnalyzer, diffSitemapHealth, dryRunReport, formatReport, mergePriorityActions, normalizePriorityActions, normalizeQuery, num, padTimeseries, periodOf, queryComparisonRows, queryRows, resolveWindow, rewriteForTableSource, runAnalyzerFromSource, runAnalyzerWithEngine, runReport, scorePriorityActions, typedQuery, windowToComparisonPeriod, windowToPeriod };
501
+ export { type ActionPriorityResult, type ActionPrioritySourceState, type ActionPrioritySourceStatus, type ActionSource, type AnalysisParams, type AnalysisPeriod, type AnalysisQuerySource, type AnalysisResult, type AnalysisSourceKind, type AnalysisTool, type Analyzer, AnalyzerCapabilityError, type AnalyzerRegistry, type AnalyzerRegistryInit, type AnalyzerRunner, type AnalyzerVariants, type BaseMetrics, type BrandSegmentationOptions, type BrandSegmentationResult, type BrandSummary, type BrowserAnalyzeOptions, type CannibalizationCompetitor, type CannibalizationEvent, type CannibalizationOptions, type CannibalizationPage, type CannibalizationResult, type CannibalizationSortMetric, type ClusterType, type ClusteringOptions, type ClusteringResult, type ComparisonMode, type ComparisonPeriod, type CompositeSourceOptions, type ConcentrationInput, type ConcentrationItem, type ConcentrationOptions, type ConcentrationResult, type ConcentrationRiskLevel, DEFAULT_PRIORITY_SOURCES, type DateRow, type DecayInput, type DecayOptions, type DecayResult, type DecaySeriesPoint, type DecaySortMetric, type DefineAnalyzerOptions, type DefineReportOptions, type DefinedAnalyzer, type DefinedReport, type DryRunReportResult, ENGINE_QUERY_CAPABILITIES, type Effort, type EngineQuerySourceOptions, type ExecuteSqlOptions, type FileSet, type FormatReportOptions, IN_MEMORY_DEFAULT_CAPABILITIES, type InMemoryQuerySourceOptions, type KeywordCluster, type MonthlyData, type MoverData, type MoversInput, type MoversOptions, type MoversResult, type MoversSortMetric, type OpportunityResult, type PadTimeseriesOptions, type PageRow, type Plan, type PriorityAction, type QueriesRow, type QueryPageRow, type QueryRow, REPORTS, ROW_ANALYZERS, type ReduceContext, type ReduceCtx, type Reducer, type ReportAction, type ReportContext, type ReportFinding, type ReportPlanStep, type ReportResult, type ReportSection, type RequiredCapability, type ResolveWindowOptions, type ResolvedWindow, type RowQueriesPlan, type RunReportOptions, SQL_ANALYZERS, type SeasonalityMetric, type SeasonalityOptions, type SeasonalityResult, type SitemapDelta, type SitemapHealthDiff, type SitemapHealthInput, type SitemapHealthRow, type SitemapHealthTotals, type SortOrder, type SourceCapabilities, type SqlExtraQuery, type SqlPlan, type SqlPlanSpec, type StrikingDistanceInputRow, type StrikingDistanceResult, type TypedQuery, type TypedRowQuery, type WindowPreset, type ZeroClickResult, analyzeBrandSegmentation, analyzeCannibalization, analyzeClustering, analyzeConcentration, analyzeDecay, analyzeInBrowser, analyzeKeywordConcentration, analyzeMovers, analyzePageConcentration, analyzeSeasonality, comparisonOf, createAnalyzerRegistry, createCompositeSource, createEngineQuerySource, createInMemoryQuerySource, createSorter, defaultAnalyzerRegistry, defaultReportRegistry, defineAnalyzer, diffSitemapHealth, dryRunReport, formatReport, mergePriorityActions, normalizePriorityActions, normalizeQuery, num, padTimeseries, periodOf, queryComparisonRows, queryRows, resolveWindow, rewriteForTableSource, runAnalyzerFromSource, runAnalyzerWithEngine, runReport, scorePriorityActions, typedQuery, windowToComparisonPeriod, windowToPeriod };
package/dist/index.mjs CHANGED
@@ -362,7 +362,7 @@ const bayesianCtrAnalyzer = defineAnalyzer$1({
362
362
  minImpressions
363
363
  ],
364
364
  current: {
365
- table: "page_keywords",
365
+ table: "page_queries",
366
366
  partitions: enumeratePartitions(startDate, endDate)
367
367
  }
368
368
  };
@@ -612,7 +612,7 @@ const bipartitePagerankAnalyzer = defineAnalyzer$1({
612
612
  minImpressions
613
613
  ],
614
614
  current: {
615
- table: "page_keywords",
615
+ table: "page_queries",
616
616
  partitions: enumeratePartitions(startDate, endDate)
617
617
  }
618
618
  };
@@ -653,7 +653,7 @@ const bipartitePagerankAnalyzer = defineAnalyzer$1({
653
653
  }
654
654
  });
655
655
  const DEFAULT_LIMIT$2 = 25e3;
656
- function keywordsQueryState(period, limit = DEFAULT_LIMIT$2) {
656
+ function queriesQueryState(period, limit = DEFAULT_LIMIT$2) {
657
657
  return gsc.select(query, page).where(between(date, period.startDate, period.endDate)).limit(limit).getState();
658
658
  }
659
659
  function pagesQueryState(period, limit = DEFAULT_LIMIT$2) {
@@ -730,7 +730,7 @@ const brandAnalyzer = defineAnalyzer$1({
730
730
  regex
731
731
  ],
732
732
  current: {
733
- table: "page_keywords",
733
+ table: "page_queries",
734
734
  partitions: enumeratePartitions(startDate, endDate)
735
735
  }
736
736
  };
@@ -772,7 +772,7 @@ const brandAnalyzer = defineAnalyzer$1({
772
772
  };
773
773
  },
774
774
  buildRows(params) {
775
- return { keywords: keywordsQueryState(periodOf$1(params), params.limit) };
775
+ return { queries: queriesQueryState(periodOf$1(params), params.limit) };
776
776
  },
777
777
  reduceRows(rows, params) {
778
778
  if (!params.brandTerms?.length) throw new Error("Brand analysis requires brandTerms");
@@ -976,7 +976,7 @@ const cannibalizationAnalyzer = defineAnalyzer$1({
976
976
  minQueryImpressions
977
977
  ],
978
978
  current: {
979
- table: "page_keywords",
979
+ table: "page_queries",
980
980
  partitions: enumeratePartitions(startDate, endDate)
981
981
  }
982
982
  };
@@ -1058,7 +1058,7 @@ const cannibalizationAnalyzer = defineAnalyzer$1({
1058
1058
  };
1059
1059
  },
1060
1060
  buildRows(params) {
1061
- return { rows: keywordsQueryState(periodOf$1(params), params.limit) };
1061
+ return { rows: queriesQueryState(periodOf$1(params), params.limit) };
1062
1062
  },
1063
1063
  reduceRows(rows, params) {
1064
1064
  const results = analyzeCannibalization(Array.isArray(rows) ? rows : [], {
@@ -1231,7 +1231,7 @@ const changePointAnalyzer = defineAnalyzer$1({
1231
1231
  minImpressions
1232
1232
  ],
1233
1233
  current: {
1234
- table: "page_keywords",
1234
+ table: "page_queries",
1235
1235
  partitions: enumeratePartitions(startDate, endDate)
1236
1236
  }
1237
1237
  };
@@ -1437,7 +1437,7 @@ const clusteringAnalyzer = defineAnalyzer$1({
1437
1437
  minClusterSize
1438
1438
  ],
1439
1439
  current: {
1440
- table: "keywords",
1440
+ table: "queries",
1441
1441
  partitions: enumeratePartitions(startDate, endDate)
1442
1442
  }
1443
1443
  };
@@ -1467,7 +1467,7 @@ const clusteringAnalyzer = defineAnalyzer$1({
1467
1467
  };
1468
1468
  },
1469
1469
  buildRows(params) {
1470
- return { keywords: keywordsQueryState(periodOf$1(params), params.limit) };
1470
+ return { queries: queriesQueryState(periodOf$1(params), params.limit) };
1471
1471
  },
1472
1472
  reduceRows(rows, params) {
1473
1473
  const result = analyzeClustering(Array.isArray(rows) ? rows : [], {
@@ -1560,7 +1560,7 @@ const concentrationAnalyzer = defineAnalyzer$1({
1560
1560
  const { startDate, endDate } = periodOf$1(params);
1561
1561
  const dim = params.dimension || "pages";
1562
1562
  const topN = params.topN ?? 10;
1563
- const table = dim === "keywords" ? "keywords" : "pages";
1563
+ const table = dim === "keywords" ? "queries" : "pages";
1564
1564
  const keyCol = dim === "keywords" ? "query" : "url";
1565
1565
  return {
1566
1566
  sql: `
@@ -1658,12 +1658,12 @@ const concentrationAnalyzer = defineAnalyzer$1({
1658
1658
  const period = periodOf$1(params);
1659
1659
  const out = {};
1660
1660
  if (dim === "pages") out.pages = pagesQueryState(period, params.limit);
1661
- else out.keywords = keywordsQueryState(period, params.limit);
1661
+ else out.queries = queriesQueryState(period, params.limit);
1662
1662
  return out;
1663
1663
  },
1664
1664
  reduceRows(rows, params) {
1665
1665
  const dim = params.dimension || "pages";
1666
- const arr = Array.isArray(rows) ? rows : rows[dim] ?? [];
1666
+ const arr = Array.isArray(rows) ? rows : rows[dim === "pages" ? "pages" : "queries"] ?? [];
1667
1667
  return {
1668
1668
  results: [dim === "pages" ? analyzePageConcentration(arr, { topN: params.topN }) : analyzeKeywordConcentration(arr, { topN: params.topN })],
1669
1669
  meta: { dimension: dim }
@@ -1723,7 +1723,7 @@ const contentVelocityAnalyzer = defineAnalyzer$1({
1723
1723
  `,
1724
1724
  params: [startDate, endDate],
1725
1725
  current: {
1726
- table: "keywords",
1726
+ table: "queries",
1727
1727
  partitions: enumeratePartitions(startDate, endDate)
1728
1728
  }
1729
1729
  };
@@ -1913,7 +1913,7 @@ const ctrAnomalyAnalyzer = defineAnalyzer$1({
1913
1913
  minDailyImpressions
1914
1914
  ],
1915
1915
  current: {
1916
- table: "page_keywords",
1916
+ table: "page_queries",
1917
1917
  partitions: enumeratePartitions(startDate, endDate)
1918
1918
  }
1919
1919
  };
@@ -2062,7 +2062,7 @@ const ctrCurveAnalyzer = defineAnalyzer$1({
2062
2062
  `,
2063
2063
  params: [startDate, endDate],
2064
2064
  current: {
2065
- table: "keywords",
2065
+ table: "queries",
2066
2066
  partitions: enumeratePartitions(startDate, endDate)
2067
2067
  }
2068
2068
  };
@@ -2188,11 +2188,11 @@ const darkTrafficAnalyzer = defineAnalyzer$1({
2188
2188
  },
2189
2189
  extraFiles: {
2190
2190
  KEYWORDS: {
2191
- table: "keywords",
2191
+ table: "queries",
2192
2192
  partitions: enumeratePartitions(startDate, endDate)
2193
2193
  },
2194
2194
  PAGE_KEYWORDS: {
2195
- table: "page_keywords",
2195
+ table: "page_queries",
2196
2196
  partitions: enumeratePartitions(startDate, endDate)
2197
2197
  }
2198
2198
  }
@@ -2964,7 +2964,7 @@ const deviceGapAnalyzer = defineAnalyzer$1({
2964
2964
  `,
2965
2965
  params: [startDate, endDate],
2966
2966
  current: {
2967
- table: "devices",
2967
+ table: "dates",
2968
2968
  partitions: enumeratePartitions(startDate, endDate)
2969
2969
  }
2970
2970
  };
@@ -3198,7 +3198,7 @@ const intentAtlasAnalyzer = defineAnalyzer$1({
3198
3198
  minQueryImpressions
3199
3199
  ],
3200
3200
  current: {
3201
- table: "keywords",
3201
+ table: "queries",
3202
3202
  partitions: enumeratePartitions(startDate, endDate)
3203
3203
  }
3204
3204
  };
@@ -3306,7 +3306,7 @@ const keywordBreadthAnalyzer = defineAnalyzer$1({
3306
3306
  `,
3307
3307
  params: [startDate, endDate],
3308
3308
  current: {
3309
- table: "page_keywords",
3309
+ table: "page_queries",
3310
3310
  partitions: enumeratePartitions(startDate, endDate)
3311
3311
  }
3312
3312
  };
@@ -3467,7 +3467,7 @@ const longTailAnalyzer = defineAnalyzer$1({
3467
3467
  minQueryImpressions
3468
3468
  ],
3469
3469
  current: {
3470
- table: "page_keywords",
3470
+ table: "page_queries",
3471
3471
  partitions: enumeratePartitions(startDate, endDate)
3472
3472
  }
3473
3473
  };
@@ -3681,11 +3681,11 @@ const moversAnalyzer = defineAnalyzer$1({
3681
3681
  changeThreshold
3682
3682
  ],
3683
3683
  current: {
3684
- table: "page_keywords",
3684
+ table: "page_queries",
3685
3685
  partitions: enumeratePartitions(cur.startDate, cur.endDate)
3686
3686
  },
3687
3687
  previous: {
3688
- table: "page_keywords",
3688
+ table: "page_queries",
3689
3689
  partitions: enumeratePartitions(prev.startDate, prev.endDate)
3690
3690
  }
3691
3691
  };
@@ -3728,8 +3728,8 @@ const moversAnalyzer = defineAnalyzer$1({
3728
3728
  buildRows(params) {
3729
3729
  const { current, previous } = comparisonOf$1(params);
3730
3730
  return {
3731
- current: keywordsQueryState(current, params.limit),
3732
- previous: keywordsQueryState(previous, params.limit)
3731
+ current: queriesQueryState(current, params.limit),
3732
+ previous: queriesQueryState(previous, params.limit)
3733
3733
  };
3734
3734
  },
3735
3735
  reduceRows(rows, params) {
@@ -3901,7 +3901,7 @@ const opportunityAnalyzer = defineAnalyzer$1({
3901
3901
  minImpressions
3902
3902
  ],
3903
3903
  current: {
3904
- table: "page_keywords",
3904
+ table: "page_queries",
3905
3905
  partitions: enumeratePartitions(startDate, endDate)
3906
3906
  }
3907
3907
  };
@@ -3928,7 +3928,7 @@ const opportunityAnalyzer = defineAnalyzer$1({
3928
3928
  };
3929
3929
  },
3930
3930
  buildRows(params) {
3931
- return { keywords: keywordsQueryState(periodOf$1(params), params.limit) };
3931
+ return { queries: queriesQueryState(periodOf$1(params), params.limit) };
3932
3932
  },
3933
3933
  reduceRows(rows, params) {
3934
3934
  const keywords = (Array.isArray(rows) ? rows : []) ?? [];
@@ -4010,7 +4010,7 @@ const positionDistributionAnalyzer = defineAnalyzer$1({
4010
4010
  `,
4011
4011
  params: [startDate, endDate],
4012
4012
  current: {
4013
- table: "keywords",
4013
+ table: "queries",
4014
4014
  partitions: enumeratePartitions(startDate, endDate)
4015
4015
  }
4016
4016
  };
@@ -4128,7 +4128,7 @@ const positionVolatilityAnalyzer = defineAnalyzer$1({
4128
4128
  minDays
4129
4129
  ],
4130
4130
  current: {
4131
- table: "page_keywords",
4131
+ table: "page_queries",
4132
4132
  partitions: enumeratePartitions(startDate, endDate)
4133
4133
  }
4134
4134
  };
@@ -4285,11 +4285,11 @@ const queryMigrationAnalyzer = defineAnalyzer$1({
4285
4285
  minImpressions
4286
4286
  ],
4287
4287
  current: {
4288
- table: "page_keywords",
4288
+ table: "page_queries",
4289
4289
  partitions: enumeratePartitions(cur.startDate, cur.endDate)
4290
4290
  },
4291
4291
  previous: {
4292
- table: "page_keywords",
4292
+ table: "page_queries",
4293
4293
  partitions: enumeratePartitions(prevStart, prevEnd)
4294
4294
  }
4295
4295
  };
@@ -4647,7 +4647,7 @@ const stlDecomposeAnalyzer = defineAnalyzer$1({
4647
4647
  minImpressions
4648
4648
  ],
4649
4649
  current: {
4650
- table: "page_keywords",
4650
+ table: "page_queries",
4651
4651
  partitions: enumeratePartitions(startDate, endDate)
4652
4652
  }
4653
4653
  };
@@ -4744,13 +4744,13 @@ const strikingDistanceAnalyzer = defineAnalyzer$1({
4744
4744
  `,
4745
4745
  params: [startDate, endDate],
4746
4746
  current: {
4747
- table: "page_keywords",
4747
+ table: "page_queries",
4748
4748
  partitions: enumeratePartitions(startDate, endDate)
4749
4749
  }
4750
4750
  };
4751
4751
  },
4752
4752
  buildRows(params) {
4753
- return { keywords: keywordsQueryState(periodOf$1(params), params.limit ?? DEFAULT_ROW_LIMIT$1) };
4753
+ return { queries: queriesQueryState(periodOf$1(params), params.limit ?? DEFAULT_ROW_LIMIT$1) };
4754
4754
  }
4755
4755
  });
4756
4756
  function str$1(v) {
@@ -4905,7 +4905,7 @@ const survivalAnalyzer = defineAnalyzer$1({
4905
4905
  minImpressions
4906
4906
  ],
4907
4907
  current: {
4908
- table: "page_keywords",
4908
+ table: "page_queries",
4909
4909
  partitions: enumeratePartitions(startDate, endDate)
4910
4910
  }
4911
4911
  };
@@ -4977,7 +4977,7 @@ const trendsAnalyzer = defineAnalyzer$1({
4977
4977
  const minWeeksWithData = params.minWeeksWithData ?? Math.max(2, Math.floor(weeks / 4));
4978
4978
  const limit = params.limit ?? 500;
4979
4979
  const dim = params.dimension === "keywords" ? "keywords" : "pages";
4980
- const table = dim === "keywords" ? "keywords" : "pages";
4980
+ const table = dim === "keywords" ? "queries" : "pages";
4981
4981
  return {
4982
4982
  sql: `
4983
4983
  WITH bucketed AS (
@@ -5195,7 +5195,7 @@ const ALL_ANALYZERS = [
5195
5195
  maxCtr
5196
5196
  ],
5197
5197
  current: {
5198
- table: "page_keywords",
5198
+ table: "page_queries",
5199
5199
  partitions: enumeratePartitions(startDate, endDate)
5200
5200
  }
5201
5201
  };
@@ -35,7 +35,7 @@ interface ContentGapOptions {
35
35
  }
36
36
  /**
37
37
  * Content-gap requires a source with a raw-SQL escape hatch. The analyzer's
38
- * query shape (CTEs + window functions against `main.page_keywords`) isn't
38
+ * query shape (CTEs + window functions against `main.page_queries`) isn't
39
39
  * expressible as a {@link BuilderState}, so it bypasses `queryRows` and
40
40
  * goes directly through `source.executeSql`.
41
41
  */
@@ -179,7 +179,7 @@ async function fetchContentGapInputs(executeSql, options) {
179
179
  SUM(impressions)::BIGINT AS total_impressions,
180
180
  SUM(clicks)::BIGINT AS total_clicks,
181
181
  SUM(sum_position) / NULLIF(SUM(impressions), 0) + 1 AS avg_position
182
- FROM main.page_keywords
182
+ FROM main.page_queries
183
183
  WHERE query IS NOT NULL AND query <> ''
184
184
  GROUP BY query
185
185
  HAVING SUM(impressions) >= ?
@@ -191,7 +191,7 @@ async function fetchContentGapInputs(executeSql, options) {
191
191
  SUM(pk.impressions)::BIGINT AS url_impressions,
192
192
  SUM(pk.sum_position) / NULLIF(SUM(pk.impressions), 0) + 1 AS url_position,
193
193
  ROW_NUMBER() OVER (PARTITION BY pk.query ORDER BY SUM(pk.impressions) DESC) AS rnk
194
- FROM main.page_keywords pk
194
+ FROM main.page_queries pk
195
195
  JOIN query_totals qt USING (query)
196
196
  WHERE pk.url IS NOT NULL AND pk.url <> ''
197
197
  GROUP BY pk.query, pk.url
@@ -204,7 +204,7 @@ async function fetchContentGapInputs(executeSql, options) {
204
204
  `, [Number(options.minImpressions), Number(options.maxQueries)]);
205
205
  const urlRows = await executeSql(`
206
206
  SELECT url, SUM(impressions)::BIGINT AS impressions
207
- FROM main.page_keywords
207
+ FROM main.page_queries
208
208
  WHERE url IS NOT NULL AND url <> ''
209
209
  GROUP BY url
210
210
  ORDER BY impressions DESC
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/analysis",
3
3
  "type": "module",
4
- "version": "0.20.3",
4
+ "version": "0.21.1",
5
5
  "description": "GSC analyzers — striking-distance, opportunity, movers, decay, brand, clustering, concentration, seasonality. Pure row-based + DuckDB-native.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -75,9 +75,9 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "drizzle-orm": "^0.45.2",
78
- "@gscdump/engine": "0.20.3",
79
- "@gscdump/engine-gsc-api": "0.20.3",
80
- "gscdump": "0.20.3"
78
+ "@gscdump/engine": "0.21.1",
79
+ "@gscdump/engine-gsc-api": "0.21.1",
80
+ "gscdump": "0.21.1"
81
81
  },
82
82
  "devDependencies": {
83
83
  "vitest": "^4.1.6"