Files
Davide Silvestri d21801281f feat(agent): trigger agents when rows are created, updated or deleted (#6695)
* feat(agent): trigger agents when rows are created, updated or deleted

* test(agent): find the trigger picker by the class it now has

The trigger picker renders the shared service picker since the send
email actions, so its menu is under .agent-service-picker.

* fix(agent): check a trigger's access again before its conversation starts

The task that starts a firing's conversation trusted the access check made
when the event happened. A run identity removed, trashed or without access
by the time the task ran still got a conversation with the event's rows.

* fix(agent): apply the row trigger review fixes

- A type change moves an overlap rule left at the old type's default to
  the new type's default.
- Queued replies wait while the run identity can't read what the trigger
  watches.
- An imported formula is kept as written when no path is remapped,
  through one import_formula in core.
- Row events hand their listeners services holding the event's table.
- Trigger form choices no longer read the workspace's views.
- A first row too long for a message is cut short instead of left out.
- A no-access error for a type the card no longer shows is ignored.
- The dispatcher no longer clamps the batch size.

* fix(agent): keep the merged trigger behaviour and UI for row triggers

- Skipping stays the default overlap rule: only the row trigger types say
  their events can't be skipped, so HTTP and periodic triggers start as
  they did before.
- The workspace-access note is a plain alert and the batch size field is
  spaced like the hosted forms, without style overrides.
- The type-change and queued-firing tests are develop's again, with the
  row trigger tests added after them.
- ADR 014 names the hooks row triggers add to the shared service type.

* fix(agent): show a row trigger without workspace access as misconfigured

The trigger can't run until the agent has workspace access, so its card
gets the error icon with a tooltip and the database field shows the error,
instead of an info note.
2026-11-17 23:42:51 +01:00

18 lines
515 B
JavaScript

export default (client) => ({
list(agentId) {
return client.get(`/agent/${agentId}/triggers/`)
},
listTypes(agentId) {
return client.get(`/agent/${agentId}/trigger-types/`)
},
create(agentId, values) {
return client.post(`/agent/${agentId}/triggers/`, values)
},
update(agentId, triggerId, values) {
return client.patch(`/agent/${agentId}/triggers/${triggerId}/`, values)
},
delete(agentId, triggerId) {
return client.delete(`/agent/${agentId}/triggers/${triggerId}/`)
},
})