Update automation context to simplify applying snippet context

This commit is contained in:
Andrew Kingston 2024-03-13 09:15:33 +00:00
parent 20f4c5a77d
commit 70821182fe
1 changed files with 3 additions and 6 deletions

View File

@ -122,17 +122,14 @@ export async function doInAutomationContext<T>(params: {
automationId: string automationId: string
task: () => T task: () => T
}): Promise<T> { }): Promise<T> {
const tenantId = getTenantIDFromAppID(params.appId) await ensureSnippetContext()
return newContext( return newContext(
{ {
tenantId, tenantId: getTenantIDFromAppID(params.appId),
appId: params.appId, appId: params.appId,
automationId: params.automationId, automationId: params.automationId,
}, },
async () => { params.task
await ensureSnippetContext()
return await params.task()
}
) )
} }