gscdump 0.40.2 → 1.0.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.
- package/README.md +47 -123
- package/dist/core/result.d.mts +1 -10
- package/dist/core/result.mjs +1 -10
- package/dist/index.d.mts +212 -87
- package/dist/index.mjs +132 -233
- package/dist/query/index.d.mts +11 -8
- package/dist/query/index.mjs +33 -22
- package/dist/query/plan.d.mts +4 -1
- package/dist/query/plan.mjs +6 -0
- package/package.json +4 -25
- package/dist/api/index.d.mts +0 -748
- package/dist/api/index.mjs +0 -2989
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { $Fetch, FetchOptions } from "ofetch";
|
|
2
|
-
import { AccountNextAction, AccountStatus, AnalyticsNextAction, AnalyticsStatus, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSCDUMP_WRITE_ANALYTICS_SCOPE, IndexingNextAction, IndexingStatus, LifecycleError, LifecycleErrorCode, LifecycleProgress, LifecycleWebhookEnvelope, LifecycleWebhookEvent, PartnerLifecycleAccount, PartnerLifecycleResponse, PartnerLifecycleSite, PropertyNextAction, PropertyStatus, QuerySourceMode, SitemapNextAction, SitemapStatus, accountNextActions, accountStatuses, analyticsNextActions, analyticsStatuses, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, lifecycleErrorCodes,
|
|
3
|
-
import { indexing_v3 } from "@googleapis/indexing/build/v3";
|
|
4
|
-
import { searchconsole_v1 } from "@googleapis/searchconsole/build/v1";
|
|
2
|
+
import { AccountNextAction, AccountStatus, AnalyticsNextAction, AnalyticsStatus, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSCDUMP_WRITE_ANALYTICS_SCOPE, IndexingNextAction, IndexingStatus, LifecycleError, LifecycleErrorCode, LifecycleProgress, LifecycleWebhookEnvelope, LifecycleWebhookEvent, PartnerLifecycleAccount, PartnerLifecycleResponse, PartnerLifecycleSite, PropertyNextAction, PropertyStatus, QuerySourceMode, SitemapNextAction, SitemapStatus, accountNextActions, accountStatuses, analyticsNextActions, analyticsStatuses, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, lifecycleErrorCodes, parseGrantedScopes, propertyNextActions, propertyStatuses, querySourceModes, sitemapNextActions, sitemapStatuses } from "@gscdump/contracts/partner";
|
|
5
3
|
/**
|
|
6
4
|
* Batch runner with optional concurrency, inter-call delay, and progress.
|
|
7
5
|
* Used by batchRequestIndexing / batchInspectUrls. Defaults to sequential
|
|
@@ -155,21 +153,155 @@ interface GSCQueryBuilder<D extends Dimension[] = [], C = object> {
|
|
|
155
153
|
toBody: () => GscSearchAnalyticsRequest;
|
|
156
154
|
getState: () => BuilderState;
|
|
157
155
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
type
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
type
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
156
|
+
/** Search Console property returned by the Sites resource. */
|
|
157
|
+
interface ApiSite {
|
|
158
|
+
permissionLevel?: string | null;
|
|
159
|
+
siteUrl?: string | null;
|
|
160
|
+
}
|
|
161
|
+
/** Per-content-type counts returned with a sitemap. */
|
|
162
|
+
interface ApiSitemapContent {
|
|
163
|
+
/** Deprecated by Google, retained because it can still appear on the wire. */
|
|
164
|
+
indexed?: string | null;
|
|
165
|
+
submitted?: string | null;
|
|
166
|
+
type?: string | null;
|
|
167
|
+
}
|
|
168
|
+
/** Sitemap returned by the Search Console Sitemaps resource. */
|
|
169
|
+
interface ApiSitemap {
|
|
170
|
+
contents?: ApiSitemapContent[];
|
|
171
|
+
errors?: string | null;
|
|
172
|
+
isPending?: boolean | null;
|
|
173
|
+
isSitemapsIndex?: boolean | null;
|
|
174
|
+
lastDownloaded?: string | null;
|
|
175
|
+
lastSubmitted?: string | null;
|
|
176
|
+
path?: string | null;
|
|
177
|
+
type?: string | null;
|
|
178
|
+
warnings?: string | null;
|
|
179
|
+
}
|
|
180
|
+
/** A Search Analytics dimension filter. */
|
|
181
|
+
interface DimensionFilter {
|
|
182
|
+
dimension?: string | null;
|
|
183
|
+
expression?: string | null;
|
|
184
|
+
operator?: string | null;
|
|
185
|
+
}
|
|
186
|
+
/** A group of Search Analytics dimension filters. */
|
|
187
|
+
interface DimensionFilterGroup {
|
|
188
|
+
filters?: DimensionFilter[];
|
|
189
|
+
groupType?: string | null;
|
|
190
|
+
}
|
|
191
|
+
/** Raw Search Analytics request accepted by Google's REST endpoint. */
|
|
192
|
+
interface SearchAnalyticsQuery {
|
|
193
|
+
aggregationType?: string | null;
|
|
194
|
+
dataState?: string | null;
|
|
195
|
+
dimensionFilterGroups?: DimensionFilterGroup[];
|
|
196
|
+
dimensions?: string[] | null;
|
|
197
|
+
endDate?: string | null;
|
|
198
|
+
rowLimit?: number | null;
|
|
199
|
+
searchType?: string | null;
|
|
200
|
+
startDate?: string | null;
|
|
201
|
+
startRow?: number | null;
|
|
202
|
+
type?: string | null;
|
|
203
|
+
}
|
|
204
|
+
/** Raw Search Analytics result row. */
|
|
205
|
+
interface DataRow {
|
|
206
|
+
clicks?: number | null;
|
|
207
|
+
ctr?: number | null;
|
|
208
|
+
impressions?: number | null;
|
|
209
|
+
keys?: string[] | null;
|
|
210
|
+
position?: number | null;
|
|
211
|
+
}
|
|
212
|
+
/** Completeness metadata returned with recent Search Analytics data. */
|
|
213
|
+
interface SearchAnalyticsMetadata {
|
|
214
|
+
firstIncompleteDate?: string | null;
|
|
215
|
+
firstIncompleteHour?: string | null;
|
|
216
|
+
/** Field name returned by the direct REST endpoint. */
|
|
217
|
+
first_incomplete_date?: string | null;
|
|
218
|
+
/** Field name returned by the direct REST endpoint. */
|
|
219
|
+
first_incomplete_hour?: string | null;
|
|
220
|
+
}
|
|
221
|
+
/** Raw Search Analytics response returned by Google's REST endpoint. */
|
|
222
|
+
interface SearchAnalyticsResponse {
|
|
223
|
+
metadata?: SearchAnalyticsMetadata;
|
|
224
|
+
responseAggregationType?: string | null;
|
|
225
|
+
rows?: DataRow[];
|
|
226
|
+
}
|
|
227
|
+
interface AmpIssue {
|
|
228
|
+
issueMessage?: string | null;
|
|
229
|
+
severity?: string | null;
|
|
230
|
+
}
|
|
231
|
+
interface AmpInspectionResult {
|
|
232
|
+
ampIndexStatusVerdict?: string | null;
|
|
233
|
+
ampUrl?: string | null;
|
|
234
|
+
indexingState?: string | null;
|
|
235
|
+
issues?: AmpIssue[];
|
|
236
|
+
lastCrawlTime?: string | null;
|
|
237
|
+
pageFetchState?: string | null;
|
|
238
|
+
robotsTxtState?: string | null;
|
|
239
|
+
verdict?: string | null;
|
|
240
|
+
}
|
|
241
|
+
interface IndexStatusResult {
|
|
242
|
+
coverageState?: string | null;
|
|
243
|
+
crawledAs?: string | null;
|
|
244
|
+
googleCanonical?: string | null;
|
|
245
|
+
indexingState?: string | null;
|
|
246
|
+
lastCrawlTime?: string | null;
|
|
247
|
+
pageFetchState?: string | null;
|
|
248
|
+
referringUrls?: string[] | null;
|
|
249
|
+
robotsTxtState?: string | null;
|
|
250
|
+
sitemap?: string[] | null;
|
|
251
|
+
userCanonical?: string | null;
|
|
252
|
+
verdict?: string | null;
|
|
253
|
+
}
|
|
254
|
+
interface MobileUsabilityIssue {
|
|
255
|
+
issueType?: string | null;
|
|
256
|
+
message?: string | null;
|
|
257
|
+
severity?: string | null;
|
|
258
|
+
}
|
|
259
|
+
interface MobileUsabilityResult {
|
|
260
|
+
issues?: MobileUsabilityIssue[];
|
|
261
|
+
verdict?: string | null;
|
|
262
|
+
}
|
|
263
|
+
interface RichResultsIssue {
|
|
264
|
+
issueMessage?: string | null;
|
|
265
|
+
severity?: string | null;
|
|
266
|
+
}
|
|
267
|
+
interface RichResultsItem {
|
|
268
|
+
issues?: RichResultsIssue[];
|
|
269
|
+
name?: string | null;
|
|
270
|
+
}
|
|
271
|
+
interface RichResultsDetectedItem {
|
|
272
|
+
items?: RichResultsItem[];
|
|
273
|
+
richResultType?: string | null;
|
|
274
|
+
}
|
|
275
|
+
interface RichResultsResult {
|
|
276
|
+
detectedItems?: RichResultsDetectedItem[];
|
|
277
|
+
verdict?: string | null;
|
|
278
|
+
}
|
|
279
|
+
/** URL inspection payload returned by Search Console. */
|
|
280
|
+
interface UrlInspectionResult {
|
|
281
|
+
ampResult?: AmpInspectionResult;
|
|
282
|
+
indexStatusResult?: IndexStatusResult;
|
|
283
|
+
inspectionResultLink?: string | null;
|
|
284
|
+
mobileUsabilityResult?: MobileUsabilityResult;
|
|
285
|
+
richResultsResult?: RichResultsResult;
|
|
286
|
+
}
|
|
287
|
+
interface InspectUrlIndexResponse {
|
|
288
|
+
inspectionResult?: UrlInspectionResult;
|
|
289
|
+
}
|
|
290
|
+
/** A single Indexing API notification. */
|
|
291
|
+
interface UrlNotification {
|
|
292
|
+
notifyTime?: string | null;
|
|
293
|
+
type?: string | null;
|
|
294
|
+
url?: string | null;
|
|
295
|
+
}
|
|
296
|
+
/** Latest Indexing API notifications recorded for a URL. */
|
|
297
|
+
interface UrlNotificationMetadata {
|
|
298
|
+
latestRemove?: UrlNotification;
|
|
299
|
+
latestUpdate?: UrlNotification;
|
|
300
|
+
url?: string | null;
|
|
301
|
+
}
|
|
302
|
+
interface PublishUrlNotificationResponse {
|
|
303
|
+
urlNotificationMetadata?: UrlNotificationMetadata;
|
|
304
|
+
}
|
|
173
305
|
type RequiredNonNullable<T> = Required<Exclude<T, null | undefined>>;
|
|
174
306
|
interface Site extends Required<Omit<ApiSite, 'siteUrl'>> {
|
|
175
307
|
siteUrl: string;
|
|
@@ -221,6 +353,8 @@ interface SiteAnalytics {
|
|
|
221
353
|
impressions: number;
|
|
222
354
|
}[];
|
|
223
355
|
}
|
|
356
|
+
/** Default deadline for each direct Google API request. */
|
|
357
|
+
declare const DEFAULT_GSC_REQUEST_TIMEOUT_MS = 30000;
|
|
224
358
|
type VerificationMethod = 'META' | 'FILE' | 'DNS_TXT' | 'DNS_CNAME' | 'ANALYTICS' | 'TAG_MANAGER';
|
|
225
359
|
type VerificationSiteType = 'SITE' | 'INET_DOMAIN' | 'ANDROID_APP';
|
|
226
360
|
interface VerificationSite {
|
|
@@ -322,8 +456,10 @@ interface GoogleSearchConsoleClient {
|
|
|
322
456
|
publish: (url: string, type: 'URL_UPDATED' | 'URL_DELETED', opts?: CallOptions) => Promise<PublishUrlNotificationResponse>;
|
|
323
457
|
getMetadata: (url: string, opts?: CallOptions) => Promise<UrlNotificationMetadata>;
|
|
324
458
|
};
|
|
325
|
-
/**
|
|
326
|
-
|
|
459
|
+
/** Direct Search Analytics API operations for callers that already have a request body. */
|
|
460
|
+
searchAnalytics: {
|
|
461
|
+
query: (siteUrl: string, body: SearchAnalyticsQuery, opts?: CallOptions) => Promise<SearchAnalyticsResponse>;
|
|
462
|
+
};
|
|
327
463
|
}
|
|
328
464
|
interface GoogleSearchConsoleClientOptions {
|
|
329
465
|
fetchOptions?: FetchOptions;
|
|
@@ -341,8 +477,8 @@ interface IndexingResult {
|
|
|
341
477
|
}
|
|
342
478
|
interface IndexingMetadata {
|
|
343
479
|
url: string;
|
|
344
|
-
latestUpdate?:
|
|
345
|
-
latestRemove?:
|
|
480
|
+
latestUpdate?: UrlNotification;
|
|
481
|
+
latestRemove?: UrlNotification;
|
|
346
482
|
}
|
|
347
483
|
/**
|
|
348
484
|
* Request Google to index or remove a URL via the Indexing API.
|
|
@@ -415,13 +551,36 @@ interface ParsedIndexingResult {
|
|
|
415
551
|
ampIssues: string | null;
|
|
416
552
|
inspectionResultLink: string | null;
|
|
417
553
|
}
|
|
418
|
-
declare function inspectUrlFlat(client: GoogleSearchConsoleClient, siteUrl: string, inspectionUrl: string): Promise<ParsedIndexingResult>;
|
|
554
|
+
declare function inspectUrlFlat(client: GoogleSearchConsoleClient, siteUrl: string, inspectionUrl: string, options?: CallOptions): Promise<ParsedIndexingResult>;
|
|
555
|
+
/** Maximum parallel URL Inspection requests started by the settled flat batch helper. */
|
|
556
|
+
declare const MAX_FLAT_INSPECTION_BATCH_CONCURRENCY = 10;
|
|
557
|
+
type InspectUrlFlatSettledResult = {
|
|
558
|
+
url: string;
|
|
559
|
+
status: 'fulfilled';
|
|
560
|
+
value: ParsedIndexingResult;
|
|
561
|
+
} | {
|
|
562
|
+
url: string;
|
|
563
|
+
status: 'rejected';
|
|
564
|
+
reason: unknown;
|
|
565
|
+
};
|
|
566
|
+
interface BatchInspectUrlsFlatSettledOptions extends CallOptions {
|
|
567
|
+
/** Delay after each request handled by a worker. Defaults to 200ms. */
|
|
568
|
+
delayMs?: number;
|
|
569
|
+
/** Number of workers. Defaults to 1 and is capped at {@link MAX_FLAT_INSPECTION_BATCH_CONCURRENCY}. */
|
|
570
|
+
concurrency?: number;
|
|
571
|
+
onProgress?: (result: InspectUrlFlatSettledResult, index: number, total: number) => void;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Inspect URLs into the flat storage shape without failing the whole batch
|
|
575
|
+
* when one URL fails. Results retain input order and include each URL so
|
|
576
|
+
* callers can persist successes and classify individual failures safely.
|
|
577
|
+
*/
|
|
578
|
+
declare function batchInspectUrlsFlatSettled(client: GoogleSearchConsoleClient, siteUrl: string, urls: readonly string[], options?: BatchInspectUrlsFlatSettledOptions): Promise<InspectUrlFlatSettledResult[]>;
|
|
419
579
|
type InspectionPriority = 'high' | 'medium' | 'low';
|
|
420
580
|
declare function getNextCheckPriority(result: Pick<ParsedIndexingResult, 'verdict'>): InspectionPriority;
|
|
421
581
|
/** Next-check unix seconds for a given priority. */
|
|
422
582
|
declare function getNextCheckAfter(priority: InspectionPriority): number;
|
|
423
583
|
declare function canUseUrlInspection(permissionLevel: string | null | undefined): boolean;
|
|
424
|
-
declare function grantedScopeList(scopes: string | null | undefined): string[];
|
|
425
584
|
type IndexingIneligibleReason = 'missing_indexing_scope' | 'insufficient_gsc_permission';
|
|
426
585
|
interface IndexingEligibility {
|
|
427
586
|
indexingEligible: boolean;
|
|
@@ -458,19 +617,11 @@ type GscError = {
|
|
|
458
617
|
status?: number;
|
|
459
618
|
cause: unknown;
|
|
460
619
|
};
|
|
461
|
-
/** Approximate per-day GSC API quotas, used in CLI messaging. */
|
|
462
|
-
declare const GSC_QUOTAS: {
|
|
463
|
-
readonly searchAnalytics: 25000;
|
|
464
|
-
readonly urlInspection: 2000;
|
|
465
|
-
readonly indexing: 200;
|
|
466
|
-
};
|
|
467
620
|
/**
|
|
468
621
|
* Classify an unknown error into a `GscError` discriminated union.
|
|
469
622
|
* Transport is the catch-all — anything without a recognizable status ends up there.
|
|
470
623
|
*/
|
|
471
624
|
declare function classifyError(cause: unknown): GscError;
|
|
472
|
-
/** Construct a storage-kind error from inside the analytics engine / adapters. */
|
|
473
|
-
declare function storageError(message: string, cause?: unknown): GscError;
|
|
474
625
|
/**
|
|
475
626
|
* Re-raises a `GscError` value as an `Error`, preserving its `cause` for
|
|
476
627
|
* stack-walking and stashing the original union under `.gscError`. Pairs with
|
|
@@ -503,8 +654,6 @@ declare function rethrowAsGscApiError(prefix: string): (err: unknown) => never;
|
|
|
503
654
|
* needs the permission verdict.
|
|
504
655
|
*/
|
|
505
656
|
declare function isPermissionDeniedError(err: unknown): boolean;
|
|
506
|
-
/** CLI-facing formatter. Returns an ANSI-colored multi-line string. */
|
|
507
|
-
declare function formatErrorForCli(cause: unknown): string;
|
|
508
657
|
interface Ok<A> {
|
|
509
658
|
readonly ok: true;
|
|
510
659
|
readonly value: A;
|
|
@@ -518,15 +667,6 @@ declare function ok<A>(value: A): Ok<A>;
|
|
|
518
667
|
declare function err<E>(error: E): Err<E>;
|
|
519
668
|
declare function isOk<A, E>(result: Result<A, E>): result is Ok<A>;
|
|
520
669
|
declare function isErr<A, E>(result: Result<A, E>): result is Err<E>;
|
|
521
|
-
/** Maps the success channel, leaving an `Err` untouched. */
|
|
522
|
-
declare function mapResult<A, B, E>(result: Result<A, E>, f: (value: A) => B): Result<B, E>;
|
|
523
|
-
/** Maps the error channel, leaving an `Ok` untouched. */
|
|
524
|
-
declare function mapErr<A, E, F>(result: Result<A, E>, f: (error: E) => F): Result<A, F>;
|
|
525
|
-
/** Folds both channels into a single value. */
|
|
526
|
-
declare function matchResult<A, E, R>(result: Result<A, E>, handlers: {
|
|
527
|
-
onOk: (value: A) => R;
|
|
528
|
-
onErr: (error: E) => R;
|
|
529
|
-
}): R;
|
|
530
670
|
/**
|
|
531
671
|
* Collapses a `Result` back into the throwing world: returns the value or throws
|
|
532
672
|
* via `toError`. Used by the throwing wrappers that sit over the `Result` core so
|
|
@@ -537,14 +677,25 @@ interface OAuthTokens {
|
|
|
537
677
|
accessToken: string;
|
|
538
678
|
/** Unix seconds. */
|
|
539
679
|
expiresAt: number;
|
|
680
|
+
/** Space-delimited scopes Google granted for this token, when returned. */
|
|
681
|
+
scope?: string;
|
|
682
|
+
}
|
|
683
|
+
/** Normalized response from Google's access-token introspection endpoint. */
|
|
684
|
+
interface OAuthTokenInfo {
|
|
685
|
+
issuedTo?: string;
|
|
686
|
+
audience?: string;
|
|
687
|
+
authorizedParty?: string;
|
|
688
|
+
userId?: string;
|
|
689
|
+
subject?: string;
|
|
690
|
+
scope?: string;
|
|
691
|
+
/** Seconds remaining when Google inspected the token. */
|
|
692
|
+
expiresIn?: number;
|
|
693
|
+
/** Unix seconds. */
|
|
694
|
+
expiresAt?: number;
|
|
695
|
+
email?: string;
|
|
696
|
+
emailVerified?: boolean;
|
|
697
|
+
accessType?: string;
|
|
540
698
|
}
|
|
541
|
-
/**
|
|
542
|
-
* Errors-as-values core for {@link refreshAccessToken}: returns a classified
|
|
543
|
-
* `GscError` instead of throwing, so token-storage callers can branch on
|
|
544
|
-
* `error.kind` — `auth-expired` (the refresh token is permanently bad, re-auth)
|
|
545
|
-
* vs `transport` (transient, safe to retry later) — rather than string-matching.
|
|
546
|
-
*/
|
|
547
|
-
declare function refreshAccessTokenResult(refreshToken: string, clientId: string, clientSecret: string): Promise<Result<OAuthTokens, GscError>>;
|
|
548
699
|
/**
|
|
549
700
|
* Exchange a refresh token for an access token. Retries transient network
|
|
550
701
|
* failures; surfaces HTTP failures (invalid_grant, etc.) immediately as
|
|
@@ -552,19 +703,21 @@ declare function refreshAccessTokenResult(refreshToken: string, clientId: string
|
|
|
552
703
|
*/
|
|
553
704
|
declare function refreshAccessToken(refreshToken: string, clientId: string, clientSecret: string): Promise<OAuthTokens>;
|
|
554
705
|
/**
|
|
555
|
-
*
|
|
706
|
+
* Exchange an authorization code (from the OAuth consent redirect) for
|
|
707
|
+
* access + refresh tokens. Same retry / surface model and `auth-expired` vs
|
|
556
708
|
* `transport` classification as {@link refreshAccessTokenResult}.
|
|
557
709
|
*/
|
|
558
710
|
declare function exchangeAuthCodeResult(code: string, clientId: string, clientSecret: string, redirectUri: string): Promise<Result<OAuthTokens & {
|
|
559
711
|
refreshToken?: string;
|
|
560
712
|
}, GscError>>;
|
|
561
|
-
/**
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}
|
|
713
|
+
/** Inspect an access token without throwing on expected OAuth failures. */
|
|
714
|
+
declare function introspectAccessTokenResult(accessToken: string): Promise<Result<OAuthTokenInfo, GscError>>;
|
|
715
|
+
/** Throwing convenience wrapper for {@link introspectAccessTokenResult}. */
|
|
716
|
+
declare function introspectAccessToken(accessToken: string): Promise<OAuthTokenInfo>;
|
|
717
|
+
/** Revoke an access or refresh token without throwing on expected OAuth failures. */
|
|
718
|
+
declare function revokeOAuthTokenResult(token: string): Promise<Result<void, GscError>>;
|
|
719
|
+
/** Throwing convenience wrapper for {@link revokeOAuthTokenResult}. */
|
|
720
|
+
declare function revokeOAuthToken(token: string): Promise<void>;
|
|
568
721
|
interface FetchSitesWithSitemapsOptions {
|
|
569
722
|
/** Maximum concurrent sitemap-list requests. Defaults to 4. */
|
|
570
723
|
concurrency?: number;
|
|
@@ -648,30 +801,6 @@ declare function getVerifiedSite(client: GoogleSearchConsoleClient, id: string):
|
|
|
648
801
|
* on the property are unaffected.
|
|
649
802
|
*/
|
|
650
803
|
declare function unverifySite(client: GoogleSearchConsoleClient, id: string): Promise<void>;
|
|
651
|
-
interface GscdumpApiOptions {
|
|
652
|
-
/** API key (gsd_user_xxx or gsd_prod_xxx) */
|
|
653
|
-
apiKey: string;
|
|
654
|
-
/** Base URL (defaults to https://gscdump.com) */
|
|
655
|
-
baseUrl?: string;
|
|
656
|
-
}
|
|
657
|
-
declare function gscdumpApi(options: GscdumpApiOptions): GoogleSearchConsoleClient;
|
|
658
|
-
/**
|
|
659
|
-
* Build a row with default-zeroed metrics. Callers attach dimension keys
|
|
660
|
-
* separately (positional via `row.keys[i]` for the raw GSC API, or named via
|
|
661
|
-
* `row[dim]` for the gscdump.com REST API).
|
|
662
|
-
*/
|
|
663
|
-
declare function rowWithMetricDefaults(row: {
|
|
664
|
-
clicks?: number | null;
|
|
665
|
-
impressions?: number | null;
|
|
666
|
-
ctr?: number | null;
|
|
667
|
-
position?: number | null;
|
|
668
|
-
}): {
|
|
669
|
-
clicks: number;
|
|
670
|
-
impressions: number;
|
|
671
|
-
ctr: number;
|
|
672
|
-
position: number;
|
|
673
|
-
};
|
|
674
|
-
declare function progressBar(current: number, total: number, label: string, width?: number): string;
|
|
675
804
|
/** Milliseconds in a UTC day. Use for date arithmetic without DST surprises. */
|
|
676
805
|
declare const MS_PER_DAY = 86400000;
|
|
677
806
|
/** Format a Date as YYYY-MM-DD (UTC). */
|
|
@@ -684,8 +813,6 @@ declare const GSC_FRESHEST_LAG_DAYS = 1;
|
|
|
684
813
|
declare const GSC_RETENTION_MONTHS = 16;
|
|
685
814
|
/** Today's date (YYYY-MM-DD) in PST. */
|
|
686
815
|
declare function getPstDate(): string;
|
|
687
|
-
/** YYYY-MM-DD for `now() - n` days, UTC. */
|
|
688
|
-
declare function daysAgo(n: number): string;
|
|
689
816
|
/** Most recent finalized date (3 days ago PST). */
|
|
690
817
|
declare function getLatestGscDate(): string;
|
|
691
818
|
/** Freshest date GSC will return (yesterday PST, may still update). */
|
|
@@ -834,14 +961,12 @@ declare function findBestGscProperty<T extends GscPropertyCandidate>(targetDomai
|
|
|
834
961
|
};
|
|
835
962
|
declare function findExactGscProperty<T extends GscPropertyCandidate>(propertyUrl: string, properties: readonly T[]): T | null;
|
|
836
963
|
declare function formatGscPropertyCandidates(candidates: ReadonlyArray<GscPropertyCandidate | null | undefined>): string;
|
|
837
|
-
declare const URL_INSPECTION_DAILY_LIMIT = 2000;
|
|
838
964
|
declare const URL_INSPECTION_EFFECTIVE_LIMIT = 1800;
|
|
839
965
|
type GoogleScopesInput$1 = string | readonly string[] | null | undefined;
|
|
840
966
|
declare const GSC_READ_SCOPE: "https://www.googleapis.com/auth/webmasters.readonly";
|
|
841
967
|
declare const GSC_WRITE_SCOPE: "https://www.googleapis.com/auth/webmasters";
|
|
842
968
|
declare const GSC_INDEXING_SCOPE: "https://www.googleapis.com/auth/indexing";
|
|
843
969
|
declare const GSC_SITE_VERIFICATION_SCOPE: "https://www.googleapis.com/auth/siteverification";
|
|
844
|
-
declare function parseGoogleScopes(scopes: GoogleScopesInput$1): string[];
|
|
845
970
|
declare function hasGoogleScope(scopes: GoogleScopesInput$1, scope: string): boolean;
|
|
846
971
|
type GoogleScopesInput = string | readonly string[] | null | undefined;
|
|
847
972
|
declare function hasGscReadScope(scopes: GoogleScopesInput): boolean;
|
|
@@ -922,4 +1047,4 @@ declare function normalizeSiteUrl(siteUrl: string): string;
|
|
|
922
1047
|
* Example: `https://www.Example.com/Foo/` → `example.com/foo`
|
|
923
1048
|
*/
|
|
924
1049
|
declare function urlMatchKey(url: string): string | null;
|
|
925
|
-
export { type AccountNextAction, type AccountStatus, type AnalyticsNextAction, type AnalyticsStatus, ApiSite, ApiSitemap, ApiSitemapContent, Auth, AuthClient, AuthOptions, BackfillProgress, CallOptions, DAYS_PER_RANGE, DataRow, DimensionFilter, DimensionFilterGroup, DiscoverSitemapOptions, Err, FetchSitemapUrlsOptions, FetchSitesWithSitemapsOptions, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSCDUMP_WRITE_ANALYTICS_SCOPE, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_INDEXING_SCOPE,
|
|
1050
|
+
export { type AccountNextAction, type AccountStatus, AmpInspectionResult, AmpIssue, type AnalyticsNextAction, type AnalyticsStatus, ApiSite, ApiSitemap, ApiSitemapContent, Auth, AuthClient, AuthOptions, type BackfillProgress, BatchInspectUrlsFlatSettledOptions, CallOptions, DAYS_PER_RANGE, DEFAULT_GSC_REQUEST_TIMEOUT_MS, DataRow, DimensionFilter, DimensionFilterGroup, DiscoverSitemapOptions, Err, FetchSitemapUrlsOptions, FetchSitesWithSitemapsOptions, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSCDUMP_WRITE_ANALYTICS_SCOPE, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_INDEXING_SCOPE, GSC_READ_SCOPE, GSC_RETENTION_MONTHS, GSC_SITE_VERIFICATION_SCOPE, GSC_WRITE_SCOPE, GoogleSearchConsoleClient, GoogleSearchConsoleClientOptions, GscApiError, type GscApiErrorInfo, type GscError, type GscErrorKind, GscPropertyCandidate, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, IndexStatusResult, IndexingEligibility, IndexingIneligibleReason, IndexingIssueType, IndexingMetadata, type IndexingNextAction, IndexingNotificationType, IndexingResult, type IndexingStatus, InspectUrlFlatSettledResult, InspectUrlIndexResponse, InspectUrlResult, InspectionPriority, KNOWN_COVERAGE_STATES, KNOWN_PAGE_FETCH_STATES, type LifecycleError, type LifecycleErrorCode, type LifecycleProgress, type LifecycleWebhookEnvelope, type LifecycleWebhookEvent, MAX_FLAT_INSPECTION_BATCH_CONCURRENCY, MS_PER_DAY, MobileUsabilityIssue, MobileUsabilityResult, OAuthTokenInfo, OAuthTokens, Ok, ParsedGscSiteUrl, ParsedIndexingResult, type PartnerLifecycleAccount, type PartnerLifecycleResponse, type PartnerLifecycleSite, Period, type PropertyNextAction, type PropertyStatus, PublishUrlNotificationResponse, QueryReturn, type QuerySourceMode, RequiredNonNullable, ResolvedAnalyticsRange, Result, RichResultsDetectedItem, RichResultsIssue, RichResultsItem, RichResultsResult, SearchAnalyticsMetadata, SearchAnalyticsQuery, SearchAnalyticsResponse, Site, SiteAnalytics, type SitemapNextAction, type SitemapStatus, URL_INSPECTION_EFFECTIVE_LIMIT, UnmappedInspectionReasons, UrlInspectionResult, UrlNotification, UrlNotificationMetadata, VerificationMethod, VerificationSite, VerificationSiteType, VerificationToken, VerificationWebResource, accountNextActions, accountStatuses, addDays, addSite, analyticsNextActions, analyticsStatuses, batchInspectUrls, batchInspectUrlsFlatSettled, batchRequestIndexing, canUseUrlInspection, classifyError, countDays, createAuth, createFetch, decodeSiteId, deleteSite, deleteSitemap, discoverSitemap, encodeSiteId, err, exchangeAuthCodeResult, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, findBestGscProperty, findExactGscProperty, formatGscPropertyCandidates, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingEligibility, getIndexingMetadata, getLatestGscDate, getNextCheckAfter, getNextCheckPriority, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, groupIntoRanges, gscErrorToException, gscPropertyMatchesTarget, hasGoogleScope, hasGscReadScope, hasGscWriteScope, hasIndexingScope, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, inspectUrl, inspectUrlFlat, introspectAccessToken, introspectAccessTokenResult, isErr, isOk, isPermissionDeniedError, isValidGscDate, isVerifiedGscPermission, isVerifiedGscProperty, lifecycleErrorCodes, listVerifiedSites, matchGscSite, normalizeGscSiteUrl, normalizeRegistrationTarget, normalizeSiteUrl, normalizeUrl, ok, parseGoogleError, parseGrantedScopes, parseGscSiteUrl, pickBestGscProperty, propertyNextActions, propertyStatuses, querySourceModes, refreshAccessToken, requestIndexing, resolveVerificationTarget, rethrowAsGscApiError, revokeOAuthToken, revokeOAuthTokenResult, runSequentialBatch, siteUrlToVerificationSite, sitemapNextActions, sitemapStatuses, submitSitemap, toIsoDate, unmappedInspectionReasons, unverifySite, unwrapResult, urlMatchKey, verificationMethodsFor, verifySite };
|