better-effect 0.10.0 → 0.12.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/README.md +464 -11
- package/dist/adapters/iti.d.mts +4 -4
- package/dist/adapters/iti.d.mts.map +1 -1
- package/dist/adapters/iti.mjs +20 -14
- package/dist/adapters/iti.mjs.map +1 -1
- package/dist/effect-CK4YZaX0.mjs +559 -0
- package/dist/effect-CK4YZaX0.mjs.map +1 -0
- package/dist/hono.d.mts +18 -13
- package/dist/hono.d.mts.map +1 -1
- package/dist/hono.mjs +9 -5
- package/dist/hono.mjs.map +1 -1
- package/dist/{index-DklNCz7w.d.mts → index-B1nH4luq.d.mts} +74 -7
- package/dist/index-B1nH4luq.d.mts.map +1 -0
- package/dist/index-BMdU_Z72.d.mts +18 -0
- package/dist/index-BMdU_Z72.d.mts.map +1 -0
- package/dist/{index-BafDna0B.d.mts → index-CX6iAoCB.d.mts} +168 -174
- package/dist/index-CX6iAoCB.d.mts.map +1 -0
- package/dist/index-GYJ4qm9K.d.mts +179 -0
- package/dist/index-GYJ4qm9K.d.mts.map +1 -0
- package/dist/{index-CULgSzUw.d.mts → index-heuaRmXR.d.mts} +5 -5
- package/dist/{index-CULgSzUw.d.mts.map → index-heuaRmXR.d.mts.map} +1 -1
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +9 -539
- package/dist/index.mjs.map +1 -1
- package/dist/{internal-identity-DmUpBeeL.mjs → internal-identity-CbXoZIfw.mjs} +3 -3
- package/dist/internal-identity-CbXoZIfw.mjs.map +1 -0
- package/dist/{signal-C1bagvrO.mjs → layer-D56fRdLt.mjs} +62 -64
- package/dist/layer-D56fRdLt.mjs.map +1 -0
- package/dist/node-context-DWsCUBRa.d.mts +12 -0
- package/dist/node-context-DWsCUBRa.d.mts.map +1 -0
- package/dist/node-context-lggRF4bR.mjs +25 -0
- package/dist/node-context-lggRF4bR.mjs.map +1 -0
- package/dist/node.d.mts +51 -0
- package/dist/node.d.mts.map +1 -0
- package/dist/node.mjs +233 -0
- package/dist/node.mjs.map +1 -0
- package/dist/{index-C7KX5rAP.d.mts → outcome-CB43bnFW.d.mts} +140 -27
- package/dist/outcome-CB43bnFW.d.mts.map +1 -0
- package/dist/program-metadata-DhQCCirO.mjs +260 -0
- package/dist/program-metadata-DhQCCirO.mjs.map +1 -0
- package/dist/registration-drnZk0SY.mjs +182 -0
- package/dist/registration-drnZk0SY.mjs.map +1 -0
- package/dist/runtime/explicit.d.mts +1 -1
- package/dist/runtime/node.d.mts +3 -12
- package/dist/runtime/node.mjs +2 -24
- package/dist/runtime-CBMrX8Wl.mjs +776 -0
- package/dist/runtime-CBMrX8Wl.mjs.map +1 -0
- package/dist/signal-D2UTcaaG.mjs +105 -0
- package/dist/signal-D2UTcaaG.mjs.map +1 -0
- package/dist/{standard-services-DW-i4UuA.mjs → standard-services-GBZ32tll.mjs} +200 -16
- package/dist/standard-services-GBZ32tll.mjs.map +1 -0
- package/dist/standard-services.d.mts +3 -3
- package/dist/standard-services.mjs +3 -3
- package/dist/testing.d.mts +257 -2
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +1159 -2
- package/dist/testing.mjs.map +1 -0
- package/package.json +8 -3
- package/dist/effect-DAMqvegy.mjs +0 -544
- package/dist/effect-DAMqvegy.mjs.map +0 -1
- package/dist/errors-Dnjhzbt0.mjs +0 -99
- package/dist/errors-Dnjhzbt0.mjs.map +0 -1
- package/dist/index-BafDna0B.d.mts.map +0 -1
- package/dist/index-C7KX5rAP.d.mts.map +0 -1
- package/dist/index-DklNCz7w.d.mts.map +0 -1
- package/dist/internal-identity-DmUpBeeL.mjs.map +0 -1
- package/dist/map-layer-backend-gal-mcRv.mjs +0 -53
- package/dist/map-layer-backend-gal-mcRv.mjs.map +0 -1
- package/dist/map-layer-backend-rNwfH0Bz.d.mts +0 -42
- package/dist/map-layer-backend-rNwfH0Bz.d.mts.map +0 -1
- package/dist/runtime/node.d.mts.map +0 -1
- package/dist/runtime/node.mjs.map +0 -1
- package/dist/signal-C1bagvrO.mjs.map +0 -1
- package/dist/standard-services-DW-i4UuA.mjs.map +0 -1
|
@@ -1,96 +1,5 @@
|
|
|
1
|
-
import { A as ProgramFromGenerator, C as EffectError, D as EffectYield, E as EffectSuccess, M as AnyService, S as Effect$1, T as EffectRequirements, f as DisposableResource, h as ScopeOutcome, k as Program$1, p as MaybePromise
|
|
2
|
-
import { S as LayerInput, T as ProvidedEnvironment, _ as Layer, a as RuntimeShutdownDiagnostic, b as CompleteInput, i as RuntimeRunOptions, n as RuntimeDisposeOptions, r as RuntimeOptions, v as CompleteExecution, y as CompleteExecutionLayer } from "./index-C7KX5rAP.mjs";
|
|
3
|
-
import { n as LayerBackend } from "./map-layer-backend-rNwfH0Bz.mjs";
|
|
1
|
+
import { A as ProgramFromGenerator, C as EffectError, D as EffectYield, E as EffectSuccess, M as AnyService, S as Effect$1, T as EffectRequirements, f as DisposableResource, h as ScopeOutcome, k as Program$1, p as MaybePromise, w as EffectFromGenerator, x as AnyEffect } from "./index-heuaRmXR.mjs";
|
|
4
2
|
import { Err, Result, UnhandledException } from "better-result";
|
|
5
|
-
//#region src/runtime/types.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Name a Runtime type from a concrete Layer without repeating its provided
|
|
8
|
-
* branded Service instance union.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* type AppRuntime = RuntimeFor<typeof AppLive>
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
type RuntimeFor<L extends LayerInput> = Runtime<Layer.Provided<L>>;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/runtime/runtime.d.ts
|
|
18
|
-
/**
|
|
19
|
-
* Long-lived execution environment backed by a complete Layer.
|
|
20
|
-
*
|
|
21
|
-
* A Runtime owns Layer resources until `dispose()` is called. Each `run()` is
|
|
22
|
-
* isolated in a child Scope, while Layer-scoped resources remain shared.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* const runtime = await Runtime.make(AppLive)
|
|
27
|
-
* const result = await runtime.run(loadUser('u1'))
|
|
28
|
-
* await runtime.dispose()
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @typeParam Provided The branded Service instances supplied by the Layer.
|
|
32
|
-
*/
|
|
33
|
-
declare class Runtime<Provided extends AnyService = any> {
|
|
34
|
-
private readonly handle;
|
|
35
|
-
private constructor();
|
|
36
|
-
/**
|
|
37
|
-
* Create a long-lived Runtime that owns its Layer resources.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* const runtime = await Runtime.make(AppLive)
|
|
42
|
-
* const result = await runtime.run(program)
|
|
43
|
-
* await runtime.dispose()
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
static make<L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, options?: RuntimeOptions): Promise<Runtime<ProvidedEnvironment<L>>>;
|
|
47
|
-
static make<L extends LayerInput>(layer: L & CompleteInput<L>, options?: RuntimeOptions): Promise<Runtime<ProvidedEnvironment<L>>>;
|
|
48
|
-
/**
|
|
49
|
-
* Run one program and dispose its Layer resources before resolving.
|
|
50
|
-
*
|
|
51
|
-
* This is convenient for request-style or command-style execution where a
|
|
52
|
-
* Runtime should not outlive the operation.
|
|
53
|
-
*/
|
|
54
|
-
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
55
|
-
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
56
|
-
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, options: RuntimeOptions, program: CompleteExecution<ProvidedEnvironment<L>, A>): Promise<Awaited<A>>;
|
|
57
|
-
/** Run a callback with a managed Runtime and always dispose it afterward. */
|
|
58
|
-
static use<A, L extends LayerInput>(layer: L & CompleteInput<L>, use: (runtime: Runtime<ProvidedEnvironment<L>>) => A | PromiseLike<A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
59
|
-
/** Resolve every Layer provider and dispose the Runtime if warmup fails. */
|
|
60
|
-
warmup(): Promise<void>;
|
|
61
|
-
/** Run one execution in this Runtime's child Scope. */
|
|
62
|
-
run<A>(program: CompleteExecution<Provided, A>, options?: RuntimeRunOptions): Promise<Awaited<A>>;
|
|
63
|
-
/** Run one execution with a Layer owned by that execution's child Scope. */
|
|
64
|
-
runWith<Request extends LayerInput, A>(layer: Request & CompleteExecutionLayer<Provided, Request>, program: CompleteExecution<Provided | ProvidedEnvironment<Request>, A>, options?: RuntimeRunOptions): Promise<Awaited<A>>;
|
|
65
|
-
private runUnchecked;
|
|
66
|
-
/** Stop new executions and release the Runtime's Layer resources. */
|
|
67
|
-
dispose(options?: RuntimeDisposeOptions): Promise<void>;
|
|
68
|
-
/** @deprecated Scope outcomes are kept for internal compatibility. */
|
|
69
|
-
dispose(outcome: ScopeOutcome): Promise<void>;
|
|
70
|
-
/** Release Runtime-owned resources through JavaScript's async disposal protocol. */
|
|
71
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
72
|
-
private disposeWithOutcome;
|
|
73
|
-
}
|
|
74
|
-
/** Type-level aliases for naming Runtime handles and shutdown options. */
|
|
75
|
-
declare namespace Runtime {
|
|
76
|
-
/** Name a Runtime type from a concrete Layer. */
|
|
77
|
-
type For<L extends LayerInput> = RuntimeFor<L>;
|
|
78
|
-
/** Optional Runtime shutdown configuration. */
|
|
79
|
-
type Options = RuntimeOptions;
|
|
80
|
-
/** Optional signal supplied to one managed Runtime execution. */
|
|
81
|
-
type RunOptions = RuntimeRunOptions;
|
|
82
|
-
/** Cooperative shutdown policy for a managed Runtime. */
|
|
83
|
-
type DisposeOptions = RuntimeDisposeOptions;
|
|
84
|
-
/** Diagnostic reported for aggregated Runtime shutdown cleanup failures. */
|
|
85
|
-
type ShutdownDiagnostic = RuntimeShutdownDiagnostic;
|
|
86
|
-
}
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/runtime/signal.d.ts
|
|
89
|
-
/** Yieldable access to the signal of the current Runtime execution. */
|
|
90
|
-
declare const CurrentAbortSignal: {
|
|
91
|
-
readonly [Symbol.iterator]: () => Generator<never, AbortSignal, unknown>;
|
|
92
|
-
};
|
|
93
|
-
//#endregion
|
|
94
3
|
//#region src/effect/combinators.d.ts
|
|
95
4
|
type EffectInput<A, E> = Result<A, E> | PromiseLike<Result<A, E>>;
|
|
96
5
|
type AnyEffectInput = EffectInput<any, any>;
|
|
@@ -102,13 +11,13 @@ type ErrorMappedResult<Input, E2> = Effect$1<EffectSuccess<Input>, E2, EffectReq
|
|
|
102
11
|
type ChainedResult<First, Next> = Effect$1<EffectSuccess<Next>, EffectError<First> | EffectError<Next>, EffectRequirements<First> | EffectRequirements<Next>>;
|
|
103
12
|
type ChainedOutput<First, Next> = ChainedResult<First, Next>;
|
|
104
13
|
type AsyncChainedOutput<First, Next> = Promise<ChainedResult<First, Next>>;
|
|
105
|
-
type MapOperation<A, B> = {
|
|
14
|
+
type MapOperation$1<A, B> = {
|
|
106
15
|
<Input>(effect: Input & EffectInput<A, any>): PreserveAsync<Input, MappedResult<Input, B>>;
|
|
107
16
|
};
|
|
108
|
-
type MapErrorOperation<E1, E2> = {
|
|
17
|
+
type MapErrorOperation$1<E1, E2> = {
|
|
109
18
|
<Input>(effect: Input & EffectInput<any, E1>): PreserveAsync<Input, ErrorMappedResult<Input, E2>>;
|
|
110
19
|
};
|
|
111
|
-
type AndThenOperation<Next> = {
|
|
20
|
+
type AndThenOperation$1<Next> = {
|
|
112
21
|
<Input>(effect: Input & AnyEffectValue): ChainedOutput<Input, Next>;
|
|
113
22
|
};
|
|
114
23
|
type AndThenAsyncOperation<A, Next> = {
|
|
@@ -121,10 +30,10 @@ type AsResult<Input, Value> = Effect$1<Value, EffectError<Input>, EffectRequirem
|
|
|
121
30
|
type MatchedResult<Input, OkResult, ErrResult> = Effect$1<EffectSuccess<OkResult> | EffectSuccess<ErrResult>, EffectError<OkResult> | EffectError<ErrResult>, EffectRequirements<Input> | EffectRequirements<OkResult> | EffectRequirements<ErrResult>>;
|
|
122
31
|
type AllResult<Results extends readonly AnyEffectValue[]> = Effect$1<{ -readonly [Index in keyof Results]: EffectSuccess<Results[Index]>; }, EffectError<Results[number]>, EffectRequirements<Results[number]>>;
|
|
123
32
|
type ZipResult<Left, Right> = Effect$1<[EffectSuccess<Left>, EffectSuccess<Right>], EffectError<Left> | EffectError<Right>, EffectRequirements<Left> | EffectRequirements<Right>>;
|
|
124
|
-
type TapOperation = {
|
|
33
|
+
type TapOperation$1 = {
|
|
125
34
|
<Input>(effect: Input & AnyEffectInput, fn: (value: EffectSuccess<Input>) => void): PreserveAsync<Input, TappedResult<Input>>;
|
|
126
35
|
};
|
|
127
|
-
type TapErrorOperation = {
|
|
36
|
+
type TapErrorOperation$1 = {
|
|
128
37
|
<Input>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => void): PreserveAsync<Input, TappedResult<Input>>;
|
|
129
38
|
};
|
|
130
39
|
type TapBothOperation = {
|
|
@@ -133,7 +42,31 @@ type TapBothOperation = {
|
|
|
133
42
|
err: (error: EffectError<Input>) => void;
|
|
134
43
|
}): PreserveAsync<Input, TappedResult<Input>>;
|
|
135
44
|
};
|
|
136
|
-
type
|
|
45
|
+
type TapAsyncOperation = {
|
|
46
|
+
<Input>(effect: Input & AnyEffectInput): Promise<TappedResult<Input>>;
|
|
47
|
+
};
|
|
48
|
+
type TapErrorAsyncOperation = {
|
|
49
|
+
<Input>(effect: Input & AnyEffectInput): Promise<TappedResult<Input>>;
|
|
50
|
+
};
|
|
51
|
+
type TapBothAsyncOperation = {
|
|
52
|
+
<Input>(effect: Input & AnyEffectInput): Promise<TappedResult<Input>>;
|
|
53
|
+
};
|
|
54
|
+
type TaggedErrorLike = Error & {
|
|
55
|
+
readonly _tag: string;
|
|
56
|
+
};
|
|
57
|
+
type TaggedErrorHandlers<ErrorValue extends TaggedErrorLike> = { [Tag in ErrorValue['_tag']]: (error: Extract<ErrorValue, {
|
|
58
|
+
readonly _tag: Tag;
|
|
59
|
+
}>) => unknown; };
|
|
60
|
+
type TaggedErrorOf<Input> = Extract<EffectError<Input>, TaggedErrorLike>;
|
|
61
|
+
type TaggedErrorHandlersFor<Input> = [EffectError<Input>] extends [TaggedErrorLike] ? TaggedErrorHandlers<TaggedErrorOf<Input>> : never;
|
|
62
|
+
type HandlerReturn<Handlers> = { [Key in keyof Handlers]-?: NonNullable<Handlers[Key]> extends ((error: never) => infer Return) ? Return : never; }[keyof Handlers];
|
|
63
|
+
type RequiredHandlerKeys<Handlers> = { [Key in keyof Handlers]-?: {} extends Pick<Handlers, Key> ? never : undefined extends Handlers[Key] ? never : Key; }[keyof Handlers];
|
|
64
|
+
type UnhandledTaggedErrors<ErrorValue extends TaggedErrorLike, Handlers> = Exclude<ErrorValue, {
|
|
65
|
+
readonly _tag: Extract<RequiredHandlerKeys<Handlers>, ErrorValue['_tag']>;
|
|
66
|
+
}>;
|
|
67
|
+
type MatchErrorResult<Input, Handlers> = Effect$1<EffectSuccess<Input>, HandlerReturn<Handlers>, EffectRequirements<Input>>;
|
|
68
|
+
type MatchErrorPartialResult<Input, Handlers> = Effect$1<EffectSuccess<Input>, HandlerReturn<Handlers> | UnhandledTaggedErrors<TaggedErrorOf<Input>, Handlers>, EffectRequirements<Input>>;
|
|
69
|
+
type RecoverOperation$1<Next> = {
|
|
137
70
|
<Input>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => Next): PreserveAsync<Input, RecoveredResult<Input, Next>>;
|
|
138
71
|
};
|
|
139
72
|
type RecoverAsyncOperation<Next> = {
|
|
@@ -151,8 +84,8 @@ type RecoverAsyncOperation<Next> = {
|
|
|
151
84
|
* const toLabel = Effect.map((value: number) => `#${value}`)
|
|
152
85
|
* ```
|
|
153
86
|
*/
|
|
154
|
-
declare function map<A, B>(fn: (value: A) => B): MapOperation<A, B>;
|
|
155
|
-
declare function map<Input, B>(effect: Input & AnyEffectInput, fn: (value: EffectSuccess<Input>) => B): PreserveAsync<Input, MappedResult<Input, B>>;
|
|
87
|
+
declare function map$1<A, B>(fn: (value: A) => B): MapOperation$1<A, B>;
|
|
88
|
+
declare function map$1<Input, B>(effect: Input & AnyEffectInput, fn: (value: EffectSuccess<Input>) => B): PreserveAsync<Input, MappedResult<Input, B>>;
|
|
156
89
|
/**
|
|
157
90
|
* Map the error value of a Result or Effect result while preserving its
|
|
158
91
|
* successful value, asynchronous shape, and declaration-only Service requirements.
|
|
@@ -162,8 +95,8 @@ declare function map<Input, B>(effect: Input & AnyEffectInput, fn: (value: Effec
|
|
|
162
95
|
* const labelled = Effect.mapError(Result.err('missing'), (error) => ({ error }))
|
|
163
96
|
* ```
|
|
164
97
|
*/
|
|
165
|
-
declare function mapError<E1, E2>(fn: (error: E1) => E2): MapErrorOperation<E1, E2>;
|
|
166
|
-
declare function mapError<Input, E2>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => E2): PreserveAsync<Input, ErrorMappedResult<Input, E2>>;
|
|
98
|
+
declare function mapError$1<E1, E2>(fn: (error: E1) => E2): MapErrorOperation$1<E1, E2>;
|
|
99
|
+
declare function mapError$1<Input, E2>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => E2): PreserveAsync<Input, ErrorMappedResult<Input, E2>>;
|
|
167
100
|
/**
|
|
168
101
|
* Chain a synchronous Result-producing operation after a successful result.
|
|
169
102
|
*
|
|
@@ -175,8 +108,8 @@ declare function mapError<Input, E2>(effect: Input & AnyEffectInput, fn: (error:
|
|
|
175
108
|
* const user = Effect.andThen(Result.ok('u1'), (id) => repository.find(id))
|
|
176
109
|
* ```
|
|
177
110
|
*/
|
|
178
|
-
declare function andThen<A, Next extends AnyEffectValue>(next: (value: A) => Next): AndThenOperation<Next>;
|
|
179
|
-
declare function andThen<Input, Next extends AnyEffectValue>(effect: Input & AnyEffectValue, next: (value: EffectSuccess<Input>) => Next): ChainedOutput<Input, Next>;
|
|
111
|
+
declare function andThen$1<A, Next extends AnyEffectValue>(next: (value: A) => Next): AndThenOperation$1<Next>;
|
|
112
|
+
declare function andThen$1<Input, Next extends AnyEffectValue>(effect: Input & AnyEffectValue, next: (value: EffectSuccess<Input>) => Next): ChainedOutput<Input, Next>;
|
|
180
113
|
/**
|
|
181
114
|
* Chain an asynchronous Result-producing operation after a successful result.
|
|
182
115
|
*
|
|
@@ -191,11 +124,11 @@ declare function andThen<Input, Next extends AnyEffectValue>(effect: Input & Any
|
|
|
191
124
|
declare function andThenAsync<A, Next extends AnyAsyncEffectInput>(next: (value: A) => Next): AndThenAsyncOperation<A, Next>;
|
|
192
125
|
declare function andThenAsync<Input, Next extends AnyAsyncEffectInput>(effect: Input & AnyEffectInput, next: (value: EffectSuccess<Input>) => Next): AsyncChainedOutput<Input, Next>;
|
|
193
126
|
/** Observe a successful value without changing the Result. */
|
|
194
|
-
declare function tap(fn: (value: any) => void): TapOperation;
|
|
195
|
-
declare function tap<Input>(effect: Input & AnyEffectInput, fn: (value: EffectSuccess<Input>) => void): PreserveAsync<Input, TappedResult<Input>>;
|
|
127
|
+
declare function tap$1(fn: (value: any) => void): TapOperation$1;
|
|
128
|
+
declare function tap$1<Input>(effect: Input & AnyEffectInput, fn: (value: EffectSuccess<Input>) => void): PreserveAsync<Input, TappedResult<Input>>;
|
|
196
129
|
/** Observe an error value without changing the Result. */
|
|
197
|
-
declare function tapError(fn: (error: any) => void): TapErrorOperation;
|
|
198
|
-
declare function tapError<Input>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => void): PreserveAsync<Input, TappedResult<Input>>;
|
|
130
|
+
declare function tapError$1(fn: (error: any) => void): TapErrorOperation$1;
|
|
131
|
+
declare function tapError$1<Input>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => void): PreserveAsync<Input, TappedResult<Input>>;
|
|
199
132
|
/** Observe whichever Result branch is active without changing the Result. */
|
|
200
133
|
declare function tapBoth(handlers: {
|
|
201
134
|
ok: (value: any) => void;
|
|
@@ -205,9 +138,28 @@ declare function tapBoth<Input>(effect: Input & AnyEffectInput, handlers: {
|
|
|
205
138
|
ok: (value: EffectSuccess<Input>) => void;
|
|
206
139
|
err: (error: EffectError<Input>) => void;
|
|
207
140
|
}): PreserveAsync<Input, TappedResult<Input>>;
|
|
141
|
+
/** Observe a successful value asynchronously without changing the Result. */
|
|
142
|
+
declare function tapAsync(fn: (value: any) => PromiseLike<void>): TapAsyncOperation;
|
|
143
|
+
declare function tapAsync<Input>(effect: Input & AnyEffectInput, fn: (value: EffectSuccess<Input>) => PromiseLike<void>): Promise<TappedResult<Input>>;
|
|
144
|
+
/** Observe an error value asynchronously without changing the Result. */
|
|
145
|
+
declare function tapErrorAsync(fn: (error: any) => PromiseLike<void>): TapErrorAsyncOperation;
|
|
146
|
+
declare function tapErrorAsync<Input>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => PromiseLike<void>): Promise<TappedResult<Input>>;
|
|
147
|
+
/** Observe the active Result branch asynchronously without changing the Result. */
|
|
148
|
+
declare function tapBothAsync(handlers: {
|
|
149
|
+
ok: (value: any) => PromiseLike<void>;
|
|
150
|
+
err: (error: any) => PromiseLike<void>;
|
|
151
|
+
}): TapBothAsyncOperation;
|
|
152
|
+
declare function tapBothAsync<Input>(effect: Input & AnyEffectInput, handlers: {
|
|
153
|
+
ok: (value: EffectSuccess<Input>) => PromiseLike<void>;
|
|
154
|
+
err: (error: EffectError<Input>) => PromiseLike<void>;
|
|
155
|
+
}): Promise<TappedResult<Input>>;
|
|
156
|
+
/** Match every tagged error variant and map it to a new error value. */
|
|
157
|
+
declare function matchError$1<Input, Handlers extends TaggedErrorHandlersFor<Input>>(effect: Input & AnyEffectInput, handlers: Handlers): PreserveAsync<Input, MatchErrorResult<Input, Handlers>>;
|
|
158
|
+
/** Match selected tagged errors and retain unhandled variants unchanged. */
|
|
159
|
+
declare function matchErrorPartial$1<Input, Handlers extends Partial<TaggedErrorHandlersFor<Input>>>(effect: Input & AnyEffectInput, handlers: Handlers): PreserveAsync<Input, MatchErrorPartialResult<Input, Handlers>>;
|
|
208
160
|
/** Recover an Err with a synchronous Result-producing callback. */
|
|
209
|
-
declare function recover<Next extends AnyEffectValue>(fn: (error: any) => Next): RecoverOperation<Next>;
|
|
210
|
-
declare function recover<Input, Next extends AnyEffectValue>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => Next): PreserveAsync<Input, RecoveredResult<Input, Next>>;
|
|
161
|
+
declare function recover$1<Next extends AnyEffectValue>(fn: (error: any) => Next): RecoverOperation$1<Next>;
|
|
162
|
+
declare function recover$1<Input, Next extends AnyEffectValue>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => Next): PreserveAsync<Input, RecoveredResult<Input, Next>>;
|
|
211
163
|
/** Recover an Err with an asynchronous Result-producing callback. */
|
|
212
164
|
declare function recoverAsync<Next extends AnyAsyncEffectInput>(fn: (error: any) => Next): RecoverAsyncOperation<Next>;
|
|
213
165
|
declare function recoverAsync<Input, Next extends AnyAsyncEffectInput>(effect: Input & AnyEffectInput, fn: (error: EffectError<Input>) => Next): Promise<RecoveredResult<Input, Next>>;
|
|
@@ -232,6 +184,56 @@ declare function all<const Results extends readonly AnyEffectValue[]>(results: R
|
|
|
232
184
|
/** Combine two already-created Effects in input order. */
|
|
233
185
|
declare function zip<Left, Right>(left: Left & AnyEffectValue, right: Right & AnyEffectValue): ZipResult<Left, Right>;
|
|
234
186
|
//#endregion
|
|
187
|
+
//#region src/effect/program-combinators.d.ts
|
|
188
|
+
type AnyResult$1 = Result<any, any>;
|
|
189
|
+
type RuntimeEffect = AnyResult$1 | PromiseLike<AnyResult$1>;
|
|
190
|
+
type RuntimeProgram = () => RuntimeEffect;
|
|
191
|
+
type ProgramInput<Input extends RuntimeProgram> = Input & Program$1<EffectSuccess<Input>, EffectError<Input>, EffectRequirements<Input>>;
|
|
192
|
+
type CompatibleSuccess<Input, A> = EffectSuccess<Input> extends A ? unknown : never;
|
|
193
|
+
type CompatibleError<Input, E> = EffectError<Input> extends E ? unknown : never;
|
|
194
|
+
type ProgramOutput<Output> = Output extends Program$1<infer _Success, infer _Error, infer _Requirements extends AnyService> ? Output : Output extends PromiseLike<infer AsyncOutput> ? AsyncOutput extends Result<infer _Success, infer _Error> ? Output : never : Output extends Result<infer _Success, infer _Error> ? Output : never;
|
|
195
|
+
type MappedProgram<Input, B> = Program$1<B, EffectError<Input>, EffectRequirements<Input>>;
|
|
196
|
+
type ErrorMappedProgram<Input, E2> = Program$1<EffectSuccess<Input>, E2, EffectRequirements<Input>>;
|
|
197
|
+
type ChainedProgram<Input, Next> = Program$1<EffectSuccess<Next>, EffectError<Input> | EffectError<Next>, EffectRequirements<Input> | EffectRequirements<Next>>;
|
|
198
|
+
type TappedProgram<Input> = Program$1<EffectSuccess<Input>, EffectError<Input>, EffectRequirements<Input>>;
|
|
199
|
+
type RecoveredProgram<Input, Next> = Program$1<EffectSuccess<Input> | EffectSuccess<Next>, EffectError<Next>, EffectRequirements<Input> | EffectRequirements<Next>>;
|
|
200
|
+
type MapOperation<A, B> = {
|
|
201
|
+
<Input extends RuntimeProgram>(program: ProgramInput<Input> & CompatibleSuccess<Input, A>): MappedProgram<Input, B>;
|
|
202
|
+
};
|
|
203
|
+
type MapErrorOperation<E1, E2> = {
|
|
204
|
+
<Input extends RuntimeProgram>(program: ProgramInput<Input> & CompatibleError<Input, E1>): ErrorMappedProgram<Input, E2>;
|
|
205
|
+
};
|
|
206
|
+
type AndThenOperation<A, Next> = {
|
|
207
|
+
<Input extends RuntimeProgram>(program: ProgramInput<Input> & CompatibleSuccess<Input, A>): ChainedProgram<Input, Next>;
|
|
208
|
+
};
|
|
209
|
+
type TapOperation<A> = {
|
|
210
|
+
<Input extends RuntimeProgram>(program: ProgramInput<Input> & CompatibleSuccess<Input, A>): TappedProgram<Input>;
|
|
211
|
+
};
|
|
212
|
+
type TapErrorOperation<E> = {
|
|
213
|
+
<Input extends RuntimeProgram>(program: ProgramInput<Input> & CompatibleError<Input, E>): TappedProgram<Input>;
|
|
214
|
+
};
|
|
215
|
+
type RecoverOperation<E, Next> = {
|
|
216
|
+
<Input extends RuntimeProgram>(program: ProgramInput<Input> & CompatibleError<Input, E>): RecoveredProgram<Input, Next>;
|
|
217
|
+
};
|
|
218
|
+
/** Lazily map the successful Result value of a Program. */
|
|
219
|
+
declare function map<A, B>(fn: (value: A) => B): MapOperation<A, B>;
|
|
220
|
+
declare function map<Input extends RuntimeProgram, B>(program: ProgramInput<Input>, fn: (value: EffectSuccess<Input>) => B): MappedProgram<Input, B>;
|
|
221
|
+
/** Lazily map the error Result value of a Program. */
|
|
222
|
+
declare function mapError<E1, E2>(fn: (error: E1) => E2): MapErrorOperation<E1, E2>;
|
|
223
|
+
declare function mapError<Input extends RuntimeProgram, E2>(program: ProgramInput<Input>, fn: (error: EffectError<Input>) => E2): ErrorMappedProgram<Input, E2>;
|
|
224
|
+
/** Lazily continue a successful Program with an Effect or Program. */
|
|
225
|
+
declare function andThen<A, Next>(next: (value: A) => Next & ProgramOutput<Next>): AndThenOperation<A, Next>;
|
|
226
|
+
declare function andThen<Input extends RuntimeProgram, Next>(program: ProgramInput<Input>, next: (value: EffectSuccess<Input>) => Next & ProgramOutput<Next>): ChainedProgram<Input, Next>;
|
|
227
|
+
/** Lazily observe a successful Program value without changing its Result. */
|
|
228
|
+
declare function tap<A>(fn: (value: A) => void): TapOperation<A>;
|
|
229
|
+
declare function tap<Input extends RuntimeProgram>(program: ProgramInput<Input>, fn: (value: EffectSuccess<Input>) => void): TappedProgram<Input>;
|
|
230
|
+
/** Lazily observe a failed Program value without changing its Result. */
|
|
231
|
+
declare function tapError<E>(fn: (error: E) => void): TapErrorOperation<E>;
|
|
232
|
+
declare function tapError<Input extends RuntimeProgram>(program: ProgramInput<Input>, fn: (error: EffectError<Input>) => void): TappedProgram<Input>;
|
|
233
|
+
/** Lazily recover a failed Program with an Effect or Program. */
|
|
234
|
+
declare function recover<E, Next>(fn: (error: E) => Next & ProgramOutput<Next>): RecoverOperation<E, Next>;
|
|
235
|
+
declare function recover<Input extends RuntimeProgram, Next>(program: ProgramInput<Input>, recover: (error: EffectError<Input>) => Next & ProgramOutput<Next>): RecoveredProgram<Input, Next>;
|
|
236
|
+
//#endregion
|
|
235
237
|
//#region src/effect/effect.d.ts
|
|
236
238
|
type Effect<A, E, R extends AnyService = never> = Effect$1<A, E, R>;
|
|
237
239
|
type LazyProgram<A, E, R extends AnyService = never> = Program$1<A, E, R>;
|
|
@@ -243,8 +245,14 @@ type ProgramAllSuccess<Programs extends readonly AnyProgram[]> = { -readonly [In
|
|
|
243
245
|
type ProgramAllError<Programs extends readonly AnyProgram[]> = EffectError<Programs[number]>;
|
|
244
246
|
type ProgramAllRequirements<Programs extends readonly AnyProgram[]> = EffectRequirements<Programs[number]>;
|
|
245
247
|
type ProgramAllResult<Programs extends readonly AnyProgram[]> = Program$1<ProgramAllSuccess<Programs>, ProgramAllError<Programs>, ProgramAllRequirements<Programs>>;
|
|
248
|
+
type ProgramResultFor<Child> = Child extends AnyProgram ? Result<EffectSuccess<Child>, EffectError<Child>> : never;
|
|
249
|
+
type ProgramAllResultsSuccess<Programs extends readonly AnyProgram[]> = number extends Programs['length'] ? ReadonlyArray<Result<EffectSuccess<Programs[number]>, EffectError<Programs[number]>>> : { readonly [Index in keyof Programs]: ProgramResultFor<Programs[Index]>; };
|
|
250
|
+
type ProgramAllResultsResult<Programs extends readonly AnyProgram[]> = Program$1<ProgramAllResultsSuccess<Programs>, never, ProgramAllRequirements<Programs>>;
|
|
251
|
+
type ProgramForEachResult<Child extends AnyProgram> = Program$1<ReadonlyArray<EffectSuccess<Child>>, EffectError<Child>, EffectRequirements<Child>>;
|
|
246
252
|
type ProgramAllOptions = {
|
|
247
253
|
readonly concurrency?: number;
|
|
254
|
+
/** Optional diagnostic name for the collection execution. */
|
|
255
|
+
readonly name?: string;
|
|
248
256
|
};
|
|
249
257
|
/**
|
|
250
258
|
* Compose `better-result` operations while preserving Service requirements in
|
|
@@ -270,11 +278,30 @@ declare function gen<Yield extends EffectYield, Returned extends AnyResult>(body
|
|
|
270
278
|
/** Build a lazy Program without running its generator. */
|
|
271
279
|
declare function fn<Yield extends EffectYield, Returned extends AnyResult>(body: () => Generator<Yield, Returned, unknown>): ProgramFromGenerator<Yield, Returned>;
|
|
272
280
|
declare function fn<Yield extends EffectYield, Returned extends AnyResult>(body: () => AsyncGenerator<Yield, Returned, unknown>): ProgramFromGenerator<Yield, Returned>;
|
|
281
|
+
type ProgramNamedOperation = {
|
|
282
|
+
<Input extends AnyProgram>(program: Input): Input;
|
|
283
|
+
};
|
|
284
|
+
/** Attach a lazy diagnostic name to a Program without invoking it. */
|
|
285
|
+
declare function programNamed(name: string): ProgramNamedOperation;
|
|
286
|
+
declare function programNamed<Input extends AnyProgram>(name: string, program: Input): Input;
|
|
273
287
|
/** Build a lazy Program collection with optional bounded concurrency. */
|
|
274
288
|
declare function programAll<const Programs extends readonly AnyProgram[]>(programs: Programs, options?: ProgramAllOptions): ProgramAllResult<Programs>;
|
|
289
|
+
/** Build a lazy Program collection from an input array and Program factory. */
|
|
290
|
+
declare function programForEach<const Items extends readonly unknown[], Child extends AnyProgram>(items: Items, makeProgram: (item: Items[number], index: number) => Child, options?: ProgramAllOptions): ProgramForEachResult<Child>;
|
|
291
|
+
/** Build a lazy Program collection that retains every child Result. */
|
|
292
|
+
declare function programAllResults<const Programs extends readonly AnyProgram[]>(programs: Programs, options?: ProgramAllOptions): ProgramAllResultsResult<Programs>;
|
|
275
293
|
/** Value-level namespace for lazy Program combinators. */
|
|
276
294
|
declare const Program: {
|
|
295
|
+
readonly named: typeof programNamed;
|
|
277
296
|
readonly all: typeof programAll;
|
|
297
|
+
readonly forEach: typeof programForEach;
|
|
298
|
+
readonly allResults: typeof programAllResults;
|
|
299
|
+
readonly map: typeof map;
|
|
300
|
+
readonly mapError: typeof mapError;
|
|
301
|
+
readonly andThen: typeof andThen;
|
|
302
|
+
readonly tap: typeof tap;
|
|
303
|
+
readonly tapError: typeof tapError;
|
|
304
|
+
readonly recover: typeof recover;
|
|
278
305
|
};
|
|
279
306
|
/**
|
|
280
307
|
* Acquire a resource in the current Scope and register its release callback.
|
|
@@ -291,7 +318,22 @@ declare const Program: {
|
|
|
291
318
|
* )
|
|
292
319
|
* ```
|
|
293
320
|
*/
|
|
294
|
-
declare function acquireRelease<R>(acquire: () => MaybePromise
|
|
321
|
+
declare function acquireRelease<R>(acquire: () => MaybePromise<R>, release: (resource: R, outcome: ScopeOutcome) => MaybePromise<void>): AsyncGenerator<Err<never, UnhandledException>, R, unknown>;
|
|
322
|
+
/**
|
|
323
|
+
* Acquire a Result-valued resource and register only successful acquisitions.
|
|
324
|
+
*
|
|
325
|
+
* Typed acquisition failures remain unchanged in the Effect error channel;
|
|
326
|
+
* unexpected acquisition and registration failures are normalized by
|
|
327
|
+
* `better-result`. Release failures remain Scope cleanup failures.
|
|
328
|
+
*/
|
|
329
|
+
declare function acquireReleaseResult<R, E>(acquire: () => MaybePromise<Result<R, E>>, release: (resource: R, outcome: ScopeOutcome) => MaybePromise<void>): AsyncGenerator<Err<never, E | UnhandledException>, R, unknown>;
|
|
330
|
+
/**
|
|
331
|
+
* Lazily acquire and register a disposable resource in the current Scope.
|
|
332
|
+
*
|
|
333
|
+
* Disposal is delegated to `Scope.add`, including protocol preference,
|
|
334
|
+
* validation, race-safe registration, and cleanup error handling.
|
|
335
|
+
*/
|
|
336
|
+
declare function acquireDisposable<R extends DisposableResource>(acquire: () => MaybePromise<R>): AsyncGenerator<Err<never, UnhandledException>, R, unknown>;
|
|
295
337
|
/**
|
|
296
338
|
* Register an already-acquired disposable resource in the current Scope.
|
|
297
339
|
*
|
|
@@ -315,15 +357,22 @@ type EffectNamespace = {
|
|
|
315
357
|
readonly gen: typeof gen;
|
|
316
358
|
readonly fn: typeof fn;
|
|
317
359
|
readonly acquireRelease: typeof acquireRelease;
|
|
360
|
+
readonly acquireReleaseResult: typeof acquireReleaseResult;
|
|
361
|
+
readonly acquireDisposable: typeof acquireDisposable;
|
|
318
362
|
readonly add: typeof add;
|
|
319
|
-
readonly map: typeof map;
|
|
320
|
-
readonly mapError: typeof mapError;
|
|
321
|
-
readonly andThen: typeof andThen;
|
|
363
|
+
readonly map: typeof map$1;
|
|
364
|
+
readonly mapError: typeof mapError$1;
|
|
365
|
+
readonly andThen: typeof andThen$1;
|
|
322
366
|
readonly andThenAsync: typeof andThenAsync;
|
|
323
|
-
readonly tap: typeof tap;
|
|
324
|
-
readonly
|
|
367
|
+
readonly tap: typeof tap$1;
|
|
368
|
+
readonly tapAsync: typeof tapAsync;
|
|
369
|
+
readonly tapError: typeof tapError$1;
|
|
370
|
+
readonly tapErrorAsync: typeof tapErrorAsync;
|
|
325
371
|
readonly tapBoth: typeof tapBoth;
|
|
326
|
-
readonly
|
|
372
|
+
readonly tapBothAsync: typeof tapBothAsync;
|
|
373
|
+
readonly matchError: typeof matchError$1;
|
|
374
|
+
readonly matchErrorPartial: typeof matchErrorPartial$1;
|
|
375
|
+
readonly recover: typeof recover$1;
|
|
327
376
|
readonly recoverAsync: typeof recoverAsync;
|
|
328
377
|
readonly flatten: typeof flatten;
|
|
329
378
|
readonly as: typeof as;
|
|
@@ -347,60 +396,5 @@ declare namespace Effect {
|
|
|
347
396
|
type Any = AnyEffect;
|
|
348
397
|
}
|
|
349
398
|
//#endregion
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
declare function pipe<A>(value: A): A;
|
|
353
|
-
declare function pipe<A, B>(value: A, ab: Unary<A, B>): B;
|
|
354
|
-
declare function pipe<A, B, C>(value: A, ab: Unary<A, B>, bc: Unary<B, C>): C;
|
|
355
|
-
declare function pipe<A, B, C, D>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>): D;
|
|
356
|
-
declare function pipe<A, B, C, D, E>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>, de: Unary<D, E>): E;
|
|
357
|
-
declare function pipe<A, B, C, D, E, F>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>, de: Unary<D, E>, ef: Unary<E, F>): F;
|
|
358
|
-
declare function pipe<A, B, C, D, E, F, G>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>, de: Unary<D, E>, ef: Unary<E, F>, fg: Unary<F, G>): G;
|
|
359
|
-
declare function pipe<A, B, C, D, E, F, G, H>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>, de: Unary<D, E>, ef: Unary<E, F>, fg: Unary<F, G>, gh: Unary<G, H>): H;
|
|
360
|
-
declare function pipe<A, B, C, D, E, F, G, H, I>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>, de: Unary<D, E>, ef: Unary<E, F>, fg: Unary<F, G>, gh: Unary<G, H>, hi: Unary<H, I>): I;
|
|
361
|
-
declare function pipe<A, B, C, D, E, F, G, H, I, J>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>, de: Unary<D, E>, ef: Unary<E, F>, fg: Unary<F, G>, gh: Unary<G, H>, hi: Unary<H, I>, ij: Unary<I, J>): J;
|
|
362
|
-
declare function pipe<A, B, C, D, E, F, G, H, I, J, K>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>, de: Unary<D, E>, ef: Unary<E, F>, fg: Unary<F, G>, gh: Unary<G, H>, hi: Unary<H, I>, ij: Unary<I, J>, jk: Unary<J, K>): K;
|
|
363
|
-
//#endregion
|
|
364
|
-
//#region src/resource/errors.d.ts
|
|
365
|
-
declare const ResourceReleaseFailure_base: import("better-result").TaggedErrorClass<"ResourceReleaseFailure">;
|
|
366
|
-
/** Describes a failure encountered while releasing a Resource. */
|
|
367
|
-
declare class ResourceReleaseFailure extends ResourceReleaseFailure_base<{
|
|
368
|
-
readonly resource: string;
|
|
369
|
-
readonly cause: unknown;
|
|
370
|
-
readonly message: string;
|
|
371
|
-
}> {}
|
|
372
|
-
//#endregion
|
|
373
|
-
//#region src/resource/types.d.ts
|
|
374
|
-
/** A value that may be delivered synchronously or through a thenable. */
|
|
375
|
-
type MaybePromise<T> = T | PromiseLike<T>;
|
|
376
|
-
/** A synchronous or asynchronous better-result Result operation. */
|
|
377
|
-
type AsyncResult<T, E> = MaybePromise<Result<T, E>>;
|
|
378
|
-
/** The allowed return value of a custom Resource release callback. */
|
|
379
|
-
type ReleaseOutcome = void | Result<void, unknown>;
|
|
380
|
-
/** Receives release failures for diagnostics without changing error precedence. */
|
|
381
|
-
type ReleaseFailureObserver = (failure: ResourceReleaseFailure) => MaybePromise<void>;
|
|
382
|
-
/** Options controlling `Resource.acquireUseRelease`. */
|
|
383
|
-
type AcquireUseReleaseOptions<R, A, AcquireError, UseError> = {
|
|
384
|
-
/** Human-readable name included in release failures. */
|
|
385
|
-
readonly name: string;
|
|
386
|
-
/** Acquire the resource. A failure skips use and release. */
|
|
387
|
-
readonly acquire: () => AsyncResult<R, AcquireError>;
|
|
388
|
-
/** Use the acquired resource. Release is attempted afterward. */
|
|
389
|
-
readonly use: (resource: R) => AsyncResult<A, UseError>;
|
|
390
|
-
/** Release the resource, or omit it to use its disposal protocol. */
|
|
391
|
-
readonly release?: (resource: R) => MaybePromise<ReleaseOutcome>;
|
|
392
|
-
/**
|
|
393
|
-
* Observe cleanup failures without changing error precedence. This is most
|
|
394
|
-
* useful when both `use` and `release` can fail.
|
|
395
|
-
*/
|
|
396
|
-
readonly onReleaseFailure?: ReleaseFailureObserver;
|
|
397
|
-
};
|
|
398
|
-
//#endregion
|
|
399
|
-
//#region src/resource/resource.d.ts
|
|
400
|
-
declare const Resource: {
|
|
401
|
-
/** Acquire, use, and release a resource with deterministic error precedence. */
|
|
402
|
-
readonly acquireUseRelease: <R, A, AcquireError, UseError>({ name, acquire, use, release, onReleaseFailure }: AcquireUseReleaseOptions<R, A, AcquireError, UseError>) => Promise<Result<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>>;
|
|
403
|
-
};
|
|
404
|
-
//#endregion
|
|
405
|
-
export { ReleaseOutcome as a, Effect as c, CurrentAbortSignal as d, Runtime as f, ReleaseFailureObserver as i, Program as l, AcquireUseReleaseOptions as n, ResourceReleaseFailure as o, RuntimeFor as p, AsyncResult as r, pipe as s, Resource as t, ProgramAllOptions as u };
|
|
406
|
-
//# sourceMappingURL=index-BafDna0B.d.mts.map
|
|
399
|
+
export { Program as n, ProgramAllOptions as r, Effect as t };
|
|
400
|
+
//# sourceMappingURL=index-CX6iAoCB.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CX6iAoCB.d.mts","names":[],"sources":["../src/effect/combinators.ts","../src/effect/program-combinators.ts","../src/effect/effect.ts"],"mappings":";;;KAYK,YAAY,GAAG,KAAK,OAAW,GAAG,KAAK,YAAY,OAAW,GAAG;KAEjE,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,eAAa,GAAG;GAClB,OAAO,QAAQ,QAAQ,YAAY,UAAU,cAAc,OAAO,aAAa,OAAO;;KAGpF,oBAAkB,IAAI;GACxB,OAAO,QAAQ,QAAQ,iBAAiB,MAAM,cAAc,OAAO,kBAAkB,OAAO;;KAG1F,mBAAiB;GACnB,OAAO,QAAQ,QAAQ,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