/** * Zod Schemas for API Response Validation * @module api/schemas * * SMI-1258: Runtime validation for API responses using zod */ import { z } from 'zod'; /** * Trust tier enum values — public-facing API values only. * SMI-5205: experimental/unknown translated to community/unverified at response layer. */ export declare const TrustTierSchema: z.ZodEnum<{ official: "official"; verified: "verified"; curated: "curated"; community: "community"; unverified: "unverified"; }>; /** * Schema for individual search result from API * SMI-1577: Added .optional() and .default() to handle partial API responses */ export declare const ApiSearchResultSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodNullable; author: z.ZodNullable; publisher: z.ZodOptional>; repo_url: z.ZodOptional>; quality_score: z.ZodNullable; trust_tier: z.ZodDefault>>; tags: z.ZodDefault>; stars: z.ZodOptional>; installable: z.ZodOptional>; content: z.ZodOptional>; created_at: z.ZodOptional; updated_at: z.ZodOptional; categories: z.ZodOptional>; compatibility: z.ZodOptional>; security_score: z.ZodOptional>; last_scanned_at: z.ZodOptional>; security_findings: z.ZodOptional>>; quarantined: z.ZodOptional; scan_coverage_incomplete: z.ZodOptional; scan_coverage_note: z.ZodOptional>; license: z.ZodOptional>; }, z.core.$strip>; /** * Schema for generic API response wrapper */ export declare function createApiResponseSchema(dataSchema: T): z.ZodObject<{ data: T; meta: z.ZodOptional>; }, z.core.$strip>; /** * Schema for telemetry response */ export declare const TelemetryResponseSchema: z.ZodObject<{ data: z.ZodObject<{ ok: z.ZodBoolean; }, z.core.$strip>; meta: z.ZodOptional>; }, z.core.$strip>; /** * Schema for a single telemetry event payload. * Used to validate batch entries client-side before POST. */ export declare const TelemetryEventSchema: z.ZodObject<{ event: z.ZodEnum<{ skill_install: "skill_install"; skill_uninstall: "skill_uninstall"; search: "search"; recommend: "recommend"; skill_view: "skill_view"; skill_rate: "skill_rate"; compare: "compare"; validate: "validate"; }>; skill_id: z.ZodOptional; anonymous_id: z.ZodString; metadata: z.ZodOptional>; }, z.core.$strip>; /** * Request schema for batched telemetry: `{ events: [...] }` (1..=20). */ export declare const TelemetryEventBatchSchema: z.ZodObject<{ events: z.ZodArray; skill_id: z.ZodOptional; anonymous_id: z.ZodString; metadata: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; /** * Response schema for batched telemetry POST. * Returned ONLY for the array-body path; single-event POST still returns `{ ok: true }`. */ export declare const TelemetryBatchResponseSchema: z.ZodObject<{ ok: z.ZodBoolean; accepted: z.ZodNumber; rejected: z.ZodNumber; errors: z.ZodOptional>>; }, z.core.$strip>; export type TelemetryEventPayload = z.infer; export type TelemetryEventBatch = z.infer; export type TelemetryBatchResponse = z.infer; /** * Search response schema with array of results */ export declare const SearchResponseSchema: z.ZodObject<{ data: z.ZodArray; author: z.ZodNullable; publisher: z.ZodOptional>; repo_url: z.ZodOptional>; quality_score: z.ZodNullable; trust_tier: z.ZodDefault>>; tags: z.ZodDefault>; stars: z.ZodOptional>; installable: z.ZodOptional>; content: z.ZodOptional>; created_at: z.ZodOptional; updated_at: z.ZodOptional; categories: z.ZodOptional>; compatibility: z.ZodOptional>; security_score: z.ZodOptional>; last_scanned_at: z.ZodOptional>; security_findings: z.ZodOptional>>; quarantined: z.ZodOptional; scan_coverage_incomplete: z.ZodOptional; scan_coverage_note: z.ZodOptional>; license: z.ZodOptional>; }, z.core.$strip>>; meta: z.ZodOptional>; }, z.core.$strip>; /** * Single skill response schema */ export declare const SingleSkillResponseSchema: z.ZodObject<{ data: z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodNullable; author: z.ZodNullable; publisher: z.ZodOptional>; repo_url: z.ZodOptional>; quality_score: z.ZodNullable; trust_tier: z.ZodDefault>>; tags: z.ZodDefault>; stars: z.ZodOptional>; installable: z.ZodOptional>; content: z.ZodOptional>; created_at: z.ZodOptional; updated_at: z.ZodOptional; categories: z.ZodOptional>; compatibility: z.ZodOptional>; security_score: z.ZodOptional>; last_scanned_at: z.ZodOptional>; security_findings: z.ZodOptional>>; quarantined: z.ZodOptional; scan_coverage_incomplete: z.ZodOptional; scan_coverage_note: z.ZodOptional>; license: z.ZodOptional>; }, z.core.$strip>; meta: z.ZodOptional>; }, z.core.$strip>; /** * Schema for the `GET /stats` basic (non-detailed) response body. * Field names match supabase/functions/stats/index.ts's `cachedStats` shape. */ export declare const PlatformStatsSchema: z.ZodObject<{ skillCount: z.ZodNumber; githubTotal: z.ZodNumber; lastUpdated: z.ZodString; }, z.core.$strip>; /** * Stats response schema (`{ data: PlatformStats, meta?: ... }`) */ export declare const StatsResponseSchema: z.ZodObject<{ data: z.ZodObject<{ skillCount: z.ZodNumber; githubTotal: z.ZodNumber; lastUpdated: z.ZodString; }, z.core.$strip>; meta: z.ZodOptional>; }, z.core.$strip>; /** * Inferred type from ApiSearchResultSchema */ export type ValidatedApiSearchResult = z.infer; /** * Inferred type from SearchResponseSchema */ export type ValidatedSearchResponse = z.infer; /** * Inferred type from SingleSkillResponseSchema */ export type ValidatedSingleSkillResponse = z.infer; /** * Inferred type from TelemetryResponseSchema */ export type ValidatedTelemetryResponse = z.infer; /** * Inferred type from PlatformStatsSchema */ export type ValidatedPlatformStats = z.infer; /** * Inferred type from StatsResponseSchema */ export type ValidatedStatsResponse = z.infer; //# sourceMappingURL=schemas.d.ts.map