AshAuthentication.Strategy.Firebase.Transformer (ash_authentication_firebase v1.1.0)

Copy Markdown View Source

DSL transformer for firebase strategies.

Summary

Functions

Runs the compile-time transformation for a firebase strategy.

Functions

transform(strategy, dsl_state)

@spec transform(AshAuthentication.Strategy.Firebase.t(), map()) ::
  {:ok, map()} | {:error, Spark.Error.DslError.t() | term()}

Runs the compile-time transformation for a firebase strategy.

Three responsibilities:

  • Fill in defaults for register_action_name (:register_with_<name>) and sign_in_action_name (:sign_in_with_<name>) when they are not set explicitly.
  • Validate the action gated by registration_enabled? — when true, the register action must be a :create action with a non-nullable :user_info map argument and upsert?: true plus an upsert_identity, so repeat sign-ins update the existing user rather than creating duplicates. When false, the sign-in action must be a :read action with the same :user_info argument shape.
  • Register both action names with AshAuthentication so the strategy plug can resolve them at runtime.

Returns {:ok, dsl_state} on success or {:error, Spark.Error.DslError.t()} when validation fails. Called automatically by Spark via the strategy's transform/2 delegate; not intended to be invoked directly.