Sobelow - 0.2.3 GraphQL Authentication with Apollo and React

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 alembic 3.3.0
  • Drop the need for changeset_render by using JaSerializer.Formatter.Utils.format_key directly to make it the same as calcinator.
  • Update to calcinator 3.0.0
  • Retort.Response.Error.to_calcinator_error(Retort.Response.t, Ecto.Changeset.t) will convert Retort.Response.t data Alembic.Document.t errors to a Calcinator error. If the Alembic.Error.t format is unrecognized, it is assumed to be convertable to Ecto.Changeset.t errors using Retort.Response.Error.Ecto.Changeset.add_alembic_errors(changeset, errors)

Bug Fixes

  • A missed rename left the application name used for Application.get_env as the original :interpreter_server_rpc instead of :retort in Retort.Resources.timeout/2.
  • Fix (Map -> map) typo in Retort.Client.Generic.start_link options.
  • Retort.Resources.client_start_link should not have been 0-arity, but 1-arity, so it can take in the client_start_link_options as an argument instead of depending on lookup by module to retrieve some hidden state.
  • Retort.Meta.valid!/2 checked if the Ecto.Repo was sandboxed with Application.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 in retort itself. To allow the repo to be check to be configured, Retort.Meta.valid!/2 now takes an :ecto_repo_module option, which is check if its sandboxed if any of the :ecto_schema_modules are database-backed (have a non-blank __schema__(:source)).
  • Retort.Server.Generic.Resources.handle_method/2 converts {:error, :sandbox_token_missing} into RPC response errors instead of a CaseClauseError exception.

Incompatible Changes

  • Retort.Resources.client_start_link callback changes arity from 0 to 1 and now should take in options instead of calling Retort.Resources.client_start_link_options/0.
  • Retort.Client.Generic.start_link calls where the ecto_schema_module_by_type ecto_schema_modules are database-backed will now require :ecto_repo_module to check if the Ecto.Repo.t is sandboxed.
  • Require alembic ~> 3.3
  • changeset_render is no longer needed for Retort.Server.Generic.Resources, so Retort.Server.Generic.Resources.t has been removed and a Calcinator.t should 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 the Alembic.Error.ts to validation errors added to the changeset. It’s a way to reverse the conversion done by Alembic.Document.from_ecto_changeset in alembic 3.3.0.
  • Retort.Response.Error.to_calcinator_error(Retort.Response.t, Ecto.Changeset.t) will convert Retort.Response.t data Alembic.Document.t errors to a Calcinator error. If the Alembic.Error.t format is unrecognized, it is assumed to be convertable to Ecto.Changeset.t errors using Retort.Response.Error.Ecto.Changeset.add_alembic_errors(changeset, errors)
  • Retort.Server.Generic.Resoruces.handle_method/2 is simplified using put_rendered_or_error/2, so that the large, duplicate cases are eliminated and error handling remains consistent across actions. For error, put_calcinator_error is called.
  • use Retort.Resources generates delete(changeset, query_options) to match the updated Calcinator.Resources.delete/2.
  • Retort.Resources.client_start_link_options now takes (module, query_options), so that if :meta exists in query_options and “beam” is set, then the pre-existing “beam” will be reused.
  • All action callbacks in Retort.Resources catch {:exit, {:timeout, _}} from the Retort.Client.Generic calls, log them, and then return {:error, :timeout}, so that Calcinator.Controller can turn it into a 504 Gateway Timeout instead of crashing the calling process.
  • All action callbacks in Retort.Resources can transform {:error, %Retort.Response.Error{}} to Calcinator errors using Retort.Client.Generic.error_to_calcinator_error.
  • meta in query_options is put back into the mergable params passed to Retort.Client.Generic calls in Retort.Resources

Shameless plug: Check out @elixirstatus' other community project:

Credo, a new static code analysis tool that acts as a code linter, but also focusses on teaching coding practices and code consistency.