0.2.2 #31

Merged
Thilawyn merged 184 commits from next into master 2026-01-16 17:05:31 +01:00
2 changed files with 16 additions and 14 deletions
Showing only changes of commit 336ea67ea2 - Show all commits

View File

@@ -199,19 +199,13 @@ export const field = <A, I, R, SA, SE, SR, const P extends PropertyPath.Paths<No
SubscriptionSubRef.makeFromPath(self.encodedValueRef, path), SubscriptionSubRef.makeFromPath(self.encodedValueRef, path),
pipe( SubscribableInternal.flatMapSubscriptionRef(self.errorRef, Option.match({
Option.match({ onSome: flow(
onSome: (v: ParseResult.ParseError) => Effect.andThen( ParseResult.ArrayFormatter.formatError,
ParseResult.ArrayFormatter.formatError(v), Effect.map(Array.filter(issue => PropertyPath.equivalence(issue.path, path))),
Array.filter(issue => PropertyPath.equivalence(issue.path, path)), ),
), onNone: () => Effect.succeed([]),
onNone: () => Effect.succeed([]), })),
}),
filter => SubscribableInternal.make({
get: Effect.flatMap(self.errorRef.get, filter),
get changes() { return Stream.flatMap(self.errorRef.changes, filter) },
}),
),
pipe( pipe(
Option.isSome, Option.isSome,

View File

@@ -1,4 +1,4 @@
import { type Effect, Effectable, Readable, type Stream, Subscribable } from "effect" import { Effect, Effectable, Readable, Stream, Subscribable, type SubscriptionRef } from "effect"
class SubscribableImpl<A, E, R> class SubscribableImpl<A, E, R>
@@ -22,3 +22,11 @@ export const make = <A, E, R>(values: {
readonly get: Effect.Effect<A, E, R> readonly get: Effect.Effect<A, E, R>
readonly changes: Stream.Stream<A, E, R> readonly changes: Stream.Stream<A, E, R>
}): Subscribable.Subscribable<A, E, R> => new SubscribableImpl(values.get, values.changes) }): Subscribable.Subscribable<A, E, R> => new SubscribableImpl(values.get, values.changes)
export const flatMapSubscriptionRef = <A, B, E, R>(
ref: SubscriptionRef.SubscriptionRef<A>,
flatMap: (value: NoInfer<A>) => Effect.Effect<B, E, R>,
): Subscribable.Subscribable<B, E, R> => make({
get: Effect.flatMap(ref, flatMap),
get changes() { return Stream.flatMap(ref.changes, flatMap) },
})