@hyperfixation/workflows 0.1.0

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.
@@ -0,0 +1,18 @@
1
+ import type { StepPool } from "@hyperfixation/db";
2
+ import type { ApprovalNotifier } from "./approvals.js";
3
+ import type { ControlPool } from "./control-pool.js";
4
+ /** What a running flow needs from the worker that launched it. */
5
+ export interface WorkerRuntime {
6
+ appName: string;
7
+ applicationVersion: string;
8
+ steps: StepPool;
9
+ control: ControlPool;
10
+ /** What `waitForApproval` notifies through when the call passes no `notify` of its own. */
11
+ approvalNotifier?: ApprovalNotifier;
12
+ }
13
+ export declare class WorkerNotStarted extends Error {
14
+ readonly operation: string;
15
+ constructor(operation: string);
16
+ }
17
+ export declare function setWorkerRuntime(runtime: WorkerRuntime): void;
18
+ export declare function workerRuntime(operation: string): WorkerRuntime;
@@ -0,0 +1,22 @@
1
+ export class WorkerNotStarted extends Error {
2
+ operation;
3
+ constructor(operation) {
4
+ super(`WorkerNotStarted: ${operation} needs the pools startWorker() builds`);
5
+ this.name = "WorkerNotStarted";
6
+ this.operation = operation;
7
+ }
8
+ }
9
+ /**
10
+ * Process-wide because `DBOS.launch()` is: one worker per process is already enforced by the
11
+ * advisory lock, and a flow function reached by DBOS recovery is handed nothing but its own
12
+ * arguments — there is no call site to thread the pools through.
13
+ */
14
+ let current;
15
+ export function setWorkerRuntime(runtime) {
16
+ current = runtime;
17
+ }
18
+ export function workerRuntime(operation) {
19
+ if (current === undefined)
20
+ throw new WorkerNotStarted(operation);
21
+ return current;
22
+ }
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@hyperfixation/workflows",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "description": "startWorker, defineFlow and the run lifecycle, the step wrapper, approvals, actions, queues, and the reconciler",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/grahamlutz/hyperfixation-core.git",
9
+ "directory": "packages/workflows"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "type": "module",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "!dist/**/*.test.*",
25
+ "!dist/test-support/**"
26
+ ],
27
+ "dependencies": {
28
+ "@dbos-inc/dbos-sdk": "4.27.6",
29
+ "@hyperfixation/db": "0.1.0",
30
+ "@langfuse/otel": "5.11.1",
31
+ "@opentelemetry/api": "1.9.1",
32
+ "@opentelemetry/context-async-hooks": "2.11.0",
33
+ "@opentelemetry/core": "2.11.0",
34
+ "@opentelemetry/exporter-trace-otlp-http": "0.220.0",
35
+ "@opentelemetry/sdk-trace-base": "2.11.0",
36
+ "@opentelemetry/sdk-trace-node": "2.11.0",
37
+ "drizzle-orm": "^0.45.2",
38
+ "pg": "^8.23.0",
39
+ "zod": "4.6.5"
40
+ },
41
+ "devDependencies": {
42
+ "@hyperfixation/eslint-config": "0.1.0",
43
+ "@hyperfixation/testing": "0.1.0",
44
+ "@microsoft/api-extractor": "^7.59.1",
45
+ "@sentry/node": "^10.74.0",
46
+ "@types/pg": "^8.23.1",
47
+ "eslint": "^10.10.0"
48
+ },
49
+ "scripts": {
50
+ "build": "tsc -p tsconfig.json",
51
+ "typecheck": "tsc -p tsconfig.json --noEmit",
52
+ "lint": "eslint src",
53
+ "api-extractor": "api-extractor run",
54
+ "api-extractor:update": "api-extractor run --local",
55
+ "test": "vitest run --passWithNoTests"
56
+ }
57
+ }