Skip to content

angee.parties.connections

Parties-owned landing for social-export connection facts.

Adapters emit :class:ParsedConnection values and never write parties rows. This owner upserts the account handle, materializes a Person behind its confirmed PartyHandle, records the account owner's acquaintance edge, and maps an optional employer onto parties' existing employee Relationship shape.

Organization names in social exports are free text, not stable organization identities. They therefore land as Relationship.other_name exactly like CardDAV employment rather than minting an Organization row from a label.

ConnectionHandle

python
class ConnectionHandle(Protocol)

The neutral parsed-handle fields a connection adapter supplies.

Read-only properties so a frozen adapter DTO (messaging's ParsedHandle) satisfies the protocol without parties importing it. metadata is the adapter's identity evidence for the handle — the one home for that fact.

ParsedConnection

python
@dataclass(frozen=True)
class ParsedConnection()

One social account's connection to a person, neutral of export format.

handle.metadata carries adapter evidence about the account handle; provenance names the connection record source independently.

ingest_connections

python
def ingest_connections(parsed_connections: Iterable[ParsedConnection], *,
                       created_by_id: Any) -> list[Any]

Idempotently land parsed connections and return their Person rows.

The batch entry point: the source user, its anchor Party, and each required RelationshipKind resolve once for the whole run — a friends export is thousands of records and must not repeat loop-invariant lookups. Each record still lands in its own transaction, so one bad record fails alone.

ingest_connection

python
def ingest_connection(parsed: ParsedConnection, *, created_by_id: Any) -> Any

Idempotently land one parsed connection and return its Person.

Released under the AGPL-3.0 License.