52 lines
822 B
TypeScript
52 lines
822 B
TypeScript
/**
|
|
*/
|
|
class type_document
|
|
{
|
|
|
|
/**
|
|
*/
|
|
public readonly definitions : Record<string, type_object>;
|
|
|
|
|
|
/**
|
|
*/
|
|
public readonly content_title : string;
|
|
|
|
|
|
/**
|
|
*/
|
|
public readonly content_main : type_object;
|
|
|
|
|
|
/**
|
|
*/
|
|
public constructor(
|
|
definitions : Record<string, type_object>,
|
|
content_title : string,
|
|
content_main : type_object
|
|
)
|
|
{
|
|
this.definitions = definitions;
|
|
this.content_title = content_title;
|
|
this.content_main = content_main;
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
public static from_raw(
|
|
document_raw : any
|
|
) : type_document
|
|
{
|
|
return (new type_document(
|
|
Object.fromEntries(
|
|
Object.entries(document_raw["definitions"])
|
|
.map(([name, object_raw]) => ([name, object_make(object_raw)]))
|
|
),
|
|
document_raw["content"]["title"],
|
|
object_make(document_raw["content"]["main"])
|
|
));
|
|
}
|
|
|
|
}
|