Emit Events control via the public API (and directus/sdk) #23570
sonrai-davo
started this conversation in
Feature Requests
Replies: 1 comment
|
The reason this feature is not currently available on the API is that this would allow users/attackers to decide to bypass validation or integrity checks implemented using Flows, Hook extensions or WebSocket subscriptions which rely on these events being fired. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
When manipulating data in collections via the public API, it would be good to have control over whether to emit events or not.
This is currently available in Extensions ( with using
{ emitEvents: false }), and through Flows and data operations in Design Studio.Basic Example
If I am writing data to a collection, sometimes I do not want events emitted so as not to trigger EventHook flows. Writing data to collections is done through the API (e.g. via the SDK).
For example you may be posting a new blog article that you don't want EventHooks to be triggered on;
Motivation
I have EventHooks which run in certain circumstances on various collection events. There are some functions using the API that must bypass these EventHooks in order coplete successfully.
Detailed Design
In the API:
Allow a query paramater for emitEvents with a boolean value.
In the SDK:
Allow emitEvents as a functional parameter for Item and User functions.
Requirements List
Must Have:
Should Have:
Could Have:
Won't Have:
Drawbacks
There are no known drawbacks.
Alternatives
Implementing an Extension, or adjusting the EventHooks to pick up on conditions where you want to avoid the EventHook logic from fully executing.
Adoption Strategy
This is not a breaking change.
Existing developers will adopt this through their use of the API or SDK.
No migration path is required as this is not breaking existing functions.
It is not known how this may effect other projects.
Unresolved Questions
Effort required to integrate this into the existing Directus source code and API.
All reactions