retort 2.0.0
https://hex.pm/packages/retort/2.0.0
Changelog
https://github.com/C-S-D/retort/compare/v1.3.2…v2.0.0
Enhancements
-
Document
Retort.Resources -
Update to
alembic3.3.0-
Drop the need for
changeset_renderby usingJaSerializer.Formatter.Utils.format_keydirectly to make it the same ascalcinator.
-
Drop the need for
-
Update to
calcinator3.0.0-
Retort.Response.Error.to_calcinator_error(Retort.Response.t, Ecto.Changeset.t)will convertRetort.Response.tdataAlembic.Document.terrorsto aCalcinatorerror. If theAlembic.Error.tformat is unrecognized, it is assumed to be convertable toEcto.Changeset.terrors usingRetort.Response.Error.Ecto.Changeset.add_alembic_errors(changeset, errors)
-
Bug Fixes
-
A missed rename left the application name used for
Application.get_envas the original:interpreter_server_rpcinstead of:retortinRetort.Resources.timeout/2. -
Fix (
Map->map) typo inRetort.Client.Generic.start_linkoptions. -
Retort.Resources.client_start_linkshould not have been 0-arity, but 1-arity, so it can take in theclient_start_link_optionsas an argument instead of depending on lookup bymoduleto retrieve some hidden state. -
Retort.Meta.valid!/2checked if the Ecto.Repo was sandboxed withApplication.get_env(:retort, Retort.Repo), which is a faithful translation of the original in:interpreter_server_rpc, but has the problem that it only works inretortitself. To allow the repo to be check to be configured,Retort.Meta.valid!/2now takes an:ecto_repo_moduleoption, which is check if its sandboxed if any of the:ecto_schema_modulesare database-backed (have a non-blank__schema__(:source)). -
Retort.Server.Generic.Resources.handle_method/2converts{:error, :sandbox_token_missing}into RPC response errors instead of aCaseClauseErrorexception.
Incompatible Changes
-
Retort.Resources.client_start_linkcallback changes arity from0to1and now should take inoptionsinstead of callingRetort.Resources.client_start_link_options/0. -
Retort.Client.Generic.start_linkcalls where theecto_schema_module_by_typeecto_schema_modules are database-backed will now require:ecto_repo_moduleto check if theEcto.Repo.tis sandboxed. -
Require
alembic~> 3.3-
changeset_renderis no longer needed forRetort.Server.Generic.Resources, soRetort.Server.Generic.Resources.thas been removed and aCalcinator.tshould be used as the state instead.
-
-
Require to
calcinator~> 3.0-
Retort.Response.Error.Ecto.Changeset.add_alembic_errors(changeset, [Alembic.Error.t])will convert theAlembic.Error.ts to validation errors added to thechangeset. It’s a way to reverse the conversion done byAlembic.Document.from_ecto_changesetinalembic3.3.0. -
Retort.Response.Error.to_calcinator_error(Retort.Response.t, Ecto.Changeset.t)will convertRetort.Response.tdataAlembic.Document.terrorsto aCalcinatorerror. If theAlembic.Error.tformat is unrecognized, it is assumed to be convertable toEcto.Changeset.terrors usingRetort.Response.Error.Ecto.Changeset.add_alembic_errors(changeset, errors) -
Retort.Server.Generic.Resoruces.handle_method/2is simplified usingput_rendered_or_error/2, so that the large, duplicatecases are eliminated and error handling remains consistent across actions. For error,put_calcinator_erroris called. -
use Retort.Resourcesgeneratesdelete(changeset, query_options)to match the updatedCalcinator.Resources.delete/2. -
Retort.Resources.client_start_link_optionsnow takes(module, query_options), so that if:metaexists inquery_optionsand “beam” is set, then the pre-existing “beam” will be reused. -
All action callbacks in
Retort.Resourcescatch{:exit, {:timeout, _}}from theRetort.Client.Genericcalls, log them, and then return{:error, :timeout}, so thatCalcinator.Controllercan turn it into a 504 Gateway Timeout instead of crashing the calling process. -
All action callbacks in
Retort.Resourcescan transform{:error, %Retort.Response.Error{}}toCalcinatorerrors usingRetort.Client.Generic.error_to_calcinator_error. -
metain query_options is put back into the mergable params passed toRetort.Client.Genericcalls inRetort.Resources
-
