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.
Files changed (101) hide show
  1. package/README.md +599 -30
  2. package/dist/adapters/iti.d.mts +2 -3
  3. package/dist/adapters/iti.d.mts.map +1 -1
  4. package/dist/adapters/iti.mjs +2 -2
  5. package/dist/bun.d.mts +95 -0
  6. package/dist/bun.d.mts.map +1 -0
  7. package/dist/bun.mjs +177 -0
  8. package/dist/bun.mjs.map +1 -0
  9. package/dist/{context-BUEf1qjL.mjs → context-DSGSqcJj.mjs} +14 -3
  10. package/dist/context-DSGSqcJj.mjs.map +1 -0
  11. package/dist/current-request-Bc1YHL0w.mjs +21 -0
  12. package/dist/current-request-Bc1YHL0w.mjs.map +1 -0
  13. package/dist/current-request-Dm-QQ3Xr.d.mts +22 -0
  14. package/dist/current-request-Dm-QQ3Xr.d.mts.map +1 -0
  15. package/dist/{effect-CK4YZaX0.mjs → effect-W0IQXY8P.mjs} +21 -2
  16. package/dist/effect-W0IQXY8P.mjs.map +1 -0
  17. package/dist/{errors-BKcsQ0ip.d.mts → errors-CpHMzPiP.d.mts} +6 -2
  18. package/dist/errors-CpHMzPiP.d.mts.map +1 -0
  19. package/dist/hono.d.mts +65 -27
  20. package/dist/hono.d.mts.map +1 -1
  21. package/dist/hono.mjs +177 -53
  22. package/dist/hono.mjs.map +1 -1
  23. package/dist/{index-CX6iAoCB.d.mts → index-3Bkl-sxS.d.mts} +7 -2
  24. package/dist/{index-CX6iAoCB.d.mts.map → index-3Bkl-sxS.d.mts.map} +1 -1
  25. package/dist/{index-B1nH4luq.d.mts → index-C2ed9Ilq.d.mts} +32 -21
  26. package/dist/index-C2ed9Ilq.d.mts.map +1 -0
  27. package/dist/{index-GYJ4qm9K.d.mts → index-ClNndn2-.d.mts} +93 -62
  28. package/dist/index-ClNndn2-.d.mts.map +1 -0
  29. package/dist/{index-BMdU_Z72.d.mts → index-Cy1VsU-u.d.mts} +2 -3
  30. package/dist/index-Cy1VsU-u.d.mts.map +1 -0
  31. package/dist/index.d.mts +6 -7
  32. package/dist/index.mjs +8 -8
  33. package/dist/{internal-identity-CbXoZIfw.mjs → internal-identity-BuHBtP0k.mjs} +2 -2
  34. package/dist/{internal-identity-CbXoZIfw.mjs.map → internal-identity-BuHBtP0k.mjs.map} +1 -1
  35. package/dist/layer-2kjHVv4N.mjs +343 -0
  36. package/dist/layer-2kjHVv4N.mjs.map +1 -0
  37. package/dist/{outcome-CB43bnFW.d.mts → layer-C2OaqTmB.d.mts} +683 -138
  38. package/dist/layer-C2OaqTmB.d.mts.map +1 -0
  39. package/dist/next.d.mts +192 -0
  40. package/dist/next.d.mts.map +1 -0
  41. package/dist/next.mjs +185 -0
  42. package/dist/next.mjs.map +1 -0
  43. package/dist/{node-context-DWsCUBRa.d.mts → node-context-1YEjrU9g.d.mts} +2 -2
  44. package/dist/{node-context-DWsCUBRa.d.mts.map → node-context-1YEjrU9g.d.mts.map} +1 -1
  45. package/dist/{node-context-lggRF4bR.mjs → node-context-g3bCcY9t.mjs} +2 -2
  46. package/dist/{node-context-lggRF4bR.mjs.map → node-context-g3bCcY9t.mjs.map} +1 -1
  47. package/dist/node.d.mts +11 -6
  48. package/dist/node.d.mts.map +1 -1
  49. package/dist/node.mjs +156 -10
  50. package/dist/node.mjs.map +1 -1
  51. package/dist/opentelemetry.d.mts +112 -0
  52. package/dist/opentelemetry.d.mts.map +1 -0
  53. package/dist/opentelemetry.mjs +871 -0
  54. package/dist/opentelemetry.mjs.map +1 -0
  55. package/dist/{registration-drnZk0SY.mjs → registration-Bwe2GbVu.mjs} +8 -2
  56. package/dist/registration-Bwe2GbVu.mjs.map +1 -0
  57. package/dist/runtime/explicit.d.mts +2 -2
  58. package/dist/runtime/explicit.mjs +1 -1
  59. package/dist/runtime/node.d.mts +3 -3
  60. package/dist/runtime/node.mjs +2 -2
  61. package/dist/runtime-qpcVwaz_.mjs +1680 -0
  62. package/dist/runtime-qpcVwaz_.mjs.map +1 -0
  63. package/dist/service-CO9VJQYa.mjs +74 -0
  64. package/dist/service-CO9VJQYa.mjs.map +1 -0
  65. package/dist/signal-5Rg9bUUe.mjs +52 -0
  66. package/dist/signal-5Rg9bUUe.mjs.map +1 -0
  67. package/dist/{standard-services-GBZ32tll.mjs → standard-services-B-iMM_W7.mjs} +39 -19
  68. package/dist/standard-services-B-iMM_W7.mjs.map +1 -0
  69. package/dist/standard-services.d.mts +4 -3
  70. package/dist/standard-services.mjs +3 -2
  71. package/dist/testing.d.mts +25 -6
  72. package/dist/testing.d.mts.map +1 -1
  73. package/dist/testing.mjs +51 -7
  74. package/dist/testing.mjs.map +1 -1
  75. package/dist/types-BFTqCCcw.d.mts +81 -0
  76. package/dist/types-BFTqCCcw.d.mts.map +1 -0
  77. package/dist/web-effect-B9hp9jIe.mjs +380 -0
  78. package/dist/web-effect-B9hp9jIe.mjs.map +1 -0
  79. package/dist/web.d.mts +56 -0
  80. package/dist/web.d.mts.map +1 -0
  81. package/dist/web.mjs +2 -0
  82. package/package.json +36 -11
  83. package/dist/context-BUEf1qjL.mjs.map +0 -1
  84. package/dist/effect-CK4YZaX0.mjs.map +0 -1
  85. package/dist/errors-BKcsQ0ip.d.mts.map +0 -1
  86. package/dist/index-B1nH4luq.d.mts.map +0 -1
  87. package/dist/index-BMdU_Z72.d.mts.map +0 -1
  88. package/dist/index-GYJ4qm9K.d.mts.map +0 -1
  89. package/dist/index-heuaRmXR.d.mts +0 -374
  90. package/dist/index-heuaRmXR.d.mts.map +0 -1
  91. package/dist/layer-D56fRdLt.mjs +0 -269
  92. package/dist/layer-D56fRdLt.mjs.map +0 -1
  93. package/dist/outcome-CB43bnFW.d.mts.map +0 -1
  94. package/dist/program-metadata-DhQCCirO.mjs +0 -260
  95. package/dist/program-metadata-DhQCCirO.mjs.map +0 -1
  96. package/dist/registration-drnZk0SY.mjs.map +0 -1
  97. package/dist/runtime-CBMrX8Wl.mjs +0 -776
  98. package/dist/runtime-CBMrX8Wl.mjs.map +0 -1
  99. package/dist/signal-D2UTcaaG.mjs +0 -105
  100. package/dist/signal-D2UTcaaG.mjs.map +0 -1
  101. package/dist/standard-services-GBZ32tll.mjs.map +0 -1
