@unlaxer/tramli 3.6.0 → 3.6.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.
@@ -1,4 +1,5 @@
1
1
  import type { StateConfig } from './types.js';
2
+ import type { FlowKey } from './flow-key.js';
2
3
  import { Builder } from './flow-definition.js';
3
4
  import { FlowEngine } from './flow-engine.js';
4
5
  import type { InMemoryFlowStore } from './in-memory-flow-store.js';
@@ -8,5 +9,7 @@ export declare class Tramli {
8
9
  static engine(store: InMemoryFlowStore, options?: {
9
10
  strictMode?: boolean;
10
11
  }): FlowEngine;
12
+ /** Create a Map<string, unknown> from flowKey-value pairs. */
13
+ static data(...pairs: [FlowKey<unknown>, unknown][]): Map<string, unknown>;
11
14
  static pipeline(name: string): PipelineBuilder;
12
15
  }
@@ -11,6 +11,13 @@ class Tramli {
11
11
  static engine(store, options) {
12
12
  return new flow_engine_js_1.FlowEngine(store, options);
13
13
  }
14
+ /** Create a Map<string, unknown> from flowKey-value pairs. */
15
+ static data(...pairs) {
16
+ const map = new Map();
17
+ for (const [key, value] of pairs)
18
+ map.set(key, value);
19
+ return map;
20
+ }
14
21
  static pipeline(name) {
15
22
  return new pipeline_js_1.PipelineBuilder(name);
16
23
  }
@@ -1,4 +1,5 @@
1
1
  import type { StateConfig } from './types.js';
2
+ import type { FlowKey } from './flow-key.js';
2
3
  import { Builder } from './flow-definition.js';
3
4
  import { FlowEngine } from './flow-engine.js';
4
5
  import type { InMemoryFlowStore } from './in-memory-flow-store.js';
@@ -8,5 +9,7 @@ export declare class Tramli {
8
9
  static engine(store: InMemoryFlowStore, options?: {
9
10
  strictMode?: boolean;
10
11
  }): FlowEngine;
12
+ /** Create a Map<string, unknown> from flowKey-value pairs. */
13
+ static data(...pairs: [FlowKey<unknown>, unknown][]): Map<string, unknown>;
11
14
  static pipeline(name: string): PipelineBuilder;
12
15
  }
@@ -8,6 +8,13 @@ export class Tramli {
8
8
  static engine(store, options) {
9
9
  return new FlowEngine(store, options);
10
10
  }
11
+ /** Create a Map<string, unknown> from flowKey-value pairs. */
12
+ static data(...pairs) {
13
+ const map = new Map();
14
+ for (const [key, value] of pairs)
15
+ map.set(key, value);
16
+ return map;
17
+ }
11
18
  static pipeline(name) {
12
19
  return new PipelineBuilder(name);
13
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unlaxer/tramli",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Constrained flow engine — state machines that prevent invalid transitions at build time",
5
5
  "type": "module",
6
6
  "exports": {