gscdump 0.11.1 → 0.11.3

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.
@@ -32,4 +32,49 @@ interface TenantCtx {
32
32
  userId: string;
33
33
  siteId?: string;
34
34
  }
35
- export { ColumnDef, ColumnType, Row, TableName, TableSchema, TenantCtx };
35
+ /**
36
+ * Dimensions accepted by the Google Search Console Search Analytics API.
37
+ *
38
+ * This intentionally excludes package-only logical dimensions such as
39
+ * `queryCanonical`; host apps must route those through an engine-backed path.
40
+ */
41
+ type GscSearchAnalyticsDimension = 'page' | 'query' | 'country' | 'device' | 'date' | 'searchAppearance';
42
+ type GscSearchAnalyticsFilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'includingRegex' | 'excludingRegex';
43
+ interface GscSearchAnalyticsFilter {
44
+ dimension: GscSearchAnalyticsDimension;
45
+ expression: string;
46
+ operator?: GscSearchAnalyticsFilterOperator;
47
+ }
48
+ interface GscSearchAnalyticsFilterGroup {
49
+ groupType?: 'and' | 'or';
50
+ filters: GscSearchAnalyticsFilter[];
51
+ }
52
+ type GscSearchType = 'web' | 'image' | 'video' | 'news' | 'discover' | 'googleNews';
53
+ /**
54
+ * Canonical host-facing Search Analytics request body.
55
+ *
56
+ * Google's generated client type also has deprecated/alternate fields. The
57
+ * gscdump query builder emits `searchType`, so apps should forward that field
58
+ * unchanged rather than translating it to `type`.
59
+ */
60
+ interface GscSearchAnalyticsRequest {
61
+ startDate: string;
62
+ endDate: string;
63
+ dimensions?: GscSearchAnalyticsDimension[];
64
+ dimensionFilterGroups?: GscSearchAnalyticsFilterGroup[];
65
+ rowLimit?: number;
66
+ startRow?: number;
67
+ searchType?: GscSearchType;
68
+ }
69
+ interface GscSearchAnalyticsRow {
70
+ keys: string[];
71
+ clicks: number;
72
+ impressions: number;
73
+ ctr: number;
74
+ position: number;
75
+ }
76
+ interface GscSearchAnalyticsResponse {
77
+ rows?: GscSearchAnalyticsRow[];
78
+ responseAggregationType?: string;
79
+ }
80
+ export { ColumnDef, ColumnType, GscSearchAnalyticsDimension, GscSearchAnalyticsFilter, GscSearchAnalyticsFilterGroup, GscSearchAnalyticsFilterOperator, GscSearchAnalyticsRequest, GscSearchAnalyticsResponse, GscSearchAnalyticsRow, GscSearchType, Row, TableName, TableSchema, TenantCtx };
package/dist/index.d.mts CHANGED
@@ -12,71 +12,39 @@ declare function runSequentialBatch<I, R>(items: I[], operation: (item: I, index
12
12
  concurrency?: number;
13
13
  onProgress?: (result: R, index: number, total: number) => void;
14
14
  }): Promise<R[]>;
