Skip to content

Instantly share code, notes, and snippets.

@Gozala
Created January 26, 2023 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gozala/840cb8ef148f49f02ba4677894ead5af to your computer and use it in GitHub Desktop.
Save Gozala/840cb8ef148f49f02ba4677894ead5af to your computer and use it in GitHub Desktop.
stateDiagram-v2
direction TB

state scope {
  sig-->meta: 
  sig-->prf
  sig-->iss
  sig-->aud
  sig-->tasks
  
  tasks
}

send.task: Task
state send.task {
  send.task.do: msg/send
}

read.task: Task
state read.task {
  read.task.do: crud/read
}

update.task: Task
state update.task {
  update.task.do: crud/update
}

send: Invocation
state send {
  send.job: task
  send.scope: scope
}

read: Invocation
state read {
  read.job: task
  read.scope: scope
}

update: Invocation
state update {
  update.job: task
  update.scope: scope
}


request:\n
state request { 
 direction TB
 

 send
 read
 update
 --
 scope
 --
 send.task
 read.task
 update.task
}

send.job --> send.task
send.scope --> scope

read.job --> read.task
read.scope --> scope

update.job --> update.task
update.scope --> scope

tasks --> send.task
tasks --> read.task
tasks --> update.task



send.promise:Promise
state send.promise {

  send.promise.selector: selector
  send.promise.job: invocation
  
  state send.promise.selector.at <<fork>>
  
  send.promise.selector.at --> send.promise.selector.at.ok
  send.promise.selector.at --> send.promise.selector.at.error
  
  send.promise.selector.at.ok: "ok"
  send.promise.selector.at.error: "error"
}
send.promise.selector --> send.promise.selector.at

send.receipt: Recept
state send.receipt {


 send.receipt.sig: sig
 send.receipt.job: job
 send.receipt.out: result
 send.receipt.meta: meta
 send.receipt.iss: iss
 send.receipt.prf: prf
 --
 
 state send.result <<fork>>
 send.result --> send.result.ok
 send.result --> send.result.error
 
 send.result.ok: { ok }
 send.result.error: { error }
}






all:\n
state all {
  send.promise
  --
  send.receipt
  --
  request
}


send.promise.job --> send
send.receipt.out --> send.result
send.receipt.sig --> send.receipt.job
send.receipt.sig --> send.receipt.out
send.receipt.sig --> send.receipt.meta
send.receipt.sig --> send.receipt.iss
send.receipt.sig --> send.receipt.prf


send.receipt.job --> send


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment