Support multiple onBeforeHooks per entity

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-10-05 11:10:25 -04:00
1 parent c8631346ca
commit 44a8824635
6 files changed
+74 -111

No files matched your search

+4 -4
View File
@@ -55,15 +55,15 @@ export class CatalogEntityRegistry {
* @param onBeforeRun The function that should return a boolean if the onBeforeRun of catalog entity should be triggered.
* @returns A function to remove that hook
*/
addOnBeforeRun(catalogEntityUid: CatalogEntity["metadata"]["uid"], onBeforeRun: CatalogEntityOnBeforeRun) {
return registry.addOnBeforeRun(catalogEntityUid, onBeforeRun);
addOnBeforeRun(entity: CatalogEntity, onBeforeRun: CatalogEntityOnBeforeRun) {
return registry.addOnBeforeRun(entity, onBeforeRun);
}
/**
* Returns one catalog entity onBeforeRun by catalog entity uid
*/
onBeforeRun(catalogEntityUid: CatalogEntity["metadata"]["uid"]): CatalogEntityOnBeforeRun | undefined {
return registry.getOnBeforeRun(catalogEntityUid);
onBeforeRun(entity: CatalogEntity): Promise<boolean> {
return registry.onBeforeRun(entity);
}
}