@actor-system/behaviors 0.0.3 → 0.0.5

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.d.ts CHANGED
@@ -6,6 +6,7 @@ export { same } from './same.js';
6
6
  export { setup } from './setup.js';
7
7
  export { stopped } from './stopped.js';
8
8
  export { supervise } from './supervise.js';
9
+ export { unhandled } from './unhandled.js';
9
10
  export { Stash, withStash } from './with-stash.js';
10
11
  export { Timers, withTimers } from './with-timers.js';
11
12
  export { Behavior } from '@actor-system/core';
@@ -6,6 +6,7 @@ export { same } from './same.internal.js';
6
6
  export { setup } from './setup.internal.js';
7
7
  export { stopped } from './stopped.internal.js';
8
8
  export { supervise } from './supervise.internal.js';
9
+ export { unhandled } from './unhandled.internal.js';
9
10
  export { Stash, withStash } from './with-stash.internal.js';
10
11
  export { Timers, withTimers } from './with-timers.internal.js';
11
12
  export { Behavior } from '@actor-system/core/internal';
package/dist/index.js CHANGED
@@ -6,5 +6,6 @@ export { same } from './same.js';
6
6
  export { setup } from './setup.js';
7
7
  export { stopped } from './stopped.js';
8
8
  export { supervise } from './supervise.js';
9
+ export { unhandled } from './unhandled.js';
9
10
  export { withStash } from './with-stash.js';
10
11
  export { withTimers } from './with-timers.js';
package/dist/receive.js CHANGED
@@ -1,18 +1,19 @@
1
1
  import { behavior, signal } from '@actor-system/core';
2
2
  import { same } from './same.js';
3
+ import { unhandled } from './unhandled.js';
3
4
 
4
5
  const receiveMessage = (onMessage) => ({
5
- ...behavior.receive((message, ctx) => !signal.isSignal(message) ? (onMessage(message, ctx) ?? same) : same),
6
+ ...behavior.receive((message, ctx) => !signal.isSignal(message) ? (onMessage(message, ctx) ?? unhandled) : same),
6
7
  receiveSignal: (onSignal) => behavior.receive((message, context) => (!signal.isSignal(message)
7
8
  ? onMessage(message, context)
8
- : onSignal(message, context)) ?? same),
9
+ : onSignal(message, context)) ?? unhandled),
9
10
  });
10
11
  const receiveSignal = (onSignal) => ({
11
- ...behavior.receive((message, ctx) => signal.isSignal(message) ? (onSignal(message, ctx) ?? same) : same),
12
+ ...behavior.receive((message, ctx) => signal.isSignal(message) ? (onSignal(message, ctx) ?? unhandled) : same),
12
13
  receiveMessage: (onMessage) => behavior.receive((message, context) => (signal.isSignal(message)
13
14
  ? onSignal(message, context)
14
- : onMessage(message, context)) ?? same),
15
+ : onMessage(message, context)) ?? unhandled),
15
16
  });
16
- const receive = (handler) => behavior.receive((message, ctx) => handler(message, ctx) ?? same);
17
+ const receive = (handler) => behavior.receive((message, ctx) => handler(message, ctx) ?? unhandled);
17
18
 
18
19
  export { receive, receiveMessage, receiveSignal };
package/dist/restart.js CHANGED
@@ -1,7 +1,10 @@
1
- import { behavior } from '@actor-system/core';
1
+ import { behavior, $type } from '@actor-system/core';
2
2
 
3
- const restart = (checkpoint) => behavior.control((runtime) => {
4
- runtime.restart(checkpoint);
3
+ const restart = (checkpoint) => ({
4
+ [$type]: undefined,
5
+ _tag: behavior.$control,
6
+ _operation: "restart",
7
+ _checkpoint: checkpoint,
5
8
  });
6
9
 
7
10
  export { restart };
package/dist/stopped.js CHANGED
@@ -1,7 +1,9 @@
1
- import { behavior } from '@actor-system/core';
1
+ import { behavior, $type } from '@actor-system/core';
2
2
 
3
- const stopped = behavior.control((runtime) => {
4
- runtime.stopSelf();
5
- });
3
+ const stopped = {
4
+ [$type]: undefined,
5
+ _tag: behavior.$control,
6
+ _operation: "stop",
7
+ };
6
8
 
7
9
  export { stopped };
@@ -0,0 +1,5 @@
1
+ import { behavior } from '@actor-system/core';
2
+
3
+ declare const unhandled: behavior.Control<never>;
4
+
5
+ export { unhandled };
@@ -0,0 +1,5 @@
1
+ import { behavior } from '@actor-system/core/internal';
2
+
3
+ declare const unhandled: behavior.Control<never>;
4
+
5
+ export { unhandled };
@@ -0,0 +1,5 @@
1
+ import { behavior } from '@actor-system/core';
2
+
3
+ const unhandled = behavior._unhandled;
4
+
5
+ export { unhandled };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actor-system/behaviors",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "type-check": "tsc -b src",
@@ -28,7 +28,7 @@
28
28
  "@actor-system/shared"
29
29
  ],
30
30
  "dependencies": {
31
- "@actor-system/core": "0.0.3"
31
+ "@actor-system/core": "0.0.5"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@actor-system/testing": "0.0.2",