Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ready for review.
Browse files Browse the repository at this point in the history
ninjeeter committed Jan 14, 2025
1 parent fb504c5 commit 50e00be
Showing 7 changed files with 98 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .vitepress/sidebars/concepts.ts
Original file line number Diff line number Diff line change
@@ -41,6 +41,10 @@ export const conceptsSidebar: DefaultTheme.SidebarItem[] = [
text: "Writing JavaScript",
link: "/concepts/workflows_js",
},
{
text: "Workflow Operation",
link: "/concepts/workflow_flow",
},
],
},
{
2 changes: 1 addition & 1 deletion .vitepress/sidebars/guides.ts
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ export const guidesSidebar: DefaultTheme.SidebarItem[] = [
link: "/guides/data_location",
},
{
text: "Deleting data",
text: "Deleting Data",
link: "/guides/deleting_data",
},
{
4 changes: 4 additions & 0 deletions .vitepress/sidebars/reference.ts
Original file line number Diff line number Diff line change
@@ -21,6 +21,10 @@ export const referenceSidebar: DefaultTheme.SidebarItem[] = [
text: "Convert Nodes",
link: "/reference/workflow_convert_nodes",
},
{
text: "Node Data Types",
link: "/reference/workflow_data_types",
},
{
text: "SDK",
link: "https://developer.caido.io/reference/sdks/workflow/",
Binary file added src/_images/data_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/_images/execution_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions src/concepts/workflow_flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Workflow Execution and Data Flow

::: info
[Learn the difference between Plugins and Workflows in Caido.](https://developer.caido.io/concepts/backend/workflow.html)
:::

The order of Workflow operation can be split into two concepts:

## Workflow Execution

A Workflow processes Nodes in sequential order:

1. Beginning at the root of the Node tree with either a "Start" or "Intercept" Node.
2. Every subsequent node in the chain is processed in order. The execution may take the path of another branch based on conditionals.
3. The Workflow ends either when it reaches an explicit "End" Node or when no more Nodes are available in the chain.

<img alt="Register command SDK." src="/_images/execution_flow.png" center/>

## Workflow Data Flow

Each Node in a Workflow has an input and output data type.

::: info
The `Choice` and `Code` types are just variations of `String`.
:::

With this typed data system, even though Nodes are processed sequentially, you do not need a direct line between two Nodes in order to pass data from one to another. Instead, data can be referenced using dot notation of a Node's alias and it's output alias:

```
[node_alias].[output_alias]
```

::: tip
You can view the data type by clicking on a Node and viewing the value within the parenthesis next to the name of the object.
:::

<img alt="Register command SDK." src="/_images/data_flow.png" center/>
52 changes: 52 additions & 0 deletions src/reference/workflow_data_types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Workflow Data Types

Nodes are defined by various different input and output data types.

When referencing a Node's data for use in another, the types must be compatible with each other.

## Data Type Conversions

Data can be shared across Nodes as long as the types are `Exact` (expected) or are `Compatible` based on the following conversions:

::: tip
You can view the data type by clicking on a Node and viewing the value within the parenthesis. This will be above the reference data dropdown menu.

:::

### String

::: info
The `Choice` and `Code` are not types in of themselves but rather just specializations of `String`.
:::

Strings are compatible with:

- **Bytes**: String (UTF-8 with lossy conversion, invalid characters are replaced with ``).
- **Bool**: String (converts to `"true"` or `"false"`).
- **Integer**: String (base-10 decimal encoding).

### Bytes

Bytes are compatible with:

- **String**: Bytes (UTF-8 encoding).
- **Bool**: String (converts to `"true"` or `"false"` in bytes).
- **Integer**: String (converts to string representation in bytes).

### Bool

Booleans are compatible with:

- **Integer**: Bool(`true` if integer is not zero - otherwise `false`).
- **Bytes/String**: Bool(`true` for "true", "on", "yes", and "1" - otherwise false).

### Integer

Integers are compatible with:

- **Bool**: Integer(`true` if integer !=0 - otherwise `false`).
- **Bytes/String**: Integer(parseIt ("0x123", "10", "#0b0", "0o123", "-123"), lossy string conversion for bytes).

### Request & Responses

There is no conversion besides their own.

0 comments on commit 50e00be

Please sign in to comment.