RabbinatixDocs
Sign inGet started

Build behaviour (Flow-Driven Development)

Reusable logic and packages

Build functions that belong to no system and call them anywhere, add logic packages, and publish your own flows and logic.

Open Logic in the app

Logic that belongs to no system

Most logic belongs to a system: an API's endpoint logic, a button's event logic. Some steps are the same everywhere: normalize an email, check a password's strength, work out VAT. Write those once as reusable logic and call them from any logic in any system.

Reusable logic is always a function: it takes inputs and returns outputs. Its key starts with LOGIC-LIB-…. On the Logic page it is listed first, under Reusable logic.

When a flow runs, reusable logic runs in the system of the logic that called it. Its steps show in the caller's lane, not a lane of their own.

Create a reusable function

  1. Open Logic and press New logic.
  2. Pick Function as the kind.
  3. Under System, choose No system (reusable anywhere).
  4. Name it, list What it takes and What it gives back, and press Create and open.

A function that belongs to a system can be shared too: tick Library (reusable by any system).

You can also make one from steps you already have. Select them on the canvas, right-click and choose Turn into a function. They move into a new function, and a Call Function step takes their place.

Call it

In any logic, open Nodes and switch to Other logic (or … → Use other logic…). It lists this system's functions and the shared ones. Add one and it becomes a Call Function step, with the function's inputs and outputs as connection points.

The function's … → Where it is used lists every logic that calls it and the systems and flows it runs in, so you know what a change affects. Generated code puts reusable logic in a shared folder.

Logic packages

The Store has logic packages, each with a clear name and version number: @publisher/name with a version. Each one is a set of functions that only calculate: no API calls, database queries or events, so they run anywhere.

  1. Open the Store and pick the Logic tab.
  2. Open a package. Its examples run on the page; Try it runs it on your input.
  3. Press Add to my logic. The functions are copied into your organization or project as reusable logic, and the copy is recorded.

Or take only the code with Download code or Copy code.

Added logic keeps a chip that links to its package, and its Where used names the package. The Added tab lists everything you added.

Publish your own

Anyone can publish a flow or a function so the rest of the organization can use it: everyone in it finds the package in the store and can copy it into any of its projects. Other organizations don't see it.

  1. For a flow, press Publish on the flow page. For a function, open the logic editor's More menu and choose Publish to store….
  2. Write a Title, a Summary, a Description and Tags.
  3. Under Publish as, choose your organization (@your-org/…) or yourself (@your-name/…).
  4. Pick the Version. The first is 1.0.0; after that, choose a fix, a new feature or a breaking change, and say What changed.
  5. Look at the Checks and press Publish.

Before publishing, Rabbinatix checks the package:

PackageCheck
FlowYour systems are turned into roles, the flow is copied into an empty project, and every test case must pass
FunctionIt must only calculate (no calls, queries or events), and an example is recorded from a test run

A new version must be higher than the latest. Your packages show on the Store's Published by you tab, where you can Unpublish them.

TipWrite examples for a function in its Test tab before you publish. They become the examples that run on the package page.

Versions

Adding copies a version into your organization or project. Later versions don't change your copy. See Versions and releases for how versions work elsewhere in Rabbinatix.