Spectre.GAM.Scope.Opening (Spectre v0.4.0)

Copy Markdown View Source

Durable description of a Scope occurrence and any explicit promise it owns.

A Scope is still only a ledger projection: opening or copying one creates no Mandate and no Meter allocation. :work and :vigil openings must name a finite due time, a decidable closing Condition, an accountable Principal and an independent disposition path so unfinished work can be derived as Duty.

Summary

Functions

Returns the plain, string-keyed ledger representation.

Returns the trusted opening fields forced by an authenticated context.

Returns the stable digest of the complete opening.

Restores a Scope opening from canonical data.

Materializes a canonical governed draft under its authorizing Act.

Returns whether the opening must be authorized by a durable Act.

Builds the exact Scope body frozen by a governed opening Candidate.

Builds and validates a Scope opening.

Returns whether this Scope declares a finite promise.

Reconstructs the exact ingress context committed by this opening.

Checks every trusted opening field against an authenticated context.

Types

kind()

@type kind() :: :session | :child | :work | :vigil

t()

@type t() :: %Spectre.GAM.Scope.Opening{
  accountable_ref: String.t() | nil,
  authentication_ref: String.t(),
  channel_ref: String.t() | nil,
  disposition_authority_refs: [String.t()],
  domain_ref: String.t(),
  due_at: integer() | nil,
  host_generation: non_neg_integer(),
  ingress_ref: String.t(),
  kind: kind(),
  opened_at: integer(),
  opened_by_ref: String.t(),
  parent_ref: String.t() | nil,
  promise_condition: Spectre.GAM.Condition.t() | nil,
  ref: String.t(),
  schema_version: 1,
  session_ref: String.t() | nil,
  source_act_ref: String.t() | nil,
  submission_context_ref: String.t()
}

Functions

canonical(opening)

@spec canonical(t()) :: map()

Returns the plain, string-keyed ledger representation.

context_bindings(context)

@spec context_bindings(Spectre.GAM.SubmissionContext.t()) :: map()

Returns the trusted opening fields forced by an authenticated context.

digest(opening)

@spec digest(t()) :: String.t()

Returns the stable digest of the complete opening.

from_canonical(value)

@spec from_canonical(map()) :: {:ok, t()} | {:error, term()}

Restores a Scope opening from canonical data.

from_governed_draft(draft, source_act_ref, opened_at)

@spec from_governed_draft(map(), String.t(), integer()) ::
  {:ok, t()} | {:error, term()}

Materializes a canonical governed draft under its authorizing Act.

governed?(opening)

@spec governed?(t()) :: boolean()

Returns whether the opening must be authorized by a durable Act.

governed_draft(opening)

@spec governed_draft(map() | keyword() | t()) :: {:ok, map()} | {:error, term()}

Builds the exact Scope body frozen by a governed opening Candidate.

new(opening)

@spec new(map() | keyword() | t()) :: {:ok, t()} | {:error, term()}

Builds and validates a Scope opening.

promised?(opening)

@spec promised?(t()) :: boolean()

Returns whether this Scope declares a finite promise.

submission_context(opening)

@spec submission_context(t()) ::
  {:ok, Spectre.GAM.SubmissionContext.t()} | {:error, term()}

Reconstructs the exact ingress context committed by this opening.

validate_context(opening, context)

@spec validate_context(t(), Spectre.GAM.SubmissionContext.t()) ::
  :ok | {:error, term()}

Checks every trusted opening field against an authenticated context.