better-effect 0.4.0 → 0.6.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.
package/dist/index.d.mts CHANGED
@@ -1,19 +1,35 @@
1
- import { A as ServiceResolver, B as ServiceRequirement, C as ScopeOutcome, D as ScopeRuntimeNotConfiguredError, E as ScopeClosedError, F as EffectFromGenerator, G as ServiceToken, H as ServiceClass, I as EffectRequirements, L as EffectResult, M as Service, N as AnyEffectResult, O as ServiceNotFoundError, P as EffectError, R as EffectSuccess, S as ScopeFinalizer, T as ScopeCloseError, U as ServiceInstance, V as AnyServiceToken, W as ServiceRequirements, _ as LayerSpecs, a as BuiltLayerDisposedError, b as DisposableResource, c as LayerGeneratorYieldError, d as AnyLayer, f as CompleteExecution, g as LayerRawRequired, h as LayerProvided, i as RuntimeShutdownDiagnostic, j as ServiceRuntime, k as ServiceRuntimeNotConfiguredError, l as LayerRegistrationError, m as LayerMissing, n as CleanupFailureObserver, o as DuplicateServiceError, p as CompleteLayer, r as RuntimeOptions, s as LayerDisposeError, t as LayerBackend, u as Layer, w as ResourceNotDisposableError, x as MaybePromise$1, y as CleanupFailureDiagnostic, z as EffectYield } from "./index-BYQKfyeJ.mjs";
1
+ import { A as AnyEffect, B as ServiceClass, C as ScopeClosedError, D as ServiceResolver, E as ServiceRuntimeNotConfiguredError, F as EffectSuccess, G as ServiceTag, H as ServiceIdentity, I as EffectYield, K as ServiceToken, L as ServiceRequirement, M as EffectError, N as EffectFromGenerator, O as ServiceRuntime, P as EffectRequirements, R as AnyService, S as ScopeCloseError, T as ServiceNotFoundError, U as ServiceInstance, V as ServiceContract, W as ServiceRequirements, _ as DisposableResource, a as DuplicateServiceError, b as ScopeOutcome, c as LayerRegistrationError, d as LayerRegistration, f as CompleteExecution, g as CleanupFailureDiagnostic, h as ProvidedEnvironment, i as RuntimeShutdownDiagnostic, j as Effect$1, k as Service, l as ServiceTagCollisionError, m as LayerInput, n as CleanupFailureObserver, o as LayerDisposeError, p as CompleteInput, q as ServiceTokenOf, r as RuntimeOptions, s as LayerGeneratorYieldError, t as LayerBackend, u as Layer, v as MaybePromise$1, w as ScopeRuntimeNotConfiguredError, x as ResourceNotDisposableError, y as ScopeFinalizer, z as AnyServiceToken } from "./index-DMfjhNR_.mjs";
2
2
  import { Err, Result, UnhandledException } from "better-result";
3
3
  //#region src/scope/scope.d.ts
4
+ /**
5
+ * Non-owning lifecycle context for finalizers and child Scopes.
6
+ *
7
+ * A Scope can register cleanup and create children, but it cannot close
8
+ * itself. Use `Scope.make()` or `Scope.run()` when your code owns the Scope.
9
+ */
4
10
  interface Scope {
11
+ /** Register a finalizer that runs when the owning Scope closes. */
5
12
  addFinalizer(finalizer: ScopeFinalizer): void;
13
+ /** Acquire a resource and register its outcome-aware release callback. */
6
14
  acquire<R>(acquire: () => MaybePromise$1<R>, release: (resource: R, outcome: ScopeOutcome) => MaybePromise$1<void>): Promise<R>;
15
+ /** Register an already-acquired disposable resource. */
7
16
  add<R extends DisposableResource>(resource: R): Promise<R>;
17
+ /** Create a child Scope owned by this Scope. */
8
18
  fork(): CloseableScope;
9
19
  }
20
+ /** A Scope whose owner is responsible for calling `close()`. */
10
21
  interface CloseableScope extends Scope {
22
+ /** Close the Scope and run children and finalizers in child-first LIFO order. */
11
23
  close(outcome?: ScopeOutcome): Promise<void>;
12
24
  }
