Crosswake.Policy.Schema (crosswake v0.1.0)

View Source

NimbleOptions schema for Phase 1 Crosswake route policy declarations.

Summary

Types

commerce_declaration()

@type commerce_declaration() :: %{
  corridor: String.t() | nil,
  role: commerce_role() | nil
}

commerce_role()

@type commerce_role() ::
  :paywall_entry | :purchase_intent | :restore_intent | :account_management

entry()

@type entry() :: :internal_only | :external

offline()

@type offline() :: :unavailable | :cached_read_only | :local_first

pack_integrity()

@type pack_integrity() :: %{algorithm: String.t(), digest: String.t()}

pack_kind()

@type pack_kind() :: :content | :media

pack_requirement()

@type pack_requirement() :: %{
  id: String.t(),
  version: String.t(),
  kind: pack_kind(),
  integrity: pack_integrity() | nil
}

runtime()

@type runtime() :: :live_view | :offline_island | :native_screen

security()

@type security() :: :standard | :sensitive

validated_options()

@type validated_options() :: [
  id: String.t(),
  runtime: runtime(),
  offline: offline(),
  entry: entry(),
  cache_contract: String.t() | nil,
  island_contract: String.t() | nil,
  capabilities: [String.t()],
  commerce: commerce_declaration() | nil,
  packs: [pack_requirement()],
  sync: [String.t()],
  transfers: [Crosswake.Transfer.Contracts.declaration()],
  security: security()
]

Functions

commerce_role_values()

@spec commerce_role_values() :: [commerce_role()]

schema()

@spec schema() :: NimbleOptions.t()

validate(options)

@spec validate(keyword()) ::
  {:ok, validated_options()} | {:error, NimbleOptions.ValidationError.t()}

validate!(options)

@spec validate!(keyword()) :: validated_options()

validate_commerce_declaration(declaration)

@spec validate_commerce_declaration(term()) ::
  {:ok, commerce_declaration() | nil} | {:error, String.t()}

validate_identifier(value)

@spec validate_identifier(term()) :: {:ok, String.t()} | {:error, String.t()}

validate_pack_requirements(requirements)

@spec validate_pack_requirements(term()) ::
  {:ok, [pack_requirement()]} | {:error, String.t()}

validate_runtime(value)

@spec validate_runtime(term()) :: {:ok, runtime()} | {:error, String.t()}

validate_transfer_declarations(declarations)

@spec validate_transfer_declarations(term()) ::
  {:ok, [Crosswake.Transfer.Contracts.declaration()]} | {:error, String.t()}