@gscdump/contracts 3.4.4 → 3.6.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/README.md CHANGED
@@ -2,33 +2,23 @@
2
2
 
3
3
  Shared protocol contracts for gscdump.com integrations.
4
4
 
5
- > The executable public v1 registry is exported from
6
- > `@gscdump/contracts/v1`. Existing root route/endpoint exports still describe
7
- > the legacy host during the release and cutover overlap. See the
8
- > [integration guide](../../docs/guides/hosted-v1.md),
9
- > [v1 contract](../../docs/hosted-api-v1.md), and
10
- > [producer inventory](../../docs/hosted-api-inventory.md).
5
+ Use `@gscdump/contracts/v1` for operation definitions, request and response schemas, and protocol constants.
6
+ The registry describes 55 HTTP operations and the realtime protocol.
7
+ For HTTP calls, install [`@gscdump/sdk`](../sdk/README.md).
11
8
 
12
- This package contains types, route metadata, Zod schemas, shared storage/query
13
- primitives, event names, and contract versions. It has no HTTP client, no
14
- websocket client, no queueing, and no producer behavior.
15
-
16
- Used by:
17
-
18
- - `@gscdump/sdk` for consuming gscdump.com
19
- - gscdump.com route/webhook/realtime contract tests
20
- - CLI and MCP integrations that need protocol validation
9
+ ```bash
10
+ npm install @gscdump/contracts
11
+ ```
21
12
 
22
- Producer behavior such as DB reads, auth, queues, webhook delivery, retries,
23
- and storage remains in gscdump.com.
13
+ The root also exports shared types and legacy route metadata.
14
+ Use the [v1 guide](../../docs/guides/hosted-v1.md) for new integrations.
15
+ The [producer inventory](../../docs/hosted-api-inventory.md) records remaining legacy mismatches.
24
16
 
25
- ## Public v1 bar
17
+ ## Operation contracts
26
18
 
27
- Each public operation has one executable descriptor covering its
28
- surface/version, method/path, query or mutation semantics, credential classes,
29
- static scopes, ownership policy, request/response schemas, consistency,
30
- idempotency, and errors. V1 has no schema-less descriptor and no two logical
31
- operations sharing an ambiguous method/path.
19
+ Each operation has one descriptor with its method, path, schemas, credentials, scopes, ownership rules, consistency, and retry behavior.
20
+ Descriptors distinguish queries from mutations independently of HTTP method.
21
+ Every public operation has schemas and a unique method/path pair.
32
22
 
33
23
  Response object schemas are additive for consumers: parsers accept unknown
34
24
  object keys while validating known fields. Producer contract tests remain
@@ -36,7 +26,7 @@ strict against the documented current schema, and enum values remain closed.
36
26
  Every `user_key` query declares primary read consistency with no caller
37
27
  override.
38
28
 
39
- Framework adapters use the registry mechanics exported from
29
+ Framework adapters use
40
30
  `@gscdump/contracts/v1/http`:
41
31
 
42
32
  - `listHttpOperations(protocol)` produces the canonical surface/operation
@@ -45,8 +35,8 @@ Framework adapters use the registry mechanics exported from
45
35
  and surface-relative path; it decodes and parses path parameters through the
46
36
  descriptor, rejects unsafe segments, and returns the canonical path.
47
37
 
48
- Consumer authorization stays app-owned. A browser proxy selects its explicit
49
- operation-ID allowlist, then passes only those entries to the resolver.
38
+ Your application owns authorization.
39
+ A browser proxy must pass only its allowed operations to the resolver.
50
40
 
51
41
  Consumers that only need operation metadata and paths can avoid the schema
52
42
  runtime:
@@ -1,18 +1,18 @@
1
1
  import { GscSearchType } from "./search-types.mjs";
2
2
  import { BuilderStateWire, Dimension, Metric } from "./types.mjs";