15
- type ApiSite = searchconsole_v1.Schema$WmxSite;
16
- type ApiSitemap = searchconsole_v1.Schema$WmxSitemap;
17
- type ApiSitemapContent = searchconsole_v1.Schema$WmxSitemapContent;
18
- type SearchAnalyticsQuery = searchconsole_v1.Schema$SearchAnalyticsQueryRequest;
19
- type SearchAnalyticsResponse = searchconsole_v1.Schema$SearchAnalyticsQueryResponse;
20
- type DataRow = searchconsole_v1.Schema$ApiDataRow;
21
- type DimensionFilter = searchconsole_v1.Schema$ApiDimensionFilter;
22
- type DimensionFilterGroup = searchconsole_v1.Schema$ApiDimensionFilterGroup;
23
- type UrlInspectionResult = searchconsole_v1.Schema$UrlInspectionResult;
24
- type IndexStatusResult = searchconsole_v1.Schema$IndexStatusInspectionResult;
25
- type MobileUsabilityResult = searchconsole_v1.Schema$MobileUsabilityInspectionResult;
26
- type RichResultsResult = searchconsole_v1.Schema$RichResultsInspectionResult;
27
- type InspectUrlIndexResponse = searchconsole_v1.Schema$InspectUrlIndexResponse;
28
- type UrlNotificationMetadata = indexing_v3.Schema$UrlNotificationMetadata;
29
- type PublishUrlNotificationResponse = indexing_v3.Schema$PublishUrlNotificationResponse;
30
- type RequiredNonNullable<T> = Required<Exclude<T, null | undefined>>;
31
- interface Site extends Required<Omit<ApiSite, 'siteUrl'>> {
32
- siteUrl: string;
15
+ /**
16
+ * Dimensions accepted by the Google Search Console Search Analytics API.
17
+ *
18
+ * This intentionally excludes package-only logical dimensions such as
19
+ * `queryCanonical`; host apps must route those through an engine-backed path.
20
+ */
21
+ type GscSearchAnalyticsDimension = 'page' | 'query' | 'country' | 'device' | 'date' | 'searchAppearance';
22
+ type GscSearchAnalyticsFilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'includingRegex' | 'excludingRegex';
23
+ interface GscSearchAnalyticsFilter {
24
+ dimension: GscSearchAnalyticsDimension;
25
+ expression: string;
26
+ operator?: GscSearchAnalyticsFilterOperator;
33
27
  }
34
- interface Period {
35
- start: Date | string;
36
- end: Date | string;
28
+ interface GscSearchAnalyticsFilterGroup {
29
+ groupType?: 'and' | 'or';
30
+ filters: GscSearchAnalyticsFilter[];
37
31
  }
38
- interface ResolvedAnalyticsRange {
39
- period: Period;
40
- prevPeriod?: Period;
41
- }
42
- interface SiteAnalytics {
43
- analytics: {
44
- period: {
45
- totalClicks: number;
46
- totalImpressions: number;
47
- };
48
- prevPeriod: {
49
- totalClicks: number;
50
- totalImpressions: number;
51
- };
52
- };
53
- sitemaps: ApiSitemap[];
54
- indexedUrls: string[];
55
- period: {
56
- url: string;
57
- clicks: number;
58
- clicksPercent: number;
59
- prevClicks: number;
60
- impressions: number;
61
- impressionsPercent: number;
62
- prevImpressions: number;
63
- }[];
64
- keywords: {
65
- keyword: string;
66
- position: number;
67
- prevPosition: number;
68
- positionPercent: number;
69
- ctr: number;
70
- ctrPercent: number;
71
- prevCtr: number;
72
- clicks: number;
73
- }[];
74
- graph: {
75
- keys?: undefined;
76
- time: string;
77
- clicks: number;
78
- impressions: number;
79
- }[];
32
+ type GscSearchType = 'web' | 'image' | 'video' | 'news' | 'discover' | 'googleNews';
33
+ /**
34
+ * Canonical host-facing Search Analytics request body.
35
+ *
36
+ * Google's generated client type also has deprecated/alternate fields. The
37
+ * gscdump query builder emits `searchType`, so apps should forward that field
38
+ * unchanged rather than translating it to `type`.
39
+ */
40
+ interface GscSearchAnalyticsRequest {
41
+ startDate: string;
42
+ endDate: string;
43
+ dimensions?: GscSearchAnalyticsDimension[];
44
+ dimensionFilterGroups?: GscSearchAnalyticsFilterGroup[];
45
+ rowLimit?: number;
46
+ startRow?: number;
47
+ searchType?: GscSearchType;
80
48
  }
81
49
  declare const _default: {
82
50
  name: string;
@@ -170,9 +138,75 @@ interface GSCQueryBuilder<D extends Dimension[] = [], C = object> {
170
138
  orderBy: (col: OrderableColumn, dir: 'asc' | 'desc') => GSCQueryBuilder<D, C>;
171
139
  limit: (n: number) => GSCQueryBuilder<D, C>;
172
140
  offset: (n: number) => GSCQueryBuilder<D, C>;
173
- toBody: () => SearchAnalyticsQuery;
141
+ toBody: () => GscSearchAnalyticsRequest;
174
142
  getState: () => BuilderState;
175
143
  }
144
+ type ApiSite = searchconsole_v1.Schema$WmxSite;
145
+ type ApiSitemap = searchconsole_v1.Schema$WmxSitemap;
146
+ type ApiSitemapContent = searchconsole_v1.Schema$WmxSitemapContent;
147
+ type SearchAnalyticsQuery = searchconsole_v1.Schema$SearchAnalyticsQueryRequest;
148
+ type SearchAnalyticsResponse = searchconsole_v1.Schema$SearchAnalyticsQueryResponse;
149
+ type DataRow = searchconsole_v1.Schema$ApiDataRow;
150
+ type DimensionFilter = searchconsole_v1.Schema$ApiDimensionFilter;
151
+ type DimensionFilterGroup = searchconsole_v1.Schema$ApiDimensionFilterGroup;
152
+ type UrlInspectionResult = searchconsole_v1.Schema$UrlInspectionResult;
153
+ type IndexStatusResult = searchconsole_v1.Schema$IndexStatusInspectionResult;
154
+ type MobileUsabilityResult = searchconsole_v1.Schema$MobileUsabilityInspectionResult;
155
+ type RichResultsResult = searchconsole_v1.Schema$RichResultsInspectionResult;
156
+ type InspectUrlIndexResponse = searchconsole_v1.Schema$InspectUrlIndexResponse;
157
+ type UrlNotificationMetadata = indexing_v3.Schema$UrlNotificationMetadata;
158
+ type PublishUrlNotificationResponse = indexing_v3.Schema$PublishUrlNotificationResponse;
159
+ type RequiredNonNullable<T> = Required<Exclude<T, null | undefined>>;
160
+ interface Site extends Required<Omit<ApiSite, 'siteUrl'>> {
161
+ siteUrl: string;
162
+ }
163
+ interface Period {
164
+ start: Date | string;
165
+ end: Date | string;
166
+ }
167
+ interface ResolvedAnalyticsRange {
168
+ period: Period;
169
+ prevPeriod?: Period;
170
+ }
171
+ interface SiteAnalytics {
172
+ analytics: {
173
+ period: {
174
+ totalClicks: number;
175
+ totalImpressions: number;
176
+ };
177
+ prevPeriod: {
178
+ totalClicks: number;
179
+ totalImpressions: number;
180
+ };
181
+ };
182
+ sitemaps: ApiSitemap[];
183
+ indexedUrls: string[];
184
+ period: {
185
+ url: string;
186
+ clicks: number;
187
+ clicksPercent: number;
188
+ prevClicks: number;
189
+ impressions: number;
190
+ impressionsPercent: number;
191
+ prevImpressions: number;
192
+ }[];
193
+ keywords: {
194
+ keyword: string;
195
+ position: number;
196
+ prevPosition: number;
197
+ positionPercent: number;
198
+ ctr: number;
199
+ ctrPercent: number;
200
+ prevCtr: number;
201
+ clicks: number;
202
+ }[];
203
+ graph: {
204
+ keys?: undefined;
205
+ time: string;
206
+ clicks: number;
207
+ impressions: number;
208
+ }[];
209
+ }
176
210
  type VerificationMethod = 'META' | 'FILE' | 'DNS_TXT' | 'DNS_CNAME' | 'ANALYTICS' | 'TAG_MANAGER';
177
211
  type VerificationSiteType = 'SITE' | 'INET_DOMAIN' | 'ANDROID_APP';
178
212
  interface VerificationSite {
@@ -1,6 +1,48 @@
1
1
  import _dayjs, { Dayjs } from "dayjs";
2
- import { searchconsole_v1 } from "@googleapis/searchconsole/build/v1";
3
- type SearchAnalyticsQuery = searchconsole_v1.Schema$SearchAnalyticsQueryRequest;
2
+ /**
3
+ * Canonical cross-package contracts. Type-only — zero runtime cost.
4
+ *
5
+ * Imported by @gscdump/engine, @gscdump/analysis, @gscdump/cli, @gscdump/mcp,
6
+ * @gscdump/cloud as the single source of truth for cross-cutting types so
7
+ * schema identifiers, tenant shape, and analyzer IO can't drift across
8
+ * packages.
9
+ */
10
+ /** Logical table / dataset identifier. Canonical across query builder + storage engine. */
11
+ type TableName = 'pages' | 'keywords' | 'countries' | 'devices' | 'page_keywords' | 'search_appearance';
12
+ /**
13
+ * Dimensions accepted by the Google Search Console Search Analytics API.
14
+ *
15
+ * This intentionally excludes package-only logical dimensions such as
16
+ * `queryCanonical`; host apps must route those through an engine-backed path.
17
+ */
18
+ type GscSearchAnalyticsDimension = 'page' | 'query' | 'country' | 'device' | 'date' | 'searchAppearance';
19
+ type GscSearchAnalyticsFilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'includingRegex' | 'excludingRegex';
20
+ interface GscSearchAnalyticsFilter {
21
+ dimension: GscSearchAnalyticsDimension;
22
+ expression: string;
23
+ operator?: GscSearchAnalyticsFilterOperator;
24
+ }
25
+ interface GscSearchAnalyticsFilterGroup {
26
+ groupType?: 'and' | 'or';
27
+ filters: GscSearchAnalyticsFilter[];
28
+ }
29
+ type GscSearchType = 'web' | 'image' | 'video' | 'news' | 'discover' | 'googleNews';
30
+ /**
31
+ * Canonical host-facing Search Analytics request body.
32
+ *
33
+ * Google's generated client type also has deprecated/alternate fields. The
34
+ * gscdump query builder emits `searchType`, so apps should forward that field
35
+ * unchanged rather than translating it to `type`.
36
+ */
37
+ interface GscSearchAnalyticsRequest {
38
+ startDate: string;
39
+ endDate: string;
40
+ dimensions?: GscSearchAnalyticsDimension[];
41
+ dimensionFilterGroups?: GscSearchAnalyticsFilterGroup[];
42
+ rowLimit?: number;
43
+ startRow?: number;
44
+ searchType?: GscSearchType;
45
+ }
4
46
  declare const _default: {
5
47
  name: string;
6
48
  'alpha-2': string;
@@ -114,7 +156,7 @@ interface GSCQueryBuilder<D extends Dimension[] = [], C = object> {
114
156
  orderBy: (col: OrderableColumn, dir: 'asc' | 'desc') => GSCQueryBuilder<D, C>;
115
157
  limit: (n: number) => GSCQueryBuilder<D, C>;
116
158
  offset: (n: number) => GSCQueryBuilder<D, C>;
117
- toBody: () => SearchAnalyticsQuery;
159
+ toBody: () => GscSearchAnalyticsRequest;
118
160
  getState: () => BuilderState;
119
161
  }
120
162
  declare const gsc: GSCQueryBuilder<[], object>;
@@ -152,16 +194,6 @@ declare function lt<D extends Dimension>(column: Column<D>, value: DimensionValu
152
194
  declare function between<M extends Metric>(column: MetricColumn<M>, start: number, end: number): Filter<object>;
153
195
  declare function between<D extends Dimension>(column: Column<D>, start: DimensionValueMap[D], end: DimensionValueMap[D]): Filter<object>;
154
196
  declare function topLevel(column: Column<'page'>): Filter<object>;
155
- /**
156
- * Canonical cross-package contracts. Type-only — zero runtime cost.
157
- *
158
- * Imported by @gscdump/engine, @gscdump/analysis, @gscdump/cli, @gscdump/mcp,
159
- * @gscdump/cloud as the single source of truth for cross-cutting types so
160
- * schema identifiers, tenant shape, and analyzer IO can't drift across
161
- * packages.
162
- */
163
- /** Logical table / dataset identifier. Canonical across query builder + storage engine. */
164
- type TableName = 'pages' | 'keywords' | 'countries' | 'devices' | 'page_keywords' | 'search_appearance';
165
197
  type LogicalDataset = TableName;
166
198
  type ComparisonFilter = 'new' | 'lost' | 'improving' | 'declining';
167
199
  interface PlannerCapabilities {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gscdump",
3
3
  "type": "module",
4
- "version": "0.11.1",
4
+ "version": "0.11.3",
5
5
  "description": "Google Search Console API wrapper with typed query builder, streaming pagination, and SEO analysis functions",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",