gscdump 0.11.3 → 0.11.4

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/index.d.mts CHANGED
@@ -595,6 +595,112 @@ declare const INDEXING_EFFECTIVE_LIMIT = 1800;
595
595
  declare function hasGscReadScope(scopes: string | null | undefined): boolean;
596
596
  declare function hasGscWriteScope(scopes: string | null | undefined): boolean;
597
597
  declare function hasIndexingScope(scopes: string | null | undefined): boolean;
598
+ declare const GSCDUMP_ONBOARDING_CONTRACT_VERSION: "2026-05-11";
599
+ declare const GSCDUMP_REQUIRED_ANALYTICS_SCOPE: "https://www.googleapis.com/auth/webmasters.readonly";
600
+ declare const GSCDUMP_OPTIONAL_INDEXING_SCOPE: "https://www.googleapis.com/auth/indexing";
601
+ declare const accountStatuses: readonly ["disconnected", "oauth_received", "scope_missing", "refresh_missing", "db_provisioning", "ready", "reauth_required"];
602
+ declare const accountNextActions: readonly ["connect_google", "reconnect_google", "wait_for_provisioning", "none"];
603
+ declare const propertyStatuses: readonly ["no_local_site", "no_gsc_property", "unverified_property", "verified_candidate", "registered", "linked"];
604
+ declare const propertyNextActions: readonly ["create_site", "verify_gsc_property", "choose_property", "register_site", "none"];
605
+ declare const analyticsStatuses: readonly ["not_registered", "queued", "preparing", "syncing", "queryable_live", "queryable_partial", "ready", "failed"];
606
+ declare const analyticsNextActions: readonly ["wait_for_sync", "retry_sync", "none"];
607
+ declare const querySourceModes: readonly ["none", "live", "d1", "r2", "mixed"];
608
+ declare const sitemapStatuses: readonly ["unknown", "discovering", "none_found", "auto_submitted", "syncing", "ready", "failed"];
609
+ declare const sitemapNextActions: readonly ["submit_sitemap", "wait_for_sitemaps", "retry_sitemaps", "none"];
610
+ declare const indexingStatuses: readonly ["not_requested", "missing_scope", "insufficient_permission", "waiting_for_sitemaps", "discovering", "checking", "ready", "budget_exhausted", "no_urls", "failed"];
611
+ declare const indexingNextActions: readonly ["reconnect_google", "fix_gsc_permission", "wait_for_sitemaps", "wait_for_indexing", "retry_indexing", "none"];
612
+ declare const lifecycleWebhookEvents: readonly ["user.lifecycle.changed", "site.lifecycle.changed", "site.analytics.ready", "site.indexing.ready", "site.auth.failed", "job.failed"];
613
+ 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"];
614
+ type AccountStatus = typeof accountStatuses[number];
615
+ type AccountNextAction = typeof accountNextActions[number];
616
+ type PropertyStatus = typeof propertyStatuses[number];
617
+ type PropertyNextAction = typeof propertyNextActions[number];
618
+ type AnalyticsStatus = typeof analyticsStatuses[number];
619
+ type AnalyticsNextAction = typeof analyticsNextActions[number];
620
+ type QuerySourceMode = typeof querySourceModes[number];
621
+ type SitemapStatus = typeof sitemapStatuses[number];
622
+ type SitemapNextAction = typeof sitemapNextActions[number];
623
+ type IndexingStatus = typeof indexingStatuses[number];
624
+ type IndexingNextAction = typeof indexingNextActions[number];
625
+ type LifecycleWebhookEvent = typeof lifecycleWebhookEvents[number];
626
+ type LifecycleErrorCode = typeof lifecycleErrorCodes[number];
627
+ interface LifecycleProgress {
628
+ completed: number;
629
+ failed: number;
630
+ total: number;
631
+ percent: number;
632
+ }
633
+ interface LifecycleError {
634
+ code: LifecycleErrorCode;
635
+ message: string;
636
+ retryable: boolean;
637
+ }
638
+ interface PartnerLifecycleAccount {
639
+ status: AccountStatus;
640
+ grantedScopes: string[];
641
+ missingScopes: string[];
642
+ nextAction: AccountNextAction;
643
+ }
644
+ interface PartnerLifecycleSite {
645
+ siteId: string;
646
+ externalSiteId: string | null;
647
+ requestedUrl: string;
648
+ gscPropertyUrl: string | null;
649
+ permissionLevel: string | null;
650
+ property: {
651
+ status: PropertyStatus;
652
+ nextAction: PropertyNextAction;
653
+ };
654
+ analytics: {
655
+ status: AnalyticsStatus;
656
+ progress: LifecycleProgress;
657
+ queryable: boolean;
658
+ sourceMode: QuerySourceMode;
659
+ syncedRange: {
660
+ oldest: string | null;
661
+ newest: string | null;
662
+ };
663
+ nextAction: AnalyticsNextAction;
664
+ };
665
+ sitemaps: {
666
+ status: SitemapStatus;
667
+ discoveredCount: number;
668
+ nextAction: SitemapNextAction;
669
+ };
670
+ indexing: {
671
+ status: IndexingStatus;
672
+ eligible: boolean;
673
+ reason: string | null;
674
+ progress: LifecycleProgress;
675
+ nextAction: IndexingNextAction;
676
+ };
677
+ latestError: LifecycleError | null;
678
+ lifecycleRevision: number;
679
+ updatedAt: string;
680
+ }
681
+ interface PartnerLifecycleResponse {
682
+ contractVersion: typeof GSCDUMP_ONBOARDING_CONTRACT_VERSION;
683
+ userId: string;
684
+ partnerId: string | null;
685
+ account: PartnerLifecycleAccount;
686
+ sites: PartnerLifecycleSite[];
687
+ }
688
+ interface LifecycleWebhookEnvelope<TData extends Record<string, unknown> = Record<string, unknown>> {
689
+ contractVersion: typeof GSCDUMP_ONBOARDING_CONTRACT_VERSION;
690
+ deliveryId: string;
691
+ event: LifecycleWebhookEvent;
692
+ partnerId: string;
693
+ userId: string;
694
+ siteId?: string;
695
+ externalUserId?: string | null;
696
+ externalSiteId?: string | null;
697
+ lifecycleRevision: number;
698
+ occurredAt: string;
699
+ data: TData;
700
+ }
701
+ declare function parseGrantedScopes(scopes: string | null | undefined): string[];
702
+ declare function hasRequiredAnalyticsScope(scopes: string | string[] | null | undefined): boolean;
703
+ declare function hasOptionalIndexingScope(scopes: string | string[] | null | undefined): boolean;
598
704
  interface DiscoverSitemapOptions {
599
705
  /** User-Agent sent on the discovery requests. */
600
706
  userAgent?: string;
@@ -620,4 +726,4 @@ interface FetchSitemapUrlsOptions extends DiscoverSitemapOptions {
620
726
  * `<loc>https://...</loc>` shape but doesn't validate the schema.
621
727
  */
622
728
  declare function fetchSitemapUrls(sitemapUrl: string, options?: FetchSitemapUrlsOptions): Promise<string[]>;
623
- export { ApiSite, ApiSitemap, ApiSitemapContent, Auth, AuthClient, AuthOptions, BackfillProgress, CallOptions, DAYS_PER_RANGE, DataRow, DimensionFilter, DimensionFilterGroup, DiscoverSitemapOptions, FetchSitemapUrlsOptions, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_QUOTAS, GSC_RETENTION_MONTHS, GoogleSearchConsoleClient, GoogleSearchConsoleClientOptions, GscError, GscErrorKind, GscdumpApiOptions, INDEXING_DAILY_LIMIT, INDEXING_EFFECTIVE_LIMIT, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, IndexStatusResult, IndexingIssueType, IndexingMetadata, IndexingNotificationType, IndexingResult, InspectUrlIndexResponse, InspectUrlResult, MS_PER_DAY, MobileUsabilityResult, Period, PublishUrlNotificationResponse, RequiredNonNullable, ResolvedAnalyticsRange, RichResultsResult, SearchAnalyticsQuery, SearchAnalyticsResponse, Site, SiteAnalytics, UrlInspectionResult, UrlNotificationMetadata, VerificationMethod, VerificationSite, VerificationSiteType, VerificationToken, VerificationWebResource, addDays, addSite, batchInspectUrls, batchRequestIndexing, classifyError, countDays, createAuth, createFetch, daysAgo, deleteSite, deleteSitemap, discoverSitemap, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, formatErrorForCli, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingMetadata, getLatestGscDate, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, groupIntoRanges, gscdumpApi, hasGscReadScope, hasGscWriteScope, hasIndexingScope, inspectUrl, isPermissionDeniedError, isValidGscDate, listVerifiedSites, progressBar, requestIndexing, rowWithMetricDefaults, runSequentialBatch, siteUrlToVerificationSite, storageError, submitSitemap, toIsoDate, unverifySite, verificationMethodsFor, verifySite };
729
+ export { AccountNextAction, AccountStatus, AnalyticsNextAction, AnalyticsStatus, ApiSite, ApiSitemap, ApiSitemapContent, Auth, AuthClient, AuthOptions, BackfillProgress, CallOptions, DAYS_PER_RANGE, DataRow, DimensionFilter, DimensionFilterGroup, DiscoverSitemapOptions, 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, GscError, GscErrorKind, GscdumpApiOptions, INDEXING_DAILY_LIMIT, INDEXING_EFFECTIVE_LIMIT, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, IndexStatusResult, IndexingIssueType, IndexingMetadata, IndexingNextAction, IndexingNotificationType, IndexingResult, IndexingStatus, InspectUrlIndexResponse, InspectUrlResult, LifecycleError, LifecycleErrorCode, LifecycleProgress, LifecycleWebhookEnvelope, LifecycleWebhookEvent, MS_PER_DAY, MobileUsabilityResult, PartnerLifecycleAccount, PartnerLifecycleResponse, PartnerLifecycleSite, Period, PropertyNextAction, PropertyStatus, PublishUrlNotificationResponse, QuerySourceMode, RequiredNonNullable, ResolvedAnalyticsRange, RichResultsResult, SearchAnalyticsQuery, SearchAnalyticsResponse, Site, SiteAnalytics, SitemapNextAction, SitemapStatus, UrlInspectionResult, UrlNotificationMetadata, VerificationMethod, VerificationSite, VerificationSiteType, VerificationToken, VerificationWebResource, accountNextActions, accountStatuses, addDays, addSite, analyticsNextActions, analyticsStatuses, batchInspectUrls, batchRequestIndexing, classifyError, countDays, createAuth, createFetch, daysAgo, deleteSite, deleteSitemap, discoverSitemap, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, formatErrorForCli, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingMetadata, getLatestGscDate, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, groupIntoRanges, gscdumpApi, hasGscReadScope, hasGscWriteScope, hasIndexingScope, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, inspectUrl, isPermissionDeniedError, isValidGscDate, lifecycleErrorCodes, lifecycleWebhookEvents, listVerifiedSites, parseGrantedScopes, progressBar, propertyNextActions, propertyStatuses, querySourceModes, requestIndexing, rowWithMetricDefaults, runSequentialBatch, siteUrlToVerificationSite, sitemapNextActions, sitemapStatuses, storageError, submitSitemap, toIsoDate, unverifySite, verificationMethodsFor, verifySite };
package/dist/index.mjs CHANGED
@@ -929,6 +929,127 @@ function hasIndexingScope(scopes) {
929
929
  if (!scopes) return false;
930
930
  return scopes.includes("googleapis.com/auth/indexing");
931
931
  }
932
+ const GSCDUMP_ONBOARDING_CONTRACT_VERSION = "2026-05-11";
933
+ const GSCDUMP_REQUIRED_ANALYTICS_SCOPE = "https://www.googleapis.com/auth/webmasters.readonly";
934
+ const GSCDUMP_OPTIONAL_INDEXING_SCOPE = "https://www.googleapis.com/auth/indexing";
935
+ const accountStatuses = [
936
+ "disconnected",
937
+ "oauth_received",
938
+ "scope_missing",
939
+ "refresh_missing",
940
+ "db_provisioning",
941
+ "ready",
942
+ "reauth_required"
943
+ ];
944
+ const accountNextActions = [
945
+ "connect_google",
946
+ "reconnect_google",
947
+ "wait_for_provisioning",
948
+ "none"
949
+ ];
950
+ const propertyStatuses = [
951
+ "no_local_site",
952
+ "no_gsc_property",
953
+ "unverified_property",
954
+ "verified_candidate",
955
+ "registered",
956
+ "linked"
957
+ ];
958
+ const propertyNextActions = [
959
+ "create_site",
960
+ "verify_gsc_property",
961
+ "choose_property",
962
+ "register_site",
963
+ "none"
964
+ ];
965
+ const analyticsStatuses = [
966
+ "not_registered",
967
+ "queued",
968
+ "preparing",
969
+ "syncing",
970
+ "queryable_live",
971
+ "queryable_partial",
972
+ "ready",
973
+ "failed"
974
+ ];
975
+ const analyticsNextActions = [
976
+ "wait_for_sync",
977
+ "retry_sync",
978
+ "none"
979
+ ];
980
+ const querySourceModes = [
981
+ "none",
982
+ "live",
983
+ "d1",
984
+ "r2",
985
+ "mixed"
986
+ ];
987
+ const sitemapStatuses = [
988
+ "unknown",
989
+ "discovering",
990
+ "none_found",
991
+ "auto_submitted",
992
+ "syncing",
993
+ "ready",
994
+ "failed"
995
+ ];
996
+ const sitemapNextActions = [
997
+ "submit_sitemap",
998
+ "wait_for_sitemaps",
999
+ "retry_sitemaps",
1000
+ "none"
1001
+ ];
1002
+ const indexingStatuses = [
1003
+ "not_requested",
1004
+ "missing_scope",
1005
+ "insufficient_permission",
1006
+ "waiting_for_sitemaps",
1007
+ "discovering",
1008
+ "checking",
1009
+ "ready",
1010
+ "budget_exhausted",
1011
+ "no_urls",
1012
+ "failed"
1013
+ ];
1014
+ const indexingNextActions = [
1015
+ "reconnect_google",
1016
+ "fix_gsc_permission",
1017
+ "wait_for_sitemaps",
1018
+ "wait_for_indexing",
1019
+ "retry_indexing",
1020
+ "none"
1021
+ ];
1022
+ const lifecycleWebhookEvents = [
1023
+ "user.lifecycle.changed",
1024
+ "site.lifecycle.changed",
1025
+ "site.analytics.ready",
1026
+ "site.indexing.ready",
1027
+ "site.auth.failed",
1028
+ "job.failed"
1029
+ ];
1030
+ const lifecycleErrorCodes = [
1031
+ "missing_refresh_token",
1032
+ "missing_analytics_scope",
1033
+ "missing_indexing_scope",
1034
+ "token_refresh_failed",
1035
+ "permission_lost",
1036
+ "insufficient_gsc_permission",
1037
+ "gsc_property_not_found",
1038
+ "gsc_property_unverified",
1039
+ "user_database_not_provisioned",
1040
+ "sync_failed",
1041
+ "sitemap_sync_failed",
1042
+ "indexing_failed"
1043
+ ];
1044
+ function parseGrantedScopes(scopes) {
1045
+ return (scopes ?? "").split(/\s+/).map((s) => s.trim()).filter(Boolean);
1046
+ }
1047
+ function hasRequiredAnalyticsScope(scopes) {
1048
+ return (Array.isArray(scopes) ? scopes : parseGrantedScopes(scopes)).includes(GSCDUMP_REQUIRED_ANALYTICS_SCOPE);
1049
+ }
1050
+ function hasOptionalIndexingScope(scopes) {
1051
+ return (Array.isArray(scopes) ? scopes : parseGrantedScopes(scopes)).includes(GSCDUMP_OPTIONAL_INDEXING_SCOPE);
1052
+ }
932
1053
  const FETCH_TIMEOUT_MS = 1e4;
933
1054
  const COMMON_PATHS = ["/sitemap.xml", "/sitemap_index.xml"];
934
1055
  const SITEMAP_DIRECTIVE_RE = /^Sitemap:\s*(\S+)/im;
@@ -996,4 +1117,4 @@ async function fetchSitemapUrls(sitemapUrl, options = {}) {
996
1117
  await visit(sitemapUrl, 0);
997
1118
  return out;
998
1119
  }
999
- export { DAYS_PER_RANGE, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_QUOTAS, GSC_RETENTION_MONTHS, INDEXING_DAILY_LIMIT, INDEXING_EFFECTIVE_LIMIT, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, MS_PER_DAY, addDays, addSite, batchInspectUrls, batchRequestIndexing, classifyError, countDays, createAuth, createFetch, daysAgo, deleteSite, deleteSitemap, discoverSitemap, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, formatErrorForCli, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingMetadata, getLatestGscDate, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, groupIntoRanges, gscdumpApi, hasGscReadScope, hasGscWriteScope, hasIndexingScope, inspectUrl, isPermissionDeniedError, isValidGscDate, listVerifiedSites, progressBar, requestIndexing, rowWithMetricDefaults, runSequentialBatch, siteUrlToVerificationSite, storageError, submitSitemap, toIsoDate, unverifySite, verificationMethodsFor, verifySite };
1120
+ 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, INDEXING_DAILY_LIMIT, INDEXING_EFFECTIVE_LIMIT, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, MS_PER_DAY, accountNextActions, accountStatuses, addDays, addSite, analyticsNextActions, analyticsStatuses, batchInspectUrls, batchRequestIndexing, classifyError, countDays, createAuth, createFetch, daysAgo, deleteSite, deleteSitemap, discoverSitemap, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, formatErrorForCli, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingMetadata, getLatestGscDate, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, groupIntoRanges, gscdumpApi, hasGscReadScope, hasGscWriteScope, hasIndexingScope, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, inspectUrl, isPermissionDeniedError, isValidGscDate, lifecycleErrorCodes, lifecycleWebhookEvents, listVerifiedSites, parseGrantedScopes, progressBar, propertyNextActions, propertyStatuses, querySourceModes, requestIndexing, rowWithMetricDefaults, runSequentialBatch, siteUrlToVerificationSite, sitemapNextActions, sitemapStatuses, storageError, submitSitemap, toIsoDate, unverifySite, verificationMethodsFor, verifySite };
@@ -0,0 +1,107 @@
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_OPTIONAL_INDEXING_SCOPE: "https://www.googleapis.com/auth/indexing";
4
+ declare const accountStatuses: readonly ["disconnected", "oauth_received", "scope_missing", "refresh_missing", "db_provisioning", "ready", "reauth_required"];
5
+ declare const accountNextActions: readonly ["connect_google", "reconnect_google", "wait_for_provisioning", "none"];
6
+ declare const propertyStatuses: readonly ["no_local_site", "no_gsc_property", "unverified_property", "verified_candidate", "registered", "linked"];
7
+ declare const propertyNextActions: readonly ["create_site", "verify_gsc_property", "choose_property", "register_site", "none"];
8
+ declare const analyticsStatuses: readonly ["not_registered", "queued", "preparing", "syncing", "queryable_live", "queryable_partial", "ready", "failed"];
9
+ declare const analyticsNextActions: readonly ["wait_for_sync", "retry_sync", "none"];
10
+ declare const querySourceModes: readonly ["none", "live", "d1", "r2", "mixed"];
11
+ declare const sitemapStatuses: readonly ["unknown", "discovering", "none_found", "auto_submitted", "syncing", "ready", "failed"];
12
+ declare const sitemapNextActions: readonly ["submit_sitemap", "wait_for_sitemaps", "retry_sitemaps", "none"];
13
+ declare const indexingStatuses: readonly ["not_requested", "missing_scope", "insufficient_permission", "waiting_for_sitemaps", "discovering", "checking", "ready", "budget_exhausted", "no_urls", "failed"];
14
+ declare const indexingNextActions: readonly ["reconnect_google", "fix_gsc_permission", "wait_for_sitemaps", "wait_for_indexing", "retry_indexing", "none"];
15
+ declare const lifecycleWebhookEvents: readonly ["user.lifecycle.changed", "site.lifecycle.changed", "site.analytics.ready", "site.indexing.ready", "site.auth.failed", "job.failed"];
16
+ 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"];
17
+ type AccountStatus = typeof accountStatuses[number];
18
+ type AccountNextAction = typeof accountNextActions[number];
19
+ type PropertyStatus = typeof propertyStatuses[number];
20
+ type PropertyNextAction = typeof propertyNextActions[number];
21
+ type AnalyticsStatus = typeof analyticsStatuses[number];
22
+ type AnalyticsNextAction = typeof analyticsNextActions[number];
23
+ type QuerySourceMode = typeof querySourceModes[number];
24
+ type SitemapStatus = typeof sitemapStatuses[number];
25
+ type SitemapNextAction = typeof sitemapNextActions[number];
26
+ type IndexingStatus = typeof indexingStatuses[number];
27
+ type IndexingNextAction = typeof indexingNextActions[number];
28
+ type LifecycleWebhookEvent = typeof lifecycleWebhookEvents[number];
29
+ type LifecycleErrorCode = typeof lifecycleErrorCodes[number];
30
+ interface LifecycleProgress {
31
+ completed: number;
32
+ failed: number;
33
+ total: number;
34
+ percent: number;
35
+ }
36
+ interface LifecycleError {
37
+ code: LifecycleErrorCode;
38
+ message: string;
39
+ retryable: boolean;
40
+ }
41
+ interface PartnerLifecycleAccount {
42
+ status: AccountStatus;
43
+ grantedScopes: string[];
44
+ missingScopes: string[];
45
+ nextAction: AccountNextAction;
46
+ }
47
+ interface PartnerLifecycleSite {
48
+ siteId: string;
49
+ externalSiteId: string | null;
50
+ requestedUrl: string;
51
+ gscPropertyUrl: string | null;
52
+ permissionLevel: string | null;
53
+ property: {
54
+ status: PropertyStatus;
55
+ nextAction: PropertyNextAction;
56
+ };
57
+ analytics: {
58
+ status: AnalyticsStatus;
59
+ progress: LifecycleProgress;
60
+ queryable: boolean;
61
+ sourceMode: QuerySourceMode;
62
+ syncedRange: {
63
+ oldest: string | null;
64
+ newest: string | null;
65
+ };
66
+ nextAction: AnalyticsNextAction;
67
+ };
68
+ sitemaps: {
69
+ status: SitemapStatus;
70
+ discoveredCount: number;
71
+ nextAction: SitemapNextAction;
72
+ };
73
+ indexing: {
74
+ status: IndexingStatus;
75
+ eligible: boolean;
76
+ reason: string | null;
77
+ progress: LifecycleProgress;
78
+ nextAction: IndexingNextAction;
79
+ };
80
+ latestError: LifecycleError | null;
81
+ lifecycleRevision: number;
82
+ updatedAt: string;
83
+ }
84
+ interface PartnerLifecycleResponse {
85
+ contractVersion: typeof GSCDUMP_ONBOARDING_CONTRACT_VERSION;
86
+ userId: string;
87
+ partnerId: string | null;
88
+ account: PartnerLifecycleAccount;
89
+ sites: PartnerLifecycleSite[];
90
+ }
91
+ interface LifecycleWebhookEnvelope<TData extends Record<string, unknown> = Record<string, unknown>> {
92
+ contractVersion: typeof GSCDUMP_ONBOARDING_CONTRACT_VERSION;
93
+ deliveryId: string;
94
+ event: LifecycleWebhookEvent;
95
+ partnerId: string;
96
+ userId: string;
97
+ siteId?: string;
98
+ externalUserId?: string | null;
99
+ externalSiteId?: string | null;
100
+ lifecycleRevision: number;
101
+ occurredAt: string;
102
+ data: TData;
103
+ }
104
+ declare function parseGrantedScopes(scopes: string | null | undefined): string[];
105
+ declare function hasRequiredAnalyticsScope(scopes: string | string[] | null | undefined): boolean;
106
+ declare function hasOptionalIndexingScope(scopes: string | string[] | null | undefined): boolean;
107
+ export { AccountNextAction, AccountStatus, AnalyticsNextAction, AnalyticsStatus, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_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, lifecycleWebhookEvents, parseGrantedScopes, propertyNextActions, propertyStatuses, querySourceModes, sitemapNextActions, sitemapStatuses };
@@ -0,0 +1,122 @@
1
+ const GSCDUMP_ONBOARDING_CONTRACT_VERSION = "2026-05-11";
2
+ const GSCDUMP_REQUIRED_ANALYTICS_SCOPE = "https://www.googleapis.com/auth/webmasters.readonly";
3
+ const GSCDUMP_OPTIONAL_INDEXING_SCOPE = "https://www.googleapis.com/auth/indexing";
4
+ const accountStatuses = [
5
+ "disconnected",
6
+ "oauth_received",
7
+ "scope_missing",
8
+ "refresh_missing",
9
+ "db_provisioning",
10
+ "ready",
11
+ "reauth_required"
12
+ ];
13
+ const accountNextActions = [
14
+ "connect_google",
15
+ "reconnect_google",
16
+ "wait_for_provisioning",
17
+ "none"
18
+ ];
19
+ const propertyStatuses = [
20
+ "no_local_site",
21
+ "no_gsc_property",
22
+ "unverified_property",
23
+ "verified_candidate",
24
+ "registered",
25
+ "linked"
26
+ ];
27
+ const propertyNextActions = [
28
+ "create_site",
29
+ "verify_gsc_property",
30
+ "choose_property",
31
+ "register_site",
32
+ "none"
33
+ ];
34
+ const analyticsStatuses = [
35
+ "not_registered",
36
+ "queued",
37
+ "preparing",
38
+ "syncing",
39
+ "queryable_live",
40
+ "queryable_partial",
41
+ "ready",
42
+ "failed"
43
+ ];
44
+ const analyticsNextActions = [
45
+ "wait_for_sync",
46
+ "retry_sync",
47
+ "none"
48
+ ];
49
+ const querySourceModes = [
50
+ "none",
51
+ "live",
52
+ "d1",
53
+ "r2",
54
+ "mixed"
55
+ ];
56
+ const sitemapStatuses = [
57
+ "unknown",
58
+ "discovering",
59
+ "none_found",
60
+ "auto_submitted",
61
+ "syncing",
62
+ "ready",
63
+ "failed"
64
+ ];
65
+ const sitemapNextActions = [
66
+ "submit_sitemap",
67
+ "wait_for_sitemaps",
68
+ "retry_sitemaps",
69
+ "none"
70
+ ];
71
+ const indexingStatuses = [
72
+ "not_requested",
73
+ "missing_scope",
74
+ "insufficient_permission",
75
+ "waiting_for_sitemaps",
76
+ "discovering",
77
+ "checking",
78
+ "ready",
79
+ "budget_exhausted",
80
+ "no_urls",
81
+ "failed"
82
+ ];
83
+ const indexingNextActions = [
84
+ "reconnect_google",
85
+ "fix_gsc_permission",
86
+ "wait_for_sitemaps",
87
+ "wait_for_indexing",
88
+ "retry_indexing",
89
+ "none"
90
+ ];
91
+ const lifecycleWebhookEvents = [
92
+ "user.lifecycle.changed",
93
+ "site.lifecycle.changed",
94
+ "site.analytics.ready",
95
+ "site.indexing.ready",
96
+ "site.auth.failed",
97
+ "job.failed"
98
+ ];
99
+ const lifecycleErrorCodes = [
100
+ "missing_refresh_token",
101
+ "missing_analytics_scope",
102
+ "missing_indexing_scope",
103
+ "token_refresh_failed",
104
+ "permission_lost",
105
+ "insufficient_gsc_permission",
106
+ "gsc_property_not_found",
107
+ "gsc_property_unverified",
108
+ "user_database_not_provisioned",
109
+ "sync_failed",
110
+ "sitemap_sync_failed",
111
+ "indexing_failed"
112
+ ];
113
+ function parseGrantedScopes(scopes) {
114
+ return (scopes ?? "").split(/\s+/).map((s) => s.trim()).filter(Boolean);
115
+ }
116
+ function hasRequiredAnalyticsScope(scopes) {
117
+ return (Array.isArray(scopes) ? scopes : parseGrantedScopes(scopes)).includes(GSCDUMP_REQUIRED_ANALYTICS_SCOPE);
118
+ }
119
+ function hasOptionalIndexingScope(scopes) {
120
+ return (Array.isArray(scopes) ? scopes : parseGrantedScopes(scopes)).includes(GSCDUMP_OPTIONAL_INDEXING_SCOPE);
121
+ }
122
+ export { GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, accountNextActions, accountStatuses, analyticsNextActions, analyticsStatuses, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, lifecycleErrorCodes, lifecycleWebhookEvents, parseGrantedScopes, propertyNextActions, propertyStatuses, querySourceModes, sitemapNextActions, sitemapStatuses };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gscdump",
3
3
  "type": "module",
4
- "version": "0.11.3",
4
+ "version": "0.11.4",
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",
@@ -76,6 +76,11 @@
76
76
  "types": "./dist/sitemap.d.mts",
77
77
  "import": "./dist/sitemap.mjs",
78
78
  "default": "./dist/sitemap.mjs"
79
+ },
80
+ "./onboarding": {
81
+ "types": "./dist/onboarding.d.mts",
82
+ "import": "./dist/onboarding.mjs",
83
+ "default": "./dist/onboarding.mjs"
79
84
  }
80
85
  },
81
86
  "main": "./dist/index.mjs",