-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use log "github.com/sirupsen/logrus"
- Loading branch information
Showing
6 changed files
with
186 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package react_app | ||
|
||
//go:generate go run ../../cmd/mkunion/main.go shape-export --output=./src/workflow --input-go-file=../../x/workflow/workflow_machine.go |
1 change: 1 addition & 0 deletions
1
example/react-app/src/workflow/github_com_widmogrod_mkunion_x_schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type Schema = any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type Duration = number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
//generated by mkunion | ||
export type Predicate = { | ||
"workflow.And": And | ||
} | { | ||
"workflow.Or": Or | ||
} | { | ||
"workflow.Not": Not | ||
} | { | ||
"workflow.Compare": Compare | ||
} | ||
|
||
export type And = { | ||
L?: Predicate[], | ||
} | ||
|
||
export type Or = { | ||
L?: Predicate[], | ||
} | ||
|
||
export type Not = { | ||
P?: Predicate, | ||
} | ||
|
||
export type Compare = { | ||
Operation?: string, | ||
Left?: Reshaper, | ||
Right?: Reshaper, | ||
} | ||
|
||
//generated by mkunion | ||
export type Command = { | ||
"workflow.Run": Run | ||
} | { | ||
"workflow.Callback": Callback | ||
} | ||
|
||
export type Run = { | ||
Flow?: Worflow, | ||
Input?: schema.Schema, | ||
} | ||
|
||
export type Callback = { | ||
CallbackID?: string, | ||
Result?: schema.Schema, | ||
} | ||
|
||
//generated by mkunion | ||
export type State = { | ||
"workflow.NextOperation": NextOperation | ||
} | { | ||
"workflow.Done": Done | ||
} | { | ||
"workflow.Error": Error | ||
} | { | ||
"workflow.Await": Await | ||
} | ||
|
||
export type NextOperation = { | ||
Result?: schema.Schema, | ||
BaseState?: BaseState, | ||
} | ||
|
||
export type Done = { | ||
Result?: schema.Schema, | ||
BaseState?: BaseState, | ||
} | ||
|
||
export type Error = { | ||
Code?: string, | ||
Reason?: string, | ||
Retried?: number, | ||
MaxRetries?: number, | ||
BaseState?: BaseState, | ||
} | ||
|
||
export type Await = { | ||
CallbackID?: string, | ||
Timeout?: time.Duration, | ||
BaseState?: BaseState, | ||
} | ||
|
||
//generated by mkunion | ||
export type Worflow = { | ||
"workflow.Flow": Flow | ||
} | { | ||
"workflow.FlowRef": FlowRef | ||
} | ||
|
||
export type Flow = { | ||
Name?: string, | ||
Arg?: string, | ||
Body?: Expr[], | ||
} | ||
|
||
export type FlowRef = { | ||
FlowID?: string, | ||
} | ||
|
||
//generated by mkunion | ||
export type Expr = { | ||
"workflow.End": End | ||
} | { | ||
"workflow.Assign": Assign | ||
} | { | ||
"workflow.Apply": Apply | ||
} | { | ||
"workflow.Choose": Choose | ||
} | ||
|
||
export type End = { | ||
ID?: string, | ||
Result?: Reshaper, | ||
} | ||
|
||
export type Assign = { | ||
ID?: string, | ||
VarOk?: string, | ||
VarErr?: string, | ||
Val?: Expr, | ||
} | ||
|
||
export type Apply = { | ||
ID?: string, | ||
Name?: string, | ||
Args?: Reshaper[], | ||
Await?: ApplyAwaitOptions, | ||
} | ||
|
||
export type Choose = { | ||
ID?: string, | ||
If?: Predicate, | ||
Then?: Expr[], | ||
Else?: Expr[], | ||
} | ||
|
||
//generated by mkunion | ||
export type Reshaper = { | ||
"workflow.GetValue": GetValue | ||
} | { | ||
"workflow.SetValue": SetValue | ||
} | ||
|
||
export type GetValue = { | ||
Path?: string, | ||
} | ||
|
||
export type SetValue = { | ||
Value?: schema.Schema, | ||
} | ||
|
||
export type Execution = { | ||
FlowID?: string, | ||
Status?: State, | ||
Location?: string, | ||
StartTime?: number, | ||
EndTime?: number, | ||
Variables?: {[key: string]: any}, | ||
} | ||
export type BaseState = { | ||
Flow?: Worflow, | ||
RunID?: string, | ||
StepID?: string, | ||
Variables?: {[key: string]: any}, | ||
ExprResult?: {[key: string]: any}, | ||
} | ||
export type ApplyAwaitOptions = { | ||
Timeout?: time.Duration, | ||
} | ||
export type ResumeOptions = { | ||
Timeout?: time.Duration, | ||
} | ||
|
||
import * as schema from './github_com_widmogrod_mkunion_x_schema' | ||
import * as time from './time' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters