@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.
- package/dist/brain.js +866 -1072
- package/dist/entities.d.ts +154 -0
- package/dist/entities.js +172 -0
- package/dist/entities.js.map +242 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +504 -0
- package/dist/index.js.map +586 -0
- package/dist/interfaces.d.ts +129 -0
- package/dist/interfaces.js +172 -0
- package/dist/interfaces.js.map +285 -0
- package/dist/plugins.d.ts +523 -0
- package/dist/plugins.js +178 -0
- package/dist/plugins.js.map +298 -0
- package/dist/services.d.ts +115 -0
- package/dist/services.js +172 -0
- package/dist/services.js.map +290 -0
- package/dist/site.js +166 -166
- package/dist/site.js.map +17 -17
- package/dist/templates.d.ts +62 -0
- package/dist/templates.js +172 -0
- package/dist/templates.js.map +206 -0
- package/package.json +26 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { DataSource, BaseDataSourceContext, BaseEntity } from "./entities";
|
|
3
|
+
import type { ApiRouteDefinition, WebRouteDefinition } from "./interfaces";
|
|
4
|
+
|
|
5
|
+
export interface BaseQuery {
|
|
6
|
+
id?: string;
|
|
7
|
+
limit?: number;
|
|
8
|
+
offset?: number;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export type SortField = string;
|
|
12
|
+
export interface NavigationResult {
|
|
13
|
+
items: unknown[];
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface EntityDataSourceConfig {
|
|
17
|
+
id: string;
|
|
18
|
+
entityType: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
}
|
|
21
|
+
export class BaseEntityDataSource<
|
|
22
|
+
TQuery extends BaseQuery = BaseQuery,
|
|
23
|
+
TResult = unknown,
|
|
24
|
+
> implements DataSource<TQuery, TResult> {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly entityType: string;
|
|
27
|
+
readonly name?: string;
|
|
28
|
+
constructor(config: EntityDataSourceConfig);
|
|
29
|
+
fetch(query?: TQuery, context?: BaseDataSourceContext): Promise<TResult>;
|
|
30
|
+
}
|
|
31
|
+
export const baseQuerySchema: z.ZodSchema<BaseQuery>;
|
|
32
|
+
export const baseInputSchema: z.ZodSchema<unknown>;
|
|
33
|
+
|
|
34
|
+
export interface JobContext {
|
|
35
|
+
jobId: string;
|
|
36
|
+
rootJobId?: string;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
export interface JobOptions {
|
|
40
|
+
priority?: number;
|
|
41
|
+
delay?: number;
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
export interface JobInfo {
|
|
45
|
+
id: string;
|
|
46
|
+
type: string;
|
|
47
|
+
status: string;
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}
|
|
50
|
+
export interface JobProgressEvent {
|
|
51
|
+
jobId: string;
|
|
52
|
+
progress?: number;
|
|
53
|
+
total?: number;
|
|
54
|
+
message?: string;
|
|
55
|
+
status?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface JobHandler<TData = unknown, TResult = unknown> {
|
|
58
|
+
process(data: TData, context: JobContext): Promise<TResult>;
|
|
59
|
+
validateAndParse?(data: unknown): TData | null;
|
|
60
|
+
onError?(
|
|
61
|
+
error: Error,
|
|
62
|
+
data: TData,
|
|
63
|
+
context: JobContext,
|
|
64
|
+
): Promise<void> | void;
|
|
65
|
+
}
|
|
66
|
+
export class BaseJobHandler<
|
|
67
|
+
TData = unknown,
|
|
68
|
+
TResult = unknown,
|
|
69
|
+
> implements JobHandler<TData, TResult> {
|
|
70
|
+
process(data: TData, context: JobContext): Promise<TResult>;
|
|
71
|
+
validateAndParse?(data: unknown): TData | null;
|
|
72
|
+
}
|
|
73
|
+
export const JobProgressEventSchema: z.ZodSchema<JobProgressEvent>;
|
|
74
|
+
|
|
75
|
+
export interface GenerationJobHandlerConfig {
|
|
76
|
+
entityType: string;
|
|
77
|
+
templateName?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface GeneratedContent<TEntity extends BaseEntity = BaseEntity> {
|
|
80
|
+
entity: TEntity;
|
|
81
|
+
content: string;
|
|
82
|
+
metadata?: Record<string, unknown>;
|
|
83
|
+
}
|
|
84
|
+
export class BaseGenerationJobHandler<
|
|
85
|
+
TData = unknown,
|
|
86
|
+
TEntity extends BaseEntity = BaseEntity,
|
|
87
|
+
> extends BaseJobHandler<TData, GeneratedContent<TEntity>> {
|
|
88
|
+
constructor(config: GenerationJobHandlerConfig);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface BatchOperation {
|
|
92
|
+
type: string;
|
|
93
|
+
data: unknown;
|
|
94
|
+
options?: JobOptions;
|
|
95
|
+
}
|
|
96
|
+
export interface Batch {
|
|
97
|
+
id: string;
|
|
98
|
+
operations: BatchOperation[];
|
|
99
|
+
}
|
|
100
|
+
export interface BatchJobStatus {
|
|
101
|
+
batchId: string;
|
|
102
|
+
total: number;
|
|
103
|
+
completed: number;
|
|
104
|
+
failed: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function ensureUniqueTitle(args: {
|
|
108
|
+
entityType: string;
|
|
109
|
+
title: string;
|
|
110
|
+
entityService: unknown;
|
|
111
|
+
ai?: unknown;
|
|
112
|
+
regeneratePrompt?: string;
|
|
113
|
+
}): Promise<string>;
|
|
114
|
+
|
|
115
|
+
export type { ApiRouteDefinition, WebRouteDefinition };
|