@rizom/brain 0.2.0-alpha.45 → 0.2.0-alpha.47

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.
@@ -0,0 +1,62 @@
1
+ import type { z } from "zod";
2
+
3
+ export type ComponentType<P = Record<string, unknown>> = (props: P) => unknown;
4
+ export interface RuntimeScript {
5
+ src: string;
6
+ type?: "module" | "text/javascript";
7
+ defer?: boolean;
8
+ }
9
+ export interface TemplateInput<T = unknown> {
10
+ name: string;
11
+ schema?: z.ZodType<T>;
12
+ formatter?: (data: T) => string;
13
+ parser?: (content: string) => T;
14
+ component?: ComponentType<{ data: T }>;
15
+ runtimeScripts?: RuntimeScript[];
16
+ }
17
+ export interface Template<T = unknown> extends TemplateInput<T> {
18
+ name: string;
19
+ }
20
+ export const TemplateSchema: z.ZodSchema<Template>;
21
+ export function createTemplate<T = unknown>(
22
+ input: TemplateInput<T>,
23
+ ): Template<T>;
24
+ export function createTypedComponent<P>(
25
+ component: ComponentType<P>,
26
+ ): ComponentType<P>;
27
+
28
+ export type OutputFormat = "html" | "markdown" | "text" | string;
29
+ export type WebRenderer<T = unknown> = (props: {
30
+ data: T;
31
+ [key: string]: unknown;
32
+ }) => unknown;
33
+ export interface ViewTemplate<T = unknown> {
34
+ name: string;
35
+ schema?: z.ZodType<T>;
36
+ renderers?: Record<string, WebRenderer<T>>;
37
+ runtimeScripts?: RuntimeScript[];
38
+ }
39
+ export interface ViewTemplateRegistry {
40
+ get<T = unknown>(name: string): ViewTemplate<T> | undefined;
41
+ list(): ViewTemplate[];
42
+ }
43
+ export const ViewTemplateSchema: z.ZodSchema<ViewTemplate>;
44
+
45
+ export interface SiteBuilderOptions {
46
+ outputDir?: string;
47
+ baseUrl?: string;
48
+ [key: string]: unknown;
49
+ }
50
+ export interface BuildResult {
51
+ success: boolean;
52
+ outputDir?: string;
53
+ pages?: number;
54
+ errors?: string[];
55
+ }
56
+ export type SiteContentEntityType = string;
57
+ export interface SiteBuilder {
58
+ build(options?: SiteBuilderOptions): Promise<BuildResult>;
59
+ }
60
+ export const SiteBuilderOptionsSchema: z.ZodSchema<SiteBuilderOptions>;
61
+ export const BuildResultSchema: z.ZodSchema<BuildResult>;
62
+ export const SiteContentEntityTypeSchema: z.ZodSchema<SiteContentEntityType>;