Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,30 @@ TypeScript SDK for the [iWF workflow engine](https://github.com/indeedeng/iwf).
- Node.js 24 (Krypton) — see [`.nvmrc`](.nvmrc) (`nvm use`)
- A running [iWF server](https://github.com/indeedeng/iwf#how-to-use)

## Install dependencies & build
## Install

Not yet published to npm. Install from GitHub, pinned to a tag:

```bash
npm install github:indeedeng/iwf-ts-sdk#v1.0.0-beta.1
```

The package's `prepare` script compiles `dist/` during install, so the tarball npm builds
from the git clone contains the emitted JS and `.d.ts` files. This makes the install slower
than a normal npm package — it resolves the full devDependency tree (including
`@openapitools/openapi-generator-cli`) in npm's temp clone to run `tsc`. Pin a tag rather
than a branch so builds are reproducible.

Then import from the package name:

```ts
import { Client, Registry } from "iwf-typescript-sdk";
```

## Develop on this SDK

```bash
npm install
npm install # also runs `prepare` -> compiles to dist/
npm run build # compile to dist/
npm run typecheck # type-check without emitting
npm test # run the unit tests (jest + ts-jest)
Expand All @@ -30,7 +50,7 @@ Implement two interfaces to define a workflow:
import {
ObjectWorkflow, WorkflowState, StateDef, StateDecision,
CommandRequest, TimerCommand, Context, Persistence, Communication, CommandResults,
} from "iwf";
} from "iwf-typescript-sdk";

class GreetState implements WorkflowState {
get stateId() { return "greet"; }
Expand All @@ -57,7 +77,7 @@ Wire them to any HTTP server (the `test/` folder has a complete Express example)

```ts
import express from "express";
import { Registry, WorkerService } from "iwf";
import { Registry, WorkerService } from "iwf-typescript-sdk";

const registry = new Registry();
registry.addWorkflow(new GreetWorkflow());
Expand All @@ -76,7 +96,7 @@ app.listen(8802);
## Client

```ts
import { Client, Registry } from "iwf";
import { Client, Registry } from "iwf-typescript-sdk";

const registry = new Registry();
const workflow = new GreetWorkflow();
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "iwf-typescript-sdk",
"private": true,
"version": "0.1.0",
"version": "1.0.0-beta.1",
"main": "dist/iwf/index.js",
"types": "dist/iwf/index.d.ts",
"files": [
Expand Down Expand Up @@ -36,7 +36,7 @@
"lint:fix": "eslint . --fix --ext .ts",
"format": "prettier --write .",
"format:check": "prettier --check .",
"prepublishOnly": "npm run build",
"prepare": "npm run build",
"preversion": "npm run lint && npm run test:ci",
"version": "npm run build && git add -A dist"
},
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"declaration": true,
"sourceMap": true,
"resolveJsonModule": true,
"rootDir": ".",
"outDir": "dist"
},
"include": ["iwf/**/*.ts", "gen/**/*.ts"],
Expand Down
Loading