13
25
  declare const Scope: {
26
+ /** Create an owned, initially open Scope. */
14
27
  readonly make: () => CloseableScope;
28
+ /** Return the non-owning Scope available in the current execution context. */
15
29
  readonly current: () => Scope;
30
+ /** Run a callback with an existing Scope supplied as the current context. */
16
31
  readonly provide: <A>(scope: Scope, program: () => A) => A;
32
+ /** Resolve the current Scope through `yield* Scope` inside an Effect. */
17
33
  readonly [Symbol.iterator]: () => Generator<never, Scope, unknown>;
18
34
  /**
19
35
  * Run a program in a newly owned Scope.
@@ -21,18 +37,40 @@ declare const Scope: {
21
37
  * Scope is independent from `better-result`, so returned values—including
22
38
  * `Result.err`—close this Scope with a successful outcome. Result-aware
23
39
  * outcome classification belongs to `Runtime.run`.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * await Scope.run(async (scope) => {
44
+ * const connection = await scope.acquire(connect, (connection) => connection.close())
45
+ * return connection.query()
46
+ * })
47
+ * ```
24
48
  */
25
49
  readonly run: <A>(program: (scope: Scope) => A | PromiseLike<A>) => Promise<Awaited<A>>;
26
50
  };
51
+ /** Type-level aliases for Scope ownership, outcomes, and cleanup contracts. */
52
+ declare namespace Scope {
53
+ /** A Scope whose owner is responsible for calling `close()`. */
54
+ type Closeable = CloseableScope;
55
+ /** The outcome supplied to Scope finalizers and resource releases. */
56
+ type Outcome = ScopeOutcome;
57
+ /** A cleanup callback registered with a Scope. */
58
+ type Finalizer = ScopeFinalizer;
59
+ /** A value implementing a JavaScript disposal protocol. */
60
+ type Disposable = DisposableResource;
61
+ }
27
62
  //#endregion
28
63
  //#region src/effect/combinators.d.ts
29
- type EffectInput<A, E, Requirements> = EffectResult<A, E, Requirements> | PromiseLike<EffectResult<A, E, Requirements>>;
64
+ type EffectInput<A, E, Requirements extends AnyService> = Effect$1<A, E, Requirements> | PromiseLike<Effect$1<A, E, Requirements>>;
30
65
  type AnyEffectInput = EffectInput<any, any, any>;
66
+ type AnyEffectValue = Effect$1<any, any, any>;
67
+ type AnyAsyncEffectInput = PromiseLike<AnyEffectValue>;
31
68
  type PreserveAsync<Input, Output> = Input extends PromiseLike<unknown> ? Promise<Output> : Output;
32
- type MappedResult<Input, B> = EffectResult<B, EffectError<Input>, EffectRequirements<Input>>;
33
- type ErrorMappedResult<Input, E2> = EffectResult<EffectSuccess<Input>, E2, EffectRequirements<Input>>;
34
- type ChainedResult<First, Next> = EffectResult<EffectSuccess<Next>, EffectError<First> | EffectError<Next>, EffectRequirements<First> | EffectRequirements<Next>>;
35
- type ChainedOutput<First, Next> = First extends PromiseLike<unknown> ? Promise<ChainedResult<First, Next>> : Next extends PromiseLike<unknown> ? Promise<ChainedResult<First, Next>> : ChainedResult<First, Next>;
69
+ type MappedResult<Input, B> = Effect$1<B, EffectError<Input>, EffectRequirements<Input>>;
70
+ type ErrorMappedResult<Input, E2> = Effect$1<EffectSuccess<Input>, E2, EffectRequirements<Input>>;
71
+ type ChainedResult<First, Next> = Effect$1<EffectSuccess<Next>, EffectError<First> | EffectError<Next>, EffectRequirements<First> | EffectRequirements<Next>>;
72
+ type ChainedOutput<First, Next> = ChainedResult<First, Next>;
73
+ type AsyncChainedOutput<First, Next> = Promise<ChainedResult<First, Next>>;
36
74
  type MapOperation<A, B> = {
37
75
  <Input>(effect: Input & EffectInput<A, any, any>): PreserveAsync<Input, MappedResult<Input, B>>;
38
76
  };
