better-effect 0.13.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 (109) hide show
  1. package/README.md +337 -88
  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 +75 -23
  6. package/dist/bun.d.mts.map +1 -1
  7. package/dist/bun.mjs +170 -33
  8. package/dist/bun.mjs.map +1 -1
  9. package/dist/{context-BphfFUMO.mjs → context-DSGSqcJj.mjs} +12 -3
  10. package/dist/context-DSGSqcJj.mjs.map +1 -0
  11. package/dist/{current-request-DDKNyymv.mjs → current-request-Bc1YHL0w.mjs} +3 -2
  12. package/dist/{current-request-DDKNyymv.mjs.map → current-request-Bc1YHL0w.mjs.map} +1 -1
  13. package/dist/{current-request-CIU7AHhF.d.mts → current-request-Dm-QQ3Xr.d.mts} +4 -4
  14. package/dist/current-request-Dm-QQ3Xr.d.mts.map +1 -0
  15. package/dist/{effect-CPdV7Yv8.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 +63 -27
  20. package/dist/hono.d.mts.map +1 -1
  21. package/dist/hono.mjs +111 -45
  22. package/dist/hono.mjs.map +1 -1
  23. package/dist/{index-CCi07kUw.d.mts → index-3Bkl-sxS.d.mts} +7 -2
  24. package/dist/{index-CCi07kUw.d.mts.map → index-3Bkl-sxS.d.mts.map} +1 -1
  25. package/dist/{index-cXgyMa0v.d.mts → index-C2ed9Ilq.d.mts} +32 -7
  26. package/dist/index-C2ed9Ilq.d.mts.map +1 -0
  27. package/dist/{index-BodMy6rO.d.mts → index-ClNndn2-.d.mts} +93 -63
  28. package/dist/index-ClNndn2-.d.mts.map +1 -0
  29. package/dist/{index-DAKn0qHk.d.mts → index-Cy1VsU-u.d.mts} +2 -4
  30. package/dist/index-Cy1VsU-u.d.mts.map +1 -0
  31. package/dist/index.d.mts +6 -8
  32. package/dist/index.mjs +8 -9
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/{internal-identity-CbXoZIfw.mjs → internal-identity-BuHBtP0k.mjs} +2 -2
  35. package/dist/{internal-identity-CbXoZIfw.mjs.map → internal-identity-BuHBtP0k.mjs.map} +1 -1
  36. package/dist/layer-2kjHVv4N.mjs +343 -0
  37. package/dist/layer-2kjHVv4N.mjs.map +1 -0
  38. package/dist/layer-C2OaqTmB.d.mts +987 -0
  39. package/dist/layer-C2OaqTmB.d.mts.map +1 -0
  40. package/dist/next.d.mts +102 -26
  41. package/dist/next.d.mts.map +1 -1
  42. package/dist/next.mjs +157 -40
  43. package/dist/next.mjs.map +1 -1
  44. package/dist/{node-context-DczjAcrX.d.mts → node-context-1YEjrU9g.d.mts} +2 -2
  45. package/dist/{node-context-DczjAcrX.d.mts.map → node-context-1YEjrU9g.d.mts.map} +1 -1
  46. package/dist/{node-context-Ca18oNSg.mjs → node-context-g3bCcY9t.mjs} +2 -2
  47. package/dist/{node-context-Ca18oNSg.mjs.map → node-context-g3bCcY9t.mjs.map} +1 -1
  48. package/dist/node.d.mts +11 -6
  49. package/dist/node.d.mts.map +1 -1
  50. package/dist/node.mjs +156 -10
  51. package/dist/node.mjs.map +1 -1
  52. package/dist/opentelemetry.d.mts +20 -2
  53. package/dist/opentelemetry.d.mts.map +1 -1
  54. package/dist/opentelemetry.mjs +423 -5
  55. package/dist/opentelemetry.mjs.map +1 -1
  56. package/dist/{registration-drnZk0SY.mjs → registration-Bwe2GbVu.mjs} +8 -2
  57. package/dist/registration-Bwe2GbVu.mjs.map +1 -0
  58. package/dist/runtime/explicit.d.mts +2 -2
  59. package/dist/runtime/explicit.mjs +1 -1
  60. package/dist/runtime/node.d.mts +3 -3
  61. package/dist/runtime/node.mjs +2 -2
  62. package/dist/runtime-qpcVwaz_.mjs +1680 -0
  63. package/dist/runtime-qpcVwaz_.mjs.map +1 -0
  64. package/dist/service-CO9VJQYa.mjs +74 -0
  65. package/dist/service-CO9VJQYa.mjs.map +1 -0
  66. package/dist/{signal-nfgFyNCk.mjs → signal-5Rg9bUUe.mjs} +2 -2
  67. package/dist/{signal-nfgFyNCk.mjs.map → signal-5Rg9bUUe.mjs.map} +1 -1
  68. package/dist/{standard-services-vnGIafkS.mjs → standard-services-B-iMM_W7.mjs} +38 -4
  69. package/dist/standard-services-B-iMM_W7.mjs.map +1 -0
  70. package/dist/standard-services.d.mts +4 -4
  71. package/dist/standard-services.mjs +3 -3
  72. package/dist/testing.d.mts +25 -7
  73. package/dist/testing.d.mts.map +1 -1
  74. package/dist/testing.mjs +51 -7
  75. package/dist/testing.mjs.map +1 -1
  76. package/dist/{types-oihI-ESv.d.mts → types-BFTqCCcw.d.mts} +32 -5
  77. package/dist/types-BFTqCCcw.d.mts.map +1 -0
  78. package/dist/web-effect-B9hp9jIe.mjs +380 -0
  79. package/dist/web-effect-B9hp9jIe.mjs.map +1 -0
  80. package/dist/web.d.mts +22 -13
  81. package/dist/web.d.mts.map +1 -1
  82. package/dist/web.mjs +1 -1
  83. package/package.json +10 -16
  84. package/dist/context-BphfFUMO.mjs.map +0 -1
  85. package/dist/current-request-CIU7AHhF.d.mts.map +0 -1
  86. package/dist/disposable-CP-Q2H3l.mjs +0 -57
  87. package/dist/disposable-CP-Q2H3l.mjs.map +0 -1
  88. package/dist/effect-CPdV7Yv8.mjs.map +0 -1
  89. package/dist/errors-BKcsQ0ip.d.mts.map +0 -1
  90. package/dist/index-AiKM71-u.d.mts +0 -376
  91. package/dist/index-AiKM71-u.d.mts.map +0 -1
  92. package/dist/index-BodMy6rO.d.mts.map +0 -1
  93. package/dist/index-DAKn0qHk.d.mts.map +0 -1
  94. package/dist/index-cXgyMa0v.d.mts.map +0 -1
  95. package/dist/layer-D16GKxuX.mjs +0 -269
  96. package/dist/layer-D16GKxuX.mjs.map +0 -1
  97. package/dist/observer-9nhbL7Pr.d.mts +0 -68
  98. package/dist/observer-9nhbL7Pr.d.mts.map +0 -1
  99. package/dist/outcome-DI8LPIQ4.d.mts +0 -387
  100. package/dist/outcome-DI8LPIQ4.d.mts.map +0 -1
  101. package/dist/program-metadata-BxjGkT17.mjs +0 -260
  102. package/dist/program-metadata-BxjGkT17.mjs.map +0 -1
  103. package/dist/registration-drnZk0SY.mjs.map +0 -1
  104. package/dist/runtime-C_55ofnL.mjs +0 -791
  105. package/dist/runtime-C_55ofnL.mjs.map +0 -1
  106. package/dist/standard-services-vnGIafkS.mjs.map +0 -1
  107. package/dist/types-oihI-ESv.d.mts.map +0 -1
  108. package/dist/web-Bq3MfMrj.mjs +0 -147
  109. package/dist/web-Bq3MfMrj.mjs.map +0 -1
@@ -1,9 +1,83 @@
1
- import { M as AnyService, h as ScopeOutcome } from "./index-AiKM71-u.mjs";
2
- import { _ as CompleteInput, a as RuntimeShutdownDiagnostic, d as LayerBackend, g as CompleteExecutionLayer, h as CompleteExecution, i as RuntimeRunOptions, n as RuntimeDisposeOptions, p as Layer, r as RuntimeOptions, w as ProvidedEnvironment, y as LayerInput } from "./outcome-DI8LPIQ4.mjs";
3
- import "./observer-9nhbL7Pr.mjs";
4
- import "./index-DAKn0qHk.mjs";
5
- import "./index-CCi07kUw.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";
6
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
7
81
  //#region src/runtime/types.d.ts
8
82
  /** A detached diagnostic view of one active Runtime execution. */
9
83
  type RuntimeExecutionInspection = {
@@ -11,6 +85,10 @@ type RuntimeExecutionInspection = {
11
85
  readonly name?: string;
12
86
  readonly startedAt: number;
13
87
  };
88
+ /** A detached diagnostic view of one active Scope-owned task. */
89
+ type RuntimeTaskInspection = RuntimeTaskMetadata & {
90
+ readonly state: 'running';
91
+ };
14
92
  /**
15
93
  * A detached, immutable diagnostic view of a Runtime.
16
94
  *
@@ -19,10 +97,12 @@ type RuntimeExecutionInspection = {
19
97
  * primitive or readiness guarantee.
20
98
  */
21
99
  type RuntimeInspection = {
22
- readonly state: 'active' | 'disposing' | 'disposed';
100
+ readonly state: 'active' | 'quiescing' | 'draining' | 'aborting' | 'releasing' | 'disposed';
23
101
  readonly warmup: 'idle' | 'running' | 'completed' | 'failed';
24
102
  readonly activeExecutions: number;
25
103
  readonly executions: readonly RuntimeExecutionInspection[];
104
+ readonly activeTasks: number;
105
+ readonly tasks: readonly RuntimeTaskInspection[];
26
106
  readonly services: readonly string[];
27
107
  readonly shutdownSignalAborted: boolean;
28
108
  };
@@ -56,6 +136,7 @@ type RuntimeOptionsInput = RuntimeOptions & RuntimeRunOptions;
56
136
  */
57
137
  declare class Runtime<Provided extends AnyService = any> {
58
138
  private readonly handle;
139
+ readonly executor: RuntimeExecutor<Provided>;
59
140
  private constructor();
60
141
  /**
61
142
  * Create a long-lived Runtime that owns its Layer resources.
@@ -80,6 +161,8 @@ declare class Runtime<Provided extends AnyService = any> {
80
161
  static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, options: RuntimeOptionsInput, program: CompleteExecution<ProvidedEnvironment<L>, A>): Promise<Awaited<A>>;
81
162
  /** Run a callback with a managed Runtime and always dispose it afterward. */
82
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>;
83
166
  /** Resolve every Layer provider and dispose the Runtime if warmup fails. */
84
167
  warmup(): Promise<void>;
85
168
  /** Return a detached diagnostic snapshot without changing Runtime state. */
@@ -113,6 +196,8 @@ declare namespace Runtime {
113
196
  type Inspection = RuntimeInspection;
114
197
  /** Detached diagnostic view of one active execution. */
115
198
  type ExecutionInspection = RuntimeExecutionInspection;
199
+ /** Non-owning view that can start child Runtime executions. */
200
+ type Executor<Provided extends AnyService = any> = RuntimeExecutor<Provided>;
116
201
  }
117
202
  //#endregion
118
203
  //#region src/runtime/signal.d.ts
@@ -121,60 +206,5 @@ declare const CurrentAbortSignal: {
121
206
  readonly [Symbol.iterator]: () => Generator<never, AbortSignal, unknown>;
122
207
  };
123
208
  //#endregion
124
- //#region src/function/pipe.d.ts
125
- type Unary<A, B> = (value: A) => B;
126
- declare function pipe<A>(value: A): A;
127
- declare function pipe<A, B>(value: A, ab: Unary<A, B>): B;
128
- declare function pipe<A, B, C>(value: A, ab: Unary<A, B>, bc: Unary<B, C>): C;
129
- declare function pipe<A, B, C, D>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>): D;
130
- 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;
131
- 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;
132
- 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;
133
- 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;
134
- 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;
135
- 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;
136
- 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;
137
- //#endregion
138
- //#region src/resource/errors.d.ts
139
- declare const ResourceReleaseFailure_base: import("better-result").TaggedErrorClass<"ResourceReleaseFailure">;
140
- /** Describes a failure encountered while releasing a Resource. */
141
- declare class ResourceReleaseFailure extends ResourceReleaseFailure_base<{
142
- readonly resource: string;
143
- readonly cause: unknown;
144
- readonly message: string;
145
- }> {}
146
- //#endregion
147
- //#region src/resource/types.d.ts
148
- /** A value that may be delivered synchronously or through a thenable. */
149
- type MaybePromise<T> = T | PromiseLike<T>;
150
- /** A synchronous or asynchronous better-result Result operation. */
151
- type AsyncResult<T, E> = MaybePromise<Result<T, E>>;
152
- /** The allowed return value of a custom Resource release callback. */
153
- type ReleaseOutcome = void | Result<void, unknown>;
154
- /** Receives release failures for diagnostics without changing error precedence. */
155
- type ReleaseFailureObserver = (failure: ResourceReleaseFailure) => MaybePromise<void>;
156
- /** Options controlling `Resource.acquireUseRelease`. */
157
- type AcquireUseReleaseOptions<R, A, AcquireError, UseError> = {
158
- /** Human-readable name included in release failures. */
159
- readonly name: string;
160
- /** Acquire the resource. A failure skips use and release. */
161
- readonly acquire: () => AsyncResult<R, AcquireError>;
162
- /** Use the acquired resource. Release is attempted afterward. */
163
- readonly use: (resource: R) => AsyncResult<A, UseError>;
164
- /** Release the resource, or omit it to use its disposal protocol. */
165
- readonly release?: (resource: R) => MaybePromise<ReleaseOutcome>;
166
- /**
167
- * Observe cleanup failures without changing error precedence. This is most
168
- * useful when both `use` and `release` can fail.
169
- */
170
- readonly onReleaseFailure?: ReleaseFailureObserver;
171
- };
172
- //#endregion
173
- //#region src/resource/resource.d.ts
174
- declare const Resource: {
175
- /** Acquire, use, and release a resource with deterministic error precedence. */
176
- readonly acquireUseRelease: <R, A, AcquireError, UseError>({ name, acquire, use, release, onReleaseFailure }: AcquireUseReleaseOptions<R, A, AcquireError, UseError>) => Promise<Result<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>>;
177
- };
178
- //#endregion
179
- 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 };
180
- //# sourceMappingURL=index-BodMy6rO.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":"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"}
@@ -1,6 +1,4 @@
1
- import { N as AnyServiceToken } from "./index-AiKM71-u.mjs";
2
- import { d as LayerBackend, f as LayerBackendDisposeOptions, m as LayerRegistration } from "./outcome-DI8LPIQ4.mjs";
3
- import "./observer-9nhbL7Pr.mjs";
1
+ import { G as LayerRegistration, H as LayerBackendDisposeOptions, Rt as AnyServiceToken, V as LayerBackend } from "./layer-C2OaqTmB.mjs";
4
2
  //#region src/layer/map-layer-backend.d.ts
5
3
  /** Native map-backed Layer backend used by Runtime when no adapter is supplied. */
6
4
  declare class MapLayerBackend implements LayerBackend {
@@ -16,4 +14,4 @@ declare class MapLayerBackend implements LayerBackend {
16
14
  }
17
15
  //#endregion
18
16
  export { MapLayerBackend as t };
19
- //# sourceMappingURL=index-DAKn0qHk.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,8 +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-AiKM71-u.mjs";
2
- import { a as RuntimeShutdownDiagnostic, c as LayerGeneratorYieldError, d as LayerBackend, f as LayerBackendDisposeOptions, i as RuntimeRunOptions, l as LayerRegistrationError, m as LayerRegistration, n as RuntimeDisposeOptions, o as DuplicateServiceError, p as Layer, r as RuntimeOptions, s as LayerDisposeError, t as CleanupFailureObserver, u as ServiceTagCollisionError } from "./outcome-DI8LPIQ4.mjs";
3
- import { a as RuntimeObserver, c as RuntimeServiceResolveEvent, i as RuntimeExecutionStartEvent, n as RuntimeExecutionEndEvent, o as RuntimeResourceReleaseEvent, r as RuntimeExecutionMetadata, s as RuntimeServiceAcquireEvent, t as RuntimeExecutionAttributes } from "./observer-9nhbL7Pr.mjs";
4
- import { t as MapLayerBackend } from "./index-DAKn0qHk.mjs";
5
- 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-BodMy6rO.mjs";
6
- import { t as RuntimeContextNotConfiguredError } from "./errors-BKcsQ0ip.mjs";
7
- import { n as Program, r as ProgramAllOptions, t as Effect } from "./index-CCi07kUw.mjs";
8
- 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,11 +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-BphfFUMO.mjs";
3
- import { a as ScopeClosedError, i as ScopeCloseError, o as ScopeRuntimeNotConfiguredError, r as ResourceNotDisposableError, t as disposeResource } from "./disposable-CP-Q2H3l.mjs";
4
- import { n as Service, r as ServiceRuntime, t as Layer } from "./layer-D16GKxuX.mjs";
5
- import { i as Scope } from "./program-metadata-BxjGkT17.mjs";
6
- import { i as MapLayerBackend, n as RuntimeObserver, t as Runtime } from "./runtime-C_55ofnL.mjs";
7
- import { n as Program, t as Effect } from "./effect-CPdV7Yv8.mjs";
8
- import { t as CurrentAbortSignal } from "./signal-nfgFyNCk.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";
9
8
  import { Result, TaggedError } from "better-result";
10
9
  //#region src/function/pipe.ts
11
10
  function pipe(value, ...operations) {
@@ -89,6 +88,6 @@ const Resource = {
89
88
  /** Acquire, use, and release a resource with deterministic error precedence. */
90
89
  acquireUseRelease };
91
90
  //#endregion
92
- 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 };
93
92
 
94
93
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/function/pipe.ts","../src/resource/errors.ts","../src/resource/internal.ts","../src/resource/resource.ts"],"sourcesContent":["type Unary<A, B> = (value: A) => B\n\n/**\n * Compose a value through a sequence of unary functions.\n *\n * `pipe` is deliberately independent of Effect, Result, Promise, Scope, and\n * Service metadata.\n *\n * @example\n * ```ts\n * const label = pipe(\n * 'alice',\n * (name) => name.trim(),\n * (name) => name.toUpperCase()\n * )\n * ```\n */\ntype PipeRuntimeValue = Parameters<Unary<any, any>>[0]\n\ntype PipeRuntimeOperation = Unary<PipeRuntimeValue, PipeRuntimeValue>\n\nexport function pipe<A>(value: A): A\nexport function pipe<A, B>(value: A, ab: Unary<A, B>): B\nexport function pipe<A, B, C>(value: A, ab: Unary<A, B>, bc: Unary<B, C>): C\nexport function pipe<A, B, C, D>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>): D\nexport function pipe<A, B, C, D, E>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>\n): E\nexport function pipe<A, B, C, D, E, F>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>\n): F\nexport function pipe<A, B, C, D, E, F, G>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>,\n fg: Unary<F, G>\n): G\nexport function pipe<A, B, C, D, E, F, G, H>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>,\n fg: Unary<F, G>,\n gh: Unary<G, H>\n): H\nexport function pipe<A, B, C, D, E, F, G, H, I>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>,\n fg: Unary<F, G>,\n gh: Unary<G, H>,\n hi: Unary<H, I>\n): I\nexport function pipe<A, B, C, D, E, F, G, H, I, J>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>,\n fg: Unary<F, G>,\n gh: Unary<G, H>,\n hi: Unary<H, I>,\n ij: Unary<I, J>\n): J\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>,\n fg: Unary<F, G>,\n gh: Unary<G, H>,\n hi: Unary<H, I>,\n ij: Unary<I, J>,\n jk: Unary<J, K>\n): K\nexport function pipe(\n value: PipeRuntimeValue,\n ...operations: ReadonlyArray<PipeRuntimeOperation>\n): PipeRuntimeValue {\n return operations.reduce((current, operation) => operation(current), value)\n}\n","import { TaggedError } from 'better-result'\n\n/** Describes a failure encountered while releasing a Resource. */\nexport class ResourceReleaseFailure extends TaggedError('ResourceReleaseFailure')<{\n readonly resource: string\n readonly cause: unknown\n readonly message: string\n}> {}\n","import { Result, type Result as ResultType, type UnhandledException } from 'better-result'\n\nimport { ResourceReleaseFailure } from './errors'\n\nimport { disposeResource } from '../scope/disposable'\n\nexport { disposeResource }\n\nimport type { AsyncResult, MaybePromise, ReleaseFailureObserver, ReleaseOutcome } from './types'\n\nconst toReleaseFailure = (resource: string, cause: unknown): ResourceReleaseFailure =>\n new ResourceReleaseFailure({\n resource,\n cause,\n message: `Failed to release resource: ${resource}`\n })\n\nexport const runResult = async <T, E>(\n operation: () => AsyncResult<T, E>\n): Promise<ResultType<T, E | UnhandledException>> => {\n const execution = await Result.tryPromise(() => Promise.resolve(operation()))\n\n return execution.andThen((result) => result)\n}\n\nconst normalizeReleaseOutcome = (\n name: string,\n outcome: ReleaseOutcome\n): ResultType<void, ResourceReleaseFailure> => {\n if (outcome === undefined) {\n return Result.ok()\n }\n\n return outcome.mapError((cause) => toReleaseFailure(name, cause))\n}\n\nexport const runRelease = async <R>(\n name: string,\n resource: R,\n release: (resource: R) => MaybePromise<ReleaseOutcome>\n): Promise<ResultType<void, ResourceReleaseFailure>> => {\n const execution = await Result.tryPromise({\n try: () => Promise.resolve(release(resource)),\n catch: (cause) => toReleaseFailure(name, cause)\n })\n\n return execution.andThen((outcome) => normalizeReleaseOutcome(name, outcome))\n}\n\nconst notifyReleaseFailure = async (\n observer: ReleaseFailureObserver | undefined,\n\n failure: ResourceReleaseFailure\n): Promise<void> => {\n if (!observer) {\n return\n }\n\n try {\n await observer(failure)\n } catch {\n /*\n * Diagnostics must never replace\n * the actual operation error.\n */\n }\n}\n\nexport const combineUseAndRelease = async <A, E>(\n used: ResultType<A, E>,\n\n released: ResultType<void, ResourceReleaseFailure>,\n\n onReleaseFailure?: ReleaseFailureObserver\n): Promise<ResultType<A, E | ResourceReleaseFailure>> => {\n if (Result.isError(used)) {\n if (Result.isError(released)) {\n await notifyReleaseFailure(onReleaseFailure, released.error)\n }\n\n return Result.err<A, E | ResourceReleaseFailure>(used.error)\n }\n\n if (Result.isError(released)) {\n await notifyReleaseFailure(onReleaseFailure, released.error)\n\n return Result.err<A, E | ResourceReleaseFailure>(released.error)\n }\n\n return Result.ok<A, E | ResourceReleaseFailure>(used.value)\n}\n","import { Result, type Result as ResultType, type UnhandledException } from 'better-result'\n\nimport { Scope } from '../scope'\n\nimport { ResourceReleaseFailure } from './errors'\n\nimport { combineUseAndRelease, disposeResource, runRelease, runResult } from './internal'\n\nimport type { AcquireUseReleaseOptions } from './types'\n\n/**\n * Acquire a resource, use it, and always attempt release afterward.\n *\n * Acquisition, use, and release may be synchronous or asynchronous Result\n * operations. If both use and release fail, the use error remains primary and\n * `onReleaseFailure` receives the cleanup failure as a diagnostic.\n *\n * When `release` is omitted, `Symbol.asyncDispose` is preferred over\n * `Symbol.dispose`.\n *\n * @example\n * ```ts\n * const result = await Resource.acquireUseRelease({\n * name: 'database connection',\n * acquire: () => connect(),\n * use: (connection) => query(connection),\n * release: (connection) => connection.close()\n * })\n * ```\n */\nconst acquireUseRelease = <R, A, AcquireError, UseError>({\n name,\n acquire,\n use,\n release = disposeResource,\n onReleaseFailure\n}: AcquireUseReleaseOptions<R, A, AcquireError, UseError>): Promise<\n ResultType<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>\n> =>\n Result.gen(async function* () {\n const resource = yield* Result.await(runResult(acquire))\n\n const scope = Scope.make()\n\n let released: ResultType<void, ResourceReleaseFailure> = Result.ok()\n\n scope.addFinalizer(async () => {\n released = await runRelease(name, resource, release)\n })\n\n const used = await runResult(() => use(resource))\n\n await scope.close()\n\n return await combineUseAndRelease(used, released, onReleaseFailure)\n })\n\nexport const Resource = {\n /** Acquire, use, and release a resource with deterministic error precedence. */\n acquireUseRelease\n} as const\n"],"mappings":";;;;;;;;;;AA+FA,SAAgB,KACd,OACA,GAAG,YACe;CAClB,OAAO,WAAW,QAAQ,SAAS,cAAc,UAAU,OAAO,GAAG,KAAK;AAC5E;;;;ACjGA,IAAa,yBAAb,cAA4C,YAAY,wBAAwB,CAAC,CAI9E,CAAC;;;ACGJ,MAAM,oBAAoB,UAAkB,UAC1C,IAAI,uBAAuB;CACzB;CACA;CACA,SAAS,+BAA+B;AAC1C,CAAC;AAEH,MAAa,YAAY,OACvB,cACmD;CAGnD,QAAO,MAFiB,OAAO,iBAAiB,QAAQ,QAAQ,UAAU,CAAC,CAAC,EAAA,CAE3D,SAAS,WAAW,MAAM;AAC7C;AAEA,MAAM,2BACJ,MACA,YAC6C;CAC7C,IAAI,YAAY,KAAA,GACd,OAAO,OAAO,GAAG;CAGnB,OAAO,QAAQ,UAAU,UAAU,iBAAiB,MAAM,KAAK,CAAC;AAClE;AAEA,MAAa,aAAa,OACxB,MACA,UACA,YACsD;CAMtD,QAAO,MALiB,OAAO,WAAW;EACxC,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,CAAC;EAC5C,QAAQ,UAAU,iBAAiB,MAAM,KAAK;CAChD,CAAC,EAAA,CAEgB,SAAS,YAAY,wBAAwB,MAAM,OAAO,CAAC;AAC9E;AAEA,MAAM,uBAAuB,OAC3B,UAEA,YACkB;CAClB,IAAI,CAAC,UACH;CAGF,IAAI;EACF,MAAM,SAAS,OAAO;CACxB,QAAQ,CAKR;AACF;AAEA,MAAa,uBAAuB,OAClC,MAEA,UAEA,qBACuD;CACvD,IAAI,OAAO,QAAQ,IAAI,GAAG;EACxB,IAAI,OAAO,QAAQ,QAAQ,GACzB,MAAM,qBAAqB,kBAAkB,SAAS,KAAK;EAG7D,OAAO,OAAO,IAAmC,KAAK,KAAK;CAC7D;CAEA,IAAI,OAAO,QAAQ,QAAQ,GAAG;EAC5B,MAAM,qBAAqB,kBAAkB,SAAS,KAAK;EAE3D,OAAO,OAAO,IAAmC,SAAS,KAAK;CACjE;CAEA,OAAO,OAAO,GAAkC,KAAK,KAAK;AAC5D;;;;;;;;;;;;;;;;;;;;;;;AC5DA,MAAM,qBAAmD,EACvD,MACA,SACA,KACA,UAAU,iBACV,uBAIA,OAAO,IAAI,mBAAmB;CAC5B,MAAM,WAAW,OAAO,OAAO,MAAM,UAAU,OAAO,CAAC;CAEvD,MAAM,QAAQ,MAAM,KAAK;CAEzB,IAAI,WAAqD,OAAO,GAAG;CAEnE,MAAM,aAAa,YAAY;EAC7B,WAAW,MAAM,WAAW,MAAM,UAAU,OAAO;CACrD,CAAC;CAED,MAAM,OAAO,MAAM,gBAAgB,IAAI,QAAQ,CAAC;CAEhD,MAAM,MAAM,MAAM;CAElB,OAAO,MAAM,qBAAqB,MAAM,UAAU,gBAAgB;AACpE,CAAC;AAEH,MAAa,WAAW;;AAEtB,kBACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/function/pipe.ts","../src/resource/errors.ts","../src/resource/internal.ts","../src/resource/resource.ts"],"sourcesContent":["type Unary<A, B> = (value: A) => B\n\n/**\n * Compose a value through a sequence of unary functions.\n *\n * `pipe` is deliberately independent of Effect, Result, Promise, Scope, and\n * Service metadata.\n *\n * @example\n * ```ts\n * const label = pipe(\n * 'alice',\n * (name) => name.trim(),\n * (name) => name.toUpperCase()\n * )\n * ```\n */\ntype PipeRuntimeValue = Parameters<Unary<any, any>>[0]\n\ntype PipeRuntimeOperation = Unary<PipeRuntimeValue, PipeRuntimeValue>\n\nexport function pipe<A>(value: A): A\nexport function pipe<A, B>(value: A, ab: Unary<A, B>): B\nexport function pipe<A, B, C>(value: A, ab: Unary<A, B>, bc: Unary<B, C>): C\nexport function pipe<A, B, C, D>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>): D\nexport function pipe<A, B, C, D, E>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>\n): E\nexport function pipe<A, B, C, D, E, F>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>\n): F\nexport function pipe<A, B, C, D, E, F, G>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>,\n fg: Unary<F, G>\n): G\nexport function pipe<A, B, C, D, E, F, G, H>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>,\n fg: Unary<F, G>,\n gh: Unary<G, H>\n): H\nexport function pipe<A, B, C, D, E, F, G, H, I>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>,\n fg: Unary<F, G>,\n gh: Unary<G, H>,\n hi: Unary<H, I>\n): I\nexport function pipe<A, B, C, D, E, F, G, H, I, J>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>,\n fg: Unary<F, G>,\n gh: Unary<G, H>,\n hi: Unary<H, I>,\n ij: Unary<I, J>\n): J\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K>(\n value: A,\n ab: Unary<A, B>,\n bc: Unary<B, C>,\n cd: Unary<C, D>,\n de: Unary<D, E>,\n ef: Unary<E, F>,\n fg: Unary<F, G>,\n gh: Unary<G, H>,\n hi: Unary<H, I>,\n ij: Unary<I, J>,\n jk: Unary<J, K>\n): K\nexport function pipe(\n value: PipeRuntimeValue,\n ...operations: ReadonlyArray<PipeRuntimeOperation>\n): PipeRuntimeValue {\n return operations.reduce((current, operation) => operation(current), value)\n}\n","import { TaggedError } from 'better-result'\n\n/** Describes a failure encountered while releasing a Resource. */\nexport class ResourceReleaseFailure extends TaggedError('ResourceReleaseFailure')<{\n readonly resource: string\n readonly cause: unknown\n readonly message: string\n}> {}\n","import { Result, type Result as ResultType, type UnhandledException } from 'better-result'\n\nimport { ResourceReleaseFailure } from './errors'\n\nimport { disposeResource } from '../scope/disposable'\n\nexport { disposeResource }\n\nimport type { AsyncResult, MaybePromise, ReleaseFailureObserver, ReleaseOutcome } from './types'\n\nconst toReleaseFailure = (resource: string, cause: unknown): ResourceReleaseFailure =>\n new ResourceReleaseFailure({\n resource,\n cause,\n message: `Failed to release resource: ${resource}`\n })\n\nexport const runResult = async <T, E>(\n operation: () => AsyncResult<T, E>\n): Promise<ResultType<T, E | UnhandledException>> => {\n const execution = await Result.tryPromise(() => Promise.resolve(operation()))\n\n return execution.andThen((result) => result)\n}\n\nconst normalizeReleaseOutcome = (\n name: string,\n outcome: ReleaseOutcome\n): ResultType<void, ResourceReleaseFailure> => {\n if (outcome === undefined) {\n return Result.ok()\n }\n\n return outcome.mapError((cause) => toReleaseFailure(name, cause))\n}\n\nexport const runRelease = async <R>(\n name: string,\n resource: R,\n release: (resource: R) => MaybePromise<ReleaseOutcome>\n): Promise<ResultType<void, ResourceReleaseFailure>> => {\n const execution = await Result.tryPromise({\n try: () => Promise.resolve(release(resource)),\n catch: (cause) => toReleaseFailure(name, cause)\n })\n\n return execution.andThen((outcome) => normalizeReleaseOutcome(name, outcome))\n}\n\nconst notifyReleaseFailure = async (\n observer: ReleaseFailureObserver | undefined,\n\n failure: ResourceReleaseFailure\n): Promise<void> => {\n if (!observer) {\n return\n }\n\n try {\n await observer(failure)\n } catch {\n /*\n * Diagnostics must never replace\n * the actual operation error.\n */\n }\n}\n\nexport const combineUseAndRelease = async <A, E>(\n used: ResultType<A, E>,\n\n released: ResultType<void, ResourceReleaseFailure>,\n\n onReleaseFailure?: ReleaseFailureObserver\n): Promise<ResultType<A, E | ResourceReleaseFailure>> => {\n if (Result.isError(used)) {\n if (Result.isError(released)) {\n await notifyReleaseFailure(onReleaseFailure, released.error)\n }\n\n return Result.err<A, E | ResourceReleaseFailure>(used.error)\n }\n\n if (Result.isError(released)) {\n await notifyReleaseFailure(onReleaseFailure, released.error)\n\n return Result.err<A, E | ResourceReleaseFailure>(released.error)\n }\n\n return Result.ok<A, E | ResourceReleaseFailure>(used.value)\n}\n","import { Result, type Result as ResultType, type UnhandledException } from 'better-result'\n\nimport { Scope } from '../scope'\n\nimport { ResourceReleaseFailure } from './errors'\n\nimport { combineUseAndRelease, disposeResource, runRelease, runResult } from './internal'\n\nimport type { AcquireUseReleaseOptions } from './types'\n\n/**\n * Acquire a resource, use it, and always attempt release afterward.\n *\n * Acquisition, use, and release may be synchronous or asynchronous Result\n * operations. If both use and release fail, the use error remains primary and\n * `onReleaseFailure` receives the cleanup failure as a diagnostic.\n *\n * When `release` is omitted, `Symbol.asyncDispose` is preferred over\n * `Symbol.dispose`.\n *\n * @example\n * ```ts\n * const result = await Resource.acquireUseRelease({\n * name: 'database connection',\n * acquire: () => connect(),\n * use: (connection) => query(connection),\n * release: (connection) => connection.close()\n * })\n * ```\n */\nconst acquireUseRelease = <R, A, AcquireError, UseError>({\n name,\n acquire,\n use,\n release = disposeResource,\n onReleaseFailure\n}: AcquireUseReleaseOptions<R, A, AcquireError, UseError>): Promise<\n ResultType<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>\n> =>\n Result.gen(async function* () {\n const resource = yield* Result.await(runResult(acquire))\n\n const scope = Scope.make()\n\n let released: ResultType<void, ResourceReleaseFailure> = Result.ok()\n\n scope.addFinalizer(async () => {\n released = await runRelease(name, resource, release)\n })\n\n const used = await runResult(() => use(resource))\n\n await scope.close()\n\n return await combineUseAndRelease(used, released, onReleaseFailure)\n })\n\nexport const Resource = {\n /** Acquire, use, and release a resource with deterministic error precedence. */\n acquireUseRelease\n} as const\n"],"mappings":";;;;;;;;;AA+FA,SAAgB,KACd,OACA,GAAG,YACe;CAClB,OAAO,WAAW,QAAQ,SAAS,cAAc,UAAU,OAAO,GAAG,KAAK;AAC5E;;;;ACjGA,IAAa,yBAAb,cAA4C,YAAY,wBAAwB,CAAC,CAI9E,CAAC;;;ACGJ,MAAM,oBAAoB,UAAkB,UAC1C,IAAI,uBAAuB;CACzB;CACA;CACA,SAAS,+BAA+B;AAC1C,CAAC;AAEH,MAAa,YAAY,OACvB,cACmD;CAGnD,QAAO,MAFiB,OAAO,iBAAiB,QAAQ,QAAQ,UAAU,CAAC,CAAC,EAAA,CAE3D,SAAS,WAAW,MAAM;AAC7C;AAEA,MAAM,2BACJ,MACA,YAC6C;CAC7C,IAAI,YAAY,KAAA,GACd,OAAO,OAAO,GAAG;CAGnB,OAAO,QAAQ,UAAU,UAAU,iBAAiB,MAAM,KAAK,CAAC;AAClE;AAEA,MAAa,aAAa,OACxB,MACA,UACA,YACsD;CAMtD,QAAO,MALiB,OAAO,WAAW;EACxC,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,CAAC;EAC5C,QAAQ,UAAU,iBAAiB,MAAM,KAAK;CAChD,CAAC,EAAA,CAEgB,SAAS,YAAY,wBAAwB,MAAM,OAAO,CAAC;AAC9E;AAEA,MAAM,uBAAuB,OAC3B,UAEA,YACkB;CAClB,IAAI,CAAC,UACH;CAGF,IAAI;EACF,MAAM,SAAS,OAAO;CACxB,QAAQ,CAKR;AACF;AAEA,MAAa,uBAAuB,OAClC,MAEA,UAEA,qBACuD;CACvD,IAAI,OAAO,QAAQ,IAAI,GAAG;EACxB,IAAI,OAAO,QAAQ,QAAQ,GACzB,MAAM,qBAAqB,kBAAkB,SAAS,KAAK;EAG7D,OAAO,OAAO,IAAmC,KAAK,KAAK;CAC7D;CAEA,IAAI,OAAO,QAAQ,QAAQ,GAAG;EAC5B,MAAM,qBAAqB,kBAAkB,SAAS,KAAK;EAE3D,OAAO,OAAO,IAAmC,SAAS,KAAK;CACjE;CAEA,OAAO,OAAO,GAAkC,KAAK,KAAK;AAC5D;;;;;;;;;;;;;;;;;;;;;;;AC5DA,MAAM,qBAAmD,EACvD,MACA,SACA,KACA,UAAU,iBACV,uBAIA,OAAO,IAAI,mBAAmB;CAC5B,MAAM,WAAW,OAAO,OAAO,MAAM,UAAU,OAAO,CAAC;CAEvD,MAAM,QAAQ,MAAM,KAAK;CAEzB,IAAI,WAAqD,OAAO,GAAG;CAEnE,MAAM,aAAa,YAAY;EAC7B,WAAW,MAAM,WAAW,MAAM,UAAU,OAAO;CACrD,CAAC;CAED,MAAM,OAAO,MAAM,gBAAgB,IAAI,QAAQ,CAAC;CAEhD,MAAM,MAAM,MAAM;CAElB,OAAO,MAAM,qBAAqB,MAAM,UAAU,gBAAgB;AACpE,CAAC;AAEH,MAAa,WAAW;;AAEtB,kBACF"}
@@ -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"}