alex4o
alex4o4w ago

Import tasks from files.

I am trying to make it so each file exports a task that can be imported.
export async function main(arangodb: Arangodb, databaseName: string, emailAccount: string) {
const database = createClient(arangodb)({ databaseName })

return getSuppliersFromArango(database)(emailAccount)
}

export const get_suppliers_from_arango = wmill.task(
(p: { arangodb: Arangodb; databaseName: string; emailAccount: string }) =>
main(p.arangodb, p.databaseName, p.emailAccount),
)
export async function main(arangodb: Arangodb, databaseName: string, emailAccount: string) {
const database = createClient(arangodb)({ databaseName })

return getSuppliersFromArango(database)(emailAccount)
}

export const get_suppliers_from_arango = wmill.task(
(p: { arangodb: Arangodb; databaseName: string; emailAccount: string }) =>
main(p.arangodb, p.databaseName, p.emailAccount),
)
This way I can make flows defined in code that are fully type safe and still reside in separate files? Is that something that is/will be supported or I should think of a different strategy.
1 Reply
rubenf
rubenf4w ago
it will work yes