@@ -40,20 +78,83 @@ type MapErrorOperation<E1, E2> = {
40
78
  <Input>(effect: Input & EffectInput<any, E1, any>): PreserveAsync<Input, ErrorMappedResult<Input, E2>>;
41
79
  };
42
80
  type AndThenOperation<A, Next> = {
43
- <Input>(effect: Input & EffectInput<A, any, any>): ChainedOutput<Input, Next>;
81
+ <Input>(effect: Input & Effect$1<A, any, any>): ChainedOutput<Input, Next>;
82
+ };
83
+ type AndThenAsyncOperation<A, Next> = {
84
+ <Input>(effect: Input & EffectInput<A, any, any>): AsyncChainedOutput<Input, Next>;
44
85
  };
86
+ /**
87
+ * Map the successful value of a Result or Effect result.
88
+ *
89
+ * Supports both data-first and data-last forms and preserves asynchronous
90
+ * results and phantom Service requirements.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * const doubled = Effect.map(Result.ok(2), (value) => value * 2)
95
+ * const toLabel = Effect.map((value: number) => `#${value}`)
96
+ * ```
97
+ */
45
98
  declare function map<A, B>(fn: (value: A) => B): MapOperation<A, B>;
46
99
  declare function map<Input, B>(effect: Input & AnyEffectInput, fn: (value: EffectSuccess<Input>) => B): PreserveAsync<Input, MappedResult<Input, B>>;
100
+ /**
101
+ * Map the error value of a Result or Effect result while preserving its
102
+ * successful value, asynchronous shape, and Service requirements.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const labelled = Effect.mapError(Result.err('missing'), (error) => ({ error }))
107
+ * ```
108
+ */
47
109
  declare function mapError<E1, E2>(fn: (error: E1) => E2): MapErrorOperation<E1, E2>;
48
110
  declare function mapError<Input, E2>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => E2): PreserveAsync<Input, ErrorMappedResult<Input, E2>>;
49
- declare function andThen<A, Next extends AnyEffectInput>(next: (value: A) => Next): AndThenOperation<A, Next>;
50
- declare function andThen<Input, Next extends AnyEffectInput>(effect: Input & AnyEffectInput, next: (value: EffectSuccess<Input>) => Next): ChainedOutput<Input, Next>;
111
+ /**
112
+ * Chain a synchronous Result-producing operation after a successful result.
113
+ *
114
+ * The next operation is skipped when the input is an error. Both error types
115
+ * and both sets of Service requirements are preserved in the output.
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * const user = Effect.andThen(Result.ok('u1'), (id) => repository.find(id))
120
+ * ```
121
+ */
122
+ declare function andThen<A, Next extends AnyEffectValue>(next: (value: A) => Next): AndThenOperation<A, Next>;
123
+ declare function andThen<Input, Next extends AnyEffectValue>(effect: Input & AnyEffectValue, next: (value: EffectSuccess<Input>) => Next): ChainedOutput<Input, Next>;
124
+ /**
125
+ * Chain an asynchronous Result-producing operation after a successful result.
126
+ *
127
+ * The returned value is always a Promise and retains both operations' error
128
+ * and Service-requirement metadata.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * const user = Effect.andThenAsync(loadUser(), (user) => fetchProfile(user.id))
133
+ * ```
134
+ */
135
+ declare function andThenAsync<A, Next extends AnyAsyncEffectInput>(next: (value: A) => Next): AndThenAsyncOperation<A, Next>;
136
+ declare function andThenAsync<Input, Next extends AnyAsyncEffectInput>(effect: Input & AnyEffectInput, next: (value: EffectSuccess<Input>) => Next): AsyncChainedOutput<Input, Next>;
51
137
  //#endregion
52
138
  //#region src/effect/effect.d.ts
139
+ type Effect<A, E, R extends AnyService = never> = Effect$1<A, E, R>;
53
140
  type AnyResult = Result<any, any>;
54
141
  /**
55
- * Compose better-result operations while preserving Service requirements in
142
+ * Compose `better-result` operations while preserving Service requirements in
56
143
  * a phantom type channel.
144
+ *
145
+ * A generator may yield Service tokens and Result operations. It must return a
146
+ * `Result` as its final value; Service yields are resolved by the active
147
+ * Runtime and do not add runtime values to the Result stream.
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * const loadUser = Effect.gen(async function* () {
152
+ * const database = yield* Database
153
+ * const user = yield* Result.await(database.findUser('u1'))
154
+ *
155
+ * return Result.ok(user)
156
+ * })
157
+ * ```
57
158
  */
