@skenora/flow 0.1.2
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 +20 -0
- package/dist/core/flow-runtime.d.ts +28 -0
- package/dist/core/flow-runtime.d.ts.map +1 -0
- package/dist/core/flow-runtime.js +711 -0
- package/dist/core/flow-runtime.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/model/node-registry.d.ts +26 -0
- package/dist/model/node-registry.d.ts.map +1 -0
- package/dist/model/node-registry.js +252 -0
- package/dist/model/node-registry.js.map +1 -0
- package/dist/model/types.d.ts +143 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +3 -0
- package/dist/model/types.js.map +1 -0
- package/dist/model/validation.d.ts +18 -0
- package/dist/model/validation.d.ts.map +1 -0
- package/dist/model/validation.js +186 -0
- package/dist/model/validation.js.map +1 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @skenora/flow
|
|
2
|
+
|
|
3
|
+
DOM-free validation and execution for serializable Skenora Flow graphs.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm add @skenora/flow
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
`FlowRuntime` mounts validated graphs over an injected `FlowHost`. Built-in
|
|
10
|
+
nodes cover scene/event/timer/pointer/animation triggers, values, branching,
|
|
11
|
+
delay, and allowlisted scene actions. Runs support bounded steps,
|
|
12
|
+
AbortSignal-based cancellation, concurrency policy, and typed lifecycle events.
|
|
13
|
+
|
|
14
|
+
Custom nodes use an application-owned namespace and a serializable
|
|
15
|
+
configuration. Core Flow deliberately rejects network and DOM side-effect
|
|
16
|
+
categories.
|
|
17
|
+
|
|
18
|
+
Use `@skenora/babylon-editor` for the standard Runtime capability host.
|
|
19
|
+
|
|
20
|
+
See the [Flow guide](https://github.com/zhangjiadi225/skenora/blob/main/docs/FLOW.md).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EventHub, type EventEnvelope } from "@skenora/events";
|
|
2
|
+
import { type FlowGraph, type FlowHost, type FlowNodeExecutor, type FlowRuntimeEventMap } from "../model/types.js";
|
|
3
|
+
import { type FlowNodeDefinition, type FlowNodeRegistry } from "../model/node-registry.js";
|
|
4
|
+
export interface FlowRuntimeOptions {
|
|
5
|
+
events?: EventHub<FlowRuntimeEventMap>;
|
|
6
|
+
maxSteps?: number;
|
|
7
|
+
nodes?: readonly FlowNodeRegistration[];
|
|
8
|
+
}
|
|
9
|
+
export interface FlowNodeRegistration {
|
|
10
|
+
definition: FlowNodeDefinition;
|
|
11
|
+
executor: FlowNodeExecutor;
|
|
12
|
+
}
|
|
13
|
+
export declare class FlowRuntime {
|
|
14
|
+
#private;
|
|
15
|
+
readonly host: FlowHost;
|
|
16
|
+
readonly events: EventHub<FlowRuntimeEventMap>;
|
|
17
|
+
readonly nodeRegistry: FlowNodeRegistry;
|
|
18
|
+
constructor(host: FlowHost, options?: FlowRuntimeOptions);
|
|
19
|
+
registerNode(definition: FlowNodeDefinition, executor: FlowNodeExecutor): () => void;
|
|
20
|
+
mount(graph: FlowGraph): void;
|
|
21
|
+
unmount(graphId: string): void;
|
|
22
|
+
start(graphId: string, payload?: unknown): Promise<string[]>;
|
|
23
|
+
trigger(graphId: string, triggerNodeId: string, payload?: unknown, triggerEvent?: Readonly<EventEnvelope>): Promise<string>;
|
|
24
|
+
cancel(runId: string): void;
|
|
25
|
+
cancelAll(graphId?: string): number;
|
|
26
|
+
dispose(): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=flow-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-runtime.d.ts","sourceRoot":"","sources":["../../src/core/flow-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,aAAa,EAEnB,MAAM,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