Merge pull request #14507 from Budibase/BUDI-8609/run-row-action-as-sync
Run row action as sync
This commit is contained in:
commit
d54f87af03
|
@ -672,6 +672,7 @@ describe("/rowsActions", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
it("can trigger an automation given valid data", async () => {
|
it("can trigger an automation given valid data", async () => {
|
||||||
|
expect(await getAutomationLogs()).toBeEmpty()
|
||||||
await config.api.rowAction.trigger(tableId, rowAction.id, {
|
await config.api.rowAction.trigger(tableId, rowAction.id, {
|
||||||
rowId: row._id!,
|
rowId: row._id!,
|
||||||
})
|
})
|
||||||
|
@ -680,13 +681,19 @@ describe("/rowsActions", () => {
|
||||||
expect(automationLogs).toEqual([
|
expect(automationLogs).toEqual([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
automationId: rowAction.automationId,
|
automationId: rowAction.automationId,
|
||||||
trigger: expect.objectContaining({
|
trigger: {
|
||||||
|
id: "trigger",
|
||||||
|
stepId: "ROW_ACTION",
|
||||||
|
inputs: null,
|
||||||
outputs: {
|
outputs: {
|
||||||
fields: {},
|
fields: {},
|
||||||
row: await config.api.row.get(tableId, row._id!),
|
row: await config.api.row.get(tableId, row._id!),
|
||||||
table: await config.api.table.get(tableId),
|
table: await config.api.table.get(tableId),
|
||||||
|
automation: expect.objectContaining({
|
||||||
|
_id: rowAction.automationId,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
}),
|
},
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
@ -731,6 +738,7 @@ describe("/rowsActions", () => {
|
||||||
)
|
)
|
||||||
|
|
||||||
await config.publish()
|
await config.publish()
|
||||||
|
expect(await getAutomationLogs()).toBeEmpty()
|
||||||
await config.api.rowAction.trigger(viewId, rowAction.id, {
|
await config.api.rowAction.trigger(viewId, rowAction.id, {
|
||||||
rowId: row._id!,
|
rowId: row._id!,
|
||||||
})
|
})
|
||||||
|
|
|
@ -216,11 +216,15 @@ export async function run(tableId: any, rowActionId: any, rowId: string) {
|
||||||
const automation = await sdk.automations.get(rowAction.automationId)
|
const automation = await sdk.automations.get(rowAction.automationId)
|
||||||
|
|
||||||
const row = await sdk.rows.find(tableId, rowId)
|
const row = await sdk.rows.find(tableId, rowId)
|
||||||
await triggers.externalTrigger(automation, {
|
await triggers.externalTrigger(
|
||||||
fields: {
|
automation,
|
||||||
row,
|
{
|
||||||
table,
|
fields: {
|
||||||
|
row,
|
||||||
|
table,
|
||||||
|
},
|
||||||
|
appId: context.getAppId(),
|
||||||
},
|
},
|
||||||
appId: context.getAppId(),
|
{ getResponses: true }
|
||||||
})
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue