@gscdump/contracts 5.0.0 → 5.1.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.
@@ -1076,8 +1076,8 @@ export declare const partnerEndpoints: {
1076
1076
  status: import("zod").ZodEnum<{
1077
1077
  error: "error";
1078
1078
  registered: "registered";
1079
- already_exists: "already_exists";
1080
1079
  not_found: "not_found";
1080
+ already_exists: "already_exists";
1081
1081
  }>;
1082
1082
  error: import("zod").ZodOptional<import("zod").ZodString>;
1083
1083
  site: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>>;
@@ -1431,19 +1431,19 @@ export declare const partnerEndpoints: {
1431
1431
  _tag: import("zod").ZodLiteral<"counted">;
1432
1432
  capturedAt: import("zod").ZodString;
1433
1433
  counts: import("zod").ZodObject<{
1434
- indexed: import("zod").ZodDefault<import("zod").ZodNumber>;
1435
- not_found: import("zod").ZodDefault<import("zod").ZodNumber>;
1436
- redirect: import("zod").ZodDefault<import("zod").ZodNumber>;
1437
1434
  unknown_to_google: import("zod").ZodDefault<import("zod").ZodNumber>;
1438
1435
  discovered_not_indexed: import("zod").ZodDefault<import("zod").ZodNumber>;
1439
1436
  crawled_not_indexed: import("zod").ZodDefault<import("zod").ZodNumber>;
1437
+ indexed: import("zod").ZodDefault<import("zod").ZodNumber>;
1440
1438
  noindex: import("zod").ZodDefault<import("zod").ZodNumber>;
1441
1439
  blocked_robots: import("zod").ZodDefault<import("zod").ZodNumber>;
1442
1440
  soft_404: import("zod").ZodDefault<import("zod").ZodNumber>;
1441
+ not_found: import("zod").ZodDefault<import("zod").ZodNumber>;
1443
1442
  server_error: import("zod").ZodDefault<import("zod").ZodNumber>;
1444
1443
  access_denied: import("zod").ZodDefault<import("zod").ZodNumber>;
1445
1444
  access_forbidden: import("zod").ZodDefault<import("zod").ZodNumber>;
1446
1445
  blocked_4xx: import("zod").ZodDefault<import("zod").ZodNumber>;
1446
+ redirect: import("zod").ZodDefault<import("zod").ZodNumber>;
1447
1447
  redirect_error: import("zod").ZodDefault<import("zod").ZodNumber>;
1448
1448
  alternate_canonical: import("zod").ZodDefault<import("zod").ZodNumber>;
1449
1449
  duplicate_no_canonical: import("zod").ZodDefault<import("zod").ZodNumber>;
@@ -21,19 +21,19 @@ export type CoverageStateTag = typeof COVERAGE_STATE_TAGS[number];
21
21
  export declare const COVERAGE_LADDER: readonly ["unknown_to_google", "discovered_not_indexed", "crawled_not_indexed", "indexed"];
22
22
  export type CoverageLadderTag = typeof COVERAGE_LADDER[number];
23
23
  export declare const coverageStateTagSchema: z.ZodEnum<{
24
- indexed: "indexed";
25
- not_found: "not_found";
26
- redirect: "redirect";
27
24
  unknown_to_google: "unknown_to_google";
28
25
  discovered_not_indexed: "discovered_not_indexed";
29
26
  crawled_not_indexed: "crawled_not_indexed";
27
+ indexed: "indexed";
30
28
  noindex: "noindex";
31
29
  blocked_robots: "blocked_robots";
32
30
  soft_404: "soft_404";
31
+ not_found: "not_found";
33
32
  server_error: "server_error";
34
33
  access_denied: "access_denied";
35
34
  access_forbidden: "access_forbidden";
36
35
  blocked_4xx: "blocked_4xx";
36
+ redirect: "redirect";
37
37
  redirect_error: "redirect_error";
38
38
  alternate_canonical: "alternate_canonical";
39
39
  duplicate_no_canonical: "duplicate_no_canonical";
@@ -49,19 +49,19 @@ export declare const coverageStateTagSchema: z.ZodEnum<{
49
49
  * reads a newer host's counts. Neither case fails the parse.
50
50
  */
51
51
  export declare const coverageStateCountsSchema: z.ZodObject<{
52
- indexed: z.ZodDefault<z.ZodNumber>;
53
- not_found: z.ZodDefault<z.ZodNumber>;
54
- redirect: z.ZodDefault<z.ZodNumber>;
55
52
  unknown_to_google: z.ZodDefault<z.ZodNumber>;
56
53
  discovered_not_indexed: z.ZodDefault<z.ZodNumber>;
57
54
  crawled_not_indexed: z.ZodDefault<z.ZodNumber>;
55
+ indexed: z.ZodDefault<z.ZodNumber>;
58
56
  noindex: z.ZodDefault<z.ZodNumber>;
59
57
  blocked_robots: z.ZodDefault<z.ZodNumber>;
60
58
  soft_404: z.ZodDefault<z.ZodNumber>;
59
+ not_found: z.ZodDefault<z.ZodNumber>;
61
60
  server_error: z.ZodDefault<z.ZodNumber>;
62
61
  access_denied: z.ZodDefault<z.ZodNumber>;
63
62
  access_forbidden: z.ZodDefault<z.ZodNumber>;
64
63
  blocked_4xx: z.ZodDefault<z.ZodNumber>;
64
+ redirect: z.ZodDefault<z.ZodNumber>;
65
65
  redirect_error: z.ZodDefault<z.ZodNumber>;
66
66
  alternate_canonical: z.ZodDefault<z.ZodNumber>;
67
67
  duplicate_no_canonical: z.ZodDefault<z.ZodNumber>;
@@ -143,19 +143,19 @@ export declare const coverageStatesPointSchema: z.ZodDiscriminatedUnion<[z.ZodOb
143
143
  _tag: z.ZodLiteral<"counted">;
144
144
  capturedAt: z.ZodString;
145
145
  counts: z.ZodObject<{
146
- indexed: z.ZodDefault<z.ZodNumber>;
147
- not_found: z.ZodDefault<z.ZodNumber>;
148
- redirect: z.ZodDefault<z.ZodNumber>;
149
146
  unknown_to_google: z.ZodDefault<z.ZodNumber>;
150
147
  discovered_not_indexed: z.ZodDefault<z.ZodNumber>;
151
148
  crawled_not_indexed: z.ZodDefault<z.ZodNumber>;
149
+ indexed: z.ZodDefault<z.ZodNumber>;
152
150
  noindex: z.ZodDefault<z.ZodNumber>;
153
151
  blocked_robots: z.ZodDefault<z.ZodNumber>;
154
152
  soft_404: z.ZodDefault<z.ZodNumber>;
153
+ not_found: z.ZodDefault<z.ZodNumber>;
155
154
  server_error: z.ZodDefault<z.ZodNumber>;
156
155
  access_denied: z.ZodDefault<z.ZodNumber>;
157
156
  access_forbidden: z.ZodDefault<z.ZodNumber>;
158
157
  blocked_4xx: z.ZodDefault<z.ZodNumber>;
158
+ redirect: z.ZodDefault<z.ZodNumber>;
159
159
  redirect_error: z.ZodDefault<z.ZodNumber>;
160
160
  alternate_canonical: z.ZodDefault<z.ZodNumber>;
161
161
  duplicate_no_canonical: z.ZodDefault<z.ZodNumber>;
@@ -193,19 +193,19 @@ export declare const WATCHED_URL_CHECKPOINT_LIMIT = 12;
193
193
  export declare const watchedUrlCheckpointSchema: z.ZodObject<{
194
194
  checkedAt: z.ZodString;
195
195
  coverageState: z.ZodCatch<z.ZodEnum<{
196
- indexed: "indexed";
197
- not_found: "not_found";
198
- redirect: "redirect";
199
196
  unknown_to_google: "unknown_to_google";
200
197
  discovered_not_indexed: "discovered_not_indexed";
201
198
  crawled_not_indexed: "crawled_not_indexed";
199
+ indexed: "indexed";
202
200
  noindex: "noindex";
203
201
  blocked_robots: "blocked_robots";
204
202
  soft_404: "soft_404";
203
+ not_found: "not_found";
205
204
  server_error: "server_error";
206
205
  access_denied: "access_denied";
207
206
  access_forbidden: "access_forbidden";
208
207
  blocked_4xx: "blocked_4xx";
208
+ redirect: "redirect";
209
209
  redirect_error: "redirect_error";
210
210
  alternate_canonical: "alternate_canonical";
211
211
  duplicate_no_canonical: "duplicate_no_canonical";
@@ -226,19 +226,19 @@ export declare const watchedUrlSchema: z.ZodObject<{
226
226
  checkpoints: z.ZodArray<z.ZodObject<{
227
227
  checkedAt: z.ZodString;
228
228
  coverageState: z.ZodCatch<z.ZodEnum<{
229
- indexed: "indexed";
230
- not_found: "not_found";
231
- redirect: "redirect";
232
229
  unknown_to_google: "unknown_to_google";
233
230
  discovered_not_indexed: "discovered_not_indexed";
234
231
  crawled_not_indexed: "crawled_not_indexed";
232
+ indexed: "indexed";
235
233
  noindex: "noindex";
236
234
  blocked_robots: "blocked_robots";
237
235
  soft_404: "soft_404";
236
+ not_found: "not_found";
238
237
  server_error: "server_error";
239
238
  access_denied: "access_denied";
240
239
  access_forbidden: "access_forbidden";
241
240
  blocked_4xx: "blocked_4xx";
241
+ redirect: "redirect";
242
242
  redirect_error: "redirect_error";
243
243
  alternate_canonical: "alternate_canonical";
244
244
  duplicate_no_canonical: "duplicate_no_canonical";
@@ -261,19 +261,19 @@ export declare const watchedUrlsResponseSchema: z.ZodObject<{
261
261
  checkpoints: z.ZodArray<z.ZodObject<{
262
262
  checkedAt: z.ZodString;
263
263
  coverageState: z.ZodCatch<z.ZodEnum<{
264
- indexed: "indexed";
265
- not_found: "not_found";
266
- redirect: "redirect";
267
264
  unknown_to_google: "unknown_to_google";
268
265
  discovered_not_indexed: "discovered_not_indexed";
269
266
  crawled_not_indexed: "crawled_not_indexed";
267
+ indexed: "indexed";
270
268
  noindex: "noindex";
271
269
  blocked_robots: "blocked_robots";
272
270
  soft_404: "soft_404";
271
+ not_found: "not_found";
273
272
  server_error: "server_error";
274
273
  access_denied: "access_denied";
275
274
  access_forbidden: "access_forbidden";
276
275
  blocked_4xx: "blocked_4xx";
276
+ redirect: "redirect";
277
277
  redirect_error: "redirect_error";
278
278
  alternate_canonical: "alternate_canonical";
279
279
  duplicate_no_canonical: "duplicate_no_canonical";
@@ -365,9 +365,9 @@ export declare const indexingUrlsResponseSchema: z.ZodObject<{
365
365
  }, z.core.$loose>;
366
366
  export declare const GSCDUMP_INDEXING_TRANSITION_FIELDS: readonly ["indexStatus", "coverageState", "robotsTxtState", "indexingState", "pageFetchState", "googleCanonical"];
367
367
  export declare const gscdumpIndexingTransitionFieldSchema: z.ZodEnum<{
368
+ coverageState: "coverageState";
368
369
  indexStatus: "indexStatus";
369
370
  googleCanonical: "googleCanonical";
370
- coverageState: "coverageState";
371
371
  robotsTxtState: "robotsTxtState";
372
372
  indexingState: "indexingState";
373
373
  pageFetchState: "pageFetchState";
@@ -1409,8 +1409,8 @@ export declare const bulkRegisterPartnerSitesResponseSchema: z.ZodObject<{
1409
1409
  status: z.ZodEnum<{
1410
1410
  error: "error";
1411
1411
  registered: "registered";
1412
- already_exists: "already_exists";
1413
1412
  not_found: "not_found";
1413
+ already_exists: "already_exists";
1414
1414
  }>;
1415
1415
  error: z.ZodOptional<z.ZodString>;
1416
1416
  site: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -1805,19 +1805,19 @@ export declare const gscdumpIndexingResponseSchema: z.ZodObject<{
1805
1805
  _tag: z.ZodLiteral<"counted">;
1806
1806
  capturedAt: z.ZodString;
1807
1807
  counts: z.ZodObject<{
1808
- indexed: z.ZodDefault<z.ZodNumber>;
1809
- not_found: z.ZodDefault<z.ZodNumber>;
1810
- redirect: z.ZodDefault<z.ZodNumber>;
1811
1808
  unknown_to_google: z.ZodDefault<z.ZodNumber>;
1812
1809
  discovered_not_indexed: z.ZodDefault<z.ZodNumber>;
1813
1810
  crawled_not_indexed: z.ZodDefault<z.ZodNumber>;
1811
+ indexed: z.ZodDefault<z.ZodNumber>;
1814
1812
  noindex: z.ZodDefault<z.ZodNumber>;
1815
1813
  blocked_robots: z.ZodDefault<z.ZodNumber>;
1816
1814
  soft_404: z.ZodDefault<z.ZodNumber>;
1815
+ not_found: z.ZodDefault<z.ZodNumber>;
1817
1816
  server_error: z.ZodDefault<z.ZodNumber>;
1818
1817
  access_denied: z.ZodDefault<z.ZodNumber>;
1819
1818
  access_forbidden: z.ZodDefault<z.ZodNumber>;
1820
1819
  blocked_4xx: z.ZodDefault<z.ZodNumber>;
1820
+ redirect: z.ZodDefault<z.ZodNumber>;
1821
1821
  redirect_error: z.ZodDefault<z.ZodNumber>;
1822
1822
  alternate_canonical: z.ZodDefault<z.ZodNumber>;
1823
1823
  duplicate_no_canonical: z.ZodDefault<z.ZodNumber>;
@@ -2124,8 +2124,8 @@ export declare const gscdumpSyncProgressResponseSchema: z.ZodObject<{
2124
2124
  authFailureCount: z.ZodNumber;
2125
2125
  currentPhase: z.ZodEnum<{
2126
2126
  complete: "complete";
2127
- backfill: "backfill";
2128
2127
  initial: "initial";
2128
+ backfill: "backfill";
2129
2129
  }>;
2130
2130
  isStalled: z.ZodBoolean;
2131
2131
  stallDays: z.ZodNumber;
@@ -3619,8 +3619,8 @@ export declare const partnerControlEndpointSchemas: {
3619
3619
  authFailureCount: z.ZodNumber;
3620
3620
  currentPhase: z.ZodEnum<{
3621
3621
  complete: "complete";
3622
- backfill: "backfill";
3623
3622
  initial: "initial";
3623
+ backfill: "backfill";
3624
3624
  }>;
3625
3625
  isStalled: z.ZodBoolean;
3626
3626
  stallDays: z.ZodNumber;
@@ -4226,8 +4226,8 @@ export declare const partnerControlEndpointSchemas: {
4226
4226
  status: z.ZodEnum<{
4227
4227
  error: "error";
4228
4228
  registered: "registered";
4229
- already_exists: "already_exists";
4230
4229
  not_found: "not_found";
4230
+ already_exists: "already_exists";
4231
4231
  }>;
4232
4232
  error: z.ZodOptional<z.ZodString>;
4233
4233
  site: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -4491,19 +4491,19 @@ export declare const partnerControlEndpointSchemas: {
4491
4491
  _tag: z.ZodLiteral<"counted">;
4492
4492
  capturedAt: z.ZodString;
4493
4493
  counts: z.ZodObject<{
4494
- indexed: z.ZodDefault<z.ZodNumber>;
4495
- not_found: z.ZodDefault<z.ZodNumber>;
4496
- redirect: z.ZodDefault<z.ZodNumber>;
4497
4494
  unknown_to_google: z.ZodDefault<z.ZodNumber>;
4498
4495
  discovered_not_indexed: z.ZodDefault<z.ZodNumber>;
4499
4496
  crawled_not_indexed: z.ZodDefault<z.ZodNumber>;
4497
+ indexed: z.ZodDefault<z.ZodNumber>;
4500
4498
  noindex: z.ZodDefault<z.ZodNumber>;
4501
4499
  blocked_robots: z.ZodDefault<z.ZodNumber>;
4502
4500
  soft_404: z.ZodDefault<z.ZodNumber>;
4501
+ not_found: z.ZodDefault<z.ZodNumber>;
4503
4502
  server_error: z.ZodDefault<z.ZodNumber>;
4504
4503
  access_denied: z.ZodDefault<z.ZodNumber>;
4505
4504
  access_forbidden: z.ZodDefault<z.ZodNumber>;
4506
4505
  blocked_4xx: z.ZodDefault<z.ZodNumber>;
4506
+ redirect: z.ZodDefault<z.ZodNumber>;
4507
4507
  redirect_error: z.ZodDefault<z.ZodNumber>;
4508
4508
  alternate_canonical: z.ZodDefault<z.ZodNumber>;
4509
4509
  duplicate_no_canonical: z.ZodDefault<z.ZodNumber>;
@@ -5424,8 +5424,8 @@ export declare const partnerEndpointSchemas: {
5424
5424
  authFailureCount: z.ZodNumber;
5425
5425
  currentPhase: z.ZodEnum<{
5426
5426
  complete: "complete";
5427
- backfill: "backfill";
5428
5427
  initial: "initial";
5428
+ backfill: "backfill";
5429
5429
  }>;
5430
5430
  isStalled: z.ZodBoolean;
5431
5431
  stallDays: z.ZodNumber;
@@ -6031,8 +6031,8 @@ export declare const partnerEndpointSchemas: {
6031
6031
  status: z.ZodEnum<{
6032
6032
  error: "error";
6033
6033
  registered: "registered";
6034
- already_exists: "already_exists";
6035
6034
  not_found: "not_found";
6035
+ already_exists: "already_exists";
6036
6036
  }>;
6037
6037
  error: z.ZodOptional<z.ZodString>;
6038
6038
  site: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -6296,19 +6296,19 @@ export declare const partnerEndpointSchemas: {
6296
6296
  _tag: z.ZodLiteral<"counted">;
6297
6297
  capturedAt: z.ZodString;
6298
6298
  counts: z.ZodObject<{
6299
- indexed: z.ZodDefault<z.ZodNumber>;
6300
- not_found: z.ZodDefault<z.ZodNumber>;
6301
- redirect: z.ZodDefault<z.ZodNumber>;
6302
6299
  unknown_to_google: z.ZodDefault<z.ZodNumber>;
6303
6300
  discovered_not_indexed: z.ZodDefault<z.ZodNumber>;
6304
6301
  crawled_not_indexed: z.ZodDefault<z.ZodNumber>;
6302
+ indexed: z.ZodDefault<z.ZodNumber>;
6305
6303
  noindex: z.ZodDefault<z.ZodNumber>;
6306
6304
  blocked_robots: z.ZodDefault<z.ZodNumber>;
6307
6305
  soft_404: z.ZodDefault<z.ZodNumber>;
6306
+ not_found: z.ZodDefault<z.ZodNumber>;
6308
6307
  server_error: z.ZodDefault<z.ZodNumber>;
6309
6308
  access_denied: z.ZodDefault<z.ZodNumber>;
6310
6309
  access_forbidden: z.ZodDefault<z.ZodNumber>;
6311
6310
  blocked_4xx: z.ZodDefault<z.ZodNumber>;
6311
+ redirect: z.ZodDefault<z.ZodNumber>;
6312
6312
  redirect_error: z.ZodDefault<z.ZodNumber>;
6313
6313
  alternate_canonical: z.ZodDefault<z.ZodNumber>;
6314
6314
  duplicate_no_canonical: z.ZodDefault<z.ZodNumber>;
@@ -17,12 +17,12 @@ export declare const GSCDUMP_V1_ANALYTICS_DIMENSIONS: readonly ["page", "query",
17
17
  export declare function createGscdumpV1BrowserSchemas(realtimeSchemas?: RealtimeV1Schemas): {
18
18
  analyticsRowsRequest: z.ZodObject<{
19
19
  dimensions: z.ZodArray<z.ZodEnum<{
20
+ date: "date";
20
21
  page: "page";
21
22
  query: "query";
22
23
  queryCanonical: "queryCanonical";
23
24
  country: "country";
24
25
  device: "device";
25
- date: "date";
26
26
  searchAppearance: "searchAppearance";
27
27
  hour: "hour";
28
28
  }>>;
@@ -0,0 +1,225 @@
1
+ import { z } from "zod";
2
+ /** Notifications one Site may send in one Pacific day. */
3
+ export declare const GOOGLE_SUBMISSION_SITE_DAILY_LIMIT = 5;
4
+ /** Days after an accepted notification before the same URL may be sent again. */
5
+ export declare const GOOGLE_SUBMISSION_URL_COOLDOWN_DAYS = 7;
6
+ /** Google's default publish quota for one Cloud project in one Pacific day. */
7
+ export declare const GOOGLE_INDEXING_API_PROJECT_DAILY_DEFAULT = 200;
8
+ /** Attempts one idempotency key may make before its receipt stays `failed`. */
9
+ export declare const GOOGLE_SUBMISSION_MAX_ATTEMPTS = 3;
10
+ /**
11
+ * `partner.users.indexing.google.grant.update`. The partner runs Google's
12
+ * consent with its dedicated Indexing API client, then hands over the refresh
13
+ * token and the scopes Google granted. gscdump refuses a grant whose `scope`
14
+ * lacks `https://www.googleapis.com/auth/indexing`.
15
+ */
16
+ export declare const indexingApiGrantUpdateV1Schema: z.ZodObject<{
17
+ refreshToken: z.ZodString;
18
+ scope: z.ZodString;
19
+ googleEmail: z.ZodNullable<z.ZodEmail>;
20
+ }, z.core.$strict>;
21
+ export declare const indexingApiGrantV1Schemas: {
22
+ producer: z.ZodDiscriminatedUnion<[z.ZodObject<{
23
+ readonly _tag: z.ZodLiteral<"missing">;
24
+ }, z.core.$strip>, z.ZodObject<{
25
+ readonly _tag: z.ZodLiteral<"granted">;
26
+ readonly googleEmail: z.ZodNullable<z.ZodString>;
27
+ readonly grantedAt: z.ZodISODateTime;
28
+ }, z.core.$strip>, z.ZodObject<{
29
+ readonly _tag: z.ZodLiteral<"reauthorization-required">;
30
+ readonly googleEmail: z.ZodNullable<z.ZodString>;
31
+ }, z.core.$strip>], "_tag">;
32
+ client: z.ZodDiscriminatedUnion<[z.ZodObject<{
33
+ readonly _tag: z.ZodLiteral<"missing">;
34
+ }, z.core.$strip>, z.ZodObject<{
35
+ readonly _tag: z.ZodLiteral<"granted">;
36
+ readonly googleEmail: z.ZodNullable<z.ZodString>;
37
+ readonly grantedAt: z.ZodISODateTime;
38
+ }, z.core.$strip>, z.ZodObject<{
39
+ readonly _tag: z.ZodLiteral<"reauthorization-required">;
40
+ readonly googleEmail: z.ZodNullable<z.ZodString>;
41
+ }, z.core.$strip>], "_tag">;
42
+ };
43
+ export declare const indexingApiGrantV1Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
44
+ readonly _tag: z.ZodLiteral<"missing">;
45
+ }, z.core.$strip>, z.ZodObject<{
46
+ readonly _tag: z.ZodLiteral<"granted">;
47
+ readonly googleEmail: z.ZodNullable<z.ZodString>;
48
+ readonly grantedAt: z.ZodISODateTime;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ readonly _tag: z.ZodLiteral<"reauthorization-required">;
51
+ readonly googleEmail: z.ZodNullable<z.ZodString>;
52
+ }, z.core.$strip>], "_tag">;
53
+ export type IndexingApiGrantV1 = z.infer<typeof indexingApiGrantV1Schema>;
54
+ /** `partner.sites.indexing.google.submissions.create`. One URL per request. */
55
+ export declare const googleSubmitV1Schema: z.ZodObject<{
56
+ url: z.ZodURL;
57
+ idempotencyKey: z.ZodString;
58
+ }, z.core.$strict>;
59
+ /**
60
+ * Why Google refused a notification. gscdump never retries a rejection.
61
+ *
62
+ * - `not-owner`: the grant's Google account does not own the property.
63
+ * - `access-revoked`: Google disabled the Indexing API for the partner's
64
+ * Cloud project. gscdump pauses the partner's Google delivery.
65
+ * - `quota-exhausted`: Google's project quota is spent until the next Pacific day.
66
+ * - `reauthorization-required`: Google refused the stored grant.
67
+ */
68
+ export declare const GOOGLE_SUBMISSION_REJECTION_REASONS: readonly ["not-owner", "access-revoked", "quota-exhausted", "reauthorization-required"];
69
+ export type GoogleSubmissionRejectionReason = typeof GOOGLE_SUBMISSION_REJECTION_REASONS[number];
70
+ export declare const googleSubmissionReceiptV1Schemas: {
71
+ producer: z.ZodDiscriminatedUnion<[z.ZodObject<{
72
+ readonly httpStatus: z.ZodLiteral<200>;
73
+ readonly reason: z.ZodNull;
74
+ readonly id: z.ZodString;
75
+ readonly url: z.ZodURL;
76
+ readonly createdAt: z.ZodISODateTime;
77
+ readonly updatedAt: z.ZodISODateTime;
78
+ readonly attempts: z.ZodNumber;
79
+ readonly _tag: z.ZodLiteral<"accepted">;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ readonly httpStatus: z.ZodNullable<z.ZodNumber>;
82
+ readonly reason: z.ZodEnum<{
83
+ "reauthorization-required": "reauthorization-required";
84
+ "not-owner": "not-owner";
85
+ "access-revoked": "access-revoked";
86
+ "quota-exhausted": "quota-exhausted";
87
+ }>;
88
+ readonly id: z.ZodString;
89
+ readonly url: z.ZodURL;
90
+ readonly createdAt: z.ZodISODateTime;
91
+ readonly updatedAt: z.ZodISODateTime;
92
+ readonly attempts: z.ZodNumber;
93
+ readonly _tag: z.ZodLiteral<"rejected">;
94
+ }, z.core.$strip>, z.ZodObject<{
95
+ readonly httpStatus: z.ZodNullable<z.ZodNumber>;
96
+ readonly reason: z.ZodString;
97
+ readonly id: z.ZodString;
98
+ readonly url: z.ZodURL;
99
+ readonly createdAt: z.ZodISODateTime;
100
+ readonly updatedAt: z.ZodISODateTime;
101
+ readonly attempts: z.ZodNumber;
102
+ readonly _tag: z.ZodLiteral<"failed">;
103
+ }, z.core.$strip>], "_tag">;
104
+ client: z.ZodDiscriminatedUnion<[z.ZodObject<{
105
+ readonly httpStatus: z.ZodLiteral<200>;
106
+ readonly reason: z.ZodNull;
107
+ readonly id: z.ZodString;
108
+ readonly url: z.ZodURL;
109
+ readonly createdAt: z.ZodISODateTime;
110
+ readonly updatedAt: z.ZodISODateTime;
111
+ readonly attempts: z.ZodNumber;
112
+ readonly _tag: z.ZodLiteral<"accepted">;
113
+ }, z.core.$strip>, z.ZodObject<{
114
+ readonly httpStatus: z.ZodNullable<z.ZodNumber>;
115
+ readonly reason: z.ZodEnum<{
116
+ "reauthorization-required": "reauthorization-required";
117
+ "not-owner": "not-owner";
118
+ "access-revoked": "access-revoked";
119
+ "quota-exhausted": "quota-exhausted";
120
+ }>;
121
+ readonly id: z.ZodString;
122
+ readonly url: z.ZodURL;
123
+ readonly createdAt: z.ZodISODateTime;
124
+ readonly updatedAt: z.ZodISODateTime;
125
+ readonly attempts: z.ZodNumber;
126
+ readonly _tag: z.ZodLiteral<"rejected">;
127
+ }, z.core.$strip>, z.ZodObject<{
128
+ readonly httpStatus: z.ZodNullable<z.ZodNumber>;
129
+ readonly reason: z.ZodString;
130
+ readonly id: z.ZodString;
131
+ readonly url: z.ZodURL;
132
+ readonly createdAt: z.ZodISODateTime;
133
+ readonly updatedAt: z.ZodISODateTime;
134
+ readonly attempts: z.ZodNumber;
135
+ readonly _tag: z.ZodLiteral<"failed">;
136
+ }, z.core.$strip>], "_tag">;
137
+ };
138
+ export declare const googleSubmissionReceiptV1Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
139
+ readonly httpStatus: z.ZodLiteral<200>;
140
+ readonly reason: z.ZodNull;
141
+ readonly id: z.ZodString;
142
+ readonly url: z.ZodURL;
143
+ readonly createdAt: z.ZodISODateTime;
144
+ readonly updatedAt: z.ZodISODateTime;
145
+ readonly attempts: z.ZodNumber;
146
+ readonly _tag: z.ZodLiteral<"accepted">;
147
+ }, z.core.$strip>, z.ZodObject<{
148
+ readonly httpStatus: z.ZodNullable<z.ZodNumber>;
149
+ readonly reason: z.ZodEnum<{
150
+ "reauthorization-required": "reauthorization-required";
151
+ "not-owner": "not-owner";
152
+ "access-revoked": "access-revoked";
153
+ "quota-exhausted": "quota-exhausted";
154
+ }>;
155
+ readonly id: z.ZodString;
156
+ readonly url: z.ZodURL;
157
+ readonly createdAt: z.ZodISODateTime;
158
+ readonly updatedAt: z.ZodISODateTime;
159
+ readonly attempts: z.ZodNumber;
160
+ readonly _tag: z.ZodLiteral<"rejected">;
161
+ }, z.core.$strip>, z.ZodObject<{
162
+ readonly httpStatus: z.ZodNullable<z.ZodNumber>;
163
+ readonly reason: z.ZodString;
164
+ readonly id: z.ZodString;
165
+ readonly url: z.ZodURL;
166
+ readonly createdAt: z.ZodISODateTime;
167
+ readonly updatedAt: z.ZodISODateTime;
168
+ readonly attempts: z.ZodNumber;
169
+ readonly _tag: z.ZodLiteral<"failed">;
170
+ }, z.core.$strip>], "_tag">;
171
+ export type GoogleSubmissionReceiptV1 = z.infer<typeof googleSubmissionReceiptV1Schema>;
172
+ /**
173
+ * The `details.reason` values of a v1 error envelope that refuses a Google
174
+ * Submission before gscdump sends anything. They are snake_case, like the
175
+ * entitlement refusals.
176
+ */
177
+ export declare const GOOGLE_SUBMISSION_REFUSAL_REASONS: readonly ["indexing_api_unavailable", "needs_indexing_api_grant", "url_outside_site", "cooling_down", "site_daily_limit", "project_quota_spent"];
178
+ export type GoogleSubmissionRefusalReason = typeof GOOGLE_SUBMISSION_REFUSAL_REASONS[number];
179
+ /**
180
+ * The `details` of a v1 error envelope that refuses a Google Submission.
181
+ *
182
+ * - `indexing_api_unavailable` (409 `invalid_request`): the partner has no
183
+ * Indexing API client, or gscdump paused its Google delivery.
184
+ * - `needs_indexing_api_grant` (409 `invalid_request`): the Site's user holds
185
+ * no usable Indexing API grant for this partner. `grant` says which.
186
+ * - `url_outside_site` (400 `invalid_request`): the URL is not on the
187
+ * registered Site host, or not inside its URL-prefix property.
188
+ * - `cooling_down` (409 `invalid_request`): Google accepted this URL at
189
+ * `lastAcceptedAt`. It may be sent again at `availableAt`.
190
+ * - `site_daily_limit` (429 `rate_limited`): the Site sent `limit`
191
+ * notifications this Pacific day. The count resets at `resetsAt`.
192
+ * - `project_quota_spent` (429 `rate_limited`): the partner's Cloud project
193
+ * has no quota left this Pacific day. It resets at `resetsAt`.
194
+ *
195
+ * Unknown `details` keys are dropped, so a newer host can add keys.
196
+ */
197
+ export declare const googleSubmissionRefusalSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
198
+ reason: z.ZodLiteral<"indexing_api_unavailable">;
199
+ }, z.core.$strip>, z.ZodObject<{
200
+ reason: z.ZodLiteral<"needs_indexing_api_grant">;
201
+ grant: z.ZodEnum<{
202
+ "reauthorization-required": "reauthorization-required";
203
+ missing: "missing";
204
+ }>;
205
+ }, z.core.$strip>, z.ZodObject<{
206
+ reason: z.ZodLiteral<"url_outside_site">;
207
+ }, z.core.$strip>, z.ZodObject<{
208
+ reason: z.ZodLiteral<"cooling_down">;
209
+ lastAcceptedAt: z.ZodISODateTime;
210
+ availableAt: z.ZodISODateTime;
211
+ }, z.core.$strip>, z.ZodObject<{
212
+ reason: z.ZodLiteral<"site_daily_limit">;
213
+ limit: z.ZodNumber;
214
+ resetsAt: z.ZodISODateTime;
215
+ }, z.core.$strip>, z.ZodObject<{
216
+ reason: z.ZodLiteral<"project_quota_spent">;
217
+ resetsAt: z.ZodISODateTime;
218
+ }, z.core.$strip>], "reason">;
219
+ export type GoogleSubmissionRefusal = z.infer<typeof googleSubmissionRefusalSchema>;
220
+ /**
221
+ * Read a Google Submission refusal from the `details` of a v1 error envelope,
222
+ * such as `GscdumpV1Error.details`. Returns `null` when the details describe a
223
+ * different failure, or a refusal this contract version does not know.
224
+ */
225
+ export declare function parseGoogleSubmissionRefusal(details: unknown): GoogleSubmissionRefusal | null;
@@ -0,0 +1,119 @@
1
+ import { defineResponseObject } from "./http-core.mjs";
2
+ import { z } from "zod";
3
+ const GOOGLE_SUBMISSION_SITE_DAILY_LIMIT = 5;
4
+ const GOOGLE_SUBMISSION_URL_COOLDOWN_DAYS = 7;
5
+ const GOOGLE_INDEXING_API_PROJECT_DAILY_DEFAULT = 200;
6
+ const GOOGLE_SUBMISSION_MAX_ATTEMPTS = 3;
7
+ const count = z.number().int().nonnegative();
8
+ const pageUrl = z.url({ protocol: /^https?$/ });
9
+ const indexingApiGrantUpdateV1Schema = z.strictObject({
10
+ refreshToken: z.string().min(1),
11
+ scope: z.string().min(1),
12
+ googleEmail: z.email().nullable()
13
+ });
14
+ const missingGrant = defineResponseObject({ _tag: z.literal("missing") });
15
+ const grantedGrant = defineResponseObject({
16
+ _tag: z.literal("granted"),
17
+ googleEmail: z.string().nullable(),
18
+ grantedAt: z.iso.datetime()
19
+ });
20
+ const reauthorizationGrant = defineResponseObject({
21
+ _tag: z.literal("reauthorization-required"),
22
+ googleEmail: z.string().nullable()
23
+ });
24
+ const indexingApiGrantV1Schemas = {
25
+ producer: z.discriminatedUnion("_tag", [
26
+ missingGrant.producer,
27
+ grantedGrant.producer,
28
+ reauthorizationGrant.producer
29
+ ]),
30
+ client: z.discriminatedUnion("_tag", [
31
+ missingGrant.client,
32
+ grantedGrant.client,
33
+ reauthorizationGrant.client
34
+ ])
35
+ };
36
+ const indexingApiGrantV1Schema = indexingApiGrantV1Schemas.producer;
37
+ const googleSubmitV1Schema = z.strictObject({
38
+ url: pageUrl,
39
+ idempotencyKey: z.string().min(1).max(128)
40
+ });
41
+ const GOOGLE_SUBMISSION_REJECTION_REASONS = [
42
+ "not-owner",
43
+ "access-revoked",
44
+ "quota-exhausted",
45
+ "reauthorization-required"
46
+ ];
47
+ const receiptShape = {
48
+ id: z.string().min(1),
49
+ url: pageUrl,
50
+ createdAt: z.iso.datetime(),
51
+ updatedAt: z.iso.datetime(),
52
+ attempts: z.number().int().min(1).max(3)
53
+ };
54
+ const acceptedReceipt = defineResponseObject({
55
+ _tag: z.literal("accepted"),
56
+ ...receiptShape,
57
+ httpStatus: z.literal(200),
58
+ reason: z.null()
59
+ });
60
+ const rejectedReceipt = defineResponseObject({
61
+ _tag: z.literal("rejected"),
62
+ ...receiptShape,
63
+ httpStatus: z.number().int().min(400).max(499).nullable(),
64
+ reason: z.enum(GOOGLE_SUBMISSION_REJECTION_REASONS)
65
+ });
66
+ const failedReceipt = defineResponseObject({
67
+ _tag: z.literal("failed"),
68
+ ...receiptShape,
69
+ httpStatus: z.number().int().min(100).max(599).nullable(),
70
+ reason: z.string().min(1)
71
+ });
72
+ const googleSubmissionReceiptV1Schemas = {
73
+ producer: z.discriminatedUnion("_tag", [
74
+ acceptedReceipt.producer,
75
+ rejectedReceipt.producer,
76
+ failedReceipt.producer
77
+ ]),
78
+ client: z.discriminatedUnion("_tag", [
79
+ acceptedReceipt.client,
80
+ rejectedReceipt.client,
81
+ failedReceipt.client
82
+ ])
83
+ };
84
+ const googleSubmissionReceiptV1Schema = googleSubmissionReceiptV1Schemas.producer;
85
+ const GOOGLE_SUBMISSION_REFUSAL_REASONS = [
86
+ "indexing_api_unavailable",
87
+ "needs_indexing_api_grant",
88
+ "url_outside_site",
89
+ "cooling_down",
90
+ "site_daily_limit",
91
+ "project_quota_spent"
92
+ ];
93
+ const googleSubmissionRefusalSchema = z.discriminatedUnion("reason", [
94
+ z.object({ reason: z.literal("indexing_api_unavailable") }),
95
+ z.object({
96
+ reason: z.literal("needs_indexing_api_grant"),
97
+ grant: z.enum(["missing", "reauthorization-required"])
98
+ }),
99
+ z.object({ reason: z.literal("url_outside_site") }),
100
+ z.object({
101
+ reason: z.literal("cooling_down"),
102
+ lastAcceptedAt: z.iso.datetime(),
103
+ availableAt: z.iso.datetime()
104
+ }),
105
+ z.object({
106
+ reason: z.literal("site_daily_limit"),
107
+ limit: count,
108
+ resetsAt: z.iso.datetime()
109
+ }),
110
+ z.object({
111
+ reason: z.literal("project_quota_spent"),
112
+ resetsAt: z.iso.datetime()
113
+ })
114
+ ]);
115
+ function parseGoogleSubmissionRefusal(details) {
116
+ const parsed = googleSubmissionRefusalSchema.safeParse(details);
117
+ return parsed.success ? parsed.data : null;
118
+ }
119
+ export { GOOGLE_INDEXING_API_PROJECT_DAILY_DEFAULT, GOOGLE_SUBMISSION_MAX_ATTEMPTS, GOOGLE_SUBMISSION_REFUSAL_REASONS, GOOGLE_SUBMISSION_REJECTION_REASONS, GOOGLE_SUBMISSION_SITE_DAILY_LIMIT, GOOGLE_SUBMISSION_URL_COOLDOWN_DAYS, googleSubmissionReceiptV1Schema, googleSubmissionReceiptV1Schemas, googleSubmissionRefusalSchema, googleSubmitV1Schema, indexingApiGrantUpdateV1Schema, indexingApiGrantV1Schema, indexingApiGrantV1Schemas, parseGoogleSubmissionRefusal };