calcinator 3.0.0
https://hex.pm/packages/calcinator/3.0.0
Bug fixes for error handling and testing support led to incompatible changes in behaviours, but use
generated code is updated as well, so no changes if you only use Calcinator.Resources.Ecto.Repo
.
Enhancements
-
Can now return (and is preferred to return instead of a timeout exit)
{:error, :timeout}
from allCalcinator.Resources
action@callbacks
. -
When structs are deleted directly instead of changesets, there’s no way to add constraints, such as
no_assoc_constraint
orassoc_constraint
that would transform DB errors into validation errors, soCalcinator.delete/3
generate a changeset fromCalcinator.Resources.changeset(struct, %{})
-
Make the
Alembic.Document.t
andAlembic.Error.t
thatCalcinator.Controller.Error
uses internally available inCalcinator.Alembic.Document
andCalcinator.Alembic.Error
, respectively, so they can be reused in overrides andretort
. -
Pass
:meta
throughCalcinator.Retort.query_options
, which allows pass through of meta like fromCalcinator.Meta.Beam
, which is necessary for indirect callbacks through RPC calls forretort
. -
Move
Calcinator.Meta.Beam
key to module attribute to prevent typos. -
Calcinator.Meta.beam.put_new_lazy
allows beam information to only be set inmeta
if its not already there to allow for loops betweenCalcinator
servers.
Bug Fixes
-
The
Calcinator
actions@spec
and@doc
include (hopefully) all the errors they can return now-
{:error, :sandbox_access_disallowed}
-
{:error, :sandbox_token_missing}
-
{:error, :timeout}
-
-
Ensure
Calcinator.Controller
actions havecase
clauses for all the declared return types fromCalcinator
calls. -
get_related_resources
could not handle has_many related resources, specifically-
Calcinator.JaSerializer.PhoenixView.get_related_resource/3
would not allowdata
to be alist
. -
Calcinator.RelatedView.render
with data assumes the data was singular and “links” could be added to that “data” map. -
Calcinator.authorized
did not allow the unfiltered data to belist
.
-
-
Fix
source
assigns
forget_related_resource
example: example still used pre-open-sourcingassociation
andid_key
. -
Fix
show_relationship
example that was just wrong. The sameassigns
asget_related_resource
should be used. Since at first I couldn’t figure out why showing a relationship would need a view module and I wrote the code, I added a note explaining its for theview_module.type/0
callback since relationships are resource identifiers withid
andtype
. -
Calcinator.RelationshipView.data/1
assumed that[:related][:resource]
wasnil
or amap
, which didn’t handle thelist
for has_many relationships.
Incompatible Changes
-
Calcinator.Resources.allow_sandbox_access/1
must now return:ok | {:error, :sandbox_access_disallowed}
. The previous{:already, :allowed | :owner}
maps to:ok
while:not_found
maps to{:error, :sandbox_access_disallowed}
. -
If you previously had total coverage for all return types from
Calcinator
actions, they now also return{:error, :sandbox_access_disallowed}
and{:error, :timeout}
. Previously, instead of{:error, :sandbox_access_disallowed}
,:not_found
may been returned, but that was a bug that leaked an implementation detail from howDBConnection.Ownership
works, so it was removed. -
Calcinator.delete
deletes a changeset instead of a resource struct-
Calcinator.Resources.delete/1
must expect anEcto.Changeset.t
instead of a resourcestruct
-
use Calcinator.Resources.Ecto.Repo
generatesdelete/1
that expects anEcto.Changeset.t
and callsCalcinator.Resources.Ecto.Repo.delete/2
, which now expects a changeset instead of resource struct as the second argument.
-
-
:meta
is now a required key inCalcinator.Resources.query_options
. -
Calcinator.Resources.delete/2
must now accept both theEcto.Changeset.t
with any constraints and theCalcinator.Resources.query_options
, so that the newmeta
key can be used to continue propagating theCalcinator.Meta.Beam
from the original caller in a chain of calls.
Read next WebSockex 0.1.3