gscdump 0.32.12 → 0.33.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.mts +12 -4
- package/dist/api/index.mjs +15 -13
- package/dist/index.d.mts +16 -7
- package/dist/index.mjs +20 -18
- package/package.json +2 -2
package/dist/api/index.d.mts
CHANGED
|
@@ -439,9 +439,17 @@ declare function findExactGscProperty<T extends GscPropertyCandidate>(propertyUr
|
|
|
439
439
|
declare function formatGscPropertyCandidates(candidates: ReadonlyArray<GscPropertyCandidate | null | undefined>): string;
|
|
440
440
|
declare const URL_INSPECTION_DAILY_LIMIT = 2000;
|
|
441
441
|
declare const URL_INSPECTION_EFFECTIVE_LIMIT = 1800;
|
|
442
|
-
|
|
443
|
-
declare
|
|
444
|
-
declare
|
|
442
|
+
type GoogleScopesInput$1 = string | readonly string[] | null | undefined;
|
|
443
|
+
declare const GSC_READ_SCOPE: "https://www.googleapis.com/auth/webmasters.readonly";
|
|
444
|
+
declare const GSC_WRITE_SCOPE: "https://www.googleapis.com/auth/webmasters";
|
|
445
|
+
declare const GSC_INDEXING_SCOPE: "https://www.googleapis.com/auth/indexing";
|
|
446
|
+
declare const GSC_SITE_VERIFICATION_SCOPE: "https://www.googleapis.com/auth/siteverification";
|
|
447
|
+
declare function parseGoogleScopes(scopes: GoogleScopesInput$1): string[];
|
|
448
|
+
declare function hasGoogleScope(scopes: GoogleScopesInput$1, scope: string): boolean;
|
|
449
|
+
type GoogleScopesInput = string | readonly string[] | null | undefined;
|
|
450
|
+
declare function hasGscReadScope(scopes: GoogleScopesInput): boolean;
|
|
451
|
+
declare function hasGscWriteScope(scopes: GoogleScopesInput): boolean;
|
|
452
|
+
declare function hasIndexingScope(scopes: GoogleScopesInput): boolean;
|
|
445
453
|
interface ParsedGscSiteUrl {
|
|
446
454
|
/** Original, canonical GSC property URL. */
|
|
447
455
|
label: string;
|
|
@@ -722,4 +730,4 @@ declare function getVerifiedSite(client: GoogleSearchConsoleClient, id: string):
|
|
|
722
730
|
* on the property are unaffected.
|
|
723
731
|
*/
|
|
724
732
|
declare function unverifySite(client: GoogleSearchConsoleClient, id: string): Promise<void>;
|
|
725
|
-
export { ApiSite, ApiSitemap, ApiSitemapContent, Auth, AuthClient, AuthOptions, CallOptions, DataRow, DimensionFilter, DimensionFilterGroup, DiscoverSitemapOptions, FetchSitemapUrlsOptions, GSC_QUOTAS, GoogleSearchConsoleClient, GoogleSearchConsoleClientOptions, GscApiError, GscApiErrorInfo, GscError, GscErrorKind, GscPropertyCandidate, GscdumpApiOptions, IndexStatusResult, IndexingEligibility, IndexingIneligibleReason, IndexingMetadata, IndexingNotificationType, IndexingResult, InspectUrlIndexResponse, InspectUrlResult, InspectionPriority, MobileUsabilityResult, OAuthTokens, ParsedGscSiteUrl, ParsedIndexingResult, Period, PublishUrlNotificationResponse, QueryReturn, RequiredNonNullable, ResolvedAnalyticsRange, RichResultsResult, SearchAnalyticsQuery, SearchAnalyticsResponse, Site, SiteAnalytics, URL_INSPECTION_DAILY_LIMIT, URL_INSPECTION_EFFECTIVE_LIMIT, UrlInspectionResult, UrlNotificationMetadata, VerificationMethod, VerificationSite, VerificationSiteType, VerificationToken, VerificationWebResource, addSite, batchInspectUrls, batchRequestIndexing, canUseUrlInspection, classifyError, createAuth, createFetch, deleteSite, deleteSitemap, discoverSitemap, exchangeAuthCode, exchangeAuthCodeResult, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, findBestGscProperty, findExactGscProperty, formatErrorForCli, formatGscPropertyCandidates, getIndexingEligibility, getIndexingMetadata, getNextCheckAfter, getNextCheckPriority, getVerificationToken, getVerifiedSite, googleSearchConsole, grantedScopeList, gscErrorToException, gscPropertyMatchesTarget, gscdumpApi, hasGscReadScope, hasGscWriteScope, hasIndexingScope, inspectUrl, inspectUrlFlat, isPermissionDeniedError, isVerifiedGscPermission, isVerifiedGscProperty, listVerifiedSites, matchGscSite, normalizeGscSiteUrl, normalizeRegistrationTarget, parseGoogleError, parseGscSiteUrl, pickBestGscProperty, refreshAccessToken, refreshAccessTokenResult, requestIndexing, rethrowAsGscApiError, runSequentialBatch, siteUrlToVerificationSite, storageError, submitSitemap, unverifySite, urlMatchKey, verificationMethodsFor, verifySite };
|
|
733
|
+
export { ApiSite, ApiSitemap, ApiSitemapContent, Auth, AuthClient, AuthOptions, CallOptions, DataRow, DimensionFilter, DimensionFilterGroup, DiscoverSitemapOptions, FetchSitemapUrlsOptions, GSC_INDEXING_SCOPE, GSC_QUOTAS, GSC_READ_SCOPE, GSC_SITE_VERIFICATION_SCOPE, GSC_WRITE_SCOPE, GoogleSearchConsoleClient, GoogleSearchConsoleClientOptions, GscApiError, GscApiErrorInfo, GscError, GscErrorKind, GscPropertyCandidate, GscdumpApiOptions, IndexStatusResult, IndexingEligibility, IndexingIneligibleReason, IndexingMetadata, IndexingNotificationType, IndexingResult, InspectUrlIndexResponse, InspectUrlResult, InspectionPriority, MobileUsabilityResult, OAuthTokens, ParsedGscSiteUrl, ParsedIndexingResult, Period, PublishUrlNotificationResponse, QueryReturn, RequiredNonNullable, ResolvedAnalyticsRange, RichResultsResult, SearchAnalyticsQuery, SearchAnalyticsResponse, Site, SiteAnalytics, URL_INSPECTION_DAILY_LIMIT, URL_INSPECTION_EFFECTIVE_LIMIT, UrlInspectionResult, UrlNotificationMetadata, VerificationMethod, VerificationSite, VerificationSiteType, VerificationToken, VerificationWebResource, addSite, batchInspectUrls, batchRequestIndexing, canUseUrlInspection, classifyError, createAuth, createFetch, deleteSite, deleteSitemap, discoverSitemap, exchangeAuthCode, exchangeAuthCodeResult, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, findBestGscProperty, findExactGscProperty, formatErrorForCli, formatGscPropertyCandidates, getIndexingEligibility, getIndexingMetadata, getNextCheckAfter, getNextCheckPriority, getVerificationToken, getVerifiedSite, googleSearchConsole, grantedScopeList, gscErrorToException, gscPropertyMatchesTarget, gscdumpApi, hasGoogleScope, hasGscReadScope, hasGscWriteScope, hasIndexingScope, inspectUrl, inspectUrlFlat, isPermissionDeniedError, isVerifiedGscPermission, isVerifiedGscProperty, listVerifiedSites, matchGscSite, normalizeGscSiteUrl, normalizeRegistrationTarget, parseGoogleError, parseGoogleScopes, parseGscSiteUrl, pickBestGscProperty, refreshAccessToken, refreshAccessTokenResult, requestIndexing, rethrowAsGscApiError, runSequentialBatch, siteUrlToVerificationSite, storageError, submitSitemap, unverifySite, urlMatchKey, verificationMethodsFor, verifySite };
|
package/dist/api/index.mjs
CHANGED
|
@@ -1964,12 +1964,12 @@ function createAuth(options) {
|
|
|
1964
1964
|
if (credentials?.access_token && credentials.expiry_date && credentials.expiry_date > Date.now()) return { token: credentials.access_token };
|
|
1965
1965
|
const response = await ofetch("https://oauth2.googleapis.com/token", {
|
|
1966
1966
|
method: "POST",
|
|
1967
|
-
body: {
|
|
1967
|
+
body: new URLSearchParams({
|
|
1968
1968
|
client_id: options.clientId,
|
|
1969
1969
|
client_secret: options.clientSecret,
|
|
1970
1970
|
refresh_token: options.refreshToken,
|
|
1971
1971
|
grant_type: "refresh_token"
|
|
1972
|
-
}
|
|
1972
|
+
})
|
|
1973
1973
|
});
|
|
1974
1974
|
credentials = {
|
|
1975
1975
|
...credentials,
|
|
@@ -2522,26 +2522,28 @@ function formatGscPropertyCandidates(candidates) {
|
|
|
2522
2522
|
}
|
|
2523
2523
|
const URL_INSPECTION_DAILY_LIMIT = 2e3;
|
|
2524
2524
|
const URL_INSPECTION_EFFECTIVE_LIMIT = 1800;
|
|
2525
|
-
const
|
|
2526
|
-
const
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2525
|
+
const GSC_READ_SCOPE = "https://www.googleapis.com/auth/webmasters.readonly";
|
|
2526
|
+
const GSC_WRITE_SCOPE = "https://www.googleapis.com/auth/webmasters";
|
|
2527
|
+
const GSC_INDEXING_SCOPE = "https://www.googleapis.com/auth/indexing";
|
|
2528
|
+
const GSC_SITE_VERIFICATION_SCOPE = "https://www.googleapis.com/auth/siteverification";
|
|
2529
|
+
function parseGoogleScopes(scopes) {
|
|
2529
2530
|
if (!scopes) return [];
|
|
2530
|
-
return scopes.split(/\s+/).filter(Boolean);
|
|
2531
|
+
if (typeof scopes === "string") return scopes.split(/\s+/).map((scope) => scope.trim()).filter(Boolean);
|
|
2532
|
+
return scopes.map((scope) => scope.trim()).filter(Boolean);
|
|
2531
2533
|
}
|
|
2532
|
-
function
|
|
2533
|
-
const tokens =
|
|
2534
|
+
function hasGoogleScope(scopes, scope) {
|
|
2535
|
+
const tokens = parseGoogleScopes(scopes);
|
|
2534
2536
|
const suffix = scope.replace("https://www.googleapis.com/auth/", "");
|
|
2535
2537
|
return tokens.includes(scope) || tokens.includes(suffix);
|
|
2536
2538
|
}
|
|
2537
2539
|
function hasGscReadScope(scopes) {
|
|
2538
|
-
return
|
|
2540
|
+
return hasGoogleScope(scopes, "https://www.googleapis.com/auth/webmasters.readonly") || hasGoogleScope(scopes, "https://www.googleapis.com/auth/webmasters");
|
|
2539
2541
|
}
|
|
2540
2542
|
function hasGscWriteScope(scopes) {
|
|
2541
|
-
return
|
|
2543
|
+
return hasGoogleScope(scopes, GSC_WRITE_SCOPE);
|
|
2542
2544
|
}
|
|
2543
2545
|
function hasIndexingScope(scopes) {
|
|
2544
|
-
return
|
|
2546
|
+
return hasGoogleScope(scopes, GSC_INDEXING_SCOPE);
|
|
2545
2547
|
}
|
|
2546
2548
|
const FETCH_TIMEOUT_MS = 1e4;
|
|
2547
2549
|
const COMMON_PATHS = ["/sitemap.xml", "/sitemap_index.xml"];
|
|
@@ -2926,4 +2928,4 @@ async function getVerifiedSite(client, id) {
|
|
|
2926
2928
|
async function unverifySite(client, id) {
|
|
2927
2929
|
return client.verification.delete(id);
|
|
2928
2930
|
}
|
|
2929
|
-
export { GSC_QUOTAS, GscApiError, URL_INSPECTION_DAILY_LIMIT, URL_INSPECTION_EFFECTIVE_LIMIT, addSite, batchInspectUrls, batchRequestIndexing, canUseUrlInspection, classifyError, createAuth, createFetch, deleteSite, deleteSitemap, discoverSitemap, exchangeAuthCode, exchangeAuthCodeResult, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, findBestGscProperty, findExactGscProperty, formatErrorForCli, formatGscPropertyCandidates, getIndexingEligibility, getIndexingMetadata, getNextCheckAfter, getNextCheckPriority, getVerificationToken, getVerifiedSite, googleSearchConsole, grantedScopeList, gscErrorToException, gscPropertyMatchesTarget, gscdumpApi, hasGscReadScope, hasGscWriteScope, hasIndexingScope, inspectUrl, inspectUrlFlat, isPermissionDeniedError, isVerifiedGscPermission, isVerifiedGscProperty, listVerifiedSites, matchGscSite, normalizeGscSiteUrl, normalizeRegistrationTarget, parseGoogleError, parseGscSiteUrl, pickBestGscProperty, refreshAccessToken, refreshAccessTokenResult, requestIndexing, rethrowAsGscApiError, runSequentialBatch, siteUrlToVerificationSite, storageError, submitSitemap, unverifySite, urlMatchKey, verificationMethodsFor, verifySite };
|
|
2931
|
+
export { GSC_INDEXING_SCOPE, GSC_QUOTAS, GSC_READ_SCOPE, GSC_SITE_VERIFICATION_SCOPE, GSC_WRITE_SCOPE, GscApiError, URL_INSPECTION_DAILY_LIMIT, URL_INSPECTION_EFFECTIVE_LIMIT, addSite, batchInspectUrls, batchRequestIndexing, canUseUrlInspection, classifyError, createAuth, createFetch, deleteSite, deleteSitemap, discoverSitemap, exchangeAuthCode, exchangeAuthCodeResult, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, findBestGscProperty, findExactGscProperty, formatErrorForCli, formatGscPropertyCandidates, getIndexingEligibility, getIndexingMetadata, getNextCheckAfter, getNextCheckPriority, getVerificationToken, getVerifiedSite, googleSearchConsole, grantedScopeList, gscErrorToException, gscPropertyMatchesTarget, gscdumpApi, hasGoogleScope, hasGscReadScope, hasGscWriteScope, hasIndexingScope, inspectUrl, inspectUrlFlat, isPermissionDeniedError, isVerifiedGscPermission, isVerifiedGscProperty, listVerifiedSites, matchGscSite, normalizeGscSiteUrl, normalizeRegistrationTarget, parseGoogleError, parseGoogleScopes, parseGscSiteUrl, pickBestGscProperty, refreshAccessToken, refreshAccessTokenResult, requestIndexing, rethrowAsGscApiError, runSequentialBatch, siteUrlToVerificationSite, storageError, submitSitemap, unverifySite, urlMatchKey, verificationMethodsFor, verifySite };
|
package/dist/index.d.mts
CHANGED
|
@@ -784,9 +784,17 @@ declare function findExactGscProperty<T extends GscPropertyCandidate>(propertyUr
|
|
|
784
784
|
declare function formatGscPropertyCandidates(candidates: ReadonlyArray<GscPropertyCandidate | null | undefined>): string;
|
|
785
785
|
declare const URL_INSPECTION_DAILY_LIMIT = 2000;
|
|
786
786
|
declare const URL_INSPECTION_EFFECTIVE_LIMIT = 1800;
|
|
787
|
-
|
|
788
|
-
declare
|
|
789
|
-
declare
|
|
787
|
+
type GoogleScopesInput$2 = string | readonly string[] | null | undefined;
|
|
788
|
+
declare const GSC_READ_SCOPE: "https://www.googleapis.com/auth/webmasters.readonly";
|
|
789
|
+
declare const GSC_WRITE_SCOPE: "https://www.googleapis.com/auth/webmasters";
|
|
790
|
+
declare const GSC_INDEXING_SCOPE: "https://www.googleapis.com/auth/indexing";
|
|
791
|
+
declare const GSC_SITE_VERIFICATION_SCOPE: "https://www.googleapis.com/auth/siteverification";
|
|
792
|
+
declare function parseGoogleScopes(scopes: GoogleScopesInput$2): string[];
|
|
793
|
+
declare function hasGoogleScope(scopes: GoogleScopesInput$2, scope: string): boolean;
|
|
794
|
+
type GoogleScopesInput$1 = string | readonly string[] | null | undefined;
|
|
795
|
+
declare function hasGscReadScope(scopes: GoogleScopesInput$1): boolean;
|
|
796
|
+
declare function hasGscWriteScope(scopes: GoogleScopesInput$1): boolean;
|
|
797
|
+
declare function hasIndexingScope(scopes: GoogleScopesInput$1): boolean;
|
|
790
798
|
interface ParsedGscSiteUrl {
|
|
791
799
|
/** Original, canonical GSC property URL. */
|
|
792
800
|
label: string;
|
|
@@ -812,6 +820,7 @@ declare function normalizeGscSiteUrl(siteUrl: string): string;
|
|
|
812
820
|
*/
|
|
813
821
|
declare function normalizeRegistrationTarget(inputUrl: string): string | null;
|
|
814
822
|
declare function normalizeUrl(input: string): string;
|
|
823
|
+
type GoogleScopesInput = string | readonly string[] | null | undefined;
|
|
815
824
|
declare const GSCDUMP_ONBOARDING_CONTRACT_VERSION: "2026-05-11";
|
|
816
825
|
declare const GSCDUMP_REQUIRED_ANALYTICS_SCOPE: "https://www.googleapis.com/auth/webmasters.readonly";
|
|
817
826
|
declare const GSCDUMP_OPTIONAL_INDEXING_SCOPE: "https://www.googleapis.com/auth/indexing";
|
|
@@ -915,9 +924,9 @@ interface LifecycleWebhookEnvelope<TData extends Record<string, unknown> = Recor
|
|
|
915
924
|
occurredAt: string;
|
|
916
925
|
data: TData;
|
|
917
926
|
}
|
|
918
|
-
declare function parseGrantedScopes(scopes:
|
|
919
|
-
declare function hasRequiredAnalyticsScope(scopes:
|
|
920
|
-
declare function hasOptionalIndexingScope(scopes:
|
|
927
|
+
declare function parseGrantedScopes(scopes: GoogleScopesInput): string[];
|
|
928
|
+
declare function hasRequiredAnalyticsScope(scopes: GoogleScopesInput): boolean;
|
|
929
|
+
declare function hasOptionalIndexingScope(scopes: GoogleScopesInput): boolean;
|
|
921
930
|
interface DiscoverSitemapOptions {
|
|
922
931
|
/** User-Agent sent on the discovery requests. */
|
|
923
932
|
userAgent?: string;
|
|
@@ -968,4 +977,4 @@ declare function normalizeSiteUrl(siteUrl: string): string;
|
|
|
968
977
|
* Example: `https://www.Example.com/Foo/` → `example.com/foo`
|
|
969
978
|
*/
|
|
970
979
|
declare function urlMatchKey(url: string): string | null;
|
|
971
|
-
export { AccountNextAction, AccountStatus, AnalyticsNextAction, AnalyticsStatus, ApiSite, ApiSitemap, ApiSitemapContent, Auth, AuthClient, AuthOptions, BackfillProgress, CallOptions, DAYS_PER_RANGE, DataRow, DimensionFilter, DimensionFilterGroup, DiscoverSitemapOptions, Err, FetchSitemapUrlsOptions, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_QUOTAS, GSC_RETENTION_MONTHS, GoogleSearchConsoleClient, GoogleSearchConsoleClientOptions, GscApiError, GscApiErrorInfo, GscError, GscErrorKind, GscPropertyCandidate, GscdumpApiOptions, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, IndexStatusResult, IndexingEligibility, IndexingIneligibleReason, IndexingIssueType, IndexingMetadata, IndexingNextAction, IndexingNotificationType, IndexingResult, IndexingStatus, InspectUrlIndexResponse, InspectUrlResult, InspectionPriority, LifecycleError, LifecycleErrorCode, LifecycleProgress, LifecycleWebhookEnvelope, LifecycleWebhookEvent, MS_PER_DAY, MobileUsabilityResult, OAuthTokens, Ok, ParsedGscSiteUrl, ParsedIndexingResult, PartnerLifecycleAccount, PartnerLifecycleResponse, PartnerLifecycleSite, Period, PropertyNextAction, PropertyStatus, PublishUrlNotificationResponse, QueryReturn, QuerySourceMode, RequiredNonNullable, ResolvedAnalyticsRange, Result, RichResultsResult, SearchAnalyticsQuery, SearchAnalyticsResponse, Site, SiteAnalytics, SitemapNextAction, SitemapStatus, URL_INSPECTION_DAILY_LIMIT, URL_INSPECTION_EFFECTIVE_LIMIT, UrlInspectionResult, UrlNotificationMetadata, VerificationMethod, VerificationSite, VerificationSiteType, VerificationToken, VerificationWebResource, accountNextActions, accountStatuses, addDays, addSite, analyticsNextActions, analyticsStatuses, batchInspectUrls, batchRequestIndexing, canUseUrlInspection, classifyError, countDays, createAuth, createFetch, daysAgo, decodeSiteId, deleteSite, deleteSitemap, discoverSitemap, encodeSiteId, err, exchangeAuthCode, exchangeAuthCodeResult, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, findBestGscProperty, findExactGscProperty, formatErrorForCli, formatGscPropertyCandidates, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingEligibility, getIndexingMetadata, getLatestGscDate, getNextCheckAfter, getNextCheckPriority, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, grantedScopeList, groupIntoRanges, gscErrorToException, gscPropertyMatchesTarget, gscdumpApi, hasGscReadScope, hasGscWriteScope, hasIndexingScope, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, inspectUrl, inspectUrlFlat, isErr, isOk, isPermissionDeniedError, isValidGscDate, isVerifiedGscPermission, isVerifiedGscProperty, lifecycleErrorCodes, lifecycleWebhookEvents, listVerifiedSites, mapErr, mapResult, matchGscSite, matchResult, normalizeGscSiteUrl, normalizeRegistrationTarget, normalizeSiteUrl, normalizeUrl, ok, parseGoogleError, parseGrantedScopes, parseGscSiteUrl, pickBestGscProperty, progressBar, propertyNextActions, propertyStatuses, querySourceModes, refreshAccessToken, refreshAccessTokenResult, requestIndexing, rethrowAsGscApiError, rowWithMetricDefaults, runSequentialBatch, siteUrlToVerificationSite, sitemapNextActions, sitemapStatuses, storageError, submitSitemap, toIsoDate, unverifySite, unwrapResult, urlMatchKey, verificationMethodsFor, verifySite };
|
|
980
|
+
export { AccountNextAction, AccountStatus, AnalyticsNextAction, AnalyticsStatus, ApiSite, ApiSitemap, ApiSitemapContent, Auth, AuthClient, AuthOptions, BackfillProgress, CallOptions, DAYS_PER_RANGE, DataRow, DimensionFilter, DimensionFilterGroup, DiscoverSitemapOptions, Err, FetchSitemapUrlsOptions, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_INDEXING_SCOPE, GSC_QUOTAS, GSC_READ_SCOPE, GSC_RETENTION_MONTHS, GSC_SITE_VERIFICATION_SCOPE, GSC_WRITE_SCOPE, GoogleSearchConsoleClient, GoogleSearchConsoleClientOptions, GscApiError, GscApiErrorInfo, GscError, GscErrorKind, GscPropertyCandidate, GscdumpApiOptions, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, IndexStatusResult, IndexingEligibility, IndexingIneligibleReason, IndexingIssueType, IndexingMetadata, IndexingNextAction, IndexingNotificationType, IndexingResult, IndexingStatus, InspectUrlIndexResponse, InspectUrlResult, InspectionPriority, LifecycleError, LifecycleErrorCode, LifecycleProgress, LifecycleWebhookEnvelope, LifecycleWebhookEvent, MS_PER_DAY, MobileUsabilityResult, OAuthTokens, Ok, ParsedGscSiteUrl, ParsedIndexingResult, PartnerLifecycleAccount, PartnerLifecycleResponse, PartnerLifecycleSite, Period, PropertyNextAction, PropertyStatus, PublishUrlNotificationResponse, QueryReturn, QuerySourceMode, RequiredNonNullable, ResolvedAnalyticsRange, Result, RichResultsResult, SearchAnalyticsQuery, SearchAnalyticsResponse, Site, SiteAnalytics, SitemapNextAction, SitemapStatus, URL_INSPECTION_DAILY_LIMIT, URL_INSPECTION_EFFECTIVE_LIMIT, UrlInspectionResult, UrlNotificationMetadata, VerificationMethod, VerificationSite, VerificationSiteType, VerificationToken, VerificationWebResource, accountNextActions, accountStatuses, addDays, addSite, analyticsNextActions, analyticsStatuses, batchInspectUrls, batchRequestIndexing, canUseUrlInspection, classifyError, countDays, createAuth, createFetch, daysAgo, decodeSiteId, deleteSite, deleteSitemap, discoverSitemap, encodeSiteId, err, exchangeAuthCode, exchangeAuthCodeResult, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, findBestGscProperty, findExactGscProperty, formatErrorForCli, formatGscPropertyCandidates, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingEligibility, getIndexingMetadata, getLatestGscDate, getNextCheckAfter, getNextCheckPriority, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, grantedScopeList, groupIntoRanges, gscErrorToException, gscPropertyMatchesTarget, gscdumpApi, hasGoogleScope, hasGscReadScope, hasGscWriteScope, hasIndexingScope, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, inspectUrl, inspectUrlFlat, isErr, isOk, isPermissionDeniedError, isValidGscDate, isVerifiedGscPermission, isVerifiedGscProperty, lifecycleErrorCodes, lifecycleWebhookEvents, listVerifiedSites, mapErr, mapResult, matchGscSite, matchResult, normalizeGscSiteUrl, normalizeRegistrationTarget, normalizeSiteUrl, normalizeUrl, ok, parseGoogleError, parseGoogleScopes, parseGrantedScopes, parseGscSiteUrl, pickBestGscProperty, progressBar, propertyNextActions, propertyStatuses, querySourceModes, refreshAccessToken, refreshAccessTokenResult, requestIndexing, rethrowAsGscApiError, rowWithMetricDefaults, runSequentialBatch, siteUrlToVerificationSite, sitemapNextActions, sitemapStatuses, storageError, submitSitemap, toIsoDate, unverifySite, unwrapResult, urlMatchKey, verificationMethodsFor, verifySite };
|
package/dist/index.mjs
CHANGED
|
@@ -50,26 +50,28 @@ async function batchRequestIndexing(client, urls, options = {}) {
|
|
|
50
50
|
onProgress
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
53
|
+
const GSC_READ_SCOPE = "https://www.googleapis.com/auth/webmasters.readonly";
|
|
54
|
+
const GSC_WRITE_SCOPE = "https://www.googleapis.com/auth/webmasters";
|
|
55
|
+
const GSC_INDEXING_SCOPE = "https://www.googleapis.com/auth/indexing";
|
|
56
|
+
const GSC_SITE_VERIFICATION_SCOPE = "https://www.googleapis.com/auth/siteverification";
|
|
57
|
+
function parseGoogleScopes(scopes) {
|
|
57
58
|
if (!scopes) return [];
|
|
58
|
-
return scopes.split(/\s+/).filter(Boolean);
|
|
59
|
+
if (typeof scopes === "string") return scopes.split(/\s+/).map((scope) => scope.trim()).filter(Boolean);
|
|
60
|
+
return scopes.map((scope) => scope.trim()).filter(Boolean);
|
|
59
61
|
}
|
|
60
|
-
function
|
|
61
|
-
const tokens =
|
|
62
|
+
function hasGoogleScope(scopes, scope) {
|
|
63
|
+
const tokens = parseGoogleScopes(scopes);
|
|
62
64
|
const suffix = scope.replace("https://www.googleapis.com/auth/", "");
|
|
63
65
|
return tokens.includes(scope) || tokens.includes(suffix);
|
|
64
66
|
}
|
|
65
67
|
function hasGscReadScope(scopes) {
|
|
66
|
-
return
|
|
68
|
+
return hasGoogleScope(scopes, "https://www.googleapis.com/auth/webmasters.readonly") || hasGoogleScope(scopes, "https://www.googleapis.com/auth/webmasters");
|
|
67
69
|
}
|
|
68
70
|
function hasGscWriteScope(scopes) {
|
|
69
|
-
return
|
|
71
|
+
return hasGoogleScope(scopes, GSC_WRITE_SCOPE);
|
|
70
72
|
}
|
|
71
73
|
function hasIndexingScope(scopes) {
|
|
72
|
-
return
|
|
74
|
+
return hasGoogleScope(scopes, GSC_INDEXING_SCOPE);
|
|
73
75
|
}
|
|
74
76
|
async function inspectUrl(client, siteUrl, inspectionUrl) {
|
|
75
77
|
const inspection = (await client.inspect(siteUrl, inspectionUrl)).inspectionResult;
|
|
@@ -2657,12 +2659,12 @@ function createAuth(options) {
|
|
|
2657
2659
|
if (credentials?.access_token && credentials.expiry_date && credentials.expiry_date > Date.now()) return { token: credentials.access_token };
|
|
2658
2660
|
const response = await ofetch("https://oauth2.googleapis.com/token", {
|
|
2659
2661
|
method: "POST",
|
|
2660
|
-
body: {
|
|
2662
|
+
body: new URLSearchParams({
|
|
2661
2663
|
client_id: options.clientId,
|
|
2662
2664
|
client_secret: options.clientSecret,
|
|
2663
2665
|
refresh_token: options.refreshToken,
|
|
2664
2666
|
grant_type: "refresh_token"
|
|
2665
|
-
}
|
|
2667
|
+
})
|
|
2666
2668
|
});
|
|
2667
2669
|
credentials = {
|
|
2668
2670
|
...credentials,
|
|
@@ -3048,8 +3050,8 @@ function safeParse(input) {
|
|
|
3048
3050
|
}
|
|
3049
3051
|
}
|
|
3050
3052
|
const GSCDUMP_ONBOARDING_CONTRACT_VERSION = "2026-05-11";
|
|
3051
|
-
const GSCDUMP_REQUIRED_ANALYTICS_SCOPE =
|
|
3052
|
-
const GSCDUMP_OPTIONAL_INDEXING_SCOPE =
|
|
3053
|
+
const GSCDUMP_REQUIRED_ANALYTICS_SCOPE = GSC_READ_SCOPE;
|
|
3054
|
+
const GSCDUMP_OPTIONAL_INDEXING_SCOPE = GSC_INDEXING_SCOPE;
|
|
3053
3055
|
const accountStatuses = [
|
|
3054
3056
|
"disconnected",
|
|
3055
3057
|
"oauth_received",
|
|
@@ -3160,13 +3162,13 @@ const lifecycleErrorCodes = [
|
|
|
3160
3162
|
"indexing_failed"
|
|
3161
3163
|
];
|
|
3162
3164
|
function parseGrantedScopes(scopes) {
|
|
3163
|
-
return (scopes
|
|
3165
|
+
return parseGoogleScopes(scopes);
|
|
3164
3166
|
}
|
|
3165
3167
|
function hasRequiredAnalyticsScope(scopes) {
|
|
3166
|
-
return (
|
|
3168
|
+
return hasGscReadScope(scopes);
|
|
3167
3169
|
}
|
|
3168
3170
|
function hasOptionalIndexingScope(scopes) {
|
|
3169
|
-
return (
|
|
3171
|
+
return hasIndexingScope(scopes);
|
|
3170
3172
|
}
|
|
3171
3173
|
const FETCH_TIMEOUT_MS = 1e4;
|
|
3172
3174
|
const COMMON_PATHS = ["/sitemap.xml", "/sitemap_index.xml"];
|
|
@@ -3257,4 +3259,4 @@ function urlMatchKey(url) {
|
|
|
3257
3259
|
if (!u) return null;
|
|
3258
3260
|
return [u.hostname.replace(/^www\./, ""), u.pathname.replace(/\/$/, "") || "/"].join("").toLowerCase();
|
|
3259
3261
|
}
|
|
3260
|
-
export { DAYS_PER_RANGE, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_QUOTAS, GSC_RETENTION_MONTHS, GscApiError, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, MS_PER_DAY, URL_INSPECTION_DAILY_LIMIT, URL_INSPECTION_EFFECTIVE_LIMIT, accountNextActions, accountStatuses, addDays, addSite, analyticsNextActions, analyticsStatuses, batchInspectUrls, batchRequestIndexing, canUseUrlInspection, classifyError, countDays, createAuth, createFetch, daysAgo, decodeSiteId, deleteSite, deleteSitemap, discoverSitemap, encodeSiteId, err, exchangeAuthCode, exchangeAuthCodeResult, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, findBestGscProperty, findExactGscProperty, formatErrorForCli, formatGscPropertyCandidates, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingEligibility, getIndexingMetadata, getLatestGscDate, getNextCheckAfter, getNextCheckPriority, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, grantedScopeList, groupIntoRanges, gscErrorToException, gscPropertyMatchesTarget, gscdumpApi, hasGscReadScope, hasGscWriteScope, hasIndexingScope, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, inspectUrl, inspectUrlFlat, isErr, isOk, isPermissionDeniedError, isValidGscDate, isVerifiedGscPermission, isVerifiedGscProperty, lifecycleErrorCodes, lifecycleWebhookEvents, listVerifiedSites, mapErr, mapResult, matchGscSite, matchResult, normalizeGscSiteUrl, normalizeRegistrationTarget, normalizeSiteUrl, normalizeUrl, ok, parseGoogleError, parseGrantedScopes, parseGscSiteUrl, pickBestGscProperty, progressBar, propertyNextActions, propertyStatuses, querySourceModes, refreshAccessToken, refreshAccessTokenResult, requestIndexing, rethrowAsGscApiError, rowWithMetricDefaults, runSequentialBatch, siteUrlToVerificationSite, sitemapNextActions, sitemapStatuses, storageError, submitSitemap, toIsoDate, unverifySite, unwrapResult, urlMatchKey, verificationMethodsFor, verifySite };
|
|
3262
|
+
export { DAYS_PER_RANGE, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_INDEXING_SCOPE, GSC_QUOTAS, GSC_READ_SCOPE, GSC_RETENTION_MONTHS, GSC_SITE_VERIFICATION_SCOPE, GSC_WRITE_SCOPE, GscApiError, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, MS_PER_DAY, URL_INSPECTION_DAILY_LIMIT, URL_INSPECTION_EFFECTIVE_LIMIT, accountNextActions, accountStatuses, addDays, addSite, analyticsNextActions, analyticsStatuses, batchInspectUrls, batchRequestIndexing, canUseUrlInspection, classifyError, countDays, createAuth, createFetch, daysAgo, decodeSiteId, deleteSite, deleteSitemap, discoverSitemap, encodeSiteId, err, exchangeAuthCode, exchangeAuthCodeResult, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, findBestGscProperty, findExactGscProperty, formatErrorForCli, formatGscPropertyCandidates, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingEligibility, getIndexingMetadata, getLatestGscDate, getNextCheckAfter, getNextCheckPriority, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, grantedScopeList, groupIntoRanges, gscErrorToException, gscPropertyMatchesTarget, gscdumpApi, hasGoogleScope, hasGscReadScope, hasGscWriteScope, hasIndexingScope, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, inspectUrl, inspectUrlFlat, isErr, isOk, isPermissionDeniedError, isValidGscDate, isVerifiedGscPermission, isVerifiedGscProperty, lifecycleErrorCodes, lifecycleWebhookEvents, listVerifiedSites, mapErr, mapResult, matchGscSite, matchResult, normalizeGscSiteUrl, normalizeRegistrationTarget, normalizeSiteUrl, normalizeUrl, ok, parseGoogleError, parseGoogleScopes, parseGrantedScopes, parseGscSiteUrl, pickBestGscProperty, progressBar, propertyNextActions, propertyStatuses, querySourceModes, refreshAccessToken, refreshAccessTokenResult, requestIndexing, rethrowAsGscApiError, rowWithMetricDefaults, runSequentialBatch, siteUrlToVerificationSite, sitemapNextActions, sitemapStatuses, storageError, submitSitemap, toIsoDate, unverifySite, unwrapResult, urlMatchKey, verificationMethodsFor, verifySite };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gscdump",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.33.3",
|
|
5
5
|
"description": "Google Search Console API wrapper with typed query builder, streaming pagination, and SEO analysis functions",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"defu": "^6.1.7",
|
|
99
99
|
"ofetch": "^1.5.1",
|
|
100
100
|
"ufo": "^1.6.4",
|
|
101
|
-
"@gscdump/contracts": "0.
|
|
101
|
+
"@gscdump/contracts": "0.33.3"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@googleapis/indexing": "^6.0.1",
|