mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 23:30:10 +00:00
26 lines
992 B
TypeScript
26 lines
992 B
TypeScript
import ComponentMetadata from 'Common/Types/Workflow/Component';
|
|
import Entities from 'Model/Models/Index';
|
|
import BaseModelComponentFactory from 'Common/Types/Workflow/Components/BaseModel';
|
|
import Components from 'Common/Types/Workflow/Components';
|
|
import Dictionary from 'Common/Types/Dictionary';
|
|
|
|
export const loadAllComponentMetadata: Function =
|
|
(): Dictionary<ComponentMetadata> => {
|
|
const initComponents: Dictionary<ComponentMetadata> = {};
|
|
|
|
for (const componentMetadata of Components) {
|
|
initComponents[componentMetadata.id] = componentMetadata;
|
|
}
|
|
|
|
for (const model of Entities) {
|
|
const baseModelComponentMetadata: Array<ComponentMetadata> =
|
|
BaseModelComponentFactory.getComponents(new model());
|
|
|
|
for (const componentMetadata of baseModelComponentMetadata) {
|
|
initComponents[componentMetadata.id] = componentMetadata;
|
|
}
|
|
}
|
|
|
|
return initComponents;
|
|
};
|