nanoeffects 0.28.0 → 0.29.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.
Files changed (76) hide show
  1. package/dist/{action-creator-CcAEvUnw.d.ts → action-creator-jeEqIKgK.d.ts} +34 -32
  2. package/dist/actions.d.ts +18 -18
  3. package/dist/actions.js +1 -1
  4. package/dist/bus-0uYn_kRj.js +1 -0
  5. package/dist/context-DtUnzC-1.js +1 -0
  6. package/dist/context-types-Bme1mzkn.d.ts +31 -0
  7. package/dist/context.d.ts +8 -3
  8. package/dist/context.js +1 -1
  9. package/dist/{delay-18LJ8jSk.js → delay-5OhJZZQ0.js} +1 -1
  10. package/dist/dev.d.ts +2 -2
  11. package/dist/effects.d.ts +2 -2
  12. package/dist/effects.js +1 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +1 -1
  15. package/dist/match.d.ts +3 -3
  16. package/dist/match.js +1 -1
  17. package/dist/{module-C_oEXw1n.d.ts → module-BWMW83qk.d.ts} +38 -38
  18. package/dist/notrace/{action-creator-DxOvVo8I.d.ts → action-creator-xpQ_I2h8.d.ts} +34 -32
  19. package/dist/notrace/actions.d.ts +52 -52
  20. package/dist/notrace/actions.js +1 -1
  21. package/dist/notrace/{bus-DmKn4SDD.js → bus-37nlVljc.js} +1 -1
  22. package/dist/notrace/effects.d.ts +2 -2
  23. package/dist/notrace/index.d.ts +2 -2
  24. package/dist/notrace/index.js +1 -1
  25. package/dist/notrace/{plugin-lJjjd-SN.d.ts → plugin-6LhNx0th.d.ts} +1 -1
  26. package/dist/notrace/policies.d.ts +1 -1
  27. package/dist/notrace/redux.d.ts +1 -1
  28. package/dist/observable.d.ts +43 -1
  29. package/dist/observable.js +1 -1
  30. package/dist/onAbort-BgMfspK4.js +1 -0
  31. package/dist/oop.d.ts +3 -3
  32. package/dist/oop.js +1 -1
  33. package/dist/{plugin-CuvIgjnX.d.ts → plugin-BaErevLy.d.ts} +2 -2
  34. package/dist/policies.d.ts +2 -2
  35. package/dist/policies.js +1 -1
  36. package/dist/react.d.ts +2 -2
  37. package/dist/react.js +1 -1
  38. package/dist/redux.d.ts +1 -1
  39. package/dist/scope.d.ts +9 -9
  40. package/dist/signal-field-key-CWT-3OXC.js +1 -0
  41. package/dist/signal.d.ts +34 -6
  42. package/dist/signal.js +1 -1
  43. package/dist/svelte.d.ts +1 -1
  44. package/dist/trace.d.ts +20 -5
  45. package/dist/trace.js +1 -1
  46. package/dist/{types-FV8fuvI9.d.ts → types-D5xsR37j.d.ts} +2 -2
  47. package/dist/vue.d.ts +1 -1
  48. package/dist/{with-policy-3bhFLEXs.d.ts → with-policy-BZVRBUOm.d.ts} +1 -1
  49. package/dist/{with-policy-D-SQRkPh.js → with-policy-C6BIiPIi.js} +1 -1
  50. package/docs/README.md +13 -1
  51. package/docs/actions.md +27 -1
  52. package/docs/chat-example.md +12 -0
  53. package/docs/chat-widget.md +7 -7
  54. package/docs/context.md +33 -1
  55. package/docs/effects.md +20 -9
  56. package/docs/guide.md +20 -2
  57. package/docs/migrating-from-effector.md +11 -0
  58. package/docs/observable.md +43 -0
  59. package/docs/oop.md +17 -0
  60. package/docs/package.md +22 -13
  61. package/docs/plugins.md +69 -11
  62. package/docs/query-libraries.md +273 -5
  63. package/docs/react.md +12 -2
  64. package/docs/scope.md +14 -2
  65. package/docs/semantics.md +10 -0
  66. package/docs/server.md +3 -3
  67. package/docs/stability.md +2 -2
  68. package/docs/tracing.md +74 -6
  69. package/docs/typescript.md +1 -1
  70. package/llms-full.txt +671 -66
  71. package/llms.txt +7 -7
  72. package/package.json +4 -4
  73. package/skills/nanoeffects/SKILL.md +2 -2
  74. package/dist/bus-DlpEluzd.js +0 -1
  75. package/dist/context-UcmrAIhP.js +0 -1
  76. package/dist/context-types-hCKgU8sC.d.ts +0 -14
