-
Notifications
You must be signed in to change notification settings - Fork 0
Flow definition #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Flow definition #236
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
92a4712
feat: added datatype definition
nicosammito d37220d
feat: final flow definition
nicosammito d1c2472
fix: adding docs support and multiply translations
nicosammito adf0eff
fix: errors inside example flow
nicosammito c728c89
Update docs/flow-definition.ts
nicosammito 540799f
Update docs/flow-definition.ts
nicosammito e0dd3fc
Update docs/flow-definition.ts
nicosammito d979fc6
Update docs/flow-definition.ts
nicosammito 2b60a3b
Update docs/flow-definition.ts
nicosammito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,208 @@ | ||
enum EDataType { | ||
PRIMITIVE, //number, boolean, text | ||
TYPE, | ||
OBJECT, | ||
DATATYPE, | ||
ARRAY, | ||
GENERIC, | ||
NODE | ||
} | ||
|
||
enum EDataTypeRuleType { | ||
REGEX, | ||
NUMBER_RANGE, | ||
ITEM_OF_COLLECTION, | ||
CONTAINS_TYPE, | ||
CONTAINS_KEY, | ||
LOCK_KEY, | ||
//etc | ||
nicosammito marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
interface Translation { | ||
code: string //de_DE | ||
text: string | ||
} | ||
|
||
interface DataTypeRule { | ||
type: EDataTypeRuleType | ||
config: object | ||
} | ||
|
||
interface DataType { | ||
name: Translation[] | ||
type: EDataType | ||
rules?: DataTypeRule[] | ||
inputTypes?: DataType[] | ||
returnType?: DataType | ||
parent?: DataType | ||
} | ||
|
||
|
||
interface RuntimeFunctionDefinition { | ||
runtime_id: string //standard::math::add | ||
parameters?: RuntimeParameterDefinition[] | ||
return_type?: DataType | ||
} | ||
|
||
|
||
interface RuntimeParameterDefinition { | ||
type: DataType | ||
name: string | ||
nicosammito marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
|
||
interface FunctionDefinition { | ||
runtime_function: RuntimeFunctionDefinition | ||
return_type?: DataType | ||
parameters?: ParameterDefinition[] | ||
name: Translation[] | ||
description: Translation[] | ||
documentation: Translation[] //as markdown | ||
|
||
} | ||
|
||
interface ParameterDefinition { | ||
type: DataType | ||
name: Translation[] // overrides the runtime parameter name and ref to language entry | ||
description: Translation[] | ||
default_value?: object | ||
} | ||
|
||
interface FlowType { | ||
name: Translation[] | ||
definition: FlowDefinition | ||
} | ||
|
||
interface FlowDefinition { | ||
nicosammito marked this conversation as resolved.
Show resolved
Hide resolved
|
||
settings: FlowDefinitionSetting[] | ||
input_type: DataType | ||
editable: boolean | ||
} | ||
|
||
interface FlowDefinitionSetting { | ||
nicosammito marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: Translation[] | ||
unique: boolean | ||
description: Translation[] | ||
type: DataType | ||
default_value?: object | ||
} | ||
|
||
interface Flow { | ||
type: FlowType | string //in the actual implementation we will just link the name or id | ||
settings: FlowSetting[] | ||
starting_node: NodeFunction | ||
input_value?: object | ||
} | ||
|
||
interface FlowSetting { | ||
definition: FlowDefinitionSetting | string | ||
value: object | ||
} | ||
|
||
interface NodeFunction { | ||
function: Partial<FunctionDefinition> | string | ||
parameters?: Parameter[] | ||
next_node?: NodeFunction | ||
} | ||
|
||
interface Parameter { | ||
definition: ParameterDefinition | string | ||
value?: object | ||
sub_node?: NodeFunction | ||
} | ||
|
||
|
||
|
||
const userObject: DataType = { | ||
name: [{ | ||
code: "en_US", | ||
text: "User" | ||
}], | ||
type: EDataType.OBJECT, | ||
rules: [{ | ||
type: EDataTypeRuleType.CONTAINS_KEY, | ||
config: {name: "firstname", type: "text", required: true} | ||
}, { | ||
type: EDataTypeRuleType.CONTAINS_KEY, | ||
config: {name: "lastname", type: "text"} | ||
}, { | ||
type: EDataTypeRuleType.CONTAINS_KEY, | ||
config: {name: "email", type: "text"} | ||
}, { | ||
type: EDataTypeRuleType.CONTAINS_KEY, | ||
config: {name: "age", type: "PositiveNumber"} | ||
}] | ||
|
||
} | ||
|
||
const integerArrayType: DataType = { | ||
name: [{ | ||
code: "en_US", | ||
text: "IntegerArray" | ||
}], | ||
type: EDataType.ARRAY, | ||
rules: [{ | ||
type: EDataTypeRuleType.CONTAINS_TYPE, | ||
config: {type: "Number"} | ||
}] | ||
} | ||
|
||
|
||
const forLoopFunctionParameterType: DataType = { | ||
name: [{ | ||
code: "en_US", | ||
text: "Function" | ||
}], | ||
type: EDataType.NODE, | ||
inputTypes: [{ | ||
name: [{ | ||
code: "en_US", | ||
text: "item" | ||
}], | ||
type: EDataType.GENERIC | ||
}] | ||
} | ||
|
||
const flow: Flow = { | ||
type: "", | ||
settings: [{ | ||
definition: "", | ||
value: {} | ||
}], | ||
starting_node: { | ||
function: "function::user::add", //-> standard::database::add | ||
parameters: [{ | ||
definition: "function::user::add__user", // -> standard::database::add_object | ||
value: { | ||
firstname: "Nico", | ||
lastname: "Sammito", | ||
email: "[email protected]", | ||
age: 20 | ||
} | ||
}] | ||
} | ||
|
||
|
||
} | ||
|
||
const flow1: Flow = { | ||
type: "", | ||
settings: [{ | ||
definition: "", | ||
value: {} | ||
}], | ||
starting_node: { | ||
function: "function::user::add", //-> standard::database::add | ||
parameters: [{ | ||
definition: "function::user::add__user", // -> standard::database::add_object | ||
sub_node: { | ||
function: "function::user::get", //-> standard::database::get | ||
parameters: [{ | ||
definition: "function::user::get__id", //-> standard::database::get_key | ||
value: {id: 123456789} | ||
}] | ||
} | ||
}] | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.