better-effect 0.12.0 → 0.14.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 +599 -30
- package/dist/adapters/iti.d.mts +2 -3
- package/dist/adapters/iti.d.mts.map +1 -1
- package/dist/adapters/iti.mjs +2 -2
- package/dist/bun.d.mts +95 -0
- package/dist/bun.d.mts.map +1 -0
- package/dist/bun.mjs +177 -0
- package/dist/bun.mjs.map +1 -0
- package/dist/{context-BUEf1qjL.mjs → context-DSGSqcJj.mjs} +14 -3
- package/dist/context-DSGSqcJj.mjs.map +1 -0
- package/dist/current-request-Bc1YHL0w.mjs +21 -0
- package/dist/current-request-Bc1YHL0w.mjs.map +1 -0
- package/dist/current-request-Dm-QQ3Xr.d.mts +22 -0
- package/dist/current-request-Dm-QQ3Xr.d.mts.map +1 -0
- package/dist/{effect-CK4YZaX0.mjs → effect-W0IQXY8P.mjs} +21 -2
- package/dist/effect-W0IQXY8P.mjs.map +1 -0
- package/dist/{errors-BKcsQ0ip.d.mts → errors-CpHMzPiP.d.mts} +6 -2
- package/dist/errors-CpHMzPiP.d.mts.map +1 -0
- package/dist/hono.d.mts +65 -27
- package/dist/hono.d.mts.map +1 -1
- package/dist/hono.mjs +177 -53
- package/dist/hono.mjs.map +1 -1
- package/dist/{index-CX6iAoCB.d.mts → index-3Bkl-sxS.d.mts} +7 -2
- package/dist/{index-CX6iAoCB.d.mts.map → index-3Bkl-sxS.d.mts.map} +1 -1
- package/dist/{index-B1nH4luq.d.mts → index-C2ed9Ilq.d.mts} +32 -21
- package/dist/index-C2ed9Ilq.d.mts.map +1 -0
- package/dist/{index-GYJ4qm9K.d.mts → index-ClNndn2-.d.mts} +93 -62
- package/dist/index-ClNndn2-.d.mts.map +1 -0
- package/dist/{index-BMdU_Z72.d.mts → index-Cy1VsU-u.d.mts} +2 -3
- package/dist/index-Cy1VsU-u.d.mts.map +1 -0
- package/dist/index.d.mts +6 -7
- package/dist/index.mjs +8 -8
- package/dist/{internal-identity-CbXoZIfw.mjs → internal-identity-BuHBtP0k.mjs} +2 -2
- package/dist/{internal-identity-CbXoZIfw.mjs.map → internal-identity-BuHBtP0k.mjs.map} +1 -1
- package/dist/layer-2kjHVv4N.mjs +343 -0
- package/dist/layer-2kjHVv4N.mjs.map +1 -0
- package/dist/{outcome-CB43bnFW.d.mts → layer-C2OaqTmB.d.mts} +683 -138
- package/dist/layer-C2OaqTmB.d.mts.map +1 -0
- package/dist/next.d.mts +192 -0
- package/dist/next.d.mts.map +1 -0
- package/dist/next.mjs +185 -0
- package/dist/next.mjs.map +1 -0
- package/dist/{node-context-DWsCUBRa.d.mts → node-context-1YEjrU9g.d.mts} +2 -2
- package/dist/{node-context-DWsCUBRa.d.mts.map → node-context-1YEjrU9g.d.mts.map} +1 -1
- package/dist/{node-context-lggRF4bR.mjs → node-context-g3bCcY9t.mjs} +2 -2
- package/dist/{node-context-lggRF4bR.mjs.map → node-context-g3bCcY9t.mjs.map} +1 -1
- package/dist/node.d.mts +11 -6
- package/dist/node.d.mts.map +1 -1
- package/dist/node.mjs +156 -10
- package/dist/node.mjs.map +1 -1
- package/dist/opentelemetry.d.mts +112 -0
- package/dist/opentelemetry.d.mts.map +1 -0
- package/dist/opentelemetry.mjs +871 -0
- package/dist/opentelemetry.mjs.map +1 -0
- package/dist/{registration-drnZk0SY.mjs → registration-Bwe2GbVu.mjs} +8 -2
- package/dist/registration-Bwe2GbVu.mjs.map +1 -0
- package/dist/runtime/explicit.d.mts +2 -2
- package/dist/runtime/explicit.mjs +1 -1
- package/dist/runtime/node.d.mts +3 -3
- package/dist/runtime/node.mjs +2 -2
- package/dist/runtime-qpcVwaz_.mjs +1680 -0
- package/dist/runtime-qpcVwaz_.mjs.map +1 -0
- package/dist/service-CO9VJQYa.mjs +74 -0
- package/dist/service-CO9VJQYa.mjs.map +1 -0
- package/dist/signal-5Rg9bUUe.mjs +52 -0
- package/dist/signal-5Rg9bUUe.mjs.map +1 -0
- package/dist/{standard-services-GBZ32tll.mjs → standard-services-B-iMM_W7.mjs} +39 -19
- package/dist/standard-services-B-iMM_W7.mjs.map +1 -0
- package/dist/standard-services.d.mts +4 -3
- package/dist/standard-services.mjs +3 -2
- package/dist/testing.d.mts +25 -6
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +51 -7
- package/dist/testing.mjs.map +1 -1
- package/dist/types-BFTqCCcw.d.mts +81 -0
- package/dist/types-BFTqCCcw.d.mts.map +1 -0
- package/dist/web-effect-B9hp9jIe.mjs +380 -0
- package/dist/web-effect-B9hp9jIe.mjs.map +1 -0
- package/dist/web.d.mts +56 -0
- package/dist/web.d.mts.map +1 -0
- package/dist/web.mjs +2 -0
- package/package.json +36 -11
- package/dist/context-BUEf1qjL.mjs.map +0 -1
- package/dist/effect-CK4YZaX0.mjs.map +0 -1
- package/dist/errors-BKcsQ0ip.d.mts.map +0 -1
- package/dist/index-B1nH4luq.d.mts.map +0 -1
- package/dist/index-BMdU_Z72.d.mts.map +0 -1
- package/dist/index-GYJ4qm9K.d.mts.map +0 -1
- package/dist/index-heuaRmXR.d.mts +0 -374
- package/dist/index-heuaRmXR.d.mts.map +0 -1
- package/dist/layer-D56fRdLt.mjs +0 -269
- package/dist/layer-D56fRdLt.mjs.map +0 -1
- package/dist/outcome-CB43bnFW.d.mts.map +0 -1
- package/dist/program-metadata-DhQCCirO.mjs +0 -260
- package/dist/program-metadata-DhQCCirO.mjs.map +0 -1
- package/dist/registration-drnZk0SY.mjs.map +0 -1
- package/dist/runtime-CBMrX8Wl.mjs +0 -776
- package/dist/runtime-CBMrX8Wl.mjs.map +0 -1
- package/dist/signal-D2UTcaaG.mjs +0 -105
- package/dist/signal-D2UTcaaG.mjs.map +0 -1
- package/dist/standard-services-GBZ32tll.mjs.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./index-
|
|
1
|
+
import { It as ServiceRequirement, Kt as ServiceToken, Tt as Service, Vt as ServiceIdentity, ft as ProviderEntry, rt as LayerResult, t as Layer } from "./layer-C2OaqTmB.mjs";
|
|
2
|
+
import "./index-Cy1VsU-u.mjs";
|
|
3
|
+
import "./index-ClNndn2-.mjs";
|
|
4
|
+
import "./current-request-Dm-QQ3Xr.mjs";
|
|
4
5
|
import { Err, StandardSchemaV1, UnhandledException } from "better-result";
|
|
5
6
|
//#region src/standard-services/config.d.ts
|
|
6
7
|
/** Raw string values supplied to a configuration schema. */
|
|
@@ -18,6 +19,9 @@ type ConfigFromEnvOptions<Schema extends StandardSchemaV1> = ConfigSourceOptions
|
|
|
18
19
|
type ConfigOutput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema>;
|
|
19
20
|
/** The raw input type described by a Standard Schema. */
|
|
20
21
|
type ConfigInput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferInput<Schema>;
|
|
22
|
+
/** The string keys exposed by a schema's decoded configuration output. */
|
|
23
|
+
type ConfigOutputObject<Schema extends StandardSchemaV1> = ConfigOutput<Schema> extends object ? ConfigOutput<Schema> : Record<never, never>;
|
|
24
|
+
type ConfigKey<Schema extends StandardSchemaV1> = Extract<keyof ConfigOutputObject<Schema>, string>;
|
|
21
25
|
/** A safe validation issue exposed by a configuration failure. */
|
|
22
26
|
type ConfigIssue = StandardSchemaV1.Issue;
|
|
23
27
|
declare const ConfigValidationError_base: import("better-result").TaggedErrorClass<"ConfigValidationError">;
|
|
@@ -40,19 +44,37 @@ type ConfigYield<Requirements extends Service.Any, Error> = Err<never, Error> |
|
|
|
40
44
|
type ConfigValue<Schema extends StandardSchemaV1, Requirements extends Service.Any = never, Error = ConfigError> = {
|
|
41
45
|
[Symbol.asyncIterator](): AsyncGenerator<ConfigYield<Requirements, Error>, ConfigOutput<Schema>, unknown>;
|
|
42
46
|
};
|
|
47
|
+
type ConfigWithOutput<Schema extends StandardSchemaV1> = Omit<Config, 'get'> & {
|
|
48
|
+
get<Key extends ConfigKey<Schema>>(key: Key): ConfigOutputObject<Schema>[Key];
|
|
49
|
+
};
|
|
50
|
+
type SchemaConfigToken<Schema extends StandardSchemaV1> = Service.Class<'Config', ConfigWithOutput<Schema>> & Service.Token<'Config', ConfigWithOutput<Schema>> & {
|
|
51
|
+
readonly [Symbol.asyncIterator]: () => AsyncGenerator<ServiceRequirement<ConfigWithOutput<Schema>>, ConfigWithOutput<Schema>, unknown>;
|
|
52
|
+
} & {
|
|
53
|
+
readonly layer: (source: ConfigSource) => Layer<ConfigWithOutput<Schema>, never>;
|
|
54
|
+
readonly layerFromEnv: (options?: ConfigSourceOptions) => Layer<ConfigWithOutput<Schema>, never>;
|
|
55
|
+
};
|
|
43
56
|
declare const Config_base: (abstract new () => ServiceIdentity<"Config">) & {
|
|
44
57
|
readonly name: string;
|
|
45
58
|
readonly serviceTag: "Config";
|
|
46
59
|
} & {
|
|
47
60
|
readonly of: Service.FactoryOf<Config, "Config">;
|
|
61
|
+
readonly [Symbol.iterator]: (this: ServiceToken<"Config", Config & ServiceIdentity<"Config">>) => Generator<ServiceRequirement<Config>, Config, unknown>;
|
|
48
62
|
readonly [Symbol.asyncIterator]: (this: ServiceToken<"Config", Config & ServiceIdentity<"Config">>) => AsyncGenerator<ServiceRequirement<Config>, Config, unknown>;
|
|
49
63
|
};
|
|
50
64
|
/** Host-backed raw configuration source and provider token. */
|
|
51
65
|
declare class Config extends Config_base {
|
|
52
66
|
readonly source: ConfigSource;
|
|
67
|
+
private values;
|
|
53
68
|
constructor(source: ConfigSource);
|
|
54
|
-
/** Read one
|
|
69
|
+
/** Read one value from the configured source or decoded schema output. */
|
|
55
70
|
get(key: string): string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Create a schema-bound Config token with a typed `get` accessor.
|
|
73
|
+
*
|
|
74
|
+
* The token validates its source while its Layer is acquired. The accessor then
|
|
75
|
+
* reads the decoded schema output, so its return type follows the selected key.
|
|
76
|
+
*/
|
|
77
|
+
static withSchema<Schema extends StandardSchemaV1>(schema: Schema): SchemaConfigToken<Schema>;
|
|
56
78
|
/** Create a provider from an already-loaded source. */
|
|
57
79
|
static layer(source: ConfigSource): LayerResult<ProviderEntry<Config, never>>;
|
|
58
80
|
/** Create a provider whose source is loaded from dotenv and the host environment. */
|
|
@@ -82,6 +104,7 @@ declare const IdGenerator_base: (abstract new () => ServiceIdentity<"IdGenerator
|
|
|
82
104
|
readonly serviceTag: "IdGenerator";
|
|
83
105
|
} & {
|
|
84
106
|
readonly of: Service.FactoryOf<IdGenerator, "IdGenerator">;
|
|
107
|
+
readonly [Symbol.iterator]: (this: ServiceToken<"IdGenerator", IdGenerator & ServiceIdentity<"IdGenerator">>) => Generator<ServiceRequirement<IdGenerator>, IdGenerator, unknown>;
|
|
85
108
|
readonly [Symbol.asyncIterator]: (this: ServiceToken<"IdGenerator", IdGenerator & ServiceIdentity<"IdGenerator">>) => AsyncGenerator<ServiceRequirement<IdGenerator>, IdGenerator, unknown>;
|
|
86
109
|
};
|
|
87
110
|
/** Host-backed UUID string ID service. */
|
|
@@ -125,6 +148,7 @@ declare const Clock_base: (abstract new () => ServiceIdentity<"Clock">) & {
|
|
|
125
148
|
readonly serviceTag: "Clock";
|
|
126
149
|
} & {
|
|
127
150
|
readonly of: Service.FactoryOf<Clock, "Clock">;
|
|
151
|
+
readonly [Symbol.iterator]: (this: ServiceToken<"Clock", Clock & ServiceIdentity<"Clock">>) => Generator<ServiceRequirement<Clock>, Clock, unknown>;
|
|
128
152
|
readonly [Symbol.asyncIterator]: (this: ServiceToken<"Clock", Clock & ServiceIdentity<"Clock">>) => AsyncGenerator<ServiceRequirement<Clock>, Clock, unknown>;
|
|
129
153
|
};
|
|
130
154
|
/** Host-backed time and waiting service. */
|
|
@@ -167,6 +191,7 @@ declare const Random_base: (abstract new () => ServiceIdentity<"Random">) & {
|
|
|
167
191
|
readonly serviceTag: "Random";
|
|
168
192
|
} & {
|
|
169
193
|
readonly of: Service.FactoryOf<Random, "Random">;
|
|
194
|
+
readonly [Symbol.iterator]: (this: ServiceToken<"Random", Random & ServiceIdentity<"Random">>) => Generator<ServiceRequirement<Random>, Random, unknown>;
|
|
170
195
|
readonly [Symbol.asyncIterator]: (this: ServiceToken<"Random", Random & ServiceIdentity<"Random">>) => AsyncGenerator<ServiceRequirement<Random>, Random, unknown>;
|
|
171
196
|
};
|
|
172
197
|
/** Host-backed pseudo-random number service. */
|
|
@@ -199,6 +224,7 @@ declare const Logger_base: (abstract new () => ServiceIdentity<"Logger">) & {
|
|
|
199
224
|
readonly serviceTag: "Logger";
|
|
200
225
|
} & {
|
|
201
226
|
readonly of: Service.FactoryOf<Logger, "Logger">;
|
|
227
|
+
readonly [Symbol.iterator]: (this: ServiceToken<"Logger", Logger & ServiceIdentity<"Logger">>) => Generator<ServiceRequirement<Logger>, Logger, unknown>;
|
|
202
228
|
readonly [Symbol.asyncIterator]: (this: ServiceToken<"Logger", Logger & ServiceIdentity<"Logger">>) => AsyncGenerator<ServiceRequirement<Logger>, Logger, unknown>;
|
|
203
229
|
};
|
|
204
230
|
/** Structured host logger bridge. */
|
|
@@ -229,21 +255,6 @@ declare class LoggerTest implements Service.Contract<Logger> {
|
|
|
229
255
|
static layer(logger?: LoggerTest): LayerResult<ProviderEntry<Logger, never>>;
|
|
230
256
|
}
|
|
231
257
|
declare const LoggerTestLayer: () => LayerResult<ProviderEntry<Logger, never>>;
|
|
232
|
-
declare const CurrentRequest_base: (abstract new () => ServiceIdentity<"CurrentRequest">) & {
|
|
233
|
-
readonly name: string;
|
|
234
|
-
readonly serviceTag: "CurrentRequest";
|
|
235
|
-
} & {
|
|
236
|
-
readonly of: Service.FactoryOf<CurrentRequest, "CurrentRequest">;
|
|
237
|
-
readonly [Symbol.asyncIterator]: (this: ServiceToken<"CurrentRequest", CurrentRequest & ServiceIdentity<"CurrentRequest">>) => AsyncGenerator<ServiceRequirement<CurrentRequest>, CurrentRequest, unknown>;
|
|
238
|
-
};
|
|
239
|
-
/** Execution-local request value carried by a normal Service provider. */
|
|
240
|
-
declare class CurrentRequest extends CurrentRequest_base {
|
|
241
|
-
readonly value: unknown;
|
|
242
|
-
readonly request: unknown;
|
|
243
|
-
constructor(value: unknown);
|
|
244
|
-
static layer(value: unknown): LayerResult<ProviderEntry<CurrentRequest, never>>;
|
|
245
|
-
}
|
|
246
|
-
declare const CurrentRequestLayer: (value: unknown) => LayerResult<ProviderEntry<CurrentRequest, never>>;
|
|
247
258
|
//#endregion
|
|
248
|
-
export {
|
|
249
|
-
//# sourceMappingURL=index-
|
|
259
|
+
export { ConfigLive as A, IdGeneratorUnavailableError as C, ConfigInput as D, ConfigFromEnvOptions as E, ConfigValidationError as F, ConfigValue as I, StandardSchemaV1 as L, ConfigSource as M, ConfigSourceError as N, ConfigIssue as O, ConfigSourceOptions as P, IdGeneratorTestLayer as S, ConfigError as T, RandomSeededLayer as _, ClockTestLayer as a, IdGeneratorLive as b, LoggerData as c, LoggerLive as d, LoggerTest as f, RandomSeeded as g, RandomLive as h, ClockTest as i, ConfigOutput as j, ConfigKey as k, LoggerEvent as l, Random as m, ClockLive as n, ClockTestRunAllOptions as o, LoggerTestLayer as p, ClockSleepOptions as r, Logger as s, Clock as t, LoggerLevel as u, IdGenerator as v, Config as w, IdGeneratorTest as x, IdGeneratorExhaustedError as y };
|
|
260
|
+
//# sourceMappingURL=index-C2ed9Ilq.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-C2ed9Ilq.d.mts","names":[],"sources":["../src/standard-services/config.ts","../src/standard-services/id-generator.ts","../src/standard-services/index.ts"],"mappings":";;;;;;;KAgBY,eAAe,SAAS;;KAGxB;WACD;WACA,YAAY;;;KAIX,qBAAqB,eAAe,oBAAoB;WACzD,QAAQ;;;KAIP,aAAa,eAAe,oBAAoB,iBAAiB,YAAY;;KAG7E,YAAY,eAAe,oBAAoB,iBAAiB,WAAW;;KAGlF,mBAAmB,eAAe,oBACrC,aAAa,yBAAyB,aAAa,UAAU;KAEnD,UAAU,eAAe,oBAAoB,cACjD,m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,OAAO;EAOhD,MAAM,iBAAiB,OAAO;EAI9B,KAAK,iBAAiB,OAAO;EAI7B,KAAK,iBAAiB,OAAO;EAI7B,MAAM,iBAAiB,OAAO;EAI9B;SAIO;;;;SAKA,MAAM,SAAQ,aAA6B,YAAA,cAAA;;cAKvC,uBAAe,YAAA,cAAA"}
|
|
@@ -1,8 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./index-
|
|
4
|
-
import "./index-CX6iAoCB.mjs";
|
|
1
|
+
import { $ as CompleteInput, F as RuntimeTaskMetadata, Lt as AnyService, Q as CompleteExecutionLayer, V as LayerBackend, Z as CompleteExecution, _ as RuntimeRunOptions, bt as ScopeOutcome, d as RuntimeExecutorRequest, g as RuntimeOptions, h as RuntimeDisposeOptions, ot as ProvidedEnvironment, t as Layer, tt as LayerInput, u as RuntimeExecutor, v as RuntimeShutdownDiagnostic } from "./layer-C2OaqTmB.mjs";
|
|
2
|
+
import "./index-Cy1VsU-u.mjs";
|
|
3
|
+
import "./index-3Bkl-sxS.mjs";
|
|
5
4
|
import { Result, UnhandledException } from "better-result";
|
|
5
|
+
//#region src/function/pipe.d.ts
|
|
6
|
+
type Unary<A, B> = (value: A) => B;
|
|
7
|
+
declare function pipe<A>(value: A): A;
|
|
8
|
+
declare function pipe<A, B>(value: A, ab: Unary<A, B>): B;
|
|
9
|
+
declare function pipe<A, B, C>(value: A, ab: Unary<A, B>, bc: Unary<B, C>): C;
|
|
10
|
+
declare function pipe<A, B, C, D>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>): D;
|
|
11
|
+
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;
|
|
12
|
+
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;
|
|
13
|
+
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;
|
|
14
|
+
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;
|
|
15
|
+
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;
|
|
16
|
+
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;
|
|
17
|
+
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;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/resource/errors.d.ts
|
|
20
|
+
declare const ResourceReleaseFailure_base: import("better-result").TaggedErrorClass<"ResourceReleaseFailure">;
|
|
21
|
+
/** Describes a failure encountered while releasing a Resource. */
|
|
22
|
+
declare class ResourceReleaseFailure extends ResourceReleaseFailure_base<{
|
|
23
|
+
readonly resource: string;
|
|
24
|
+
readonly cause: unknown;
|
|
25
|
+
readonly message: string;
|
|
26
|
+
}> {}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/resource/types.d.ts
|
|
29
|
+
/** A value that may be delivered synchronously or through a thenable. */
|
|
30
|
+
type MaybePromise<T> = T | PromiseLike<T>;
|
|
31
|
+
/** A synchronous or asynchronous better-result Result operation. */
|
|
32
|
+
type AsyncResult<T, E> = MaybePromise<Result<T, E>>;
|
|
33
|
+
/** The allowed return value of a custom Resource release callback. */
|
|
34
|
+
type ReleaseOutcome = void | Result<void, unknown>;
|
|
35
|
+
/** Receives release failures for diagnostics without changing error precedence. */
|
|
36
|
+
type ReleaseFailureObserver = (failure: ResourceReleaseFailure) => MaybePromise<void>;
|
|
37
|
+
/** Options controlling `Resource.acquireUseRelease`. */
|
|
38
|
+
type AcquireUseReleaseOptions<R, A, AcquireError, UseError> = {
|
|
39
|
+
/** Human-readable name included in release failures. */
|
|
40
|
+
readonly name: string;
|
|
41
|
+
/** Acquire the resource. A failure skips use and release. */
|
|
42
|
+
readonly acquire: () => AsyncResult<R, AcquireError>;
|
|
43
|
+
/** Use the acquired resource. Release is attempted afterward. */
|
|
44
|
+
readonly use: (resource: R) => AsyncResult<A, UseError>;
|
|
45
|
+
/** Release the resource, or omit it to use its disposal protocol. */
|
|
46
|
+
readonly release?: (resource: R) => MaybePromise<ReleaseOutcome>;
|
|
47
|
+
/**
|
|
48
|
+
* Observe cleanup failures without changing error precedence. This is most
|
|
49
|
+
* useful when both `use` and `release` can fail.
|
|
50
|
+
*/
|
|
51
|
+
readonly onReleaseFailure?: ReleaseFailureObserver;
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/resource/resource.d.ts
|
|
55
|
+
/**
|
|
56
|
+
* Acquire a resource, use it, and always attempt release afterward.
|
|
57
|
+
*
|
|
58
|
+
* Acquisition, use, and release may be synchronous or asynchronous Result
|
|
59
|
+
* operations. If both use and release fail, the use error remains primary and
|
|
60
|
+
* `onReleaseFailure` receives the cleanup failure as a diagnostic.
|
|
61
|
+
*
|
|
62
|
+
* When `release` is omitted, `Symbol.asyncDispose` is preferred over
|
|
63
|
+
* `Symbol.dispose`.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const result = await Resource.acquireUseRelease({
|
|
68
|
+
* name: 'database connection',
|
|
69
|
+
* acquire: () => connect(),
|
|
70
|
+
* use: (connection) => query(connection),
|
|
71
|
+
* release: (connection) => connection.close()
|
|
72
|
+
* })
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
declare const acquireUseRelease: <R, A, AcquireError, UseError>({ name, acquire, use, release, onReleaseFailure }: AcquireUseReleaseOptions<R, A, AcquireError, UseError>) => Promise<Result<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>>;
|
|
76
|
+
declare const Resource: {
|
|
77
|
+
/** Acquire, use, and release a resource with deterministic error precedence. */
|
|
78
|
+
readonly acquireUseRelease: typeof acquireUseRelease;
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
6
81
|
//#region src/runtime/types.d.ts
|
|
7
82
|
/** A detached diagnostic view of one active Runtime execution. */
|
|
8
83
|
type RuntimeExecutionInspection = {
|
|
@@ -10,6 +85,10 @@ type RuntimeExecutionInspection = {
|
|
|
10
85
|
readonly name?: string;
|
|
11
86
|
readonly startedAt: number;
|
|
12
87
|
};
|
|
88
|
+
/** A detached diagnostic view of one active Scope-owned task. */
|
|
89
|
+
type RuntimeTaskInspection = RuntimeTaskMetadata & {
|
|
90
|
+
readonly state: 'running';
|
|
91
|
+
};
|
|
13
92
|
/**
|
|
14
93
|
* A detached, immutable diagnostic view of a Runtime.
|
|
15
94
|
*
|
|
@@ -18,10 +97,12 @@ type RuntimeExecutionInspection = {
|
|
|
18
97
|
* primitive or readiness guarantee.
|
|
19
98
|
*/
|
|
20
99
|
type RuntimeInspection = {
|
|
21
|
-
readonly state: 'active' | '
|
|
100
|
+
readonly state: 'active' | 'quiescing' | 'draining' | 'aborting' | 'releasing' | 'disposed';
|
|
22
101
|
readonly warmup: 'idle' | 'running' | 'completed' | 'failed';
|
|
23
102
|
readonly activeExecutions: number;
|
|
24
103
|
readonly executions: readonly RuntimeExecutionInspection[];
|
|
104
|
+
readonly activeTasks: number;
|
|
105
|
+
readonly tasks: readonly RuntimeTaskInspection[];
|
|
25
106
|
readonly services: readonly string[];
|
|
26
107
|
readonly shutdownSignalAborted: boolean;
|
|
27
108
|
};
|
|
@@ -55,6 +136,7 @@ type RuntimeOptionsInput = RuntimeOptions & RuntimeRunOptions;
|
|
|
55
136
|
*/
|
|
56
137
|
declare class Runtime<Provided extends AnyService = any> {
|
|
57
138
|
private readonly handle;
|
|
139
|
+
readonly executor: RuntimeExecutor<Provided>;
|
|
58
140
|
private constructor();
|
|
59
141
|
/**
|
|
60
142
|
* Create a long-lived Runtime that owns its Layer resources.
|
|
@@ -79,6 +161,8 @@ declare class Runtime<Provided extends AnyService = any> {
|
|
|
79
161
|
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, options: RuntimeOptionsInput, program: CompleteExecution<ProvidedEnvironment<L>, A>): Promise<Awaited<A>>;
|
|
80
162
|
/** Run a callback with a managed Runtime and always dispose it afterward. */
|
|
81
163
|
static use<A, L extends LayerInput>(layer: L & CompleteInput<L>, use: (runtime: Runtime<ProvidedEnvironment<L>>) => A | PromiseLike<A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
164
|
+
/** Request the non-owning executor view from the current Runtime context. */
|
|
165
|
+
static executor<Requested extends AnyService>(): RuntimeExecutorRequest<Requested>;
|
|
82
166
|
/** Resolve every Layer provider and dispose the Runtime if warmup fails. */
|
|
83
167
|
warmup(): Promise<void>;
|
|
84
168
|
/** Return a detached diagnostic snapshot without changing Runtime state. */
|
|
@@ -112,6 +196,8 @@ declare namespace Runtime {
|
|
|
112
196
|
type Inspection = RuntimeInspection;
|
|
113
197
|
/** Detached diagnostic view of one active execution. */
|
|
114
198
|
type ExecutionInspection = RuntimeExecutionInspection;
|
|
199
|
+
/** Non-owning view that can start child Runtime executions. */
|
|
200
|
+
type Executor<Provided extends AnyService = any> = RuntimeExecutor<Provided>;
|
|
115
201
|
}
|
|
116
202
|
//#endregion
|
|
117
203
|
//#region src/runtime/signal.d.ts
|
|
@@ -120,60 +206,5 @@ declare const CurrentAbortSignal: {
|
|
|
120
206
|
readonly [Symbol.iterator]: () => Generator<never, AbortSignal, unknown>;
|
|
121
207
|
};
|
|
122
208
|
//#endregion
|
|
123
|
-
|
|
124
|
-
|
|
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
|
|
209
|
+
export { RuntimeInspection as a, AcquireUseReleaseOptions as c, ReleaseOutcome as d, ResourceReleaseFailure as f, RuntimeFor as i, AsyncResult as l, Runtime as n, RuntimeTaskInspection as o, pipe as p, RuntimeExecutionInspection as r, Resource as s, CurrentAbortSignal as t, ReleaseFailureObserver as u };
|
|
210
|
+
//# sourceMappingURL=index-ClNndn2-.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-ClNndn2-.d.mts","names":[],"sources":["../src/function/pipe.ts","../src/resource/errors.ts","../src/resource/types.ts","../src/resource/resource.ts","../src/runtime/types.ts","../src/runtime/runtime.ts","../src/runtime/signal.ts"],"mappings":";;;;;KAAK,MAAM,GAAG,MAAM,OAAO,MAAM;iBAqBjB,KAA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IX;;EASR,QAAQ,UAAU,wBAAwB;;EAG1C,QAAQ,SAAS,eAAe;;GAOzB,OAAO,iBAAiB;UAIvB;;;kBAMe;;OAEX,IAAI,UAAU,cAAc,WAAW;;OAGvC,UAAU;;OAGV,aAAa;;OAGb,iBAAiB;;OAGjB,qBAAqB;;OAGrB,aAAa;;OAGb,sBAAsB;;OAGtB,SAAS,iBAAiB,oBAAoB,gBAAgB;;;;;cCjV/D;YAEW,OAAA,iBAAA,iBAAiB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { S as LayerRegistration, b as LayerBackendDisposeOptions, y as LayerBackend } from "./outcome-CB43bnFW.mjs";
|
|
1
|
+
import { G as LayerRegistration, H as LayerBackendDisposeOptions, Rt as AnyServiceToken, V as LayerBackend } from "./layer-C2OaqTmB.mjs";
|
|
3
2
|
//#region src/layer/map-layer-backend.d.ts
|
|
4
3
|
/** Native map-backed Layer backend used by Runtime when no adapter is supplied. */
|
|
5
4
|
declare class MapLayerBackend implements LayerBackend {
|
|
@@ -15,4 +14,4 @@ declare class MapLayerBackend implements LayerBackend {
|
|
|
15
14
|
}
|
|
16
15
|
//#endregion
|
|
17
16
|
export { MapLayerBackend as t };
|
|
18
|
-
//# sourceMappingURL=index-
|
|
17
|
+
//# sourceMappingURL=index-Cy1VsU-u.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Cy1VsU-u.d.mts","names":[],"sources":["../src/layer/map-layer-backend.ts"],"mappings":";;;cAca,2BAA2B;mBACrB;mBAEA;mBAEA;;EAGjB,SAAS,cAAc;;EAiBjB,QAAQ,UAAU,iBAAiB,OAAO,IAAI,QAAQ,aAAa;;EA6CnE,WAAW,UAAU,6BAA6B"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as RuntimeContextNotConfiguredError } from "./errors-
|
|
6
|
-
|
|
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 };
|
|
1
|
+
import { A as RuntimeServiceAcquireEvent, At as EffectRequirements, Bt as ServiceContract, C as RuntimeExecutionStartEvent, Ct as ScopeClosedError, D as RuntimeLifecycleStartEvent, E as RuntimeLifecycleReleaseEvent, Et as AnyEffect, F as RuntimeTaskMetadata, G as LayerRegistration, H as LayerBackendDisposeOptions, Ht as ServiceInstance, I as RuntimeTaskStartEvent, It as ServiceRequirement, J as LayerGeneratorYieldError, K as DuplicateServiceError, Kt as ServiceToken, L as ScopedTask, Lt as AnyService, M as RuntimeShutdownEvent, Mt as EffectYield, N as RuntimeShutdownPhase, O as RuntimeObserver, Ot as EffectError, P as RuntimeTaskEndEvent, R as ScopedTaskExit, Rt as AnyServiceToken, S as RuntimeExecutionMetadata, St as ScopeCloseError, T as RuntimeLifecycleEventMetadata, Tt as Service, U as LayerLifecycle, Ut as ServiceRequirements, V as LayerBackend, Vt as ServiceIdentity, W as LayerQuiesce, Wt as ServiceTag, X as ServiceTagCollisionError, Y as LayerRegistrationError, _ as RuntimeRunOptions, _t as DisposableResource, a as ServiceRuntimeNotConfiguredError, b as RuntimeExecutionAttributes, bt as ScopeOutcome, c as RuntimeContext, f as RuntimeManagedExecution, g as RuntimeOptions, gt as CleanupFailureDiagnostic, h as RuntimeDisposeOptions, ht as Scope, i as ServiceNotFoundError, j as RuntimeServiceResolveEvent, jt as EffectSuccess, k as RuntimeResourceReleaseEvent, l as RuntimeContextStorage, m as CleanupFailureObserver, mt as CloseableScope, n as CircularDependencyError, o as ServiceResolver, p as RuntimeManagedPlan, q as LayerDisposeError, qt as ServiceTokenOf, r as ServiceAcquisitionError, s as ServiceRuntime, t as Layer, u as RuntimeExecutor, v as RuntimeShutdownDiagnostic, w as RuntimeLifecycleEndEvent, wt as ScopeRuntimeNotConfiguredError, x as RuntimeExecutionEndEvent, xt as ResourceNotDisposableError, y as RuntimeShutdownReason, yt as ScopeFinalizer, z as ScopedTaskState, zt as ServiceClass } from "./layer-C2OaqTmB.mjs";
|
|
2
|
+
import { t as MapLayerBackend } from "./index-Cy1VsU-u.mjs";
|
|
3
|
+
import { n as Program, r as ProgramAllOptions, t as Effect } from "./index-3Bkl-sxS.mjs";
|
|
4
|
+
import { a as RuntimeInspection, c as AcquireUseReleaseOptions, d as ReleaseOutcome, f as ResourceReleaseFailure, i as RuntimeFor, l as AsyncResult, n as Runtime, o as RuntimeTaskInspection, p as pipe, r as RuntimeExecutionInspection, s as Resource, t as CurrentAbortSignal, u as ReleaseFailureObserver } from "./index-ClNndn2-.mjs";
|
|
5
|
+
import { r as RuntimeExecutorNotConfiguredError, t as RuntimeContextNotConfiguredError } from "./errors-CpHMzPiP.mjs";
|
|
6
|
+
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 LayerLifecycle, type LayerQuiesce, 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 RuntimeExecutor, RuntimeExecutorNotConfiguredError, type RuntimeFor, type RuntimeInspection, type RuntimeLifecycleEndEvent, type RuntimeLifecycleEventMetadata, type RuntimeLifecycleReleaseEvent, type RuntimeLifecycleStartEvent, type RuntimeManagedExecution, type RuntimeManagedPlan, RuntimeObserver, type RuntimeOptions, type RuntimeResourceReleaseEvent, type RuntimeRunOptions, type RuntimeServiceAcquireEvent, type RuntimeServiceResolveEvent, type RuntimeShutdownDiagnostic, type RuntimeShutdownEvent, type RuntimeShutdownPhase, type RuntimeShutdownReason, type RuntimeTaskEndEvent, type RuntimeTaskInspection, type RuntimeTaskMetadata, type RuntimeTaskStartEvent, Scope, ScopeCloseError, ScopeClosedError, type ScopeFinalizer, type ScopeOutcome, ScopeRuntimeNotConfiguredError, type ScopedTask, type ScopedTaskExit, type ScopedTaskState, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as LayerGeneratorYieldError, c as CircularDependencyError, d as ServiceRuntimeNotConfiguredError, i as LayerDisposeError, l as ServiceAcquisitionError, o as LayerRegistrationError, r as DuplicateServiceError, s as ServiceTagCollisionError, u as ServiceNotFoundError } from "./registration-
|
|
2
|
-
import { h as RuntimeContextNotConfiguredError } from "./context-
|
|
3
|
-
import { a as ResourceNotDisposableError, c as ScopeRuntimeNotConfiguredError, o as ScopeCloseError, r as disposeResource, s as ScopeClosedError, t as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as Program, t as Effect } from "./effect-
|
|
1
|
+
import { a as LayerGeneratorYieldError, c as CircularDependencyError, d as ServiceRuntimeNotConfiguredError, i as LayerDisposeError, l as ServiceAcquisitionError, o as LayerRegistrationError, r as DuplicateServiceError, s as ServiceTagCollisionError, u as ServiceNotFoundError } from "./registration-Bwe2GbVu.mjs";
|
|
2
|
+
import { _ as RuntimeExecutorNotConfiguredError, h as RuntimeContextNotConfiguredError } from "./context-DSGSqcJj.mjs";
|
|
3
|
+
import { a as ResourceNotDisposableError, c as ScopeRuntimeNotConfiguredError, l as ServiceRuntime, o as ScopeCloseError, r as disposeResource, s as ScopeClosedError, t as Layer } from "./layer-2kjHVv4N.mjs";
|
|
4
|
+
import { t as Service } from "./service-CO9VJQYa.mjs";
|
|
5
|
+
import { a as RuntimeObserver, c as MapLayerBackend, l as Scope, t as Runtime } from "./runtime-qpcVwaz_.mjs";
|
|
6
|
+
import { t as CurrentAbortSignal } from "./signal-5Rg9bUUe.mjs";
|
|
7
|
+
import { n as Program, t as Effect } from "./effect-W0IQXY8P.mjs";
|
|
8
8
|
import { Result, TaggedError } from "better-result";
|
|
9
9
|
//#region src/function/pipe.ts
|
|
10
10
|
function pipe(value, ...operations) {
|
|
@@ -88,6 +88,6 @@ const Resource = {
|
|
|
88
88
|
/** Acquire, use, and release a resource with deterministic error precedence. */
|
|
89
89
|
acquireUseRelease };
|
|
90
90
|
//#endregion
|
|
91
|
-
export { CircularDependencyError, CurrentAbortSignal, DuplicateServiceError, Effect, Layer, LayerDisposeError, LayerGeneratorYieldError, LayerRegistrationError, MapLayerBackend, Program, Resource, ResourceNotDisposableError, ResourceReleaseFailure, Runtime, RuntimeContextNotConfiguredError, RuntimeObserver, Scope, ScopeCloseError, ScopeClosedError, ScopeRuntimeNotConfiguredError, Service, ServiceAcquisitionError, ServiceNotFoundError, ServiceRuntime, ServiceRuntimeNotConfiguredError, ServiceTagCollisionError, pipe };
|
|
91
|
+
export { CircularDependencyError, CurrentAbortSignal, DuplicateServiceError, Effect, Layer, LayerDisposeError, LayerGeneratorYieldError, LayerRegistrationError, MapLayerBackend, Program, Resource, ResourceNotDisposableError, ResourceReleaseFailure, Runtime, RuntimeContextNotConfiguredError, RuntimeExecutorNotConfiguredError, RuntimeObserver, Scope, ScopeCloseError, ScopeClosedError, ScopeRuntimeNotConfiguredError, Service, ServiceAcquisitionError, ServiceNotFoundError, ServiceRuntime, ServiceRuntimeNotConfiguredError, ServiceTagCollisionError, pipe };
|
|
92
92
|
|
|
93
93
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as captureServiceTag, s as ServiceTagCollisionError } from "./registration-
|
|
1
|
+
import { f as captureServiceTag, s as ServiceTagCollisionError } from "./registration-Bwe2GbVu.mjs";
|
|
2
2
|
//#region src/layer/internal-identity.ts
|
|
3
3
|
const serviceMemberNames = (token) => {
|
|
4
4
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -24,4 +24,4 @@ const assertServiceCompatibility = (requested, registered, instance) => {
|
|
|
24
24
|
//#endregion
|
|
25
25
|
export { assertServiceCompatibility as t };
|
|
26
26
|
|
|
27
|
-
//# sourceMappingURL=internal-identity-
|
|
27
|
+
//# sourceMappingURL=internal-identity-BuHBtP0k.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-identity-
|
|
1
|
+
{"version":3,"file":"internal-identity-BuHBtP0k.mjs","names":[],"sources":["../src/layer/internal-identity.ts"],"sourcesContent":["import { captureServiceTag } from '../service/tag'\nimport type { AnyServiceToken } from '../service'\n\nimport { ServiceTagCollisionError } from './errors'\n\nimport type { LayerRegistration } from './types'\n\ntype LayerAcquiredValue = Awaited<ReturnType<LayerRegistration['acquire']>>\n\nconst serviceMemberNames = (token: AnyServiceToken): readonly (string | symbol)[] => {\n const names = new Set<string | symbol>()\n let prototype = token.prototype\n\n while (prototype && prototype !== Object.prototype) {\n for (const name of Object.getOwnPropertyNames(prototype)) {\n if (name !== 'constructor') {\n names.add(name)\n }\n }\n\n for (const symbol of Object.getOwnPropertySymbols(prototype)) {\n names.add(symbol)\n }\n\n prototype = Object.getPrototypeOf(prototype)\n }\n\n return [...names]\n}\n\n/**\n * Check the runtime portion of a same-tag association before returning it.\n * TypeScript remains authoritative for full structural compatibility; this\n * check catches the common incompatible-method collision after erasure.\n */\nexport const assertServiceCompatibility = (\n requested: AnyServiceToken,\n registered: AnyServiceToken,\n instance: LayerAcquiredValue\n): void => {\n if (requested === registered || captureServiceTag(requested) !== captureServiceTag(registered)) {\n return\n }\n\n const candidate = Object(instance)\n\n // SAFETY: Service providers are object instances; Object() lets this runtime boundary reject rogue primitive values without trusting their static type.\n if (candidate !== instance) {\n throw new ServiceTagCollisionError(registered, requested)\n }\n\n for (const name of serviceMemberNames(requested)) {\n if (!(name in candidate)) {\n throw new ServiceTagCollisionError(registered, requested)\n }\n }\n}\n"],"mappings":";;AASA,MAAM,sBAAsB,UAAyD;CACnF,MAAM,wBAAQ,IAAI,IAAqB;CACvC,IAAI,YAAY,MAAM;CAEtB,OAAO,aAAa,cAAc,OAAO,WAAW;EAClD,KAAK,MAAM,QAAQ,OAAO,oBAAoB,SAAS,GACrD,IAAI,SAAS,eACX,MAAM,IAAI,IAAI;EAIlB,KAAK,MAAM,UAAU,OAAO,sBAAsB,SAAS,GACzD,MAAM,IAAI,MAAM;EAGlB,YAAY,OAAO,eAAe,SAAS;CAC7C;CAEA,OAAO,CAAC,GAAG,KAAK;AAClB;;;;;;AAOA,MAAa,8BACX,WACA,YACA,aACS;CACT,IAAI,cAAc,cAAc,kBAAkB,SAAS,MAAM,kBAAkB,UAAU,GAC3F;CAGF,MAAM,YAAY,OAAO,QAAQ;CAGjC,IAAI,cAAc,UAChB,MAAM,IAAI,yBAAyB,YAAY,SAAS;CAG1D,KAAK,MAAM,QAAQ,mBAAmB,SAAS,GAC7C,IAAI,EAAE,QAAQ,YACZ,MAAM,IAAI,yBAAyB,YAAY,SAAS;AAG9D"}
|