@gscdump/contracts 5.0.0 → 5.2.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.
@@ -8,6 +8,7 @@ import { bingDataQueryV1Schema, bingDataV1Schemas } from "./bing-data.mjs";
8
8
  import { bingAuthorizationRequestV1Schema, bingAuthorizationV1Schemas, bingLinkResultV1Schemas, bingSitemapSubmitRequestV1Schema, bingSitemapSubmitResultV1Schemas, bingSitesQueryV1Schema, bingSitesV1Schemas } from "./bing-sites.mjs";
9
9
  import { GSCDUMP_REALTIME_ACK_POLICY, GSCDUMP_REALTIME_CLOSE_CODES, GSCDUMP_REALTIME_CONNECTION_POLICY, GSCDUMP_REALTIME_LIMITS, GSCDUMP_REALTIME_PING, GSCDUMP_REALTIME_PONG, GSCDUMP_REALTIME_REPLAY_POLICY, GSCDUMP_REALTIME_SUBPROTOCOL, GSCDUMP_REALTIME_TICKET_AUDIENCE, GSCDUMP_REALTIME_TICKET_ISSUER, GSCDUMP_REALTIME_TICKET_POLICY, GSCDUMP_REALTIME_TICKET_PREFIX, REALTIME_V1_EVENT_SEMANTICS, createRealtimeV1Schemas } from "./realtime.mjs";
10
10
  import { GSCDUMP_V1_ANALYTICS_DIMENSIONS, createGscdumpV1BrowserSchemas } from "./browser.mjs";
11
+ import { googleSubmissionReceiptV1Schemas, googleSubmitV1Schema, indexingApiGrantUpdateV1Schema, indexingApiGrantV1Schemas } from "./google-indexing.mjs";
11
12
  import { indexNowConfigureV1Schema, indexNowConnectionV1Schemas, indexNowSubmissionReceiptV1Schemas, indexNowSubmitV1Schema } from "./indexnow.mjs";
12
13
  import { gscdumpV1OperationRoute, gscdumpV1Surface } from "./route-catalog.mjs";
13
14
  import { sitemapSubmissionV1Schemas, sitemapSubmitResultV1Schemas } from "./sitemap-submission.mjs";
@@ -273,6 +274,15 @@ function createGscdumpV1Protocol() {
273
274
  submissionReceipts: z.array(indexNowSubmissionReceiptV1Schemas.client),
274
275
  pagination: bingIndexingEvidencePagination.client
275
276
  }), partnerResponseMeta);
277
+ const indexingApiGrantResponse = defineSuccessResponse(indexingApiGrantV1Schemas, partnerResponseMeta);
278
+ const googleSubmissionResponse = defineSuccessResponse(defineResponseObject({ submissionReceipt: googleSubmissionReceiptV1Schemas.producer }, { submissionReceipt: googleSubmissionReceiptV1Schemas.client }), partnerResponseMeta);
279
+ const googleSubmissionReceiptsResponse = defineSuccessResponse(defineResponseObject({
280
+ submissionReceipts: z.array(googleSubmissionReceiptV1Schemas.producer),
281
+ pagination: bingIndexingEvidencePagination.producer
282
+ }, {
283
+ submissionReceipts: z.array(googleSubmissionReceiptV1Schemas.client),
284
+ pagination: bingIndexingEvidencePagination.client
285
+ }), partnerResponseMeta);
276
286
  const bingSitesResponse = defineSuccessResponse(bingSitesV1Schemas, partnerResponseMeta);
277
287
  const bingLinkResponse = defineSuccessResponse(bingLinkResultV1Schemas, partnerResponseMeta);
278
288
  const bingAuthorizationResponse = defineSuccessResponse(bingAuthorizationV1Schemas, partnerResponseMeta);
@@ -1845,6 +1855,321 @@ function createGscdumpV1Protocol() {
1845
1855
  }
1846
1856
  }
1847
1857
  }),