58
159
  declare function gen<Yield extends EffectYield, Returned extends AnyResult>(body: () => Generator<Yield, Returned, unknown>): EffectFromGenerator<Yield, Returned>;
59
160
  declare function gen<Yield extends EffectYield, Returned extends AnyResult>(body: () => AsyncGenerator<Yield, Returned, unknown>): Promise<EffectFromGenerator<Yield, Returned>>;
@@ -61,28 +162,67 @@ declare function gen<Yield extends EffectYield, Returned extends AnyResult>(body
61
162
  * Acquire a resource in the current Scope and register its release callback.
62
163
  *
63
164
  * Acquisition failures are represented in the Effect Result error channel;
64
- * release failures remain owned by Scope cleanup.
165
+ * release failures remain owned by Scope cleanup. The release callback
166
+ * receives the final outcome chosen by the enclosing execution boundary.
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * const connection = yield* Effect.acquireRelease(
171
+ * () => pool.connect(),
172
+ * (connection, outcome) => connection.close(outcome)
173
+ * )
174
+ * ```
65
175
  */
66
176
  declare function acquireRelease<R>(acquire: () => MaybePromise$1<R>, release: (resource: R, outcome: ScopeOutcome) => MaybePromise$1<void>): AsyncGenerator<Err<never, UnhandledException>, R, unknown>;
67
177
  /**
68
178
  * Register an already-acquired disposable resource in the current Scope.
69
179
  *
70
- * Registration failures are represented in the Effect Result error channel;
71
- * disposal failures remain owned by Scope cleanup.
180
+ * The resource is not acquired by this helper. Registration failures are
181
+ * represented in the Effect Result error channel; disposal failures remain
182
+ * owned by Scope cleanup.
183
+ *
184
+ * @example
185
+ * ```ts
186
+ * const file = yield* Effect.add(await openFile('notes.txt'))
187
+ * ```
72
188
  */
73
189
  declare function add<R extends DisposableResource>(resource: R): AsyncGenerator<Err<never, UnhandledException>, R, unknown>;
190
+ /**
191
+ * Effect namespace containing generator, resource, and Result combinators.
192
+ *
193
+ * Prefer these helpers when a program needs typed Service requirements or
194
+ * Scope-aware acquisition and cleanup.
195
+ */
74
196
  declare const Effect: {
197
+ /** Compose a generator-based Effect program. */
75
198
  readonly gen: typeof gen;
199
+ /** Acquire and register a resource in the current Scope. */
76
200
  readonly acquireRelease: typeof acquireRelease;
201
+ /** Register an already-acquired disposable in the current Scope. */
77
202
  readonly add: typeof add;
203
+ /** Map a successful Effect result. */
78
204
  readonly map: typeof map;
205
+ /** Map an Effect error. */
79
206
  readonly mapError: typeof mapError;
207
+ /** Chain a synchronous Effect result. */
80
208
  readonly andThen: typeof andThen;
209
+ /** Chain an asynchronous Effect result. */
210
+ readonly andThenAsync: typeof andThenAsync;
81
211
  };
212
+ /** Type-level aliases for inspecting Effect result channels and requirements. */
213
+ declare namespace Effect {
214
+ /** Extract the success channel from an Effect result or Promise. */
215
+ type Success<T> = EffectSuccess<T>;
216
+ /** Extract the error channel from an Effect result or Promise. */
217
+ type Error<T> = EffectError<T>;
218
+ /** Extract the Service requirements from an Effect result or Promise. */
219
+ type Requirements<T> = EffectRequirements<T>;
220
+ /** An Effect with erased success, error, and requirements. */
221
+ type Any = AnyEffect;
222
+ }
82
223
  //#endregion
83
224
  //#region src/function/pipe.d.ts
84
225
  type Unary<A, B> = (value: A) => B;
85
- /** Compose a value through a sequence of unary functions. */
86
226
  declare function pipe<A>(value: A): A;
87
227
  declare function pipe<A, B>(value: A, ab: Unary<A, B>): B;
88
228
  declare function pipe<A, B, C>(value: A, ab: Unary<A, B>, bc: Unary<B, C>): C;
@@ -97,6 +237,7 @@ declare function pipe<A, B, C, D, E, F, G, H, I, J, K>(value: A, ab: Unary<A, B>
97
237
  //#endregion
98
238
  //#region src/resource/errors.d.ts
99
239
  declare const ResourceReleaseFailure_base: import("better-result").TaggedErrorClass<"ResourceReleaseFailure">;
240
+ /** Describes a failure encountered while releasing a Resource. */
100
241
  declare class ResourceReleaseFailure extends ResourceReleaseFailure_base<{
101
242
  readonly resource: string;
102
243
  readonly cause: unknown;
@@ -104,39 +245,86 @@ declare class ResourceReleaseFailure extends ResourceReleaseFailure_base<{
104
245
  }> {}
105
246
  //#endregion
106
247
  //#region src/resource/types.d.ts
248
+ /** A value that may be delivered synchronously or through a thenable. */
107
249
  type MaybePromise<T> = T | PromiseLike<T>;
250
+ /** A synchronous or asynchronous better-result Result operation. */
108
251
  type AsyncResult<T, E> = MaybePromise<Result<T, E>>;
252
+ /** The allowed return value of a custom Resource release callback. */
109
253
  type ReleaseOutcome = void | Result<void, unknown>;
254
+ /** Receives release failures for diagnostics without changing error precedence. */
110
255
  type ReleaseFailureObserver = (failure: ResourceReleaseFailure) => MaybePromise<void>;
256
+ /** Options controlling `Resource.acquireUseRelease`. */
111
257
  type AcquireUseReleaseOptions<R, A, AcquireError, UseError> = {
258
+ /** Human-readable name included in release failures. */
112
259
  readonly name: string;
260
+ /** Acquire the resource. A failure skips use and release. */
113
261
  readonly acquire: () => AsyncResult<R, AcquireError>;
262
+ /** Use the acquired resource. Release is attempted afterward. */
114
263
  readonly use: (resource: R) => AsyncResult<A, UseError>;
264
+ /** Release the resource, or omit it to use its disposal protocol. */
115
265
  readonly release?: (resource: R) => MaybePromise<ReleaseOutcome>;
116
266
  /**
117
- * Observa falhas de cleanup sem
118
- * alterar a precedência de erros.
119
- *
120
- * Útil principalmente quando use
121
- * e release falham juntos.
267
+ * Observe cleanup failures without changing error precedence. This is most
268
+ * useful when both `use` and `release` can fail.
122
269
  */
123
270
  readonly onReleaseFailure?: ReleaseFailureObserver;
124
271
  };
125
272
  //#endregion
126
273
  //#region src/resource/resource.d.ts
127
- declare const acquireUseRelease: <R, A, AcquireError, UseError>({ name, acquire, use, release, onReleaseFailure }: AcquireUseReleaseOptions<R, A, AcquireError, UseError>) => Promise<Result<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>>;
128
274
  declare const Resource: {
129
- readonly acquireUseRelease: typeof acquireUseRelease;
275
+ /** Acquire, use, and release a resource with deterministic error precedence. */
276
+ readonly acquireUseRelease: <R, A, AcquireError, UseError>({ name, acquire, use, release, onReleaseFailure }: AcquireUseReleaseOptions<R, A, AcquireError, UseError>) => Promise<Result<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>>;
130
277
  };
131
278
  //#endregion
279
+ //#region src/runtime/types.d.ts
280
+ /**
281
+ * Name a Runtime type from a concrete Layer without repeating its provided
282
+ * branded Service instance union.
283
+ *
284
+ * @example
285
+ * ```ts
286
+ * type AppRuntime = RuntimeFor<typeof AppLive>
287
+ * ```
288
+ */
289
+ type RuntimeFor<L extends LayerInput> = Runtime<Layer.Provided<L>>;
290
+ //#endregion
132
291
  //#region src/runtime/runtime.d.ts
133
- declare class Runtime<Provided extends AnyServiceToken = AnyServiceToken> {
134
- private readonly built;
292
+ /**
293
+ * Long-lived execution environment backed by a complete Layer.
294
+ *
295
+ * A Runtime owns Layer resources until `dispose()` is called. Each `run()` is
296
+ * isolated in a child Scope, while Layer-scoped resources remain shared.
297
+ *
298
+ * @example
299
+ * ```ts
300
+ * const runtime = await Runtime.make(AppLive, new MemoryLayerBackend())
301
+ * const result = await runtime.run(loadUser('u1'))
302
+ * await runtime.dispose()
303
+ * ```
304
+ *
305
+ * @typeParam Provided The branded Service instances supplied by the Layer.
306
+ */
307
+ declare class Runtime<Provided extends AnyService = any> {
308
+ private readonly handle;
135
309
  private constructor();
136
- /** Create a long-lived Runtime that owns its Layer resources. */
137
- static make<L extends AnyLayer>(layer: CompleteLayer<L>, backend: LayerBackend, options?: RuntimeOptions): Promise<Runtime<LayerProvided<L>>>;
138
- /** Run one program and dispose its Layer resources before resolving. */
139
- static run<A, L extends AnyLayer>(layer: CompleteLayer<L>, backend: LayerBackend, program: CompleteExecution<LayerProvided<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
310
+ /**
311
+ * Create a long-lived Runtime that owns its Layer resources.
312
+ *
313
+ * @example
314
+ * ```ts
315
+ * const runtime = await Runtime.make(AppLive, backend)
316
+ * const result = await runtime.run(program)
317
+ * await runtime.dispose()
318
+ * ```
319
+ */
320
+ static make<L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, options?: RuntimeOptions): Promise<Runtime<ProvidedEnvironment<L>>>;
321
+ /**
322
+ * Run one program and dispose its Layer resources before resolving.
323
+ *
324
+ * This is convenient for request-style or command-style execution where a
325
+ * Runtime should not outlive the operation.
326
+ */
327
+ static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
140
328
  /** Run one execution in this Runtime's child Scope. */
141
329
  run<A>(program: CompleteExecution<Provided, A>): Promise<Awaited<A>>;
142
330
  private runUnchecked;
@@ -144,10 +332,15 @@ declare class Runtime<Provided extends AnyServiceToken = AnyServiceToken> {
144
332
  dispose(): Promise<void>;
145
333
  private disposeWithOutcome;
146
334
  }
335
+ /** Type-level aliases for naming Runtime handles and shutdown options. */
336
+ declare namespace Runtime {
337
+ /** Name a Runtime type from a concrete Layer. */
338
+ type For<L extends LayerInput> = RuntimeFor<L>;
339
+ /** Optional Runtime shutdown configuration. */
340
+ type Options = RuntimeOptions;
341
+ /** Diagnostic reported for aggregated Runtime shutdown cleanup failures. */
342
+ type ShutdownDiagnostic = RuntimeShutdownDiagnostic;
343
+ }
147
344
  //#endregion
148
- //#region src/runtime/types.d.ts
149
- /** Runtime handle whose provided Services are inferred from a Layer. */
150
- type RuntimeFor<L extends AnyLayer> = Runtime<LayerProvided<L>>;
151
- //#endregion
152
- export { type AcquireUseReleaseOptions, type AnyEffectResult, type AnyServiceToken, type AsyncResult, BuiltLayerDisposedError, type CleanupFailureDiagnostic, type CleanupFailureObserver, type CloseableScope, type DisposableResource, DuplicateServiceError, Effect, type EffectError, type EffectRequirements, type EffectResult, type EffectSuccess, type EffectYield, Layer, type LayerBackend, LayerDisposeError, LayerGeneratorYieldError, type LayerMissing, type LayerProvided, type LayerRawRequired, LayerRegistrationError, type LayerSpecs, type ReleaseFailureObserver, type ReleaseOutcome, Resource, ResourceNotDisposableError, ResourceReleaseFailure, Runtime, type RuntimeFor, type RuntimeOptions, type RuntimeShutdownDiagnostic, Scope, ScopeCloseError, ScopeClosedError, type ScopeFinalizer, type ScopeOutcome, ScopeRuntimeNotConfiguredError, Service, type ServiceClass, type ServiceInstance, ServiceNotFoundError, type ServiceRequirement, type ServiceRequirements, type ServiceResolver, ServiceRuntime, ServiceRuntimeNotConfiguredError, type ServiceToken, pipe };
345
+ export { type AcquireUseReleaseOptions, type AnyEffect, type AnyService, type AnyServiceToken, type AsyncResult, type CleanupFailureDiagnostic, type CleanupFailureObserver, type CloseableScope, type DisposableResource, DuplicateServiceError, Effect, type EffectError, type EffectRequirements, type EffectSuccess, type EffectYield, Layer, type LayerBackend, LayerDisposeError, LayerGeneratorYieldError, type LayerRegistration, LayerRegistrationError, type ReleaseFailureObserver, type ReleaseOutcome, Resource, ResourceNotDisposableError, ResourceReleaseFailure, Runtime, type RuntimeFor, type RuntimeOptions, type RuntimeShutdownDiagnostic, Scope, ScopeCloseError, ScopeClosedError, type ScopeFinalizer, type ScopeOutcome, ScopeRuntimeNotConfiguredError, Service, type ServiceClass, type ServiceContract, type ServiceIdentity, type ServiceInstance, ServiceNotFoundError, type ServiceRequirement, type ServiceRequirements, type ServiceResolver, ServiceRuntime, ServiceRuntimeNotConfiguredError, type ServiceTag, ServiceTagCollisionError, type ServiceToken, type ServiceTokenOf, pipe };
153
346
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/scope/scope.ts","../src/effect/combinators.ts","../src/effect/effect.ts","../src/function/pipe.ts","../src/resource/errors.ts","../src/resource/types.ts","../src/resource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","names":[],"sources":["../src/scope/scope.ts","../src/effect/combinators.ts","../src/effect/effect.ts","../src/function/pipe.ts","../src/resource/errors.ts","../src/resource/types.ts","../src/resource/resource.ts","../src/runtime/types.ts","../src/runtime/runtime.ts"],"mappings":";;;;;;;;;UAgBiB;;EAEf,aAAa,WAAW;;EAGxB,QAAQ,GACN,eAAe,eAAa,IAC5B,UAAU,UAAU,GAAG,SAAS,iBAAiB,uBAChD,QAAQ;;EAGX,IAAI,UAAU,oBAAoB,UAAU,IAAI,QAAQ;;EAGxD,QAAQ;;;UAIO,uBAAuB;;EAEtC,MAAM,UAAU,eAAe;;cAgKpB;;WAEH,YAAA;;WAKG,eAAA;;WAKH,UAAA,GAAC,OAAS,OAAK,eAAiB,MAAI;;YAMtB,OAAA,iBAAA,iBAAiB;;;;;;;;;;;;;;;;WAmBnC,MAAA,GAAC,UAAY,OAAO,UAAU,IAAI,YAAY,OAAK,QAAQ,QAAQ;;;kBAUhD;;OAEX,YAAY;;OAGZ,UAAU;;OAGV,YAAY;;OAGZ,aAAa;;;;KCtPtB,YAAY,GAAG,GAAG,qBAAqB,cACxC,SAAO,GAAG,GAAG,gBACb,YAAY,SAAO,GAAG,GAAG;KAExB,iBAAiB;KACjB,iBAAiB;KACjB,sBAAsB,YAAY;KAIlC,cAAc,OAAO,UAAU,cAAc,uBAAuB,QAAQ,UAAU;KAEtF,aAAa,OAAO,KAAK,SAAO,GAAG,YAAY,QAAQ,mBAAmB;KAE1E,kBAAkB,OAAO,MAAM,SAAO,cAAc,QAAQ,IAAI,mBAAmB;KAEnF,cAAc,OAAO,QAAQ,SAChC,cAAc,OACd,YAAY,SAAS,YAAY,OACjC,mBAAmB,SAAS,mBAAmB;KAG5C,cAAc,OAAO,QAAQ,cAAc,OAAO;KAElD,mBAAmB,OAAO,QAAQ,QAAQ,cAAc,OAAO;KAE/D,aAAa,GAAG;GAClB,OAAO,QAAQ,QAAQ,YAAY,eAAe,cAAc,OAAO,aAAa,OAAO;;KAGzF,kB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