🗡️
ConanJs
  • What is ConanJs?
  • Why ConanJs...
    • ... if coming from Redux
    • ... if using vanilla React
    • ... if learning React
    • ... if not using React
  • How to install/use ConanJs
  • About us / Github / Contact us
  • Demos
    • Demo Gallery
    • Conan State Demos
      • Hello World
      • Todos
        • Todos - Basic
        • Todos - Async
        • Todos - Optimistic
      • Github issues viewer
    • Conan Flow Demos
      • Authentication
  • CONAN DATA
    • General Concepts
    • Conan State
      • Actions & Reducers
        • Reducers
        • Actions
      • Creating State
      • Observing State
        • Live rendering
        • Connecting
      • Composing State
      • Scaling State
      • Orchestrating State
      • Life cycle
        • Async handling
        • Introspection
      • Testing state
    • Conan Flow
      • Creating Flows
      • Serialising Flows
      • Observing Flows
  • CONAN Runtime
  • Dependency Injection
    • General Concepts
    • Creating the Context
    • Using the Context
  • ASAPs
  • Logging
  • API
    • Main Classes
      • Conan
        • StateDef
      • ConanState
      • ConanFlow
        • UserFlowDef
        • UserStatusDef
        • Status
    • Conan State Classes
      • Thread
      • ConnectedState
      • MonitorInfo
      • MetaInfo
    • Dependency Injection
      • DiContextFactory
    • ASAPS
      • Asaps
      • Asap
Powered by GitBook
On this page
  • Introduction
  • toStateAll() - Serialising everything
  • toState(statusName) - Serialising a single status
  • Using Conan Flows

Was this helpful?

  1. CONAN DATA
  2. Conan Flow

Serialising Flows

Introduction

Before introducing flow serialising, is important to remind that Conan Flows are 2 dimensional data structures.

We believe that for most use cases, when you would like to access a flow you would like to serialise it.

Let's illustrate this graphically. Let's use again the authentication example:

Status

State 1

State 2

State 3

State 4

State 5

notAuthenticated

'invalid password'

authenticating

[username/TACOS]

[username/password]

authenticated

credentials

We provide you with two serialisation mechanisms, one to serialise everything, the other one to serialise a single status.

Both of them leverage Conan State to provide you the final serialised result.

toStateAll() - Serialising everything

authentication$F.toStateAll()

By serialising all, you will create a ConanState of Status

From the example above, this would be the visual equivalent of the generate ConanState.

State 1

State 2

State 3

State 4

State 5

nextData

name notAuthenticated

data ''

name authenticating

data username/ TACOS

name notAuthenticated

data 'invalid pass..'

name authenticating

data username/ password

name authenticated

data credentials

toState(statusName) - Serialising a single status

Similar to toStateAll, toState statusName), will generate a ConanState of the data type associated to the status being serialised.

Let's have a look at a couple of examples

authentication$F.toState('notAuhtenticated')

Will generate a ConanState which will provide the following states

State 1

State 2

nextData

''

'invalid password'

authentication$F.toState('authenticating')

Will generate a ConanState which will provide the following states

State 1

State 2

nextData

[username/TACOS]

[username/password]

To see some example for serialisation, check our Testing State, in that example, we leverage the serialisation of flows to show what the underlying meta flow is doing

Using Conan Flows

You might be familiar with the TACOS acronym that describe the attributes for Conan Data.

Conan State documents these in detail in its different document sections.

By being able to transform Conan Flows into Conan State, you should be able to leverage these attributes for Conan Flows too.

Note that for convenience we also provide with some shortcuts for observing flows, but we think the best way to leverage flows is to convert them into Conan State.

PreviousCreating FlowsNextObserving Flows

Last updated 4 years ago

Was this helpful?

''

💡
💡
💡
💡
💡