@gscdump/contracts 0.26.10 → 0.27.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/_chunks/schemas.d.mts +5376 -0
- package/dist/_chunks/schemas.mjs +1519 -0
- package/dist/_chunks/types.d.mts +1557 -0
- package/dist/_chunks/webhook-constants.d.mts +9 -0
- package/dist/analytics.d.mts +3 -0
- package/dist/analytics.mjs +2 -0
- package/dist/archetypes.d.mts +107 -0
- package/dist/archetypes.mjs +12 -0
- package/dist/index.d.mts +5 -5249
- package/dist/index.mjs +3 -1512
- package/dist/partner.d.mts +4 -0
- package/dist/partner.mjs +2 -0
- package/package.json +16 -1
|
@@ -0,0 +1,1557 @@
|
|
|
1
|
+
declare const GSCDUMP_ONBOARDING_CONTRACT_VERSION: "2026-05-11";
|
|
2
|
+
declare const GSCDUMP_REQUIRED_ANALYTICS_SCOPE: "https://www.googleapis.com/auth/webmasters.readonly";
|
|
3
|
+
declare const GSCDUMP_WRITE_ANALYTICS_SCOPE: "https://www.googleapis.com/auth/webmasters";
|
|
4
|
+
declare const GSCDUMP_OPTIONAL_INDEXING_SCOPE: "https://www.googleapis.com/auth/indexing";
|
|
5
|
+
declare const accountStatuses: readonly ["disconnected", "oauth_received", "scope_missing", "refresh_missing", "db_provisioning", "ready", "reauth_required"];
|
|
6
|
+
declare const accountNextActions: readonly ["connect_google", "reconnect_google", "wait_for_provisioning", "none"];
|
|
7
|
+
declare const propertyStatuses: readonly ["no_local_site", "no_gsc_property", "unverified_property", "verified_candidate", "registered", "linked"];
|
|
8
|
+
declare const propertyNextActions: readonly ["create_site", "verify_gsc_property", "choose_property", "register_site", "none"];
|
|
9
|
+
declare const analyticsStatuses: readonly ["not_registered", "queued", "preparing", "syncing", "queryable_live", "queryable_partial", "ready", "failed"];
|
|
10
|
+
declare const analyticsNextActions: readonly ["wait_for_sync", "retry_sync", "none"];
|
|
11
|
+
declare const querySourceModes: readonly ["none", "live", "d1", "r2", "mixed"];
|
|
12
|
+
declare const sitemapStatuses: readonly ["unknown", "discovering", "none_found", "auto_submitted", "syncing", "ready", "failed"];
|
|
13
|
+
declare const sitemapNextActions: readonly ["submit_sitemap", "wait_for_sitemaps", "retry_sitemaps", "none"];
|
|
14
|
+
declare const indexingStatuses: readonly ["not_requested", "missing_scope", "insufficient_permission", "waiting_for_sitemaps", "discovering", "checking", "ready", "budget_exhausted", "no_urls", "failed"];
|
|
15
|
+
declare const indexingNextActions: readonly ["reconnect_google", "fix_gsc_permission", "wait_for_sitemaps", "wait_for_indexing", "retry_indexing", "none"];
|
|
16
|
+
declare const lifecycleWebhookEvents: readonly ["user.lifecycle.changed", "site.lifecycle.changed", "site.analytics.ready", "site.indexing.ready", "site.auth.failed", "job.failed"];
|
|
17
|
+
declare const lifecycleErrorCodes: readonly ["missing_refresh_token", "missing_analytics_scope", "missing_indexing_scope", "token_refresh_failed", "permission_lost", "insufficient_gsc_permission", "gsc_property_not_found", "gsc_property_unverified", "user_database_not_provisioned", "sync_failed", "sitemap_sync_failed", "indexing_failed"];
|
|
18
|
+
type AccountStatus = typeof accountStatuses[number];
|
|
19
|
+
type AccountNextAction = typeof accountNextActions[number];
|
|
20
|
+
type PropertyStatus = typeof propertyStatuses[number];
|
|
21
|
+
type PropertyNextAction = typeof propertyNextActions[number];
|
|
22
|
+
type AnalyticsStatus = typeof analyticsStatuses[number];
|
|
23
|
+
type AnalyticsNextAction = typeof analyticsNextActions[number];
|
|
24
|
+
type QuerySourceMode = typeof querySourceModes[number];
|
|
25
|
+
type SitemapStatus = typeof sitemapStatuses[number];
|
|
26
|
+
type SitemapNextAction = typeof sitemapNextActions[number];
|
|
27
|
+
type IndexingStatus = typeof indexingStatuses[number];
|
|
28
|
+
type IndexingNextAction = typeof indexingNextActions[number];
|
|
29
|
+
type LifecycleWebhookEvent = typeof lifecycleWebhookEvents[number];
|
|
30
|
+
type LifecycleErrorCode = typeof lifecycleErrorCodes[number];
|
|
31
|
+
interface LifecycleProgress {
|
|
32
|
+
completed: number;
|
|
33
|
+
failed: number;
|
|
34
|
+
total: number;
|
|
35
|
+
percent: number;
|
|
36
|
+
}
|
|
37
|
+
interface LifecycleError {
|
|
38
|
+
code: LifecycleErrorCode;
|
|
39
|
+
message: string;
|
|
40
|
+
retryable: boolean;
|
|
41
|
+
}
|
|
42
|
+
interface PartnerLifecycleAccount {
|
|
43
|
+
status: AccountStatus;
|
|
44
|
+
grantedScopes: string[];
|
|
45
|
+
missingScopes: string[];
|
|
46
|
+
nextAction: AccountNextAction;
|
|
47
|
+
}
|
|
48
|
+
interface PartnerLifecycleSite {
|
|
49
|
+
siteId: string;
|
|
50
|
+
externalSiteId: string | null;
|
|
51
|
+
requestedUrl: string;
|
|
52
|
+
gscPropertyUrl: string | null;
|
|
53
|
+
permissionLevel: string | null;
|
|
54
|
+
property: {
|
|
55
|
+
status: PropertyStatus;
|
|
56
|
+
nextAction: PropertyNextAction;
|
|
57
|
+
};
|
|
58
|
+
analytics: {
|
|
59
|
+
status: AnalyticsStatus;
|
|
60
|
+
progress: LifecycleProgress;
|
|
61
|
+
queryable: boolean;
|
|
62
|
+
sourceMode: QuerySourceMode;
|
|
63
|
+
syncedRange: {
|
|
64
|
+
oldest: string | null;
|
|
65
|
+
newest: string | null;
|
|
66
|
+
};
|
|
67
|
+
nextAction: AnalyticsNextAction;
|
|
68
|
+
};
|
|
69
|
+
sitemaps: {
|
|
70
|
+
status: SitemapStatus;
|
|
71
|
+
discoveredCount: number;
|
|
72
|
+
nextAction: SitemapNextAction;
|
|
73
|
+
};
|
|
74
|
+
indexing: {
|
|
75
|
+
status: IndexingStatus;
|
|
76
|
+
eligible: boolean;
|
|
77
|
+
reason: string | null;
|
|
78
|
+
progress: LifecycleProgress;
|
|
79
|
+
nextAction: IndexingNextAction;
|
|
80
|
+
};
|
|
81
|
+
latestError: LifecycleError | null;
|
|
82
|
+
lifecycleRevision: number;
|
|
83
|
+
updatedAt: string;
|
|
84
|
+
}
|
|
85
|
+
interface PartnerLifecycleResponse {
|
|
86
|
+
contractVersion: typeof GSCDUMP_ONBOARDING_CONTRACT_VERSION;
|
|
87
|
+
userId: string;
|
|
88
|
+
partnerId: string | null;
|
|
89
|
+
account: PartnerLifecycleAccount;
|
|
90
|
+
sites: PartnerLifecycleSite[];
|
|
91
|
+
}
|
|
92
|
+
interface LifecycleWebhookEnvelope<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
93
|
+
contractVersion: typeof GSCDUMP_ONBOARDING_CONTRACT_VERSION;
|
|
94
|
+
deliveryId: string;
|
|
95
|
+
event: LifecycleWebhookEvent;
|
|
96
|
+
partnerId: string;
|
|
97
|
+
userId: string;
|
|
98
|
+
siteId?: string;
|
|
99
|
+
externalUserId?: string | null;
|
|
100
|
+
externalSiteId?: string | null;
|
|
101
|
+
lifecycleRevision: number;
|
|
102
|
+
occurredAt: string;
|
|
103
|
+
data: TData;
|
|
104
|
+
}
|
|
105
|
+
declare function parseGrantedScopes(scopes: string | null | undefined): string[];
|
|
106
|
+
declare function hasRequiredAnalyticsScope(scopes: string | string[] | null | undefined): boolean;
|
|
107
|
+
declare function hasOptionalIndexingScope(scopes: string | string[] | null | undefined): boolean;
|
|
108
|
+
type TableName = 'pages' | 'queries' | 'countries' | 'page_queries' | 'dates' | 'search_appearance' | 'search_appearance_pages' | 'search_appearance_queries' | 'search_appearance_page_queries' | 'hourly_pages';
|
|
109
|
+
/**
|
|
110
|
+
* Temporal granularity axis. Daily callers (`'day'`, default) read/write rows
|
|
111
|
+
* keyed by `date`; hourly callers (`'hour'`) read/write rows that additionally
|
|
112
|
+
* carry a `hour` field. Composes with `searchType` — hourly is only meaningful
|
|
113
|
+
* for Discover at the moment but the engine is generic.
|
|
114
|
+
*/
|
|
115
|
+
type Grain = 'day' | 'hour';
|
|
116
|
+
type Row = Record<string, unknown>;
|
|
117
|
+
type ColumnType = 'DATE' | 'VARCHAR' | 'INTEGER' | 'BIGINT' | 'DOUBLE';
|
|
118
|
+
interface ColumnDef {
|
|
119
|
+
name: string;
|
|
120
|
+
type: ColumnType;
|
|
121
|
+
nullable: boolean;
|
|
122
|
+
}
|
|
123
|
+
interface TableSchema {
|
|
124
|
+
name: TableName;
|
|
125
|
+
columns: ColumnDef[];
|
|
126
|
+
sortKey: string[];
|
|
127
|
+
version: number;
|
|
128
|
+
}
|
|
129
|
+
interface TenantCtx {
|
|
130
|
+
userId: string;
|
|
131
|
+
siteId?: string;
|
|
132
|
+
}
|
|
133
|
+
type Dimension = 'page' | 'query' | 'queryCanonical' | 'country' | 'device' | 'date' | 'searchAppearance' | 'hour';
|
|
134
|
+
type Metric = 'clicks' | 'impressions' | 'ctr' | 'position';
|
|
135
|
+
type GscSearchType = 'web' | 'image' | 'video' | 'news' | 'discover' | 'googleNews';
|
|
136
|
+
type Filter = unknown;
|
|
137
|
+
interface BuilderState {
|
|
138
|
+
dimensions: Dimension[];
|
|
139
|
+
metrics?: Metric[];
|
|
140
|
+
filter?: Filter;
|
|
141
|
+
orderBy?: {
|
|
142
|
+
column: Metric | 'date';
|
|
143
|
+
dir: 'asc' | 'desc';
|
|
144
|
+
};
|
|
145
|
+
rowLimit?: number;
|
|
146
|
+
startRow?: number;
|
|
147
|
+
searchType?: GscSearchType;
|
|
148
|
+
}
|
|
149
|
+
interface GscApiRange {
|
|
150
|
+
start: string;
|
|
151
|
+
end: string;
|
|
152
|
+
}
|
|
153
|
+
interface CountryRow {
|
|
154
|
+
country: string;
|
|
155
|
+
clicks: number;
|
|
156
|
+
impressions: number;
|
|
157
|
+
sum_position: number;
|
|
158
|
+
}
|
|
159
|
+
interface CountriesResponse {
|
|
160
|
+
rows: CountryRow[];
|
|
161
|
+
range: GscApiRange;
|
|
162
|
+
generatedAt: string;
|
|
163
|
+
source: 'gsc-api' | 'engine';
|
|
164
|
+
}
|
|
165
|
+
interface SearchAppearanceRow {
|
|
166
|
+
searchAppearance: string;
|
|
167
|
+
clicks: number;
|
|
168
|
+
impressions: number;
|
|
169
|
+
sum_position: number;
|
|
170
|
+
}
|
|
171
|
+
interface SearchAppearanceResponse {
|
|
172
|
+
rows: SearchAppearanceRow[];
|
|
173
|
+
range: GscApiRange;
|
|
174
|
+
generatedAt: string;
|
|
175
|
+
source: 'gsc-api' | 'engine';
|
|
176
|
+
}
|
|
177
|
+
interface SiteListItem {
|
|
178
|
+
id: string;
|
|
179
|
+
label: string;
|
|
180
|
+
hostname: string;
|
|
181
|
+
propertyType: 'domain' | 'url-prefix';
|
|
182
|
+
readBackend?: 'd1' | 'r2';
|
|
183
|
+
}
|
|
184
|
+
interface ScheduleState {
|
|
185
|
+
nextAt: number;
|
|
186
|
+
consecutiveUnchanged: number;
|
|
187
|
+
policyVersion: number;
|
|
188
|
+
}
|
|
189
|
+
interface SitemapHistoryRecord {
|
|
190
|
+
path: string;
|
|
191
|
+
capturedAt: string;
|
|
192
|
+
lastDownloaded?: string;
|
|
193
|
+
lastSubmitted?: string;
|
|
194
|
+
type?: string;
|
|
195
|
+
isPending?: boolean;
|
|
196
|
+
isSitemapsIndex?: boolean;
|
|
197
|
+
errors?: string;
|
|
198
|
+
warnings?: string;
|
|
199
|
+
contents?: Array<{
|
|
200
|
+
type?: string;
|
|
201
|
+
submitted?: string;
|
|
202
|
+
indexed?: string;
|
|
203
|
+
}>;
|
|
204
|
+
raw?: unknown;
|
|
205
|
+
urlCount?: number;
|
|
206
|
+
contentHash?: string;
|
|
207
|
+
schedule?: ScheduleState;
|
|
208
|
+
}
|
|
209
|
+
interface SitemapHistoryResponse {
|
|
210
|
+
path: string | null;
|
|
211
|
+
snapshots: SitemapHistoryRecord[];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Wire-format extension carried under `InspectionHistoryRecord.raw`.
|
|
215
|
+
*
|
|
216
|
+
* Source of truth: D1 `url_indexing_status` (per the 2026-05-19 redesign).
|
|
217
|
+
* Most fields are JSON-encoded TEXT in D1 and surface here unchanged as
|
|
218
|
+
* `string | null`; consumers parse on read.
|
|
219
|
+
*
|
|
220
|
+
* Additional keys are tolerated (`[key: string]: unknown`) for
|
|
221
|
+
* forward-compatibility — new fields can ship without a contract bump.
|
|
222
|
+
*/
|
|
223
|
+
interface InspectionRecordRaw {
|
|
224
|
+
/** Adaptive recheck schedule owned by `inspectionPolicy.observe`. */
|
|
225
|
+
schedule?: ScheduleState;
|
|
226
|
+
/** Unix seconds. Mirrors the `next_check_after` column. */
|
|
227
|
+
nextCheckAfter?: number;
|
|
228
|
+
/** Mirrors the `next_check_priority` column. */
|
|
229
|
+
priority?: 'high' | 'medium' | 'low';
|
|
230
|
+
/** JSON-encoded `string[]` of sitemap URLs containing this URL. */
|
|
231
|
+
sitemaps?: string | null;
|
|
232
|
+
/** JSON-encoded `string[]` of referring URLs Google reported. */
|
|
233
|
+
referringUrls?: string | null;
|
|
234
|
+
/** Crawler that fetched the URL (`Googlebot smartphone` etc.). */
|
|
235
|
+
crawlingUserAgent?: string | null;
|
|
236
|
+
/** JSON-encoded mobile-usability issues. */
|
|
237
|
+
mobileIssues?: string | null;
|
|
238
|
+
/** JSON-encoded rich-results items array. */
|
|
239
|
+
richResultsItems?: string | null;
|
|
240
|
+
/** Deep link into the GSC URL Inspection tool. */
|
|
241
|
+
inspectionResultLink?: string | null;
|
|
242
|
+
[key: string]: unknown;
|
|
243
|
+
}
|
|
244
|
+
interface InspectionHistoryRecord {
|
|
245
|
+
url: string;
|
|
246
|
+
inspectedAt: string;
|
|
247
|
+
indexStatus?: string;
|
|
248
|
+
lastCrawlTime?: string;
|
|
249
|
+
googleCanonical?: string;
|
|
250
|
+
userCanonical?: string;
|
|
251
|
+
coverageState?: string;
|
|
252
|
+
robotsTxtState?: string;
|
|
253
|
+
indexingState?: string;
|
|
254
|
+
pageFetchState?: string;
|
|
255
|
+
mobileUsabilityVerdict?: string;
|
|
256
|
+
richResultsVerdict?: string;
|
|
257
|
+
raw?: InspectionRecordRaw;
|
|
258
|
+
}
|
|
259
|
+
interface InspectionHistoryResponse {
|
|
260
|
+
url: string | null;
|
|
261
|
+
records: InspectionHistoryRecord[];
|
|
262
|
+
}
|
|
263
|
+
interface SitemapIndex {
|
|
264
|
+
version: 1;
|
|
265
|
+
records: Record<string, SitemapHistoryRecord>;
|
|
266
|
+
}
|
|
267
|
+
interface InspectionIndex {
|
|
268
|
+
version: 1;
|
|
269
|
+
records: Record<string, InspectionHistoryRecord>;
|
|
270
|
+
}
|
|
271
|
+
interface RollupEnvelope<T = unknown> {
|
|
272
|
+
version: 1;
|
|
273
|
+
id: string;
|
|
274
|
+
builtAt: number;
|
|
275
|
+
windowDays: number | null;
|
|
276
|
+
payload: T;
|
|
277
|
+
}
|
|
278
|
+
interface GscRowQueryMeta {
|
|
279
|
+
sourceName: string;
|
|
280
|
+
sourceKind: 'row' | 'sql';
|
|
281
|
+
queryMs: number;
|
|
282
|
+
}
|
|
283
|
+
interface GscRowQueryResponse<T = Record<string, unknown>> {
|
|
284
|
+
rows: T[];
|
|
285
|
+
meta: GscRowQueryMeta;
|
|
286
|
+
}
|
|
287
|
+
type IndexingUrlStatus = 'indexed' | 'not_indexed' | 'pending';
|
|
288
|
+
interface IndexingUrlRow {
|
|
289
|
+
url: string;
|
|
290
|
+
verdict: string | null;
|
|
291
|
+
coverageState: string | null;
|
|
292
|
+
indexingState: string | null;
|
|
293
|
+
robotsTxtState: string | null;
|
|
294
|
+
pageFetchState: string | null;
|
|
295
|
+
lastCrawlTime: string | null;
|
|
296
|
+
crawlingUserAgent: string | null;
|
|
297
|
+
userCanonical: string | null;
|
|
298
|
+
googleCanonical: string | null;
|
|
299
|
+
sitemaps: string[] | null;
|
|
300
|
+
referringUrls: string[] | null;
|
|
301
|
+
mobileVerdict: string | null;
|
|
302
|
+
mobileIssues: unknown[] | null;
|
|
303
|
+
richResultsVerdict: string | null;
|
|
304
|
+
richResultsItems: unknown[] | null;
|
|
305
|
+
inspectionResultLink: string | null;
|
|
306
|
+
firstCheckedAt: string;
|
|
307
|
+
lastCheckedAt: string;
|
|
308
|
+
checkCount: number;
|
|
309
|
+
}
|
|
310
|
+
interface IndexingUrlsResponse {
|
|
311
|
+
urls: IndexingUrlRow[];
|
|
312
|
+
pagination: {
|
|
313
|
+
total: number;
|
|
314
|
+
limit: number;
|
|
315
|
+
offset: number;
|
|
316
|
+
hasMore: boolean;
|
|
317
|
+
};
|
|
318
|
+
meta: {
|
|
319
|
+
siteUrl: string;
|
|
320
|
+
status: string;
|
|
321
|
+
issue: string | null;
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
type IndexingIssueSeverity = 'error' | 'warning' | 'info';
|
|
325
|
+
interface IndexingIssue {
|
|
326
|
+
type: string;
|
|
327
|
+
label: string;
|
|
328
|
+
severity: IndexingIssueSeverity;
|
|
329
|
+
count: number;
|
|
330
|
+
}
|
|
331
|
+
interface IndexingDiagnostics {
|
|
332
|
+
summary: {
|
|
333
|
+
totalUrls: number;
|
|
334
|
+
indexed: number;
|
|
335
|
+
indexedPercent: number;
|
|
336
|
+
};
|
|
337
|
+
issues: IndexingIssue[];
|
|
338
|
+
meta: {
|
|
339
|
+
siteUrl: string;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
interface IndexingInspectRequest {
|
|
343
|
+
urls: string[];
|
|
344
|
+
}
|
|
345
|
+
interface IndexingInspectResult {
|
|
346
|
+
url: string;
|
|
347
|
+
verdict: string | null;
|
|
348
|
+
coverageState: string | null;
|
|
349
|
+
indexingState: string | null;
|
|
350
|
+
robotsTxtState: string | null;
|
|
351
|
+
pageFetchState: string | null;
|
|
352
|
+
lastCrawlTime: string | null;
|
|
353
|
+
crawlingUserAgent: string | null;
|
|
354
|
+
userCanonical: string | null;
|
|
355
|
+
googleCanonical: string | null;
|
|
356
|
+
sitemaps: string | null;
|
|
357
|
+
referringUrls: string | null;
|
|
358
|
+
mobileVerdict: string | null;
|
|
359
|
+
mobileIssues: string | null;
|
|
360
|
+
richResultsVerdict: string | null;
|
|
361
|
+
richResultsItems: string | null;
|
|
362
|
+
inspectionResultLink: string | null;
|
|
363
|
+
}
|
|
364
|
+
interface IndexingInspectRateLimit {
|
|
365
|
+
reserved: number;
|
|
366
|
+
remaining: number;
|
|
367
|
+
limit: number;
|
|
368
|
+
}
|
|
369
|
+
interface IndexingInspectResponse {
|
|
370
|
+
siteId: string;
|
|
371
|
+
rateLimit: IndexingInspectRateLimit;
|
|
372
|
+
results: IndexingInspectResult[];
|
|
373
|
+
errors: Array<{
|
|
374
|
+
url: string;
|
|
375
|
+
error: string;
|
|
376
|
+
}>;
|
|
377
|
+
skipped: Array<{
|
|
378
|
+
url: string;
|
|
379
|
+
reason: string;
|
|
380
|
+
}>;
|
|
381
|
+
}
|
|
382
|
+
interface IndexingInspectRateLimited {
|
|
383
|
+
error: 'rate_limited';
|
|
384
|
+
message: string;
|
|
385
|
+
rateLimit: {
|
|
386
|
+
reserved: 0;
|
|
387
|
+
remaining: 0;
|
|
388
|
+
limit: number;
|
|
389
|
+
};
|
|
390
|
+
retryAfterSeconds: number;
|
|
391
|
+
}
|
|
392
|
+
interface SitemapAddedRow {
|
|
393
|
+
url: string;
|
|
394
|
+
sitemap: string;
|
|
395
|
+
firstSeenAt: number;
|
|
396
|
+
}
|
|
397
|
+
interface SitemapRemovedRow {
|
|
398
|
+
url: string;
|
|
399
|
+
sitemap: string;
|
|
400
|
+
removedAt: number;
|
|
401
|
+
}
|
|
402
|
+
interface SitemapChangesResponse {
|
|
403
|
+
added: SitemapAddedRow[];
|
|
404
|
+
removed: SitemapRemovedRow[];
|
|
405
|
+
summary: {
|
|
406
|
+
totalAdded: number;
|
|
407
|
+
totalRemoved: number;
|
|
408
|
+
period: {
|
|
409
|
+
days: number;
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
type AnalysisSourcesResponse = GscdumpAnalysisSourcesResponse;
|
|
414
|
+
interface SourceInfoResponse {
|
|
415
|
+
name: string;
|
|
416
|
+
kind: 'row' | 'sql';
|
|
417
|
+
capabilities: {
|
|
418
|
+
attachedTables?: boolean;
|
|
419
|
+
[k: string]: unknown;
|
|
420
|
+
};
|
|
421
|
+
supportedAnalyzerIds: string[];
|
|
422
|
+
browserAttachEligible: boolean;
|
|
423
|
+
identityAttrs?: Record<string, unknown> | null;
|
|
424
|
+
}
|
|
425
|
+
interface WhoamiResponse {
|
|
426
|
+
userId?: string | null;
|
|
427
|
+
plan?: string | null;
|
|
428
|
+
attrs?: Record<string, unknown>;
|
|
429
|
+
}
|
|
430
|
+
interface BackfillRange {
|
|
431
|
+
startDate: string;
|
|
432
|
+
endDate: string;
|
|
433
|
+
}
|
|
434
|
+
interface BackfillResponse {
|
|
435
|
+
ok?: boolean;
|
|
436
|
+
queued?: boolean;
|
|
437
|
+
[key: string]: unknown;
|
|
438
|
+
}
|
|
439
|
+
interface AnalyticsClient {
|
|
440
|
+
whoami: () => Promise<WhoamiResponse>;
|
|
441
|
+
listSites: () => Promise<SiteListItem[]>;
|
|
442
|
+
getSourceInfo: (siteId: string, options?: SourceInfoOptions) => Promise<SourceInfoResponse>;
|
|
443
|
+
getAnalysisSources: (siteId: string, tables?: string[] | string | AnalysisSourcesOptions, options?: SearchTypeOptions | SourceInfoOptions) => Promise<AnalysisSourcesResponse>;
|
|
444
|
+
analyze: <T = unknown>(siteId: string, params: unknown) => Promise<T>;
|
|
445
|
+
queryRows: <T = Record<string, unknown>>(siteId: string, state: unknown) => Promise<GscRowQueryResponse<T>>;
|
|
446
|
+
getRollup: <T = unknown>(siteId: string, rollupId: string, params?: {
|
|
447
|
+
start?: string;
|
|
448
|
+
end?: string;
|
|
449
|
+
}) => Promise<RollupEnvelope<T>>;
|
|
450
|
+
requestBackfill: (siteId: string, range: BackfillRange) => Promise<BackfillResponse>;
|
|
451
|
+
getSitemaps: (siteId: string) => Promise<SitemapIndex>;
|
|
452
|
+
getSitemapHistory: (siteId: string, hash: string) => Promise<SitemapHistoryResponse>;
|
|
453
|
+
getSitemapChanges: (siteId: string, params?: {
|
|
454
|
+
days?: number;
|
|
455
|
+
}) => Promise<SitemapChangesResponse>;
|
|
456
|
+
getInspections: (siteId: string) => Promise<InspectionIndex>;
|
|
457
|
+
getInspectionHistory: (siteId: string, hash: string) => Promise<InspectionHistoryResponse>;
|
|
458
|
+
getIndexingUrls: (siteId: string, params?: {
|
|
459
|
+
limit?: number;
|
|
460
|
+
offset?: number;
|
|
461
|
+
status?: IndexingUrlStatus;
|
|
462
|
+
issue?: string;
|
|
463
|
+
search?: string;
|
|
464
|
+
}) => Promise<IndexingUrlsResponse>;
|
|
465
|
+
getIndexingDiagnostics: (siteId: string) => Promise<IndexingDiagnostics>;
|
|
466
|
+
requestIndexingInspect: (siteId: string, body: IndexingInspectRequest) => Promise<IndexingInspectResponse | IndexingInspectRateLimited>;
|
|
467
|
+
getCountries: (siteId: string, range: {
|
|
468
|
+
start: string;
|
|
469
|
+
end: string;
|
|
470
|
+
}) => Promise<CountriesResponse>;
|
|
471
|
+
getSearchAppearance: (siteId: string, range: {
|
|
472
|
+
start: string;
|
|
473
|
+
end: string;
|
|
474
|
+
}) => Promise<SearchAppearanceResponse>;
|
|
475
|
+
}
|
|
476
|
+
type GscComparisonFilter = 'new' | 'lost' | 'improving' | 'declining';
|
|
477
|
+
interface GscdumpDataRow {
|
|
478
|
+
page?: string;
|
|
479
|
+
query?: string;
|
|
480
|
+
queryCanonical?: string;
|
|
481
|
+
country?: string;
|
|
482
|
+
device?: string;
|
|
483
|
+
date?: string;
|
|
484
|
+
clicks: number;
|
|
485
|
+
impressions: number;
|
|
486
|
+
ctr: number;
|
|
487
|
+
position: number;
|
|
488
|
+
prevClicks?: number;
|
|
489
|
+
prevImpressions?: number;
|
|
490
|
+
prevCtr?: number;
|
|
491
|
+
prevPosition?: number;
|
|
492
|
+
topKeyword?: string;
|
|
493
|
+
topPage?: string;
|
|
494
|
+
variantCount?: number;
|
|
495
|
+
variants?: Array<{
|
|
496
|
+
query: string;
|
|
497
|
+
clicks: number;
|
|
498
|
+
impressions: number;
|
|
499
|
+
position: number;
|
|
500
|
+
}>;
|
|
501
|
+
difficulty?: number;
|
|
502
|
+
searchVolume?: number;
|
|
503
|
+
cpc?: number;
|
|
504
|
+
firstDate?: string;
|
|
505
|
+
lastDate?: string;
|
|
506
|
+
}
|
|
507
|
+
interface GscdumpMeta {
|
|
508
|
+
siteUrl: string;
|
|
509
|
+
syncStatus: string;
|
|
510
|
+
newestDateSynced: string | null;
|
|
511
|
+
oldestDateSynced: string | null;
|
|
512
|
+
dataDelay: string;
|
|
513
|
+
dataEndDate?: string | null;
|
|
514
|
+
warnings?: string[];
|
|
515
|
+
enrichment?: {
|
|
516
|
+
lastEnriched: number;
|
|
517
|
+
isDue: boolean;
|
|
518
|
+
};
|
|
519
|
+
backfill?: {
|
|
520
|
+
percent: number;
|
|
521
|
+
daysRemaining?: number;
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
interface GscdumpTotals {
|
|
525
|
+
clicks: number;
|
|
526
|
+
impressions: number;
|
|
527
|
+
ctr: number;
|
|
528
|
+
position: number;
|
|
529
|
+
}
|
|
530
|
+
interface GscdumpDataResponse {
|
|
531
|
+
rows: GscdumpDataRow[];
|
|
532
|
+
totalCount: number;
|
|
533
|
+
totals: GscdumpTotals;
|
|
534
|
+
meta: GscdumpMeta;
|
|
535
|
+
}
|
|
536
|
+
interface GscdumpDataDetailResponse {
|
|
537
|
+
daily: Array<{
|
|
538
|
+
date: string;
|
|
539
|
+
clicks: number;
|
|
540
|
+
impressions: number;
|
|
541
|
+
ctr: number;
|
|
542
|
+
position: number;
|
|
543
|
+
}>;
|
|
544
|
+
totals: GscdumpTotals;
|
|
545
|
+
previousTotals?: GscdumpTotals;
|
|
546
|
+
meta: GscdumpMeta;
|
|
547
|
+
}
|
|
548
|
+
interface GscdumpUserRegistration {
|
|
549
|
+
userId: string;
|
|
550
|
+
apiKey?: string;
|
|
551
|
+
isNew?: boolean;
|
|
552
|
+
status?: 'provisioning' | 'ready';
|
|
553
|
+
}
|
|
554
|
+
interface GscdumpUserStatus {
|
|
555
|
+
userId: string;
|
|
556
|
+
status: 'provisioning' | 'ready' | 'reauth_required';
|
|
557
|
+
databaseReady?: boolean;
|
|
558
|
+
needsReauth?: boolean;
|
|
559
|
+
reauthRequired?: boolean;
|
|
560
|
+
reauthReason?: string | null;
|
|
561
|
+
authFailureCount?: number;
|
|
562
|
+
nextAction?: 'reconnect_google' | 'none';
|
|
563
|
+
grantedScopes?: string | null;
|
|
564
|
+
}
|
|
565
|
+
interface GscdumpUserTokenUpdate {
|
|
566
|
+
userId: string;
|
|
567
|
+
updated: boolean;
|
|
568
|
+
sites: GscdumpAvailableSite[];
|
|
569
|
+
}
|
|
570
|
+
interface GscdumpAvailableSite {
|
|
571
|
+
siteUrl: string;
|
|
572
|
+
permissionLevel: string;
|
|
573
|
+
registered: boolean;
|
|
574
|
+
siteId?: string;
|
|
575
|
+
syncStatus?: 'pending' | 'syncing' | 'synced' | 'error';
|
|
576
|
+
syncProgress?: {
|
|
577
|
+
completed: number;
|
|
578
|
+
failed?: number;
|
|
579
|
+
total: number;
|
|
580
|
+
percent: number;
|
|
581
|
+
};
|
|
582
|
+
lastSyncAt?: number | null;
|
|
583
|
+
newestDateSynced?: string | null;
|
|
584
|
+
oldestDateSynced?: string | null;
|
|
585
|
+
}
|
|
586
|
+
interface GscdumpSiteRegistration {
|
|
587
|
+
siteId: string;
|
|
588
|
+
status: 'idle' | 'pending' | 'syncing' | 'synced' | 'error';
|
|
589
|
+
message?: string;
|
|
590
|
+
existing?: boolean;
|
|
591
|
+
indexingEligible?: boolean;
|
|
592
|
+
indexingIneligibleReason?: 'missing_indexing_scope' | 'insufficient_gsc_permission';
|
|
593
|
+
indexingPermissionLevel?: string | null;
|
|
594
|
+
grantedScopes?: string[];
|
|
595
|
+
}
|
|
596
|
+
interface GscdumpUserSite {
|
|
597
|
+
siteId: string;
|
|
598
|
+
siteUrl: string;
|
|
599
|
+
analyticsSyncStatus?: 'idle' | 'pending' | 'syncing' | 'synced' | 'error';
|
|
600
|
+
analyticsSyncProgress?: {
|
|
601
|
+
completed: number;
|
|
602
|
+
failed?: number;
|
|
603
|
+
total: number;
|
|
604
|
+
percent: number;
|
|
605
|
+
};
|
|
606
|
+
syncStatus: 'idle' | 'pending' | 'syncing' | 'synced' | 'error';
|
|
607
|
+
syncProgress?: {
|
|
608
|
+
completed: number;
|
|
609
|
+
failed?: number;
|
|
610
|
+
total: number;
|
|
611
|
+
percent: number;
|
|
612
|
+
};
|
|
613
|
+
indexingEligible?: boolean;
|
|
614
|
+
indexingIneligibleReason?: 'missing_indexing_scope' | 'insufficient_gsc_permission';
|
|
615
|
+
indexingPermissionLevel?: string | null;
|
|
616
|
+
grantedScopes?: string[];
|
|
617
|
+
indexingStatus?: 'not_started' | 'indexing' | 'complete';
|
|
618
|
+
indexingProgress?: {
|
|
619
|
+
completed: number;
|
|
620
|
+
failed?: number;
|
|
621
|
+
total: number;
|
|
622
|
+
percent: number;
|
|
623
|
+
};
|
|
624
|
+
indexingUrl?: string;
|
|
625
|
+
lastSyncAt: number | null;
|
|
626
|
+
newestDateSynced: string | null;
|
|
627
|
+
oldestDateSynced: string | null;
|
|
628
|
+
}
|
|
629
|
+
interface GscdumpSyncStatusResponse {
|
|
630
|
+
siteUrl: string;
|
|
631
|
+
syncStatus: 'pending' | 'syncing' | 'synced' | 'error';
|
|
632
|
+
oldestDateAvailable: string | null;
|
|
633
|
+
oldestDateSynced: string | null;
|
|
634
|
+
newestDateSynced: string | null;
|
|
635
|
+
lastSyncAt: number | null;
|
|
636
|
+
lastError: string | null;
|
|
637
|
+
jobs: {
|
|
638
|
+
queued: number;
|
|
639
|
+
processing: number;
|
|
640
|
+
completed: number;
|
|
641
|
+
failed: number;
|
|
642
|
+
};
|
|
643
|
+
progress: number;
|
|
644
|
+
jobProgress: number;
|
|
645
|
+
daysSynced: number;
|
|
646
|
+
daysAvailable: number;
|
|
647
|
+
isSyncing: boolean;
|
|
648
|
+
hasData: boolean;
|
|
649
|
+
isComplete: boolean;
|
|
650
|
+
tables: Record<string, {
|
|
651
|
+
queued: number;
|
|
652
|
+
processing: number;
|
|
653
|
+
completed: number;
|
|
654
|
+
failed: number;
|
|
655
|
+
totalRows: number;
|
|
656
|
+
}>;
|
|
657
|
+
days?: Record<string, {
|
|
658
|
+
tables: Record<string, {
|
|
659
|
+
status: string;
|
|
660
|
+
rowsFetched: number;
|
|
661
|
+
rowsInserted: number;
|
|
662
|
+
error: string | null;
|
|
663
|
+
}>;
|
|
664
|
+
}>;
|
|
665
|
+
failedJobs?: Array<{
|
|
666
|
+
date: string;
|
|
667
|
+
tableName: string;
|
|
668
|
+
error: string;
|
|
669
|
+
retryCount: number;
|
|
670
|
+
}>;
|
|
671
|
+
}
|
|
672
|
+
interface GscdumpSitemap {
|
|
673
|
+
path: string;
|
|
674
|
+
errors: number;
|
|
675
|
+
warnings: number;
|
|
676
|
+
urlCount: number;
|
|
677
|
+
isIndex: boolean;
|
|
678
|
+
contentHash: string | null;
|
|
679
|
+
lastDownloaded: string | null;
|
|
680
|
+
lastError: string | null;
|
|
681
|
+
isPending: boolean;
|
|
682
|
+
fetchedAt: number;
|
|
683
|
+
}
|
|
684
|
+
interface GscdumpSitemapHistory {
|
|
685
|
+
date: string;
|
|
686
|
+
errors: number;
|
|
687
|
+
warnings: number;
|
|
688
|
+
urlCount: number;
|
|
689
|
+
urlDelta: number;
|
|
690
|
+
}
|
|
691
|
+
interface GscdumpPerSitemapHistoryEntry {
|
|
692
|
+
date: string;
|
|
693
|
+
urlCount: number;
|
|
694
|
+
changed: boolean;
|
|
695
|
+
urlDelta: number;
|
|
696
|
+
}
|
|
697
|
+
interface GscdumpSitemapsResponse {
|
|
698
|
+
sitemaps: GscdumpSitemap[];
|
|
699
|
+
history: GscdumpSitemapHistory[];
|
|
700
|
+
perSitemapHistory: Record<string, GscdumpPerSitemapHistoryEntry[]>;
|
|
701
|
+
meta: {
|
|
702
|
+
siteUrl: string;
|
|
703
|
+
gscPropertyUrl?: string;
|
|
704
|
+
syncStatus: string | null;
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
interface GscdumpSitemapChangesResponse {
|
|
708
|
+
added: {
|
|
709
|
+
url: string;
|
|
710
|
+
sitemap: string;
|
|
711
|
+
firstSeenAt: number;
|
|
712
|
+
}[];
|
|
713
|
+
removed: {
|
|
714
|
+
url: string;
|
|
715
|
+
sitemap: string;
|
|
716
|
+
removedAt: number;
|
|
717
|
+
}[];
|
|
718
|
+
summary?: {
|
|
719
|
+
totalAdded: number;
|
|
720
|
+
totalRemoved: number;
|
|
721
|
+
period: {
|
|
722
|
+
days: number;
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
interface GscdumpIndexingTrendPoint {
|
|
727
|
+
date: string;
|
|
728
|
+
totalUrls: number;
|
|
729
|
+
indexedCount: number | null;
|
|
730
|
+
notIndexedCount: number | null;
|
|
731
|
+
errorCount: number | null;
|
|
732
|
+
indexedPercent: number;
|
|
733
|
+
issues: {
|
|
734
|
+
blockedByRobots: number | null;
|
|
735
|
+
noindexDetected: number | null;
|
|
736
|
+
soft404: number | null;
|
|
737
|
+
redirect: number | null;
|
|
738
|
+
notFound: number | null;
|
|
739
|
+
serverError: number | null;
|
|
740
|
+
};
|
|
741
|
+
coverage: {
|
|
742
|
+
submittedIndexed: number | null;
|
|
743
|
+
crawledNotIndexed: number | null;
|
|
744
|
+
discoveredNotCrawled: number | null;
|
|
745
|
+
};
|
|
746
|
+
signals: {
|
|
747
|
+
mobilePass: number;
|
|
748
|
+
mobileFail: number;
|
|
749
|
+
richResultsPass: number;
|
|
750
|
+
richResultsFail: number;
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
interface GscdumpIndexingResponse {
|
|
754
|
+
trend: GscdumpIndexingTrendPoint[];
|
|
755
|
+
summary: {
|
|
756
|
+
totalUrls: number;
|
|
757
|
+
indexed: number;
|
|
758
|
+
notIndexed: number;
|
|
759
|
+
pending: number;
|
|
760
|
+
indexedPercent: number;
|
|
761
|
+
oldestCheck: string | null;
|
|
762
|
+
newestCheck: string | null;
|
|
763
|
+
change7d: number | null;
|
|
764
|
+
change28d: number | null;
|
|
765
|
+
signals: {
|
|
766
|
+
mobilePass: number;
|
|
767
|
+
mobileFail: number;
|
|
768
|
+
mobileUnspecified: number;
|
|
769
|
+
richResultsPass: number;
|
|
770
|
+
richResultsFail: number;
|
|
771
|
+
richResultTypes: Array<{
|
|
772
|
+
type: string;
|
|
773
|
+
count: number;
|
|
774
|
+
}>;
|
|
775
|
+
crawlingMobile: number;
|
|
776
|
+
crawlingDesktop: number;
|
|
777
|
+
};
|
|
778
|
+
};
|
|
779
|
+
meta: {
|
|
780
|
+
siteUrl: string;
|
|
781
|
+
syncStatus: string | null;
|
|
782
|
+
indexingStatus: 'pending' | 'partial' | 'complete';
|
|
783
|
+
indexingProgress: number;
|
|
784
|
+
sitemapTotal: number;
|
|
785
|
+
inspectedCount: number;
|
|
786
|
+
noSitemapsSubmitted: boolean;
|
|
787
|
+
sitemapsPending: boolean;
|
|
788
|
+
rollupBuiltAt?: number;
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
type GscdumpIndexingUrlStatus = 'indexed' | 'not_indexed' | 'pending';
|
|
792
|
+
type GscdumpIndexingIssueSeverity = 'error' | 'warning' | 'info';
|
|
793
|
+
interface GscdumpRichResultItem {
|
|
794
|
+
richResultType: string;
|
|
795
|
+
items?: unknown[];
|
|
796
|
+
}
|
|
797
|
+
interface GscdumpIndexingUrl {
|
|
798
|
+
url: string;
|
|
799
|
+
verdict: string | null;
|
|
800
|
+
coverageState: string | null;
|
|
801
|
+
indexingState: string | null;
|
|
802
|
+
robotsTxtState?: string | null;
|
|
803
|
+
pageFetchState?: string | null;
|
|
804
|
+
lastCrawlTime: string | null;
|
|
805
|
+
crawlingUserAgent?: string | null;
|
|
806
|
+
userCanonical?: string | null;
|
|
807
|
+
googleCanonical?: string | null;
|
|
808
|
+
sitemaps?: string[] | null;
|
|
809
|
+
referringUrls?: string[] | null;
|
|
810
|
+
mobileVerdict?: string | null;
|
|
811
|
+
mobileIssues?: string[] | null;
|
|
812
|
+
richResultsVerdict?: string | null;
|
|
813
|
+
richResultsItems?: GscdumpRichResultItem[] | null;
|
|
814
|
+
inspectionResultLink?: string | null;
|
|
815
|
+
firstCheckedAt: string;
|
|
816
|
+
lastCheckedAt: string;
|
|
817
|
+
checkCount?: number;
|
|
818
|
+
}
|
|
819
|
+
interface GscdumpIndexingUrlsResponse {
|
|
820
|
+
urls: GscdumpIndexingUrl[];
|
|
821
|
+
pagination: {
|
|
822
|
+
total: number;
|
|
823
|
+
limit: number;
|
|
824
|
+
offset: number;
|
|
825
|
+
hasMore: boolean;
|
|
826
|
+
};
|
|
827
|
+
meta: {
|
|
828
|
+
siteUrl: string;
|
|
829
|
+
gscPropertyUrl?: string;
|
|
830
|
+
status: string;
|
|
831
|
+
issue: string | null;
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
interface GscdumpIndexingDiagnosticsResponse {
|
|
835
|
+
summary: {
|
|
836
|
+
totalUrls: number;
|
|
837
|
+
indexed: number;
|
|
838
|
+
indexedPercent: number;
|
|
839
|
+
};
|
|
840
|
+
issues: {
|
|
841
|
+
type: string;
|
|
842
|
+
label: string;
|
|
843
|
+
severity: GscdumpIndexingIssueSeverity;
|
|
844
|
+
count: number;
|
|
845
|
+
}[];
|
|
846
|
+
meta: {
|
|
847
|
+
siteUrl: string;
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
type GscdumpIndexingInspectRequest = IndexingInspectRequest;
|
|
851
|
+
type GscdumpIndexingInspectResult = IndexingInspectResult;
|
|
852
|
+
type GscdumpIndexingInspectResponse = IndexingInspectResponse;
|
|
853
|
+
type GscdumpIndexingInspectRateLimited = IndexingInspectRateLimited;
|
|
854
|
+
type GscdumpAnalysisPreset = 'striking-distance' | 'opportunity' | 'decay' | 'zero-click' | 'non-brand' | 'brand-only' | 'movers-rising' | 'movers-declining';
|
|
855
|
+
interface GscdumpAnalysisParams {
|
|
856
|
+
preset: GscdumpAnalysisPreset;
|
|
857
|
+
startDate: string;
|
|
858
|
+
endDate: string;
|
|
859
|
+
prevStartDate?: string;
|
|
860
|
+
prevEndDate?: string;
|
|
861
|
+
brandTerms?: string;
|
|
862
|
+
limit?: number;
|
|
863
|
+
offset?: number;
|
|
864
|
+
search?: string;
|
|
865
|
+
minImpressions?: number;
|
|
866
|
+
minPosition?: number;
|
|
867
|
+
maxPosition?: number;
|
|
868
|
+
maxCtr?: number;
|
|
869
|
+
searchType?: GscSearchType;
|
|
870
|
+
}
|
|
871
|
+
interface GscdumpAnalysisResponse {
|
|
872
|
+
preset: GscdumpAnalysisPreset;
|
|
873
|
+
keywords: Array<Record<string, unknown>>;
|
|
874
|
+
totalCount: number;
|
|
875
|
+
summary?: Record<string, unknown>;
|
|
876
|
+
meta: GscdumpMeta;
|
|
877
|
+
}
|
|
878
|
+
interface RegisterPartnerUserParams {
|
|
879
|
+
userGoogleId: string;
|
|
880
|
+
userEmail: string;
|
|
881
|
+
userName?: string;
|
|
882
|
+
accessToken: string;
|
|
883
|
+
refreshToken: string;
|
|
884
|
+
tokenExpiresAt?: number;
|
|
885
|
+
}
|
|
886
|
+
interface UpdatePartnerUserTokensParams {
|
|
887
|
+
accessToken: string;
|
|
888
|
+
refreshToken: string;
|
|
889
|
+
tokenExpiresAt?: number;
|
|
890
|
+
}
|
|
891
|
+
interface RegisterPartnerSiteParams {
|
|
892
|
+
userId: string;
|
|
893
|
+
siteUrl: string;
|
|
894
|
+
requestedUrl?: string;
|
|
895
|
+
gscPropertyUrl?: string;
|
|
896
|
+
externalSiteId?: string;
|
|
897
|
+
externalSiteUrl?: string;
|
|
898
|
+
webhookUrl?: string;
|
|
899
|
+
webhookEvents?: WebhookEventType[];
|
|
900
|
+
teamId?: string;
|
|
901
|
+
}
|
|
902
|
+
interface BulkRegisterPartnerSitesParams {
|
|
903
|
+
userId?: string;
|
|
904
|
+
siteUrls?: string[];
|
|
905
|
+
sites?: Array<{
|
|
906
|
+
siteUrl?: string;
|
|
907
|
+
requestedUrl?: string;
|
|
908
|
+
gscPropertyUrl?: string;
|
|
909
|
+
externalSiteId?: string;
|
|
910
|
+
externalSiteUrl?: string;
|
|
911
|
+
webhookUrl?: string;
|
|
912
|
+
webhookEvents?: WebhookEventType[];
|
|
913
|
+
}>;
|
|
914
|
+
}
|
|
915
|
+
interface BulkRegisterPartnerSiteResult {
|
|
916
|
+
siteUrl: string;
|
|
917
|
+
siteId?: string;
|
|
918
|
+
status: 'registered' | 'already_exists' | 'not_found' | 'error';
|
|
919
|
+
error?: string;
|
|
920
|
+
site?: PartnerLifecycleSite | null;
|
|
921
|
+
indexingEligible?: boolean;
|
|
922
|
+
indexingIneligibleReason?: 'missing_indexing_scope' | 'insufficient_gsc_permission';
|
|
923
|
+
indexingPermissionLevel?: string | null;
|
|
924
|
+
grantedScopes?: string[];
|
|
925
|
+
}
|
|
926
|
+
interface BulkRegisterPartnerSitesResponse {
|
|
927
|
+
results: BulkRegisterPartnerSiteResult[];
|
|
928
|
+
summary: {
|
|
929
|
+
registered: number;
|
|
930
|
+
alreadyExists: number;
|
|
931
|
+
notFound: number;
|
|
932
|
+
errors: number;
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
interface DeletePartnerUserResponse {
|
|
936
|
+
ok: true;
|
|
937
|
+
queued: true;
|
|
938
|
+
userId: number;
|
|
939
|
+
publicId: string;
|
|
940
|
+
}
|
|
941
|
+
interface GscdumpAnalysisSourcesResponse {
|
|
942
|
+
tables: Record<string, string[]>;
|
|
943
|
+
generatedAt: string;
|
|
944
|
+
manifestVersion: string;
|
|
945
|
+
searchType?: GscSearchType;
|
|
946
|
+
canUseBrowser?: boolean;
|
|
947
|
+
fallback?: string;
|
|
948
|
+
reason?: string;
|
|
949
|
+
estimatedBytes?: number;
|
|
950
|
+
estimatedFiles?: number;
|
|
951
|
+
coveragePlan?: unknown;
|
|
952
|
+
}
|
|
953
|
+
interface SearchTypeOptions {
|
|
954
|
+
searchType?: GscSearchType;
|
|
955
|
+
}
|
|
956
|
+
interface SourceInfoOptions extends SearchTypeOptions {
|
|
957
|
+
start?: string;
|
|
958
|
+
end?: string;
|
|
959
|
+
startDate?: string;
|
|
960
|
+
endDate?: string;
|
|
961
|
+
}
|
|
962
|
+
interface AnalysisSourcesOptions extends SearchTypeOptions {
|
|
963
|
+
tables?: string[] | string;
|
|
964
|
+
start?: string;
|
|
965
|
+
end?: string;
|
|
966
|
+
startDate?: string;
|
|
967
|
+
endDate?: string;
|
|
968
|
+
}
|
|
969
|
+
interface DataQueryOptions {
|
|
970
|
+
comparison?: BuilderState;
|
|
971
|
+
filter?: GscComparisonFilter;
|
|
972
|
+
searchType?: GscSearchType;
|
|
973
|
+
}
|
|
974
|
+
interface DataDetailOptions {
|
|
975
|
+
comparison?: BuilderState;
|
|
976
|
+
searchType?: GscSearchType;
|
|
977
|
+
}
|
|
978
|
+
interface IndexingUrlsParams {
|
|
979
|
+
limit?: number;
|
|
980
|
+
offset?: number;
|
|
981
|
+
status?: GscdumpIndexingUrlStatus;
|
|
982
|
+
issue?: string;
|
|
983
|
+
search?: string;
|
|
984
|
+
}
|
|
985
|
+
interface GscdumpUserSettings {
|
|
986
|
+
browserAnalyzerEnabled: boolean;
|
|
987
|
+
}
|
|
988
|
+
interface GscdumpPermissionRecovery {
|
|
989
|
+
success: boolean;
|
|
990
|
+
permissionLevel: string | null;
|
|
991
|
+
jobsQueued: number;
|
|
992
|
+
message: string;
|
|
993
|
+
}
|
|
994
|
+
interface GscdumpTopAssociationParams {
|
|
995
|
+
type: 'topPage' | 'topKeyword';
|
|
996
|
+
identifier: string;
|
|
997
|
+
startDate: string;
|
|
998
|
+
endDate: string;
|
|
999
|
+
}
|
|
1000
|
+
interface GscdumpTopAssociationResponse {
|
|
1001
|
+
value: string | null;
|
|
1002
|
+
}
|
|
1003
|
+
interface GscdumpKeywordSparklinesParams {
|
|
1004
|
+
keywords: string[];
|
|
1005
|
+
startDate: string;
|
|
1006
|
+
endDate: string;
|
|
1007
|
+
searchType?: GscSearchType;
|
|
1008
|
+
}
|
|
1009
|
+
interface GscdumpKeywordSparklinesResponse {
|
|
1010
|
+
sparklines: Record<string, number[]>;
|
|
1011
|
+
}
|
|
1012
|
+
interface GscdumpQueryTrendParams {
|
|
1013
|
+
startDate: string;
|
|
1014
|
+
endDate: string;
|
|
1015
|
+
prevStartDate?: string;
|
|
1016
|
+
prevEndDate?: string;
|
|
1017
|
+
searchType?: GscSearchType;
|
|
1018
|
+
}
|
|
1019
|
+
interface GscdumpQueryTrendResponse {
|
|
1020
|
+
daily: Array<{
|
|
1021
|
+
date: string;
|
|
1022
|
+
queryCount: number;
|
|
1023
|
+
}>;
|
|
1024
|
+
total: number;
|
|
1025
|
+
previousTotal?: number;
|
|
1026
|
+
meta: {
|
|
1027
|
+
siteUrl: string;
|
|
1028
|
+
syncStatus: string | null;
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
interface GscdumpPageTrendParams {
|
|
1032
|
+
startDate: string;
|
|
1033
|
+
endDate: string;
|
|
1034
|
+
prevStartDate?: string;
|
|
1035
|
+
prevEndDate?: string;
|
|
1036
|
+
searchType?: GscSearchType;
|
|
1037
|
+
}
|
|
1038
|
+
interface GscdumpPageTrendResponse {
|
|
1039
|
+
daily: Array<{
|
|
1040
|
+
date: string;
|
|
1041
|
+
pageCount: number;
|
|
1042
|
+
}>;
|
|
1043
|
+
total: number;
|
|
1044
|
+
previousTotal?: number;
|
|
1045
|
+
meta: {
|
|
1046
|
+
siteUrl: string;
|
|
1047
|
+
syncStatus: string | null;
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
interface GscdumpDateRangeParams {
|
|
1051
|
+
startDate: string;
|
|
1052
|
+
endDate: string;
|
|
1053
|
+
}
|
|
1054
|
+
interface GscdumpCanonicalMismatchRow {
|
|
1055
|
+
url: string;
|
|
1056
|
+
userCanonical: string;
|
|
1057
|
+
googleCanonical: string;
|
|
1058
|
+
verdict: string | null;
|
|
1059
|
+
coverageState: string | null;
|
|
1060
|
+
lastCrawlTime: string | null;
|
|
1061
|
+
lastCheckedAt: string | null;
|
|
1062
|
+
}
|
|
1063
|
+
interface GscdumpCanonicalMismatchesResponse {
|
|
1064
|
+
mismatches: GscdumpCanonicalMismatchRow[];
|
|
1065
|
+
totalCount: number;
|
|
1066
|
+
consolidationTargets: Array<{
|
|
1067
|
+
google_canonical: string;
|
|
1068
|
+
count: number;
|
|
1069
|
+
}>;
|
|
1070
|
+
trend: Array<{
|
|
1071
|
+
date: string;
|
|
1072
|
+
count: number;
|
|
1073
|
+
}>;
|
|
1074
|
+
meta: {
|
|
1075
|
+
siteUrl: string;
|
|
1076
|
+
syncStatus: string | null;
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
interface GscdumpIndexPercentTrendPoint {
|
|
1080
|
+
date: string;
|
|
1081
|
+
percent: number;
|
|
1082
|
+
total: number;
|
|
1083
|
+
visible: number;
|
|
1084
|
+
added: number | null;
|
|
1085
|
+
removed: number | null;
|
|
1086
|
+
}
|
|
1087
|
+
interface GscdumpInvisibleUrlRow {
|
|
1088
|
+
url: string;
|
|
1089
|
+
firstSeen?: string;
|
|
1090
|
+
lastmod: string | null;
|
|
1091
|
+
}
|
|
1092
|
+
interface GscdumpOrphanPageRow {
|
|
1093
|
+
url: string;
|
|
1094
|
+
impressions: number | null;
|
|
1095
|
+
clicks: number | null;
|
|
1096
|
+
}
|
|
1097
|
+
interface GscdumpIndexPercentSitemap {
|
|
1098
|
+
path: string;
|
|
1099
|
+
urlCount: number;
|
|
1100
|
+
isIndex: boolean;
|
|
1101
|
+
}
|
|
1102
|
+
interface GscdumpIndexPercentResponse {
|
|
1103
|
+
trend: GscdumpIndexPercentTrendPoint[];
|
|
1104
|
+
invisibleUrls: GscdumpInvisibleUrlRow[];
|
|
1105
|
+
invisibleCount: number;
|
|
1106
|
+
orphanPages: GscdumpOrphanPageRow[];
|
|
1107
|
+
orphanCount: number;
|
|
1108
|
+
sitemaps: GscdumpIndexPercentSitemap[];
|
|
1109
|
+
summary: {
|
|
1110
|
+
currentPercent: number;
|
|
1111
|
+
totalSitemapUrls: number;
|
|
1112
|
+
visibleUrls: number;
|
|
1113
|
+
change7d: number | null;
|
|
1114
|
+
change28d: number | null;
|
|
1115
|
+
dataDate: string;
|
|
1116
|
+
};
|
|
1117
|
+
meta: {
|
|
1118
|
+
siteUrl: string;
|
|
1119
|
+
syncStatus: string | null;
|
|
1120
|
+
newestDateSynced: string | null;
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
interface GscdumpUserMeResponse {
|
|
1124
|
+
id: string;
|
|
1125
|
+
name?: string;
|
|
1126
|
+
email: string;
|
|
1127
|
+
picture?: string;
|
|
1128
|
+
setupComplete: boolean;
|
|
1129
|
+
databaseReady: boolean;
|
|
1130
|
+
plan: string;
|
|
1131
|
+
accountStatus: AccountStatus;
|
|
1132
|
+
accountNextAction: AccountNextAction;
|
|
1133
|
+
missingScopes: string[];
|
|
1134
|
+
browserAnalyzerEnabled: boolean;
|
|
1135
|
+
stats: {
|
|
1136
|
+
activeSessions: number;
|
|
1137
|
+
totalApiCalls: number;
|
|
1138
|
+
lastUsed: number | null;
|
|
1139
|
+
} | null;
|
|
1140
|
+
}
|
|
1141
|
+
interface GscdumpHealthResponse {
|
|
1142
|
+
timestamp: number;
|
|
1143
|
+
jobs: {
|
|
1144
|
+
byStatus: Record<string, number>;
|
|
1145
|
+
byQueue: Record<string, number>;
|
|
1146
|
+
stuck: number;
|
|
1147
|
+
oldCompleted: number;
|
|
1148
|
+
};
|
|
1149
|
+
failures: {
|
|
1150
|
+
lastHour: number;
|
|
1151
|
+
};
|
|
1152
|
+
users: {
|
|
1153
|
+
needsReauth: number;
|
|
1154
|
+
};
|
|
1155
|
+
throughput: {
|
|
1156
|
+
completedLastHour: number;
|
|
1157
|
+
};
|
|
1158
|
+
totals: {
|
|
1159
|
+
users: number;
|
|
1160
|
+
sites: number;
|
|
1161
|
+
byPlan: Record<string, number>;
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
interface GscdumpSyncProgressDateStatus {
|
|
1165
|
+
date: string;
|
|
1166
|
+
status: 'completed' | 'queued' | 'processing' | 'failed';
|
|
1167
|
+
}
|
|
1168
|
+
interface GscdumpSyncProgressPhaseCounts {
|
|
1169
|
+
total: number;
|
|
1170
|
+
done: number;
|
|
1171
|
+
pending: number;
|
|
1172
|
+
stuck: number;
|
|
1173
|
+
failed: number;
|
|
1174
|
+
percent: number;
|
|
1175
|
+
rows: number;
|
|
1176
|
+
}
|
|
1177
|
+
interface GscdumpSyncProgressSite {
|
|
1178
|
+
id: string;
|
|
1179
|
+
userId: number;
|
|
1180
|
+
partnerId: number | null;
|
|
1181
|
+
siteUrl: string;
|
|
1182
|
+
syncStatus: string | null;
|
|
1183
|
+
lastError: string | null;
|
|
1184
|
+
createdAt: number;
|
|
1185
|
+
oldestDateSynced: string | null;
|
|
1186
|
+
newestDateSynced: string | null;
|
|
1187
|
+
oldestDateAvailable: string | null;
|
|
1188
|
+
userEmail: string | null;
|
|
1189
|
+
partnerName: string | null;
|
|
1190
|
+
needsReauth: boolean;
|
|
1191
|
+
authFailureCount: number;
|
|
1192
|
+
currentPhase: 'initial' | 'backfill' | 'complete';
|
|
1193
|
+
isStalled: boolean;
|
|
1194
|
+
stallDays: number;
|
|
1195
|
+
needsContinuation: boolean;
|
|
1196
|
+
missingDays: number;
|
|
1197
|
+
initial: GscdumpSyncProgressPhaseCounts;
|
|
1198
|
+
backfill: GscdumpSyncProgressPhaseCounts & {
|
|
1199
|
+
processing: number;
|
|
1200
|
+
daysTarget: number;
|
|
1201
|
+
daysQueued: number;
|
|
1202
|
+
};
|
|
1203
|
+
tables: Record<string, {
|
|
1204
|
+
percent: number;
|
|
1205
|
+
rows: number;
|
|
1206
|
+
}>;
|
|
1207
|
+
overallPercent: number;
|
|
1208
|
+
totalRows: number;
|
|
1209
|
+
dateStatuses: GscdumpSyncProgressDateStatus[];
|
|
1210
|
+
}
|
|
1211
|
+
interface GscdumpSyncProgressResponse {
|
|
1212
|
+
summary: {
|
|
1213
|
+
total: number;
|
|
1214
|
+
inInitial: number;
|
|
1215
|
+
inBackfill: number;
|
|
1216
|
+
complete: number;
|
|
1217
|
+
stalled: number;
|
|
1218
|
+
authBlocked: number;
|
|
1219
|
+
totalRows: number;
|
|
1220
|
+
avgInitialPercent: number;
|
|
1221
|
+
avgBackfillPercent: number;
|
|
1222
|
+
};
|
|
1223
|
+
sites: GscdumpSyncProgressSite[];
|
|
1224
|
+
pagination: {
|
|
1225
|
+
total: number;
|
|
1226
|
+
limit: number;
|
|
1227
|
+
offset: number;
|
|
1228
|
+
hasMore: boolean;
|
|
1229
|
+
};
|
|
1230
|
+
hasD1Stats: boolean;
|
|
1231
|
+
}
|
|
1232
|
+
type GscdumpSyncJobStatus = 'queued' | 'processing' | 'completed' | 'failed' | 'scheduled';
|
|
1233
|
+
interface GscdumpSyncJobItem {
|
|
1234
|
+
id: number;
|
|
1235
|
+
userSiteId: string | null;
|
|
1236
|
+
tableName?: string;
|
|
1237
|
+
tableTier?: string;
|
|
1238
|
+
date?: string;
|
|
1239
|
+
priority?: string;
|
|
1240
|
+
status: GscdumpSyncJobStatus;
|
|
1241
|
+
siteUrl: string | null;
|
|
1242
|
+
userEmail?: string | null;
|
|
1243
|
+
rowsFetched: number | null;
|
|
1244
|
+
rowsInserted: number | null;
|
|
1245
|
+
error: string | null;
|
|
1246
|
+
retryCount: number;
|
|
1247
|
+
queuedAt: number;
|
|
1248
|
+
startedAt: number | null;
|
|
1249
|
+
completedAt: number | null;
|
|
1250
|
+
}
|
|
1251
|
+
interface GscdumpSyncJobsQueueCounts {
|
|
1252
|
+
queued: number;
|
|
1253
|
+
processing: number;
|
|
1254
|
+
}
|
|
1255
|
+
interface GscdumpSyncJobsResponse {
|
|
1256
|
+
jobs: GscdumpSyncJobItem[];
|
|
1257
|
+
summary: {
|
|
1258
|
+
queued: number;
|
|
1259
|
+
processing: number;
|
|
1260
|
+
completed: number;
|
|
1261
|
+
failed: number;
|
|
1262
|
+
};
|
|
1263
|
+
queues: Record<string, GscdumpSyncJobsQueueCounts>;
|
|
1264
|
+
tiers?: {
|
|
1265
|
+
critical: GscdumpSyncJobsQueueCounts | undefined;
|
|
1266
|
+
standard: GscdumpSyncJobsQueueCounts | undefined;
|
|
1267
|
+
extended: GscdumpSyncJobsQueueCounts | undefined;
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
interface GscdumpSiteReportResponse<TResult = unknown> {
|
|
1271
|
+
status: 'done' | 'error';
|
|
1272
|
+
cached: boolean;
|
|
1273
|
+
result?: TResult;
|
|
1274
|
+
error?: string;
|
|
1275
|
+
}
|
|
1276
|
+
interface GscdumpTeamRow {
|
|
1277
|
+
id: string;
|
|
1278
|
+
ownerId: number;
|
|
1279
|
+
name: string;
|
|
1280
|
+
personalTeam: boolean;
|
|
1281
|
+
createdAt: number;
|
|
1282
|
+
updatedAt: number;
|
|
1283
|
+
}
|
|
1284
|
+
interface GscdumpTeamMemberRow {
|
|
1285
|
+
userId: number;
|
|
1286
|
+
publicId: string;
|
|
1287
|
+
name: string | null;
|
|
1288
|
+
email: string;
|
|
1289
|
+
picture: string | null;
|
|
1290
|
+
role: 'admin' | 'editor' | 'viewer';
|
|
1291
|
+
joinedAt: number;
|
|
1292
|
+
}
|
|
1293
|
+
interface CreatePartnerTeamParams {
|
|
1294
|
+
ownerUserId: string;
|
|
1295
|
+
name: string;
|
|
1296
|
+
personalTeam?: boolean;
|
|
1297
|
+
}
|
|
1298
|
+
interface AddPartnerTeamMemberParams {
|
|
1299
|
+
userId: string;
|
|
1300
|
+
role: GscdumpTeamMemberRow['role'];
|
|
1301
|
+
}
|
|
1302
|
+
interface BindPartnerSiteTeamParams {
|
|
1303
|
+
teamId: string | null;
|
|
1304
|
+
}
|
|
1305
|
+
interface PartnerClient {
|
|
1306
|
+
registerUser: (params: RegisterPartnerUserParams) => Promise<GscdumpUserRegistration>;
|
|
1307
|
+
updateUserTokens: (userId: string, params: UpdatePartnerUserTokensParams) => Promise<GscdumpUserTokenUpdate>;
|
|
1308
|
+
getUserStatus: (userId: string) => Promise<GscdumpUserStatus>;
|
|
1309
|
+
getUserLifecycle: (userId: string) => Promise<PartnerLifecycleResponse>;
|
|
1310
|
+
waitForUserReady: (userId: string, options?: {
|
|
1311
|
+
attempts?: number;
|
|
1312
|
+
intervalMs?: number;
|
|
1313
|
+
}) => Promise<GscdumpUserStatus>;
|
|
1314
|
+
waitForUserLifecycleReady: (userId: string, options?: {
|
|
1315
|
+
attempts?: number;
|
|
1316
|
+
intervalMs?: number;
|
|
1317
|
+
}) => Promise<PartnerLifecycleResponse>;
|
|
1318
|
+
getUserSites: (userId: string) => Promise<{
|
|
1319
|
+
sites: GscdumpUserSite[];
|
|
1320
|
+
}>;
|
|
1321
|
+
getAvailableSites: (userId: string) => Promise<{
|
|
1322
|
+
sites: GscdumpAvailableSite[];
|
|
1323
|
+
}>;
|
|
1324
|
+
registerSite: (params: RegisterPartnerSiteParams) => Promise<GscdumpSiteRegistration>;
|
|
1325
|
+
bulkRegisterSites: (params: BulkRegisterPartnerSitesParams) => Promise<BulkRegisterPartnerSitesResponse>;
|
|
1326
|
+
deleteUser: (userId: string) => Promise<DeletePartnerUserResponse>;
|
|
1327
|
+
deleteSite: (siteId: string) => Promise<{
|
|
1328
|
+
success: boolean;
|
|
1329
|
+
}>;
|
|
1330
|
+
getAnalysisSources: (siteId: string, tables?: string[] | string | AnalysisSourcesOptions, options?: SearchTypeOptions | SourceInfoOptions) => Promise<GscdumpAnalysisSourcesResponse>;
|
|
1331
|
+
getSiteSyncStatus: (siteId: string, userId?: string) => Promise<GscdumpSyncStatusResponse>;
|
|
1332
|
+
getData: (siteId: string, state: BuilderState, options?: DataQueryOptions) => Promise<GscdumpDataResponse>;
|
|
1333
|
+
getDataDetail: (siteId: string, state: BuilderState, options?: DataDetailOptions) => Promise<GscdumpDataDetailResponse>;
|
|
1334
|
+
getAnalysis: (siteId: string, params: GscdumpAnalysisParams) => Promise<GscdumpAnalysisResponse>;
|
|
1335
|
+
getSitemaps: (siteId: string) => Promise<GscdumpSitemapsResponse>;
|
|
1336
|
+
getSitemapChanges: (siteId: string, days?: number) => Promise<GscdumpSitemapChangesResponse>;
|
|
1337
|
+
submitSitemap: (siteId: string, sitemapUrl: string, action?: 'submit' | 'delete') => Promise<{
|
|
1338
|
+
success: boolean;
|
|
1339
|
+
action: 'submitted' | 'deleted';
|
|
1340
|
+
sitemapUrl: string;
|
|
1341
|
+
}>;
|
|
1342
|
+
refreshSitemaps: (siteId: string) => Promise<{
|
|
1343
|
+
success: boolean;
|
|
1344
|
+
action: 'refreshed';
|
|
1345
|
+
sitemapCount: number;
|
|
1346
|
+
changed: boolean;
|
|
1347
|
+
}>;
|
|
1348
|
+
getIndexing: (siteId: string, days?: number) => Promise<GscdumpIndexingResponse>;
|
|
1349
|
+
getIndexingUrls: (siteId: string, params?: IndexingUrlsParams) => Promise<GscdumpIndexingUrlsResponse>;
|
|
1350
|
+
getIndexingDiagnostics: (siteId: string) => Promise<GscdumpIndexingDiagnosticsResponse>;
|
|
1351
|
+
requestIndexingInspect: (siteId: string, body: IndexingInspectRequest) => Promise<IndexingInspectResponse | IndexingInspectRateLimited>;
|
|
1352
|
+
getUserSettings: () => Promise<GscdumpUserSettings>;
|
|
1353
|
+
patchUserSettings: (body: Partial<GscdumpUserSettings>) => Promise<GscdumpUserSettings>;
|
|
1354
|
+
recoverPermission: (siteId: string) => Promise<GscdumpPermissionRecovery>;
|
|
1355
|
+
getTopAssociation: (siteId: string, params: GscdumpTopAssociationParams) => Promise<GscdumpTopAssociationResponse>;
|
|
1356
|
+
getKeywordSparklines: (siteId: string, params: GscdumpKeywordSparklinesParams) => Promise<GscdumpKeywordSparklinesResponse>;
|
|
1357
|
+
getQueryTrend: (siteId: string, params: GscdumpQueryTrendParams) => Promise<GscdumpQueryTrendResponse>;
|
|
1358
|
+
getPageTrend: (siteId: string, params: GscdumpPageTrendParams) => Promise<GscdumpPageTrendResponse>;
|
|
1359
|
+
getCanonicalMismatches: (siteId: string) => Promise<GscdumpCanonicalMismatchesResponse>;
|
|
1360
|
+
getContentVelocity: <T = unknown>(siteId: string, days?: number) => Promise<T>;
|
|
1361
|
+
getCtrCurve: <T = unknown>(siteId: string, params: GscdumpDateRangeParams) => Promise<T>;
|
|
1362
|
+
getDarkTraffic: <T = unknown>(siteId: string, params: GscdumpDateRangeParams) => Promise<T>;
|
|
1363
|
+
getDeviceGap: <T = unknown>(siteId: string, params: GscdumpDateRangeParams) => Promise<T>;
|
|
1364
|
+
getIndexPercent: (siteId: string, params?: {
|
|
1365
|
+
invisibleLimit?: number;
|
|
1366
|
+
invisibleOffset?: number;
|
|
1367
|
+
orphanLimit?: number;
|
|
1368
|
+
}) => Promise<GscdumpIndexPercentResponse>;
|
|
1369
|
+
getKeywordBreadth: <T = unknown>(siteId: string, params: GscdumpDateRangeParams) => Promise<T>;
|
|
1370
|
+
getPositionDistribution: <T = unknown>(siteId: string, params: GscdumpDateRangeParams) => Promise<T>;
|
|
1371
|
+
createTeam: (params: CreatePartnerTeamParams) => Promise<{
|
|
1372
|
+
team: GscdumpTeamRow;
|
|
1373
|
+
}>;
|
|
1374
|
+
renameTeam: (teamId: string, params: {
|
|
1375
|
+
name: string;
|
|
1376
|
+
}) => Promise<{
|
|
1377
|
+
ok: true;
|
|
1378
|
+
name: string;
|
|
1379
|
+
}>;
|
|
1380
|
+
deleteTeam: (teamId: string) => Promise<{
|
|
1381
|
+
ok: true;
|
|
1382
|
+
}>;
|
|
1383
|
+
listTeamMembers: (teamId: string) => Promise<{
|
|
1384
|
+
members: GscdumpTeamMemberRow[];
|
|
1385
|
+
}>;
|
|
1386
|
+
addTeamMember: (teamId: string, params: AddPartnerTeamMemberParams) => Promise<{
|
|
1387
|
+
ok: true;
|
|
1388
|
+
role: string;
|
|
1389
|
+
alreadyExisted?: boolean;
|
|
1390
|
+
}>;
|
|
1391
|
+
updateTeamMemberRole: (teamId: string, userId: string, params: {
|
|
1392
|
+
role: GscdumpTeamMemberRow['role'];
|
|
1393
|
+
}) => Promise<{
|
|
1394
|
+
ok: true;
|
|
1395
|
+
role: string;
|
|
1396
|
+
}>;
|
|
1397
|
+
removeTeamMember: (teamId: string, userId: string) => Promise<{
|
|
1398
|
+
ok: true;
|
|
1399
|
+
}>;
|
|
1400
|
+
bindSiteToTeam: (userId: string, siteId: string, params: BindPartnerSiteTeamParams) => Promise<{
|
|
1401
|
+
ok: true;
|
|
1402
|
+
teamId: string | null;
|
|
1403
|
+
}>;
|
|
1404
|
+
}
|
|
1405
|
+
type PartnerRealtimeEventType = 'sync.progress' | 'sync.complete' | 'sync.job_complete' | 'sync.site_complete' | 'sync.failed' | 'job.failed' | 'auth.failed' | 'auth.needs_reauth' | 'site.added' | 'site.removed' | 'enrichment.complete';
|
|
1406
|
+
interface RealtimeSyncProgressEvent {
|
|
1407
|
+
event: 'sync.progress';
|
|
1408
|
+
siteId: string;
|
|
1409
|
+
siteUrl: string;
|
|
1410
|
+
table: string;
|
|
1411
|
+
date: string;
|
|
1412
|
+
progress: number;
|
|
1413
|
+
}
|
|
1414
|
+
interface RealtimeSyncCompleteEvent {
|
|
1415
|
+
event: 'sync.complete';
|
|
1416
|
+
userId: number;
|
|
1417
|
+
siteId: string;
|
|
1418
|
+
siteUrl: string;
|
|
1419
|
+
table: string;
|
|
1420
|
+
date: string;
|
|
1421
|
+
rowsFetched: number;
|
|
1422
|
+
rowsInserted: number;
|
|
1423
|
+
timestamp: number;
|
|
1424
|
+
}
|
|
1425
|
+
interface RealtimeSyncJobCompleteEvent {
|
|
1426
|
+
event: 'sync.job_complete';
|
|
1427
|
+
userId: number;
|
|
1428
|
+
siteId: string;
|
|
1429
|
+
siteUrl: string;
|
|
1430
|
+
table: string;
|
|
1431
|
+
date: string;
|
|
1432
|
+
rowsFetched: number;
|
|
1433
|
+
rowsInserted: number;
|
|
1434
|
+
syncStatus: string;
|
|
1435
|
+
timestamp: number;
|
|
1436
|
+
}
|
|
1437
|
+
interface RealtimeSyncSiteCompleteEvent {
|
|
1438
|
+
event: 'sync.site_complete';
|
|
1439
|
+
userId: number;
|
|
1440
|
+
siteId: string;
|
|
1441
|
+
siteUrl: string;
|
|
1442
|
+
syncStatus: string;
|
|
1443
|
+
timestamp: number;
|
|
1444
|
+
}
|
|
1445
|
+
interface RealtimeSyncFailedEvent {
|
|
1446
|
+
event: 'sync.failed';
|
|
1447
|
+
userId: number;
|
|
1448
|
+
siteId: string;
|
|
1449
|
+
siteUrl: string;
|
|
1450
|
+
table: string;
|
|
1451
|
+
date: string;
|
|
1452
|
+
error: string;
|
|
1453
|
+
timestamp: number;
|
|
1454
|
+
}
|
|
1455
|
+
interface RealtimeJobFailedEvent {
|
|
1456
|
+
event: 'job.failed';
|
|
1457
|
+
siteId: string;
|
|
1458
|
+
siteUrl: string;
|
|
1459
|
+
table: string;
|
|
1460
|
+
date: string;
|
|
1461
|
+
error: string;
|
|
1462
|
+
timestamp: number;
|
|
1463
|
+
}
|
|
1464
|
+
interface RealtimeSiteAddedEvent {
|
|
1465
|
+
event: 'site.added';
|
|
1466
|
+
userId: number;
|
|
1467
|
+
siteId: string;
|
|
1468
|
+
siteUrl: string;
|
|
1469
|
+
}
|
|
1470
|
+
interface RealtimeSiteRemovedEvent {
|
|
1471
|
+
event: 'site.removed';
|
|
1472
|
+
userId: number;
|
|
1473
|
+
siteId: string;
|
|
1474
|
+
siteUrl: string;
|
|
1475
|
+
}
|
|
1476
|
+
interface RealtimeAuthFailedEvent {
|
|
1477
|
+
event: 'auth.failed';
|
|
1478
|
+
userId: number;
|
|
1479
|
+
siteId: string;
|
|
1480
|
+
siteUrl: string;
|
|
1481
|
+
error: string;
|
|
1482
|
+
timestamp: number;
|
|
1483
|
+
}
|
|
1484
|
+
interface RealtimeNeedsReauthEvent {
|
|
1485
|
+
event: 'auth.needs_reauth';
|
|
1486
|
+
userId: number;
|
|
1487
|
+
failureCount: number;
|
|
1488
|
+
timestamp: number;
|
|
1489
|
+
}
|
|
1490
|
+
interface RealtimeEnrichmentCompleteEvent {
|
|
1491
|
+
event: 'enrichment.complete';
|
|
1492
|
+
siteId: string;
|
|
1493
|
+
userId: number;
|
|
1494
|
+
timestamp: number;
|
|
1495
|
+
}
|
|
1496
|
+
type PartnerRealtimeEvent = RealtimeSyncProgressEvent | RealtimeSyncCompleteEvent | RealtimeSyncJobCompleteEvent | RealtimeSyncSiteCompleteEvent | RealtimeSyncFailedEvent | RealtimeJobFailedEvent | RealtimeSiteAddedEvent | RealtimeSiteRemovedEvent | RealtimeAuthFailedEvent | RealtimeNeedsReauthEvent | RealtimeEnrichmentCompleteEvent;
|
|
1497
|
+
interface RealtimeAuthRequiredMessage {
|
|
1498
|
+
event: 'auth.required';
|
|
1499
|
+
message: string;
|
|
1500
|
+
}
|
|
1501
|
+
interface RealtimeConnectedMessage {
|
|
1502
|
+
event: 'connected';
|
|
1503
|
+
partnerId?: string;
|
|
1504
|
+
userId?: number;
|
|
1505
|
+
message: string;
|
|
1506
|
+
}
|
|
1507
|
+
interface RealtimeSubscribedMessage {
|
|
1508
|
+
type: 'subscribed';
|
|
1509
|
+
siteIds?: string[];
|
|
1510
|
+
partnerIds?: string[];
|
|
1511
|
+
}
|
|
1512
|
+
interface RealtimePongMessage {
|
|
1513
|
+
type: 'pong';
|
|
1514
|
+
timestamp: number;
|
|
1515
|
+
}
|
|
1516
|
+
interface RealtimeErrorMessage {
|
|
1517
|
+
type: 'error';
|
|
1518
|
+
message: string;
|
|
1519
|
+
}
|
|
1520
|
+
type PartnerRealtimeMessage = PartnerRealtimeEvent | RealtimeAuthRequiredMessage | RealtimeConnectedMessage | RealtimeSubscribedMessage | RealtimePongMessage | RealtimeErrorMessage;
|
|
1521
|
+
type CanonicalWebhookEventType = 'user.lifecycle.changed' | 'site.lifecycle.changed' | 'site.analytics.ready' | 'site.indexing.ready' | 'site.auth.failed' | 'job.failed';
|
|
1522
|
+
type WebhookEventType = CanonicalWebhookEventType;
|
|
1523
|
+
interface WebhookEnvelope<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
1524
|
+
contractVersion: string;
|
|
1525
|
+
deliveryId: string;
|
|
1526
|
+
event: CanonicalWebhookEventType;
|
|
1527
|
+
partnerId: string;
|
|
1528
|
+
userId: string | null;
|
|
1529
|
+
siteId?: string;
|
|
1530
|
+
externalUserId?: string | null;
|
|
1531
|
+
externalSiteId?: string | null;
|
|
1532
|
+
lifecycleRevision: number;
|
|
1533
|
+
occurredAt: string;
|
|
1534
|
+
data: TData;
|
|
1535
|
+
}
|
|
1536
|
+
type PartnerWebhookData = Record<string, unknown>;
|
|
1537
|
+
interface CreateWebhookEnvelopeOptions<TData extends Record<string, unknown> = Record<string, unknown>> {
|
|
1538
|
+
event: CanonicalWebhookEventType;
|
|
1539
|
+
partnerId: string;
|
|
1540
|
+
userId: string | null;
|
|
1541
|
+
siteId?: string;
|
|
1542
|
+
externalUserId?: string | null;
|
|
1543
|
+
externalSiteId?: string | null;
|
|
1544
|
+
lifecycleRevision: number;
|
|
1545
|
+
data: TData;
|
|
1546
|
+
deliveryId?: string;
|
|
1547
|
+
occurredAt?: string | Date;
|
|
1548
|
+
contractVersion?: string;
|
|
1549
|
+
}
|
|
1550
|
+
interface PartnerWebhookHeaders {
|
|
1551
|
+
event?: string | null;
|
|
1552
|
+
delivery?: string | null;
|
|
1553
|
+
contractVersion?: string | null;
|
|
1554
|
+
timestamp?: string | null;
|
|
1555
|
+
signature?: string | null;
|
|
1556
|
+
}
|
|
1557
|
+
export { AccountNextAction, AccountStatus, AddPartnerTeamMemberParams, AnalysisSourcesOptions, AnalysisSourcesResponse, AnalyticsClient, AnalyticsNextAction, AnalyticsStatus, BackfillRange, BackfillResponse, BindPartnerSiteTeamParams, BuilderState, BulkRegisterPartnerSiteResult, BulkRegisterPartnerSitesParams, BulkRegisterPartnerSitesResponse, CanonicalWebhookEventType, ColumnDef, ColumnType, CountriesResponse, CountryRow, CreatePartnerTeamParams, CreateWebhookEnvelopeOptions, DataDetailOptions, DataQueryOptions, DeletePartnerUserResponse, Dimension, Filter, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSCDUMP_WRITE_ANALYTICS_SCOPE, Grain, GscApiRange, GscComparisonFilter, GscRowQueryMeta, GscRowQueryResponse, GscSearchType, GscdumpAnalysisParams, GscdumpAnalysisPreset, GscdumpAnalysisResponse, GscdumpAnalysisSourcesResponse, GscdumpAvailableSite, GscdumpCanonicalMismatchRow, GscdumpCanonicalMismatchesResponse, GscdumpDataDetailResponse, GscdumpDataResponse, GscdumpDataRow, GscdumpDateRangeParams, GscdumpHealthResponse, GscdumpIndexPercentResponse, GscdumpIndexPercentSitemap, GscdumpIndexPercentTrendPoint, GscdumpIndexingDiagnosticsResponse, GscdumpIndexingInspectRateLimited, GscdumpIndexingInspectRequest, GscdumpIndexingInspectResponse, GscdumpIndexingInspectResult, GscdumpIndexingIssueSeverity, GscdumpIndexingResponse, GscdumpIndexingTrendPoint, GscdumpIndexingUrl, GscdumpIndexingUrlStatus, GscdumpIndexingUrlsResponse, GscdumpInvisibleUrlRow, GscdumpKeywordSparklinesParams, GscdumpKeywordSparklinesResponse, GscdumpMeta, GscdumpOrphanPageRow, GscdumpPageTrendParams, GscdumpPageTrendResponse, GscdumpPerSitemapHistoryEntry, GscdumpPermissionRecovery, GscdumpQueryTrendParams, GscdumpQueryTrendResponse, GscdumpRichResultItem, GscdumpSiteRegistration, GscdumpSiteReportResponse, GscdumpSitemap, GscdumpSitemapChangesResponse, GscdumpSitemapHistory, GscdumpSitemapsResponse, GscdumpSyncJobItem, GscdumpSyncJobStatus, GscdumpSyncJobsQueueCounts, GscdumpSyncJobsResponse, GscdumpSyncProgressDateStatus, GscdumpSyncProgressPhaseCounts, GscdumpSyncProgressResponse, GscdumpSyncProgressSite, GscdumpSyncStatusResponse, GscdumpTeamMemberRow, GscdumpTeamRow, GscdumpTopAssociationParams, GscdumpTopAssociationResponse, GscdumpTotals, GscdumpUserMeResponse, GscdumpUserRegistration, GscdumpUserSettings, GscdumpUserSite, GscdumpUserStatus, GscdumpUserTokenUpdate, IndexingDiagnostics, IndexingInspectRateLimit, IndexingInspectRateLimited, IndexingInspectRequest, IndexingInspectResponse, IndexingInspectResult, IndexingIssue, IndexingIssueSeverity, IndexingNextAction, IndexingStatus, IndexingUrlRow, IndexingUrlStatus, IndexingUrlsParams, IndexingUrlsResponse, InspectionHistoryRecord, InspectionHistoryResponse, InspectionIndex, InspectionRecordRaw, LifecycleError, LifecycleErrorCode, LifecycleProgress, LifecycleWebhookEnvelope, LifecycleWebhookEvent, Metric, PartnerClient, PartnerLifecycleAccount, PartnerLifecycleResponse, PartnerLifecycleSite, PartnerRealtimeEvent, PartnerRealtimeEventType, PartnerRealtimeMessage, PartnerWebhookData, PartnerWebhookHeaders, PropertyNextAction, PropertyStatus, QuerySourceMode, RealtimeAuthFailedEvent, RealtimeAuthRequiredMessage, RealtimeConnectedMessage, RealtimeEnrichmentCompleteEvent, RealtimeErrorMessage, RealtimeJobFailedEvent, RealtimeNeedsReauthEvent, RealtimePongMessage, RealtimeSiteAddedEvent, RealtimeSiteRemovedEvent, RealtimeSubscribedMessage, RealtimeSyncCompleteEvent, RealtimeSyncFailedEvent, RealtimeSyncJobCompleteEvent, RealtimeSyncProgressEvent, RealtimeSyncSiteCompleteEvent, RegisterPartnerSiteParams, RegisterPartnerUserParams, RollupEnvelope, Row, ScheduleState, SearchAppearanceResponse, SearchAppearanceRow, SearchTypeOptions, SiteListItem, SitemapAddedRow, SitemapChangesResponse, SitemapHistoryRecord, SitemapHistoryResponse, SitemapIndex, SitemapNextAction, SitemapRemovedRow, SitemapStatus, SourceInfoOptions, SourceInfoResponse, TableName, TableSchema, TenantCtx, UpdatePartnerUserTokensParams, WebhookEnvelope, WebhookEventType, WhoamiResponse, accountNextActions, accountStatuses, analyticsNextActions, analyticsStatuses, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, lifecycleErrorCodes, lifecycleWebhookEvents, parseGrantedScopes, propertyNextActions, propertyStatuses, querySourceModes, sitemapNextActions, sitemapStatuses };
|