38 lines
874 B
TypeScript
38 lines
874 B
TypeScript
|
|
export interface Progress {
|
||
|
|
current: number;
|
||
|
|
total: number;
|
||
|
|
status: string;
|
||
|
|
metadata?: {
|
||
|
|
sourceURL?: string;
|
||
|
|
[key: string]: any;
|
||
|
|
};
|
||
|
|
currentDocumentUrl?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export class Document {
|
||
|
|
id?: string;
|
||
|
|
content: string;
|
||
|
|
markdown?: string;
|
||
|
|
createdAt?: Date;
|
||
|
|
updatedAt?: Date;
|
||
|
|
type?: string;
|
||
|
|
metadata: {
|
||
|
|
sourceURL?: string;
|
||
|
|
[key: string]: any;
|
||
|
|
};
|
||
|
|
childrenLinks?: string[];
|
||
|
|
|
||
|
|
constructor(data: Partial<Document>) {
|
||
|
|
if (!data.content) {
|
||
|
|
throw new Error("Missing required fields");
|
||
|
|
}
|
||
|
|
this.content = data.content;
|
||
|
|
this.createdAt = data.createdAt || new Date();
|
||
|
|
this.updatedAt = data.updatedAt || new Date();
|
||
|
|
this.type = data.type || "unknown";
|
||
|
|
this.metadata = data.metadata || { sourceURL: "" };
|
||
|
|
this.markdown = data.markdown || "";
|
||
|
|
this.childrenLinks = data.childrenLinks || undefined;
|
||
|
|
}
|
||
|
|
}
|