better-effect 0.5.0 → 0.6.1

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,4 +1,5 @@
1
- import { A as ServiceResolver, B as ServiceRequirement, C as ScopeOutcome, D as ScopeRuntimeNotConfiguredError, E as ScopeClosedError, F as EffectFromGenerator, G as ServiceTag, H as ServiceClass, I as EffectRequirements, K as ServiceToken, 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 DuplicateServiceError, b as DisposableResource, c as LayerRegistrationError, d as AnyLayer, f as CompleteExecution, g as LayerRawRequired, h as LayerProvided, i as RuntimeShutdownDiagnostic, j as ServiceRuntime, k as ServiceRuntimeNotConfiguredError, l as ServiceTagCollisionError, m as LayerMissing, n as CleanupFailureObserver, o as LayerDisposeError, p as CompleteLayer, r as RuntimeOptions, s as LayerGeneratorYieldError, t as LayerBackend, u as Layer, v as LayerRegistration, w as ResourceNotDisposableError, x as MaybePromise$1, y as CleanupFailureDiagnostic, z as EffectYield } from "./index-D77AvuBl.mjs";
1
+ import { A as ServiceRequirements, C as ServiceRequirement, D as ServiceContract, E as ServiceClass, N as ServiceToken, O as ServiceIdentity, P as ServiceTokenOf, S as ProgramFromGenerator, T as AnyServiceToken, _ as EffectFromGenerator, a as LayerRegistration, b as EffectYield, c as ServiceAcquisitionError, d as ServiceResolver, f as ServiceRuntime, g as EffectError, h as Effect$1, j as ServiceTag, k as ServiceInstance, l as ServiceNotFoundError, m as AnyEffect, n as LayerBackend, p as Service, s as CircularDependencyError, t as MapLayerBackend, u as ServiceRuntimeNotConfiguredError, v as EffectRequirements, w as AnyService, x as Program, y as EffectSuccess } from "./map-layer-backend-7hQkf_QP.mjs";
2
+ import { S as ScopeRuntimeNotConfiguredError, _ as ScopeFinalizer, a as LayerDisposeError, b as ScopeCloseError, c as ServiceTagCollisionError, d as CompleteInput, f as LayerInput, g as MaybePromise$1, h as DisposableResource, i as DuplicateServiceError, l as Layer, m as CleanupFailureDiagnostic, n as RuntimeOptions, o as LayerGeneratorYieldError, p as ProvidedEnvironment, r as RuntimeShutdownDiagnostic, s as LayerRegistrationError, t as CleanupFailureObserver, u as CompleteExecution, v as ScopeOutcome, x as ScopeClosedError, y as ResourceNotDisposableError } from "./index-R3FdVmdr.mjs";
2
3
  import { Err, Result, UnhandledException } from "better-result";
3
4
  //#region src/scope/scope.d.ts
4
5
  /**
@@ -48,35 +49,46 @@ declare const Scope: {
48
49
  */
49
50
  readonly run: <A>(program: (scope: Scope) => A | PromiseLike<A>) => Promise<Awaited<A>>;
50
51
  };
52
+ /** Type-level aliases for Scope ownership, outcomes, and cleanup contracts. */
53
+ declare namespace Scope {
54
+ /** A Scope whose owner is responsible for calling `close()`. */
55
+ type Closeable = CloseableScope;
56
+ /** The outcome supplied to Scope finalizers and resource releases. */
57
+ type Outcome = ScopeOutcome;
58
+ /** A cleanup callback registered with a Scope. */
59
+ type Finalizer = ScopeFinalizer;
60
+ /** A value implementing a JavaScript disposal protocol. */
61
+ type Disposable = DisposableResource;
62
+ }
51
63
  //#endregion
52
64
  //#region src/effect/combinators.d.ts
53
- type EffectInput<A, E, Requirements> = EffectResult<A, E, Requirements> | PromiseLike<EffectResult<A, E, Requirements>>;
54
- type AnyEffectInput = EffectInput<any, any, any>;
55
- type AnyEffectResult$1 = EffectResult<any, any, any>;
56
- type AnyAsyncEffectInput = PromiseLike<AnyEffectResult$1>;
65
+ type EffectInput<A, E> = Result<A, E> | PromiseLike<Result<A, E>>;
66
+ type AnyEffectInput = EffectInput<any, any>;
67
+ type AnyEffectValue = Result<any, any>;
68
+ type AnyAsyncEffectInput = PromiseLike<Result<any, any>>;
57
69
  type PreserveAsync<Input, Output> = Input extends PromiseLike<unknown> ? Promise<Output> : Output;
