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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { M as AnyService, h as ScopeOutcome } from "./index-heuaRmXR.mjs";
|
|
2
|
+
import { C as CompleteExecution, D as LayerInput, M as ProvidedEnvironment, T as CompleteInput, a as RuntimeShutdownDiagnostic, i as RuntimeRunOptions, n as RuntimeDisposeOptions, r as RuntimeOptions, w as CompleteExecutionLayer, x as Layer, y as LayerBackend } from "./outcome-CB43bnFW.mjs";
|
|
3
|
+
import "./index-BMdU_Z72.mjs";
|
|
4
|
+
import "./index-CX6iAoCB.mjs";
|
|
5
|
+
import { Result, UnhandledException } from "better-result";
|
|
6
|
+
//#region src/runtime/types.d.ts
|
|
7
|
+
/** A detached diagnostic view of one active Runtime execution. */
|
|
8
|
+
type RuntimeExecutionInspection = {
|
|
9
|
+
readonly executionId: string;
|
|
10
|
+
readonly name?: string;
|
|
11
|
+
readonly startedAt: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A detached, immutable diagnostic view of a Runtime.
|
|
15
|
+
*
|
|
16
|
+
* Inspection never exposes Service instances, providers, Scopes or arbitrary
|
|
17
|
+
* execution attributes. It is informational only and is not a synchronization
|
|
18
|
+
* primitive or readiness guarantee.
|
|
19
|
+
*/
|
|
20
|
+
type RuntimeInspection = {
|
|
21
|
+
readonly state: 'active' | 'disposing' | 'disposed';
|
|
22
|
+
readonly warmup: 'idle' | 'running' | 'completed' | 'failed';
|
|
23
|
+
readonly activeExecutions: number;
|
|
24
|
+
readonly executions: readonly RuntimeExecutionInspection[];
|
|
25
|
+
readonly services: readonly string[];
|
|
26
|
+
readonly shutdownSignalAborted: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Name a Runtime type from a concrete Layer without repeating its provided
|
|
30
|
+
* branded Service instance union.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* type AppRuntime = RuntimeFor<typeof AppLive>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
type RuntimeFor<L extends LayerInput> = Runtime<Layer.Provided<L>>;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/runtime/runtime.d.ts
|
|
40
|
+
type RuntimeOptionsInput = RuntimeOptions & RuntimeRunOptions;
|
|
41
|
+
/**
|
|
42
|
+
* Long-lived execution environment backed by a complete Layer.
|
|
43
|
+
*
|
|
44
|
+
* A Runtime owns Layer resources until `dispose()` is called. Each `run()` is
|
|
45
|
+
* isolated in a child Scope, while Layer-scoped resources remain shared.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const runtime = await Runtime.make(AppLive)
|
|
50
|
+
* const result = await runtime.run(loadUser('u1'))
|
|
51
|
+
* await runtime.dispose()
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @typeParam Provided The branded Service instances supplied by the Layer.
|
|
55
|
+
*/
|
|
56
|
+
declare class Runtime<Provided extends AnyService = any> {
|
|
57
|
+
private readonly handle;
|
|
58
|
+
private constructor();
|
|
59
|
+
/**
|
|
60
|
+
* Create a long-lived Runtime that owns its Layer resources.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const runtime = await Runtime.make(AppLive)
|
|
65
|
+
* const result = await runtime.run(program)
|
|
66
|
+
* await runtime.dispose()
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
static make<L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, options?: RuntimeOptions): Promise<Runtime<ProvidedEnvironment<L>>>;
|
|
70
|
+
static make<L extends LayerInput>(layer: L & CompleteInput<L>, options?: RuntimeOptions): Promise<Runtime<ProvidedEnvironment<L>>>;
|
|
71
|
+
/**
|
|
72
|
+
* Run one program and dispose its Layer resources before resolving.
|
|
73
|
+
*
|
|
74
|
+
* This is convenient for request-style or command-style execution where a
|
|
75
|
+
* Runtime should not outlive the operation.
|
|
76
|
+
*/
|
|
77
|
+
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptionsInput): Promise<Awaited<A>>;
|
|
78
|
+
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptionsInput): Promise<Awaited<A>>;
|
|
79
|
+
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, options: RuntimeOptionsInput, program: CompleteExecution<ProvidedEnvironment<L>, A>): Promise<Awaited<A>>;
|
|
80
|
+
/** Run a callback with a managed Runtime and always dispose it afterward. */
|
|
81
|
+
static use<A, L extends LayerInput>(layer: L & CompleteInput<L>, use: (runtime: Runtime<ProvidedEnvironment<L>>) => A | PromiseLike<A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
82
|
+
/** Resolve every Layer provider and dispose the Runtime if warmup fails. */
|
|
83
|
+
warmup(): Promise<void>;
|
|
84
|
+
/** Return a detached diagnostic snapshot without changing Runtime state. */
|
|
85
|
+
inspect(): RuntimeInspection;
|
|
86
|
+
/** Run one execution in this Runtime's child Scope. */
|
|
87
|
+
run<A>(program: CompleteExecution<Provided, A>, options?: RuntimeRunOptions): Promise<Awaited<A>>;
|
|
88
|
+
/** Run one execution with a Layer owned by that execution's child Scope. */
|
|
89
|
+
runWith<Request extends LayerInput, A>(layer: Request & CompleteExecutionLayer<Provided, Request>, program: CompleteExecution<Provided | ProvidedEnvironment<Request>, A>, options?: RuntimeRunOptions): Promise<Awaited<A>>;
|
|
90
|
+
private runUnchecked;
|
|
91
|
+
/** Stop new executions and release the Runtime's Layer resources. */
|
|
92
|
+
dispose(options?: RuntimeDisposeOptions): Promise<void>;
|
|
93
|
+
/** @deprecated Scope outcomes are kept for internal compatibility. */
|
|
94
|
+
dispose(outcome: ScopeOutcome): Promise<void>;
|
|
95
|
+
/** Release Runtime-owned resources through JavaScript's async disposal protocol. */
|
|
96
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
97
|
+
private disposeWithOutcome;
|
|
98
|
+
}
|
|
99
|
+
/** Type-level aliases for naming Runtime handles and shutdown options. */
|
|
100
|
+
declare namespace Runtime {
|
|
101
|
+
/** Name a Runtime type from a concrete Layer. */
|
|
102
|
+
type For<L extends LayerInput> = RuntimeFor<L>;
|
|
103
|
+
/** Optional Runtime shutdown configuration. */
|
|
104
|
+
type Options = RuntimeOptions;
|
|
105
|
+
/** Optional signal supplied to one managed Runtime execution. */
|
|
106
|
+
type RunOptions = RuntimeRunOptions;
|
|
107
|
+
/** Cooperative shutdown policy for a managed Runtime. */
|
|
108
|
+
type DisposeOptions = RuntimeDisposeOptions;
|
|
109
|
+
/** Diagnostic reported for aggregated Runtime shutdown cleanup failures. */
|
|
110
|
+
type ShutdownDiagnostic = RuntimeShutdownDiagnostic;
|
|
111
|
+
/** Detached diagnostic snapshot returned by `Runtime.inspect()`. */
|
|
112
|
+
type Inspection = RuntimeInspection;
|
|
113
|
+
/** Detached diagnostic view of one active execution. */
|
|
114
|
+
type ExecutionInspection = RuntimeExecutionInspection;
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/runtime/signal.d.ts
|
|
118
|
+
/** Yieldable access to the signal of the current Runtime execution. */
|
|
119
|
+
declare const CurrentAbortSignal: {
|
|
120
|
+
readonly [Symbol.iterator]: () => Generator<never, AbortSignal, unknown>;
|
|
121
|
+
};
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/function/pipe.d.ts
|
|
124
|
+
type Unary<A, B> = (value: A) => B;
|
|
125
|
+
declare function pipe<A>(value: A): A;
|
|
126
|
+
declare function pipe<A, B>(value: A, ab: Unary<A, B>): B;
|
|
127
|
+
declare function pipe<A, B, C>(value: A, ab: Unary<A, B>, bc: Unary<B, C>): C;
|
|
128
|
+
declare function pipe<A, B, C, D>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>): D;
|
|
129
|
+
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;
|
|
130
|
+
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;
|
|
131
|
+
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;
|
|
132
|
+
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;
|
|
133
|
+
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;
|
|
134
|
+
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;
|
|
135
|
+
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;
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/resource/errors.d.ts
|
|
138
|
+
declare const ResourceReleaseFailure_base: import("better-result").TaggedErrorClass<"ResourceReleaseFailure">;
|
|
139
|
+
/** Describes a failure encountered while releasing a Resource. */
|
|
140
|
+
declare class ResourceReleaseFailure extends ResourceReleaseFailure_base<{
|
|
141
|
+
readonly resource: string;
|
|
142
|
+
readonly cause: unknown;
|
|
143
|
+
readonly message: string;
|
|
144
|
+
}> {}
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/resource/types.d.ts
|
|
147
|
+
/** A value that may be delivered synchronously or through a thenable. */
|
|
148
|
+
type MaybePromise<T> = T | PromiseLike<T>;
|
|
149
|
+
/** A synchronous or asynchronous better-result Result operation. */
|
|
150
|
+
type AsyncResult<T, E> = MaybePromise<Result<T, E>>;
|
|
151
|
+
/** The allowed return value of a custom Resource release callback. */
|
|
152
|
+
type ReleaseOutcome = void | Result<void, unknown>;
|
|
153
|
+
/** Receives release failures for diagnostics without changing error precedence. */
|
|
154
|
+
type ReleaseFailureObserver = (failure: ResourceReleaseFailure) => MaybePromise<void>;
|
|
155
|
+
/** Options controlling `Resource.acquireUseRelease`. */
|
|
156
|
+
type AcquireUseReleaseOptions<R, A, AcquireError, UseError> = {
|
|
157
|
+
/** Human-readable name included in release failures. */
|
|
158
|
+
readonly name: string;
|
|
159
|
+
/** Acquire the resource. A failure skips use and release. */
|
|
160
|
+
readonly acquire: () => AsyncResult<R, AcquireError>;
|
|
161
|
+
/** Use the acquired resource. Release is attempted afterward. */
|
|
162
|
+
readonly use: (resource: R) => AsyncResult<A, UseError>;
|
|
163
|
+
/** Release the resource, or omit it to use its disposal protocol. */
|
|
164
|
+
readonly release?: (resource: R) => MaybePromise<ReleaseOutcome>;
|
|
165
|
+
/**
|
|
166
|
+
* Observe cleanup failures without changing error precedence. This is most
|
|
167
|
+
* useful when both `use` and `release` can fail.
|
|
168
|
+
*/
|
|
169
|
+
readonly onReleaseFailure?: ReleaseFailureObserver;
|
|
170
|
+
};
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/resource/resource.d.ts
|
|
173
|
+
declare const Resource: {
|
|
174
|
+
/** Acquire, use, and release a resource with deterministic error precedence. */
|
|
175
|
+
readonly acquireUseRelease: <R, A, AcquireError, UseError>({ name, acquire, use, release, onReleaseFailure }: AcquireUseReleaseOptions<R, A, AcquireError, UseError>) => Promise<Result<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>>;
|
|
176
|
+
};
|
|
177
|
+
//#endregion
|
|
178
|
+
export { ReleaseOutcome as a, CurrentAbortSignal as c, RuntimeFor as d, RuntimeInspection as f, ReleaseFailureObserver as i, Runtime as l, AcquireUseReleaseOptions as n, ResourceReleaseFailure as o, AsyncResult as r, pipe as s, Resource as t, RuntimeExecutionInspection as u };
|
|
179
|
+
//# sourceMappingURL=index-GYJ4qm9K.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-GYJ4qm9K.d.mts","names":[],"sources":["../src/runtime/types.ts","../src/runtime/runtime.ts","../src/runtime/signal.ts","../src/function/pipe.ts","../src/resource/errors.ts","../src/resource/types.ts","../src/resource/resource.ts"],"mappings":";;;;;;;KAMY;WACD;WACA;WACA;;;;;;;;;KAUC;WACD;WACA;WACA;WACA,qBAAqB;WACrB;WACA;;;;;;;;;;;KAYC,WAAW,UAAU,cAAc,QAAQ,MAAM,SAAS;;;KCNjE,sBAAsB,iBAAiB;;;;;;;;;;;;;;;;cA8C/B,QAAQ,iBAAiB;mBACC;UAA9B;;;;;;;;;;;SAYA,KAAK,UAAU,YACpB,OAAO,IAAI,cAAc,IACzB,SAAS,cACT,UAAU,iBACT,QAAQ,QAAQ,oBAAoB;SAEhC,KAAK,UAAU,YACpB,OAAO,IAAI,cAAc,IACzB,UAAU,iBACT,QAAQ,QAAQ,oBAAoB;;;;;;;SAwBhC,IAAI,GAAG,UAAU,YACtB,OAAO,IAAI,cAAc,IACzB,SAAS,cACT,SAAS,kBAAkB,oBAAoB,IAAI,IACnD,UAAU,sBACT,QAAQ,QAAQ;SAEZ,IAAI,GAAG,UAAU,YACtB,OAAO,IAAI,cAAc,IACzB,SAAS,kBAAkB,oBAAoB,IAAI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AG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GACjD,OAAO,GACP,IAAI,MAAM,GAAG,IACb,IAAI,MAAM,GAAG,IACb,IAAI,MAAM,GAAG,IACb,IAAI,MAAM,GAAG,IACb,IAAI,MAAM,GAAG,IACb,IAAI,MAAM,GAAG,IACb,IAAI,MAAM,GAAG,IACb,IAAI,MAAM,GAAG,IACb,IAAI,MAAM,GAAG,IACb,IAAI,MAAM,GAAG,KACZ;;;;;cC3FU,+BAA+B;WACjC;WACA;WACA;;;;;KCCC,aAAa,KAAK,IAAI,YAAY;;KAGlC,YAAY,GAAG,KAAK,aAAa,OAAW,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;;;;cCqBjB;;WA3Bc,oBAAA,GAAG,GAAG,cAAc,YAAQ,MAAA,SAAA,KAAA,SAAA,oBAMpD,yBAAyB,GAAG,GAAG,cAAc,cAAY,QAC1D,OAAW,GAAG,eAAe,WAAW,qBAAqB"}
|
|
@@ -54,16 +54,16 @@ type EffectMethods<A, E, R extends AnyService> = {
|
|
|
54
54
|
andThen<Next extends ResultValue>(fn: (value: A) => Next): Effect<EffectSuccess<Next>, E | EffectError<Next>, R | EffectRequirements<Next>>;
|
|
55
55
|
andThenAsync<Next extends ResultValue>(fn: (value: A) => Promise<Next>): Promise<Effect<EffectSuccess<Next>, E | EffectError<Next>, R | EffectRequirements<Next>>>;
|
|
56
56
|
tap(fn: (value: A) => void): Effect<A, E, R>;
|
|
57
|
-
tapAsync(fn: (value: A) =>
|
|
57
|
+
tapAsync(fn: (value: A) => PromiseLike<void>): Promise<Effect<A, E, R>>;
|
|
58
58
|
tapError(fn: (error: E) => void): Effect<A, E, R>;
|
|
59
|
-
tapErrorAsync(fn: (error: E) =>
|
|
59
|
+
tapErrorAsync(fn: (error: E) => PromiseLike<void>): Promise<Effect<A, E, R>>;
|
|
60
60
|
tapBoth(handlers: {
|
|
61
61
|
ok: (value: A) => void;
|
|
62
62
|
err: (error: E) => void;
|
|
63
63
|
}): Effect<A, E, R>;
|
|
64
64
|
tapBothAsync(handlers: {
|
|
65
|
-
ok: (value: A) =>
|
|
66
|
-
err: (error: E) =>
|
|
65
|
+
ok: (value: A) => PromiseLike<void>;
|
|
66
|
+
err: (error: E) => PromiseLike<void>;
|
|
67
67
|
}): Promise<Effect<A, E, R>>;
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
@@ -371,4 +371,4 @@ declare class ServiceAcquisitionError extends Error {
|
|
|
371
371
|
}
|
|
372
372
|
//#endregion
|
|
373
373
|
export { ProgramFromGenerator as A, ServiceTag as B, EffectError as C, EffectYield as D, EffectSuccess as E, ServiceContract as F, ServiceToken as H, ServiceIdentity as I, ServiceIdentityTypeId as L, AnyService as M, AnyServiceToken as N, InferYieldRequirements as O, ServiceClass as P, ServiceInstance as R, Effect as S, EffectRequirements as T, ServiceTokenOf as U, ServiceTagOf as V, ScopeCloseError as _, ServiceResolver as a, Service as b, RuntimeContextStorage as c, CleanupFailureDiagnostic as d, DisposableResource as f, ResourceNotDisposableError as g, ScopeOutcome as h, ServiceRuntimeNotConfiguredError as i, ServiceRequirement as j, Program as k, CloseableScope as l, ScopeFinalizer as m, ServiceAcquisitionError as n, ServiceRuntime as o, MaybePromise as p, ServiceNotFoundError as r, RuntimeContext as s, CircularDependencyError as t, Scope as u, ScopeClosedError as v, EffectFromGenerator as w, AnyEffect as x, ScopeRuntimeNotConfiguredError as y, ServiceRequirements as z };
|
|
374
|
-
//# sourceMappingURL=index-
|
|
374
|
+
//# sourceMappingURL=index-heuaRmXR.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-heuaRmXR.d.mts","names":[],"sources":["../src/service/types.ts","../src/effect/types.ts","../src/service/service.ts","../src/scope/errors.ts","../src/scope/types.ts","../src/scope/scope.ts","../src/runtime/context.ts","../src/service/runtime.ts","../src/service/errors.ts"],"mappings":";;;cAGqB;;UAGJ,oBAAoB;YACzB,wBAAwB;;;KAIxB,aAAa;;KAGb,gBAAgB,KAAK,oBAAoB,KAAK,UAAU;KAExD,mBAAmB,2BAA2B,iBAAiB;WAChE;WACA,YAAY;;WAGZ,KAAK,YAAY,gBAAgB,gBAAgB,cAAc;;KAGrE,+BAA+B,6BAA6B,gBAAgB;;UAGhE,iBACX,oCACG,iBAAiB,0BAEhB,2BAA2B,WAAW,eAAe,KAAK;;KAGxD,kBAAkB;;KAGlB,aACV,6BACA,iBAAiB,aAAa,uBACnB,gBAAgB,YAAY,eAAe,KAAK;;KAGjD,gBAAgB,UAAU,mBAAmB,aAAa;;KAG1D,aAAa,UAAU,cAAc,SAAS;;KAG9C,eAAe,UAAU,cAAc,UAAU,aACzD,aAAa,aAAa,IAAI;;KAItB,WAAW,UAAU,aAAa,mBAAmB,UAAU,aACvE,aAAa,KACb,UAAU,kBACR;KAGD,mBAAmB,QACrB,WAAW,IAAI,EAAE,gBAAe,sBAAsB,UAAS,mBAAmB,yBAC7E;;;;;;;KAQI,oBAAoB,UAAU,cAAc,mBAAmB;;;KClEtE,cAAc;;KAGd,eAAe,GAAG,GAAG,UAAU;GACjC,OAAO,aAAa,UAAU,WAAW,KAAK,mBAAmB,IAAI;;KAGnE,cAAc,GAAG,GAAG,UAAU;EACjC,IAAI,GAAG,KAAK,OAAO,MAAM,IAAI,OAAO,GAAG,GAAG;EAC1C,SAAS,IAAI,KAAK,OAAO,MAAM,KAAK,OAAO,GAAG,IAAI;EAElD,WAAW,aAAa,aACtB,KAAK,OAAO,MAAM,OACjB,OAAO,IAAI,cAAc,OAAO,YAAY,OAAO,IAAI,mBAAmB;EAE7E,gBAAgB,aAAa,aAC3B,KAAK,OAAO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ACT,UAAU,iBACV,eAAe,GACf,UAAS,wBACR;;SAcI,WAAW;;SAqBL,QAAQ,UAAU,iBAAiB,OAAO,IAAI,QAAQ,aAAa;;;;;cCtErE,yCAAyC;EAAA;;;cASzC,6BAA6B;WACnB,SAAS;EAAT,YAAA,SAAS;;;cAQnB,gCAAgC;WAClC,eAAe;EAEZ,YAAA,eAAe;;;cAWhB,gCAAgC;WAIhC,SAAS;WAHF;EAGP,YAAA,SAAS,iBAClB,yBAAyB,mBACzB;WAgBO,yBAAyB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { B as ServiceTag, C as EffectError, D as EffectYield, E as EffectSuccess, F as ServiceContract, H as ServiceToken, I as ServiceIdentity, M as AnyService, N as AnyServiceToken, P as ServiceClass, R as ServiceInstance, T as EffectRequirements, U as ServiceTokenOf, _ as ScopeCloseError, a as ServiceResolver, b as Service, c as RuntimeContextStorage, d as CleanupFailureDiagnostic, f as DisposableResource, g as ResourceNotDisposableError, h as ScopeOutcome, i as ServiceRuntimeNotConfiguredError, j as ServiceRequirement, l as CloseableScope, m as ScopeFinalizer, n as ServiceAcquisitionError, o as ServiceRuntime, r as ServiceNotFoundError, s as RuntimeContext, t as CircularDependencyError, u as Scope, v as ScopeClosedError, x as AnyEffect, y as ScopeRuntimeNotConfiguredError, z as ServiceRequirements } from "./index-
|
|
2
|
-
import { _ as
|
|
3
|
-
import {
|
|
4
|
-
import { a as ReleaseOutcome, c as
|
|
1
|
+
import { B as ServiceTag, C as EffectError, D as EffectYield, E as EffectSuccess, F as ServiceContract, H as ServiceToken, I as ServiceIdentity, M as AnyService, N as AnyServiceToken, P as ServiceClass, R as ServiceInstance, T as EffectRequirements, U as ServiceTokenOf, _ as ScopeCloseError, a as ServiceResolver, b as Service, c as RuntimeContextStorage, d as CleanupFailureDiagnostic, f as DisposableResource, g as ResourceNotDisposableError, h as ScopeOutcome, i as ServiceRuntimeNotConfiguredError, j as ServiceRequirement, l as CloseableScope, m as ScopeFinalizer, n as ServiceAcquisitionError, o as ServiceRuntime, r as ServiceNotFoundError, s as RuntimeContext, t as CircularDependencyError, u as Scope, v as ScopeClosedError, x as AnyEffect, y as ScopeRuntimeNotConfiguredError, z as ServiceRequirements } from "./index-heuaRmXR.mjs";
|
|
2
|
+
import { S as LayerRegistration, _ as LayerRegistrationError, a as RuntimeShutdownDiagnostic, b as LayerBackendDisposeOptions, c as RuntimeExecutionMetadata, d as RuntimeResourceReleaseEvent, f as RuntimeServiceAcquireEvent, g as LayerGeneratorYieldError, h as LayerDisposeError, i as RuntimeRunOptions, l as RuntimeExecutionStartEvent, m as DuplicateServiceError, n as RuntimeDisposeOptions, o as RuntimeExecutionAttributes, p as RuntimeServiceResolveEvent, r as RuntimeOptions, s as RuntimeExecutionEndEvent, t as CleanupFailureObserver, u as RuntimeObserver, v as ServiceTagCollisionError, x as Layer, y as LayerBackend } from "./outcome-CB43bnFW.mjs";
|
|
3
|
+
import { t as MapLayerBackend } from "./index-BMdU_Z72.mjs";
|
|
4
|
+
import { a as ReleaseOutcome, c as CurrentAbortSignal, d as RuntimeFor, f as RuntimeInspection, i as ReleaseFailureObserver, l as Runtime, n as AcquireUseReleaseOptions, o as ResourceReleaseFailure, r as AsyncResult, s as pipe, t as Resource, u as RuntimeExecutionInspection } from "./index-GYJ4qm9K.mjs";
|
|
5
5
|
import { t as RuntimeContextNotConfiguredError } from "./errors-BKcsQ0ip.mjs";
|
|
6
|
-
|
|
6
|
+
import { n as Program, r as ProgramAllOptions, t as Effect } from "./index-CX6iAoCB.mjs";
|
|
7
|
+
export { type AcquireUseReleaseOptions, type AnyEffect, type AnyService, type AnyServiceToken, type AsyncResult, CircularDependencyError, type CleanupFailureDiagnostic, type CleanupFailureObserver, type CloseableScope, CurrentAbortSignal, type DisposableResource, DuplicateServiceError, Effect, type EffectError, type EffectRequirements, type EffectSuccess, type EffectYield, Layer, type LayerBackend, type LayerBackendDisposeOptions, LayerDisposeError, LayerGeneratorYieldError, type LayerRegistration, LayerRegistrationError, MapLayerBackend, Program, type ProgramAllOptions, type ReleaseFailureObserver, type ReleaseOutcome, Resource, ResourceNotDisposableError, ResourceReleaseFailure, Runtime, type RuntimeContext, RuntimeContextNotConfiguredError, type RuntimeContextStorage, type RuntimeDisposeOptions, type RuntimeExecutionAttributes, type RuntimeExecutionEndEvent, type RuntimeExecutionInspection, type RuntimeExecutionMetadata, type RuntimeExecutionStartEvent, type RuntimeFor, type RuntimeInspection, RuntimeObserver, type RuntimeOptions, type RuntimeResourceReleaseEvent, type RuntimeRunOptions, type RuntimeServiceAcquireEvent, type RuntimeServiceResolveEvent, 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 };
|