npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cyoda/workflow-core

v0.2.0

Published

Cyoda workflow domain model: parse, normalize, validate, serialize, patch.

Readme

@cyoda/workflow-core

Core domain package for parsing, normalizing, validating, patching, and serializing Cyoda workflow documents.

Install

npm install @cyoda/workflow-core

Highlights

  • Parse and validate workflow import/export payloads (Zod schemas).
  • Normalize documents into canonical WorkflowEditorDocument state.
  • Apply and invert domain patches with exact inverses.
  • PatchTransaction — group multiple patches into one atomic undo step.
  • Deterministic serialization — exported JSON excludes all editor metadata.
  • Editor metadata types: WorkflowUiMeta, CommentMeta (layout/comments never appear in exported Cyoda JSON).

Patch families

| Op | Description | |---|---| | addState / renameState / removeState | State lifecycle | | setInitialState | Promote a state to initial | | addTransition / updateTransition / removeTransition | Transition editing | | reorderTransition | Reorder within source state | | moveTransitionSource | Move transition to a different source state | | addProcessor / updateProcessor / removeProcessor / reorderProcessor | Processor editing | | setCriterion | Set or clear a criterion at an arbitrary path | | addWorkflow / removeWorkflow / updateWorkflowMeta / renameWorkflow | Workflow lifecycle | | setImportMode / setEntity | Session metadata | | replaceSession | Replace full session (Monaco JSON edits) | | setEdgeAnchors | UI-only: edge anchor overrides | | setNodePosition / removeNodePosition / resetLayout | UI-only: manual layout | | addComment / updateComment / removeComment | UI-only: canvas comments |

All UI-only patches write to meta.workflowUi and are excluded from serializeImportPayload output.

Exact inverses

invertPatch(doc, patch) returns a patch that, when applied after the original, restores the document to its prior state. Exact inverses are implemented for all patch families including reorder, moveTransitionSource, and all UI-only metadata ops.

PatchTransaction groups forward patches with pre-computed inverses for multi-patch undo in one step:

import { applyTransaction, invertTransaction } from "@cyoda/workflow-core";

const tx = {
  summary: "Add state at position",
  patches: [
    { op: "addState", workflow: "wf", stateCode: "new" },
    { op: "setNodePosition", workflow: "wf", stateCode: "new", x: 50, y: 100 },
  ],
  inverses: [
    { op: "removeNodePosition", workflow: "wf", stateCode: "new" },
    { op: "removeState", workflow: "wf", stateCode: "new" },
  ],
};
const after = applyTransaction(doc, tx);
const undoTx = invertTransaction(doc, tx);

Deterministic serialization

import { serializeImportPayload } from "@cyoda/workflow-core";

// Always produces clean, canonical Cyoda workflow JSON.
// Layout positions, comments, edge anchors, and viewport state are excluded.
const json = serializeImportPayload(doc);

Fixed key order, 2-space indent, LF, trailing newline. No operatorType aliases in output.

Editor metadata types

// WorkflowUiMeta lives in doc.meta.workflowUi[workflowName].
// It is never serialised into exported Cyoda JSON.
interface WorkflowUiMeta {
  layout?: { nodes: Record<StateCode, { x: number; y: number; pinned?: boolean }> };
  comments?: Record<string, CommentMeta>;
  edgeAnchors?: Record<string, EdgeAnchorPair>;
  viewports?: Partial<Record<"vertical" | "horizontal", EditorViewport>>;
}

interface CommentMeta {
  id: string;
  text: string;
  x: number;
  y: number;
  attachedTo?: { kind: "state"; stateCode: string }
             | { kind: "transition"; sourceState: string; transitionName: string }
             | { kind: "free" };
}

Documentation

See the repository README.

License

Apache-2.0