1858
+ getUserIndexingApiGrant: defineHttpOperation({
1859
+ ...gscdumpV1OperationRoute("partner.users.indexing.google.grant.get"),
1860
+ visibility: "public",
1861
+ semantics: {
1862
+ kind: "query",
1863
+ sideEffects: "none",
1864
+ idempotent: true,
1865
+ retry: "idempotent",
1866
+ readConsistency: "primary"
1867
+ },
1868
+ auth: {
1869
+ credentials: ["partner_key"],
1870
+ scopes: ["indexing:read"],
1871
+ ownership: [{
1872
+ credential: "partner_key",
1873
+ rule: "linked_user"
1874
+ }]
1875
+ },
1876
+ request: {
1877
+ params: z.strictObject({ userId: realtimeSchemas.publicUserId }),
1878
+ query: null,
1879
+ headers: requestHeaders,
1880
+ body: null
1881
+ },
1882
+ responses: { 200: indexingApiGrantResponse },
1883
+ errors: partnerUserErrors,
1884
+ errorResponse: errorEnvelopeSchemas(partnerUserErrors, realtimeSchemas.publicRequestId),
1885
+ resources: {
1886
+ reads: [{
1887
+ type: "partner.user",
1888
+ idFrom: "params.userId"
1889
+ }],
1890
+ changes: []
1891
+ },
1892
+ lifecycle: { introduced: "5.1.0" },
1893
+ docs: {
1894
+ summary: "Get Indexing API grant",
1895
+ description: "Returns the user's Google Indexing API grant for the calling partner.",
1896
+ tags: ["Indexing"],
1897
+ examples: {
1898
+ request: { params: { userId: "u_01" } },
1899
+ response: {
1900
+ data: { _tag: "missing" },
1901
+ meta: {
1902
+ requestId: "req_01",
1903
+ surface: "partner",
1904
+ version: "1.0"
1905
+ }
1906
+ }
1907
+ }
1908
+ }
1909
+ }),
1910
+ updateUserIndexingApiGrant: defineHttpOperation({
1911
+ ...gscdumpV1OperationRoute("partner.users.indexing.google.grant.update"),
1912
+ visibility: "public",
1913
+ semantics: {
1914
+ kind: "mutation",
1915
+ sideEffects: "state",
1916
+ idempotent: true,
1917
+ retry: "idempotent",
1918
+ readConsistency: null
1919
+ },
1920
+ auth: {
1921
+ credentials: ["partner_key"],
1922
+ scopes: ["indexing:write"],
1923
+ ownership: [{
1924
+ credential: "partner_key",
1925
+ rule: "linked_user"
1926
+ }]
1927
+ },
1928
+ request: {
1929
+ params: z.strictObject({ userId: realtimeSchemas.publicUserId }),
1930
+ query: null,
1931
+ headers: requestHeaders,
1932
+ body: indexingApiGrantUpdateV1Schema
1933
+ },
1934
+ responses: { 200: indexingApiGrantResponse },
1935
+ errors: partnerUserErrors,
1936
+ errorResponse: errorEnvelopeSchemas(partnerUserErrors, realtimeSchemas.publicRequestId),
1937
+ resources: {
1938
+ reads: [{
1939
+ type: "partner.user",
1940
+ idFrom: "params.userId"
1941
+ }],
1942
+ changes: [{
1943
+ type: "partner.user",
1944
+ idFrom: "params.userId"
1945
+ }]
1946
+ },
1947
+ lifecycle: { introduced: "5.1.0" },
1948
+ docs: {
1949
+ summary: "Store Indexing API grant",
1950
+ description: "Stores the Google Indexing API grant that the partner obtained with its dedicated Cloud project. A grant without the Indexing API scope is refused.",
1951
+ tags: ["Indexing"],
1952
+ examples: {
1953
+ request: {
1954
+ params: { userId: "u_01" },
1955
+ body: {
1956
+ refreshToken: "refresh",
1957
+ scope: "openid email https://www.googleapis.com/auth/indexing",
1958
+ googleEmail: "owner@example.com"
1959
+ }
1960
+ },
1961
+ response: {
1962
+ data: {
1963
+ _tag: "granted",
1964
+ googleEmail: "owner@example.com",
1965
+ grantedAt: "2026-10-01T00:00:00.000Z"
1966
+ },
1967
+ meta: {
1968
+ requestId: "req_01",
1969
+ surface: "partner",
1970
+ version: "1.0"
1971
+ }
1972
+ }
1973
+ }
1974
+ }
1975
+ }),
1976
+ revokeUserIndexingApiGrant: defineHttpOperation({
1977
+ ...gscdumpV1OperationRoute("partner.users.indexing.google.grant.revoke"),
1978
+ visibility: "public",
1979
+ semantics: {
1980
+ kind: "mutation",
1981
+ sideEffects: "state",
1982
+ idempotent: true,
1983
+ retry: "idempotent",
1984
+ readConsistency: null
1985
+ },
1986
+ auth: {
1987
+ credentials: ["partner_key"],
1988
+ scopes: ["indexing:write"],
1989
+ ownership: [{
1990
+ credential: "partner_key",
1991
+ rule: "linked_user"
1992
+ }]
1993
+ },
1994
+ request: {
1995
+ params: z.strictObject({ userId: realtimeSchemas.publicUserId }),
1996
+ query: null,
1997
+ headers: requestHeaders,
1998
+ body: null
1999
+ },
2000
+ responses: { 200: indexingApiGrantResponse },
2001
+ errors: partnerUserErrors,
2002
+ errorResponse: errorEnvelopeSchemas(partnerUserErrors, realtimeSchemas.publicRequestId),
2003
+ resources: {
2004
+ reads: [{
2005
+ type: "partner.user",
2006
+ idFrom: "params.userId"
2007
+ }],
2008
+ changes: [{
2009
+ type: "partner.user",
2010
+ idFrom: "params.userId"
2011
+ }]
2012
+ },
2013
+ lifecycle: { introduced: "5.1.0" },
2014
+ docs: {
2015
+ summary: "Revoke Indexing API grant",
2016
+ description: "Revokes the grant at Google, then deletes it.",
2017
+ tags: ["Indexing"],
2018
+ examples: {
2019
+ request: { params: { userId: "u_01" } },
2020
+ response: {
2021
+ data: { _tag: "missing" },
2022
+ meta: {
2023
+ requestId: "req_01",
2024
+ surface: "partner",
2025
+ version: "1.0"
2026
+ }
2027
+ }
2028
+ }
2029
+ }
2030
+ }),
2031
+ createSiteGoogleSubmission: defineHttpOperation({
2032
+ ...gscdumpV1OperationRoute("partner.sites.indexing.google.submissions.create"),
2033
+ visibility: "public",
2034
+ semantics: {
2035
+ kind: "mutation",
2036
+ sideEffects: "state",
2037
+ idempotent: true,
2038
+ retry: "idempotent",
2039
+ readConsistency: null
2040
+ },
2041
+ auth: {
2042
+ credentials: ["partner_key"],
2043
+ scopes: ["indexing:write"],
2044
+ ownership: [{
2045
+ credential: "partner_key",
2046
+ rule: "authorized_site"
2047
+ }]
2048
+ },
2049
+ request: {
2050
+ params: z.strictObject({ siteId: realtimeSchemas.publicSiteId }),
2051
+ query: null,
2052
+ headers: requestHeaders,
2053
+ body: googleSubmitV1Schema
2054
+ },
2055
+ responses: { 200: googleSubmissionResponse },
2056
+ errors: partnerSiteErrors,
2057
+ errorResponse: errorEnvelopeSchemas(partnerSiteErrors, realtimeSchemas.publicRequestId),
2058
+ resources: {
2059
+ reads: [{
2060
+ type: "site.indexing",
2061
+ idFrom: "params.siteId"
2062
+ }],
2063
+ changes: [{
2064
+ type: "site.indexing",
2065
+ idFrom: "params.siteId"
2066
+ }]
2067
+ },
2068
+ lifecycle: { introduced: "5.1.0" },
2069
+ docs: {
2070
+ summary: "Submit a Google Indexing API notification",
2071
+ description: "Sends one URL_UPDATED notification for one URL with the Site user's Indexing API grant and returns a Submission Receipt. Acceptance does not prove indexing.",
2072
+ tags: ["Indexing"],
2073
+ examples: {
2074
+ request: {
2075
+ params: { siteId: "s_01" },
2076
+ body: {
2077
+ url: "https://example.com/jobs/1",
2078
+ idempotencyKey: "req_01"
2079
+ }
2080
+ },
2081
+ response: {
2082
+ data: { submissionReceipt: {
2083
+ _tag: "accepted",
2084
+ id: "gi_01",
2085
+ url: "https://example.com/jobs/1",
2086
+ createdAt: "2026-10-01T00:00:00.000Z",
2087
+ updatedAt: "2026-10-01T00:00:00.000Z",
2088
+ attempts: 1,
2089
+ httpStatus: 200,
2090
+ reason: null
2091
+ } },
2092
+ meta: {
2093
+ requestId: "req_01",
2094
+ surface: "partner",
2095
+ version: "1.0"
2096
+ }
2097
+ }
2098
+ }
2099
+ }
2100
+ }),
2101
+ listSiteGoogleSubmissionReceipts: defineHttpOperation({
2102
+ ...gscdumpV1OperationRoute("partner.sites.indexing.google.submissions.list"),
2103
+ visibility: "public",
2104
+ semantics: {
2105
+ kind: "query",
2106
+ sideEffects: "none",
2107
+ idempotent: true,
2108
+ retry: "idempotent",
2109
+ readConsistency: "primary"
2110
+ },
2111
+ auth: {
2112
+ credentials: ["user_key", "partner_key"],
2113
+ scopes: ["indexing:read"],
2114
+ ownership: [{
2115
+ credential: "user_key",
2116
+ rule: "authorized_site"
2117
+ }, {
2118
+ credential: "partner_key",
2119
+ rule: "authorized_site"
2120
+ }]
2121
+ },
2122
+ request: {
2123
+ params: z.strictObject({ siteId: realtimeSchemas.publicSiteId }),
2124
+ query: z.strictObject({
2125
+ limit: z.coerce.number().int().min(1).max(100).default(25),
2126
+ offset: z.coerce.number().int().min(0).default(0)
2127
+ }),
2128
+ headers: requestHeaders,
2129
+ body: null
2130
+ },
2131
+ responses: { 200: googleSubmissionReceiptsResponse },
2132
+ errors: partnerSiteErrors,
2133
+ errorResponse: errorEnvelopeSchemas(partnerSiteErrors, realtimeSchemas.publicRequestId),
2134
+ resources: {
2135
+ reads: [{
2136
+ type: "site.indexing",
2137
+ idFrom: "params.siteId"
2138
+ }],
2139
+ changes: []
2140
+ },
2141
+ lifecycle: { introduced: "5.1.0" },
2142
+ docs: {
2143
+ summary: "List Google Indexing API Submission Receipts",
2144
+ description: "Returns Google Indexing API Submission Receipts for this Site, newest first.",
2145
+ tags: ["Indexing"],
2146
+ examples: {
2147
+ request: {
2148
+ params: { siteId: "s_01" },
2149
+ query: {
2150
+ limit: 25,
2151
+ offset: 0
2152
+ }
2153
+ },
2154
+ response: {
2155
+ data: {
2156
+ submissionReceipts: [],
2157
+ pagination: {
2158
+ total: 0,
2159
+ limit: 25,
2160
+ offset: 0,
2161
+ hasMore: false
2162
+ }
2163
+ },
2164
+ meta: {
2165
+ requestId: "req_01",
2166
+ surface: "partner",
2167
+ version: "1.0"
2168
+ }
2169
+ }
2170
+ }
2171
+ }
2172
+ }),
1848
2173
  listUserBingSites: defineHttpOperation({
1849
2174
  ...gscdumpV1OperationRoute("partner.users.indexing.bing.sites.list"),
1850
2175
  visibility: "public",
@@ -5810,6 +6135,9 @@ function createGscdumpV1Protocol() {
5810
6135
  indexNowConnectionResponse,
5811
6136
  indexNowSubmissionResponse,
5812
6137
  indexNowSubmissionReceiptsResponse,
6138
+ indexingApiGrantResponse,
6139
+ googleSubmissionResponse,
6140
+ googleSubmissionReceiptsResponse,
5813
6141
  bingSitesResponse,
5814
6142
  bingLinkResponse,
5815
6143
  bingAuthorizationResponse,
@@ -96,6 +96,31 @@ export declare const GSCDUMP_V1_ROUTE_CATALOG: {
96
96
  readonly method: "GET";
97
97
  readonly template: "/sites/{siteId}/indexing/indexnow/submissions";
98
98
  };
99
+ readonly 'partner.sites.indexing.google.submissions.create': {
100
+ readonly surface: "partner";
101
+ readonly method: "POST";
102
+ readonly template: "/sites/{siteId}/indexing/google/submissions";
103
+ };
104
+ readonly 'partner.sites.indexing.google.submissions.list': {
105
+ readonly surface: "partner";
106
+ readonly method: "GET";
107
+ readonly template: "/sites/{siteId}/indexing/google/submissions";
108
+ };
109
+ readonly 'partner.users.indexing.google.grant.get': {
110
+ readonly surface: "partner";
111
+ readonly method: "GET";
112
+ readonly template: "/users/{userId}/indexing/google/grant";
113
+ };
114
+ readonly 'partner.users.indexing.google.grant.update': {
115
+ readonly surface: "partner";
116
+ readonly method: "PATCH";
117
+ readonly template: "/users/{userId}/indexing/google/grant";
118
+ };
119
+ readonly 'partner.users.indexing.google.grant.revoke': {
120
+ readonly surface: "partner";
121
+ readonly method: "DELETE";
122
+ readonly template: "/users/{userId}/indexing/google/grant";
123
+ };
99
124
  readonly 'partner.sites.indexing.bing.connection.get': {
100
125
  readonly surface: "partner";
101
126
  readonly method: "GET";
@@ -83,6 +83,31 @@ const GSCDUMP_V1_ROUTE_CATALOG = {
83
83
  method: "GET",
84
84
  template: "/sites/{siteId}/indexing/indexnow/submissions"
85
85
  },
86
+ "partner.sites.indexing.google.submissions.create": {
87
+ surface: "partner",
88
+ method: "POST",
89
+ template: "/sites/{siteId}/indexing/google/submissions"
90
+ },
91
+ "partner.sites.indexing.google.submissions.list": {
92
+ surface: "partner",
93
+ method: "GET",
94
+ template: "/sites/{siteId}/indexing/google/submissions"
95
+ },
96
+ "partner.users.indexing.google.grant.get": {
97
+ surface: "partner",
98
+ method: "GET",
99
+ template: "/users/{userId}/indexing/google/grant"
100
+ },
101
+ "partner.users.indexing.google.grant.update": {
102
+ surface: "partner",
103
+ method: "PATCH",
104
+ template: "/users/{userId}/indexing/google/grant"
105
+ },
106
+ "partner.users.indexing.google.grant.revoke": {
107
+ surface: "partner",
108
+ method: "DELETE",
109
+ template: "/users/{userId}/indexing/google/grant"
110
+ },
86
111
  "partner.sites.indexing.bing.connection.get": {
87
112
  surface: "partner",
88
113
  method: "GET",
@@ -263,14 +263,14 @@ export declare const sitemapSubmitResultV1Schemas: {
263
263
  }, z.core.$strip>, z.ZodObject<{
264
264
  readonly _tag: z.ZodLiteral<"failed">;
265
265
  readonly reason: z.ZodEnum<{
266
- "permission-lost": "permission-lost";
267
- "grant-missing": "grant-missing";
268
- "no-sitemap-found": "no-sitemap-found";
269
- "provider-unavailable": "provider-unavailable";
270
- rejected: "rejected";
271
266
  "needs-write-access": "needs-write-access";
272
267
  "insufficient-permission": "insufficient-permission";
268
+ "no-sitemap-found": "no-sitemap-found";
269
+ "permission-lost": "permission-lost";
270
+ "grant-missing": "grant-missing";
273
271
  "already-listed": "already-listed";
272
+ rejected: "rejected";
273
+ "provider-unavailable": "provider-unavailable";
274
274
  }>;
275
275
  readonly retryable: z.ZodBoolean;
276
276
  readonly sitemapUrl: z.ZodNullable<z.ZodURL>;
@@ -282,14 +282,14 @@ export declare const sitemapSubmitResultV1Schemas: {
282
282
  }, z.core.$strip>, z.ZodObject<{
283
283
  readonly _tag: z.ZodLiteral<"failed">;
284
284
  readonly reason: z.ZodEnum<{
285
- "permission-lost": "permission-lost";
286
- "grant-missing": "grant-missing";
287
- "no-sitemap-found": "no-sitemap-found";
288
- "provider-unavailable": "provider-unavailable";
289
- rejected: "rejected";
290
285
  "needs-write-access": "needs-write-access";
291
286
  "insufficient-permission": "insufficient-permission";
287
+ "no-sitemap-found": "no-sitemap-found";
288
+ "permission-lost": "permission-lost";
289
+ "grant-missing": "grant-missing";
292
290
  "already-listed": "already-listed";
291
+ rejected: "rejected";
292
+ "provider-unavailable": "provider-unavailable";
293
293
  }>;
294
294
  readonly retryable: z.ZodBoolean;
295
295
  readonly sitemapUrl: z.ZodNullable<z.ZodURL>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/contracts",
3
3
  "type": "module",
4
- "version": "5.0.0",
4
+ "version": "5.2.0",
5
5
  "description": "Shared gscdump.com API, webhook, realtime, and lifecycle contracts.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",