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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-C2OaqTmB.d.mts","names":[],"sources":["../src/service/types.ts","../src/effect/types.ts","../src/service/service.ts","../src/scope/errors.ts","../src/scope/types.ts","../src/scope/scope.ts","../src/internal/missing-dependencies.ts","../src/layer/metadata.ts","../src/layer/inference.ts","../src/layer/errors.ts","../src/utils/types.ts","../src/layer/types.ts","../src/layer/backend.ts","../src/effect/task.ts","../src/runtime/observer.ts","../src/runtime/outcome.ts","../src/runtime/executor.ts","../src/runtime/context.ts","../src/service/runtime.ts","../src/service/errors.ts","../src/internal/variance.ts","../src/layer/layer.ts"],"mappings":";;;cAGqB;;UAGJ,oBAAoB;YACzB,wBAAwB;;;KAIxB,aAAa;;KAGb,gBAAgB,KAAK,oBAAoB,KAAK,UAAU;KAExD,mBAAmB,2BAA2B,iBAAiB;WAChE;WACA,YAAY;;YAGX,OAAO,iBAAiB,UAAU,mBAAmB,WAAW;;WAGjE,KAAK,YAAY,gBAAgB,gBAAgB,cAAc;;KAGrE,+BAA+B,6BAA6B,gBAAgB;;UAGhE,iBACX,oCACG,iBAAiB,0BAEhB,2BAA2B,WAAW,eAAe,KAAK;;KAGxD,kBAAkB;;KAGlB,aACV,6BACA,iBAAiB,aAAa,uBACnB,gBAAgB,YAAY,eAAe,KAAK;;KAGjD,gBAAgB,UAAU,mBAAmB,aAAa;;KAG1D,aAAa,UAAU,cAAc,SAAS;;KAG9C,eAAe,UAAU,cAAc,UAAU,aACzD,aAAa,aAAa,IAAI;;KAItB,WAAW,UAAU,aAAa,mBAAmB,UAAU,aACvE,aAAa,KACb,UAAU,kBACR;KAGD,mBAAmB,QACrB,WAAW,IAAI,EAAE,gBAAe,sBAAsB,UAAS,mBAAmB,yBAC7E;;;;;;;KAQI,oBAA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AAe,eAEjD,MAAM,OAAO,mBAAmB,UAC7B,WAAW,YAAY,kBAAkB,MAAM,aACjD,oBAAoB,MAAM;SAEtB,SAAS,aAAa,kBAAkB,2BAA2B,cACxE,MAAM,OAAO,mBAAmB,UAC7B,WAAW,YAAY,kBAAkB,MAAM,aACjD,oBAAoB,MAAM;;;kBA2DN;;OAEX,MAAM;;OAGN,SAAS,UAAU,cAAc,oBAAoB;;OAGrD,SAAS,UAAU,cAAc,oBAAoB;;OAGrD,QAAQ,UAAU,cAAc,oBAAoB;;OAGpD,SAAS,UAAU,cAAc,cAAc"}
@@ -0,0 +1,192 @@
1
+ import { $ as CompleteInput, At as EffectRequirements, Ft as ProgramFromGenerator, It as ServiceRequirement, Lt as AnyService, Mt as EffectYield, Ot as EffectError, Pt as Program, ct as ValidateLayerInput, et as ExecutionMissing, g as RuntimeOptions, h as RuntimeDisposeOptions, it as MissingServices, jt as EffectSuccess, lt as ValidateOneOverride, ot as ProvidedEnvironment, pt as MissingDependencies, st as RequiredEnvironment, tt as LayerInput } from "./layer-C2OaqTmB.mjs";
2
+ import { a as RuntimeInspection } from "./index-ClNndn2-.mjs";
3
+ import { t as CurrentRequest } from "./current-request-Dm-QQ3Xr.mjs";
4
+ import { h as WebRequestLayerChecks, p as WebJsonValue } from "./types-BFTqCCcw.mjs";
5
+ import { Result } from "better-result";
6
+ //#region src/next/types.d.ts
7
+ /** Route parameters exposed by Next.js App Router contexts. */
8
+ type NextEffectParams = {
9
+ readonly [key: string]: string | readonly string[] | undefined;
10
+ };
11
+ /** The explicit context passed to an App Router Route Handler factory. */
12
+ type NextEffectContext<Params extends object = NextEffectParams> = {
13
+ readonly params: Promise<Params>;
14
+ };
15
+ /** A native Route Handler function returned by this adapter. */
16
+ type NextRouteHandler<Context extends object = NextEffectContext> = (request: Request, context: Context) => Promise<Response>;
17
+ /** A native Web Response returned synchronously or asynchronously by a policy. */
18
+ type ResponseLike = Response | PromiseLike<Response>;
19
+ /** The value passed to a Next success policy. */
20
+ type NextEffectSuccess<A = unknown> = {
21
+ readonly value: A;
22
+ };
23
+ /** A lazy Result-valued Program accepted by the Next boundary. */
24
+ type NextEffectProgram<A = unknown, E = unknown, R extends AnyService = never> = Program<A, E, R>;
25
+ /** @internal */
26
+ type AnyProgram = NextEffectProgram<any, any, AnyService>;
27
+ /** @internal */
28
+ type AnyResult = Result<any, any>;
29
+ /** The request Layer installed when no custom Layer is supplied. */
30
+ type DefaultRequestLayer = ReturnType<typeof CurrentRequest.layer>;
31
+ /** Services available to a route Program after its request Layer is installed. */
32
+ type AvailableServices<Provided extends AnyService, RequestLayer extends LayerInput> = Provided | InstanceType<typeof CurrentRequest> | ProvidedEnvironment<RequestLayer>;
33
+ /** Validate a request Layer against a managed Runtime and CurrentRequest. */
34
+ type NextRequestLayerChecks<Provided extends AnyService, RequestLayer extends LayerInput> = WebRequestLayerChecks<Provided, RequestLayer>;
35
+ /** Validate a request Layer for the embedded mode, whose root environment is external. */
36
+ type FromCurrentRequestLayerChecks<RequestLayer extends LayerInput> = ValidateLayerInput<RequestLayer> & ValidateOneOverride<DefaultRequestLayer, RequestLayer>;
37
+ type InvalidFailure<Actual, Expected> = {
38
+ readonly __betterEffectInvalidNextFailure: {
39
+ readonly actual: Actual;
40
+ readonly expected: Expected;
41
+ };
42
+ };
43
+ type FailureCheck<Failure, Actual> = [Actual] extends [Failure] ? unknown : InvalidFailure<Actual, Failure>;
44
+ /** Services supplied by the embedded request boundary itself. */
45
+ type RequestBoundaryServices<RequestLayer extends LayerInput> = Extract<InstanceType<typeof CurrentRequest> | ProvidedEnvironment<RequestLayer>, AnyService>;
46
+ /** Requirements that must be supplied by the Runtime containing a fromCurrent builder. */
47
+ type FromCurrentRequirements<Program extends AnyProgram, RequestLayer extends LayerInput> = MissingServices<Extract<EffectRequirements<Program> | RequiredEnvironment<RequestLayer>, AnyService>, RequestBoundaryServices<RequestLayer>>;
48
+ /** Services and failures checked for one managed route Program. */
49
+ type NextProgramChecks<Provided extends AnyService, RequestLayer extends LayerInput, Program extends AnyProgram, Failure = unknown> = (ExecutionMissing<AvailableServices<Provided, RequestLayer>, Program> extends never ? unknown : MissingDependencies<ExecutionMissing<AvailableServices<Provided, RequestLayer>, Program>>) & FailureCheck<Failure, EffectError<Program>>;
50
+ /** A route Program after its Service and Failure channels have been checked. */
51
+ type CompleteNextProgram<Provided extends AnyService, RequestLayer extends LayerInput, Program extends AnyProgram, Failure = unknown> = Program & NextProgramChecks<Provided, RequestLayer, Program, Failure>;
52
+ /** Convert a managed route Program factory into a checked factory. */
53
+ type NextHandlerFactory<Context extends object, Provided extends AnyService, RequestLayer extends LayerInput, Failure, ProgramFactory extends (request: Request, context: Context) => AnyProgram> = ProgramFactory & ([ReturnType<ProgramFactory>] extends [CompleteNextProgram<Provided, RequestLayer, ReturnType<ProgramFactory>, Failure>] ? unknown : (request: Request, context: Context) => CompleteNextProgram<Provided, RequestLayer, ReturnType<ProgramFactory>, Failure>);
54
+ /** Convert an embedded route Program factory into a failure-checked factory. */
55
+ type FromCurrentHandlerFactory<Context extends object, Failure, ProgramFactory extends (request: Request, context: Context) => AnyProgram> = ProgramFactory & ([ReturnType<ProgramFactory>] extends [ReturnType<ProgramFactory> & FailureCheck<Failure, EffectError<ReturnType<ProgramFactory>>>] ? unknown : (request: Request, context: Context) => ReturnType<ProgramFactory> & FailureCheck<Failure, EffectError<ReturnType<ProgramFactory>>>);
56
+ /** A generator body used by `NextEffect.gen`. */
57
+ type GeneratorBody<Context extends object, Yield extends EffectYield, Returned extends AnyResult> = (request: Request, context: Context) => Generator<Yield, Returned, unknown> | AsyncGenerator<Yield, Returned, unknown>;
58
+ /** Options shared by every Route Handler created by a NextEffect instance. */
59
+ type NextEffectOptions<Failure = unknown, RequestLayer extends LayerInput = ReturnType<typeof CurrentRequest.layer>, Context extends object = NextEffectContext> = {
60
+ /** Build a request-local Layer once for each native Request. */
61
+ readonly requestLayer?: (request: Request, context: Context) => RequestLayer;
62
+ /** Convert a successful value to a native Response. */
63
+ readonly onSuccess?: (result: NextEffectSuccess<unknown>, request: Request, context: Context) => ResponseLike;
64
+ /** Convert a typed Program failure to a native Response. */
65
+ readonly onFailure?: (error: Failure, request: Request, context: Context) => ResponseLike;
66
+ };
67
+ /** Runtime options accepted by a managed NextEffect, excluding backend ownership. */
68
+ type NextEffectManagedRuntimeOptions = Omit<RuntimeOptions, 'backend'>;
69
+ /** Options for `NextEffect.managed`. */
70
+ type NextEffectManagedOptions<Failure = unknown, RequestLayer extends LayerInput = DefaultRequestLayer, Context extends object = NextEffectContext> = NextEffectOptions<Failure, RequestLayer, Context> & {
71
+ /** Runtime warmup, observers and host-specific context options. */
72
+ readonly runtime?: NextEffectManagedRuntimeOptions;
73
+ };
74
+ /** A detached diagnostic snapshot of a managed NextEffect manager. */
75
+ type NextEffectManagedInspection = {
76
+ readonly state: 'idle' | 'initializing' | 'ready' | 'failed' | 'disposing' | 'disposed';
77
+ readonly runtime?: RuntimeInspection;
78
+ };
79
+ /** A yieldable value returned by fromCurrent route materialization. */
80
+ type NextEffectYieldable<Value, Required extends AnyService = never> = {
81
+ [Symbol.iterator](): Generator<ServiceRequirement<Required>, Value, unknown>;
82
+ [Symbol.asyncIterator](): AsyncGenerator<ServiceRequirement<Required>, Value, unknown>;
83
+ };
84
+ /** Options for one typed route success policy. */
85
+ type NextEffectRouteSuccessPolicy<A, Context extends object> = {
86
+ /** Handle the success value directly and return a native Response. */
87
+ readonly respond: (value: A, request: Request, context: Context) => ResponseLike;
88
+ readonly serialize?: never;
89
+ readonly onSuccess?: never;
90
+ } | {
91
+ readonly respond?: never;
92
+ /** Convert the success value to the JSON-safe body wrapped by WebEffect. */
93
+ readonly serialize: (value: A, request: Request, context: Context) => WebJsonValue;
94
+ readonly onSuccess?: never;
95
+ } | {
96
+ readonly respond?: never;
97
+ readonly serialize?: never;
98
+ /** Replace the shared success policy for this route. */
99
+ readonly onSuccess: (result: NextEffectSuccess<A>, request: Request, context: Context) => ResponseLike;
100
+ } | {
101
+ /** Use the shared or default success policy for this route. */
102
+ readonly respond?: never;
103
+ readonly serialize?: never;
104
+ readonly onSuccess?: never;
105
+ };
106
+ type NextEffectRouteOptions<A, Context extends object = NextEffectContext> = NextEffectRouteSuccessPolicy<A, Context>;
107
+ /** Service and Failure checks for a managed generator-created route Program. */
108
+ type NextGeneratorChecks<Provided extends AnyService, RequestLayer extends LayerInput, Yield extends EffectYield, Returned extends AnyResult, Failure = unknown> = NextProgramChecks<Provided, RequestLayer, ProgramFromGenerator<Yield, Returned>, Failure>;
109
+ /** Failure checks for an embedded generator-created route Program. */
110
+ type FromCurrentGeneratorChecks<Yield extends EffectYield, Returned extends AnyResult, Failure = unknown> = FailureCheck<Failure, EffectError<ProgramFromGenerator<Yield, Returned>>>;
111
+ //#endregion
112
+ //#region src/next/lifecycle.d.ts
113
+ /** Thrown when a managed NextEffect no longer accepts new requests. */
114
+ declare class NextEffectDisposedError extends Error {
115
+ constructor();
116
+ }
117
+ /** Own one lazy Runtime for a Next host without exposing that Runtime publicly. */
118
+ declare class ManagedNextEffect<Layer extends LayerInput, Failure = unknown, RequestLayer extends LayerInput = ReturnType<typeof CurrentRequest.layer>, Context extends object = NextEffectContext> {
119
+ private readonly layer;
120
+ private readonly options;
121
+ private state;
122
+ private runtimePromise;
123
+ private runtime;
124
+ private disposePromise;
125
+ private readonly activeHandlers;
126
+ constructor(layer: Layer & CompleteInput<Layer>, options: NextEffectManagedOptions<Failure, RequestLayer, Context>);
127
+ /** Create a native Route Handler from a checked Program factory. */
128
+ handler<Program extends AnyProgram>(makeProgram: (request: Request, context: Context) => CompleteNextProgram<ProvidedEnvironment<Layer>, RequestLayer, Program, Failure>, options?: NextEffectRouteOptions<EffectSuccess<Program>, Context>): NextRouteHandler<Context>;
129
+ handler<const HandlerContext extends object, const ProgramFactory extends (request: Request, context: HandlerContext) => AnyProgram>(makeProgram: NextHandlerFactory<HandlerContext, ProvidedEnvironment<Layer>, RequestLayer, Failure, ProgramFactory>, options?: NextEffectRouteOptions<EffectSuccess<ReturnType<ProgramFactory>>, HandlerContext>): NextRouteHandler<HandlerContext>;
130
+ /** Create a native Route Handler from a checked generator body. */
131
+ gen<const HandlerContext extends object = Context, const Yield extends EffectYield = EffectYield, const Returned extends AnyResult = AnyResult>(body: GeneratorBody<HandlerContext, Yield, Returned> & NextGeneratorChecks<ProvidedEnvironment<Layer>, RequestLayer, Yield, Returned, Failure>, options?: NextEffectRouteOptions<EffectSuccess<ProgramFromGenerator<Yield, Returned>>, HandlerContext>): NextRouteHandler<HandlerContext>;
132
+ gen<const CustomContext extends object, const CustomYield extends EffectYield, const CustomReturned extends AnyResult>(body: GeneratorBody<CustomContext, CustomYield, CustomReturned> & NextGeneratorChecks<ProvidedEnvironment<Layer>, RequestLayer, CustomYield, CustomReturned, Failure>, options?: NextEffectRouteOptions<EffectSuccess<ProgramFromGenerator<CustomYield, CustomReturned>>, CustomContext>): NextRouteHandler<CustomContext>;
133
+ /** Eagerly initialize the manager's single Runtime. */
134
+ initialize(): Promise<void>;
135
+ /** Return a detached lifecycle snapshot without exposing the owned Runtime. */
136
+ inspect(): NextEffectManagedInspection;
137
+ /** Stop admitting requests, drain admitted handlers, and dispose the owned Runtime. */
138
+ dispose(options?: RuntimeDisposeOptions): Promise<void>;
139
+ /** Release the owned Runtime through JavaScript's async disposal protocol. */
140
+ [Symbol.asyncDispose](): Promise<void>;
141
+ /** Wrap a materialized route so requests admitted before disposal are drained. */
142
+ private protect;
143
+ /** Resolve the non-owning executor for an already admitted request. */
144
+ private executor;
145
+ private ensureRuntime;
146
+ private runAdmitted;
147
+ private performDispose;
148
+ }
149
+ //#endregion
150
+ //#region src/next/next-effect.d.ts
151
+ /** The two explicit ownership modes for the Next.js adapter. */
152
+ declare class NextEffect {
153
+ private constructor();
154
+ /** Build an inert adapter whose handlers capture the current Runtime executor when yielded. */
155
+ static fromCurrent<Failure = unknown, RequestLayer extends LayerInput = DefaultRequestLayer, Context extends object = NextEffectContext>(options?: NextEffectOptions<Failure, RequestLayer, Context> & FromCurrentRequestLayerChecks<RequestLayer>): NextEffect.FromCurrent<Failure, RequestLayer, Context>;
156
+ /** Build a host-owned adapter with one lazy Runtime for the supplied complete Layer. */
157
+ static managed<Layer extends LayerInput, Failure = unknown, RequestLayer extends LayerInput = DefaultRequestLayer, Context extends object = NextEffectContext>(layer: Layer & CompleteInput<Layer>, options?: NextEffectManagedOptions<Failure, RequestLayer, Context> & NextRequestLayerChecks<ProvidedEnvironment<Layer>, RequestLayer>): NextEffect.Managed<Layer, Failure, RequestLayer, Context>;
158
+ }
159
+ declare class FromCurrentNextEffect<Failure, RequestLayer extends LayerInput, Context extends object> {
160
+ private readonly options;
161
+ constructor(options: NextEffectOptions<Failure, RequestLayer, Context>);
162
+ /** Materialize a route while resolving only the current Runtime executor. */
163
+ handler<Program extends AnyProgram>(makeProgram: FromCurrentHandlerFactory<Context, Failure, (request: Request, context: Context) => Program>, options?: NextEffectRouteOptions<EffectSuccess<Program>, Context>): NextEffectYieldable<NextRouteHandler<Context>, FromCurrentRequirements<Program, RequestLayer>>;
164
+ handler<const HandlerContext extends object, const ProgramFactory extends (request: Request, context: HandlerContext) => AnyProgram>(makeProgram: FromCurrentHandlerFactory<HandlerContext, Failure, ProgramFactory>, options?: NextEffectRouteOptions<EffectSuccess<ReturnType<ProgramFactory>>, HandlerContext>): NextEffectYieldable<NextRouteHandler<HandlerContext>, FromCurrentRequirements<ReturnType<ProgramFactory>, RequestLayer>>;
165
+ /** Materialize a generator route while preserving its external Service requirements. */
166
+ gen<const HandlerContext extends object = Context, const Yield extends EffectYield = EffectYield, const Returned extends AnyResult = AnyResult>(body: GeneratorBody<HandlerContext, Yield, Returned> & FromCurrentGeneratorChecks<Yield, Returned, Failure>, options?: NextEffectRouteOptions<EffectSuccess<ProgramFromGenerator<Yield, Returned>>, HandlerContext>): NextEffectYieldable<NextRouteHandler<HandlerContext>, FromCurrentRequirements<ProgramFromGenerator<Yield, Returned>, RequestLayer>>;
167
+ gen<const CustomContext extends object, const CustomYield extends EffectYield, const CustomReturned extends AnyResult>(body: GeneratorBody<CustomContext, CustomYield, CustomReturned> & FromCurrentGeneratorChecks<CustomYield, CustomReturned, Failure>, options?: NextEffectRouteOptions<EffectSuccess<ProgramFromGenerator<CustomYield, CustomReturned>>, CustomContext>): NextEffectYieldable<NextRouteHandler<CustomContext>, FromCurrentRequirements<ProgramFromGenerator<CustomYield, CustomReturned>, RequestLayer>>;
168
+ private materialize;
169
+ }
170
+ declare namespace NextEffect {
171
+ /** The inert embedded adapter returned by `fromCurrent`. */
172
+ type FromCurrent<Failure = unknown, RequestLayer extends LayerInput = DefaultRequestLayer, Context extends object = NextEffectContext> = FromCurrentNextEffect<Failure, RequestLayer, Context>;
173
+ /** The host-owned adapter returned by `managed`. */
174
+ type Managed<Layer extends LayerInput, Failure = unknown, RequestLayer extends LayerInput = DefaultRequestLayer, Context extends object = NextEffectContext> = ManagedNextEffect<Layer, Failure, RequestLayer, Context>;
175
+ /** Options shared by all handlers created from a NextEffect builder. */
176
+ type Options<Failure = unknown, RequestLayer extends LayerInput = DefaultRequestLayer, Context extends object = NextEffectContext> = NextEffectOptions<Failure, RequestLayer, Context>;
177
+ /** Options for a host-owned managed adapter. */
178
+ type ManagedOptions<Failure = unknown, RequestLayer extends LayerInput = DefaultRequestLayer, Context extends object = NextEffectContext> = NextEffectManagedOptions<Failure, RequestLayer, Context>;
179
+ /** The lifecycle inspection returned by a managed adapter. */
180
+ type ManagedInspection = NextEffectManagedInspection;
181
+ /** A typed per-route success policy. */
182
+ type RouteOptions<A, Context extends object = NextEffectContext> = NextEffectRouteOptions<A, Context>;
183
+ /** The explicit App Router context passed to route factories. */
184
+ type Context<Params extends object = NextEffectParams> = NextEffectContext<Params>;
185
+ /** The native handler returned by `handler` and `gen`. */
186
+ type Handler<Context extends object = NextEffectContext> = NextRouteHandler<Context>;
187
+ /** A native success policy value. */
188
+ type Success<A = unknown> = NextEffectSuccess<A>;
189
+ }
190
+ //#endregion
191
+ export { type FromCurrentGeneratorChecks, type FromCurrentHandlerFactory, type FromCurrentRequestLayerChecks, type FromCurrentRequirements, NextEffect, type NextEffectContext, NextEffectDisposedError, type NextEffectManagedInspection, type NextEffectManagedOptions, type NextEffectManagedRuntimeOptions, type NextEffectOptions, type NextEffectParams, type NextEffectProgram, type NextEffectRouteOptions, type NextEffectSuccess, type NextEffectYieldable, type NextRouteHandler, type ResponseLike };
192
+ //# sourceMappingURL=next.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next.d.mts","names":[],"sources":["../src/next/types.ts","../src/next/lifecycle.ts","../src/next/next-effect.ts"],"mappings":";;;;;;;KA0BY;YACA;;;KAIA,kBAAkB,wBAAwB;WAC3C,QAAQ,QAAQ;;;KAIf,iBAAiB,yBAAyB,sBACpD,SAAS,SACT,SAAS,YACN,QAAQ;;KAGD,eAAe,WAAW,YAAY;;KAGtC,kBAAkB;WACnB,OAAO;;;KAIN,kBAAkB,aAAa,aAAa,UAAU,sBAAsB,QACtF,GACA,GACA;;KAIU,aAAa,4BAA4B;;KAGzC,YAAY;;KAGZ,sBAAsB,kBAAkB,eAAe;;KAGvD,kBAAkB,iBAAiB,YAAY,qBAAqB,cAC5E,WACA,oBAAoB,kBACpB,oBAAoB;;KAGZ,uBACV,iBAAiB,YACjB,qBAAqB,cACnB,sBAAsB,UAAU;;KAGxB,8BAA8B,qBAAqB,cAC7D,mBAAmB,gBAAgB,oBAAoB,qBAAqB;KAEzE,eAAe,QAAQ;WACjB;aACE,QAAQ;aACR,UAAU;;;KAIlB,aAAa,SAAS,WAAW,iBAAiB,qBAEnD,eAAe,QAAQ;;KAGtB,wBAAwB,qBAAqB,cAAc,QAC9D,oBAAoB,kBAAkB,oBAAoB,eAC1D;;KAIU,wBACV,gBAAgB,YAChB,qBAAqB,cACnB,gBACF,QAAQ,mBAAmB,WAAW,oBAAoB,eAAe,aACzE,wBAAwB;;KAId,kBACV,iBAAiB,YACjB,qBAAqB,YACrB,gBAAgB,YAChB,sBACG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aAAa,kBAC9C,2BAA2B,aAAa,gBAAgB,UAC1D,UAAU,uBACR,cAAc,qBAAqB,aAAa,kBAChD,iBAED,oBACD,iBAAiB,gBACjB,wBAAwB,qBAAqB,aAAa,iBAAiB;UAmBrE;;kBAgBe;;OAEX,YACV,mBACA,qBAAqB,aAAa,qBAClC,yBAAyB,qBACvB,sBAAsB,SAAS,cAAc;;OAGrC,QACV,cAAc,YACd,mBACA,qBAAqB,aAAa,qBAClC,yBAAyB,qBACvB,kBAAkB,OAAO,SAAS,cAAc;;OAGxC,QACV,mBACA,qBAAqB,aAAa,qBAClC,yBAAyB,qBACvB,kBAAkB,SAAS,cAAc;;OAGjC,eACV,mBACA,qBAAqB,aAAa,qBAClC,yBAAyB,qBACvB,yBAAyB,SAAS,cAAc;;OAGxC,oBAAoB;;OAGpB,aAAa,GAAG,yBAAyB,qBAAqB,uBACxE,GACA;;OAIU,QAAQ,wBAAwB,oBAAoB,kBAAkB;;OAGtE,QAAQ,yBAAyB,qBAAqB,iBAAiB;;OAGvE,QAAQ,eAAe,kBAAkB"}
package/dist/next.mjs ADDED
@@ -0,0 +1,185 @@
1
+ import { t as Runtime } from "./runtime-qpcVwaz_.mjs";
2
+ import { t as Effect } from "./effect-W0IQXY8P.mjs";
3
+ import { t as WebEffect } from "./web-effect-B9hp9jIe.mjs";
4
+ import { Result } from "better-result";
5
+ //#region src/next/route-builder.ts
6
+ const routeSuccessPolicyNames = [
7
+ "respond",
8
+ "serialize",
9
+ "onSuccess"
10
+ ];
11
+ const assertExclusiveRouteSuccessPolicy = (options) => {
12
+ const configuredPolicies = routeSuccessPolicyNames.filter((name) => options[name] !== void 0);
13
+ if (configuredPolicies.length > 1) throw new TypeError(`NextEffect route options must configure at most one success policy; received ${configuredPolicies.join(", ")}`);
14
+ };
15
+ /** Build the shared Next/WebEffect request boundary for both ownership modes. */
16
+ const makeNextRouteHandler = (getExecutor, instanceOptions, makeProgram, routeOptions) => {
17
+ assertExclusiveRouteSuccessPolicy(routeOptions);
18
+ return async (request, context) => {
19
+ const executor = await getExecutor(request, context);
20
+ const program = makeProgram(request, context);
21
+ const effectiveProgram = routeOptions.serialize === void 0 ? program : async () => {
22
+ const result = await program();
23
+ if (Result.isError(result)) return result;
24
+ return Result.ok(routeOptions.serialize(result.value, request, context));
25
+ };
26
+ const webOptions = {};
27
+ if (instanceOptions.requestLayer !== void 0) webOptions.requestLayer = () => instanceOptions.requestLayer(request, context);
28
+ if (routeOptions.respond !== void 0) webOptions.onSuccess = ({ value }) => routeOptions.respond(value, request, context);
29
+ else if (routeOptions.onSuccess !== void 0) webOptions.onSuccess = (result) => routeOptions.onSuccess(result, request, context);
30
+ else if (instanceOptions.onSuccess !== void 0) webOptions.onSuccess = (result) => instanceOptions.onSuccess(result, request, context);
31
+ if (instanceOptions.onFailure !== void 0) webOptions.onFailure = (error) => instanceOptions.onFailure(error, request, context);
32
+ return await WebEffect.handleWith(executor, request, effectiveProgram, webOptions);
33
+ };
34
+ };
35
+ //#endregion
36
+ //#region src/next/lifecycle.ts
37
+ /** Thrown when a managed NextEffect no longer accepts new requests. */
38
+ var NextEffectDisposedError = class extends Error {
39
+ constructor() {
40
+ super("Cannot use a disposed NextEffect manager");
41
+ this.name = "NextEffectDisposedError";
42
+ }
43
+ };
44
+ /** Own one lazy Runtime for a Next host without exposing that Runtime publicly. */
45
+ var ManagedNextEffect = class {
46
+ layer;
47
+ options;
48
+ state = "idle";
49
+ runtimePromise;
50
+ runtime;
51
+ disposePromise;
52
+ activeHandlers = /* @__PURE__ */ new Set();
53
+ constructor(layer, options) {
54
+ this.layer = layer;
55
+ this.options = options;
56
+ }
57
+ handler(...args) {
58
+ const makeProgram = args[0];
59
+ const options = args[1] ?? {};
60
+ const route = makeNextRouteHandler((_request, _context) => this.executor().then((executor) => executor), this.options, makeProgram, options);
61
+ return this.protect(route);
62
+ }
63
+ gen(...args) {
64
+ const body = args[0];
65
+ const options = args[1] ?? {};
66
+ const route = makeNextRouteHandler((_request, _context) => this.executor().then((executor) => executor), this.options, (request, context) => {
67
+ return Effect.fn(() => body(request, context));
68
+ }, options);
69
+ return this.protect(route);
70
+ }
71
+ /** Eagerly initialize the manager's single Runtime. */
72
+ async initialize() {
73
+ await this.ensureRuntime(false);
74
+ }
75
+ /** Return a detached lifecycle snapshot without exposing the owned Runtime. */
76
+ inspect() {
77
+ const runtime = this.runtime?.inspect();
78
+ if (runtime === void 0) return Object.freeze({ state: this.state });
79
+ return Object.freeze({
80
+ state: this.state,
81
+ runtime
82
+ });
83
+ }
84
+ /** Stop admitting requests, drain admitted handlers, and dispose the owned Runtime. */
85
+ dispose(options) {
86
+ if (this.disposePromise !== void 0) return this.disposePromise;
87
+ this.state = "disposing";
88
+ const activeHandlers = [...this.activeHandlers];
89
+ const disposal = this.performDispose(activeHandlers, options);
90
+ this.disposePromise = disposal;
91
+ return disposal;
92
+ }
93
+ /** Release the owned Runtime through JavaScript's async disposal protocol. */
94
+ async [Symbol.asyncDispose]() {
95
+ await this.dispose();
96
+ }
97
+ /** Wrap a materialized route so requests admitted before disposal are drained. */
98
+ protect(handler) {
99
+ return async (request, context) => await this.runAdmitted(() => handler(request, context));
100
+ }
101
+ /** Resolve the non-owning executor for an already admitted request. */
102
+ executor() {
103
+ return this.ensureRuntime(true).then((runtime) => runtime.executor);
104
+ }
105
+ ensureRuntime(allowDisposing) {
106
+ if (this.state === "disposed" || this.state === "disposing" && !allowDisposing) return Promise.reject(new NextEffectDisposedError());
107
+ if (this.runtimePromise !== void 0) return this.runtimePromise;
108
+ this.state = "initializing";
109
+ const runtimePromise = Runtime.make(this.layer, this.options.runtime);
110
+ this.runtimePromise = runtimePromise;
111
+ runtimePromise.then((runtime) => {
112
+ this.runtime = runtime;
113
+ if (this.state === "initializing") this.state = "ready";
114
+ }, () => {
115
+ if (this.state === "initializing") this.state = "failed";
116
+ });
117
+ return runtimePromise;
118
+ }
119
+ async runAdmitted(run) {
120
+ if (this.state === "disposing" || this.state === "disposed") throw new NextEffectDisposedError();
121
+ const execution = Promise.resolve().then(run);
122
+ this.activeHandlers.add(execution);
123
+ execution.then(() => this.activeHandlers.delete(execution), () => this.activeHandlers.delete(execution));
124
+ return await execution;
125
+ }
126
+ async performDispose(activeHandlers, options) {
127
+ await Promise.allSettled(activeHandlers);
128
+ let runtime;
129
+ if (this.runtimePromise !== void 0) try {
130
+ runtime = await this.runtimePromise;
131
+ } catch {}
132
+ let disposalFailure;
133
+ if (runtime !== void 0) try {
134
+ await runtime.dispose(options);
135
+ } catch (cause) {
136
+ disposalFailure = cause;
137
+ }
138
+ this.state = "disposed";
139
+ if (disposalFailure !== void 0) throw disposalFailure;
140
+ }
141
+ };
142
+ //#endregion
143
+ //#region src/next/next-effect.ts
144
+ /** The two explicit ownership modes for the Next.js adapter. */
145
+ var NextEffect = class {
146
+ constructor() {}
147
+ /** Build an inert adapter whose handlers capture the current Runtime executor when yielded. */
148
+ static fromCurrent(options) {
149
+ return new FromCurrentNextEffect(options ?? {});
150
+ }
151
+ /** Build a host-owned adapter with one lazy Runtime for the supplied complete Layer. */
152
+ static managed(layer, options) {
153
+ return new ManagedNextEffect(layer, options ?? {});
154
+ }
155
+ };
156
+ var FromCurrentNextEffect = class {
157
+ options;
158
+ constructor(options) {
159
+ this.options = options;
160
+ }
161
+ handler(...args) {
162
+ const makeProgram = args[0];
163
+ const options = args[1] ?? {};
164
+ return this.materialize((executor) => makeNextRouteHandler(() => executor, this.options, makeProgram, options));
165
+ }
166
+ gen(...args) {
167
+ const body = args[0];
168
+ const options = args[1] ?? {};
169
+ return this.materialize((executor) => makeNextRouteHandler(() => executor, this.options, (request, context) => Effect.fn(() => body(request, context)), options));
170
+ }
171
+ materialize(build) {
172
+ return {
173
+ *[Symbol.iterator]() {
174
+ return build(yield* Runtime.executor());
175
+ },
176
+ async *[Symbol.asyncIterator]() {
177
+ return build(yield* Runtime.executor());
178
+ }
179
+ };
180
+ }
181
+ };
182
+ //#endregion
183
+ export { NextEffect, NextEffectDisposedError };
184
+
185
+ //# sourceMappingURL=next.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next.mjs","names":[],"sources":["../src/next/route-builder.ts","../src/next/lifecycle.ts","../src/next/next-effect.ts"],"sourcesContent":["/* oxlint-disable anti-slop/no-object-parameters -- the private boundary erases arbitrary framework context types after public overload validation. */\n/* oxlint-disable anti-slop/no-unknown-parameters -- response policy values are opaque until WebEffect validates them. */\n/* oxlint-disable anti-slop/no-unsafe-dictionary-type -- the private WebEffect options object is populated only by checked policies. */\n\nimport { Result } from 'better-result'\n\nimport type { LayerInput } from '../layer/inference'\nimport type { RuntimeExecutor } from '../runtime'\nimport type { AnyService } from '../service'\nimport { WebEffect } from '../web'\nimport type {\n AnyProgram,\n NextEffectOptions,\n NextEffectRouteOptions,\n NextRouteHandler\n} from './types'\n\nconst routeSuccessPolicyNames = ['respond', 'serialize', 'onSuccess'] as const\n\nconst assertExclusiveRouteSuccessPolicy = (\n options: NextEffectRouteOptions<unknown, object>\n): void => {\n const configuredPolicies = routeSuccessPolicyNames.filter((name) => options[name] !== undefined)\n\n if (configuredPolicies.length > 1) {\n throw new TypeError(\n `NextEffect route options must configure at most one success policy; received ${configuredPolicies.join(', ')}`\n )\n }\n}\n\ntype AnyNextEffectOptions = NextEffectOptions<unknown, LayerInput, object>\n\ntype ExecutorProvider = (\n request: Request,\n context: object\n) => RuntimeExecutor<AnyService> | PromiseLike<RuntimeExecutor<AnyService>>\n\n/** Build the shared Next/WebEffect request boundary for both ownership modes. */\nexport const makeNextRouteHandler = (\n getExecutor: ExecutorProvider,\n instanceOptions: AnyNextEffectOptions,\n makeProgram: (request: Request, context: object) => AnyProgram,\n routeOptions: NextEffectRouteOptions<unknown, object>\n): NextRouteHandler<object> => {\n assertExclusiveRouteSuccessPolicy(routeOptions)\n\n return async (request, context) => {\n const executor = await getExecutor(request, context)\n const program = makeProgram(request, context)\n const effectiveProgram =\n routeOptions.serialize === undefined\n ? program\n : async () => {\n const result = await program()\n\n if (Result.isError(result)) {\n return result\n }\n\n return Result.ok(routeOptions.serialize!(result.value, request, context))\n }\n const webOptions: Record<string, unknown> = {}\n\n if (instanceOptions.requestLayer !== undefined) {\n webOptions.requestLayer = () => instanceOptions.requestLayer!(request, context)\n }\n\n if (routeOptions.respond !== undefined) {\n webOptions.onSuccess = ({ value }: { readonly value: unknown }) =>\n routeOptions.respond!(value, request, context)\n } else if (routeOptions.onSuccess !== undefined) {\n webOptions.onSuccess = (result: { readonly value: unknown }) =>\n routeOptions.onSuccess!(result, request, context)\n } else if (instanceOptions.onSuccess !== undefined) {\n webOptions.onSuccess = (result: { readonly value: unknown }) =>\n instanceOptions.onSuccess!(result, request, context)\n }\n\n if (instanceOptions.onFailure !== undefined) {\n webOptions.onFailure = (error: unknown) => instanceOptions.onFailure!(error, request, context)\n }\n\n // SAFETY: Public overloads validated the Program, request Layer, and policies before this erased WebEffect boundary.\n return await WebEffect.handleWith(\n executor,\n request,\n // SAFETY: Serialization preserves the original Result error and Service channels.\n effectiveProgram as AnyProgram,\n // SAFETY: This private options object is populated only from the checked policy unions above.\n webOptions as never\n )\n }\n}\n","/* oxlint-disable anti-slop/no-object-parameters -- private route boundaries erase framework context after public overload validation. */\n/* oxlint-disable anti-slop/no-chained-type-assertions -- these are localized adapter erasures after overload checks. */\n/* oxlint-disable anti-slop/require-safety-comment-for-type-assertion -- assertions below are confined to checked overload implementations. */\n\nimport type { CompleteInput, LayerInput, ProvidedEnvironment } from '../layer/inference'\nimport { Effect } from '../effect'\nimport type { EffectSuccess, EffectYield, ProgramFromGenerator } from '../effect/types'\nimport { Runtime } from '../runtime'\nimport type { RuntimeDisposeOptions, RuntimeExecutor } from '../runtime'\nimport type { AnyService } from '../service'\nimport type {\n AnyProgram,\n AnyResult,\n CompleteNextProgram,\n GeneratorBody,\n NextEffectManagedInspection,\n NextEffectManagedOptions,\n NextEffectRouteOptions,\n NextGeneratorChecks,\n NextHandlerFactory,\n NextRouteHandler\n} from './types'\nimport { makeNextRouteHandler } from './route-builder'\n\n/** Thrown when a managed NextEffect no longer accepts new requests. */\nexport class NextEffectDisposedError extends Error {\n constructor() {\n super('Cannot use a disposed NextEffect manager')\n this.name = 'NextEffectDisposedError'\n }\n}\n\ntype RuntimeForLayer<Layer extends LayerInput> = Runtime<ProvidedEnvironment<Layer>>\n\ntype AnyManagedOptions = NextEffectManagedOptions<any, LayerInput, object>\n\ntype RouteHandler = ReturnType<typeof makeNextRouteHandler>\n\n/** Own one lazy Runtime for a Next host without exposing that Runtime publicly. */\nexport class ManagedNextEffect<\n Layer extends LayerInput,\n Failure = unknown,\n RequestLayer extends LayerInput = ReturnType<\n typeof import('../standard-services/current-request').CurrentRequest.layer\n >,\n Context extends object = import('./types').NextEffectContext\n> {\n private state: NextEffectManagedInspection['state'] = 'idle'\n\n private runtimePromise: Promise<RuntimeForLayer<Layer>> | undefined\n\n private runtime: RuntimeForLayer<Layer> | undefined\n\n private disposePromise: Promise<void> | undefined\n\n private readonly activeHandlers = new Set<Promise<unknown>>()\n\n constructor(\n private readonly layer: Layer & CompleteInput<Layer>,\n private readonly options: NextEffectManagedOptions<Failure, RequestLayer, Context>\n ) {}\n\n /** Create a native Route Handler from a checked Program factory. */\n handler<Program extends AnyProgram>(\n makeProgram: (\n request: Request,\n context: Context\n ) => CompleteNextProgram<ProvidedEnvironment<Layer>, RequestLayer, Program, Failure>,\n options?: NextEffectRouteOptions<EffectSuccess<Program>, Context>\n ): NextRouteHandler<Context>\n handler<\n const HandlerContext extends object,\n const ProgramFactory extends (request: Request, context: HandlerContext) => AnyProgram\n >(\n makeProgram: NextHandlerFactory<\n HandlerContext,\n ProvidedEnvironment<Layer>,\n RequestLayer,\n Failure,\n ProgramFactory\n >,\n options?: NextEffectRouteOptions<EffectSuccess<ReturnType<ProgramFactory>>, HandlerContext>\n ): NextRouteHandler<HandlerContext>\n handler(...args: unknown[]): NextRouteHandler<object> {\n const makeProgram = args[0] as (request: Request, context: object) => AnyProgram\n const options = (args[1] ?? {}) as NextEffectRouteOptions<unknown, object>\n const route = makeNextRouteHandler(\n (_request, _context) =>\n this.executor().then((executor) => executor as unknown as RuntimeExecutor<AnyService>),\n this.options as unknown as AnyManagedOptions,\n makeProgram,\n options\n )\n\n return this.protect(route) as NextRouteHandler<object>\n }\n\n /** Create a native Route Handler from a checked generator body. */\n gen<\n const HandlerContext extends object = Context,\n const Yield extends EffectYield = EffectYield,\n const Returned extends AnyResult = AnyResult\n >(\n body: GeneratorBody<HandlerContext, Yield, Returned> &\n NextGeneratorChecks<ProvidedEnvironment<Layer>, RequestLayer, Yield, Returned, Failure>,\n options?: NextEffectRouteOptions<\n EffectSuccess<ProgramFromGenerator<Yield, Returned>>,\n HandlerContext\n >\n ): NextRouteHandler<HandlerContext>\n gen<\n const CustomContext extends object,\n const CustomYield extends EffectYield,\n const CustomReturned extends AnyResult\n >(\n body: GeneratorBody<CustomContext, CustomYield, CustomReturned> &\n NextGeneratorChecks<\n ProvidedEnvironment<Layer>,\n RequestLayer,\n CustomYield,\n CustomReturned,\n Failure\n >,\n options?: NextEffectRouteOptions<\n EffectSuccess<ProgramFromGenerator<CustomYield, CustomReturned>>,\n CustomContext\n >\n ): NextRouteHandler<CustomContext>\n gen(...args: unknown[]): NextRouteHandler<object> {\n const body = args[0] as GeneratorBody<object, EffectYield, AnyResult>\n const options = (args[1] ?? {}) as NextEffectRouteOptions<unknown, object>\n const route = makeNextRouteHandler(\n (_request, _context) =>\n this.executor().then((executor) => executor as unknown as RuntimeExecutor<AnyService>),\n this.options as unknown as AnyManagedOptions,\n (request, context) => {\n const program = Effect.fn(\n () => body(request, context) as AsyncGenerator<EffectYield, AnyResult, unknown>\n )\n return program as AnyProgram\n },\n options\n )\n return this.protect(route) as NextRouteHandler<object>\n }\n\n /** Eagerly initialize the manager's single Runtime. */\n async initialize(): Promise<void> {\n await this.ensureRuntime(false)\n }\n\n /** Return a detached lifecycle snapshot without exposing the owned Runtime. */\n inspect(): NextEffectManagedInspection {\n const runtime = this.runtime?.inspect()\n\n if (runtime === undefined) {\n return Object.freeze({ state: this.state })\n }\n\n return Object.freeze({ state: this.state, runtime })\n }\n\n /** Stop admitting requests, drain admitted handlers, and dispose the owned Runtime. */\n dispose(options?: RuntimeDisposeOptions): Promise<void> {\n if (this.disposePromise !== undefined) {\n return this.disposePromise\n }\n\n this.state = 'disposing'\n const activeHandlers = [...this.activeHandlers]\n const disposal = this.performDispose(activeHandlers, options)\n this.disposePromise = disposal\n return disposal\n }\n\n /** Release the owned Runtime through JavaScript's async disposal protocol. */\n async [Symbol.asyncDispose](): Promise<void> {\n await this.dispose()\n }\n\n /** Wrap a materialized route so requests admitted before disposal are drained. */\n private protect(handler: RouteHandler): RouteHandler {\n return async (request, context) => await this.runAdmitted(() => handler(request, context))\n }\n\n /** Resolve the non-owning executor for an already admitted request. */\n private executor(): Promise<RuntimeExecutor<ProvidedEnvironment<Layer>>> {\n return this.ensureRuntime(true).then((runtime) => runtime.executor)\n }\n\n private ensureRuntime(allowDisposing: boolean): Promise<RuntimeForLayer<Layer>> {\n if (this.state === 'disposed' || (this.state === 'disposing' && !allowDisposing)) {\n return Promise.reject(new NextEffectDisposedError())\n }\n\n if (this.runtimePromise !== undefined) {\n return this.runtimePromise\n }\n\n this.state = 'initializing'\n const runtimePromise = Runtime.make(this.layer, this.options.runtime)\n this.runtimePromise = runtimePromise\n\n void runtimePromise.then(\n (runtime) => {\n this.runtime = runtime\n\n if (this.state === 'initializing') {\n this.state = 'ready'\n }\n },\n () => {\n if (this.state === 'initializing') {\n this.state = 'failed'\n }\n }\n )\n\n return runtimePromise\n }\n\n private async runAdmitted<A>(run: () => A | PromiseLike<A>): Promise<Awaited<A>> {\n if (this.state === 'disposing' || this.state === 'disposed') {\n throw new NextEffectDisposedError()\n }\n\n const execution = Promise.resolve().then(run) as Promise<Awaited<A>>\n this.activeHandlers.add(execution)\n void execution.then(\n () => this.activeHandlers.delete(execution),\n () => this.activeHandlers.delete(execution)\n )\n return await execution\n }\n\n private async performDispose(\n activeHandlers: readonly Promise<unknown>[],\n options: RuntimeDisposeOptions | undefined\n ): Promise<void> {\n await Promise.allSettled(activeHandlers)\n\n let runtime: RuntimeForLayer<Layer> | undefined\n\n if (this.runtimePromise !== undefined) {\n try {\n runtime = await this.runtimePromise\n } catch {\n // Runtime.make owns cleanup for initialization failures; preserve the request/init error.\n }\n }\n\n let disposalFailure: unknown\n\n if (runtime !== undefined) {\n try {\n await runtime.dispose(options)\n } catch (cause) {\n disposalFailure = cause\n }\n }\n\n this.state = 'disposed'\n\n if (disposalFailure !== undefined) {\n throw disposalFailure\n }\n }\n}\n","/* oxlint-disable anti-slop/no-object-parameters -- private route boundaries erase framework context after public overload validation. */\n/* oxlint-disable anti-slop/no-chained-type-assertions -- these are localized adapter erasures after overload checks. */\n/* oxlint-disable anti-slop/require-safety-comment-for-type-assertion -- assertions below are confined to checked overload implementations. */\n\nimport { Effect } from '../effect'\nimport type { EffectSuccess, EffectYield, ProgramFromGenerator } from '../effect/types'\nimport type { CompleteInput, LayerInput, ProvidedEnvironment } from '../layer/inference'\nimport { Runtime } from '../runtime'\nimport type { RuntimeExecutor } from '../runtime'\nimport type { AnyService } from '../service'\nimport type {\n AnyProgram,\n AnyResult,\n DefaultRequestLayer,\n FromCurrentGeneratorChecks,\n FromCurrentHandlerFactory,\n FromCurrentRequirements,\n FromCurrentRequestLayerChecks,\n GeneratorBody,\n NextEffectContext,\n NextEffectManagedInspection,\n NextEffectManagedOptions,\n NextEffectOptions,\n NextEffectParams,\n NextEffectRouteOptions,\n NextEffectSuccess,\n NextEffectYieldable,\n NextRouteHandler\n} from './types'\nimport { ManagedNextEffect } from './lifecycle'\nimport { makeNextRouteHandler } from './route-builder'\n\n/** The two explicit ownership modes for the Next.js adapter. */\nexport class NextEffect {\n private constructor() {}\n\n /** Build an inert adapter whose handlers capture the current Runtime executor when yielded. */\n static fromCurrent<\n Failure = unknown,\n RequestLayer extends LayerInput = DefaultRequestLayer,\n Context extends object = NextEffectContext\n >(\n options?: NextEffectOptions<Failure, RequestLayer, Context> &\n FromCurrentRequestLayerChecks<RequestLayer>\n ): NextEffect.FromCurrent<Failure, RequestLayer, Context> {\n return new FromCurrentNextEffect(options ?? {})\n }\n\n /** Build a host-owned adapter with one lazy Runtime for the supplied complete Layer. */\n static managed<\n Layer extends LayerInput,\n Failure = unknown,\n RequestLayer extends LayerInput = DefaultRequestLayer,\n Context extends object = NextEffectContext\n >(\n layer: Layer & CompleteInput<Layer>,\n options?: NextEffectManagedOptions<Failure, RequestLayer, Context> &\n import('./types').NextRequestLayerChecks<ProvidedEnvironment<Layer>, RequestLayer>\n ): NextEffect.Managed<Layer, Failure, RequestLayer, Context> {\n return new ManagedNextEffect(layer, options ?? {})\n }\n}\n\nclass FromCurrentNextEffect<Failure, RequestLayer extends LayerInput, Context extends object> {\n constructor(private readonly options: NextEffectOptions<Failure, RequestLayer, Context>) {}\n\n /** Materialize a route while resolving only the current Runtime executor. */\n handler<Program extends AnyProgram>(\n makeProgram: FromCurrentHandlerFactory<\n Context,\n Failure,\n (request: Request, context: Context) => Program\n >,\n options?: NextEffectRouteOptions<EffectSuccess<Program>, Context>\n ): NextEffectYieldable<NextRouteHandler<Context>, FromCurrentRequirements<Program, RequestLayer>>\n handler<\n const HandlerContext extends object,\n const ProgramFactory extends (request: Request, context: HandlerContext) => AnyProgram\n >(\n makeProgram: FromCurrentHandlerFactory<HandlerContext, Failure, ProgramFactory>,\n options?: NextEffectRouteOptions<EffectSuccess<ReturnType<ProgramFactory>>, HandlerContext>\n ): NextEffectYieldable<\n NextRouteHandler<HandlerContext>,\n FromCurrentRequirements<ReturnType<ProgramFactory>, RequestLayer>\n >\n handler(...args: unknown[]): any {\n const makeProgram = args[0] as (request: Request, context: object) => AnyProgram\n const options = (args[1] ?? {}) as NextEffectRouteOptions<unknown, object>\n\n return this.materialize((executor) =>\n makeNextRouteHandler(\n () => executor,\n this.options as unknown as NextEffectOptions<unknown, LayerInput, object>,\n makeProgram,\n options\n )\n )\n }\n\n /** Materialize a generator route while preserving its external Service requirements. */\n gen<\n const HandlerContext extends object = Context,\n const Yield extends EffectYield = EffectYield,\n const Returned extends AnyResult = AnyResult\n >(\n body: GeneratorBody<HandlerContext, Yield, Returned> &\n FromCurrentGeneratorChecks<Yield, Returned, Failure>,\n options?: NextEffectRouteOptions<\n EffectSuccess<ProgramFromGenerator<Yield, Returned>>,\n HandlerContext\n >\n ): NextEffectYieldable<\n NextRouteHandler<HandlerContext>,\n FromCurrentRequirements<ProgramFromGenerator<Yield, Returned>, RequestLayer>\n >\n gen<\n const CustomContext extends object,\n const CustomYield extends EffectYield,\n const CustomReturned extends AnyResult\n >(\n body: GeneratorBody<CustomContext, CustomYield, CustomReturned> &\n FromCurrentGeneratorChecks<CustomYield, CustomReturned, Failure>,\n options?: NextEffectRouteOptions<\n EffectSuccess<ProgramFromGenerator<CustomYield, CustomReturned>>,\n CustomContext\n >\n ): NextEffectYieldable<\n NextRouteHandler<CustomContext>,\n FromCurrentRequirements<ProgramFromGenerator<CustomYield, CustomReturned>, RequestLayer>\n >\n gen(...args: unknown[]): any {\n const body = args[0] as GeneratorBody<object, EffectYield, AnyResult>\n const options = (args[1] ?? {}) as NextEffectRouteOptions<unknown, object>\n\n return this.materialize((executor) =>\n makeNextRouteHandler(\n () => executor,\n this.options as unknown as NextEffectOptions<unknown, LayerInput, object>,\n (request, context) =>\n Effect.fn(\n () => body(request, context) as AsyncGenerator<EffectYield, AnyResult, unknown>\n ) as AnyProgram,\n options\n )\n )\n }\n\n private materialize<Value>(\n build: (executor: RuntimeExecutor<AnyService>) => Value\n ): NextEffectYieldable<Value, AnyService> {\n return {\n *[Symbol.iterator]() {\n const executor = yield* Runtime.executor<AnyService>()\n return build(executor)\n },\n async *[Symbol.asyncIterator]() {\n const executor = yield* Runtime.executor<AnyService>()\n return build(executor)\n }\n }\n }\n}\n\nexport declare namespace NextEffect {\n /** The inert embedded adapter returned by `fromCurrent`. */\n export type FromCurrent<\n Failure = unknown,\n RequestLayer extends LayerInput = DefaultRequestLayer,\n Context extends object = NextEffectContext\n > = FromCurrentNextEffect<Failure, RequestLayer, Context>\n\n /** The host-owned adapter returned by `managed`. */\n export type Managed<\n Layer extends LayerInput,\n Failure = unknown,\n RequestLayer extends LayerInput = DefaultRequestLayer,\n Context extends object = NextEffectContext\n > = ManagedNextEffect<Layer, Failure, RequestLayer, Context>\n\n /** Options shared by all handlers created from a NextEffect builder. */\n export type Options<\n Failure = unknown,\n RequestLayer extends LayerInput = DefaultRequestLayer,\n Context extends object = NextEffectContext\n > = NextEffectOptions<Failure, RequestLayer, Context>\n\n /** Options for a host-owned managed adapter. */\n export type ManagedOptions<\n Failure = unknown,\n RequestLayer extends LayerInput = DefaultRequestLayer,\n Context extends object = NextEffectContext\n > = NextEffectManagedOptions<Failure, RequestLayer, Context>\n\n /** The lifecycle inspection returned by a managed adapter. */\n export type ManagedInspection = NextEffectManagedInspection\n\n /** A typed per-route success policy. */\n export type RouteOptions<A, Context extends object = NextEffectContext> = NextEffectRouteOptions<\n A,\n Context\n >\n\n /** The explicit App Router context passed to route factories. */\n export type Context<Params extends object = NextEffectParams> = NextEffectContext<Params>\n\n /** The native handler returned by `handler` and `gen`. */\n export type Handler<Context extends object = NextEffectContext> = NextRouteHandler<Context>\n\n /** A native success policy value. */\n export type Success<A = unknown> = NextEffectSuccess<A>\n}\n"],"mappings":";;;;;AAiBA,MAAM,0BAA0B;CAAC;CAAW;CAAa;AAAW;AAEpE,MAAM,qCACJ,YACS;CACT,MAAM,qBAAqB,wBAAwB,QAAQ,SAAS,QAAQ,UAAU,KAAA,CAAS;CAE/F,IAAI,mBAAmB,SAAS,GAC9B,MAAM,IAAI,UACR,gFAAgF,mBAAmB,KAAK,IAAI,GAC9G;AAEJ;;AAUA,MAAa,wBACX,aACA,iBACA,aACA,iBAC6B;CAC7B,kCAAkC,YAAY;CAE9C,OAAO,OAAO,SAAS,YAAY;EACjC,MAAM,WAAW,MAAM,YAAY,SAAS,OAAO;EACnD,MAAM,UAAU,YAAY,SA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,cAAc,KAAK;EACzB,MAAM,UAAW,KAAK,MAAM,CAAC;EAE7B,OAAO,KAAK,aAAa,aACvB,2BACQ,UACN,KAAK,SACL,aACA,OACF,CACF;CACF;CAiCA,IAAI,GAAG,MAAsB;EAC3B,MAAM,OAAO,KAAK;EAClB,MAAM,UAAW,KAAK,MAAM,CAAC;EAE7B,OAAO,KAAK,aAAa,aACvB,2BACQ,UACN,KAAK,UACJ,SAAS,YACR,OAAO,SACC,KAAK,SAAS,OAAO,CAC7B,GACF,OACF,CACF;CACF;CAEA,YACE,OACwC;EACxC,OAAO;GACL,EAAE,OAAO,YAAY;IAEnB,OAAO,MAAM,OADW,QAAQ,SAAqB,CAChC;GACvB;GACA,QAAQ,OAAO,iBAAiB;IAE9B,OAAO,MAAM,OADW,QAAQ,SAAqB,CAChC;GACvB;EACF;CACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { c as RuntimeContextStorage, s as RuntimeContext } from "./index-heuaRmXR.mjs";
1
+ import { c as RuntimeContext, l as RuntimeContextStorage } from "./layer-C2OaqTmB.mjs";
2
2
  //#region src/runtime/node-context.d.ts
