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.Resourcesaction@callbacks. -
When structs are deleted directly instead of changesets, there’s no way to add constraints, such as
no_assoc_constraintorassoc_constraintthat would transform DB errors into validation errors, soCalcinator.delete/3generate a changeset fromCalcinator.Resources.changeset(struct, %{}) -
Make the
Alembic.Document.tandAlembic.Error.tthatCalcinator.Controller.Erroruses internally available inCalcinator.Alembic.DocumentandCalcinator.Alembic.Error, respectively, so they can be reused in overrides andretort. -
Pass
:metathroughCalcinator.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.Beamkey to module attribute to prevent typos. -
Calcinator.Meta.beam.put_new_lazyallows beam information to only be set inmetaif its not already there to allow for loops betweenCalcinatorservers.
Bug Fixes
-
The
Calcinatoractions@specand@docinclude (hopefully) all the errors they can return now-
{:error, :sandbox_access_disallowed} -
{:error, :sandbox_token_missing} -
{:error, :timeout}
-
-
Ensure
Calcinator.Controlleractions havecaseclauses for all the declared return types fromCalcinatorcalls. -
get_related_resourcescould not handle has_many related resources, specifically-
Calcinator.JaSerializer.PhoenixView.get_related_resource/3would not allowdatato be alist. -
Calcinator.RelatedView.renderwith data assumes the data was singular and “links” could be added to that “data” map. -
Calcinator.authorizeddid not allow the unfiltered data to belist.
-
-
Fix
sourceassignsforget_related_resourceexample: example still used pre-open-sourcingassociationandid_key. -
Fix
show_relationshipexample that was just wrong. The sameassignsasget_related_resourceshould 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/0callback since relationships are resource identifiers withidandtype. -
Calcinator.RelationshipView.data/1assumed that[:related][:resource]wasnilor amap, which didn’t handle thelistfor has_many relationships.
Incompatible Changes
-
Calcinator.Resources.allow_sandbox_access/1must now return:ok | {:error, :sandbox_access_disallowed}. The previous{:already, :allowed | :owner}maps to:okwhile:not_foundmaps to{:error, :sandbox_access_disallowed}. -
If you previously had total coverage for all return types from
Calcinatoractions, they now also return{:error, :sandbox_access_disallowed}and{:error, :timeout}. Previously, instead of{:error, :sandbox_access_disallowed},:not_foundmay been returned, but that was a bug that leaked an implementation detail from howDBConnection.Ownershipworks, so it was removed. -
Calcinator.deletedeletes a changeset instead of a resource struct-
Calcinator.Resources.delete/1must expect anEcto.Changeset.tinstead of a resourcestruct -
use Calcinator.Resources.Ecto.Repogeneratesdelete/1that expects anEcto.Changeset.tand callsCalcinator.Resources.Ecto.Repo.delete/2, which now expects a changeset instead of resource struct as the second argument.
-
-
:metais now a required key inCalcinator.Resources.query_options. -
Calcinator.Resources.delete/2must now accept both theEcto.Changeset.twith any constraints and theCalcinator.Resources.query_options, so that the newmetakey can be used to continue propagating theCalcinator.Meta.Beamfrom the original caller in a chain of calls.
Read next WebSockex 0.1.3
