@gscdump/contracts 3.5.0 → 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.
@@ -1,6 +1,6 @@
1
1
  import { CompatibleResponseSchema } from "./http-core.mjs";
2
2
  import { z } from "zod";
3
- declare const bingDataQueryV1Schema: z.ZodObject<{
3
+ export declare const bingDataQueryV1Schema: z.ZodObject<{
4
4
  dataset: z.ZodEnum<{
5
5
  keywords: "keywords";
6
6
  pages: "pages";
@@ -55,7 +55,7 @@ declare const pagination: CompatibleResponseSchema<z.ZodObject<{
55
55
  readonly offset: z.ZodNumber;
56
56
  readonly hasMore: z.ZodBoolean;
57
57
  }, z.core.$strip>>;
58
- declare const bingDataV1Schemas: {
58
+ export declare const bingDataV1Schemas: {
59
59
  producer: z.ZodDiscriminatedUnion<[z.ZodObject<{
60
60
  searchEngine: z.ZodLiteral<"bing">;
61
61
  siteUrl: z.ZodURL;
@@ -191,6 +191,5 @@ declare const bingDataV1Schemas: {
191
191
  pagination: typeof pagination.producer;
192
192
  }, z.core.$strip>], "dataset">;
193
193
  };
194
- type BingDataV1 = z.infer<typeof bingDataV1Schemas.producer>;
195
- type BingDataQueryV1 = z.infer<typeof bingDataQueryV1Schema>;
196
- export { BingDataQueryV1, BingDataV1, bingDataQueryV1Schema, bingDataV1Schemas };
194
+ export type BingDataV1 = z.infer<typeof bingDataV1Schemas.producer>;
195
+ export type BingDataQueryV1 = z.infer<typeof bingDataQueryV1Schema>;
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
- declare const bingCnameVerificationV1Schema: z.ZodObject<{
2
+ export declare const bingCnameVerificationV1Schema: z.ZodObject<{
3
3
  _tag: z.ZodLiteral<"cname">;
4
4
  name: z.ZodString;
5
5
  value: z.ZodLiteral<"verify.bing.com">;
6
6
  }, z.core.$strict>;
7
- declare const bingConnectionV1Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7
+ export declare const bingConnectionV1Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
8
8
  _tag: z.ZodLiteral<"disconnected">;
9
9
  searchEngine: z.ZodLiteral<"bing">;
10
10
  }, z.core.$strict>, z.ZodObject<{
@@ -43,6 +43,5 @@ declare const bingConnectionV1Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
43
43
  verified: z.ZodLiteral<true>;
44
44
  reason: z.ZodLiteral<"permission-lost">;
45
45
  }, z.core.$strict>], "_tag">;
46
- type BingCnameVerificationV1 = z.infer<typeof bingCnameVerificationV1Schema>;
47
- type BingConnectionV1 = z.infer<typeof bingConnectionV1Schema>;
48
- export { BingCnameVerificationV1, BingConnectionV1, bingCnameVerificationV1Schema, bingConnectionV1Schema };
46
+ export type BingCnameVerificationV1 = z.infer<typeof bingCnameVerificationV1Schema>;
47
+ export type BingConnectionV1 = z.infer<typeof bingConnectionV1Schema>;
@@ -1,7 +1,7 @@
1
1
  import { CompatibleResponseSchema } from "./http-core.mjs";
2
2
  import { RealtimeV1Schemas } from "./realtime.mjs";
3
3
  import { z } from "zod";
4
- interface NormalizedFilterV1 {
4
+ export interface NormalizedFilterV1 {
5
5
  _filters: Array<{
6
6
  dimension: string;
7
7
  operator: string;
@@ -11,8 +11,8 @@ interface NormalizedFilterV1 {
11
11
  _nestedGroups?: NormalizedFilterV1[];
12
12
  _groupType?: 'and' | 'or';
13
13
  }
14
- declare const GSCDUMP_V1_ANALYTICS_DIMENSIONS: readonly ["page", "query", "queryCanonical", "country", "device", "date", "searchAppearance", "hour"];
15
- declare function createGscdumpV1BrowserSchemas(realtimeSchemas?: RealtimeV1Schemas): {
14
+ export declare const GSCDUMP_V1_ANALYTICS_DIMENSIONS: readonly ["page", "query", "queryCanonical", "country", "device", "date", "searchAppearance", "hour"];
15
+ export declare function createGscdumpV1BrowserSchemas(realtimeSchemas?: RealtimeV1Schemas): {
16
16
  analyticsRowsRequest: z.ZodObject<{
17
17
  dimensions: z.ZodArray<z.ZodEnum<{
18
18
  page: "page";
@@ -463,5 +463,4 @@ declare function createGscdumpV1BrowserSchemas(realtimeSchemas?: RealtimeV1Schem
463
463
  version: z.ZodLiteral<"1.0">;
464
464
  }, z.core.$loose>;
465
465
  }, z.core.$loose>;
466
- };
467
- export { GSCDUMP_V1_ANALYTICS_DIMENSIONS, NormalizedFilterV1, createGscdumpV1BrowserSchemas };
466
+ };
@@ -1,4 +1,3 @@
1
- type ContractDocument = Record<string, unknown>;
2
- declare function serializeContractDocument(document: ContractDocument): string;
3
- declare function createGscdumpV1Documents(): Record<'openapi.partner.v1.json' | 'openapi.analytics.v1.json' | 'openapi.realtime.v1.json' | 'asyncapi.realtime.v1.json', ContractDocument>;
4
- export { ContractDocument, createGscdumpV1Documents, serializeContractDocument };
1
+ export type ContractDocument = Record<string, unknown>;
2
+ export declare function serializeContractDocument(document: ContractDocument): string;
3
+ export declare function createGscdumpV1Documents(): Record<'openapi.partner.v1.json' | 'openapi.analytics.v1.json' | 'openapi.realtime.v1.json' | 'asyncapi.realtime.v1.json', ContractDocument>;
@@ -3,45 +3,45 @@ import { HttpV1RouteSurfaceName } from "./route-surfaces.mjs";
3
3
  import { HttpV1RouteMethod } from "./route-catalog.mjs";
4
4
  import { GSCDUMP_HTTP_V1_VERSION } from "./version.mjs";
5
5
  import { ZodRawShape, ZodTypeAny, z } from "zod";
6
- declare const HTTP_V1_SURFACES: readonly ["partner", "analytics", "realtime"];
7
- declare const HTTP_V1_METHODS: readonly ["DELETE", "GET", "PATCH", "POST"];
8
- declare const HTTP_V1_CREDENTIALS: readonly ["user_key", "partner_key"];
9
- declare const HTTP_V1_SCOPES: readonly ["users:read", "users:write", "sites:read", "sites:write", "analytics:read", "analytics:execute", "indexing:read", "indexing:write", "sitemaps:read", "sitemaps:write", "settings:read", "settings:write", "realtime:connect", "teams:read", "teams:write"];
10
- declare const HTTP_V1_CREDENTIAL_SCOPES: {
6
+ export declare const HTTP_V1_SURFACES: readonly ["partner", "analytics", "realtime"];
7
+ export declare const HTTP_V1_METHODS: readonly ["DELETE", "GET", "PATCH", "POST"];
8
+ export declare const HTTP_V1_CREDENTIALS: readonly ["user_key", "partner_key"];
9
+ export declare const HTTP_V1_SCOPES: readonly ["users:read", "users:write", "sites:read", "sites:write", "analytics:read", "analytics:execute", "indexing:read", "indexing:write", "sitemaps:read", "sitemaps:write", "settings:read", "settings:write", "realtime:connect", "teams:read", "teams:write"];
10
+ export declare const HTTP_V1_CREDENTIAL_SCOPES: {
11
11
  readonly user_key: readonly ["users:read", "users:write", "sites:read", "sites:write", "analytics:read", "analytics:execute", "indexing:read", "indexing:write", "sitemaps:read", "sitemaps:write", "settings:read", "settings:write", "realtime:connect"];
12
12
  readonly partner_key: readonly ["users:read", "users:write", "sites:read", "sites:write", "analytics:read", "analytics:execute", "indexing:read", "indexing:write", "sitemaps:read", "sitemaps:write", "settings:read", "settings:write", "realtime:connect", "teams:read", "teams:write"];
13
13
  };
14
- declare const HTTP_V1_ERROR_CODES: readonly ["invalid_request", "unauthorized", "forbidden", "user_not_found", "site_not_found", "rate_limited", "realtime_unavailable", "internal_error", "contract_violation"];
15
- type HttpV1SurfaceName = HttpV1RouteSurfaceName;
16
- type HttpV1Method = HttpV1RouteMethod;
17
- type HttpV1Credential = typeof HTTP_V1_CREDENTIALS[number];
18
- type HttpV1Scope = typeof HTTP_V1_SCOPES[number];
19
- type HttpV1ErrorCode = typeof HTTP_V1_ERROR_CODES[number];
20
- type HttpV1Visibility = 'internal' | 'public';
21
- type HttpV1OwnershipRule = 'self' | 'linked_user' | 'authorized_site' | 'partner_tenant' | 'principal_stream';
22
- type HttpV1ResourceType = 'partner.user' | 'partner.team' | 'user.sites' | 'site.registration' | 'site.lifecycle' | 'site.analytics' | 'site.sitemaps' | 'site.indexing' | 'site.auth';
23
- interface CompatibleResponseSchema<TProducer extends ZodTypeAny = ZodTypeAny, TClient extends ZodTypeAny = ZodTypeAny> {
14
+ export declare const HTTP_V1_ERROR_CODES: readonly ["invalid_request", "unauthorized", "forbidden", "user_not_found", "site_not_found", "rate_limited", "realtime_unavailable", "internal_error", "contract_violation"];
15
+ export type HttpV1SurfaceName = HttpV1RouteSurfaceName;
16
+ export type HttpV1Method = HttpV1RouteMethod;
17
+ export type HttpV1Credential = typeof HTTP_V1_CREDENTIALS[number];
18
+ export type HttpV1Scope = typeof HTTP_V1_SCOPES[number];
19
+ export type HttpV1ErrorCode = typeof HTTP_V1_ERROR_CODES[number];
20
+ export type HttpV1Visibility = 'internal' | 'public';
21
+ export type HttpV1OwnershipRule = 'self' | 'linked_user' | 'authorized_site' | 'partner_tenant' | 'principal_stream';
22
+ export type HttpV1ResourceType = 'partner.user' | 'partner.team' | 'user.sites' | 'site.registration' | 'site.lifecycle' | 'site.analytics' | 'site.sitemaps' | 'site.indexing' | 'site.auth';
23
+ export interface CompatibleResponseSchema<TProducer extends ZodTypeAny = ZodTypeAny, TClient extends ZodTypeAny = ZodTypeAny> {
24
24
  producer: TProducer;
25
25
  client: TClient;
26
26
  }
27
- interface HttpV1RequestSchemas {
27
+ export interface HttpV1RequestSchemas {
28
28
  params: ZodTypeAny | null;
29
29
  query: ZodTypeAny | null;
30
30
  headers: ZodTypeAny | null;
31
31
  body: ZodTypeAny | null;
32
32
  }
33
- interface HttpV1Semantics {
33
+ export interface HttpV1Semantics {
34
34
  kind: 'mutation' | 'query';
35
35
  sideEffects: 'none' | 'state';
36
36
  idempotent: boolean;
37
37
  retry: 'idempotent' | 'never';
38
38
  readConsistency: 'primary' | 'replica-ok' | null;
39
39
  }
40
- interface HttpV1ResourceReference {
40
+ export interface HttpV1ResourceReference {
41
41
  type: HttpV1ResourceType;
42
42
  idFrom: `params.${string}` | 'principal.id';
43
43
  }
44
- interface HttpV1OperationDefinition {
44
+ export interface HttpV1OperationDefinition {
45
45
  id: string;
46
46
  method: HttpV1Method;
47
47
  path: `/${string}`;
@@ -78,34 +78,34 @@ interface HttpV1OperationDefinition {
78
78
  };
79
79
  };
80
80
  }
81
- interface HttpV1Surface<TOperations extends Readonly<Record<string, HttpV1OperationDefinition>> = Readonly<Record<string, HttpV1OperationDefinition>>> {
81
+ export interface HttpV1Surface<TOperations extends Readonly<Record<string, HttpV1OperationDefinition>> = Readonly<Record<string, HttpV1OperationDefinition>>> {
82
82
  name: HttpV1SurfaceName;
83
83
  prefix: `/api/${HttpV1SurfaceName}/v1`;
84
84
  version: '1.0';
85
85
  operations: TOperations;
86
86
  }
87
- interface HttpV1ProtocolLike {
87
+ export interface HttpV1ProtocolLike {
88
88
  surfaces: Readonly<Record<string, HttpV1Surface>>;
89
89
  }
90
90
  type HttpV1ProtocolSurface<TProtocol extends HttpV1ProtocolLike> = TProtocol['surfaces'][keyof TProtocol['surfaces']];
91
91
  type HttpV1SurfaceOperation<TSurface> = TSurface extends HttpV1Surface<infer TOperations> ? TOperations[keyof TOperations] : never;
92
- type HttpV1ProtocolOperation<TProtocol extends HttpV1ProtocolLike> = HttpV1SurfaceOperation<HttpV1ProtocolSurface<TProtocol>>;
93
- type HttpV1OperationEntry<TProtocol extends HttpV1ProtocolLike = HttpV1ProtocolLike> = HttpV1ProtocolSurface<TProtocol> extends (infer TSurface) ? TSurface extends HttpV1Surface ? {
92
+ export type HttpV1ProtocolOperation<TProtocol extends HttpV1ProtocolLike> = HttpV1SurfaceOperation<HttpV1ProtocolSurface<TProtocol>>;
93
+ export type HttpV1OperationEntry<TProtocol extends HttpV1ProtocolLike = HttpV1ProtocolLike> = HttpV1ProtocolSurface<TProtocol> extends (infer TSurface) ? TSurface extends HttpV1Surface ? {
94
94
  surface: TSurface;
95
95
  operation: HttpV1SurfaceOperation<TSurface>;
96
96
  } : never : never;
97
- interface HttpV1OperationRequest {
97
+ export interface HttpV1OperationRequest {
98
98
  method: string;
99
99
  surface: string;
100
100
  /** Surface-relative path without a leading slash or query string. */
101
101
  path: string;
102
102
  }
103
- type ResolvedHttpV1Operation<TEntry extends HttpV1OperationEntry = HttpV1OperationEntry> = TEntry & {
103
+ export type ResolvedHttpV1Operation<TEntry extends HttpV1OperationEntry = HttpV1OperationEntry> = TEntry & {
104
104
  params: Record<string, unknown>;
105
105
  /** Canonical surface-relative path. */
106
106
  path: string;
107
107
  };
108
- type HttpV1RegistryOperationId<TProtocol extends HttpV1ProtocolLike> = HttpV1ProtocolOperation<TProtocol>['id'] & string;
108
+ export type HttpV1RegistryOperationId<TProtocol extends HttpV1ProtocolLike> = HttpV1ProtocolOperation<TProtocol>['id'] & string;
109
109
  type HttpV1OperationEntryWithId<TEntry, TId extends string> = TEntry extends {
110
110
  surface: infer TSurface extends HttpV1Surface;
111
111
  operation: infer TOperation extends HttpV1OperationDefinition;
@@ -115,31 +115,31 @@ type HttpV1OperationEntryWithId<TEntry, TId extends string> = TEntry extends {
115
115
  surface: TSurface;
116
116
  operation: TOperation;
117
117
  } : never : never;
118
- type HttpV1RegistryOperationEntry<TProtocol extends HttpV1ProtocolLike, TId extends HttpV1RegistryOperationId<TProtocol>> = HttpV1OperationEntryWithId<HttpV1OperationEntry<TProtocol>, TId>;
119
- type HttpV1RegistryPathParams<TProtocol extends HttpV1ProtocolLike, TId extends HttpV1RegistryOperationId<TProtocol>> = HttpV1RegistryOperationEntry<TProtocol, TId>['operation']['request']['params'] extends (infer TParams) ? TParams extends ZodTypeAny ? z.input<TParams> : undefined : never;
120
- interface HttpV1RegistryPathOptions {
118
+ export type HttpV1RegistryOperationEntry<TProtocol extends HttpV1ProtocolLike, TId extends HttpV1RegistryOperationId<TProtocol>> = HttpV1OperationEntryWithId<HttpV1OperationEntry<TProtocol>, TId>;
119
+ export type HttpV1RegistryPathParams<TProtocol extends HttpV1ProtocolLike, TId extends HttpV1RegistryOperationId<TProtocol>> = HttpV1RegistryOperationEntry<TProtocol, TId>['operation']['request']['params'] extends (infer TParams) ? TParams extends ZodTypeAny ? z.input<TParams> : undefined : never;
120
+ export interface HttpV1RegistryPathOptions {
121
121
  /** Root replacing the contract's `/api` segment. */
122
122
  apiRoot?: string;
123
123
  }
124
- interface HttpV1Registry<TProtocol extends HttpV1ProtocolLike> {
124
+ export interface HttpV1Registry<TProtocol extends HttpV1ProtocolLike> {
125
125
  operation: <const TId extends HttpV1RegistryOperationId<TProtocol>>(id: TId) => HttpV1RegistryOperationEntry<TProtocol, TId>;
126
126
  resolve: <const TAllowed extends readonly HttpV1RegistryOperationId<TProtocol>[]>(request: HttpV1OperationRequest, options: {
127
127
  allow: TAllowed;
128
128
  }) => ResolvedHttpV1Operation<HttpV1RegistryOperationEntry<TProtocol, TAllowed[number]>> | null;
129
129
  path: <const TId extends HttpV1RegistryOperationId<TProtocol>>(id: TId, params?: HttpV1RegistryPathParams<TProtocol, TId>, options?: HttpV1RegistryPathOptions) => string;
130
130
  }
131
- declare function defineHttpOperation<const TOperation extends HttpV1OperationDefinition>(operation: TOperation): TOperation;
132
- declare function defineHttpSurface<const TOperations extends Readonly<Record<string, HttpV1OperationDefinition>>>(surface: HttpV1Surface<TOperations>): HttpV1Surface<TOperations>;
133
- declare function listHttpOperations<const TProtocol extends HttpV1ProtocolLike>(protocol: TProtocol): HttpV1OperationEntry<TProtocol>[];
134
- declare function defineResponseObject<const TProducerShape extends ZodRawShape, const TClientShape extends ZodRawShape = TProducerShape>(producerShape: TProducerShape, clientShape?: TClientShape): CompatibleResponseSchema<z.ZodObject<TProducerShape>, z.ZodObject<TClientShape>>;
135
- declare function defineSuccessResponse<const TDataProducer extends ZodTypeAny, const TDataClient extends ZodTypeAny, const TMetaProducer extends ZodTypeAny, const TMetaClient extends ZodTypeAny>(data: CompatibleResponseSchema<TDataProducer, TDataClient>, meta: CompatibleResponseSchema<TMetaProducer, TMetaClient>): CompatibleResponseSchema<z.ZodObject<{
131
+ export declare function defineHttpOperation<const TOperation extends HttpV1OperationDefinition>(operation: TOperation): TOperation;
132
+ export declare function defineHttpSurface<const TOperations extends Readonly<Record<string, HttpV1OperationDefinition>>>(surface: HttpV1Surface<TOperations>): HttpV1Surface<TOperations>;
133
+ export declare function listHttpOperations<const TProtocol extends HttpV1ProtocolLike>(protocol: TProtocol): HttpV1OperationEntry<TProtocol>[];
134
+ export declare function defineResponseObject<const TProducerShape extends ZodRawShape, const TClientShape extends ZodRawShape = TProducerShape>(producerShape: TProducerShape, clientShape?: TClientShape): CompatibleResponseSchema<z.ZodObject<TProducerShape>, z.ZodObject<TClientShape>>;
135
+ export declare function defineSuccessResponse<const TDataProducer extends ZodTypeAny, const TDataClient extends ZodTypeAny, const TMetaProducer extends ZodTypeAny, const TMetaClient extends ZodTypeAny>(data: CompatibleResponseSchema<TDataProducer, TDataClient>, meta: CompatibleResponseSchema<TMetaProducer, TMetaClient>): CompatibleResponseSchema<z.ZodObject<{
136
136
  data: TDataProducer;
137
137
  meta: TMetaProducer;
138
138
  }>, z.ZodObject<{
139
139
  data: TDataClient;
140
140
  meta: TMetaClient;
141
141
  }>>;
142
- declare function buildHttpOperationPath(surface: HttpV1Surface, operation: HttpV1OperationDefinition, params?: unknown): string;
143
- declare function resolveHttpOperation<const TEntries extends readonly HttpV1OperationEntry[]>(entries: TEntries, request: HttpV1OperationRequest): ResolvedHttpV1Operation<TEntries[number]> | null;
144
- declare function createHttpV1Registry<const TProtocol extends HttpV1ProtocolLike>(protocol: TProtocol): HttpV1Registry<TProtocol>;
145
- export { CompatibleResponseSchema, GSCDUMP_HTTP_V1_VERSION, HTTP_V1_CREDENTIALS, HTTP_V1_CREDENTIAL_SCOPES, HTTP_V1_ERROR_CODES, HTTP_V1_METHODS, HTTP_V1_SCOPES, HTTP_V1_SURFACES, HttpV1Credential, HttpV1ErrorCode, HttpV1Method, HttpV1OperationDefinition, HttpV1OperationEntry, HttpV1OperationRequest, HttpV1OwnershipRule, HttpV1ProtocolLike, HttpV1ProtocolOperation, HttpV1Registry, HttpV1RegistryOperationEntry, HttpV1RegistryOperationId, HttpV1RegistryPathOptions, HttpV1RegistryPathParams, HttpV1RequestSchemas, HttpV1ResourceReference, HttpV1ResourceType, HttpV1Scope, HttpV1Semantics, HttpV1Surface, HttpV1SurfaceName, HttpV1Visibility, ResolvedHttpV1Operation, type UnknownHttpV1OperationError, buildHttpOperationPath, createHttpV1Registry, defineHttpOperation, defineHttpSurface, defineResponseObject, defineSuccessResponse, isUnknownHttpV1OperationError, listHttpOperations, resolveHttpOperation };
142
+ export declare function buildHttpOperationPath(surface: HttpV1Surface, operation: HttpV1OperationDefinition, params?: unknown): string;
143
+ export declare function resolveHttpOperation<const TEntries extends readonly HttpV1OperationEntry[]>(entries: TEntries, request: HttpV1OperationRequest): ResolvedHttpV1Operation<TEntries[number]> | null;
144
+ export declare function createHttpV1Registry<const TProtocol extends HttpV1ProtocolLike>(protocol: TProtocol): HttpV1Registry<TProtocol>;
145
+ export { GSCDUMP_HTTP_V1_VERSION, type UnknownHttpV1OperationError, isUnknownHttpV1OperationError };
@@ -1,6 +1,5 @@
1
- interface UnknownHttpV1OperationError extends TypeError {
1
+ export interface UnknownHttpV1OperationError extends TypeError {
2
2
  readonly tag: 'UnknownHttpV1OperationError';
3
3
  readonly operationId: string;
4
4
  }
5
- declare function isUnknownHttpV1OperationError(error: unknown): error is UnknownHttpV1OperationError;
6
- export { UnknownHttpV1OperationError, isUnknownHttpV1OperationError };
5
+ export declare function isUnknownHttpV1OperationError(error: unknown): error is UnknownHttpV1OperationError;