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 7e816d041e - Show all commits
+11 -14
View File
@@ -1,4 +1,4 @@
import { type Cause, Context, DateTime, type Duration, Effect, Equal, Exit, flow, HashMap, Layer, Option, Order, Scope, Semaphore, Stream, SubscriptionRef } from "effect"
import { type Cause, Chunk, Context, DateTime, type Duration, Effect, Equal, Exit, HashMap, Layer, Option, Order, Scope, Semaphore, Stream, SubscriptionRef } from "effect"
export interface ScopeRegistryService {
@@ -115,22 +115,19 @@ export class ScopeRegistryServiceImpl implements ScopeRegistryService {
get closeExpired(): Effect.Effect<void> {
return Effect.flatMap(DateTime.now, now => SubscriptionRef.modify(
this.ref,
entries => {
const expired: ScopeRegistryService.Entry[] = []
const remaining = HashMap.filter(entries, entry => {
const shouldClose = Option.exists(
entries => HashMap.reduce(
entries,
[
Chunk.empty<ScopeRegistryService.Entry>(),
HashMap.empty<ScopeRegistryService.Key, ScopeRegistryService.Entry>(),
] as const,
([expired, remaining], entry, key) => Option.exists(
entry.expiresAt,
expiresAt => DateTime.isLessThanOrEqualTo(expiresAt, now),
)
if (shouldClose)
expired.push(entry)
return !shouldClose
})
return [expired, remaining]
},
? [Chunk.append(expired, entry), remaining] as const
: [expired, HashMap.set(remaining, key, entry)] as const,
),
)).pipe(
Effect.flatMap(entries => Effect.forEach(
entries,