import { GSCDUMP_HTTP_V1_VERSION } from "./version.mjs"; import { ZodRawShape, ZodTypeAny, z } from "zod"; declare const HTTP_V1_SURFACES: readonly ["partner", "analytics", "realtime"]; declare const HTTP_V1_METHODS: readonly ["DELETE", "GET", "PATCH", "POST"]; declare const HTTP_V1_CREDENTIALS: readonly ["user_key", "partner_key"]; 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"]; declare const HTTP_V1_CREDENTIAL_SCOPES: { 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"]; 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"]; }; 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"]; type HttpV1SurfaceName = typeof HTTP_V1_SURFACES[number]; type HttpV1Method = typeof HTTP_V1_METHODS[number]; type HttpV1Credential = typeof HTTP_V1_CREDENTIALS[number]; type HttpV1Scope = typeof HTTP_V1_SCOPES[number]; type HttpV1ErrorCode = typeof HTTP_V1_ERROR_CODES[number]; type HttpV1Visibility = 'internal' | 'public'; type HttpV1OwnershipRule = 'self' | 'linked_user' | 'authorized_site' | 'partner_tenant' | 'principal_stream'; type HttpV1ResourceType = 'partner.user' | 'partner.team' | 'user.sites' | 'site.registration' | 'site.lifecycle' | 'site.analytics' | 'site.sitemaps' | 'site.indexing' | 'site.auth'; interface CompatibleResponseSchema { producer: TProducer; client: TClient; } interface HttpV1RequestSchemas { params: ZodTypeAny | null; query: ZodTypeAny | null; headers: ZodTypeAny | null; body: ZodTypeAny | null; } interface HttpV1Semantics { kind: 'mutation' | 'query'; sideEffects: 'none' | 'state'; idempotent: boolean; retry: 'idempotent' | 'never'; readConsistency: 'primary' | 'replica-ok' | null; } interface HttpV1ResourceReference { type: HttpV1ResourceType; idFrom: `params.${string}` | 'principal.id'; } interface HttpV1OperationDefinition { id: string; method: HttpV1Method; path: `/${string}`; visibility: HttpV1Visibility; semantics: HttpV1Semantics; auth: { credentials: readonly HttpV1Credential[]; scopes: readonly HttpV1Scope[]; ownership: readonly { credential: HttpV1Credential; rule: HttpV1OwnershipRule; }[]; }; request: HttpV1RequestSchemas; responses: Readonly>; errors: readonly HttpV1ErrorCode[]; errorResponse: CompatibleResponseSchema; resources: { reads: readonly HttpV1ResourceReference[]; changes: readonly HttpV1ResourceReference[]; }; lifecycle: { introduced: `${number}.${number}.${number}`; deprecated?: `${number}.${number}.${number}`; sunset?: string; }; docs: { summary: string; description: string; tags: readonly string[]; examples: { request: unknown; response: unknown; }; }; } interface HttpV1Surface> = Readonly>> { name: HttpV1SurfaceName; prefix: `/api/${HttpV1SurfaceName}/v1`; version: '1.0'; operations: TOperations; } interface HttpV1ProtocolLike { surfaces: Readonly>; } type HttpV1ProtocolSurface = TProtocol['surfaces'][keyof TProtocol['surfaces']]; type HttpV1SurfaceOperation = TSurface extends HttpV1Surface ? TOperations[keyof TOperations] : never; type HttpV1ProtocolOperation = HttpV1SurfaceOperation>; type HttpV1OperationEntry = HttpV1ProtocolSurface extends (infer TSurface) ? TSurface extends HttpV1Surface ? { surface: TSurface; operation: HttpV1SurfaceOperation; } : never : never; interface HttpV1OperationRequest { method: string; surface: string; /** Surface-relative path without a leading slash or query string. */ path: string; } type ResolvedHttpV1Operation = TEntry & { params: Record; /** Canonical surface-relative path. */ path: string; }; declare function defineHttpOperation(operation: TOperation): TOperation; declare function defineHttpSurface>>(surface: HttpV1Surface): HttpV1Surface; declare function listHttpOperations(protocol: TProtocol): HttpV1OperationEntry[]; declare function defineResponseObject(producerShape: TProducerShape, clientShape?: TClientShape): CompatibleResponseSchema, z.ZodObject>; declare function defineSuccessResponse(data: CompatibleResponseSchema, meta: CompatibleResponseSchema): CompatibleResponseSchema, z.ZodObject<{ data: TDataClient; meta: TMetaClient; }>>; declare function buildHttpOperationPath(surface: HttpV1Surface, operation: HttpV1OperationDefinition, params?: unknown): string; declare function resolveHttpOperation(entries: TEntries, request: HttpV1OperationRequest): ResolvedHttpV1Operation | null; 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, HttpV1RequestSchemas, HttpV1ResourceReference, HttpV1ResourceType, HttpV1Scope, HttpV1Semantics, HttpV1Surface, HttpV1SurfaceName, HttpV1Visibility, ResolvedHttpV1Operation, buildHttpOperationPath, defineHttpOperation, defineHttpSurface, defineResponseObject, defineSuccessResponse, listHttpOperations, resolveHttpOperation };