58
- type MappedResult<Input, B> = EffectResult<B, EffectError<Input>, EffectRequirements<Input>>;
59
- type ErrorMappedResult<Input, E2> = EffectResult<EffectSuccess<Input>, E2, EffectRequirements<Input>>;
60
- type ChainedResult<First, Next> = EffectResult<EffectSuccess<Next>, EffectError<First> | EffectError<Next>, EffectRequirements<First> | EffectRequirements<Next>>;
70
+ type MappedResult<Input, B> = Effect$1<B, EffectError<Input>, EffectRequirements<Input>>;
71
+ type ErrorMappedResult<Input, E2> = Effect$1<EffectSuccess<Input>, E2, EffectRequirements<Input>>;
72
+ type ChainedResult<First, Next> = Effect$1<EffectSuccess<Next>, EffectError<First> | EffectError<Next>, EffectRequirements<First> | EffectRequirements<Next>>;
61
73
  type ChainedOutput<First, Next> = ChainedResult<First, Next>;
62
74
  type AsyncChainedOutput<First, Next> = Promise<ChainedResult<First, Next>>;
63
75
  type MapOperation<A, B> = {
64
- <Input>(effect: Input & EffectInput<A, any, any>): PreserveAsync<Input, MappedResult<Input, B>>;
76
+ <Input>(effect: Input & EffectInput<A, any>): PreserveAsync<Input, MappedResult<Input, B>>;
65
77
  };
66
78
  type MapErrorOperation<E1, E2> = {
67
- <Input>(effect: Input & EffectInput<any, E1, any>): PreserveAsync<Input, ErrorMappedResult<Input, E2>>;
79
+ <Input>(effect: Input & EffectInput<any, E1>): PreserveAsync<Input, ErrorMappedResult<Input, E2>>;
68
80
  };