@@ -1,6 +1,7 @@
1
- import { H as ServiceToken, I as ServiceIdentity, b as Service, j as ServiceRequirement } from "./index-heuaRmXR.mjs";
2
- import { R as ProviderEntry, k as LayerResult } from "./outcome-CB43bnFW.mjs";
3
- import "./index-GYJ4qm9K.mjs";
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 raw value from the configured source. */
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 { ConfigIssue as A, IdGeneratorTest as C, ConfigError as D, Config as E, ConfigSourceOptions as F, ConfigValidationError as I, ConfigValue as L, ConfigOutput as M, ConfigSource as N, ConfigFromEnvOptions as O, ConfigSourceError as P, StandardSchemaV1 as R, IdGeneratorLive as S, IdGeneratorUnavailableError as T, RandomLive as _, ClockTestLayer as a, IdGenerator as b, CurrentRequestLayer as c, LoggerEvent as d, LoggerLevel as f, Random as g, LoggerTestLayer as h, ClockTest as i, ConfigLive as j, ConfigInput as k, Logger as l, LoggerTest as m, ClockLive as n, ClockTestRunAllOptions as o, LoggerLive as p, ClockSleepOptions as r, CurrentRequest as s, Clock as t, LoggerData as u, RandomSeeded as v, IdGeneratorTestLayer as w, IdGeneratorExhaustedError as x, RandomSeededLayer as y };
249
- //# sourceMappingURL=index-B1nH4luq.d.mts.map
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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QAAQ,SAAS;WACzC,QAAQ;EAEjB,IAAI,OAAO;EACX,IAAI,OAAO,aAAa,iBAAiB,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 { 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";
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' | 'disposing' | 'disposed';
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
- //#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
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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U,uBAAuB,UAAU,UAClD,SAAS,kBAAkB,WAAW,oBAAoB,UAAU,IACpE,UAAU,oBACT,QAAQ,QAAQ;UAIX;;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 { N as AnyServiceToken } from "./index-heuaRmXR.mjs";
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-BMdU_Z72.d.mts.map
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 { 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
- import { t as RuntimeContextNotConfiguredError } from "./errors-BKcsQ0ip.mjs";
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 };
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-drnZk0SY.mjs";
2
- import { h as RuntimeContextNotConfiguredError } from "./context-BUEf1qjL.mjs";
3
- import { a as ResourceNotDisposableError, c as ScopeRuntimeNotConfiguredError, o as ScopeCloseError, r as disposeResource, s as ScopeClosedError, t as CurrentAbortSignal } from "./signal-D2UTcaaG.mjs";
4
- import { n as Service, r as ServiceRuntime, t as Layer } from "./layer-D56fRdLt.mjs";
5
- import { i as Scope } from "./program-metadata-DhQCCirO.mjs";
6
- import { i as MapLayerBackend, n as RuntimeObserver, t as Runtime } from "./runtime-CBMrX8Wl.mjs";
7
- import { n as Program, t as Effect } from "./effect-CK4YZaX0.mjs";
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-drnZk0SY.mjs";
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-CbXoZIfw.mjs.map
27
+ //# sourceMappingURL=internal-identity-BuHBtP0k.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal-identity-CbXoZIfw.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"}
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"}