0.2.6 #49

Merged
Thilawyn merged 48 commits from next into master 2026-05-04 02:10:53 +02:00
Showing only changes of commit a68dc80658 - Show all commits

View File

@@ -55,41 +55,43 @@ extends Pipeable.Class() implements SubmittableForm<A, I, R, MA, ME, MR, MP> {
} }
get run(): Effect.Effect<void> { get run(): Effect.Effect<void> {
return this.runSemaphore.withPermits(1)(Stream.runForEach( return this.runSemaphore.withPermits(1)(Effect.provide(
this.encodedValue.changes, Stream.runForEach(
this.encodedValue.changes,
encodedValue => Lens.get(this.validationFiber).pipe( encodedValue => Lens.get(this.validationFiber).pipe(
Effect.andThen(Option.match({ Effect.andThen(Option.match({
onSome: Fiber.interrupt, onSome: Fiber.interrupt,
onNone: () => Effect.void, onNone: () => Effect.void,
})), })),
Effect.andThen( Effect.andThen(
Effect.forkScoped(Effect.onExit( Effect.forkScoped(Effect.onExit(
Schema.decode(this.schema, { errors: "all" })(encodedValue), Schema.decode(this.schema, { errors: "all" })(encodedValue),
exit => Effect.andThen( exit => Effect.andThen(
Exit.matchEffect(exit, { Exit.matchEffect(exit, {
onSuccess: v => Effect.andThen( onSuccess: v => Effect.andThen(
Lens.set(this.value, Option.some(v)), Lens.set(this.value, Option.some(v)),
Lens.set(this.issues, Array.empty()), Lens.set(this.issues, Array.empty()),
),
onFailure: c => Option.match(Chunk.findFirst(Cause.failures(c), e => e._tag === "ParseError"), {
onSome: e => Effect.flatMap(
ParseResult.ArrayFormatter.formatError(e),
v => Lens.set(this.issues, v),
), ),
onNone: () => Effect.void, onFailure: c => Option.match(Chunk.findFirst(Cause.failures(c), e => e._tag === "ParseError"), {
onSome: e => Effect.flatMap(
ParseResult.ArrayFormatter.formatError(e),
v => Lens.set(this.issues, v),
),
onNone: () => Effect.void,
}),
}), }),
}), Lens.set(this.validationFiber, Option.none()),
Lens.set(this.validationFiber, Option.none()), ),
), ))
)).pipe( ),
Effect.tap(fiber => Lens.set(this.validationFiber, Option.some(fiber))), Effect.tap(fiber => Lens.set(this.validationFiber, Option.some(fiber))),
Effect.andThen(Fiber.join), Effect.andThen(Fiber.join),
Effect.forkScoped, Effect.ignore,
)
), ),
Effect.provide(this.context),
), ),
this.context,
)) ))
} }