better-effect 0.6.1 → 0.7.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 +23 -1
- package/dist/adapters/iti.d.mts +3 -2
- package/dist/adapters/iti.d.mts.map +1 -1
- package/dist/context-B4yO5LaH.mjs +80 -0
- package/dist/context-B4yO5LaH.mjs.map +1 -0
- package/dist/errors-BXKc7juX.d.mts +8 -0
- package/dist/errors-BXKc7juX.d.mts.map +1 -0
- package/dist/{map-layer-backend-7hQkf_QP.d.mts → index-BFgG9zZC.d.mts} +129 -42
- package/dist/index-BFgG9zZC.d.mts.map +1 -0
- package/dist/{index-R3FdVmdr.d.mts → index-BddlcJK6.d.mts} +14 -57
- package/dist/index-BddlcJK6.d.mts.map +1 -0
- package/dist/index.d.mts +9 -63
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +101 -32
- package/dist/index.mjs.map +1 -1
- package/dist/map-layer-backend-CGibcwkc.d.mts +42 -0
- package/dist/map-layer-backend-CGibcwkc.d.mts.map +1 -0
- package/dist/runtime/explicit.d.mts +18 -0
- package/dist/runtime/explicit.d.mts.map +1 -0
- package/dist/runtime/explicit.mjs +46 -0
- package/dist/runtime/explicit.mjs.map +1 -0
- package/dist/runtime/node.d.mts +13 -0
- package/dist/runtime/node.d.mts.map +1 -0
- package/dist/runtime/node.mjs +21 -0
- package/dist/runtime/node.mjs.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/package.json +3 -1
- package/dist/index-R3FdVmdr.d.mts.map +0 -1
- package/dist/map-layer-backend-7hQkf_QP.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -118,6 +118,24 @@ boundaries; the callback form remains supported for compatibility.
|
|
|
118
118
|
container is needed; `MemoryLayerBackend` remains its compatibility alias from
|
|
119
119
|
`better-effect/testing`.
|
|
120
120
|
|
|
121
|
+
Runtimes are async disposables, so request-scoped code can use:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
await using runtime = await Runtime.make(AppLive)
|
|
125
|
+
const result = await runtime.run(program)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Or let `Runtime.use` own the lifetime:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
const result = await Runtime.use(AppLive, (runtime) => runtime.run(program))
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Service and Scope access share one `RuntimeContext`. Node/Bun uses
|
|
135
|
+
`AsyncLocalStorage` by default; hosts without transparent async context can
|
|
136
|
+
pass `contextStorage: new ExplicitRuntimeContextStorage()` from
|
|
137
|
+
`better-effect/runtime/explicit`.
|
|
138
|
+
|
|
121
139
|
If a program asks that Runtime for a Service its environment does not provide, TypeScript rejects the call.
|
|
122
140
|
|
|
123
141
|
```text
|
|
@@ -163,6 +181,7 @@ type Success = Effect.Success<Program>
|
|
|
163
181
|
type Failure = Effect.Error<Program>
|
|
164
182
|
type Dependencies = Effect.Requirements<Program>
|
|
165
183
|
type Services = Layer.Provided<typeof AppLive>
|
|
184
|
+
type Missing = Layer.Missing<typeof AppLive>
|
|
166
185
|
type AppRuntime = Runtime.For<typeof AppLive>
|
|
167
186
|
type DatabaseTag = Service.Tag<Database> // 'Database'
|
|
168
187
|
type DatabaseToken = Service.TokenOf<Database> // Service.Token<'Database', Database>
|
|
@@ -171,9 +190,12 @@ type Outcome = Scope.Outcome
|
|
|
171
190
|
|
|
172
191
|
These are declaration-only aliases and add nothing to the JavaScript bundle.
|
|
173
192
|
The associated `Layer` helpers are intentionally namespaced; use
|
|
174
|
-
`Layer.Provided`, `Layer.Required`, `Layer.Complete` and `Layer.Any` rather than
|
|
193
|
+
`Layer.Provided`, `Layer.Required`, `Layer.Missing`, `Layer.Complete` and `Layer.Any` rather than
|
|
175
194
|
low-level provider metadata names.
|
|
176
195
|
|
|
196
|
+
`Layer.complete(layer)` is a runtime identity that checks a composition root
|
|
197
|
+
immediately, so missing Services are reported where the Layer is assembled.
|
|
198
|
+
|
|
177
199
|
---
|
|
178
200
|
|
|
179
201
|
## Why better-effect?
|
package/dist/adapters/iti.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-
|
|
1
|
+
import { N as AnyServiceToken } from "../index-BFgG9zZC.mjs";
|
|
2
|
+
import "../index-BddlcJK6.mjs";
|
|
3
|
+
import { a as LayerRegistration, n as LayerBackend } from "../map-layer-backend-CGibcwkc.mjs";
|
|
3
4
|
//#region src/adapters/iti.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* ITI-backed Layer backend.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iti.d.mts","names":[],"sources":["../../src/adapters/iti.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"iti.d.mts","names":[],"sources":["../../src/adapters/iti.ts"],"mappings":";;;;;;;;;;cAsBa,2BAA2B;UAC9B;mBAES;mBAEA;UAET;;EAgBR,SAAS,cAAc;;EAuBvB,QAAQ,UAAU,iBAAiB,OAAO,IAAI,aAAa,KAAK,YAAY,aAAa;;EAyBnF,cAAc"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region src/runtime/errors.ts
|
|
2
|
+
/** Thrown when no RuntimeContext is active in the selected storage. */
|
|
3
|
+
var RuntimeContextNotConfiguredError = class extends Error {
|
|
4
|
+
constructor() {
|
|
5
|
+
super("No RuntimeContext is available in the current execution context");
|
|
6
|
+
this.name = "RuntimeContextNotConfiguredError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/runtime/context.ts
|
|
11
|
+
const unconfiguredRuntimeContextStorage = {
|
|
12
|
+
run: (_context, program) => program(),
|
|
13
|
+
current: () => {
|
|
14
|
+
throw new RuntimeContextNotConfiguredError();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
/** Build a context while keeping compatibility-only missing channels internal. */
|
|
18
|
+
const makeRuntimeContext = (resolver, scope, resolutionPath, signal) => {
|
|
19
|
+
const context = {
|
|
20
|
+
resolver,
|
|
21
|
+
scope,
|
|
22
|
+
resolutionPath
|
|
23
|
+
};
|
|
24
|
+
if (signal === void 0) return context;
|
|
25
|
+
return {
|
|
26
|
+
...context,
|
|
27
|
+
signal
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
let activeStorage = unconfiguredRuntimeContextStorage;
|
|
31
|
+
/** Install the host default used by the main Runtime entrypoint. */
|
|
32
|
+
const setDefaultRuntimeContextStorage = (storage) => {
|
|
33
|
+
activeStorage = storage;
|
|
34
|
+
};
|
|
35
|
+
const isPromiseLike = (value) => Object(value) === value && "then" in Object(value);
|
|
36
|
+
/** Return the storage currently associated with the executing callback. */
|
|
37
|
+
const activeRuntimeContextStorage = () => activeStorage;
|
|
38
|
+
/** Return the active context, or undefined when the storage has not been entered. */
|
|
39
|
+
const getRuntimeContext = (storage = activeStorage) => {
|
|
40
|
+
try {
|
|
41
|
+
return storage.current();
|
|
42
|
+
} catch (cause) {
|
|
43
|
+
if (cause instanceof RuntimeContextNotConfiguredError) return;
|
|
44
|
+
throw cause;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/** Return the active context or throw the storage's standard missing-context error. */
|
|
48
|
+
const currentRuntimeContext = () => activeStorage.current();
|
|
49
|
+
/** Keep a storage discoverable to Service and Scope compatibility bridges. */
|
|
50
|
+
const withActiveRuntimeContextStorage = (storage, program) => {
|
|
51
|
+
const previous = activeStorage;
|
|
52
|
+
activeStorage = storage;
|
|
53
|
+
const restore = () => {
|
|
54
|
+
if (activeStorage === storage) activeStorage = previous;
|
|
55
|
+
};
|
|
56
|
+
let value;
|
|
57
|
+
try {
|
|
58
|
+
value = program();
|
|
59
|
+
} catch (cause) {
|
|
60
|
+
restore();
|
|
61
|
+
throw cause;
|
|
62
|
+
}
|
|
63
|
+
if (!isPromiseLike(value)) {
|
|
64
|
+
restore();
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
return Promise.resolve(value).then((resolved) => {
|
|
68
|
+
restore();
|
|
69
|
+
return resolved;
|
|
70
|
+
}, (cause) => {
|
|
71
|
+
restore();
|
|
72
|
+
throw cause;
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
/** Run a callback in a context while keeping the selected storage discoverable to bridges. */
|
|
76
|
+
const runRuntimeContext = (storage, context, program) => withActiveRuntimeContextStorage(storage, () => storage.run(context, program));
|
|
77
|
+
//#endregion
|
|
78
|
+
export { runRuntimeContext as a, RuntimeContextNotConfiguredError as c, makeRuntimeContext as i, currentRuntimeContext as n, setDefaultRuntimeContextStorage as o, getRuntimeContext as r, withActiveRuntimeContextStorage as s, activeRuntimeContextStorage as t };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=context-B4yO5LaH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-B4yO5LaH.mjs","names":[],"sources":["../src/runtime/errors.ts","../src/runtime/context.ts"],"sourcesContent":["/** Thrown when no RuntimeContext is active in the selected storage. */\nexport class RuntimeContextNotConfiguredError extends Error {\n constructor() {\n super('No RuntimeContext is available in the current execution context')\n\n this.name = 'RuntimeContextNotConfiguredError'\n }\n}\n","import { RuntimeContextNotConfiguredError } from './errors'\n\nimport type { Scope } from '../scope/scope'\nimport type { AnyServiceToken, ServiceResolver } from '../service'\n\n/** The complete contextual state shared by Service, Scope and Layer resolution. */\nexport interface RuntimeContext {\n readonly resolver: ServiceResolver\n readonly scope: Scope\n readonly signal?: AbortSignal\n readonly resolutionPath: readonly AnyServiceToken[]\n}\n\n/** Host-specific storage for the current RuntimeContext. */\nexport interface RuntimeContextStorage {\n run<A>(context: RuntimeContext, program: () => A): A\n current(): RuntimeContext\n}\n\nconst unconfiguredRuntimeContextStorage: RuntimeContextStorage = {\n run: (_context, program) => program(),\n current: () => {\n throw new RuntimeContextNotConfiguredError()\n }\n}\n\n/** Build a context while keeping compatibility-only missing channels internal. */\nexport const makeRuntimeContext = (\n resolver: ServiceResolver | undefined,\n scope: Scope | undefined,\n resolutionPath: readonly AnyServiceToken[],\n signal: AbortSignal | undefined\n): RuntimeContext => {\n // SAFETY: ServiceRuntime and ScopeRuntime can be entered independently; the missing channel is rejected by the corresponding bridge before use.\n const context: RuntimeContext = {\n resolver: resolver as ServiceResolver,\n scope: scope as Scope,\n resolutionPath\n }\n\n if (signal === undefined) {\n return context\n }\n\n return { ...context, signal }\n}\n\nlet activeStorage = unconfiguredRuntimeContextStorage\n\n/** Install the host default used by the main Runtime entrypoint. */\nexport const setDefaultRuntimeContextStorage = (storage: RuntimeContextStorage): void => {\n activeStorage = storage\n}\n\nconst isPromiseLike = <A>(value: A): value is A & PromiseLike<unknown> =>\n Object(value) === value && 'then' in Object(value)\n\n/** Return the storage currently associated with the executing callback. */\nexport const activeRuntimeContextStorage = (): RuntimeContextStorage => activeStorage\n\n/** Return the active context, or undefined when the storage has not been entered. */\nexport const getRuntimeContext = (\n storage: RuntimeContextStorage = activeStorage\n): RuntimeContext | undefined => {\n try {\n return storage.current()\n } catch (cause) {\n if (cause instanceof RuntimeContextNotConfiguredError) {\n return undefined\n }\n\n throw cause\n }\n}\n\n/** Return the active context or throw the storage's standard missing-context error. */\nexport const currentRuntimeContext = (): RuntimeContext => activeStorage.current()\n\n/** Keep a storage discoverable to Service and Scope compatibility bridges. */\nexport const withActiveRuntimeContextStorage = <A>(\n storage: RuntimeContextStorage,\n program: () => A\n): A => {\n const previous = activeStorage\n activeStorage = storage\n\n const restore = (): void => {\n if (activeStorage === storage) {\n activeStorage = previous\n }\n }\n\n let value: A\n\n try {\n value = program()\n } catch (cause) {\n restore()\n throw cause\n }\n\n if (!isPromiseLike(value)) {\n restore()\n return value\n }\n\n // SAFETY: PromiseLike values are normalized only to restore the storage after settlement; the public generic retains the callback's awaited shape.\n return Promise.resolve(value).then(\n (resolved) => {\n restore()\n return resolved\n },\n (cause) => {\n restore()\n throw cause\n }\n ) as A\n}\n\n/** Run a callback in a context while keeping the selected storage discoverable to bridges. */\nexport const runRuntimeContext = <A>(\n storage: RuntimeContextStorage,\n context: RuntimeContext,\n program: () => A\n): A => withActiveRuntimeContextStorage(storage, () => storage.run(context, program))\n"],"mappings":";;AACA,IAAa,mCAAb,cAAsD,MAAM;CAC1D,cAAc;EACZ,MAAM,iEAAiE;EAEvE,KAAK,OAAO;CACd;AACF;;;ACYA,MAAM,oCAA2D;CAC/D,MAAM,UAAU,YAAY,QAAQ;CACpC,eAAe;EACb,MAAM,IAAI,iCAAiC;CAC7C;AACF;;AAGA,MAAa,sBACX,UACA,OACA,gBACA,WACmB;CAEnB,MAAM,UAA0B;EACpB;EACH;EACP;CACF;CAEA,IAAI,WAAW,KAAA,GACb,OAAO;CAGT,OAAO;EAAE,GAAG;EAAS;CAAO;AAC9B;AAEA,IAAI,gBAAgB;;AAGpB,MAAa,mCAAmC,YAAyC;CACvF,gBAAgB;AAClB;AAEA,MAAM,iBAAoB,UACxB,OAAO,KAAK,MAAM,SAAS,UAAU,OAAO,KAAK;;AAGnD,MAAa,oCAA2D;;AAGxE,MAAa,qBACX,UAAiC,kBACF;CAC/B,IAAI;EACF,OAAO,QAAQ,QAAQ;CACzB,SAAS,OAAO;EACd,IAAI,iBAAiB,kCACnB;EAGF,MAAM;CACR;AACF;;AAGA,MAAa,8BAA8C,cAAc,QAAQ;;AAGjF,MAAa,mCACX,SACA,YACM;CACN,MAAM,WAAW;CACjB,gBAAgB;CAEhB,MAAM,gBAAsB;EAC1B,IAAI,kBAAkB,SACpB,gBAAgB;CAEpB;CAEA,IAAI;CAEJ,IAAI;EACF,QAAQ,QAAQ;CAClB,SAAS,OAAO;EACd,QAAQ;EACR,MAAM;CACR;CAEA,IAAI,CAAC,cAAc,KAAK,GAAG;EACzB,QAAQ;EACR,OAAO;CACT;CAGA,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,MAC3B,aAAa;EACZ,QAAQ;EACR,OAAO;CACT,IACC,UAAU;EACT,QAAQ;EACR,MAAM;CACR,CACF;AACF;;AAGA,MAAa,qBACX,SACA,SACA,YACM,gCAAgC,eAAe,QAAQ,IAAI,SAAS,OAAO,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/runtime/errors.d.ts
|
|
2
|
+
/** Thrown when no RuntimeContext is active in the selected storage. */
|
|
3
|
+
declare class RuntimeContextNotConfiguredError extends Error {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { RuntimeContextNotConfiguredError as t };
|
|
8
|
+
//# sourceMappingURL=errors-BXKc7juX.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-BXKc7juX.d.mts","names":[],"sources":["../src/runtime/errors.ts"],"mappings":";;cACa,yCAAyC;EAAA"}
|
|
@@ -194,6 +194,132 @@ declare namespace Service {
|
|
|
194
194
|
type Requirements<S extends AnyService> = ServiceRequirements<S>;
|
|
195
195
|
}
|
|
196
196
|
//#endregion
|
|
197
|
+
//#region src/scope/errors.d.ts
|
|
198
|
+
/** Thrown when Scope context is accessed outside an active Scope execution. */
|
|
199
|
+
declare class ScopeRuntimeNotConfiguredError extends Error {
|
|
200
|
+
constructor();
|
|
201
|
+
}
|
|
202
|
+
/** Thrown when a resource or finalizer is added after Scope closure begins. */
|
|
203
|
+
declare class ScopeClosedError extends Error {
|
|
204
|
+
constructor();
|
|
205
|
+
}
|
|
206
|
+
/** Aggregates finalizer failures encountered while closing a Scope. */
|
|
207
|
+
declare class ScopeCloseError extends Error {
|
|
208
|
+
readonly causes: readonly unknown[];
|
|
209
|
+
constructor(causes: readonly unknown[]);
|
|
210
|
+
}
|
|
211
|
+
/** Thrown when a value has neither Symbol.dispose nor Symbol.asyncDispose. */
|
|
212
|
+
declare class ResourceNotDisposableError extends Error {
|
|
213
|
+
constructor();
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/scope/types.d.ts
|
|
217
|
+
/** A value that may be returned synchronously or asynchronously. */
|
|
218
|
+
type MaybePromise<T> = T | PromiseLike<T>;
|
|
219
|
+
/** Final outcome supplied to Scope finalizers and resource releases. */
|
|
220
|
+
type ScopeOutcome = {
|
|
221
|
+
/** Indicates that the owning program completed successfully. */
|
|
222
|
+
readonly status: 'success';
|
|
223
|
+
} | {
|
|
224
|
+
/** Indicates that the owning program failed or was interrupted. */
|
|
225
|
+
readonly status: 'failure';
|
|
226
|
+
/** The original program or execution failure. */
|
|
227
|
+
readonly cause: unknown;
|
|
228
|
+
};
|
|
229
|
+
/** Cleanup callback registered with a Scope. */
|
|
230
|
+
type ScopeFinalizer = (outcome: ScopeOutcome) => MaybePromise<void>;
|
|
231
|
+
/** Aggregated cleanup information reported at an execution boundary. */
|
|
232
|
+
type CleanupFailureDiagnostic = {
|
|
233
|
+
/** Outcome used for the Scope close that triggered cleanup. */
|
|
234
|
+
readonly outcome: ScopeOutcome;
|
|
235
|
+
/** Aggregated finalizer failure. */
|
|
236
|
+
readonly error: ScopeCloseError;
|
|
237
|
+
};
|
|
238
|
+
type SyncDisposableResource = {
|
|
239
|
+
[Symbol.dispose]: () => void;
|
|
240
|
+
[Symbol.asyncDispose]?: () => MaybePromise<void>;
|
|
241
|
+
};
|
|
242
|
+
type AsyncDisposableResource = {
|
|
243
|
+
[Symbol.dispose]?: () => void;
|
|
244
|
+
[Symbol.asyncDispose]: () => MaybePromise<void>;
|
|
245
|
+
};
|
|
246
|
+
/** A value implementing at least one JavaScript disposal protocol. */
|
|
247
|
+
type DisposableResource = SyncDisposableResource | AsyncDisposableResource;
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/scope/scope.d.ts
|
|
250
|
+
/**
|
|
251
|
+
* Non-owning lifecycle context for finalizers and child Scopes.
|
|
252
|
+
*
|
|
253
|
+
* A Scope can register cleanup and create children, but it cannot close
|
|
254
|
+
* itself. Use `Scope.make()` or `Scope.run()` when your code owns the Scope.
|
|
255
|
+
*/
|
|
256
|
+
interface Scope {
|
|
257
|
+
/** Register a finalizer that runs when the owning Scope closes. */
|
|
258
|
+
addFinalizer(finalizer: ScopeFinalizer): void;
|
|
259
|
+
/** Acquire a resource and register its outcome-aware release callback. */
|
|
260
|
+
acquire<R>(acquire: () => MaybePromise<R>, release: (resource: R, outcome: ScopeOutcome) => MaybePromise<void>): Promise<R>;
|
|
261
|
+
/** Register an already-acquired disposable resource. */
|
|
262
|
+
add<R extends DisposableResource>(resource: R): Promise<R>;
|
|
263
|
+
/** Create a child Scope owned by this Scope. */
|
|
264
|
+
fork(): CloseableScope;
|
|
265
|
+
}
|
|
266
|
+
/** A Scope whose owner is responsible for calling `close()`. */
|
|
267
|
+
interface CloseableScope extends Scope {
|
|
268
|
+
/** Close the Scope and run children and finalizers in child-first LIFO order. */
|
|
269
|
+
close(outcome?: ScopeOutcome): Promise<void>;
|
|
270
|
+
}
|
|
271
|
+
declare const Scope: {
|
|
272
|
+
/** Create an owned, initially open Scope. */
|
|
273
|
+
readonly make: () => CloseableScope;
|
|
274
|
+
/** Return the non-owning Scope available in the current execution context. */
|
|
275
|
+
readonly current: () => Scope;
|
|
276
|
+
/** Run a callback with an existing Scope supplied as the current context. */
|
|
277
|
+
readonly provide: <A>(scope: Scope, program: () => A) => A;
|
|
278
|
+
/** Resolve the current Scope through `yield* Scope` inside an Effect. */
|
|
279
|
+
readonly [Symbol.iterator]: () => Generator<never, Scope, unknown>;
|
|
280
|
+
/**
|
|
281
|
+
* Run a program in a newly owned Scope.
|
|
282
|
+
*
|
|
283
|
+
* Scope is independent from `better-result`, so returned values—including
|
|
284
|
+
* `Result.err`—close this Scope with a successful outcome. Result-aware
|
|
285
|
+
* outcome classification belongs to `Runtime.run`.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```ts
|
|
289
|
+
* await Scope.run(async (scope) => {
|
|
290
|
+
* const connection = await scope.acquire(connect, (connection) => connection.close())
|
|
291
|
+
* return connection.query()
|
|
292
|
+
* })
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
readonly run: <A>(program: (scope: Scope) => A | PromiseLike<A>) => Promise<Awaited<A>>;
|
|
296
|
+
};
|
|
297
|
+
/** Type-level aliases for Scope ownership, outcomes, and cleanup contracts. */
|
|
298
|
+
declare namespace Scope {
|
|
299
|
+
/** A Scope whose owner is responsible for calling `close()`. */
|
|
300
|
+
type Closeable = CloseableScope;
|
|
301
|
+
/** The outcome supplied to Scope finalizers and resource releases. */
|
|
302
|
+
type Outcome = ScopeOutcome;
|
|
303
|
+
/** A cleanup callback registered with a Scope. */
|
|
304
|
+
type Finalizer = ScopeFinalizer;
|
|
305
|
+
/** A value implementing a JavaScript disposal protocol. */
|
|
306
|
+
type Disposable = DisposableResource;
|
|
307
|
+
}
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/runtime/context.d.ts
|
|
310
|
+
/** The complete contextual state shared by Service, Scope and Layer resolution. */
|
|
311
|
+
interface RuntimeContext {
|
|
312
|
+
readonly resolver: ServiceResolver;
|
|
313
|
+
readonly scope: Scope;
|
|
314
|
+
readonly signal?: AbortSignal;
|
|
315
|
+
readonly resolutionPath: readonly AnyServiceToken[];
|
|
316
|
+
}
|
|
317
|
+
/** Host-specific storage for the current RuntimeContext. */
|
|
318
|
+
interface RuntimeContextStorage {
|
|
319
|
+
run<A>(context: RuntimeContext, program: () => A): A;
|
|
320
|
+
current(): RuntimeContext;
|
|
321
|
+
}
|
|
322
|
+
//#endregion
|
|
197
323
|
//#region src/service/runtime.d.ts
|
|
198
324
|
/** Resolves class-backed Service tokens for a runtime execution. */
|
|
199
325
|
interface ServiceResolver {
|
|
@@ -214,7 +340,7 @@ declare class ServiceRuntime {
|
|
|
214
340
|
* })
|
|
215
341
|
* ```
|
|
216
342
|
*/
|
|
217
|
-
static run<A>(resolver: ServiceResolver, program: () => A): A;
|
|
343
|
+
static run<A>(resolver: ServiceResolver, program: () => A, storage?: RuntimeContextStorage): A;
|
|
218
344
|
/** Return the resolver active in the current execution context. */
|
|
219
345
|
static current(): ServiceResolver;
|
|
220
346
|
/** Resolve a Service token using the active resolver. */
|
|
@@ -244,44 +370,5 @@ declare class ServiceAcquisitionError extends Error {
|
|
|
244
370
|
readonly resolutionPath: readonly AnyServiceToken[];
|
|
245
371
|
}
|
|
246
372
|
//#endregion
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
//#endregion
|
|
250
|
-
//#region src/layer/types.d.ts
|
|
251
|
-
/** Runtime-facing provider registration supplied by a Layer backend. */
|
|
252
|
-
interface LayerRegistration {
|
|
253
|
-
/** The class-backed Service token provided by this registration. */
|
|
254
|
-
readonly service: ServiceClass<any, any>;
|
|
255
|
-
/** Lazily acquire the Service instance; concrete types are erased at this backend boundary. */
|
|
256
|
-
readonly acquire: () => MaybePromise<unknown>;
|
|
257
|
-
}
|
|
258
|
-
/** Generator shape used by `Layer.gen` and `Layer.scopedGen`. */
|
|
259
|
-
type LayerGenerator<S extends ServiceClass<any, any>, Yield extends ServiceRequirement<unknown> = ServiceRequirement<unknown>> = () => AsyncGenerator<Yield, ServiceContract<InstanceType<S>>, unknown>;
|
|
260
|
-
/** Service requirements inferred from a provider's methods and generator. */
|
|
261
|
-
type LayerGeneratorRequirements<S extends ServiceClass<any, any>, Yield extends ServiceRequirement<unknown>> = ServiceRequirements<InstanceType<S>> | InferYieldRequirements<Yield>;
|
|
262
|
-
//#endregion
|
|
263
|
-
//#region src/layer/backend.d.ts
|
|
264
|
-
/** Runtime adapter responsible for registering, resolving, and disposing Layer providers. */
|
|
265
|
-
interface LayerBackend extends ServiceResolver {
|
|
266
|
-
/** Register one Service provider with the backend. */
|
|
267
|
-
register(registration: LayerRegistration): MaybePromise<void>;
|
|
268
|
-
/** Dispose all backend-owned instances and provider registrations. */
|
|
269
|
-
disposeAll(): MaybePromise<void>;
|
|
270
|
-
}
|
|
271
|
-
//#endregion
|
|
272
|
-
//#region src/layer/map-layer-backend.d.ts
|
|
273
|
-
/** Native map-backed Layer backend used by Runtime when no adapter is supplied. */
|
|
274
|
-
declare class MapLayerBackend implements LayerBackend {
|
|
275
|
-
private readonly providers;
|
|
276
|
-
private readonly instances;
|
|
277
|
-
private readonly pending;
|
|
278
|
-
/** Register a provider, rejecting duplicate or colliding Service tags. */
|
|
279
|
-
register(registration: LayerRegistration): void;
|
|
280
|
-
/** Resolve and cache a provider instance by Service tag. */
|
|
281
|
-
resolve<T extends AnyServiceToken>(token: T): Promise<InstanceType<T>>;
|
|
282
|
-
/** Clear pending acquisitions, cached instances, and provider registrations. */
|
|
283
|
-
disposeAll(): Promise<void>;
|
|
284
|
-
}
|
|
285
|
-
//#endregion
|
|
286
|
-
export { ServiceRequirements as A, ServiceRequirement as C, ServiceContract as D, ServiceClass as E, ServiceTagOf as M, ServiceToken as N, ServiceIdentity as O, ServiceTokenOf as P, ProgramFromGenerator as S, AnyServiceToken as T, EffectFromGenerator as _, LayerRegistration as a, EffectYield as b, ServiceAcquisitionError as c, ServiceResolver as d, ServiceRuntime as f, EffectError as g, Effect as h, LayerGeneratorRequirements as i, ServiceTag as j, ServiceInstance as k, ServiceNotFoundError as l, AnyEffect as m, LayerBackend as n, MaybePromise as o, Service as p, LayerGenerator as r, CircularDependencyError as s, MapLayerBackend as t, ServiceRuntimeNotConfiguredError as u, EffectRequirements as v, AnyService as w, Program as x, EffectSuccess as y };
|
|
287
|
-
//# sourceMappingURL=map-layer-backend-7hQkf_QP.d.mts.map
|
|
373
|
+
export { ProgramFromGenerator as A, ServiceTagOf as B, EffectError as C, EffectYield as D, EffectSuccess as E, ServiceContract as F, ServiceTokenOf as H, ServiceIdentity as I, ServiceInstance as L, AnyService as M, AnyServiceToken as N, InferYieldRequirements as O, ServiceClass as P, ServiceRequirements as R, Effect as S, EffectRequirements as T, ServiceToken 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, ServiceTag as z };
|
|
374
|
+
//# sourceMappingURL=index-BFgG9zZC.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BFgG9zZC.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,KAA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;;;;;UCxPV;WACN,UAAU;WACV,OAAO;WACP,SAAS;WACT,yBAAyB;;;UAInB;EACf,IAAI,GAAG,SAAS,gBAAgB,eAAe,IAAI;EACnD,WAAW;;;;;UCAI;;EAEf,QAAQ,UAAU,iBAAiB,OAAO,IAAI,aAAa,KAAK,YAAY,aAAa;;;cAI9E;;;;;;;;;;;;;SAaJ,IAAI,GACT,UAAU,iBACV,eAAe,GACf,UAAS,wBACR;;SAaI,WAAW;;SAiBL,QAAQ,UAAU,iBAAiB,OAAO,IAAI,QAAQ,aAAa;;;;;cC/DrE,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"}
|
|
@@ -1,56 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/** Thrown when Scope context is accessed outside an active Scope execution. */
|
|
4
|
-
declare class ScopeRuntimeNotConfiguredError extends Error {
|
|
5
|
-
constructor();
|
|
6
|
-
}
|
|
7
|
-
/** Thrown when a resource or finalizer is added after Scope closure begins. */
|
|
8
|
-
declare class ScopeClosedError extends Error {
|
|
9
|
-
constructor();
|
|
10
|
-
}
|
|
11
|
-
/** Aggregates finalizer failures encountered while closing a Scope. */
|
|
12
|
-
declare class ScopeCloseError extends Error {
|
|
13
|
-
readonly causes: readonly unknown[];
|
|
14
|
-
constructor(causes: readonly unknown[]);
|
|
15
|
-
}
|
|
16
|
-
/** Thrown when a value has neither Symbol.dispose nor Symbol.asyncDispose. */
|
|
17
|
-
declare class ResourceNotDisposableError extends Error {
|
|
18
|
-
constructor();
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/scope/types.d.ts
|
|
22
|
-
/** A value that may be returned synchronously or asynchronously. */
|
|
23
|
-
type MaybePromise<T> = T | PromiseLike<T>;
|
|
24
|
-
/** Final outcome supplied to Scope finalizers and resource releases. */
|
|
25
|
-
type ScopeOutcome = {
|
|
26
|
-
/** Indicates that the owning program completed successfully. */
|
|
27
|
-
readonly status: 'success';
|
|
28
|
-
} | {
|
|
29
|
-
/** Indicates that the owning program failed or was interrupted. */
|
|
30
|
-
readonly status: 'failure';
|
|
31
|
-
/** The original program or execution failure. */
|
|
32
|
-
readonly cause: unknown;
|
|
33
|
-
};
|
|
34
|
-
/** Cleanup callback registered with a Scope. */
|
|
35
|
-
type ScopeFinalizer = (outcome: ScopeOutcome) => MaybePromise<void>;
|
|
36
|
-
/** Aggregated cleanup information reported at an execution boundary. */
|
|
37
|
-
type CleanupFailureDiagnostic = {
|
|
38
|
-
/** Outcome used for the Scope close that triggered cleanup. */
|
|
39
|
-
readonly outcome: ScopeOutcome;
|
|
40
|
-
/** Aggregated finalizer failure. */
|
|
41
|
-
readonly error: ScopeCloseError;
|
|
42
|
-
};
|
|
43
|
-
type SyncDisposableResource = {
|
|
44
|
-
[Symbol.dispose]: () => void;
|
|
45
|
-
[Symbol.asyncDispose]?: () => MaybePromise<void>;
|
|
46
|
-
};
|
|
47
|
-
type AsyncDisposableResource = {
|
|
48
|
-
[Symbol.dispose]?: () => void;
|
|
49
|
-
[Symbol.asyncDispose]: () => MaybePromise<void>;
|
|
50
|
-
};
|
|
51
|
-
/** A value implementing at least one JavaScript disposal protocol. */
|
|
52
|
-
type DisposableResource = SyncDisposableResource | AsyncDisposableResource;
|
|
53
|
-
//#endregion
|
|
1
|
+
import { B as ServiceTagOf, F as ServiceContract, H as ServiceTokenOf, M as AnyService, N as AnyServiceToken, P as ServiceClass, R as ServiceRequirements, T as EffectRequirements, V as ServiceToken, c as RuntimeContextStorage, d as CleanupFailureDiagnostic, h as ScopeOutcome, j as ServiceRequirement, p as MaybePromise } from "./index-BFgG9zZC.mjs";
|
|
2
|
+
import { a as LayerRegistration, i as LayerGeneratorRequirements, n as LayerBackend, o as MaybePromise$1, r as LayerGenerator } from "./map-layer-backend-CGibcwkc.mjs";
|
|
54
3
|
//#region src/internal/variance.d.ts
|
|
55
4
|
/** Type-level marker for a value produced by `A`. */
|
|
56
5
|
type Covariant<A> = () => A;
|
|
@@ -58,9 +7,9 @@ type Covariant<A> = () => A;
|
|
|
58
7
|
type Invariant<A> = (value: A) => A;
|
|
59
8
|
//#endregion
|
|
60
9
|
//#region src/internal/missing-dependencies.d.ts
|
|
61
|
-
declare const MissingDependenciesTypeId: unique symbol;
|
|
62
10
|
type MissingDependencies<Missing extends AnyService> = {
|
|
63
|
-
|
|
11
|
+
/** Names the Services that must be supplied before execution. */
|
|
12
|
+
readonly missingServices: Missing;
|
|
64
13
|
};
|
|
65
14
|
//#endregion
|
|
66
15
|
//#region src/layer/metadata.d.ts
|
|
@@ -227,6 +176,8 @@ declare class Layer<in out Provided extends AnyService = AnyService, out Require
|
|
|
227
176
|
static gen<S extends ServiceClass<any, any>, Yield extends ServiceRequirement<unknown>>(service: S, factory: LayerGenerator<S, Yield>): LayerResult<ProviderEntry<InstanceType<S>, LayerGeneratorRequirements<S, Yield>>>;
|
|
228
177
|
/** Compose Layers without replacing providers. */
|
|
229
178
|
static merge<const Layers extends readonly LayerInput[]>(...layers: Layers & ValidateLayerTuple<Layers>): MergeResult<Layers>;
|
|
179
|
+
/** Mark a Layer composition root as complete without changing its runtime value. */
|
|
180
|
+
static complete<L extends LayerInput>(layer: L & CompleteInput<L>): L;
|
|
230
181
|
/** Replace providers in a base Layer, using tag identity and compatible contracts. */
|
|
231
182
|
static override<Base extends LayerInput, const Overrides extends readonly LayerInput[]>(base: Base & ValidateLayerInput<Base>, ...overrides: Overrides & ValidateOverrides<Base, Overrides>): OverrideLayerResult<Base, Overrides>;
|
|
232
183
|
}
|
|
@@ -238,6 +189,8 @@ declare namespace Layer {
|
|
|
238
189
|
type Provided<L extends LayerInput> = ProvidedEnvironment<L>;
|
|
239
190
|
/** Extract the external Service requirements of a Layer. */
|
|
240
191
|
type Required<L extends LayerInput> = RequiredEnvironment<L>;
|
|
192
|
+
/** Extract the Services still missing from a Layer composition. */
|
|
193
|
+
type Missing<L extends LayerInput> = RequiredEnvironment<L>;
|
|
241
194
|
/** Validate a Layer's requirements and input shape. */
|
|
242
195
|
type Complete<L extends LayerInput> = CompleteInput<L>;
|
|
243
196
|
}
|
|
@@ -291,7 +244,11 @@ type RuntimeOptions = {
|
|
|
291
244
|
readonly backend?: LayerBackend;
|
|
292
245
|
/** Optional observer for best-effort cleanup diagnostics. */
|
|
293
246
|
readonly onCleanupFailure?: CleanupFailureObserver;
|
|
247
|
+
/** Context storage used by Service, Scope and Layer resolution. */
|
|
248
|
+
readonly contextStorage?: RuntimeContextStorage;
|
|
249
|
+
/** Optional signal exposed through the RuntimeContext. */
|
|
250
|
+
readonly signal?: AbortSignal;
|
|
294
251
|
};
|
|
295
252
|
//#endregion
|
|
296
|
-
export {
|
|
297
|
-
//# sourceMappingURL=index-
|
|
253
|
+
export { LayerDisposeError as a, ServiceTagCollisionError as c, CompleteInput as d, LayerInput as f, DuplicateServiceError as i, Layer as l, RuntimeOptions as n, LayerGeneratorYieldError as o, ProvidedEnvironment as p, RuntimeShutdownDiagnostic as r, LayerRegistrationError as s, CleanupFailureObserver as t, CompleteExecution as u };
|
|
254
|
+
//# sourceMappingURL=index-BddlcJK6.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BddlcJK6.d.mts","names":[],"sources":["../src/internal/variance.ts","../src/internal/missing-dependencies.ts","../src/layer/metadata.ts","../src/layer/inference.ts","../src/layer/layer.ts","../src/layer/errors.ts","../src/runtime/outcome.ts"],"mappings":";;;;KACY,UAAU,WAAW;;KAGrB,UAAU,MAAM,OAAO,MAAM;;;KCF7B,oBAAoB,gBAAgB;;WAErC,iBAAiB;;;;;cCCP;UAEJ,kBACX,iBAAiB,gBACjB,oBAAoB;WAEf,UAAU;WACV,UAAU;;UAGJ,qBACX,iBAAiB,g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;;cAGtC,8BAA8B;WACpB,SAAS;EAAT,YAAA,SAAS;;;cAQnB,iCAAiC;WAEjC,UAAU;WACV,UAAU;EADV,YAAA,UAAU,iBACV,UAAU;;;cAYV,+BAA+B;WAE/B,SAAS;WACT,mBAAmB;WACnB,eAAe;EAFf,YAAA,SAAS,+BACT,mBAAmB,YACnB,eAAe;;;cAcf,0BAA0B;WAChB;EAAA,YAAA;;;cAQV,iCAAiC;WACvB,SAAS;EAAT,YAAA,SAAS;;;;;KC7CpB;;WAED,SAAS;;WAET,OAAO;;;KAIN,0BACV,YAAY,2BAA2B,8BACpC;;KAGO;;WAED,UAAU;;WAEV,mBAAmB;;WAEnB,iBAAiB;;WAEjB,SAAS"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,66 +1,8 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import {
|
|
1
|
+
import { A as ProgramFromGenerator, C as EffectError, D as EffectYield, E as EffectSuccess, F as ServiceContract, H as ServiceTokenOf, I as ServiceIdentity, L as ServiceInstance, M as AnyService, N as AnyServiceToken, P as ServiceClass, R as ServiceRequirements, S as Effect$1, T as EffectRequirements, V as ServiceToken, _ 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, k as Program, l as CloseableScope, m as ScopeFinalizer, n as ServiceAcquisitionError, o as ServiceRuntime, p as MaybePromise$1, r as ServiceNotFoundError, s as RuntimeContext, t as CircularDependencyError, u as Scope, v as ScopeClosedError, w as EffectFromGenerator, x as AnyEffect, y as ScopeRuntimeNotConfiguredError, z as ServiceTag } from "./index-BFgG9zZC.mjs";
|
|
2
|
+
import { a as LayerDisposeError, c as ServiceTagCollisionError, d as CompleteInput, f as LayerInput, i as DuplicateServiceError, l as Layer, n as RuntimeOptions, o as LayerGeneratorYieldError, p as ProvidedEnvironment, r as RuntimeShutdownDiagnostic, s as LayerRegistrationError, t as CleanupFailureObserver, u as CompleteExecution } from "./index-BddlcJK6.mjs";
|
|
3
|
+
import { a as LayerRegistration, n as LayerBackend, t as MapLayerBackend } from "./map-layer-backend-CGibcwkc.mjs";
|
|
4
|
+
import { t as RuntimeContextNotConfiguredError } from "./errors-BXKc7juX.mjs";
|
|
3
5
|
import { Err, Result, UnhandledException } from "better-result";
|
|
4
|
-
//#region src/scope/scope.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Non-owning lifecycle context for finalizers and child Scopes.
|
|
7
|
-
*
|
|
8
|
-
* A Scope can register cleanup and create children, but it cannot close
|
|
9
|
-
* itself. Use `Scope.make()` or `Scope.run()` when your code owns the Scope.
|
|
10
|
-
*/
|
|
11
|
-
interface Scope {
|
|
12
|
-
/** Register a finalizer that runs when the owning Scope closes. */
|
|
13
|
-
addFinalizer(finalizer: ScopeFinalizer): void;
|
|
14
|
-
/** Acquire a resource and register its outcome-aware release callback. */
|
|
15
|
-
acquire<R>(acquire: () => MaybePromise$1<R>, release: (resource: R, outcome: ScopeOutcome) => MaybePromise$1<void>): Promise<R>;
|
|
16
|
-
/** Register an already-acquired disposable resource. */
|
|
17
|
-
add<R extends DisposableResource>(resource: R): Promise<R>;
|
|
18
|
-
/** Create a child Scope owned by this Scope. */
|
|
19
|
-
fork(): CloseableScope;
|
|
20
|
-
}
|
|
21
|
-
/** A Scope whose owner is responsible for calling `close()`. */
|
|
22
|
-
interface CloseableScope extends Scope {
|
|
23
|
-
/** Close the Scope and run children and finalizers in child-first LIFO order. */
|
|
24
|
-
close(outcome?: ScopeOutcome): Promise<void>;
|
|
25
|
-
}
|
|
26
|
-
declare const Scope: {
|
|
27
|
-
/** Create an owned, initially open Scope. */
|
|
28
|
-
readonly make: () => CloseableScope;
|
|
29
|
-
/** Return the non-owning Scope available in the current execution context. */
|
|
30
|
-
readonly current: () => Scope;
|
|
31
|
-
/** Run a callback with an existing Scope supplied as the current context. */
|
|
32
|
-
readonly provide: <A>(scope: Scope, program: () => A) => A;
|
|
33
|
-
/** Resolve the current Scope through `yield* Scope` inside an Effect. */
|
|
34
|
-
readonly [Symbol.iterator]: () => Generator<never, Scope, unknown>;
|
|
35
|
-
/**
|
|
36
|
-
* Run a program in a newly owned Scope.
|
|
37
|
-
*
|
|
38
|
-
* Scope is independent from `better-result`, so returned values—including
|
|
39
|
-
* `Result.err`—close this Scope with a successful outcome. Result-aware
|
|
40
|
-
* outcome classification belongs to `Runtime.run`.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```ts
|
|
44
|
-
* await Scope.run(async (scope) => {
|
|
45
|
-
* const connection = await scope.acquire(connect, (connection) => connection.close())
|
|
46
|
-
* return connection.query()
|
|
47
|
-
* })
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
readonly run: <A>(program: (scope: Scope) => A | PromiseLike<A>) => Promise<Awaited<A>>;
|
|
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
|
-
}
|
|
63
|
-
//#endregion
|
|
64
6
|
//#region src/effect/combinators.d.ts
|
|
65
7
|
type EffectInput<A, E> = Result<A, E> | PromiseLike<Result<A, E>>;
|
|
66
8
|
type AnyEffectInput = EffectInput<any, any>;
|
|
@@ -338,11 +280,15 @@ declare class Runtime<Provided extends AnyService = any> {
|
|
|
338
280
|
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
339
281
|
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
340
282
|
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, options: RuntimeOptions, program: CompleteExecution<ProvidedEnvironment<L>, A>): Promise<Awaited<A>>;
|
|
283
|
+
/** Run a callback with a managed Runtime and always dispose it afterward. */
|
|
284
|
+
static use<A, L extends LayerInput>(layer: L & CompleteInput<L>, use: (runtime: Runtime<ProvidedEnvironment<L>>) => A | PromiseLike<A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
341
285
|
/** Run one execution in this Runtime's child Scope. */
|
|
342
286
|
run<A>(program: CompleteExecution<Provided, A>): Promise<Awaited<A>>;
|
|
343
287
|
private runUnchecked;
|
|
344
288
|
/** Stop new executions and release the Runtime's Layer resources. */
|
|
345
289
|
dispose(): Promise<void>;
|
|
290
|
+
/** Release Runtime-owned resources through JavaScript's async disposal protocol. */
|
|
291
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
346
292
|
private disposeWithOutcome;
|
|
347
293
|
}
|
|
348
294
|
/** Type-level aliases for naming Runtime handles and shutdown options. */
|
|
@@ -355,5 +301,5 @@ declare namespace Runtime {
|
|
|
355
301
|
type ShutdownDiagnostic = RuntimeShutdownDiagnostic;
|
|
356
302
|
}
|
|
357
303
|
//#endregion
|
|
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 };
|
|
304
|
+
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 RuntimeContext, RuntimeContextNotConfiguredError, type RuntimeContextStorage, 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 };
|
|
359
305
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/effect/combinators.ts","../src/effect/effect.ts","../src/function/pipe.ts","../src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