3
- type QueryArchetype = 'site-daily-timeseries' | 'entity-daily-timeseries' | 'entity-daily-sparkline' | 'top-n-breakdown' | 'single-row-lookup' | 'multi-series-stacked-daily' | 'two-dimension-detail' | 'arbitrary-sql' | 'aux-cloud-only';
4
- type ArchetypeExecutionClass = 'r2-sql' | 'r2-sql-resolved' | 'duckdb' | 'cloud-only';
5
- declare const ARCHETYPE_EXECUTION_CLASS: Record<QueryArchetype, ArchetypeExecutionClass>;
6
- interface DateRange {
3
+ export type QueryArchetype = 'site-daily-timeseries' | 'entity-daily-timeseries' | 'entity-daily-sparkline' | 'top-n-breakdown' | 'single-row-lookup' | 'multi-series-stacked-daily' | 'two-dimension-detail' | 'arbitrary-sql' | 'aux-cloud-only';
4
+ export type ArchetypeExecutionClass = 'r2-sql' | 'r2-sql-resolved' | 'duckdb' | 'cloud-only';
5
+ export declare const ARCHETYPE_EXECUTION_CLASS: Record<QueryArchetype, ArchetypeExecutionClass>;
6
+ export interface DateRange {
7
7
  start: string;
8
8
  end: string;
9
9
  }
10
- interface ArchetypeFacet {
10
+ export interface ArchetypeFacet {
11
11
  column: Dimension;
12
12
  op: 'eq' | 'regex' | 'notRegex';
13
13
  value: string;
14
14
  }
15
- interface ArchetypeQueryBase {
15
+ export interface ArchetypeQueryBase {
16
16
  archetype: QueryArchetype;
17
17
  siteId: string;
18
18
  searchType: GscSearchType;
@@ -20,11 +20,11 @@ interface ArchetypeQueryBase {
20
20
  compareRange?: DateRange;
21
21
  facets?: readonly ArchetypeFacet[];
22
22
  }
23
- interface SiteDailyTimeseriesQuery extends ArchetypeQueryBase {
23
+ export interface SiteDailyTimeseriesQuery extends ArchetypeQueryBase {
24
24
  archetype: 'site-daily-timeseries';
25
25
  metrics: readonly Metric[];
26
26
  }
27
- interface EntityDailyTimeseriesQuery extends ArchetypeQueryBase {
27
+ export interface EntityDailyTimeseriesQuery extends ArchetypeQueryBase {
28
28
  archetype: 'entity-daily-timeseries';
29
29
  entity: {
30
30
  dimension: Extract<Dimension, 'page' | 'query' | 'queryCanonical'>;
@@ -32,13 +32,13 @@ interface EntityDailyTimeseriesQuery extends ArchetypeQueryBase {
32
32
  };
33
33
  metrics: readonly Metric[];
34
34
  }
35
- interface EntityDailySparklineQuery extends ArchetypeQueryBase {
35
+ export interface EntityDailySparklineQuery extends ArchetypeQueryBase {
36
36
  archetype: 'entity-daily-sparkline';
37
37
  dimension: Extract<Dimension, 'page' | 'query' | 'queryCanonical'>;
38
38
  entities: readonly string[];
39
39
  metric: Metric;
40
40
  }
41
- interface TopNBreakdownQuery extends ArchetypeQueryBase {
41
+ export interface TopNBreakdownQuery extends ArchetypeQueryBase {
42
42
  archetype: 'top-n-breakdown';
43
43
  dimension: Dimension;
44
44
  metrics: readonly Metric[];
@@ -51,17 +51,17 @@ interface TopNBreakdownQuery extends ArchetypeQueryBase {
51
51
  includeTotal?: boolean;
52
52
  movers?: 'improving' | 'declining' | 'new' | 'lost';
53
53
  }
54
- interface SingleRowLookupQuery extends ArchetypeQueryBase {
54
+ export interface SingleRowLookupQuery extends ArchetypeQueryBase {
55
55
  archetype: 'single-row-lookup';
56
56
  match: Partial<Record<Dimension, string>>;
57
57
  metrics: readonly Metric[];
58
58
  }
59
- interface MultiSeriesStackedDailyQuery extends ArchetypeQueryBase {
59
+ export interface MultiSeriesStackedDailyQuery extends ArchetypeQueryBase {
60
60
  archetype: 'multi-series-stacked-daily';
61
61
  seriesDimension: Dimension;
62
62
  metric: Metric;
63
63
  }
64
- interface TwoDimensionDetailQuery extends ArchetypeQueryBase {
64
+ export interface TwoDimensionDetailQuery extends ArchetypeQueryBase {
65
65
  archetype: 'two-dimension-detail';
66
66
  metrics: readonly Metric[];
67
67
  filter?: {
@@ -74,39 +74,39 @@ interface TwoDimensionDetailQuery extends ArchetypeQueryBase {
74
74
  };
75
75
  limit?: number;
76
76
  }
77
- interface ArbitrarySqlQuery extends ArchetypeQueryBase {
77
+ export interface ArbitrarySqlQuery extends ArchetypeQueryBase {
78
78
  archetype: 'arbitrary-sql';
79
79
  sql: string;
80
80
  params?: readonly unknown[];
81
81
  }
82
- interface AuxCloudOnlyQuery {
82
+ export interface AuxCloudOnlyQuery {
83
83
  archetype: 'aux-cloud-only';
84
84
  siteId: string;
85
85
  dataset: 'canonicals' | 'sitemaps' | 'indexing';
86
86
  params?: Record<string, unknown>;
87
87
  }
88
- type ArchetypeQuery = SiteDailyTimeseriesQuery | EntityDailyTimeseriesQuery | EntityDailySparklineQuery | TopNBreakdownQuery | SingleRowLookupQuery | MultiSeriesStackedDailyQuery | TwoDimensionDetailQuery | ArbitrarySqlQuery | AuxCloudOnlyQuery;
88
+ export type ArchetypeQuery = SiteDailyTimeseriesQuery | EntityDailyTimeseriesQuery | EntityDailySparklineQuery | TopNBreakdownQuery | SingleRowLookupQuery | MultiSeriesStackedDailyQuery | TwoDimensionDetailQuery | ArbitrarySqlQuery | AuxCloudOnlyQuery;
89
89
  /** Date window accepted by the portable archetype constructors. */
90
- interface WireDateRange {
90
+ export interface WireDateRange {
91
91
  start: string;
92
92
  end: string;
93
93
  }
94
94
  /** Portable constructors for the canonical hosted/browser archetype wire shapes. */
95
- declare function siteDailyTimeseries(siteId: string, range: WireDateRange, options?: {
95
+ export declare function siteDailyTimeseries(siteId: string, range: WireDateRange, options?: {
96
96
  searchType?: GscSearchType;
97
97
  compareRange?: WireDateRange;
98
98
  metrics?: readonly Metric[];
99
99
  }): SiteDailyTimeseriesQuery;
100
- declare function entityDailyTimeseries(siteId: string, range: WireDateRange, entity: EntityDailyTimeseriesQuery['entity'], options?: {
100
+ export declare function entityDailyTimeseries(siteId: string, range: WireDateRange, entity: EntityDailyTimeseriesQuery['entity'], options?: {
101
101
  searchType?: GscSearchType;
102
102
  compareRange?: WireDateRange;
103
103
  metrics?: readonly Metric[];
104
104
  }): EntityDailyTimeseriesQuery;
105
- declare function entityDailySparkline(siteId: string, range: WireDateRange, dimension: EntityDailySparklineQuery['dimension'], entities: readonly string[], options?: {
105
+ export declare function entityDailySparkline(siteId: string, range: WireDateRange, dimension: EntityDailySparklineQuery['dimension'], entities: readonly string[], options?: {
106
106
  searchType?: GscSearchType;
107
107
  metric?: Metric;
108
108
  }): EntityDailySparklineQuery;
109
- interface TopNBreakdownOptions {
109
+ export interface TopNBreakdownOptions {
110
110
  searchType?: GscSearchType;
111
111
  compareRange?: WireDateRange;
112
112
  metrics?: readonly Metric[];
@@ -117,18 +117,18 @@ interface TopNBreakdownOptions {
117
117
  includeTotal?: boolean;
118
118
  movers?: NonNullable<TopNBreakdownQuery['movers']>;
119
119
  }
120
- declare function topNBreakdown(siteId: string, range: WireDateRange, dimension: Dimension, options?: TopNBreakdownOptions): TopNBreakdownQuery;
121
- declare function singleRowLookup(siteId: string, range: WireDateRange, match: SingleRowLookupQuery['match'], options?: {
120
+ export declare function topNBreakdown(siteId: string, range: WireDateRange, dimension: Dimension, options?: TopNBreakdownOptions): TopNBreakdownQuery;
121
+ export declare function singleRowLookup(siteId: string, range: WireDateRange, match: SingleRowLookupQuery['match'], options?: {
122
122
  searchType?: GscSearchType;
123
123
  compareRange?: WireDateRange;
124
124
  metrics?: readonly Metric[];
125
125
  }): SingleRowLookupQuery;
126
- declare function multiSeriesStackedDaily(siteId: string, range: WireDateRange, seriesDimension: Dimension, options?: {
126
+ export declare function multiSeriesStackedDaily(siteId: string, range: WireDateRange, seriesDimension: Dimension, options?: {
127
127
  searchType?: GscSearchType;
128
128
  compareRange?: WireDateRange;
129
129
  metric?: Metric;
130
130
  }): MultiSeriesStackedDailyQuery;
131
- interface TwoDimensionDetailOptions {
131
+ export interface TwoDimensionDetailOptions {
132
132
  searchType?: GscSearchType;
133
133
  compareRange?: WireDateRange;
134
134
  metrics?: readonly Metric[];
@@ -137,17 +137,17 @@ interface TwoDimensionDetailOptions {
137
137
  limit?: number;
138
138
  facets?: readonly ArchetypeFacet[];
139
139
  }
140
- declare function twoDimensionDetail(siteId: string, range: WireDateRange, options?: TwoDimensionDetailOptions): TwoDimensionDetailQuery;
141
- declare function arbitrarySql(siteId: string, range: WireDateRange, sql: string, options?: {
140
+ export declare function twoDimensionDetail(siteId: string, range: WireDateRange, options?: TwoDimensionDetailOptions): TwoDimensionDetailQuery;
141
+ export declare function arbitrarySql(siteId: string, range: WireDateRange, sql: string, options?: {
142
142
  searchType?: GscSearchType;
143
143
  params?: readonly unknown[];
144
144
  cacheable?: boolean;
145
145
  }): ArbitrarySqlQuery & {
146
146
  cacheable?: true;
147
147
  };
148
- type ArchetypeResultRow = Record<string, string | number | null>;
149
- type ArchetypeResultSource = 'browser' | 'server-r2-sql' | 'server-duckdb' | 'cloud';
150
- interface ArchetypeResult<R extends ArchetypeResultRow = ArchetypeResultRow> {
148
+ export type ArchetypeResultRow = Record<string, string | number | null>;
149
+ export type ArchetypeResultSource = 'browser' | 'server-r2-sql' | 'server-duckdb' | 'cloud';
150
+ export interface ArchetypeResult<R extends ArchetypeResultRow = ArchetypeResultRow> {
151
151
  archetype: QueryArchetype;
152
152
  rows: R[];
153
153
  source: ArchetypeResultSource;
@@ -159,9 +159,8 @@ interface ArchetypeResult<R extends ArchetypeResultRow = ArchetypeResultRow> {
159
159
  truncated?: boolean;
160
160
  };
161
161
  }
162
- interface ResolvedArchetypeQuery {
162
+ export interface ResolvedArchetypeQuery {
163
163
  query: ArchetypeQuery;
164
164
  builder?: BuilderStateWire;
165
165
  executionClass: ArchetypeExecutionClass;
166
- }
167
- export { ARCHETYPE_EXECUTION_CLASS, ArbitrarySqlQuery, ArchetypeExecutionClass, ArchetypeFacet, ArchetypeQuery, ArchetypeQueryBase, ArchetypeResult, ArchetypeResultRow, ArchetypeResultSource, AuxCloudOnlyQuery, DateRange, EntityDailySparklineQuery, EntityDailyTimeseriesQuery, MultiSeriesStackedDailyQuery, QueryArchetype, ResolvedArchetypeQuery, SingleRowLookupQuery, SiteDailyTimeseriesQuery, TopNBreakdownOptions, TopNBreakdownQuery, TwoDimensionDetailOptions, TwoDimensionDetailQuery, WireDateRange, arbitrarySql, entityDailySparkline, entityDailyTimeseries, multiSeriesStackedDaily, singleRowLookup, siteDailyTimeseries, topNBreakdown, twoDimensionDetail };
166
+ }
@@ -1,5 +1,5 @@
1
1
  /** Canonical analytics data-plane endpoint definitions. */
2
- declare const analyticsEndpoints: {
2
+ export declare const analyticsEndpoints: {
3
3
  readonly whoami: {
4
4
  method: "GET";
5
5
  path: "/api/__gsc/whoami";
@@ -510,7 +510,7 @@ declare const analyticsEndpoints: {
510
510
  };
511
511
  };
512
512
  /** Canonical partner control-plane endpoint definitions. */
513
- declare const partnerEndpoints: {
513
+ export declare const partnerEndpoints: {
514
514
  readonly registerUser: {
515
515
  method: "POST";
516
516
  path: "/users/register";
@@ -1564,5 +1564,4 @@ declare const partnerEndpoints: {
1564
1564
  browserAnalyzerEnabled: import("zod").ZodBoolean;
1565
1565
  }, import("zod/v4/core").$loose>;
1566
1566
  };
1567
- };
1568
- export { analyticsEndpoints, partnerEndpoints };
1567
+ };
@@ -1,8 +1,8 @@
1
1
  import { GscSearchType } from "./search-types.mjs";
2
2
  /** The 6 Iceberg fact tables — string-typed here to avoid an engine dep. */
3
- type FileResolutionTable = 'pages' | 'queries' | 'countries' | 'page_queries' | 'dates' | 'search_appearance' | 'search_appearance_pages' | 'search_appearance_queries' | 'search_appearance_page_queries';
3
+ export type FileResolutionTable = 'pages' | 'queries' | 'countries' | 'page_queries' | 'dates' | 'search_appearance' | 'search_appearance_pages' | 'search_appearance_queries' | 'search_appearance_page_queries';
4
4
  /** Request query params for `GET /api/sites/[siteId]/analysis-sources`. */
5
- interface FileResolutionRequest {
5
+ export interface FileResolutionRequest {
6
6
  /** `YYYY-MM-DD` inclusive. Required — no date range = no resolution. */
7
7
  start: string;
8
8
  /** `YYYY-MM-DD` inclusive. */
@@ -29,7 +29,7 @@ interface FileResolutionRequest {
29
29
  /**
30
30
  * One compacted Iceberg parquet data file the browser should fetch into OPFS.
31
31
  */
32
- interface ResolvedParquetFile {
32
+ export interface ResolvedParquetFile {
33
33
  /**
34
34
  * Same-origin URL (`/api/r2-data/<key>?...`) carrying a signed size hint
35
35
  * and a short-lived exact-key access token. Stable for the file's lifetime
@@ -53,7 +53,7 @@ interface ResolvedParquetFile {
53
53
  rowCount: number;
54
54
  }
55
55
  /** Per-table resolution result. */
56
- interface ResolvedTable {
56
+ export interface ResolvedTable {
57
57
  table: FileResolutionTable;
58
58
  /**
59
59
  * `'browser'` — `files` is populated; the browser downloads + attaches.
@@ -85,7 +85,7 @@ interface ResolvedTable {
85
85
  totalRows: number;
86
86
  }
87
87
  /** Server-tail directive — how an ineligible `(site, table)` is queried. */
88
- interface ServerTailDirective {
88
+ export interface ServerTailDirective {
89
89
  /**
90
90
  * `'r2-sql'` — server runs the query via R2 SQL over the Iceberg table.
91
91
  * `'duckdb'` — server runs DuckDB-over-Iceberg-files (caller-supplied SQL,
@@ -99,7 +99,7 @@ interface ServerTailDirective {
99
99
  endpoint: string;
100
100
  }
101
101
  /** Response body of the file-resolution endpoint. */
102
- interface FileResolutionResponse {
102
+ export interface FileResolutionResponse {
103
103
  siteId: string;
104
104
  searchType: GscSearchType;
105
105
  range: {
@@ -131,25 +131,24 @@ interface FileResolutionResponse {
131
131
  };
132
132
  }
133
133
  /** One canonical query-dimension sidecar object for browser attachment. */
134
- interface QueryDimSourceFile {
134
+ export interface QueryDimSourceFile {
135
135
  url: string;
136
136
  bytes: number;
137
137
  contentHash: string;
138
138
  }
139
139
  /** Response from the versioned query-dimension sidecar resolver. */
140
- interface QueryDimSourceResponse {
140
+ export interface QueryDimSourceResponse {
141
141
  file: QueryDimSourceFile | null;
142
142
  }
143
143
  /** Multi-site file-resolution response. Inaccessible sites are omitted. */
144
- interface BulkFileResolutionResponse {
144
+ export interface BulkFileResolutionResponse {
145
145
  generatedAt: string;
146
146
  siteCount: number;
147
147
  maxSites: number;
148
148
  results: Record<string, FileResolutionResponse>;
149
149
  }
150
150
  /** Request query for the multi-site file resolver. */
151
- interface BulkFileResolutionRequest extends FileResolutionRequest {
151
+ export interface BulkFileResolutionRequest extends FileResolutionRequest {
152
152
  /** Public site ids to resolve. Partner callers must supply this list. */
153
153
  siteIds?: string[];
154
- }
155
- export { BulkFileResolutionRequest, BulkFileResolutionResponse, FileResolutionRequest, FileResolutionResponse, FileResolutionTable, QueryDimSourceFile, QueryDimSourceResponse, ResolvedParquetFile, ResolvedTable, ServerTailDirective };
154
+ }
@@ -1,51 +1,51 @@
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";
1
+ export declare const GSCDUMP_ONBOARDING_CONTRACT_VERSION: "2026-05-11";
2
+ export declare const GSCDUMP_REQUIRED_ANALYTICS_SCOPE: "https://www.googleapis.com/auth/webmasters.readonly";
3
+ export declare const GSCDUMP_WRITE_ANALYTICS_SCOPE: "https://www.googleapis.com/auth/webmasters";
4
+ export declare const GSCDUMP_OPTIONAL_INDEXING_SCOPE: "https://www.googleapis.com/auth/indexing";
5
5
  type GoogleScopesInput = string | readonly string[] | null | undefined;
6
- declare const accountStatuses: readonly ["disconnected", "oauth_received", "scope_missing", "refresh_missing", "db_provisioning", "ready", "reauth_required"];
7
- declare const accountNextActions: readonly ["connect_google", "reconnect_google", "wait_for_provisioning", "none"];
8
- declare const propertyStatuses: readonly ["no_local_site", "no_gsc_property", "unverified_property", "verified_candidate", "registered", "linked"];
9
- declare const propertyNextActions: readonly ["create_site", "verify_gsc_property", "choose_property", "register_site", "none"];
10
- declare const analyticsStatuses: readonly ["not_registered", "queued", "preparing", "syncing", "queryable_live", "queryable_partial", "ready", "failed"];
11
- declare const analyticsNextActions: readonly ["wait_for_sync", "retry_sync", "none"];
12
- declare const querySourceModes: readonly ["none", "live", "d1", "r2", "mixed"];
13
- declare const sitemapStatuses: readonly ["unknown", "discovering", "none_found", "auto_submitted", "syncing", "ready", "failed"];
14
- declare const sitemapNextActions: readonly ["submit_sitemap", "wait_for_sitemaps", "retry_sitemaps", "none"];
15
- declare const indexingStatuses: readonly ["not_requested", "missing_scope", "insufficient_permission", "waiting_for_sitemaps", "discovering", "checking", "ready", "budget_exhausted", "no_urls", "failed"];
16
- declare const indexingNextActions: readonly ["reconnect_google", "fix_gsc_permission", "wait_for_sitemaps", "wait_for_indexing", "retry_indexing", "none"];
17
- declare const lifecycleErrorCodes: readonly ["missing_refresh_token", "missing_analytics_scope", "missing_gsc_read_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 = 'user.lifecycle.changed' | 'site.lifecycle.changed' | 'site.analytics.ready' | 'site.indexing.ready' | 'site.auth.failed' | 'job.failed';
30
- type LifecycleErrorCode = typeof lifecycleErrorCodes[number];
31
- interface LifecycleProgress {
6
+ export declare const accountStatuses: readonly ["disconnected", "oauth_received", "scope_missing", "refresh_missing", "db_provisioning", "ready", "reauth_required"];
7
+ export declare const accountNextActions: readonly ["connect_google", "reconnect_google", "wait_for_provisioning", "none"];
8
+ export declare const propertyStatuses: readonly ["no_local_site", "no_gsc_property", "unverified_property", "verified_candidate", "registered", "linked"];
9
+ export declare const propertyNextActions: readonly ["create_site", "verify_gsc_property", "choose_property", "register_site", "none"];
10
+ export declare const analyticsStatuses: readonly ["not_registered", "queued", "preparing", "syncing", "queryable_live", "queryable_partial", "ready", "failed"];
11
+ export declare const analyticsNextActions: readonly ["wait_for_sync", "retry_sync", "none"];
12
+ export declare const querySourceModes: readonly ["none", "live", "d1", "r2", "mixed"];
13
+ export declare const sitemapStatuses: readonly ["unknown", "discovering", "none_found", "auto_submitted", "syncing", "ready", "failed"];
14
+ export declare const sitemapNextActions: readonly ["submit_sitemap", "wait_for_sitemaps", "retry_sitemaps", "none"];
15
+ export declare const indexingStatuses: readonly ["not_requested", "missing_scope", "insufficient_permission", "waiting_for_sitemaps", "discovering", "checking", "ready", "budget_exhausted", "no_urls", "failed"];
16
+ export declare const indexingNextActions: readonly ["reconnect_google", "fix_gsc_permission", "wait_for_sitemaps", "wait_for_indexing", "retry_indexing", "none"];
17
+ export declare const lifecycleErrorCodes: readonly ["missing_refresh_token", "missing_analytics_scope", "missing_gsc_read_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
+ export type AccountStatus = typeof accountStatuses[number];
19
+ export type AccountNextAction = typeof accountNextActions[number];
20
+ export type PropertyStatus = typeof propertyStatuses[number];
21
+ export type PropertyNextAction = typeof propertyNextActions[number];
22
+ export type AnalyticsStatus = typeof analyticsStatuses[number];
23
+ export type AnalyticsNextAction = typeof analyticsNextActions[number];
24
+ export type QuerySourceMode = typeof querySourceModes[number];
25
+ export type SitemapStatus = typeof sitemapStatuses[number];
26
+ export type SitemapNextAction = typeof sitemapNextActions[number];
27
+ export type IndexingStatus = typeof indexingStatuses[number];
28
+ export type IndexingNextAction = typeof indexingNextActions[number];
29
+ export type LifecycleWebhookEvent = 'user.lifecycle.changed' | 'site.lifecycle.changed' | 'site.analytics.ready' | 'site.indexing.ready' | 'site.auth.failed' | 'job.failed';
30
+ export type LifecycleErrorCode = typeof lifecycleErrorCodes[number];
31
+ export interface LifecycleProgress {
32
32
  completed: number;
33
33
  failed: number;
34
34
  total: number;
35
35
  percent: number;
36
36
  }
37
- interface LifecycleError {
37
+ export interface LifecycleError {
38
38
  code: LifecycleErrorCode;
39
39
  message: string;
40
40
  retryable: boolean;
41
41
  }
42
- interface PartnerLifecycleAccount {
42
+ export interface PartnerLifecycleAccount {
43
43
  status: AccountStatus;
44
44
  grantedScopes: string[];
45
45
  missingScopes: string[];
46
46
  nextAction: AccountNextAction;
47
47
  }
48
- interface PartnerLifecycleSite {
48
+ export interface PartnerLifecycleSite {
49
49
  siteId: string;
50
50
  /** Integer alias (`user_sites.int_id`) — the int JOIN key partners denormalize into their own catalog namespaces. Nullable only for pre-0029 unbackfilled rows. */
51
51
  intId: number | null;
@@ -86,7 +86,7 @@ interface PartnerLifecycleSite {
86
86
  lifecycleRevision: number;
87
87
  updatedAt: string;
88
88
  }
89
- interface PartnerLifecycleResponse {
89
+ export interface PartnerLifecycleResponse {
90
90
  contractVersion: typeof GSCDUMP_ONBOARDING_CONTRACT_VERSION;
91
91
  userId: string;
92
92
  partnerId: string | null;
@@ -94,7 +94,7 @@ interface PartnerLifecycleResponse {
94
94
  account: PartnerLifecycleAccount;
95
95
  sites: PartnerLifecycleSite[];
96
96
  }
97
- interface LifecycleWebhookEnvelope<TData extends Record<string, unknown> = Record<string, unknown>> {
97
+ export interface LifecycleWebhookEnvelope<TData extends Record<string, unknown> = Record<string, unknown>> {
98
98
  contractVersion: typeof GSCDUMP_ONBOARDING_CONTRACT_VERSION;
99
99
  deliveryId: string;
100
100
  event: LifecycleWebhookEvent;
@@ -107,7 +107,6 @@ interface LifecycleWebhookEnvelope<TData extends Record<string, unknown> = Recor
107
107
  occurredAt: string;
108
108
  data: TData;
109
109
  }
110
- declare function parseGrantedScopes(scopes: GoogleScopesInput): string[];
111
- declare function hasRequiredAnalyticsScope(scopes: GoogleScopesInput): boolean;
112
- declare function hasOptionalIndexingScope(scopes: GoogleScopesInput): boolean;
113
- export { 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 };
110
+ export declare function parseGrantedScopes(scopes: GoogleScopesInput): string[];
111
+ export declare function hasRequiredAnalyticsScope(scopes: GoogleScopesInput): boolean;
112
+ export declare function hasOptionalIndexingScope(scopes: GoogleScopesInput): boolean;
package/dist/routes.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- declare const partnerRoutes: {
1
+ export declare const partnerRoutes: {
2
2
  readonly partner: {
3
3
  readonly users: {
4
4
  readonly lifecycle: (userId: string) => string;
@@ -34,7 +34,7 @@ declare const partnerRoutes: {
34
34
  readonly user: "/user/settings";
35
35
  };
36
36
  };
37
- declare const analyticsRoutes: {
37
+ export declare const analyticsRoutes: {
38
38
  readonly whoami: "/api/__gsc/whoami";
39
39
  readonly sites: "/api/__gsc/sites";
40
40
  readonly bulkSources: "/api/__gsc/bulk-sources";
@@ -55,5 +55,4 @@ declare const analyticsRoutes: {
55
55
  readonly topAssociation: (siteId: string) => string;
56
56
  };
57
57
  readonly syncProgress: "/api/sync-progress";
58
- };
59
- export { analyticsRoutes, partnerRoutes };
58
+ };