@rotorsoft/act 0.10.0 → 0.11.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.
package/dist/index.js CHANGED
@@ -1562,7 +1562,11 @@ function act(states = /* @__PURE__ */ new Map(), registry = {
1562
1562
  }
1563
1563
 
1564
1564
  // src/state-builder.ts
1565
- function state(name, state2) {
1565
+ function state(entry) {
1566
+ const keys = Object.keys(entry);
1567
+ if (keys.length !== 1) throw new Error("state() requires exactly one key");
1568
+ const name = keys[0];
1569
+ const stateSchema = entry[name];
1566
1570
  return {
1567
1571
  init(init) {
1568
1572
  return {
@@ -1572,7 +1576,7 @@ function state(name, state2) {
1572
1576
  return action_builder({
1573
1577
  events,
1574
1578
  actions: {},
1575
- state: state2,
1579
+ state: stateSchema,
1576
1580
  name,
1577
1581
  init,
1578
1582
  patch: patch2,