feat(workflows): Workflow DX (#5607)

This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2023-11-22 17:23:39 +00:00
1 parent 2850e9a772
commit 9f9db39698
22 files changed
+2768 -16

No files matched your search

+10
View File
@@ -96,6 +96,7 @@ export default async ({
)
registerCoreRouters(pluginDetails, container)
await registerSubscribers(pluginDetails, container, activityId)
await registerWorkflows(pluginDetails)
})
)
@@ -634,6 +635,15 @@ function registerRepositories(
})
}
/**
* import files from the workflows directory to run the registration of the wofklows
* @param pluginDetails
*/
async function registerWorkflows(pluginDetails: PluginDetails): Promise<void> {
const files = glob.sync(`${pluginDetails.resolve}/workflows/*.js`, {})
await Promise.all(files.map(async (file) => import(file)))
}
/**
* Registers a plugin's models at the right location in our container. Models
* must inherit from BaseModel. Models are registered directly in the container.