@@ -1,10 +1,10 @@
1
- import { G as PayloadOf, H as EventMap, R as commandCall, S as Context, Z as UnsubscribeCallback, b as Command, c as Scope, g as Actions, q as Task, u as WithScope, v as Bus, x as CommandCall } from "./action-creator-CcAEvUnw.js";
2
- import { n as ScopeSlots, r as Scoped } from "./types-FV8fuvI9.js";
3
- //#region src/actions/command.d.ts
4
- /** What `createCommand` returns: a command that also tells whether an action is of its type. */
5
- type MadeCommand<P, R, T extends string> = Command<P, R> & {
1
+ import { A as HandledCall, G as PayloadOf, H as EventMap, Z as UnsubscribeCallback, b as Context, c as Scope, g as Actions, k as Handled, q as Task, u as WithScope, v as Bus, z as handledCall } from "./action-creator-jeEqIKgK.js";
2
+ import { n as ScopeSlots, r as Scoped } from "./types-D5xsR37j.js";
3
+ //#region src/actions/handled.d.ts
4
+ /** What `createAction` returns: an action that also tells whether an action is of its type. */
5
+ type MadeHandled<P, R, T extends string> = Handled<P, R> & {
6
6
  readonly type: T;
7
- /** Tells whether an action has the type of this command, and narrows its type. */
7
+ /** Tells whether an action has the type of this action, and narrows its type. */
8
8
  match(action: {
9
9
  type: string;
10
10
  payload?: unknown;
@@ -14,14 +14,14 @@ type MadeCommand<P, R, T extends string> = Command<P, R> & {
14
14
  };
15
15
  };
16
16
  /** `Made`, called so that its calls carry the scope fields `F`; `Made` itself when there are none. */
17
- type CarryingCalls<Made, P, R, F> = [unknown] extends [F] ? Made : ((payload: P) => CommandCall<P, R> & WithScope<F>) & Made & WithScope<F>;
18
- /** A command made with a scope: its calls carry the fields of that scope, for the checker. */
19
- type ScopedCommand<P, R, T extends string, F> = ((payload: P) => CommandCall<P, R> & WithScope<F>) & MadeCommand<P, R, T> & WithScope<F>;
20
- /** A command (or its type) with the handler to bind to it; `setHandler` makes one. */
21
- type Binding<E extends EventMap = EventMap> = readonly [Command<never, unknown> | string, Task<never, E, unknown>];
17
+ type CarryingCalls<Made, P, R, F> = [unknown] extends [F] ? Made : ((payload: P) => HandledCall<P, R> & WithScope<F>) & Made & WithScope<F>;
18
+ /** An action made with a scope: its calls carry the fields of that scope, for the checker. */
19
+ type ScopedHandled<P, R, T extends string, F> = ((payload: P) => HandledCall<P, R> & WithScope<F>) & MadeHandled<P, R, T> & WithScope<F>;
20
+ /** An action (or its type) with the handler to bind to it; `setHandler` makes one. */
21
+ type Binding<E extends EventMap = EventMap> = readonly [Handled<never, unknown> | string, Task<never, E, unknown>];
22
22
  /**
23
23
  * Pairs an action with the handler to bind to it, for `actionsPlugin`. For a
24
- * command (an action made with a handler, or with a `Call` type) it checks that
24
+ * action (an action made with a handler, or with a `Call` type) it checks that
25
25
  * the handler fits; any other action is accepted with a handler of any payload.
26
26
  *
27
27
  * @example
@@ -29,21 +29,21 @@ type Binding<E extends EventMap = EventMap> = readonly [Command<never, unknown>
29
29
  * bus.use(actionsPlugin([setHandler(sendMail, smtpSend)]));
30
30
  * ```
31
31
  */
32
- declare function setHandler<P, R, E extends EventMap>(command: Command<P, R>, fn: Task<P, E, R>): Binding<E>;
32
+ declare function setHandler<P, R, E extends EventMap>(handled: Handled<P, R>, fn: Task<P, E, R>): Binding<E>;
33
33
  declare function setHandler<A extends {
34
34
  readonly type: string;
35
35
  }, E extends EventMap>(action: A, fn: LooseHandler<A, E>): Binding<E>;
36
36
  /**
37
- * The handler an action that is not a command can have: any. A command
38
- * (a creator whose calls are command calls) is not accepted here, so its own
37
+ * The handler an action that is not an action can have: any. An action
38
+ * (a creator whose calls are calls of an action with a handler) is not accepted here, so its own
39
39
  * overload checks the handler against its payload and result.
40
40
  */
41
41
  type LooseHandler<A, E extends EventMap> = A extends ((...args: never[]) => {
42
- readonly [commandCall]: unknown;
42
+ readonly [handledCall]: unknown;
43
43
  }) ? never : Task<never, E, unknown>;
44
44
  /** The registry of handlers that `actionsPlugin` returns: `run` for the bus, `handle` to bind more. */
45
45
  interface Registry$1<E extends EventMap> extends Actions {
46
- handle<P, R>(command: Command<P, R>, fn: Task<P, E, R>): UnsubscribeCallback;
46
+ handle<P, R>(handled: Handled<P, R>, fn: Task<P, E, R>): UnsubscribeCallback;
47
47
  /** Also an action made without a handler: what is emitted for its type runs `fn` and returns its result. */
48
48
  handle<A extends {
49
49
  readonly type: string;
@@ -52,25 +52,25 @@ interface Registry$1<E extends EventMap> extends Actions {
52
52
  handle(bindings: readonly Binding<E>[]): UnsubscribeCallback;
53
53
  }
54
54
  /**
55
- * The plugin that gives a bus the handlers bound to commands:
55
+ * The plugin that gives a bus the handlers bound to actions:
56
56
  * `bus.use(actionsPlugin(bindings))` makes the registry, sets it as the
57
- * commands of the bus and returns it. Each bus has its own, so each test can
57
+ * actions of the bus and returns it. Each bus has its own, so each test can
58
58
  * have its own implementation. `handle` binds more later and returns the
59
59
  * function that unbinds. A second `actionsPlugin` on the same bus binds its
60
60
  * list in the registry that is there and returns it, so the order of the
61
- * plugins does not matter. A `commands` that is not such a registry (a custom
61
+ * plugins does not matter. A `actions` that is not such a registry (a custom
62
62
  * runner) is replaced.
63
63
  *
64
- * What the bus runs for a command: the handler bound last, else the one the
65
- * command was created with, else it throws `No handler for command "..."`.
64
+ * What the bus runs for an action: the handler bound last, else the one the
65
+ * action was created with, else it throws `No handler for action "..."`.
66
66
  *
67
67
  * @example
68
68
  * ```ts
69
69
  * const bus = createBus<Events>();
70
- * const commands = bus.use(actionsPlugin([setHandler(sendMail, smtpSend)]));
70
+ * const actions = bus.use(actionsPlugin([setHandler(sendMail, smtpSend)]));
71
71
  *
72
- * const unbind = commands.handle(getUser, async () => fakeUser);
73
- * unbind(); // the command's own handler is back
72
+ * const unbind = actions.handle(getUser, async () => fakeUser);
73
+ * unbind(); // the action's own handler is back
74
74
  * ```
75
75
  */
76
76
  declare const actionsPlugin: <E extends EventMap>(bindings?: readonly Binding<E>[]) => (bus: Bus<E>) => Registry$1<E>;
@@ -78,23 +78,23 @@ declare const actionsPlugin: <E extends EventMap>(bindings?: readonly Binding<E>
78
78
  //#region src/actions/module.d.ts
79
79
  /**
80
80
  * What a module's `setup` gets: the context of the module's task, so `on`,
81
- * `emit` and `run` work as in a handler, plus `handle` to bind commands, `use`
81
+ * `emit` and `run` work as in a handler, plus `handle` to bind actions, `use`
82
82
  * to mount sub-modules and `spawn` to start a background task. Everything the
83
83
  * module does is undone when it is unmounted.
84
84
  */
85
85
  type ModuleContext<E extends EventMap = EventMap> = Context<E> & {
86
- /** Binds the handler of a command, or a list of them; undone on unmount. */
87
- handle<P, R>(command: Command<P, R>, fn: Task<P, E, R>): UnsubscribeCallback;
88
- /** Also an action made without a handler: the handler answers it as it would a command. */
86
+ /** Binds the handler of an action, or a list of them; undone on unmount. */
87
+ handle<P, R>(handled: Handled<P, R>, fn: Task<P, E, R>): UnsubscribeCallback;
88
+ /** Also an action made without a handler: the handler answers it as it would one made with a handler. */
89
89
  handle<A extends {
90
90
  readonly type: string;
91
91
  }>(action: A, fn: LooseHandler<A, E>): UnsubscribeCallback;
92
92
  handle(type: string, fn: Task<never, E, unknown>): UnsubscribeCallback;
93
93
  handle(bindings: readonly Binding<E>[]): UnsubscribeCallback;
94
94
  /**
95
- * Brings sub-modules and commands, in any order. A sub-module is mounted and
96
- * unmounted with this one. A command is bound to the handler it carries, for
97
- * as long as this module is mounted; a command that answers by itself keeps
95
+ * Brings sub-modules and actions, in any order. A sub-module is mounted and
96
+ * unmounted with this one. An action is bound to the handler it carries, for
97
+ * as long as this module is mounted; an action that answers by itself keeps
98
98
  * answering after the module is gone, since the handler is its own. The
99
99
  * returned function undoes just this call, e.g. for what was added later from
100
100
  * a listener.
@@ -116,7 +116,7 @@ type Module<E extends EventMap = EventMap> = {
116
116
  readonly scope?: Scope;
117
117
  };
118
118
  /**
119
- * Describes one domain of an app: the commands it handles, the events it
119
+ * Describes one domain of an app: the actions it handles, the events it
120
120
  * listens to, its sub-modules and its background tasks. The `name` shows up as
121
121
  * the type of the module's tasks in the trace.
122
122
  *
@@ -158,7 +158,7 @@ interface WithApp {
158
158
  }
159
159
  /** What `modulePlugin` returns. */
160
160
  type ModuleApi<E extends EventMap = EventMap> = {
161
- /** The registry of command handlers of the bus: the one it was made with, or the app's own. */
161
+ /** The registry of action handlers of the bus: the one it was made with, or the app's own. */
162
162
  actions: Registry<E>;
163
163
  /**
164
164
  * Mounts modules, in the order given, and returns the function that unmounts them, last
@@ -187,17 +187,17 @@ type ModuleApi<E extends EventMap = EventMap> = {
187
187
  * of one of its methods. By then every plugin is on the bus, so the plugins can
188
188
  * be used in any order. The `on`, `once` and `off` calls made in between are
189
189
  * held and made right after the modules, so the listeners of a module stay
190
- * ahead of them. The bus runs the commands that the modules bind: the registry
190
+ * ahead of them. The bus runs the actions that the modules bind: the registry
191
191
  * that the bus has is used (a later `actionsPlugin` binds in it), otherwise the
192
192
  * app attaches its own, as `app.actions`. The app is also `bus.app`.
193
193
  *
194
194
  * A module is known by its `name`: mounting a module whose name is taken
195
195
  * replaces the mounted one, which is unmounted first. That is what hot reload
196
196
  * needs (see `docs/hmr.md`): the new version of a module file mounts again and
197
- * the old version goes away with its subscriptions, commands and tasks.
197
+ * the old version goes away with its subscriptions, actions and tasks.
198
198
  *
199
199
  * Unmounting undoes everything the module did: its subscriptions, its bound
200
- * commands, its sub-modules and its background tasks. `dispose` unmounts them
200
+ * actions, its sub-modules and its background tasks. `dispose` unmounts them
201
201
  * all, and a disposed app cannot mount modules.
202
202
  *
203
203
  * @example
@@ -220,4 +220,4 @@ type ModuleApi<E extends EventMap = EventMap> = {
220
220
  */
221
221
  declare const modulePlugin: <E extends EventMap>(modules?: readonly Module<E>[]) => (bus: Bus<E> & ScopeSlots & WithApp) => ModuleApi<E>;
222
222
  //#endregion
223
- export { createModule as a, CarryingCalls as c, actionsPlugin as d, setHandler as f, WithApp as i, MadeCommand as l, ModuleApi as n, modulePlugin as o, ModuleContext as r, Binding as s, Module as t, ScopedCommand as u };
223
+ export { createModule as a, CarryingCalls as c, actionsPlugin as d, setHandler as f, WithApp as i, MadeHandled as l, ModuleApi as n, modulePlugin as o, ModuleContext as r, Binding as s, Module as t, ScopedHandled as u };
@@ -1,14 +1,16 @@
1
1
  //#region src/core/types.d.ts
2
- /** The third argument of `on` and `once`: read by `tracePlugin`, ignored without it. */
2
+ /** The third argument of `on` and `once`: each field is read by the plugin that names it, ignored without it. */
3
3
  type ListenerOptions = {
4
- /** Names the listener in the trace: each call of it is a task with this `type`. */
4
+ /** Names the listener in the trace: each call of it is a task with this `type`. Read by `tracePlugin`. */
5
5
  traceId?: string;
6
+ /** Removes the listener when this aborts, and adds none if it aborted already. Read by `signalPlugin`. */
7
+ signal?: AbortSignal;
6
8
  };
7
9
  type PayloadOf<P> = undefined extends P ? [payload?: P] : [payload: P];
8
10
  type EventMap = Record<string, unknown>;
9
11
  type Keys<E> = keyof E & string;
10
12
  type Task<P, E extends EventMap, R = unknown> = (payload: P, ctx: Context<E>) => R;
11
- type EffectName = "every" | "latest" | "leading" | "debounce" | "throttle" | "run" | "all" | "race" | "retry" | "timeout" | "poll" | "take" | "queue" | "allSettled" | "command" | "emit";
13
+ type EffectName = "every" | "latest" | "leading" | "debounce" | "throttle" | "run" | "all" | "race" | "retry" | "timeout" | "poll" | "take" | "queue" | "allSettled" | "action" | "emit";
12
14
  type Phase = "start" | "done" | "error" | "cancel" | "drop";
13
15
  type UnsubscribeCallback = () => void;
14
16
  //#endregion
@@ -98,27 +100,27 @@ type Action<E extends EventMap> = {
98
100
  };
99
101
  type EventLike<E extends EventMap> = { [K in EventKey<E>]: WithPayload<E, K>; }[Keys<E>];
100
102
  /**
101
- * Brands `{ type, payload }` from a command call so `emit` can run the command.
103
+ * Brands `{ type, payload }` from a call of an action with a handler so `emit` can run the action.
102
104
  * Not enumerable on the object.
103
105
  */
104
- declare const commandCall: unique symbol;
106
+ declare const handledCall: unique symbol;
105
107
  /**
106
- * What `command(payload)` returns: an action-shaped value that `emit` runs as
107
- * that command. A plain `{ type, payload }` without this brand is notify-only.
108
+ * What `action(payload)` returns: an action-shaped value that `emit` runs as
109
+ * that action. A plain `{ type, payload }` without this brand is notify-only.
108
110
  */
109
- type CommandCall<P = unknown, R = unknown> = {
111
+ type HandledCall<P = unknown, R = unknown> = {
110
112
  type: string;
111
113
  payload: P;
112
- readonly [commandCall]: Command<P, R>;
114
+ readonly [handledCall]: Handled<P, R>;
113
115
  };
114
116
  /**
115
117
  * A typed request for a result. Calling it builds `{ type, payload }` like
116
- * `createAction`; `bus.emit(command(payload))` (or `bus.emit(command, payload)`)
118
+ * `createAction`; `bus.emit(action(payload))` (or `bus.emit(action, payload)`)
117
119
  * runs the handler as a task and returns what it returns. Made by
118
- * `createCommand` in `nanoeffects/actions`.
120
+ * `createAction` in `nanoeffects/actions`.
119
121
  */
120
- type Command<P = never, R = unknown> = {
121
- (payload: P): CommandCall<P, R>;
122
+ type Handled<P = never, R = unknown> = {
123
+ (payload: P): HandledCall<P, R>;
122
124
  readonly type: string;
123
125
  /** Wraps the handler that really runs, e.g. to route its outcome. */
124
126
  readonly wrap?: (run: (payload: never, ctx: never) => unknown) => (payload: never, ctx: never) => unknown;
@@ -128,15 +130,15 @@ type Command<P = never, R = unknown> = {
128
130
  * `actionsPlugin` in `nanoeffects/actions`, holds the handlers bound to
129
131
  * actions and runs the right one, so a bus without `actions` carries none of
130
132
  * that. `bound` tells, for an event type, whether a handler is bound to it: an
131
- * action with no handler of its own is a command only then. A runner that has
132
- * no `bound` runs commands only.
133
+ * action with no handler of its own is an action only then. A runner that has
134
+ * no `bound` runs actions only.
133
135
  */
134
136
  interface Actions {
135
- run(command: Command, payload: unknown, ctx: unknown): unknown;
136
- bound?(type: string): Command | undefined;
137
+ run(handled: Handled, payload: unknown, ctx: unknown): unknown;
138
+ bound?(type: string): Handled | undefined;
137
139
  }
138
- /** Anything `emit` takes as its first argument: an event type, an action or a command. */
139
- type Emittable<E extends EventMap> = EventKey<E> | Command | CommandCall | EventLike<E>;
140
+ /** Anything `emit` takes as its first argument: an event type, an action creator or a call of one. */
141
+ type Emittable<E extends EventMap> = EventKey<E> | Handled | HandledCall | EventLike<E>;
140
142
  type Emit<E extends EventMap> = {
141
143
  /**
142
144
  * On a bus without an event map the caller can say what a handler bound for
@@ -145,11 +147,11 @@ type Emit<E extends EventMap> = {
145
147
  */
146
148
  <R = void>(type: string extends EventKey<E> ? string : never, ...payload: unknown[]): R;
147
149
  <K extends EventKey<E>>(event: K, ...payload: PayloadOf<DataOf<E[K]>>): ResultOf<E[K]>;
148
- /** Before Handler: a command is callable too, and must return its result type. */
149
- <P, R>(command: Command<P, R>, ...payload: PayloadOf<P>): R;
150
+ /** Before Handler: an action is callable too, and must return its result type. */
151
+ <P, R>(handled: Handled<P, R>, ...payload: PayloadOf<P>): R;
150
152
  /** A scope as the second argument replaces context fields for the tasks of this emit; see `scopePlugin`. */
151
- <P, R, F>(call: CommandCall<P, R> & WithScope<F>, scope?: EmitScope<E, F>): R;
152
- <P, R>(call: CommandCall<P, R>, scope?: EmitScope<E>): R;
153
+ <P, R, F>(call: HandledCall<P, R> & WithScope<F>, scope?: EmitScope<E, F>): R;
154
+ <P, R>(call: HandledCall<P, R>, scope?: EmitScope<E>): R;
153
155
  <K extends EventKey<E>, R>(event: Handler<E, R, K>, ...payload: PayloadOf<DataOf<E[K]>>): R;
154
156
  <F>(event: EventLike<E> & WithScope<F>, scope?: EmitScope<E, F>): void;
155
157
  (event: EventLike<E>, scope?: EmitScope<E>): void;
@@ -158,15 +160,15 @@ type On<E extends EventMap> = {
158
160
  (event: AnyEvent, fn: Task<EventPayload<E>, E>, options?: ListenerOptions): UnsubscribeCallback;
159
161
  <K extends EventKey<E>>(event: K, fn: Task<DataOf<E[K]>, E>, options?: ListenerOptions): UnsubscribeCallback;
160
162
  /** An action creator without a payload type: the payload comes from the event map. */
161
- /** The creators and commands that carry a scope come first: the handler sees their fields. */
163
+ /** The creators and actions that carry a scope come first: the handler sees their fields. */
162
164
  <K extends EventKey<E>, F>(creator: FreeActionCreator<K, F> & WithScope<F>, fn: Task<DataOf<E[K]>, WithFields<E, F>>, options?: ListenerOptions): UnsubscribeCallback;
163
165
  <P, F>(creator: ActionCreator<P, string, PayloadOf<P>, F> & WithScope<F>, fn: Task<P, WithFields<E, F>>, options?: ListenerOptions): UnsubscribeCallback;
164
- <P, F>(command: Command<P, unknown> & WithScope<F>, fn: Task<P, WithFields<E, F>>, options?: ListenerOptions): UnsubscribeCallback;
166
+ <P, F>(handled: Handled<P, unknown> & WithScope<F>, fn: Task<P, WithFields<E, F>>, options?: ListenerOptions): UnsubscribeCallback;
165
167
  <K extends EventKey<E>>(creator: FreeActionCreator<K>, fn: Task<DataOf<E[K]>, E>, options?: ListenerOptions): UnsubscribeCallback;
166
168
  /** An action creator: the payload comes from it, so an event map is not needed. */
167
169
  <P>(creator: ActionCreator<P>, fn: Task<P, E>, options?: ListenerOptions): UnsubscribeCallback;
168
- /** A command: the payload comes from it too. */
169
- <P>(command: Command<P, unknown>, fn: Task<P, E>, options?: ListenerOptions): UnsubscribeCallback;
170
+ /** An action: the payload comes from it too. */
171
+ <P>(handled: Handled<P, unknown>, fn: Task<P, E>, options?: ListenerOptions): UnsubscribeCallback;
170
172
  <K extends EventKey<E>, Event extends {
171
173
  type: K;
172
174
  }>(event: Event & {
@@ -185,7 +187,7 @@ type Off<E extends EventMap> = {
185
187
  }>(event: Event & {
186
188
  type: K;
187
189
  }, fn: Task<DataOf<E[K]>, E>): void;
188
- <P>(command: Command<P, unknown>, fn?: Task<P, E>): void;
190
+ <P>(handled: Handled<P, unknown>, fn?: Task<P, E>): void;
189
191
  };
190
192
  declare const contextKey: unique symbol;
191
193
  /**
@@ -275,7 +277,7 @@ interface Bus<E extends EventMap> {
275
277
  use<R>(plugin: (bus: Bus<E>) => R): R;
276
278
  /** `BusOptions.context` and `.trace`, and `actions`, for what makes tasks of its own, like `modulePlugin`. */
277
279
  readonly ctx?: ContextOption<E> | undefined;
278
- /** What runs the handlers of actions; `actionsPlugin` and `modulePlugin` set it. Without one a command runs its own handler. */
280
+ /** What runs the handlers of actions; `actionsPlugin` and `modulePlugin` set it. Without one an action runs its own handler. */
279
281
  actions?: Actions | undefined;
280
282
  readonly trace?: Tracer | undefined;
281
283
  /** Called with every new task context to add fields to it, for what needs the task, like `effectsPlugin`. Chain to the previous one. */
@@ -294,7 +296,7 @@ type BusOptions<E extends EventMap> = {
294
296
  onError?: (error: unknown, event: Action<E>) => void;
295
297
  /**
296
298
  * Called when an event is emitted and nobody listens to it: the usual sign
297
- * of a typo in an event name. Not called for commands, nor for an action with
299
+ * of a typo in an event name. Not called for actions, nor for an action with
298
300
  * a handler bound in `actions`, which always have a handler to run. Typically a warning in development only.
299
301
  *
300
302
  * @example
@@ -345,7 +347,7 @@ type BoundForm<F> = typeof bound extends keyof F ? NonNullable<F[typeof bound &
345
347
  //#endregion
346
348
  //#region src/core/scope-types.d.ts
347
349
  declare const scopeFields: unique symbol;
348
- /** What an action creator, a command or a call knows of the scope it was made with: its fields, for the checker. */
350
+ /** What an action creator or a call knows of the scope it was made with: its fields, for the checker. */
349
351
  type WithScope<F> = {
350
352
  readonly [scopeFields]: F;
351
353
  };
@@ -454,4 +456,4 @@ interface ActionCreator<P = void, T extends string = string, A extends unknown[]
454
456
  toString(): T;
455
457
  }
456
458
  //#endregion
457
- export { Off as A, Task as B, Emittable as C, EventsOf as D, EventPayload as E, commandCall as F, createBus as I, EventMap as L, WithContext as M, WithSignal as N, Handler as O, WithType as P, Keys as R, Emit as S, EventLike as T, UnsubscribeCallback as V, Command as _, WithPayload as a, ContextOf as b, WithScope as c, Effects as d, Action as f, BusOptions as g, Bus as h, FreeActionCreator as i, On as j, HandlerRef as k, BoundForm as l, AnyEvent as m, Call as n, Scope as o, Actions as p, Free as r, WithFields as s, ActionCreator as t, Effect as u, CommandCall as v, EventKey as w, ContextOption as x, Context as y, PayloadOf as z };
459
+ export { Off as A, Task as B, EventLike as C, HandledCall as D, Handled as E, createBus as F, handledCall as I, EventMap as L, WithContext as M, WithSignal as N, Handler as O, WithType as P, Keys as R, EventKey as S, EventsOf as T, UnsubscribeCallback as V, Context as _, WithPayload as a, Emit as b, WithScope as c, Effects as d, Action as f, BusOptions as g, Bus as h, FreeActionCreator as i, On as j, HandlerRef as k, BoundForm as l, AnyEvent as m, Call as n, Scope as o, Actions as p, Free as r, WithFields as s, ActionCreator as t, Effect as u, ContextOf as v, EventPayload as w, Emittable as x, ContextOption as y, PayloadOf as z };
@@ -1,5 +1,5 @@
1
- import { B as Task, F as commandCall, L as EventMap, V as UnsubscribeCallback, _ as Command, c as WithScope, d as Effects, h as Bus, i as FreeActionCreator, n as Call, o as Scope, p as Actions, r as Free, s as WithFields, t as ActionCreator, v as CommandCall, w as EventKey, y as Context, z as PayloadOf } from "./action-creator-DxOvVo8I.js";
2
- import { t as BoundOf } from "./plugin-lJjjd-SN.js";
1
+ import { B as Task, D as HandledCall, E as Handled, I as handledCall, L as EventMap, S as EventKey, V as UnsubscribeCallback, _ as Context, c as WithScope, d as Effects, h as Bus, i as FreeActionCreator, n as Call, o as Scope, p as Actions, r as Free, s as WithFields, t as ActionCreator, z as PayloadOf } from "./action-creator-xpQ_I2h8.js";
2
+ import { t as BoundOf } from "./plugin-6LhNx0th.js";
3
3
  import { t as OriginOptions } from "./origin-key-CxK0SkeG.js";
4
4
  //#region src/scope/types.d.ts
5
5
  /**
@@ -23,11 +23,11 @@ type FieldsOfScope<E extends EventMap, S extends Scope> = [keyof S] extends [nev
23
23
  */
24
24
  type Scoped<E extends EventMap, S extends Scope> = WithFields<E, FieldsOfScope<E, S>>;
25
25
  //#endregion
26
- //#region src/actions/command.d.ts
27
- /** What `createCommand` returns: a command that also tells whether an action is of its type. */
28
- type MadeCommand<P, R, T extends string> = Command<P, R> & {
26
+ //#region src/actions/handled.d.ts
27
+ /** What `createAction` returns: an action that also tells whether an action is of its type. */
28
+ type MadeHandled<P, R, T extends string> = Handled<P, R> & {
29
29
  readonly type: T;
30
- /** Tells whether an action has the type of this command, and narrows its type. */
30
+ /** Tells whether an action has the type of this action, and narrows its type. */
31
31
  match(action: {
32
32
  type: string;
33
33
  payload?: unknown;
@@ -37,14 +37,14 @@ type MadeCommand<P, R, T extends string> = Command<P, R> & {
37
37
  };
38
38
  };
39
39
  /** `Made`, called so that its calls carry the scope fields `F`; `Made` itself when there are none. */
40
- type CarryingCalls<Made, P, R, F> = [unknown] extends [F] ? Made : ((payload: P) => CommandCall<P, R> & WithScope<F>) & Made & WithScope<F>;
41
- /** A command made with a scope: its calls carry the fields of that scope, for the checker. */
42
- type ScopedCommand<P, R, T extends string, F> = ((payload: P) => CommandCall<P, R> & WithScope<F>) & MadeCommand<P, R, T> & WithScope<F>;
43
- /** A command (or its type) with the handler to bind to it; `setHandler` makes one. */
44
- type Binding<E extends EventMap = EventMap> = readonly [Command<never, unknown> | string, Task<never, E, unknown>];
40
+ type CarryingCalls<Made, P, R, F> = [unknown] extends [F] ? Made : ((payload: P) => HandledCall<P, R> & WithScope<F>) & Made & WithScope<F>;
41
+ /** An action made with a scope: its calls carry the fields of that scope, for the checker. */
42
+ type ScopedHandled<P, R, T extends string, F> = ((payload: P) => HandledCall<P, R> & WithScope<F>) & MadeHandled<P, R, T> & WithScope<F>;
43
+ /** An action (or its type) with the handler to bind to it; `setHandler` makes one. */
44
+ type Binding<E extends EventMap = EventMap> = readonly [Handled<never, unknown> | string, Task<never, E, unknown>];
45
45
  /**
46
46
  * Pairs an action with the handler to bind to it, for `actionsPlugin`. For a
47
- * command (an action made with a handler, or with a `Call` type) it checks that
47
+ * action (an action made with a handler, or with a `Call` type) it checks that
48
48
  * the handler fits; any other action is accepted with a handler of any payload.
49
49
  *
50
50
  * @example
@@ -52,21 +52,21 @@ type Binding<E extends EventMap = EventMap> = readonly [Command<never, unknown>
52
52
  * bus.use(actionsPlugin([setHandler(sendMail, smtpSend)]));
53
53
  * ```
54
54
  */
55
- export declare function setHandler<P, R, E extends EventMap>(command: Command<P, R>, fn: Task<P, E, R>): Binding<E>;
55
+ export declare function setHandler<P, R, E extends EventMap>(handled: Handled<P, R>, fn: Task<P, E, R>): Binding<E>;
56
56
  export declare function setHandler<A extends {
57
57
  readonly type: string;
58
58
  }, E extends EventMap>(action: A, fn: LooseHandler<A, E>): Binding<E>;
59
59
  /**
60
- * The handler an action that is not a command can have: any. A command
61
- * (a creator whose calls are command calls) is not accepted here, so its own
60
+ * The handler an action that is not an action can have: any. An action
61
+ * (a creator whose calls are calls of an action with a handler) is not accepted here, so its own
62
62
  * overload checks the handler against its payload and result.
63
63
  */
64
64
  type LooseHandler<A, E extends EventMap> = A extends ((...args: never[]) => {
65
- readonly [commandCall]: unknown;
65
+ readonly [handledCall]: unknown;
66
66
  }) ? never : Task<never, E, unknown>;
67
67
  /** The registry of handlers that `actionsPlugin` returns: `run` for the bus, `handle` to bind more. */
68
68
  interface Registry$1<E extends EventMap> extends Actions {
69
- handle<P, R>(command: Command<P, R>, fn: Task<P, E, R>): UnsubscribeCallback;
69
+ handle<P, R>(handled: Handled<P, R>, fn: Task<P, E, R>): UnsubscribeCallback;
70
70
  /** Also an action made without a handler: what is emitted for its type runs `fn` and returns its result. */
71
71
  handle<A extends {
72
72
  readonly type: string;
@@ -75,38 +75,38 @@ interface Registry$1<E extends EventMap> extends Actions {
75
75
  handle(bindings: readonly Binding<E>[]): UnsubscribeCallback;
76
76
  }
77
77
  /**
78
- * The plugin that gives a bus the handlers bound to commands:
78
+ * The plugin that gives a bus the handlers bound to actions:
79
79
  * `bus.use(actionsPlugin(bindings))` makes the registry, sets it as the
80
- * commands of the bus and returns it. Each bus has its own, so each test can
80
+ * actions of the bus and returns it. Each bus has its own, so each test can
81
81
  * have its own implementation. `handle` binds more later and returns the
82
82
  * function that unbinds. A second `actionsPlugin` on the same bus binds its
83
83
  * list in the registry that is there and returns it, so the order of the
84
- * plugins does not matter. A `commands` that is not such a registry (a custom
84
+ * plugins does not matter. A `actions` that is not such a registry (a custom
85
85
  * runner) is replaced.
86
86
  *
87
- * What the bus runs for a command: the handler bound last, else the one the
88
- * command was created with, else it throws `No handler for command "..."`.
87
+ * What the bus runs for an action: the handler bound last, else the one the
88
+ * action was created with, else it throws `No handler for action "..."`.
89
89
  *
90
90
  * @example
91
91
  * ```ts
92
92
  * const bus = createBus<Events>();
93
- * const commands = bus.use(actionsPlugin([setHandler(sendMail, smtpSend)]));
93
+ * const actions = bus.use(actionsPlugin([setHandler(sendMail, smtpSend)]));
94
94
  *
95
- * const unbind = commands.handle(getUser, async () => fakeUser);
96
- * unbind(); // the command's own handler is back
95
+ * const unbind = actions.handle(getUser, async () => fakeUser);
96
+ * unbind(); // the action's own handler is back
97
97
  * ```
98
98
  */
99
99
  export declare const actionsPlugin: <E extends EventMap>(bindings?: readonly Binding<E>[]) => (bus: Bus<E>) => Registry$1<E>;
100
100
  //#endregion
101
101
  //#region src/actions/action.d.ts
102
102
  type Reserved = "handle" | "prepare";
103
- type Made<P, T extends string> = [P] extends [Free] ? FreeActionCreator<T> : [P] extends [Call<infer Q, infer R>] ? MadeCommand<Q, R, T> : ActionCreator<P, T>;
103
+ type Made<P, T extends string> = [P] extends [Free] ? FreeActionCreator<T> : [P] extends [Call<infer Q, infer R>] ? MadeHandled<Q, R, T> : ActionCreator<P, T>;
104
104
  type ScopedCreator<P, T extends string, F> = [P] extends [Free] ? FreeActionCreator<T, F> & WithScope<F> : ActionCreator<P, T, PayloadOf<P>, F> & WithScope<F>;
105
105
  type ScopeOf<S> = Omit<S, Reserved>;
106
- type PreparedCommand<P, R, T extends string, A extends unknown[], F> = ((...args: A) => ReturnType<MadeCommand<P, R, T>> & WithScope<F>) & Omit<MadeCommand<P, R, T>, never> & WithScope<F>;
106
+ type PreparedHandled<P, R, T extends string, A extends unknown[], F> = ((...args: A) => ReturnType<MadeHandled<P, R, T>> & WithScope<F>) & Omit<MadeHandled<P, R, T>, never> & WithScope<F>;
107
107
  /**
108
108
  * Creates an action creator, as in Redux Toolkit. With a handler it makes a
109
- * command: `bus.emit(getUser("1"))` runs the handler and returns its result.
109
+ * action: `bus.emit(getUser("1"))` runs the handler and returns its result.
110
110
  *
111
111
  * - `createAction("user/loaded")` needs no generics: the payload type comes
112
112
  * from the event map of the bus that the action goes to, and the literal
@@ -150,22 +150,22 @@ type PreparedCommand<P, R, T extends string, A extends unknown[], F> = ((...args
150
150
  * ```
151
151
  */
152
152
  export declare function createAction<P = Free, T extends string = string>(type: T): Made<P, T>;
153
- export declare function createAction<P = void, R = void, T extends string = string, E extends EventMap = EventMap>(type: T, handler: Task<P, E, R>): MadeCommand<P, R, T>;
153
+ export declare function createAction<P = void, R = void, T extends string = string, E extends EventMap = EventMap>(type: T, handler: Task<P, E, R>): MadeHandled<P, R, T>;
154
154
  export declare function createAction<P, R, A extends unknown[], T extends string, S extends Scope = Record<never, never>>(type: T, handler: Task<P, Scoped<EventMap, ScopeOf<S>>, R>, options: {
155
155
  prepare: (...args: A) => {
156
156
  payload: P;
157
157
  };
158
- } & S): PreparedCommand<P, R, T, A, FieldsOfScope<EventMap, ScopeOf<S>>>;
158
+ } & S): PreparedHandled<P, R, T, A, FieldsOfScope<EventMap, ScopeOf<S>>>;
159
159
  export declare function createAction<P, R, A extends unknown[], T extends string, S extends Scope = Record<never, never>>(type: T, options: {
160
160
  handle: Task<P, Scoped<EventMap, ScopeOf<S>>, R>;
161
161
  prepare: (...args: A) => {
162
162
  payload: P;
163
163
  };
164
- } & S): PreparedCommand<P, R, T, A, FieldsOfScope<EventMap, ScopeOf<S>>>;
165
- export declare function createAction<P, R, T extends string, S extends Scope = Record<never, never>>(type: T, handler: Task<P, Scoped<EventMap, S>, R>, scope: S): ScopedCommand<P, R, T, FieldsOfScope<EventMap, S>>;
164
+ } & S): PreparedHandled<P, R, T, A, FieldsOfScope<EventMap, ScopeOf<S>>>;
165
+ export declare function createAction<P, R, T extends string, S extends Scope = Record<never, never>>(type: T, handler: Task<P, Scoped<EventMap, S>, R>, scope: S): ScopedHandled<P, R, T, FieldsOfScope<EventMap, S>>;
166
166
  export declare function createAction<P, R, T extends string, S extends Scope = Record<never, never>>(type: T, options: {
167
167
  handle: Task<P, Scoped<EventMap, ScopeOf<S>>, R>;
168
- } & S): ScopedCommand<P, R, T, FieldsOfScope<EventMap, ScopeOf<S>>>;
168
+ } & S): ScopedHandled<P, R, T, FieldsOfScope<EventMap, ScopeOf<S>>>;
169
169
  export declare function createAction<A extends unknown[], P, T extends string, S extends Scope = Record<never, never>>(type: T, options: {
170
170
  prepare: (...args: A) => {
171
171
  payload: P;
@@ -223,8 +223,8 @@ type Creator = {
223
223
  readonly type: string;
224
224
  };
225
225
  type Outcome = string | Creator;
226
- /** What `createJob` returns: the command of the job, with its four actions as properties. */
227
- type Job<P, R, T extends string, S extends Outcome, F extends Outcome, PE extends Outcome = `${T}/pending`, CE extends Outcome = `${T}/cancel`> = MadeCommand<P, Promise<Awaited<R> | undefined>, T> & {
226
+ /** What `createJob` returns: the action of the job, with its four outcome creators as properties. */
227
+ type Job<P, R, T extends string, S extends Outcome, F extends Outcome, PE extends Outcome = `${T}/pending`, CE extends Outcome = `${T}/cancel`> = MadeHandled<P, Promise<Awaited<R> | undefined>, T> & {
228
228
  /** Made from a string with the payload of the call as its payload, or the creator that was given. */
229
229
  readonly pending: PE extends string ? ActionCreator<P, PE> : PE;
230
230
  /** Made from a string with the result as its payload, or the creator that was given. */
@@ -235,13 +235,13 @@ type Job<P, R, T extends string, S extends Outcome, F extends Outcome, PE extend
235
235
  readonly cancel: CE extends string ? ActionCreator<unknown, CE> : CE;
236
236
  };
237
237
  /**
238
- * Creates a job: a command whose outcome is sent on as actions. When the
238
+ * Creates a job: an action whose outcome is sent on as actions. When the
239
239
  * handler starts, `job.pending(payload)` is emitted on the bus. When it
240
240
  * succeeds, `job.success(result)` follows, and when it fails, `job.fail(error)`.
241
241
  * When the task is aborted after it started, `job.cancel(reason)` follows
242
242
  * instead. After `pending`, exactly one of the three closes the call. A job is
243
243
  * made for the case where nobody waits for the result and the bus carries it
244
- * on, like `createAsyncThunk` or an effector effect. It returns the command,
244
+ * on, like `createAsyncThunk` or an effector effect. It returns the action,
245
245
  * with the four actions on it.
246
246
  *
247
247
  * A scope as the last argument, `{ cache, $effects: { race } }`, gives the handler
@@ -255,14 +255,14 @@ type Job<P, R, T extends string, S extends Outcome, F extends Outcome, PE extend
255
255
  *
256
256
  * `bus.emit(job(payload))` returns a promise of the result. An error of the
257
257
  * handler always counts as handled: it goes to `job.fail` and the promise
258
- * resolves with `undefined`; a command is the tool for a result that must reject.
258
+ * resolves with `undefined`; an action is the tool for a result that must reject.
259
259
  * The actions are emitted as the task that ran the job, also for a handler bound
260
- * with `commands.handle`. Once the task is aborted, `success` and `fail` are
260
+ * with `actions.handle`. Once the task is aborted, `success` and `fail` are
261
261
  * skipped and `cancel` is sent when the handler settles (a handler that never
262
262
  * settles sends nothing). A call that does not start, because a policy drops it
263
263
  * or it is aborted while it waits in a `queue`, sends none of the four. A
264
264
  * missing handler is not an outcome: `emit` throws `MissingHandlerError`.
265
- * Calling the job builds `{ type, payload }` like a command; it does not run
265
+ * Calling the job builds `{ type, payload }` like an action; it does not run
266
266
  * the handler.
267
267
  *
268
268
  * @example
@@ -293,23 +293,23 @@ scope?: X) => CarryingCalls<Job<P, R, T, S, F, PE, CE>, P, Promise<Awaited<R> |
293
293
  //#region src/actions/module.d.ts
294
294
  /**
295
295
  * What a module's `setup` gets: the context of the module's task, so `on`,
296
- * `emit` and `run` work as in a handler, plus `handle` to bind commands, `use`
296
+ * `emit` and `run` work as in a handler, plus `handle` to bind actions, `use`
297
297
  * to mount sub-modules and `spawn` to start a background task. Everything the
298
298
  * module does is undone when it is unmounted.
299
299
  */
300
300
  type ModuleContext<E extends EventMap = EventMap> = Context<E> & {
301
- /** Binds the handler of a command, or a list of them; undone on unmount. */
302
- handle<P, R>(command: Command<P, R>, fn: Task<P, E, R>): UnsubscribeCallback;
303
- /** Also an action made without a handler: the handler answers it as it would a command. */
301
+ /** Binds the handler of an action, or a list of them; undone on unmount. */
302
+ handle<P, R>(handled: Handled<P, R>, fn: Task<P, E, R>): UnsubscribeCallback;
303
+ /** Also an action made without a handler: the handler answers it as it would one made with a handler. */
304
304
  handle<A extends {
305
305
  readonly type: string;
306
306
  }>(action: A, fn: LooseHandler<A, E>): UnsubscribeCallback;
307
307
  handle(type: string, fn: Task<never, E, unknown>): UnsubscribeCallback;
308
308
  handle(bindings: readonly Binding<E>[]): UnsubscribeCallback;
309
309
  /**
310
- * Brings sub-modules and commands, in any order. A sub-module is mounted and
311
- * unmounted with this one. A command is bound to the handler it carries, for
312
- * as long as this module is mounted; a command that answers by itself keeps
310
+ * Brings sub-modules and actions, in any order. A sub-module is mounted and
311
+ * unmounted with this one. An action is bound to the handler it carries, for
312
+ * as long as this module is mounted; an action that answers by itself keeps
313
313
  * answering after the module is gone, since the handler is its own. The
314
314
  * returned function undoes just this call, e.g. for what was added later from
315
315
  * a listener.
@@ -331,7 +331,7 @@ type Module<E extends EventMap = EventMap> = {
331
331
  readonly scope?: Scope;
332
332
  };
333
333
  /**
334
- * Describes one domain of an app: the commands it handles, the events it
334
+ * Describes one domain of an app: the actions it handles, the events it
335
335
  * listens to, its sub-modules and its background tasks. The `name` shows up as
336
336
  * the type of the module's tasks in the trace.
337
337
  *
@@ -373,7 +373,7 @@ interface WithApp {
373
373
  }
374
374
  /** What `modulePlugin` returns. */
375
375
  type ModuleApi<E extends EventMap = EventMap> = {
376
- /** The registry of command handlers of the bus: the one it was made with, or the app's own. */
376
+ /** The registry of action handlers of the bus: the one it was made with, or the app's own. */
377
377
  actions: Registry<E>;
378
378
  /**
379
379
  * Mounts modules, in the order given, and returns the function that unmounts them, last
@@ -402,17 +402,17 @@ type ModuleApi<E extends EventMap = EventMap> = {
402
402
  * of one of its methods. By then every plugin is on the bus, so the plugins can
403
403
  * be used in any order. The `on`, `once` and `off` calls made in between are
404
404
  * held and made right after the modules, so the listeners of a module stay
405
- * ahead of them. The bus runs the commands that the modules bind: the registry
405
+ * ahead of them. The bus runs the actions that the modules bind: the registry
406
406
  * that the bus has is used (a later `actionsPlugin` binds in it), otherwise the
407
407
  * app attaches its own, as `app.actions`. The app is also `bus.app`.
408
408
  *
409
409
  * A module is known by its `name`: mounting a module whose name is taken
410
410
  * replaces the mounted one, which is unmounted first. That is what hot reload
411
411
  * needs (see `docs/hmr.md`): the new version of a module file mounts again and
412
- * the old version goes away with its subscriptions, commands and tasks.
412
+ * the old version goes away with its subscriptions, actions and tasks.
413
413
  *
414
414
  * Unmounting undoes everything the module did: its subscriptions, its bound
415
- * commands, its sub-modules and its background tasks. `dispose` unmounts them
415
+ * actions, its sub-modules and its background tasks. `dispose` unmounts them
416
416
  * all, and a disposed app cannot mount modules.
417
417
  *
418
418
  * @example