{"id":29405053,"url":"https://github.com/serverlessworkflow/sdk-typescript","last_synced_at":"2025-10-10T02:14:56.827Z","repository":{"id":41979379,"uuid":"354178027","full_name":"serverlessworkflow/sdk-typescript","owner":"serverlessworkflow","description":"Typescript SDK for Serverless Workflow","archived":false,"fork":false,"pushed_at":"2025-03-28T08:24:14.000Z","size":1515,"stargazers_count":77,"open_issues_count":6,"forks_count":21,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-09-11T13:53:33.447Z","etag":null,"topics":["cncf","sdk","serverless","serverless-workflow","typescript"],"latest_commit_sha":null,"homepage":"https://serverlessworkflow.io/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serverlessworkflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-03T02:06:39.000Z","updated_at":"2025-09-08T17:41:56.000Z","dependencies_parsed_at":"2024-02-29T15:46:52.943Z","dependency_job_id":"c2179fca-ac58-48a9-adc8-e6f6262eff47","html_url":"https://github.com/serverlessworkflow/sdk-typescript","commit_stats":{"total_commits":131,"total_committers":8,"mean_commits":16.375,"dds":"0.29007633587786263","last_synced_commit":"641a3298e1285eeec2f354d0537fa7cf33856f34"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/serverlessworkflow/sdk-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessworkflow%2Fsdk-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessworkflow%2Fsdk-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessworkflow%2Fsdk-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessworkflow%2Fsdk-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serverlessworkflow","download_url":"https://codeload.github.com/serverlessworkflow/sdk-typescript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessworkflow%2Fsdk-typescript/sbom","scorecard":{"id":812970,"data":{"date":"2025-08-11","repo":{"name":"github.com/serverlessworkflow/sdk-typescript","commit":"b22ff1ed9d0016e73d54dc0ae5ed4cca11b65f49"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5,"checks":[{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node-ci.yml:1","Warn: no topLevel permission defined: .github/workflows/npmjs-release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/npmjs-release.yml:7"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node-ci.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/serverlessworkflow/sdk-typescript/node-ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node-ci.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/serverlessworkflow/sdk-typescript/node-ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmjs-release.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/serverlessworkflow/sdk-typescript/npmjs-release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmjs-release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/serverlessworkflow/sdk-typescript/npmjs-release.yml/main?enable=pin","Warn: containerImage not pinned by hash: .gitpod.Dockerfile:1: pin your Docker image by updating node:16-buster to node:16-buster@sha256:f77a1aef2da8d83e45ec990f45df50f1a286c5fe8bbfb8c6e4246c6389705c0b","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned","Info:   2 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T13:35:43.992Z","repository_id":41979379,"created_at":"2025-08-23T13:35:43.992Z","updated_at":"2025-08-23T13:35:43.992Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002539,"owners_count":26083399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cncf","sdk","serverless","serverless-workflow","typescript"],"created_at":"2025-07-10T21:12:30.426Z","updated_at":"2025-10-10T02:14:56.814Z","avatar_url":"https://github.com/serverlessworkflow.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Node CI](https://github.com/serverlessworkflow/sdk-typescript/workflows/Node%20CI/badge.svg) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/serverlessworkflow/sdk-typescript)\r\n\r\n- [Serverless Workflow Specification - TypeScript SDK](#serverless-workflow-specification---typescript-sdk)\r\n  - [Status](#status)\r\n  - [SDK Structure](#sdk-structure)\r\n    - [Types and Interfaces](#types-and-interfaces)\r\n    - [Classes](#classes)\r\n    - [Fluent Builders](#fluent-builders)\r\n    - [Validation Function](#validation-function)\r\n    - [Other tools](#other-tools)\r\n  - [Getting Started](#getting-started)\r\n    - [Installation](#installation)\r\n    - [Usage](#usage)\r\n      - [Create a Workflow Definition from YAML or JSON](#create-a-workflow-definition-from-yaml-or-json)\r\n      - [Create a Workflow Definition by Casting an Object](#create-a-workflow-definition-by-casting-an-object)\r\n      - [Create a Workflow Definition Using a Class Constructor](#create-a-workflow-definition-using-a-class-constructor)\r\n      - [Create a Workflow Definition Using the Builder API](#create-a-workflow-definition-using-the-builder-api)\r\n      - [Serialize a Workflow Definition to YAML or JSON](#serialize-a-workflow-definition-to-yaml-or-json)\r\n      - [Validate Workflow Definitions](#validate-workflow-definitions)\r\n      - [Generate a directed graph](#generate-a-directed-graph)\r\n      - [Generate a MermaidJS flowchart](#generate-a-mermaidjs-flowchart)\r\n    - [Building Locally](#building-locally)\r\n\r\n# Serverless Workflow Specification - TypeScript SDK\r\n\r\nThis SDK provides a TypeScript API for working with the [Serverless Workflow Specification](https://github.com/serverlessworkflow/specification).\r\n\r\nWith this SDK, you can:\r\n* Parse workflow definitions in JSON and YAML formats\r\n* Programmatically build workflow definitions\r\n* Validate workflow definitions\r\n\r\n## Status\r\nThe npm [`@serverlessworkflow/sdk`](https://www.npmjs.com/package/@serverlessworkflow/sdk) package versioning aligns with the versioning of the [specification](https://github.com/serverlessworkflow/specification):\r\n\r\n| Latest Releases | Conformance to Spec Version |\r\n| :---: | :---: |\r\n| [v1.0.\\*](https://github.com/serverlessworkflow/sdk-typescript/releases/) | [v1.0.0](https://github.com/serverlessworkflow/specification) |\r\n\r\n\u003e [!WARNING]\r\n\u003e Previous versions of the SDK were published with a typo in the scope:\r\n\u003e @severlessworkflow/sdk-typescript instead of\r\n\u003e @se**r**verlessworkflow/sdk-typescript\r\n\r\n| Latest Releases | Conformance to Spec Version |\r\n| :---: | :---: |\r\n| [v1.0.0](https://github.com/serverlessworkflow/sdk-typescript/releases/) | [v0.6](https://github.com/serverlessworkflow/specification/tree/0.6.x) |\r\n| [v2.0.0](https://github.com/serverlessworkflow/sdk-typescript/releases/) | [v0.7](https://github.com/serverlessworkflow/specification/tree/0.7.x) |\r\n| [v3.0.0](https://github.com/serverlessworkflow/sdk-typescript/releases/) | [v0.8](https://github.com/serverlessworkflow/specification/tree/0.8.x) |\r\n\r\n## SDK Structure\r\nThis SDK includes the following key components:\r\n\r\n### Types and Interfaces\r\nThe SDK provides various TypeScript types and interfaces that ensure type safety and enhance the development experience by catching type errors during compile time.\r\n\r\nTo avoid confusion with classes, these types and interfaces are exported under the **`Specification`** object, e.g., `Specification.Workflow`.\r\n\r\n### Classes\r\nThe SDK includes classes that correspond to the aforementioned types and interfaces. These classes offer:\r\n\r\n- **Instance Checking**: Easily verify if an object is an instance of a specific class.\r\n- **Self-Validation**: Validate the internal state of an object to ensure it adheres to the expected structure.\r\n- **Normalization**: Methods to normalize object data, ensuring consistent formatting and values.\r\n\r\nTo avoid confusion with type definitions, these classes are exported under the **`Classes`** object, e.g., `Classes.Workflow`.\r\n\r\n### Fluent Builders\r\nThe fluent builders wrap the core classes and provide a fluent API for constructing objects. This API allows you to chain method calls and configure objects in a more readable and convenient manner.\r\n\r\nThe fluent builders are directly exported as `*\u003cdesired-type\u003e*Builder`, e.g., `workflowBuilder`.\r\n\r\nBy default, built objects are self-validated and self-normalized. `BuildOptions` can be passed to the `build()` method to disable validation or normalization.\r\n\r\n### Validation Function\r\nThe SDK includes a validation function to check if objects conform to the expected schema. This function ensures that your workflow objects are correctly structured and meet the required specifications.\r\n\r\nThe `validate` function is directly exported and can be used as `validate('Workflow', workflowObject)`.\r\n\r\n### Other Tools\r\nThe SDK also ships tools to build directed graph and MermaidJS flowcharts from a workflow.\r\n\r\n## Getting Started\r\n\r\n### Installation\r\n\u003e [!NOTE]\r\n\u003e Version v1.0.0.\\* has not been released yet.\r\n\r\n```sh\r\nnpm install @serverlessworkflow/sdk\r\n```\r\n\r\n### Usage\r\n#### Create a Workflow Definition from YAML or JSON\r\nYou can deserialize a YAML or JSON representation of the workflow using the static method `Classes.Workflow.deserialize`:\r\n\r\n```typescript\r\nimport { Classes } from '@serverlessworkflow/sdk';\r\n\r\n// const text = await readFile('/some/path/my-workflow-definition.yaml', { encoding: 'utf8' });\r\n// const text = await fetch('https://myserver.com/my-workflow-definition.json');\r\nconst text = `\r\ndocument:\r\n  dsl: 1.0.0\r\n  name: test\r\n  version: 1.0.0\r\n  namespace: default\r\ndo:\r\n- step1:\r\n    set:\r\n      variable: 'my first workflow'\r\n`;\r\nconst workflow = Classes.Workflow.deserialize(text);\r\n```\r\n\r\n#### Create a Workflow Definition by Casting an Object\r\nYou can type-cast an object to match the structure of a workflow definition:\r\n\r\n```typescript\r\nimport { Classes, Specification, validate } from '@serverlessworkflow/sdk';\r\n\r\n// Simply cast an object:\r\nconst workflow = {\r\n  document: {\r\n    dsl: '1.0.0',\r\n    name: 'test',\r\n    version: '1.0.0',\r\n    namespace: 'default',\r\n  },\r\n  do: [\r\n    {\r\n      step1: {\r\n        set: {\r\n          variable: 'my first workflow',\r\n        },\r\n      },\r\n    },\r\n  ],\r\n} as Specification.Workflow;\r\n\r\n// Validate it\r\ntry {\r\n  validate('Workflow', workflow);\r\n  // Serialize it\r\n  const definitionTxt = Classes.Workflow.serialize(workflow);\r\n}\r\ncatch (ex) {\r\n  // Invalid workflow definition\r\n}\r\n```\r\n\r\n#### Create a Workflow Definition Using a Class Constructor\r\nYou can create a workflow definition by calling a constructor:\r\n\r\n```typescript\r\nimport { Classes, validate } from '@serverlessworkflow/sdk';\r\n\r\n// Simply use the constructor\r\nconst workflow = new Classes.Workflow({\r\n  document: {\r\n    dsl: '1.0.0',\r\n    name: 'test',\r\n    version: '1.0.0',\r\n    namespace: 'default',\r\n  },\r\n  do: [/*\r\n    {\r\n      step1: {\r\n        set: {\r\n          variable: 'my first workflow',\r\n        },\r\n      },\r\n    },\r\n  */],\r\n});\r\nworkflow.do.push({\r\n  step1: new Classes.SetTask({\r\n    set: {\r\n      variable: 'my first workflow',\r\n    }\r\n  })\r\n});\r\n\r\n// Validate it\r\ntry {\r\n  workflow.validate();\r\n  // Serialize it\r\n  const definitionTxt = workflow.serialize();\r\n}\r\ncatch (ex) {\r\n  // Invalid workflow definition\r\n}\r\n```\r\n\r\n#### Create a Workflow Definition Using the Builder API\r\nYou can use the fluent API to build a validated and normalized workflow definition:\r\n\r\n```typescript\r\nimport { documentBuilder, setTaskBuilder, taskListBuilder, workflowBuilder } from '@serverlessworkflow/sdk';\r\n\r\nconst workflow = workflowBuilder(/*workflowObject*/)\r\n  .document(\r\n    documentBuilder()\r\n    .dsl('1.0.0')\r\n    .name('test')\r\n    .version('1.0.0')\r\n    .namespace('default')\r\n    .build()\r\n  )\r\n  .do(\r\n    taskListBuilder()\r\n      .push({\r\n        step1: setTaskBuilder()\r\n          .set({\r\n            variable: 'my first workflow'\r\n          })\r\n          .build()\r\n      })\r\n      .build()\r\n  )\r\n  .build(/*{\r\n    validate: false,\r\n    normalize: false\r\n  }*/);\r\n```\r\n\r\n#### Serialize a Workflow Definition to YAML or JSON\r\nYou can serialize a workflow definition either by using its `serialize` method if it's an instance or the static method with the same name:\r\n\r\n```typescript\r\nimport { Classes } from '@serverlessworkflow/sdk';\r\n\r\n// const workflow = \u003cYour preferred method\u003e;\r\nif (workflow instanceof Classes.Workflow) {\r\n  const yaml = workflow.serialize(/*'yaml' | 'json' */);\r\n}\r\nelse {\r\n  const json = Classes.Workflow.serialize(workflow, 'json');\r\n}\r\n```\r\n\u003e [!NOTE]\r\n\u003e The default serialization format is YAML.\r\n\r\n#### Validate Workflow Definitions\r\nValidation can be achieved in two ways: via the `validate` function or the instance `validate` method:\r\n\r\n```typescript\r\nimport { Classes, validate } from '@serverlessworkflow/sdk';\r\n\r\nconst workflow = /* \u003cYour preferred method\u003e */;\r\ntry {\r\n  if (workflow instanceof Classes.Workflow) {\r\n    workflow.validate();\r\n  }\r\n  else {\r\n    validate('Workflow', workflow);\r\n  }\r\n}\r\ncatch (ex) {\r\n  // Workflow definition is invalid\r\n}\r\n```\r\n\r\n#### Generate a directed graph\r\nA [directed graph](https://en.wikipedia.org/wiki/Directed_graph) of a workflow can be generated using the `buildGraph` function, or alternatives:\r\n- Workflow instance `.toGraph();`\r\n- Static `Classes.Workflow.toGraph(workflow)`\r\n\r\n```typescript\r\nimport { buildGraph } from '@serverlessworkflow/sdk';\r\n\r\nconst workflow = {\r\n  document: {\r\n    dsl: '1.0.0',\r\n    name: 'using-plain-object',\r\n    version: '1.0.0',\r\n    namespace: 'default',\r\n  },\r\n  do: [\r\n    {\r\n      step1: {\r\n        set: {\r\n          variable: 'my first workflow',\r\n        },\r\n      },\r\n    },\r\n  ],\r\n};\r\nconst graph = buildGraph(workflow);\r\n// const workflow = new Classes.Workflow({...}); const graph = workflow.toGraph();\r\n// const graph = Classes.Workflow.toGraph(workflow);\r\n/*{\r\n  id: 'root',\r\n  type: 'root',\r\n  label: undefined,\r\n  parent: null,\r\n  nodes: [...], // length 3 - root entry node, step1 node, root exit node\r\n  edges: [...], // length 2 - entry to step1, step1 to exit\r\n  entryNode: {...}, // root entry node\r\n  exitNode: {...} // root exit node\r\n}*/\r\n```\r\n\r\n#### Generate a MermaidJS flowchart\r\nGenerating a [MermaidJS](https://mermaid.js.org/) flowchart can be achieved in two ways: using the `convertToMermaidCode`, the legacy `MermaidDiagram` class, or alternatives:\r\n- Workflow instance `.toMermaidCode();`\r\n- Static `Classes.Workflow.toMermaidCode(workflow)`\r\n\r\n```typescript\r\nimport { convertToMermaidCode, MermaidDiagram } from '@serverlessworkflow/sdk';\r\n\r\nconst workflow = {\r\n  document: {\r\n    dsl: '1.0.0',\r\n    name: 'using-plain-object',\r\n    version: '1.0.0',\r\n    namespace: 'default',\r\n  },\r\n  do: [\r\n    {\r\n      step1: {\r\n        set: {\r\n          variable: 'my first workflow',\r\n        },\r\n      },\r\n    },\r\n  ],\r\n};\r\nconst mermaidCode = convertToMermaidCode(workflow) /* or  */;\r\n// const mermaidCode = new MermaidDiagram(workflow).sourceCode();\r\n// const workflow = new Classes.Workflow({...}); const mermaidCode = workflow.toMermaidCode();\r\n// const mermaidCode = Classes.Workflow.toMermaidCode(workflow);\r\n/*\r\nflowchart TD\r\n    root-entry-node(( ))\r\n    root-exit-node((( )))\r\n    /do/0/step1[\"step1\"]\r\n    /do/0/step1 --\u003e root-exit-node\r\n    root-entry-node --\u003e /do/0/step1\r\n\r\n\r\nclassDef hidden display: none;\r\n*/\r\n```\r\n\r\n```mermaid\r\nflowchart TD\r\n    root-entry-node(( ))\r\n    root-exit-node((( )))\r\n    /do/0/step1[\"step1\"]\r\n    /do/0/step1 --\u003e root-exit-node\r\n    root-entry-node --\u003e /do/0/step1\r\n\r\n\r\nclassDef hidden display: none;\r\n```\r\n\r\n### Building Locally\r\n\r\nTo build the project and run tests locally, use the following commands:\r\n\r\n```sh\r\ngit clone https://github.com/serverlessworkflow/sdk-typescript.git\r\ncd sdk-typescript\r\nnpm install \u0026\u0026 npm run build \u0026\u0026 npm run test\r\n```\r\n\r\nIf you're interested in contributing, reading the [Tooling Architecture](/tools/README.md) is a good place to start.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverlessworkflow%2Fsdk-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserverlessworkflow%2Fsdk-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverlessworkflow%2Fsdk-typescript/lists"}