Expression.V2.Compat (expression v2.33.0)

Compatibility module to make the transition from V1 to V2 a bit easier, hopefully.

It does a few things:

  • It swaps out V2 callbacks for V1 callbacks when evaluating expressions with V1.
  • It does some patching of the context to match V1's assumptions:
    • case insensitive context keys
    • casting of integers
    • casting of datetimes
  • It compares the output of V1 to V2, if those aren't equal it will log an error and return the V1 response.
  • If there is no error it will return the value from V2.

NOTE: This module does twice the work because it runs V1 and V2 sequentially and then compares the result before returning a value.

NOTE: This was throwing more errors in prod than anticipated, hacking in a revert temporarily

Summary

Functions

Link to this function

attempt_boolean(binary)

Link to this function

attempt_datetime(binary)

Link to this function

attempt_float(binary)

Link to this function

attempt_integer(binary)

Link to this function

evaluate!(expression, context \\ %{}, callback_module \\ Expression.Callbacks.Standard)

Link to this function

evaluate_as_string!(expression, context, callback_module \\ Expression.Callbacks.Standard)

Link to this function

evaluate_block!(expression, context \\ %{}, callback_module \\ Callbacks.Standard, opts \\ [])

Link to this function

log_error(expression, context, v1_resp, v2_resp)

Link to this function

normalize_value(datetime)

Link to this function

patch_v1_context(datetime)

Link to this function

patch_v1_key(key)

Link to this function

return_or_raise(expression, context, v1_resp, v2_resp)

Link to this function

return_or_raise_binaries(expression, context, v1_resp, v2_resp)

Link to this function

unpack_returned_value(other)