3
3
  /** RuntimeContextStorage backed by Node/Bun async context propagation. */
4
4
  declare class NodeRuntimeContextStorage implements RuntimeContextStorage {
@@ -9,4 +9,4 @@ declare class NodeRuntimeContextStorage implements RuntimeContextStorage {
9
9
  declare const nodeRuntimeContextStorage: NodeRuntimeContextStorage;
10
10
  //#endregion
11
11
  export { nodeRuntimeContextStorage as n, NodeRuntimeContextStorage as t };
12
- //# sourceMappingURL=node-context-DWsCUBRa.d.mts.map
12
+ //# sourceMappingURL=node-context-1YEjrU9g.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-context-DWsCUBRa.d.mts","names":[],"sources":["../src/runtime/node-context.ts"],"mappings":";;;cA2Ba,qCAAqC;EAChD,IAAI,GAAG,SAAS,gBAAgB,eAAe,IAAI;EAInD,WAAW;;;cAYA,2BAAyB"}
1
+ {"version":3,"file":"node-context-1YEjrU9g.d.mts","names":[],"sources":["../src/runtime/node-context.ts"],"mappings":";;;cA2Ba,qCAAqC;EAChD,IAAI,GAAG,SAAS,gBAAgB,eAAe,IAAI;EAInD,WAAW;;;cAYA,2BAAyB"}
@@ -1,4 +1,4 @@
1
- import { f as setRuntimeContextFrameCarrier, h as RuntimeContextNotConfiguredError, m as withActiveRuntimeContextStorage, r as currentRuntimeContextFrame } from "./context-BUEf1qjL.mjs";
1
+ import { f as setRuntimeContextFrameCarrier, h as RuntimeContextNotConfiguredError, m as withActiveRuntimeContextStorage, r as currentRuntimeContextFrame } from "./context-DSGSqcJj.mjs";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/runtime/node-context.ts
4
4
  const asyncLocalStorage = new AsyncLocalStorage();
@@ -22,4 +22,4 @@ const nodeRuntimeContextStorage = new NodeRuntimeContextStorage();
22
22
  //#endregion
23
23
  export { nodeRuntimeContextStorage as n, NodeRuntimeContextStorage as t };
24
24
 
25
- //# sourceMappingURL=node-context-lggRF4bR.mjs.map
25
+ //# sourceMappingURL=node-context-g3bCcY9t.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-context-lggRF4bR.mjs","names":[],"sources":["../src/runtime/node-context.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\n\nimport { RuntimeContextNotConfiguredError } from './errors'\n\nimport {\n currentRuntimeContextFrame,\n setRuntimeContextFrameCarrier,\n withActiveRuntimeContextStorage\n} from './context'\n\nimport type {\n ActiveRuntimeContextFrame,\n RuntimeContext,\n RuntimeContextFrameCarrier,\n RuntimeContextStorage\n} from './context'\n\nconst asyncLocalStorage = new AsyncLocalStorage<ActiveRuntimeContextFrame>()\n\nconst frameCarrier: RuntimeContextFrameCarrier = {\n run: (frame, program) => asyncLocalStorage.run(frame, program),\n current: () => asyncLocalStorage.getStore()\n}\n\nsetRuntimeContextFrameCarrier(frameCarrier)\n\n/** RuntimeContextStorage backed by Node/Bun async context propagation. */\nexport class NodeRuntimeContextStorage implements RuntimeContextStorage {\n run<A>(context: RuntimeContext, program: () => A): A {\n return withActiveRuntimeContextStorage(this, context, program)\n }\n\n current(): RuntimeContext {\n const frame = currentRuntimeContextFrame()\n\n if (!frame || frame.storage !== this) {\n throw new RuntimeContextNotConfiguredError()\n }\n\n return frame.context\n }\n}\n\n/** Shared Node/Bun storage used by the compatibility APIs and default Runtime. */\nexport const nodeRuntimeContextStorage = new NodeRuntimeContextStorage()\n\nexport { RuntimeContextNotConfiguredError } from './errors'\n\nexport type { RuntimeContext, RuntimeContextStorage } from './context'\n"],"mappings":";;;AAiBA,MAAM,oBAAoB,IAAI,kBAA6C;AAO3E,8BAA8B;CAJ5B,MAAM,OAAO,YAAY,kBAAkB,IAAI,OAAO,OAAO;CAC7D,eAAe,kBAAkB,SAAS;AAGH,CAAC;;AAG1C,IAAa,4BAAb,MAAwE;CACtE,IAAO,SAAyB,SAAqB;EACnD,OAAO,gCAAgC,MAAM,SAAS,OAAO;CAC/D;CAEA,UAA0B;EACxB,MAAM,QAAQ,2BAA2B;EAEzC,IAAI,CAAC,SAAS,MAAM,YAAY,MAC9B,MAAM,IAAI,iCAAiC;EAG7C,OAAO,MAAM;CACf;AACF;;AAGA,MAAa,4BAA4B,IAAI,0BAA0B"}
1
+ {"version":3,"file":"node-context-g3bCcY9t.mjs","names":[],"sources":["../src/runtime/node-context.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\n\nimport { RuntimeContextNotConfiguredError } from './errors'\n\nimport {\n currentRuntimeContextFrame,\n setRuntimeContextFrameCarrier,\n withActiveRuntimeContextStorage\n} from './context'\n\nimport type {\n ActiveRuntimeContextFrame,\n RuntimeContext,\n RuntimeContextFrameCarrier,\n RuntimeContextStorage\n} from './context'\n\nconst asyncLocalStorage = new AsyncLocalStorage<ActiveRuntimeContextFrame>()\n\nconst frameCarrier: RuntimeContextFrameCarrier = {\n run: (frame, program) => asyncLocalStorage.run(frame, program),\n current: () => asyncLocalStorage.getStore()\n}\n\nsetRuntimeContextFrameCarrier(frameCarrier)\n\n/** RuntimeContextStorage backed by Node/Bun async context propagation. */\nexport class NodeRuntimeContextStorage implements RuntimeContextStorage {\n run<A>(context: RuntimeContext, program: () => A): A {\n return withActiveRuntimeContextStorage(this, context, program)\n }\n\n current(): RuntimeContext {\n const frame = currentRuntimeContextFrame()\n\n if (!frame || frame.storage !== this) {\n throw new RuntimeContextNotConfiguredError()\n }\n\n return frame.context\n }\n}\n\n/** Shared Node/Bun storage used by the compatibility APIs and default Runtime. */\nexport const nodeRuntimeContextStorage = new NodeRuntimeContextStorage()\n\nexport { RuntimeContextNotConfiguredError } from './errors'\n\nexport type { RuntimeContext, RuntimeContextStorage } from './context'\n"],"mappings":";;;AAiBA,MAAM,oBAAoB,IAAI,kBAA6C;AAO3E,8BAA8B;CAJ5B,MAAM,OAAO,YAAY,kBAAkB,IAAI,OAAO,OAAO;CAC7D,eAAe,kBAAkB,SAAS;AAGH,CAAC;;AAG1C,IAAa,4BAAb,MAAwE;CACtE,IAAO,SAAyB,SAAqB;EACnD,OAAO,gCAAgC,MAAM,SAAS,OAAO;CAC/D;CAEA,UAA0B;EACxB,MAAM,QAAQ,2BAA2B;EAEzC,IAAI,CAAC,SAAS,MAAM,YAAY,MAC9B,MAAM,IAAI,iCAAiC;EAG7C,OAAO,MAAM;CACf;AACF;;AAGA,MAAa,4BAA4B,IAAI,0BAA0B"}
package/dist/node.d.mts CHANGED
@@ -1,8 +1,7 @@
1
- import { C as EffectError, E as EffectSuccess, c as RuntimeContextStorage, s as RuntimeContext } from "./index-heuaRmXR.mjs";
2
- import { C as CompleteExecution, D as LayerInput, M as ProvidedEnvironment, T as CompleteInput, r as RuntimeOptions, y as LayerBackend } from "./outcome-CB43bnFW.mjs";
3
- import { t as RuntimeContextNotConfiguredError } from "./errors-BKcsQ0ip.mjs";
4
- import "./index-CX6iAoCB.mjs";
5
- import { n as nodeRuntimeContextStorage, t as NodeRuntimeContextStorage } from "./node-context-DWsCUBRa.mjs";
1
+ import { $ as CompleteInput, Ot as EffectError, V as LayerBackend, Z as CompleteExecution, c as RuntimeContext, g as RuntimeOptions, h as RuntimeDisposeOptions, jt as EffectSuccess, l as RuntimeContextStorage, ot as ProvidedEnvironment, tt as LayerInput } from "./layer-C2OaqTmB.mjs";
2
+ import "./index-3Bkl-sxS.mjs";
3
+ import { t as RuntimeContextNotConfiguredError } from "./errors-CpHMzPiP.mjs";
4
+ import { n as nodeRuntimeContextStorage, t as NodeRuntimeContextStorage } from "./node-context-1YEjrU9g.mjs";
6
5
  import { Result } from "better-result";
7
6
  //#region src/runtime/node-runtime.d.ts
8
7
  /** Process signals supported by the Node.js/Bun process boundary. */
@@ -23,7 +22,11 @@ type NodeRuntimeOptions<Success = unknown, Failure = unknown> = RuntimeOptions &
23
22
  readonly onFailure?: NodeRuntimeFailureHandler<Failure>;
24
23
  /** Observe a defect. Defects are rethrown after the handler runs. */
25
24
  readonly onDefect?: NodeRuntimeDefectHandler;
25
+ /** Runtime shutdown policy used after a signal or main-program settlement. */
26
+ readonly shutdown?: RuntimeDisposeOptions;
26
27
  };
28
+ /** Options for the Layer-first `NodeRuntime.launch` entrypoint. */
29
+ type NodeRuntimeLaunchOptions = Omit<NodeRuntimeOptions<never, never>, 'onSuccess' | 'onFailure'>;
27
30
  type NonResultMainSuccess<Value> = Value extends Result<any, any> ? never : Value;
28
31
  type PlainMainSuccess<Value> = NonResultMainSuccess<Awaited<Value>>;
29
32
  type MainSuccess<Value> = EffectSuccess<Value> | PlainMainSuccess<Value>;
@@ -38,6 +41,8 @@ declare class NodeRuntime {
38
41
  static runMain<A, L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: MainOptions<A>): Promise<Awaited<A>>;
39
42
  static runMain<A, L extends LayerInput>(layer: L & CompleteInput<L>, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: MainOptions<A>): Promise<Awaited<A>>;
40
43
  static runMain<A, L extends LayerInput>(layer: L & CompleteInput<L>, options: MainOptions<A>, program: CompleteExecution<ProvidedEnvironment<L>, A>): Promise<Awaited<A>>;
44
+ /** Start a Layer-owned application until a process or caller signal shuts it down. */
45
+ static launch<L extends LayerInput>(layer: L & CompleteInput<L>, options?: NodeRuntimeLaunchOptions): Promise<void>;
41
46
  }
