@typed/fx 1.5.5 → 1.5.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typed/fx",
3
- "version": "1.5.5",
3
+ "version": "1.5.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "@effect/data": "^0.10.3",
23
23
  "@effect/io": "^0.17.0"
24
24
  },
25
- "gitHead": "f70a844aab53243d9e39c57ac737f4e207f9ebb3",
25
+ "gitHead": "ac8f3db6a878fef184ccf0ef88e31100fc6d69e5",
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
@@ -8,7 +8,6 @@ import type { RuntimeFiber } from '@effect/io/Fiber'
8
8
  import type { Scope } from '@effect/io/Scope'
9
9
 
10
10
  import { Fx } from '../Fx.js'
11
- import { asap } from '../_internal/RefCounter.js'
12
11
 
13
12
  export const multicast = <R, E, A>(fx: Fx<R, E, A>): Fx<R, E, A> => new MulticastFx(fx)
14
13
 
@@ -43,7 +42,7 @@ export class MulticastFx<R, E, A>
43
42
  }
44
43
 
45
44
  if (observers.push(observer) === 1) {
46
- that.fiber = yield* $(pipe(fx.run(that), Effect.scheduleForked(asap)))
45
+ that.fiber = yield* $(pipe(fx.run(that), Effect.forkScoped))
47
46
  }
48
47
 
49
48
  yield* $(Deferred.await(deferred))
@@ -7,7 +7,6 @@ import * as Exit from '@effect/io/Exit'
7
7
  import * as Scope from '@effect/io/Scope'
8
8
 
9
9
  import { Fx } from '../Fx.js'
10
- import { asap } from '../_internal/RefCounter.js'
11
10
  import { run } from '../run/run.js'
12
11
 
13
12
  import { tap } from './tap.js'
@@ -55,7 +54,7 @@ class RaceAllFx<Streams extends readonly Fx<any, any, any>[]>
55
54
  s,
56
55
  tap(() => cleanupScopes(i)),
57
56
  run(sink.event, sink.error, sink.end),
58
- Effect.scheduleForked(asap), // Schedule starts so that all Scopes can be returned *before* attempting to cleanup
57
+ Effect.forkScoped, // Schedule starts so that all Scopes can be returned *before* attempting to cleanup
59
58
  Effect.as(scope),
60
59
  Effect.provideService(Scope.Scope, scope),
61
60
  ),
@@ -53,12 +53,23 @@ class SwitchMapFx<R, E, A, R2, E2, B>
53
53
  this.f(a).run(
54
54
  Fx.Sink(
55
55
  sink.event,
56
- flow(sink.error, Effect.zipLeft(resetRef)),
56
+ flow(
57
+ Effect.unified((cause) =>
58
+ Cause.isInterruptedOnly(cause)
59
+ ? counter.decrement
60
+ : sink.error(cause),
61
+ ),
62
+ Effect.zipLeft(resetRef),
63
+ ),
57
64
  pipe(counter.decrement, Effect.zipLeft(resetRef)),
58
65
  ),
59
66
  ),
60
- Effect.onError((cause) =>
61
- Cause.isInterruptedOnly(cause) ? Effect.unit() : sink.error(cause),
67
+ Effect.onError(
68
+ Effect.unified((cause) =>
69
+ Cause.isInterruptedOnly(cause)
70
+ ? counter.decrement
71
+ : sink.error(cause),
72
+ ),
62
73
  ),
63
74
  Effect.forkScoped,
64
75
  ),
@@ -1,5 +1,5 @@
1
1
  import { flow, pipe } from '@effect/data/Function'
2
- import type * as Cause from '@effect/io/Cause'
2
+ import * as Cause from '@effect/io/Cause'
3
3
  import * as Effect from '@effect/io/Effect'
4
4
  import * as Fiber from '@effect/io/Fiber'
5
5
  import * as Ref from '@effect/io/Ref/Synchronized'
@@ -65,7 +65,14 @@ class SwitchMapCauseFx<R, E, A, R2, E2, B>
65
65
  this.f(cause).run(
66
66
  Fx.Sink(
67
67
  sink.event,
68
- flow(sink.error, Effect.zipLeft(resetRef)),
68
+ flow(
69
+ Effect.unified((cause) =>
70
+ Cause.isInterruptedOnly(cause)
71
+ ? counter.decrement
72
+ : sink.error(cause),
73
+ ),
74
+ Effect.zipLeft(resetRef),
75
+ ),
69
76
  pipe(counter.decrement, Effect.zipLeft(resetRef)),
70
77
  ),
71
78
  ),
@@ -67,7 +67,14 @@ class SwitchMatchFx<R, E, A, R2, E2, B, R3, E3, C>
67
67
  fx.run(
68
68
  Fx.Sink(
69
69
  sink.event,
70
- flow(sink.error, Effect.zipLeft(resetRef)),
70
+ flow(
71
+ Effect.unified((cause) =>
72
+ Cause.isInterruptedOnly(cause)
73
+ ? counter.decrement
74
+ : sink.error(cause),
75
+ ),
76
+ Effect.zipLeft(resetRef),
77
+ ),
71
78
  pipe(counter.decrement, Effect.zipLeft(resetRef)),
72
79
  ),
73
80
  ),