@stacc/flow-ts-helpers
TypeScript icon, indicating that this package has built-in type declarations

1.3.4 • Public • Published

Flow Typescript Helpers

A collection of utility function that makes it easier to work in a typesafe way in Flow Process

Getting started

  1. First install the package in your flow process
  npm install @stacc/flow-ts-helpers
  1. Import into a handler and use one of the functions provided.
import { createAddOperation } from "@stacc/flow-ts-helpers";

const map: UserTaskMapFn<typeof execute, State, Variables> = ({
  data,
  state,
}) => {
  return {
    // createAddOperation will validate that the data you insert into the specified path, is of the correct type.
    patch: [createAddOperation<State>()("/foo", "bar")],
    variables: {},
    attachments: {},
  };
};

API

Utilities

Interfaces

  • AddPatch - Interface for the Add mutation on a Flow Process state.
  • RemovePatch - Interface for the Remove mutation on a Flow Process state.
  • ReplacePatch - Interface for the Replace mutation on a Flow Process state.
  • OpPatch - Interface that is a intersection of all allowed state mutations in Flow Process.

How to contribute

This library is built using Bun as a package manager. Download it first before you begin working on your change!

Preferably open an issue describing which utility function you want added, if agreed it is something that fits this library, open a PR with your changes.

The PR should include:

  • A new file for your new change, placed in src
  • A new test file that sufficiently tests your function, placed in tests
  • A new export in index file.
  • An updated list where the change is placed in the correct list above, e.g
### new or existing category
- [myNewShinyFunction](relative path) - a cool description of what it does

Readme

Keywords

none

Package Sidebar

Install

npm i @stacc/flow-ts-helpers

Weekly Downloads

680

Version

1.3.4

License

MIT

Unpacked Size

14.8 kB

Total Files

15

Last publish

Collaborators

  • karolined
  • gawdfrey
  • bjarnehelland
  • robingrundvag
  • anderseidestacc
  • oyvindfanebust
  • slem