BaileysEx.Auth.PersistenceMigration (baileys_ex v0.1.0-alpha.7)

Copy Markdown View Source

Explicit migration helpers between built-in auth persistence backends.

Phase 15 keeps BaileysEx.Auth.FilePersistence as the Baileys-compatible JSON helper and introduces BaileysEx.Auth.NativeFilePersistence as the recommended durable backend. This module provides the one-step migration path between those built-in backends without forcing users to re-pair.

The JSON helper exists as a compatibility bridge for users migrating away from Baileys JS sidecars. This module is the explicit off-ramp from that bridge to the Elixir-first native backend.

Migration is explicit. The built-in auth helpers do not convert existing auth directories automatically during connect/2.

Summary

Types

Summary returned after a successful built-in backend migration.

Functions

Migrates a compatibility JSON auth directory into the native durable backend.

Types

migration_summary()

@type migration_summary() :: %{
  source_backend: module(),
  target_backend: module(),
  source_path: Path.t(),
  target_path: Path.t(),
  migrated_keys: non_neg_integer()
}

Summary returned after a successful built-in backend migration.

Functions

migrate_compat_json_to_native(source_path, target_path, opts \\ [])

@spec migrate_compat_json_to_native(Path.t(), Path.t(), keyword()) ::
  {:ok, migration_summary()} | {:error, term()}

Migrates a compatibility JSON auth directory into the native durable backend.

The source directory is left untouched. By default the target path must be missing or empty and must not already contain native backend artifacts unless overwrite?: true is given.