View Source Glific.Flows.Flow (Glific v5.1.6)
The flow object which encapsulates the complete flow as emitted by
by https://github.com/nyaruka/floweditor
Link to this section Summary
Functions
Standard changeset pattern we use for all data types
Return a flow for a specific uuid. Cache is not present in cache
load the latest revision, specifically json definition from the flow_revision table. We return the clean definition back
Helper function to load a active flow from the database and build an object
Process a json structure from flow editor to the Glific data types. While we are doing this we also fix the map, if the variables to resolve Other/No Response is true
Create a sub flow of an existing flow
Validate a flow and ensures the flow is valid with our internal rule-set
Changeset helper for keywords
Link to this section Types
@type t() :: %Glific.Flows.Flow{ __meta__: Ecto.Schema.Metadata.t(), definition: map() | nil, flow_type: String.t() | nil, id: non_neg_integer() | nil, ignore_keywords: boolean() | nil, inserted_at: :utc_datetime | nil, is_active: boolean() | nil, is_background: boolean() | nil, is_pinned: boolean() | nil, keywords: [String.t()] | nil, last_changed_at: term(), last_published_at: term(), localization: Glific.Flows.Localization.t() | nil, name: String.t() | nil, nodes: [Glific.Flows.Node.t()] | nil, organization: Glific.Partners.Organization.t() | Ecto.Association.NotLoaded.t() | nil, organization_id: non_neg_integer() | nil, respond_no_response: boolean() | nil, respond_other: boolean() | nil, revisions: [Glific.Flows.FlowRevision.t()] | Ecto.Association.NotLoaded.t() | nil, roles: term(), start_node: Glific.Flows.Node.t() | nil, status: String.t(), updated_at: :utc_datetime | nil, uuid: Ecto.UUID.t() | nil, uuid_map: map() | nil, version: term(), version_number: String.t() | nil }
Link to this section Functions
@spec changeset(t(), map()) :: Ecto.Changeset.t()
Standard changeset pattern we use for all data types
@spec get_flow(non_neg_integer(), Ecto.UUID.t(), String.t()) :: map()
Return a flow for a specific uuid. Cache is not present in cache
load the latest revision, specifically json definition from the flow_revision table. We return the clean definition back
@spec get_loaded_flow(non_neg_integer(), String.t(), map()) :: map()
Helper function to load a active flow from the database and build an object
@spec process(map(), t(), Ecto.UUID.t()) :: t()
Process a json structure from flow editor to the Glific data types. While we are doing this we also fix the map, if the variables to resolve Other/No Response is true
@spec start_sub_flow(Glific.Flows.FlowContext.t(), Ecto.UUID.t(), non_neg_integer()) :: {:ok, Glific.Flows.FlowContext.t(), [String.t()]} | {:error, String.t()}
Create a sub flow of an existing flow
@spec validate_flow(non_neg_integer(), String.t(), map()) :: Keyword.t()
Validate a flow and ensures the flow is valid with our internal rule-set
@spec validate_keywords(Ecto.Changeset.t(), any()) :: Ecto.Changeset.t()
Changeset helper for keywords