Can an extension add a notifier/fragment?
Quick poke leads me to believe this is the same as asking whether an extension can add other extensions, since notifiers and fragments are just special kinds of extensions.
12 Replies
I don't believe it can do so currently, but you could validate that another extension had been added
additionally, notifiers are just a type of extension
so if your extension is a notifier, you can do
notifiers: [YourExtension]
I'd like my extension to build a notifier and add it.
Is AshAuthentication a relevant example to this question? :thinkies:
not so much in this case
@\ ឵឵឵ we'll need to add that as a feature in
spark
in that case.
Actually, come to think of it, does your notifier have a DSL?
If not, you can modify the resource.simple_notifiers
option
you can use Ash.Resource.Info.simple_notifiers(dsl)
to get the list
and then set it with Transformer.set_option
or set_opt
or w/e its called, I forget 😄Righto, that'll work perfectly for my immediate case. Definitely had some thoughts about fragments as well, but think there might be some issues there anyways with regards to supplying parameters.
Thanks!
Yeah, but there isn't a way to dynamically add a fragment to a resource either 😆
So would still need to be a spark feature
Ofc. First take on how tough it would be to let extensions append other extensions? Wouldn't imagine which key they are passed with makes much of a difference 😄
For transformers, I guess it's allowing the extension to return further extensions to be added to the list of transform passes.
hmm....it would need to be like a special callback on the extension
it would almost certainly not be doable in a transformer
because we're basically at the end of the process by then
Ah, I mean extensions using transformers.
Gotcha
But we could support a callback in the extension module like
def add_extensions(entity), do: ...
and that probably wouldn't be too badI think that would be pretty reasonable, just means building the notifier module in that callback (or before, as the case may be).
I wanted to build the notifier module based on parameters in the DSL, though, which was why I thought of the transformers, but there may be ways to get around that.
I can have the notifier be static and have it pull the DSL stuff out of the
resource
passed with each notification call, for example.Yeah I’d do that 🙂