This package contains the shared TypeScript types, interfaces, and validation schemas used across the Elata VSM System. It ensures type safety and consistent data structures between the scraper, ChatGPT agent's output structure, and web platform.
The shared types package serves several critical functions:
- Defines the core data structures for news articles and categories
- Provides Zod schemas for runtime validation
- Ensures consistent typing between backend and frontend
- Documents the shape of AI-generated content
interface Article {
title: string;
description: string;
url: string;
source: string;
author?: string;
relevanceScore: number;
}
type SummaryOutputCategoriesKey =
| "research"
| "industry"
| "biohacking"
| "computational"
| "hardware"
| "desci"
| "offTopic";
interface SummaryOutput {
[key in SummaryOutputCategoriesKey]: Article[];
}
export const articleSchema = z.object({
title: z.string(),
description: z.string(),
url: z.string().url(),
source: z.string(),
author: z.string().optional(),
relevanceScore: z.number().min(0).max(1),
});
export const summarySchema = z.object({
research: z.array(articleSchema),
industry: z.array(articleSchema),
// ... other categories
});
import { articleSchema, type Article } from "@elata/shared-types";
const validateArticle = (data: unknown): Article => {
return articleSchema.parse(data);
};
This package needs to be build before being accessed by other packages.
npm run build