process-graph 0.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # process-graph
2
+
3
+ [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white)](https://github.com/ExaDev/process-graph) [![npm](https://img.shields.io/badge/npm-CB3837?logo=npm&logoColor=white)](https://www.npmjs.com/package/process-graph) [![Release](https://img.shields.io/github/v/release/ExaDev/process-graph)](https://github.com/ExaDev/process-graph/releases/latest) [![CI](https://img.shields.io/github/actions/workflow/status/ExaDev/process-graph/ci.yml?branch=main)](https://github.com/ExaDev/process-graph/actions)
4
+
5
+ The one install for the process-graph model: a layout-free description of a process, its projections into a flowchart, a swimlane, a state machine and a sequence diagram, and reasoning over a run (what is ready, what blocks what, what finishing something changes). It re-exports the building-block packages so a consumer depends on one package and imports from one place. `src/` imports nothing Node-only and runs unchanged in a browser or a Worker.
6
+
7
+ ```ts
8
+ import {
9
+ defineModel,
10
+ deriveStatuses,
11
+ toSwimlane,
12
+ type Facts,
13
+ } from "process-graph";
14
+
15
+ const model = defineModel({
16
+ participants: [
17
+ { id: "customer", label: "Customer", kind: "role" },
18
+ { id: "shop", label: "Shop", kind: "system" },
19
+ ],
20
+ events: [],
21
+ actions: [],
22
+ artefacts: [],
23
+ elements: [
24
+ { kind: "activity", id: "submit", label: "Submit", actor: "customer" },
25
+ { kind: "activity", id: "pack", label: "Pack", actor: "shop" },
26
+ ],
27
+ transitions: [{ id: "t1", source: "submit", target: "pack" }],
28
+ fragments: [],
29
+ projections: [],
30
+ });
31
+
32
+ // The injected source of facts a decision's condition reads; this model has no decisions.
33
+ const facts: Facts = () => ({ found: false });
34
+
35
+ toSwimlane(model).lanes; // one lane per actor, each with the elements it owns
36
+ deriveStatuses(model, { submit: "done" }, facts); // Map { "submit" => "done", "pack" => "ready" }
37
+ ```
38
+
39
+ ## This package or a building block
40
+
41
+ Install `process-graph` to author, load, project and reason about a model. Install a building-block package instead when only one layer is needed and the rest should stay out of the dependency tree, or when another package of this repository imports a layer directly.
42
+
43
+ | Layer | Package | Exported by this package |
44
+ | ---------- | ---------------------------------- | ------------------------ |
45
+ | Model | `@exadev/process-graph-schema` | flat |
46
+ | Projection | `@exadev/process-graph-projection` | flat |
47
+ | Domain | `@exadev/process-graph-domain` | flat |
48
+ | DAG | `@exadev/process-graph-dag` | namespaced as `dag` |
49
+
50
+ Each package's own README documents its functions and rules; this package adds no behaviour of its own.
51
+
52
+ ## What is exported, and under which name
53
+
54
+ The model, projection and domain packages are exported flat, under their own names. The DAG package is exported as the namespace `dag`, in its entirety: `dag.buildDag`, `dag.topologicalLayers`, `dag.criticalPath`, `dag.CycleError` and the rest. It is the only layer namespaced, because its `criticalPath` has the same name as the domain package's, which answers a different question (the heaviest chain through the work still ahead of a run, not through a bare node set). The whole layer is namespaced rather than only the colliding name, so a name added to a layer later cannot start colliding silently.
55
+
56
+ - A name is never shadowed. Two flat layers exporting the same name is a compile error in this package, and its unit test also compares the runtime exports of each package against the entry point's.
57
+ - Types follow the same rule as values: a model, projection or domain type is a flat import, a DAG type is `dag.Dag` and so on.
58
+ - Errors thrown by the domain functions (`CycleError`, `UnknownNodeError`) are the DAG package's, so a handler imports them from `dag`.
59
+
60
+ ```ts
61
+ import { criticalPath, dag } from "process-graph";
62
+
63
+ criticalPath; // the domain function: over a model and a run overlay
64
+ dag.criticalPath; // the DAG function: over a node set and a `needs` accessor
65
+ ```
66
+
67
+ ## Commands
68
+
69
+ ```sh
70
+ pnpm build # tsc -b -> dist/ (ESM + .d.ts)
71
+ pnpm test # unit tests
72
+ pnpm test:smoke # the built dist/ exercised as a real artefact
73
+ pnpm test:mutation # Stryker
74
+ ```
@@ -0,0 +1,4 @@
1
+ export * from "@exadev/process-graph-schema";
2
+ export * from "@exadev/process-graph-projection";
3
+ export * from "@exadev/process-graph-domain";
4
+ export * as dag from "@exadev/process-graph-dag";
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ // The primary entry point: the model, its projections and its reasoning under one install. The schema, projection and domain packages are re-exported flat. The DAG package is namespaced as `dag` because its `criticalPath` has the same name as the domain package's, which answers a different question over the model and a run overlay. The whole layer is namespaced, not only the colliding name, so the rule is one sentence and a name added to a layer later cannot start colliding silently: TypeScript rejects a duplicate `export *` name and `index.unit.test.ts` checks the runtime surface against each package's own exports.
2
+ export * from "@exadev/process-graph-schema";
3
+ export * from "@exadev/process-graph-projection";
4
+ export * from "@exadev/process-graph-domain";
5
+ export * as dag from "@exadev/process-graph-dag";
package/package.json CHANGED
@@ -1,5 +1,77 @@
1
1
  {
2
2
  "name": "process-graph",
3
- "version": "0.0.0",
4
- "private": false
3
+ "version": "1.0.1",
4
+ "description": "A process and dependency graph model with projections into flowcharts, swimlanes, state machines and sequence diagrams, and reasoning over a run: one install for the model, projection, domain and DAG packages.",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ExaDev/process-graph.git",
9
+ "directory": "packages/targets/process-graph"
10
+ },
11
+ "homepage": "https://github.com/ExaDev/process-graph/tree/main/packages/targets/process-graph#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/ExaDev/process-graph/issues"
14
+ },
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ }
20
+ },
21
+ "types": "./dist/index.d.ts",
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public",
27
+ "provenance": true,
28
+ "registry": "https://registry.npmjs.org/"
29
+ },
30
+ "sideEffects": false,
31
+ "license": "MIT",
32
+ "scripts": {
33
+ "build": "turbo run _build",
34
+ "_build": "tsc -b tsconfig.build.json",
35
+ "lint": "turbo run _lint",
36
+ "_lint": "eslint . --cache --max-warnings 0",
37
+ "_lint:fix": "eslint . --fix --cache --max-warnings 0",
38
+ "typecheck": "turbo run _typecheck _typecheck:attw",
39
+ "_typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.node.json --noEmit",
40
+ "_typecheck:attw": "attw --pack --profile esm-only",
41
+ "test": "turbo run _test",
42
+ "_test": "vitest run --project unit",
43
+ "test:coverage": "turbo run _test:coverage",
44
+ "_test:coverage": "vitest run --project unit --coverage",
45
+ "test:smoke": "turbo run _test:smoke",
46
+ "_test:smoke": "vitest run --project smoke",
47
+ "test:mutation": "turbo run _test:mutation",
48
+ "_test:mutation": "stryker run stryker.config.ts",
49
+ "prepublishOnly": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build && publint && attw --pack --profile esm-only"
50
+ },
51
+ "keywords": [
52
+ "process-model",
53
+ "dependency-graph",
54
+ "flowchart",
55
+ "swimlane",
56
+ "state-machine",
57
+ "sequence-diagram"
58
+ ],
59
+ "dependencies": {
60
+ "@exadev/process-graph-dag": "1.0.0",
61
+ "@exadev/process-graph-domain": "1.0.0",
62
+ "@exadev/process-graph-projection": "1.0.0",
63
+ "@exadev/process-graph-schema": "1.0.0"
64
+ },
65
+ "devDependencies": {
66
+ "@arethetypeswrong/cli": "0.18.5",
67
+ "@stryker-mutator/core": "10.0.0",
68
+ "@stryker-mutator/typescript-checker": "10.0.0",
69
+ "@stryker-mutator/vitest-runner": "10.0.0",
70
+ "@types/node": "26.6.4",
71
+ "@vitest/coverage-v8": "4.1.11",
72
+ "eslint": "10.12.0",
73
+ "publint": "0.3.25",
74
+ "typescript": "6.0.3",
75
+ "vitest": "4.1.11"
76
+ }
5
77
  }