Squidie.GraphMutation.Operation (squidie v0.3.7)

Copy Markdown View Source

One normalized node or edge operation in a graph mutation.

This contract validates transport shape only. Graph identity, topology, lifecycle, and limit validation belong to the runtime validator.

Summary

Functions

Returns the ordered operation content used by mutation identity.

Normalizes one operation for its addition or removal context.

Converts an operation to its deterministic persistence map.

Converts an operation to a redacted report summary.

Types

kind()

@type kind() :: :node | :edge

mode()

@type mode() :: :addition | :removal

public_mode()

@type public_mode() :: :add | :remove

t()

@type t() :: %Squidie.GraphMutation.Operation{
  action: String.t() | nil,
  from: String.t() | nil,
  id: String.t(),
  input: map() | nil,
  kind: kind(),
  queue: String.t() | nil,
  to: String.t() | nil
}

Functions

canonical(operation)

@spec canonical(t()) :: tuple()

Returns the ordered operation content used by mutation identity.

normalize(attrs, mode)

@spec normalize(term(), mode()) :: {:ok, t()} | {:error, {term(), atom()}}

Normalizes one operation for its addition or removal context.

to_map(operation)

@spec to_map(t()) :: map()

Converts an operation to its deterministic persistence map.

to_public_map(operation, mode)

@spec to_public_map(t(), public_mode()) :: map()

Converts an operation to a redacted report summary.