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 3516ba05f8 - Show all commits
+15 -13
View File
@@ -1,4 +1,4 @@
import { type Cause, Context, DateTime, type Duration, Effect, Equal, Exit, HashMap, Layer, Option, Scope, Semaphore, Stream, SubscriptionRef } from "effect" import { type Cause, Context, DateTime, type Duration, Effect, Equal, Exit, HashMap, Layer, Option, Order, Scope, Semaphore, Stream, SubscriptionRef } from "effect"
export interface ScopeRegistryService { export interface ScopeRegistryService {
@@ -159,18 +159,20 @@ export class ScopeRegistryServiceImpl implements ScopeRegistryService {
getNextExpiration( getNextExpiration(
entries: HashMap.HashMap<ScopeRegistryService.Key, ScopeRegistryService.Entry>, entries: HashMap.HashMap<ScopeRegistryService.Key, ScopeRegistryService.Entry>,
): Option.Option<DateTime.Utc> { ): Option.Option<DateTime.Utc> {
let earliest: DateTime.Utc | undefined return HashMap.reduce(
entries,
for (const entry of HashMap.values(entries)) { Option.none<DateTime.Utc>(),
if ( (earliest, entry) => Option.match(
entry.leases === 0 && Option.filter(entry.expiresAt, () => entry.leases === 0),
entry.expiresAt._tag === "Some" && {
(!earliest || DateTime.isLessThan(entry.expiresAt.value, earliest)) onNone: () => earliest,
) onSome: expiresAt => Option.some(Option.match(earliest, {
earliest = entry.expiresAt.value onNone: () => expiresAt,
} onSome: Order.min<DateTime.Utc>(DateTime.Order)(expiresAt),
})),
return Option.fromNullishOr(earliest) },
),
)
} }
} }