42
47
  /** Type-level aliases for the Node.js/Bun process boundary. */
43
48
  declare namespace NodeRuntime {
@@ -47,5 +52,5 @@ declare namespace NodeRuntime {
47
52
  type Signal = NodeRuntimeSignal;
48
53
  }
49
54
  //#endregion
50
- export { NodeRuntime, NodeRuntimeContextStorage, type NodeRuntimeDefectHandler, type NodeRuntimeFailureHandler, type NodeRuntimeOptions, type NodeRuntimeSignal, type NodeRuntimeSuccessHandler, type RuntimeContext, RuntimeContextNotConfiguredError, type RuntimeContextStorage, nodeRuntimeContextStorage };
55
+ export { NodeRuntime, NodeRuntimeContextStorage, type NodeRuntimeDefectHandler, type NodeRuntimeFailureHandler, type NodeRuntimeLaunchOptions, type NodeRuntimeOptions, type NodeRuntimeSignal, type NodeRuntimeSuccessHandler, type RuntimeContext, RuntimeContextNotConfiguredError, type RuntimeContextStorage, nodeRuntimeContextStorage };
51
56
  //# sourceMappingURL=node.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.mts","names":[],"sources":["../src/runtime/node-runtime.ts"],"mappings":";;;;;;;;KAoBY;;KAGA,0BAA0B,YAAY,OAAO;;KAG7C,0BAA0B,YAAY,OAAO;;KAG7C,4BAA4B;;KAG5B,mBAAmB,mBAAmB,qBAAqB;;WAE5D,mBAAmB;;WAEnB,YAAY,0BAA0B;;WAEtC,YAAY,0BAA0B;;WAEtC,WAAW;;KAGjB,qBAAqB,SAAS,cAAc,2BAA+B;KAE3E,iBAAiB,SAAS,qBAAqB,QAAQ;KAEvD,YAAY,SAAS,cAAc,SAAS,iBAAiB;KAE7D,YAAY,SAAS,YAAY;KAEjC,YAAY,SAAS,mBAAmB,YAAY,QAAQ,YA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