@opfs-vfs/effect 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import { Effect, Scope } from 'effect';
2
+ import { type Coordinator } from './coordinator.js';
3
+ import { SubscriptionError } from './errors.js';
4
+ import type { SubscribeOptions, Subscription } from './subscriptions.js';
5
+ export interface SubscriptionAdmission {
6
+ readonly generation: string;
7
+ readonly budget: {
8
+ remaining: number;
9
+ };
10
+ }
11
+ export declare const makeSubscriptionInternal: (state: Coordinator, input: SubscribeOptions, admission?: SubscriptionAdmission) => Effect.Effect<Subscription, SubscriptionError, Scope.Scope>;
@@ -0,0 +1,24 @@
1
+ import { Context, Effect, Layer, Scope, Stream } from 'effect';
2
+ import type { FileChange } from '@opfs-vfs/plugin-subscriptions/client';
3
+ import type { SubscribeOptions as PluginSubscribeOptions } from '@opfs-vfs/plugin-subscriptions/client';
4
+ import { VolumeError, SubscriptionError } from './errors.js';
5
+ import { Volume } from './volume.js';
6
+ export type SubscribeOptions = Omit<PluginSubscribeOptions, 'onError' | 'signal'>;
7
+ export type SubscriptionRetirement = {
8
+ readonly status: 'released';
9
+ } | {
10
+ readonly status: 'unknown';
11
+ readonly error: SubscriptionError;
12
+ };
13
+ export interface Subscription {
14
+ readonly changes: Stream.Stream<FileChange, SubscriptionError>;
15
+ readonly retired: Effect.Effect<SubscriptionRetirement>;
16
+ }
17
+ export interface SubscriptionsService {
18
+ readonly subscribe: (options: SubscribeOptions) => Effect.Effect<Subscription, SubscriptionError, Scope.Scope>;
19
+ }
20
+ declare const Subscriptions_base: Context.ServiceClass<Subscriptions, "@opfs-vfs/effect/Subscriptions", SubscriptionsService>;
21
+ export declare class Subscriptions extends Subscriptions_base {
22
+ }
23
+ export declare const layer: Layer.Layer<Subscriptions, VolumeError, Volume>;
24
+ export {};