From 5ac5a63dc57193627689cf0c6dfde57161047038 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 3 Sep 2024 16:51:56 +0200 Subject: [PATCH 1/2] Run row action as sync --- packages/server/src/sdk/app/rowActions.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/server/src/sdk/app/rowActions.ts b/packages/server/src/sdk/app/rowActions.ts index aed2dff1a46..e963a4317bf 100644 --- a/packages/server/src/sdk/app/rowActions.ts +++ b/packages/server/src/sdk/app/rowActions.ts @@ -216,11 +216,15 @@ export async function run(tableId: any, rowActionId: any, rowId: string) { const automation = await sdk.automations.get(rowAction.automationId) const row = await sdk.rows.find(tableId, rowId) - await triggers.externalTrigger(automation, { - fields: { - row, - table, + await triggers.externalTrigger( + automation, + { + fields: { + row, + table, + }, + appId: context.getAppId(), }, - appId: context.getAppId(), - }) + { getResponses: true } + ) } From c830e2a5899219084ec6dc34d4df314bf6fc6c96 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 3 Sep 2024 16:52:27 +0200 Subject: [PATCH 2/2] Fix tests --- .../server/src/api/routes/tests/rowAction.spec.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/routes/tests/rowAction.spec.ts b/packages/server/src/api/routes/tests/rowAction.spec.ts index 40ba2c18118..d43f5075d03 100644 --- a/packages/server/src/api/routes/tests/rowAction.spec.ts +++ b/packages/server/src/api/routes/tests/rowAction.spec.ts @@ -672,6 +672,7 @@ describe("/rowsActions", () => { } it("can trigger an automation given valid data", async () => { + expect(await getAutomationLogs()).toBeEmpty() await config.api.rowAction.trigger(tableId, rowAction.id, { rowId: row._id!, }) @@ -680,13 +681,19 @@ describe("/rowsActions", () => { expect(automationLogs).toEqual([ expect.objectContaining({ automationId: rowAction.automationId, - trigger: expect.objectContaining({ + trigger: { + id: "trigger", + stepId: "ROW_ACTION", + inputs: null, outputs: { fields: {}, row: await config.api.row.get(tableId, row._id!), table: await config.api.table.get(tableId), + automation: expect.objectContaining({ + _id: rowAction.automationId, + }), }, - }), + }, }), ]) }) @@ -731,6 +738,7 @@ describe("/rowsActions", () => { ) await config.publish() + expect(await getAutomationLogs()).toBeEmpty() await config.api.rowAction.trigger(viewId, rowAction.id, { rowId: row._id!, })