69
- type AndThenOperation<A, Next> = {
70
- <Input>(effect: Input & EffectResult<A, any, any>): ChainedOutput<Input, Next>;
81
+ type AndThenOperation<Next> = {
82
+ <Input>(effect: Input & AnyEffectValue): ChainedOutput<Input, Next>;
71
83
  };
72
84
  type AndThenAsyncOperation<A, Next> = {
73
- <Input>(effect: Input & EffectInput<A, any, any>): AsyncChainedOutput<Input, Next>;
85
+ <Input>(effect: Input & EffectInput<A, any>): AsyncChainedOutput<Input, Next>;
74
86
  };
75
87
  /**
76
88
  * Map the successful value of a Result or Effect result.
77
89
  *
78
90
  * Supports both data-first and data-last forms and preserves asynchronous
79
- * results and phantom Service requirements.
91
+ * results and declaration-only Service requirements.
80
92
  *
81
93
  * @example
82
94
  * ```ts
@@ -88,7 +100,7 @@ declare function map<A, B>(fn: (value: A) => B): MapOperation<A, B>;
88
100
  declare function map<Input, B>(effect: Input & AnyEffectInput, fn: (value: EffectSuccess<Input>) => B): PreserveAsync<Input, MappedResult<Input, B>>;
89
101
  /**
90
102
  * Map the error value of a Result or Effect result while preserving its
91
- * successful value, asynchronous shape, and Service requirements.
103
+ * successful value, asynchronous shape, and declaration-only Service requirements.
92
104
  *
93
105
  * @example
94
106
  * ```ts
@@ -108,8 +120,8 @@ declare function mapError<Input, E2>(effect: Input & AnyEffectInput, fn: (error:
108
120
  * const user = Effect.andThen(Result.ok('u1'), (id) => repository.find(id))
109
121
  * ```
110
122
  */
111
- declare function andThen<A, Next extends AnyEffectResult$1>(next: (value: A) => Next): AndThenOperation<A, Next>;
112
- declare function andThen<Input, Next extends AnyEffectResult$1>(effect: Input & AnyEffectResult$1, next: (value: EffectSuccess<Input>) => Next): ChainedOutput<Input, Next>;
123
+ declare function andThen<A, Next extends AnyEffectValue>(next: (value: A) => Next): AndThenOperation<Next>;
124
+ declare function andThen<Input, Next extends AnyEffectValue>(effect: Input & AnyEffectValue, next: (value: EffectSuccess<Input>) => Next): ChainedOutput<Input, Next>;
113
125
  /**
114
126
  * Chain an asynchronous Result-producing operation after a successful result.
115
127
  *
@@ -125,14 +137,17 @@ declare function andThenAsync<A, Next extends AnyAsyncEffectInput>(next: (value:
125
137
  declare function andThenAsync<Input, Next extends AnyAsyncEffectInput>(effect: Input & AnyEffectInput, next: (value: EffectSuccess<Input>) => Next): AsyncChainedOutput<Input, Next>;
126
138
  //#endregion
127
139
  //#region src/effect/effect.d.ts
140
+ type Effect<A, E, R extends AnyService = never> = Effect$1<A, E, R>;
141
+ type LazyProgram<A, E, R extends AnyService = never> = Program<A, E, R>;
128
142
  type AnyResult = Result<any, any>;
129
143
  /**
130
144
  * Compose `better-result` operations while preserving Service requirements in
131
- * a phantom type channel.
145
+ * a declaration-only type channel.
132
146
  *
133
147
  * A generator may yield Service tokens and Result operations. It must return a
134
148
  * `Result` as its final value; Service yields are resolved by the active
135
149
  * Runtime and do not add runtime values to the Result stream.
150
+ * Use `fn` when generator execution should wait for a Runtime boundary.
136
151
  *
137
152
  * @example
138
153
  * ```ts
@@ -146,6 +161,9 @@ type AnyResult = Result<any, any>;
146
161
  */
147
162
  declare function gen<Yield extends EffectYield, Returned extends AnyResult>(body: () => Generator<Yield, Returned, unknown>): EffectFromGenerator<Yield, Returned>;
148
163
  declare function gen<Yield extends EffectYield, Returned extends AnyResult>(body: () => AsyncGenerator<Yield, Returned, unknown>): Promise<EffectFromGenerator<Yield, Returned>>;
164
+ /** Build a lazy Program without running its generator. */
165
+ declare function fn<Yield extends EffectYield, Returned extends AnyResult>(body: () => Generator<Yield, Returned, unknown>): ProgramFromGenerator<Yield, Returned>;
166
+ declare function fn<Yield extends EffectYield, Returned extends AnyResult>(body: () => AsyncGenerator<Yield, Returned, unknown>): ProgramFromGenerator<Yield, Returned>;
149
167
  /**
150
168
  * Acquire a resource in the current Scope and register its release callback.
151
169
  *
@@ -184,6 +202,8 @@ declare function add<R extends DisposableResource>(resource: R): AsyncGenerator<
184
202
  declare const Effect: {
185
203
  /** Compose a generator-based Effect program. */
186
204
  readonly gen: typeof gen;
205
+ /** Build a lazy Program from a generator. */
206
+ readonly fn: typeof fn;
187
207
  /** Acquire and register a resource in the current Scope. */
188
208
  readonly acquireRelease: typeof acquireRelease;
189
209
  /** Register an already-acquired disposable in the current Scope. */
@@ -197,24 +217,22 @@ declare const Effect: {
197
217
  /** Chain an asynchronous Effect result. */
198
218
  readonly andThenAsync: typeof andThenAsync;
199
219
  };
220
+ /** Type-level aliases for inspecting Effect result channels and requirements. */
221
+ declare namespace Effect {
222
+ /** A nominal lazy computation that produces an Effect when invoked. */
223
+ type Program<A, E, R extends AnyService = never> = LazyProgram<A, E, R>;
224
+ /** Extract the success channel from an Effect result or Promise. */
225
+ type Success<T> = EffectSuccess<T>;
226
+ /** Extract the error channel from an Effect result or Promise. */
227
+ type Error<T> = EffectError<T>;
228
+ /** Extract the Service requirements from an Effect result or Promise. */
229
+ type Requirements<T> = EffectRequirements<T>;
230
+ /** An Effect with erased success, error, and requirements. */
231
+ type Any = AnyEffect;
232
+ }
200
233
  //#endregion
201
234
  //#region src/function/pipe.d.ts
202
235
  type Unary<A, B> = (value: A) => B;
203
- /**
204
- * Compose a value through a sequence of unary functions.
205
- *
206
- * `pipe` is deliberately independent of Effect, Result, Promise, Scope, and
207
- * Service metadata.
208
- *
209
- * @example
210
- * ```ts
211
- * const label = pipe(
212
- * 'alice',
213
- * (name) => name.trim(),
214
- * (name) => name.toUpperCase()
215
- * )
216
- * ```
217
- */
218
236
  declare function pipe<A>(value: A): A;
219
237
  declare function pipe<A, B>(value: A, ab: Unary<A, B>): B;
220
238
  declare function pipe<A, B, C>(value: A, ab: Unary<A, B>, bc: Unary<B, C>): C;
@@ -263,31 +281,22 @@ type AcquireUseReleaseOptions<R, A, AcquireError, UseError> = {
263
281
  };
264
282
  //#endregion
265
283
  //#region src/resource/resource.d.ts
284
+ declare const Resource: {
285
+ /** Acquire, use, and release a resource with deterministic error precedence. */
286
+ readonly acquireUseRelease: <R, A, AcquireError, UseError>({ name, acquire, use, release, onReleaseFailure }: AcquireUseReleaseOptions<R, A, AcquireError, UseError>) => Promise<Result<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>>;
287
+ };
288
+ //#endregion
289
+ //#region src/runtime/types.d.ts
266
290
  /**
267
- * Acquire a resource, use it, and always attempt release afterward.
268
- *
269
- * Acquisition, use, and release may be synchronous or asynchronous Result
270
- * operations. If both use and release fail, the use error remains primary and
271
- * `onReleaseFailure` receives the cleanup failure as a diagnostic.
272
- *
273
- * When `release` is omitted, `Symbol.asyncDispose` is preferred over
274
- * `Symbol.dispose`.
291
+ * Name a Runtime type from a concrete Layer without repeating its provided
292
+ * branded Service instance union.
275
293
  *
276
294
  * @example
277
295
  * ```ts
278
- * const result = await Resource.acquireUseRelease({
279
- * name: 'database connection',
280
- * acquire: () => connect(),
281
- * use: (connection) => query(connection),
282
- * release: (connection) => connection.close()
283
- * })
296
+ * type AppRuntime = RuntimeFor<typeof AppLive>
284
297
  * ```
285
298
  */
286
- declare const acquireUseRelease: <R, A, AcquireError, UseError>({ name, acquire, use, release, onReleaseFailure }: AcquireUseReleaseOptions<R, A, AcquireError, UseError>) => Promise<Result<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>>;
287
- declare const Resource: {
288
- /** Acquire, use, and release a resource with deterministic error precedence. */
289
- readonly acquireUseRelease: typeof acquireUseRelease;
290
- };
299
+ type RuntimeFor<L extends LayerInput> = Runtime<Layer.Provided<L>>;
291
300
  //#endregion
292
301
  //#region src/runtime/runtime.d.ts
293
302
  /**
@@ -298,14 +307,14 @@ declare const Resource: {
298
307
  *
299
308
  * @example
300
309
  * ```ts
301
- * const runtime = await Runtime.make(AppLive, new MemoryLayerBackend())
310
+ * const runtime = await Runtime.make(AppLive)
302
311
  * const result = await runtime.run(loadUser('u1'))
303
312
  * await runtime.dispose()
304
313
  * ```
305
314
  *
306
- * @typeParam Provided The Service constructors supplied by the Layer.
315
+ * @typeParam Provided The branded Service instances supplied by the Layer.
307
316
  */
308
- declare class Runtime<Provided extends AnyServiceToken = AnyServiceToken> {
317
+ declare class Runtime<Provided extends AnyService = any> {
309
318
  private readonly handle;
310
319
  private constructor();
311
320
  /**
@@ -313,19 +322,22 @@ declare class Runtime<Provided extends AnyServiceToken = AnyServiceToken> {
313
322
  *
314
323
  * @example
315
324
  * ```ts
316
- * const runtime = await Runtime.make(AppLive, backend)
325
+ * const runtime = await Runtime.make(AppLive)
317
326
  * const result = await runtime.run(program)
318
327
  * await runtime.dispose()
319
328
  * ```
320
329
  */
321
- static make<L extends AnyLayer>(layer: CompleteLayer<L>, backend: LayerBackend, options?: RuntimeOptions): Promise<Runtime<LayerProvided<L>>>;
330
+ static make<L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, options?: RuntimeOptions): Promise<Runtime<ProvidedEnvironment<L>>>;
331
+ static make<L extends LayerInput>(layer: L & CompleteInput<L>, options?: RuntimeOptions): Promise<Runtime<ProvidedEnvironment<L>>>;
322
332
  /**
323
333
  * Run one program and dispose its Layer resources before resolving.
324
334
  *
325
335
  * This is convenient for request-style or command-style execution where a
326
336
  * Runtime should not outlive the operation.
327
337
  */
328
- static run<A, L extends AnyLayer>(layer: CompleteLayer<L>, backend: LayerBackend, program: CompleteExecution<LayerProvided<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
338
+ static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
339
+ static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
340
+ static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, options: RuntimeOptions, program: CompleteExecution<ProvidedEnvironment<L>, A>): Promise<Awaited<A>>;
329
341
  /** Run one execution in this Runtime's child Scope. */
330
342
  run<A>(program: CompleteExecution<Provided, A>): Promise<Awaited<A>>;
331
343
  private runUnchecked;
@@ -333,18 +345,15 @@ declare class Runtime<Provided extends AnyServiceToken = AnyServiceToken> {
333
345
  dispose(): Promise<void>;
334
346
  private disposeWithOutcome;
335
347
  }
348
+ /** Type-level aliases for naming Runtime handles and shutdown options. */
349
+ declare namespace Runtime {
350
+ /** Name a Runtime type from a concrete Layer. */
351
+ type For<L extends LayerInput> = RuntimeFor<L>;
352
+ /** Optional Runtime shutdown configuration. */
353
+ type Options = RuntimeOptions;
354
+ /** Diagnostic reported for aggregated Runtime shutdown cleanup failures. */
355
+ type ShutdownDiagnostic = RuntimeShutdownDiagnostic;
356
+ }
336
357
  //#endregion
337
- //#region src/runtime/types.d.ts
338
- /**
339
- * Name a Runtime type from a concrete Layer without repeating its provided
340
- * Service constructor union.
341
- *
342
- * @example
343
- * ```ts
344
- * type AppRuntime = RuntimeFor<typeof AppLive>
345
- * ```
346
- */
347
- type RuntimeFor<L extends AnyLayer> = Runtime<LayerProvided<L>>;
348
- //#endregion
349
- export { type AcquireUseReleaseOptions, type AnyEffectResult, type AnyServiceToken, type AsyncResult, 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, type LayerRegistration, 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 ServiceTag, ServiceTagCollisionError, type ServiceToken, pipe };
358
+ export { type AcquireUseReleaseOptions, type AnyEffect, type AnyService, type AnyServiceToken, type AsyncResult, CircularDependencyError, 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, MapLayerBackend, type Program, type ReleaseFailureObserver, type ReleaseOutcome, Resource, ResourceNotDisposableError, ResourceReleaseFailure, Runtime, type RuntimeFor, type RuntimeOptions, type RuntimeShutdownDiagnostic, Scope, ScopeCloseError, ScopeClosedError, type ScopeFinalizer, type ScopeOutcome, ScopeRuntimeNotConfiguredError, Service, ServiceAcquisitionError, 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 };
350
359
  //# 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/resource.ts","../src/runtime/runtime.ts","../src/runtime/types.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;;;;KCnOpE,YAAY,GAAG,GAAG,gBACnB,aAAa,GAAG,GAAG,gBACnB,YAAY,aAAa,GAAG,GAAG;KAE9B,iBAAiB;KACjB,oBAAkB;KAClB,sBAAsB,YAAY;KAElC,cAAc,OAAO,UAAU,cAAc,uBAAuB,QAAQ,UAAU;KAEtF,aAAa,OAAO,KAAK,aAAa,GAAG,YAAY,QAAQ,mBAAmB;KAEhF,kBAAkB,OAAO,MAAM,aAClC,cAAc,QACd,IACA,mBAAmB;KAGhB,cAAc,OAAO,QAAQ,aAChC,cAAc,OACd,YAAY,SAAS,YAAY,OACjC,mBAAmB,SAAS,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GAAG;;KAG/C,wBAAwB;;KAGxB,0BAA0B,SAAS,2BAA2B;;KAG9D,yBAAyB,GAAG,GAAG,cAAc;;WAE9C;;WAGA,eAAe,YAAY,GAAG;;WAG9B,MAAM,UAAU,MAAM,YAAY,GAAG;;WAGrC,WAAW,UAAU,MAAM,aAAa;;;;;WAMxC,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;cCNxB,oBAAqB,GAAG,GAAG,cAAc,YAAQ,MAAA,SAAA,KAAA,SAAA,oBAMpD,yBAAyB,GAAG,GAAG,cAAc,cAAY,QAC1D,OAAW,GAAG,eAAe,WAAW,qBAAqB;cAoBlD;;qCAAA;;;;;;;;;;;;;;;;;;;cC5BA,QAAQ,iBAAiB,kBAAkB;mBACjB;UAA9B;;;;;;;;;;;SAYM,KAAK,UAAU,UAC1B,OAAO,cAAc,IACrB,SAAS,cACT,UAAS,iBACR,QAAQ,QAAQ,cAAc;;;;;;;SAYpB,IAAI,GAAG,UAAU,UAC5B,OAAO,cAAc,IACrB,SAAS,cACT,SAAS,kBAAkB,cAAc,IAAI,IAC7C,UAAS,iBACR,QAAQ,QAAQ;;EAqDnB,IAAI,GAAG,SAAS,kBAAkB,UAAU,KAAK,QAAQ,QAAQ;UAIzD;;EAKR,WAAW;UAIH;;;;;;;;;;;;;KCpHE,WAAW,UAAU,YAAY,QAAQ,cAAc"}
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/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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