Maps decoded Syncd mutations to application events.
Examines the SyncActionValue in each decoded mutation and emits the
corresponding event (chats update, messages delete, contacts upsert, etc.).
Ports processSyncAction from chat-utils.ts:758-974 and
processContactAction/emitSyncActionResults from sync-action-utils.ts.
Summary
Functions
Dispatch sync action results to an event emitter callback.
Process a contact action and return events to emit.
Process a single decoded sync action mutation and return events to emit.
Types
@type event() :: {:chats_update, [map()]} | {:chats_delete, [String.t()]} | {:chats_lock, map()} | {:messages_delete, map()} | {:messages_update, [map()]} | {:contacts_upsert, [map()]} | {:creds_update, map()} | {:labels_edit, map()} | {:labels_association, map()} | {:settings_update, map()} | {:lid_mapping_update, map()}
Functions
@spec emit_sync_action_results((event() -> any()), [sync_action_result()]) :: :ok
Dispatch sync action results to an event emitter callback.
Ports emitSyncActionResults from sync-action-utils.ts:66-74.
@spec process_contact_action(map(), String.t() | nil) :: [sync_action_result()]
Process a contact action and return events to emit.
Always emits contacts_upsert. Optionally emits lid_mapping_update
if both LID and PN are available.
Ports processContactAction from sync-action-utils.ts:22-64.
Process a single decoded sync action mutation and return events to emit.
Returns a list of events (may be empty for unrecognized actions).
Ports processSyncAction from chat-utils.ts:758-974.
Parameters
mutation— decoded mutation with:sync_action(SyncActionData) and:index(parsed JSON array)me— current user's contact info%{name: ..., id: ...}opts— optional::initial_sync— boolean, whether this is initial app state sync:account_settings—%{unarchive_chats: boolean()}for initial sync logic