Skip to content

angee.graphql.events

Payload and GraphQL event types for model change subscriptions.

ChangePayload

python
@dataclass(frozen=True, slots=True)
class ChangePayload()

Channel-layer payload describing one model row change.

model

Django model label for the changed row.

id

Public row identifier exposed to GraphQL clients.

action

Change action: create, update, or delete.

changed_fields

Updated model fields when Django saved a partial update.

changed_values

JSON-safe changed values keyed by field name.

resource_id

REBAC resource id when it differs from the public id.

from_instance

python
@classmethod
def from_instance(cls, instance: models.Model, *, action: str,
                  update_fields: Iterable[str] | None) -> ChangePayload

Return the channel payload for a saved or deleted model instance.

from_mapping

python
@classmethod
def from_mapping(cls, payload: Mapping[str, Any]) -> ChangePayload

Return a payload from its channel-layer message dictionary.

as_message

python
def as_message() -> dict[str, Any]

Return the channel-layer dictionary representation.

resource_identifier

python
@property
def resource_identifier() -> str

Return the REBAC resource id, falling back to the public id.

redacted

python
def redacted(denied_fields: set[str]) -> ChangePayload

Return a payload with denied field-level values removed.

ChangeEvent

python
@strawberry.type
class ChangeEvent()

Read-gated notification that one model instance changed.

from_payload

python
@classmethod
def from_payload(cls,
                 payload: ChangePayload | Mapping[str, Any]) -> ChangeEvent

Return a GraphQL event from a change payload.

Released under the AGPL-3.0 License.