openworkflowdev / openworkflowdev/openworkflow
Custom serializer for step/workflow output
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 66
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 69
Description
Desired Behavior
Currently serializers are using JSON.stringify/JSON.parse. Any plans to support custom serializers to support non serializable json data? Just ran into a gotcha case where Date was serialized to string but still typed as a Date in step output.
Example Usage
const backend = BackendSqlite.connect(dbPath, { serializer: {
serialize(data) {
return devalue.stringify(data)
},
deserialize(data: string) {
return devalue.parse(data)
}
})
If there are no plans to support custom serializers, i guess it might be good to type StepOutputs in a way that makes typescript complain errors when output returned are not serializable
Maybe Output extends JsonValue or something
export interface StepApi {
run: <Output extends JsonValue>(
config: Readonly<StepFunctionConfig>,
fn: StepFunction<Output>,
) => Promise<Output>;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the BackendSqlite.connect serializer option and the StepApi output typing shown in the issue. Trace how step and workflow output is serialized, then define whether completion means supporting custom serialize/deserialize functions, restricting outputs to JsonValue, or both; verify the Date example and non-serializable output behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite, typescript
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100