Add Effect v4 support, Fast Refresh tooling, and revamped docs #56

Merged
Thilawyn merged 133 commits from next into master 2026-07-26 02:32:59 +02:00
Showing only changes of commit d8b9c0394c - Show all commits
+15 -14
View File
@@ -11,7 +11,7 @@ export interface ScopeRegistryService {
commit(key: ScopeRegistryService.Key): Effect.Effect<ScopeRegistryService.Entry, Cause.NoSuchElementError> commit(key: ScopeRegistryService.Key): Effect.Effect<ScopeRegistryService.Entry, Cause.NoSuchElementError>
release(key: ScopeRegistryService.Key): Effect.Effect<ScopeRegistryService.Entry, Cause.NoSuchElementError> release(key: ScopeRegistryService.Key): Effect.Effect<ScopeRegistryService.Entry, Cause.NoSuchElementError>
readonly run: Effect.Effect<void> readonly run: Effect.Effect<void, never, Scope.Scope>
} }
export declare namespace ScopeRegistryService { export declare namespace ScopeRegistryService {
@@ -81,19 +81,20 @@ export class ScopeRegistryServiceImpl implements ScopeRegistryService {
) )
} }
get run(): Effect.Effect<void> { get run(): Effect.Effect<void, never, Scope.Scope> {
return SubscriptionRef.changes(this.ref).pipe( return Effect.addFinalizer(() => this.dispose).pipe(
Stream.switchMap(entries => Option.match(this.getNextExpiration(entries), { Effect.andThen(SubscriptionRef.changes(this.ref).pipe(
onNone: () => Stream.never, Stream.switchMap(entries => Option.match(this.getNextExpiration(entries), {
onSome: expiresAt => Stream.fromEffect(DateTime.now.pipe( onNone: () => Stream.never,
Effect.flatMap(now => DateTime.isLessThan(now, expiresAt) onSome: expiresAt => Stream.fromEffect(DateTime.now.pipe(
? Effect.sleep(DateTime.distance(now, expiresAt)) Effect.flatMap(now => DateTime.isLessThan(now, expiresAt)
: Effect.void), ? Effect.sleep(DateTime.distance(now, expiresAt))
Effect.andThen(Effect.uninterruptible(this.closeExpired)), : Effect.void),
)), Effect.andThen(Effect.uninterruptible(this.closeExpired)),
})), )),
Stream.runDrain, })),
Effect.ensuring(this.dispose), Stream.runDrain,
)),
this.runSemaphore.withPermit, this.runSemaphore.withPermit,
) )
} }