better-effect 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +220 -6
- package/dist/adapters/iti.d.mts +2 -1
- package/dist/adapters/iti.d.mts.map +1 -1
- package/dist/adapters/iti.mjs +11 -10
- package/dist/adapters/iti.mjs.map +1 -1
- package/dist/{effect-2ZcGZI8A.mjs → effect-CK4YZaX0.mjs} +56 -10
- package/dist/effect-CK4YZaX0.mjs.map +1 -0
- package/dist/hono.d.mts +3 -3
- package/dist/hono.mjs +3 -3
- package/dist/{index-DStz0JMN.d.mts → index-B1nH4luq.d.mts} +73 -6
- package/dist/index-B1nH4luq.d.mts.map +1 -0
- package/dist/index-BMdU_Z72.d.mts +18 -0
- package/dist/index-BMdU_Z72.d.mts.map +1 -0
- package/dist/{index-C7Qild0_.d.mts → index-CX6iAoCB.d.mts} +15 -151
- package/dist/index-CX6iAoCB.d.mts.map +1 -0
- package/dist/index-GYJ4qm9K.d.mts +179 -0
- package/dist/index-GYJ4qm9K.d.mts.map +1 -0
- package/dist/index-heuaRmXR.d.mts.map +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{internal-identity-DmUpBeeL.mjs → internal-identity-CbXoZIfw.mjs} +3 -3
- package/dist/internal-identity-CbXoZIfw.mjs.map +1 -0
- package/dist/{signal-B97cs85Z.mjs → layer-D56fRdLt.mjs} +30 -111
- package/dist/layer-D56fRdLt.mjs.map +1 -0
- package/dist/node-context-DWsCUBRa.d.mts +12 -0
- package/dist/node-context-DWsCUBRa.d.mts.map +1 -0
- package/dist/node-context-lggRF4bR.mjs +25 -0
- package/dist/node-context-lggRF4bR.mjs.map +1 -0
- package/dist/node.d.mts +51 -0
- package/dist/node.d.mts.map +1 -0
- package/dist/node.mjs +233 -0
- package/dist/node.mjs.map +1 -0
- package/dist/{index-rQhZk3Nt.d.mts → outcome-CB43bnFW.d.mts} +29 -19
- package/dist/outcome-CB43bnFW.d.mts.map +1 -0
- package/dist/{scope-GGnmTQck.mjs → program-metadata-DhQCCirO.mjs} +18 -3
- package/dist/program-metadata-DhQCCirO.mjs.map +1 -0
- package/dist/registration-drnZk0SY.mjs +182 -0
- package/dist/registration-drnZk0SY.mjs.map +1 -0
- package/dist/runtime/node.d.mts +2 -11
- package/dist/runtime/node.mjs +2 -24
- package/dist/{runtime-DnMn0X0X.mjs → runtime-CBMrX8Wl.mjs} +210 -47
- package/dist/runtime-CBMrX8Wl.mjs.map +1 -0
- package/dist/signal-D2UTcaaG.mjs +105 -0
- package/dist/signal-D2UTcaaG.mjs.map +1 -0
- package/dist/{standard-services-BFBq-4lo.mjs → standard-services-GBZ32tll.mjs} +200 -16
- package/dist/standard-services-GBZ32tll.mjs.map +1 -0
- package/dist/standard-services.d.mts +3 -3
- package/dist/standard-services.mjs +3 -3
- package/dist/testing.d.mts +65 -6
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +191 -8
- package/dist/testing.mjs.map +1 -1
- package/package.json +8 -3
- package/dist/effect-2ZcGZI8A.mjs.map +0 -1
- package/dist/errors-Dnjhzbt0.mjs +0 -99
- package/dist/errors-Dnjhzbt0.mjs.map +0 -1
- package/dist/index-C7Qild0_.d.mts.map +0 -1
- package/dist/index-DStz0JMN.d.mts.map +0 -1
- package/dist/index-rQhZk3Nt.d.mts.map +0 -1
- package/dist/internal-identity-DmUpBeeL.mjs.map +0 -1
- package/dist/runtime/node.d.mts.map +0 -1
- package/dist/runtime/node.mjs.map +0 -1
- package/dist/runtime-DnMn0X0X.mjs.map +0 -1
- package/dist/scope-GGnmTQck.mjs.map +0 -1
- package/dist/signal-B97cs85Z.mjs.map +0 -1
- package/dist/standard-services-BFBq-4lo.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect-CK4YZaX0.mjs","names":["map","mapError","andThen","next","resultMatchError","resultMatchErrorPartial","tap","tapError","matchError","matchErrorPartial","recover","programMap","programMapError","programAndThen","programTap","programTapError","programRecover"],"sources":["../src/effect/combinators.ts","../src/effect/program-combinators.ts","../src/effect/program-scheduler.ts","../src/effect/effect.ts"],"sourcesContent":["import {\n matchError as resultMatchError,\n matchErrorPartial as resultMatchErrorPartial,\n Result\n} from 'better-result'\n\nimport type { Result as ResultType } from 'better-result'\n\nimport type { AnyService } from '../service'\nimport { isPromiseLike } from '../utils/runtime'\nimport type { Effect, EffectError, EffectRequirements, EffectSuccess } from './types'\n\ntype EffectInput<A, E> = ResultType<A, E> | PromiseLike<ResultType<A, E>>\n\ntype AnyEffectInput = EffectInput<any, any>\ntype AnyEffectValue = ResultType<any, any>\ntype AnyAsyncEffectInput = PromiseLike<ResultType<any, any>>\ntype CombinatorCallback = (value: any) => any\ntype CombinatorInput = AnyEffectInput | CombinatorCallback\n\ntype PreserveAsync<Input, Output> = Input extends PromiseLike<unknown> ? Promise<Output> : Output\n\ntype MappedResult<Input, B> = Effect<B, EffectError<Input>, EffectRequirements<Input>>\n\ntype ErrorMappedResult<Input, E2> = Effect<EffectSuccess<Input>, E2, EffectRequirements<Input>>\n\ntype ChainedResult<First, Next> = Effect<\n EffectSuccess<Next>,\n EffectError<First> | EffectError<Next>,\n EffectRequirements<First> | EffectRequirements<Next>\n>\n\ntype ChainedOutput<First, Next> = ChainedResult<First, Next>\n\ntype AsyncChainedOutput<First, Next> = Promise<ChainedResult<First, Next>>\n\ntype MapOperation<A, B> = {\n <Input>(effect: Input & EffectInput<A, any>): PreserveAsync<Input, MappedResult<Input, B>>\n}\n\ntype MapErrorOperation<E1, E2> = {\n <Input>(effect: Input & EffectInput<any, E1>): PreserveAsync<Input, ErrorMappedResult<Input, E2>>\n}\n\ntype AndThenOperation<Next> = {\n <Input>(effect: Input & AnyEffectValue): ChainedOutput<Input, Next>\n}\n\ntype AndThenAsyncOperation<A, Next> = {\n <Input>(effect: Input & EffectInput<A, any>): AsyncChainedOutput<Input, Next>\n}\n\ntype TappedResult<Input> = Effect<\n EffectSuccess<Input>,\n EffectError<Input>,\n EffectRequirements<Input>\n>\n\ntype RecoveredResult<Input, Next> = Effect<\n EffectSuccess<Input> | EffectSuccess<Next>,\n EffectError<Next>,\n EffectRequirements<Input> | EffectRequirements<Next>\n>\n\ntype FlattenedResult<Input> = Effect<\n EffectSuccess<EffectSuccess<Input>>,\n EffectError<Input> | EffectError<EffectSuccess<Input>>,\n EffectRequirements<Input> | EffectRequirements<EffectSuccess<Input>>\n>\n\ntype AsResult<Input, Value> = Effect<Value, EffectError<Input>, EffectRequirements<Input>>\n\ntype MatchedResult<Input, OkResult, ErrResult> = Effect<\n EffectSuccess<OkResult> | EffectSuccess<ErrResult>,\n EffectError<OkResult> | EffectError<ErrResult>,\n EffectRequirements<Input> | EffectRequirements<OkResult> | EffectRequirements<ErrResult>\n>\n\ntype AllResult<Results extends readonly AnyEffectValue[]> = Effect<\n { -readonly [Index in keyof Results]: EffectSuccess<Results[Index]> },\n EffectError<Results[number]>,\n EffectRequirements<Results[number]>\n>\n\ntype ZipResult<Left, Right> = Effect<\n [EffectSuccess<Left>, EffectSuccess<Right>],\n EffectError<Left> | EffectError<Right>,\n EffectRequirements<Left> | EffectRequirements<Right>\n>\n\ntype TapOperation = {\n <Input>(\n effect: Input & AnyEffectInput,\n fn: (value: EffectSuccess<Input>) => void\n ): PreserveAsync<Input, TappedResult<Input>>\n}\n\ntype TapErrorOperation = {\n <Input>(\n effect: Input & AnyEffectInput,\n fn: (error: EffectError<Input>) => void\n ): PreserveAsync<Input, TappedResult<Input>>\n}\n\ntype TapBothOperation = {\n <Input>(\n effect: Input & AnyEffectInput,\n handlers: {\n ok: (value: EffectSuccess<Input>) => void\n err: (error: EffectError<Input>) => void\n }\n ): PreserveAsync<Input, TappedResult<Input>>\n}\n\ntype TapAsyncOperation = {\n <Input>(effect: Input & AnyEffectInput): Promise<TappedResult<Input>>\n}\n\ntype TapErrorAsyncOperation = {\n <Input>(effect: Input & AnyEffectInput): Promise<TappedResult<Input>>\n}\n\ntype TapBothAsyncOperation = {\n <Input>(effect: Input & AnyEffectInput): Promise<TappedResult<Input>>\n}\n\ntype TaggedErrorLike = Error & { readonly _tag: string }\n\ntype TaggedErrorHandlers<ErrorValue extends TaggedErrorLike> = {\n // oxlint-disable-next-line anti-slop/no-unknown-returns -- better-result matchers allow arbitrary handler results.\n [Tag in ErrorValue['_tag']]: (error: Extract<ErrorValue, { readonly _tag: Tag }>) => unknown\n}\n\ntype TaggedErrorOf<Input> = Extract<EffectError<Input>, TaggedErrorLike>\n\ntype TaggedErrorHandlersFor<Input> = [EffectError<Input>] extends [TaggedErrorLike]\n ? TaggedErrorHandlers<TaggedErrorOf<Input>>\n : never\n\ntype HandlerReturn<Handlers> = {\n [Key in keyof Handlers]-?: NonNullable<Handlers[Key]> extends (error: never) => infer Return\n ? Return\n : never\n}[keyof Handlers]\n\ntype RequiredHandlerKeys<Handlers> = {\n [Key in keyof Handlers]-?: {} extends Pick<Handlers, Key>\n ? never\n : undefined extends Handlers[Key]\n ? never\n : Key\n}[keyof Handlers]\n\ntype UnhandledTaggedErrors<ErrorValue extends TaggedErrorLike, Handlers> = Exclude<\n ErrorValue,\n { readonly _tag: Extract<RequiredHandlerKeys<Handlers>, ErrorValue['_tag']> }\n>\n\ntype MatchErrorResult<Input, Handlers> = Effect<\n EffectSuccess<Input>,\n HandlerReturn<Handlers>,\n EffectRequirements<Input>\n>\n\ntype MatchErrorPartialResult<Input, Handlers> = Effect<\n EffectSuccess<Input>,\n HandlerReturn<Handlers> | UnhandledTaggedErrors<TaggedErrorOf<Input>, Handlers>,\n EffectRequirements<Input>\n>\n\ntype RecoverOperation<Next> = {\n <Input>(\n effect: Input & AnyEffectInput,\n fn: (error: EffectError<Input>) => Next\n ): PreserveAsync<Input, RecoveredResult<Input, Next>>\n}\n\ntype RecoverAsyncOperation<Next> = {\n <Input>(\n effect: Input & AnyEffectInput,\n fn: (error: EffectError<Input>) => Next\n ): Promise<RecoveredResult<Input, Next>>\n}\n\nconst asResult = <Value>(value: Value): ResultType<any, any> => {\n // SAFETY: Effect is the declaration-only Result facade, so every runtime value is a Result.\n return value as ResultType<any, any>\n}\n\nconst mapResult = <A, B, E, Requirements extends AnyService>(\n result: ResultType<A, E>,\n fn: (value: A) => B\n): Effect<B, E, Requirements> => {\n // SAFETY: Result.map changes only the success channel; the declaration-only Effect marker is restored by this adapter.\n return Result.map(result, fn) as Effect<B, E, Requirements>\n}\n\nconst mapErrorResult = <A, E1, E2, Requirements extends AnyService>(\n result: ResultType<A, E1>,\n fn: (error: E1) => E2\n): Effect<A, E2, Requirements> => {\n // SAFETY: Result.mapError changes only the error channel; the declaration-only Effect marker is restored by this adapter.\n return Result.mapError(result, fn) as Effect<A, E2, Requirements>\n}\n\nconst andThenResult = <\n A,\n B,\n E1,\n E2,\n Requirements1 extends AnyService,\n Requirements2 extends AnyService\n>(\n result: ResultType<A, E1>,\n next: (value: A) => ResultType<B, E2>\n): Effect<B, E1 | E2, Requirements1 | Requirements2> => {\n // SAFETY: The public callback returns an Effect, whose only runtime contract is the underlying Result.\n const resultNext = next as (value: A) => ResultType<B, E2>\n\n // SAFETY: Result.andThen unions Result errors; the declaration-only Effect marker is restored by this adapter.\n return Result.andThen(result, resultNext) as Effect<B, E1 | E2, Requirements1 | Requirements2>\n}\n\nconst andThenAsyncResult = <\n A,\n B,\n E1,\n E2,\n Requirements1 extends AnyService,\n Requirements2 extends AnyService\n>(\n result: ResultType<A, E1>,\n next: (value: A) => PromiseLike<ResultType<B, E2>>\n): Promise<Effect<B, E1 | E2, Requirements1 | Requirements2>> => {\n // SAFETY: The public callback returns an Effect, whose only runtime contract is the underlying Result.\n const resultNext = (value: A) => {\n // SAFETY: Promise resolution preserves the callback's Result value; only declaration-only Effect metadata is erased.\n return Promise.resolve(next(value)) as Promise<ResultType<B, E2>>\n }\n\n // SAFETY: Result.andThenAsync unions Result errors; the declaration-only Effect marker is restored by this adapter.\n return Result.andThenAsync(result, resultNext) as Promise<\n Effect<B, E1 | E2, Requirements1 | Requirements2>\n >\n}\n\n/**\n * Map the successful value of a Result or Effect result.\n *\n * Supports both data-first and data-last forms and preserves asynchronous\n * results and declaration-only Service requirements.\n *\n * @example\n * ```ts\n * const doubled = Effect.map(Result.ok(2), (value) => value * 2)\n * const toLabel = Effect.map((value: number) => `#${value}`)\n * ```\n */\nexport function map<A, B>(fn: (value: A) => B): MapOperation<A, B>\nexport function map<Input, B>(\n effect: Input & AnyEffectInput,\n fn: (value: EffectSuccess<Input>) => B\n): PreserveAsync<Input, MappedResult<Input, B>>\nexport function map(first: CombinatorInput, second?: CombinatorCallback): any {\n if (first instanceof Function && second === undefined) {\n // SAFETY: The curried overload accepts a unary mapping callback in this branch.\n const callback = first as CombinatorCallback\n\n return (effect: AnyEffectInput) => {\n // SAFETY: The overload implementation has already established the callback and Effect input positions.\n return map(effect as never, callback as never)\n }\n }\n\n // SAFETY: The data-first overload requires the second argument to be a unary mapping callback.\n const fn = second as CombinatorCallback\n\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => {\n // SAFETY: Result is the runtime representation shared by Effect and better-result.\n return mapResult(result as ResultType<any, any>, fn)\n })\n }\n\n // SAFETY: The data-first overload supplies a Result-compatible Effect value.\n return mapResult(first as ResultType<any, any>, fn)\n}\n\n/**\n * Map the error value of a Result or Effect result while preserving its\n * successful value, asynchronous shape, and declaration-only Service requirements.\n *\n * @example\n * ```ts\n * const labelled = Effect.mapError(Result.err('missing'), (error) => ({ error }))\n * ```\n */\nexport function mapError<E1, E2>(fn: (error: E1) => E2): MapErrorOperation<E1, E2>\nexport function mapError<Input, E2>(\n effect: Input & AnyEffectInput,\n fn: (error: EffectError<Input>) => E2\n): PreserveAsync<Input, ErrorMappedResult<Input, E2>>\nexport function mapError(first: CombinatorInput, second?: CombinatorCallback): any {\n if (first instanceof Function && second === undefined) {\n // SAFETY: The curried overload accepts a unary error-mapping callback in this branch.\n const callback = first as CombinatorCallback\n\n return (effect: AnyEffectInput) => {\n // SAFETY: The overload implementation has already established the callback and Effect input positions.\n return mapError(effect as never, callback as never)\n }\n }\n\n // SAFETY: The data-first overload requires the second argument to be a unary error-mapping callback.\n const fn = second as CombinatorCallback\n\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => {\n // SAFETY: Result is the runtime representation shared by Effect and better-result.\n return mapErrorResult(result as ResultType<any, any>, fn)\n })\n }\n\n // SAFETY: The data-first overload supplies a Result-compatible Effect value.\n return mapErrorResult(first as ResultType<any, any>, fn)\n}\n\n/**\n * Chain a synchronous Result-producing operation after a successful result.\n *\n * The next operation is skipped when the input is an error. Both error types\n * and both sets of Service requirements are preserved in the output.\n *\n * @example\n * ```ts\n * const user = Effect.andThen(Result.ok('u1'), (id) => repository.find(id))\n * ```\n */\nexport function andThen<A, Next extends AnyEffectValue>(\n next: (value: A) => Next\n): AndThenOperation<Next>\nexport function andThen<Input, Next extends AnyEffectValue>(\n effect: Input & AnyEffectValue,\n next: (value: EffectSuccess<Input>) => Next\n): ChainedOutput<Input, Next>\nexport function andThen(first: CombinatorInput, second?: CombinatorCallback): any {\n if (first instanceof Function && second === undefined) {\n // SAFETY: The curried overload accepts a unary continuation in this branch.\n const callback = first as CombinatorCallback\n\n return (effect: AnyEffectInput) => {\n // SAFETY: The overload implementation has already established the callback and Effect input positions.\n return andThen(effect as never, callback as never)\n }\n }\n\n // SAFETY: The data-first overload requires the second argument to return a Result.\n const next = second as CombinatorCallback\n\n // SAFETY: The data-first overload supplies a Result-compatible Effect value.\n return andThenResult(first as ResultType<any, any>, next)\n}\n\n/**\n * Chain an asynchronous Result-producing operation after a successful result.\n *\n * The returned value is always a Promise and retains both operations' error\n * and Service-requirement metadata.\n *\n * @example\n * ```ts\n * const user = Effect.andThenAsync(loadUser(), (user) => fetchProfile(user.id))\n * ```\n */\nexport function andThenAsync<A, Next extends AnyAsyncEffectInput>(\n next: (value: A) => Next\n): AndThenAsyncOperation<A, Next>\nexport function andThenAsync<Input, Next extends AnyAsyncEffectInput>(\n effect: Input & AnyEffectInput,\n next: (value: EffectSuccess<Input>) => Next\n): AsyncChainedOutput<Input, Next>\nexport function andThenAsync(first: CombinatorInput, second?: CombinatorCallback): any {\n if (first instanceof Function && second === undefined) {\n // SAFETY: The curried overload accepts a unary asynchronous continuation in this branch.\n const callback = first as CombinatorCallback\n\n return (effect: AnyEffectInput) => {\n // SAFETY: The overload implementation has already established the callback and Effect input positions.\n return andThenAsync(effect as never, callback as never)\n }\n }\n\n // SAFETY: The data-first overload requires the second argument to return a PromiseLike Effect.\n const next = second as CombinatorCallback\n\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => {\n // SAFETY: Result is the runtime representation shared by Effect and better-result.\n return andThenAsyncResult(result as ResultType<any, any>, next)\n })\n }\n\n // SAFETY: The data-first overload supplies a Result-compatible Effect value.\n return andThenAsyncResult(first as ResultType<any, any>, next)\n}\n\nconst tapResult = <A, E, Requirements extends AnyService>(\n result: ResultType<A, E>,\n fn: (value: A) => void\n): Effect<A, E, Requirements> =>\n // SAFETY: Result.tap preserves the Result value; the declaration-only Effect marker is restored here.\n Result.tap(result, fn) as Effect<A, E, Requirements>\n\nconst tapErrorResult = <A, E, Requirements extends AnyService>(\n result: ResultType<A, E>,\n fn: (error: E) => void\n): Effect<A, E, Requirements> =>\n // SAFETY: Result.tapError preserves the Result value; the declaration-only Effect marker is restored here.\n Result.tapError(result, fn) as Effect<A, E, Requirements>\n\nconst tapBothResult = <A, E, Requirements extends AnyService>(\n result: ResultType<A, E>,\n handlers: { ok: (value: A) => void; err: (error: E) => void }\n): Effect<A, E, Requirements> =>\n // SAFETY: Result.tapBoth preserves the Result value; the declaration-only Effect marker is restored here.\n Result.tapBoth(result, handlers) as Effect<A, E, Requirements>\n\nconst tapAsyncResult = <A, E, Requirements extends AnyService>(\n result: ResultType<A, E>,\n fn: (value: A) => PromiseLike<void>\n): Promise<Effect<A, E, Requirements>> =>\n // SAFETY: Result.tapAsync preserves the Result value and owns observer defect behavior; only the Effect marker is restored here.\n Result.tapAsync(result, (value) => Promise.resolve(fn(value))) as Promise<\n Effect<A, E, Requirements>\n >\n\nconst tapErrorAsyncResult = <A, E, Requirements extends AnyService>(\n result: ResultType<A, E>,\n fn: (error: E) => PromiseLike<void>\n): Promise<Effect<A, E, Requirements>> =>\n // SAFETY: Result.tapErrorAsync preserves the Result value and owns observer defect behavior; only the Effect marker is restored here.\n Result.tapErrorAsync(result, (error) => Promise.resolve(fn(error))) as Promise<\n Effect<A, E, Requirements>\n >\n\nconst tapBothAsyncResult = <A, E, Requirements extends AnyService>(\n result: ResultType<A, E>,\n handlers: { ok: (value: A) => PromiseLike<void>; err: (error: E) => PromiseLike<void> }\n): Promise<Effect<A, E, Requirements>> =>\n // SAFETY: Result.tapBothAsync selects one branch and preserves the Result; only the Effect marker is restored here.\n Result.tapBothAsync(result, {\n ok: (value) => Promise.resolve(handlers.ok(value)),\n err: (error) => Promise.resolve(handlers.err(error))\n }) as Promise<Effect<A, E, Requirements>>\n\nconst asTaggedResult = (\n result: ResultType<unknown, unknown>\n): ResultType<unknown, TaggedErrorLike> => {\n // SAFETY: The public matcher overload restricts error values to TaggedErrorLike before reaching this runtime boundary.\n return result as ResultType<unknown, TaggedErrorLike>\n}\n\nconst matchErrorResult = <\n A,\n E extends TaggedErrorLike,\n Requirements extends AnyService,\n Handlers extends TaggedErrorHandlers<E>\n>(\n result: ResultType<A, E>,\n handlers: Handlers\n): Effect<A, HandlerReturn<Handlers>, Requirements> => {\n // SAFETY: Result.mapError selects Err and preserves Ok; the declaration-only Effect marker is restored here.\n return Result.mapError(result, (error) => resultMatchError(error, handlers)) as Effect<\n A,\n HandlerReturn<Handlers>,\n Requirements\n >\n}\n\nconst matchErrorPartialResult = <\n A,\n E extends TaggedErrorLike,\n Requirements extends AnyService,\n Handlers extends Partial<TaggedErrorHandlers<E>>\n>(\n result: ResultType<A, E>,\n handlers: Handlers\n): Effect<A, HandlerReturn<Handlers> | UnhandledTaggedErrors<E, Handlers>, Requirements> => {\n // SAFETY: Result.mapError selects Err and preserves Ok; the declaration-only Effect marker is restored here.\n return Result.mapError(result, (error) => resultMatchErrorPartial(error, handlers)) as Effect<\n A,\n HandlerReturn<Handlers> | UnhandledTaggedErrors<E, Handlers>,\n Requirements\n >\n}\n\nconst recoverResult = <\n A,\n E,\n B,\n E2,\n Requirements1 extends AnyService,\n Requirements2 extends AnyService\n>(\n result: ResultType<A, E>,\n fn: (error: E) => ResultType<B, E2>\n): Effect<A | B, E2, Requirements1 | Requirements2> =>\n // SAFETY: Result.tryRecover owns recovery and short-circuiting; only Effect metadata is restored here.\n Result.tryRecover(result, fn) as Effect<A | B, E2, Requirements1 | Requirements2>\n\nconst recoverAsyncResult = <\n A,\n E,\n B,\n E2,\n Requirements1 extends AnyService,\n Requirements2 extends AnyService\n>(\n result: ResultType<A, E>,\n fn: (error: E) => PromiseLike<ResultType<B, E2>>\n): Promise<Effect<A | B, E2, Requirements1 | Requirements2>> =>\n // SAFETY: Result.tryRecoverAsync owns asynchronous recovery; only Effect metadata is restored here.\n Result.tryRecoverAsync(result, (error) => Promise.resolve(fn(error))) as Promise<\n Effect<A | B, E2, Requirements1 | Requirements2>\n >\n\nconst flattenResult = <\n A,\n E1,\n E2,\n Requirements1 extends AnyService,\n Requirements2 extends AnyService\n>(\n result: ResultType<ResultType<A, E2>, E1>\n): Effect<A, E1 | E2, Requirements1 | Requirements2> =>\n // SAFETY: Result.flatten removes one Result layer; the outer and inner Effect markers are restored here.\n Result.flatten(result) as Effect<A, E1 | E2, Requirements1 | Requirements2>\n\nconst matchResult = <A, E, OkResult, ErrResult>(\n result: ResultType<A, E>,\n handlers: { ok: (value: A) => OkResult; err: (error: E) => ErrResult }\n): OkResult | ErrResult =>\n // SAFETY: Result.match invokes only the selected branch; handler Results remain ordinary runtime values.\n Result.match(result, handlers as never) as OkResult | ErrResult\n\nconst allResult = <const Results extends readonly AnyEffectValue[]>(\n results: Results\n): AllResult<Results> =>\n // SAFETY: Result.all preserves tuple order and short-circuiting; the declaration-only channels are restored here.\n Result.all(results as readonly ResultType<any, any>[]) as AllResult<Results>\n\n/** Observe a successful value without changing the Result. */\nexport function tap(fn: (value: any) => void): TapOperation\nexport function tap<Input>(\n effect: Input & AnyEffectInput,\n fn: (value: EffectSuccess<Input>) => void\n): PreserveAsync<Input, TappedResult<Input>>\nexport function tap(first: CombinatorInput, second?: CombinatorCallback): any {\n if (first instanceof Function && second === undefined) {\n const callback = first\n return (effect: AnyEffectInput) => tap(effect, callback)\n }\n\n if (second === undefined) {\n throw new TypeError('Effect.tap requires a callback')\n }\n\n const fn = second\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => tapResult(asResult(result), fn))\n }\n\n return tapResult(asResult(first), fn)\n}\n\n/** Observe an error value without changing the Result. */\nexport function tapError(fn: (error: any) => void): TapErrorOperation\nexport function tapError<Input>(\n effect: Input & AnyEffectInput,\n fn: (error: EffectError<Input>) => void\n): PreserveAsync<Input, TappedResult<Input>>\nexport function tapError(first: CombinatorInput, second?: CombinatorCallback): any {\n if (first instanceof Function && second === undefined) {\n const callback = first\n return (effect: AnyEffectInput) => tapError(effect, callback)\n }\n\n if (second === undefined) {\n throw new TypeError('Effect.tapError requires a callback')\n }\n\n const fn = second\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => tapErrorResult(asResult(result), fn))\n }\n\n return tapErrorResult(asResult(first), fn)\n}\n\n/** Observe whichever Result branch is active without changing the Result. */\nexport function tapBoth(handlers: {\n ok: (value: any) => void\n err: (error: any) => void\n}): TapBothOperation\nexport function tapBoth<Input>(\n effect: Input & AnyEffectInput,\n handlers: {\n ok: (value: EffectSuccess<Input>) => void\n err: (error: EffectError<Input>) => void\n }\n): PreserveAsync<Input, TappedResult<Input>>\nexport function tapBoth(first: any, second?: any): any {\n if (second === undefined) {\n return (effect: AnyEffectInput) => tapBoth(effect, first)\n }\n\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => tapBothResult(result, second))\n }\n\n return tapBothResult(asResult(first), second)\n}\n\n/** Observe a successful value asynchronously without changing the Result. */\nexport function tapAsync(fn: (value: any) => PromiseLike<void>): TapAsyncOperation\nexport function tapAsync<Input>(\n effect: Input & AnyEffectInput,\n fn: (value: EffectSuccess<Input>) => PromiseLike<void>\n): Promise<TappedResult<Input>>\nexport function tapAsync(first: CombinatorInput, second?: CombinatorCallback): any {\n if (first instanceof Function && second === undefined) {\n const callback = first\n return (effect: AnyEffectInput) => tapAsync(effect, callback)\n }\n\n if (second === undefined) {\n throw new TypeError('Effect.tapAsync requires a callback')\n }\n\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => tapAsyncResult(asResult(result), second))\n }\n\n return tapAsyncResult(asResult(first), second)\n}\n\n/** Observe an error value asynchronously without changing the Result. */\nexport function tapErrorAsync(fn: (error: any) => PromiseLike<void>): TapErrorAsyncOperation\nexport function tapErrorAsync<Input>(\n effect: Input & AnyEffectInput,\n fn: (error: EffectError<Input>) => PromiseLike<void>\n): Promise<TappedResult<Input>>\nexport function tapErrorAsync(first: CombinatorInput, second?: CombinatorCallback): any {\n if (first instanceof Function && second === undefined) {\n const callback = first\n return (effect: AnyEffectInput) => tapErrorAsync(effect, callback)\n }\n\n if (second === undefined) {\n throw new TypeError('Effect.tapErrorAsync requires a callback')\n }\n\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => tapErrorAsyncResult(asResult(result), second))\n }\n\n return tapErrorAsyncResult(asResult(first), second)\n}\n\n/** Observe the active Result branch asynchronously without changing the Result. */\nexport function tapBothAsync(handlers: {\n ok: (value: any) => PromiseLike<void>\n err: (error: any) => PromiseLike<void>\n}): TapBothAsyncOperation\nexport function tapBothAsync<Input>(\n effect: Input & AnyEffectInput,\n handlers: {\n ok: (value: EffectSuccess<Input>) => PromiseLike<void>\n err: (error: EffectError<Input>) => PromiseLike<void>\n }\n): Promise<TappedResult<Input>>\nexport function tapBothAsync(first: any, second?: any): any {\n if (second === undefined) {\n return (effect: AnyEffectInput) => tapBothAsync(effect, first)\n }\n\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => tapBothAsyncResult(result, second))\n }\n\n return tapBothAsyncResult(asResult(first), second)\n}\n\n/** Match every tagged error variant and map it to a new error value. */\nexport function matchError<Input, Handlers extends TaggedErrorHandlersFor<Input>>(\n effect: Input & AnyEffectInput,\n handlers: Handlers\n): PreserveAsync<Input, MatchErrorResult<Input, Handlers>>\n// oxlint-disable-next-line anti-slop/no-unknown-parameters -- overload implementation is narrowed by the typed public signature.\nexport function matchError(first: AnyEffectInput, second?: unknown): any {\n if (second === undefined) {\n throw new TypeError('Effect.matchError requires handlers')\n }\n\n // SAFETY: The public matcher overload checks the handler map against the source tagged-error union.\n const handlers = second as TaggedErrorHandlers<TaggedErrorLike>\n\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) =>\n matchErrorResult(asTaggedResult(asResult(result)), handlers)\n )\n }\n\n return matchErrorResult(asTaggedResult(asResult(first)), handlers)\n}\n\n/** Match selected tagged errors and retain unhandled variants unchanged. */\nexport function matchErrorPartial<Input, Handlers extends Partial<TaggedErrorHandlersFor<Input>>>(\n effect: Input & AnyEffectInput,\n handlers: Handlers\n): PreserveAsync<Input, MatchErrorPartialResult<Input, Handlers>>\n// oxlint-disable-next-line anti-slop/no-unknown-parameters -- overload implementation is narrowed by the typed public signature.\nexport function matchErrorPartial(first: AnyEffectInput, second?: unknown): any {\n if (second === undefined) {\n throw new TypeError('Effect.matchErrorPartial requires handlers')\n }\n\n // SAFETY: The public matcher overload checks the handler map against the source tagged-error union.\n const handlers = second as Partial<TaggedErrorHandlers<TaggedErrorLike>>\n\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) =>\n matchErrorPartialResult(asTaggedResult(asResult(result)), handlers)\n )\n }\n\n return matchErrorPartialResult(asTaggedResult(asResult(first)), handlers)\n}\n\n/** Recover an Err with a synchronous Result-producing callback. */\nexport function recover<Next extends AnyEffectValue>(\n fn: (error: any) => Next\n): RecoverOperation<Next>\nexport function recover<Input, Next extends AnyEffectValue>(\n effect: Input & AnyEffectInput,\n fn: (error: EffectError<Input>) => Next\n): PreserveAsync<Input, RecoveredResult<Input, Next>>\nexport function recover(first: CombinatorInput, second?: CombinatorCallback): any {\n if (first instanceof Function && second === undefined) {\n const callback = first\n return (effect: AnyEffectInput) => recover(effect, callback)\n }\n\n if (second === undefined) {\n throw new TypeError('Effect.recover requires a callback')\n }\n\n const fn = second\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => recoverResult(asResult(result), fn))\n }\n\n return recoverResult(asResult(first), fn)\n}\n\n/** Recover an Err with an asynchronous Result-producing callback. */\nexport function recoverAsync<Next extends AnyAsyncEffectInput>(\n fn: (error: any) => Next\n): RecoverAsyncOperation<Next>\nexport function recoverAsync<Input, Next extends AnyAsyncEffectInput>(\n effect: Input & AnyEffectInput,\n fn: (error: EffectError<Input>) => Next\n): Promise<RecoveredResult<Input, Next>>\nexport function recoverAsync(first: CombinatorInput, second?: CombinatorCallback): any {\n if (first instanceof Function && second === undefined) {\n const callback = first\n return (effect: AnyEffectInput) => recoverAsync(effect, callback)\n }\n\n if (second === undefined) {\n throw new TypeError('Effect.recoverAsync requires a callback')\n }\n\n const fn = second\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => recoverAsyncResult(asResult(result), fn))\n }\n\n return recoverAsyncResult(asResult(first), fn)\n}\n\n/** Remove one nested Result/Effect layer. */\nexport function flatten<Input>(effect: Input & AnyEffectValue): FlattenedResult<Input> {\n // SAFETY: flattenResult restores the nested Effect channels after Result.flatten removes one runtime layer.\n return flattenResult(asResult(effect)) as FlattenedResult<Input>\n}\n\n/** Replace a successful value while preserving errors and requirements. */\nexport function as<Value>(\n value: Value\n): <Input>(effect: Input & AnyEffectValue) => AsResult<Input, Value>\nexport function as<Input, Value>(\n effect: Input & AnyEffectValue,\n value: Value\n): AsResult<Input, Value>\nexport function as(first: any, second?: any): any {\n if (arguments.length < 2) {\n return (effect: AnyEffectValue) => as(effect, first)\n }\n\n return mapResult(asResult(first), () => second)\n}\n\n/** Replace a successful value with void. */\nexport function asVoid<Input>(effect: Input & AnyEffectValue): AsResult<Input, void> {\n return mapResult(asResult(effect), () => undefined)\n}\n\n/** Match an Effect and return branch Effects with their channels unioned. */\nexport function match<Input, OkResult extends AnyEffectValue, ErrResult extends AnyEffectValue>(\n effect: Input & AnyEffectValue,\n handlers: {\n ok: (value: EffectSuccess<Input>) => OkResult\n err: (error: EffectError<Input>) => ErrResult\n }\n): PreserveAsync<Input, MatchedResult<Input, OkResult, ErrResult>>\nexport function match<Input, OkValue, ErrValue>(\n effect: Input & AnyEffectValue,\n handlers: {\n ok: (value: EffectSuccess<Input>) => OkValue\n err: (error: EffectError<Input>) => ErrValue\n }\n): PreserveAsync<Input, OkValue | ErrValue>\nexport function match(first: AnyEffectInput, second?: any): any {\n if (isPromiseLike(first)) {\n return Promise.resolve(first).then((result) => match(asResult(result), second))\n }\n\n return matchResult(asResult(first), second)\n}\n\n/** Collect already-created Effects in input order. */\nexport function all<const Results extends readonly AnyEffectValue[]>(\n results: Results\n): AllResult<Results> {\n return allResult(results)\n}\n\n/** Combine two already-created Effects in input order. */\nexport function zip<Left, Right>(\n left: Left & AnyEffectValue,\n right: Right & AnyEffectValue\n): ZipResult<Left, Right> {\n // SAFETY: Result.all returns the ordered pair; ZipResult restores only the declaration-only Effect channels.\n return Result.all([left, right]) as ZipResult<Left, Right>\n}\n","import { Result } from 'better-result'\n\nimport type { Result as ResultType } from 'better-result'\n\nimport type { AnyService } from '../service'\nimport { inheritProgramName } from './program-metadata'\nimport { isPromiseLike } from '../utils/runtime'\n\nimport type { EffectError, EffectRequirements, EffectSuccess, Program } from './types'\n\ntype AnyResult = ResultType<any, any>\ntype RuntimeEffect = AnyResult | PromiseLike<AnyResult>\ntype RuntimeProgram = () => RuntimeEffect\ntype RuntimeProgramOutput = RuntimeEffect | RuntimeProgram\ntype RuntimeCallback = (value: any) => any\ntype RuntimeContinuation = (value: any) => RuntimeProgramOutput\ntype AnyProgram = Program<any, any, AnyService>\n\ntype ProgramInput<Input extends RuntimeProgram> = Input &\n Program<EffectSuccess<Input>, EffectError<Input>, EffectRequirements<Input>>\n\ntype CompatibleSuccess<Input, A> = EffectSuccess<Input> extends A ? unknown : never\ntype CompatibleError<Input, E> = EffectError<Input> extends E ? unknown : never\n\ntype ProgramOutput<Output> =\n Output extends Program<infer _Success, infer _Error, infer _Requirements extends AnyService>\n ? Output\n : Output extends PromiseLike<infer AsyncOutput>\n ? AsyncOutput extends ResultType<infer _Success, infer _Error>\n ? Output\n : never\n : Output extends ResultType<infer _Success, infer _Error>\n ? Output\n : never\n\ntype MappedProgram<Input, B> = Program<B, EffectError<Input>, EffectRequirements<Input>>\n\ntype ErrorMappedProgram<Input, E2> = Program<EffectSuccess<Input>, E2, EffectRequirements<Input>>\n\ntype ChainedProgram<Input, Next> = Program<\n EffectSuccess<Next>,\n EffectError<Input> | EffectError<Next>,\n EffectRequirements<Input> | EffectRequirements<Next>\n>\n\ntype TappedProgram<Input> = Program<\n EffectSuccess<Input>,\n EffectError<Input>,\n EffectRequirements<Input>\n>\n\ntype RecoveredProgram<Input, Next> = Program<\n EffectSuccess<Input> | EffectSuccess<Next>,\n EffectError<Next>,\n EffectRequirements<Input> | EffectRequirements<Next>\n>\n\ntype MapOperation<A, B> = {\n <Input extends RuntimeProgram>(\n program: ProgramInput<Input> & CompatibleSuccess<Input, A>\n ): MappedProgram<Input, B>\n}\n\ntype MapErrorOperation<E1, E2> = {\n <Input extends RuntimeProgram>(\n program: ProgramInput<Input> & CompatibleError<Input, E1>\n ): ErrorMappedProgram<Input, E2>\n}\n\ntype AndThenOperation<A, Next> = {\n <Input extends RuntimeProgram>(\n program: ProgramInput<Input> & CompatibleSuccess<Input, A>\n ): ChainedProgram<Input, Next>\n}\n\ntype TapOperation<A> = {\n <Input extends RuntimeProgram>(\n program: ProgramInput<Input> & CompatibleSuccess<Input, A>\n ): TappedProgram<Input>\n}\n\ntype TapErrorOperation<E> = {\n <Input extends RuntimeProgram>(\n program: ProgramInput<Input> & CompatibleError<Input, E>\n ): TappedProgram<Input>\n}\n\ntype RecoverOperation<E, Next> = {\n <Input extends RuntimeProgram>(\n program: ProgramInput<Input> & CompatibleError<Input, E>\n ): RecoveredProgram<Input, Next>\n}\n\nconst asProgram = <Output extends AnyProgram>(program: RuntimeProgram): Output =>\n // SAFETY: Program's channels and nominal marker are declaration-only; callers derive them from typed inputs.\n program as Output\n\nconst isAsyncEffect = (effect: RuntimeEffect): effect is PromiseLike<AnyResult> =>\n isPromiseLike(effect)\n\nconst mapRuntime = (effect: RuntimeEffect, fn: RuntimeCallback): RuntimeEffect => {\n if (isAsyncEffect(effect)) {\n return Promise.resolve(effect).then((result) => Result.map(result, fn))\n }\n\n return Result.map(effect, fn)\n}\n\nconst mapErrorRuntime = (effect: RuntimeEffect, fn: RuntimeCallback): RuntimeEffect => {\n if (isAsyncEffect(effect)) {\n return Promise.resolve(effect).then((result) => Result.mapError(result, fn))\n }\n\n return Result.mapError(effect, fn)\n}\n\nconst tapRuntime = (effect: RuntimeEffect, fn: RuntimeCallback): RuntimeEffect => {\n if (isAsyncEffect(effect)) {\n return Promise.resolve(effect).then((result) => Result.tap(result, fn))\n }\n\n return Result.tap(effect, fn)\n}\n\nconst tapErrorRuntime = (effect: RuntimeEffect, fn: RuntimeCallback): RuntimeEffect => {\n if (isAsyncEffect(effect)) {\n return Promise.resolve(effect).then((result) => Result.tapError(result, fn))\n }\n\n return Result.tapError(effect, fn)\n}\n\nconst invoke = (output: RuntimeProgramOutput): RuntimeEffect =>\n output instanceof Function ? output() : output\n\nconst andThenRuntime = (effect: RuntimeEffect, next: RuntimeContinuation): Promise<AnyResult> => {\n const continueWith = (value: any) => Promise.resolve(invoke(next(value)))\n\n if (isAsyncEffect(effect)) {\n return Promise.resolve(effect).then((result) => Result.andThenAsync(result, continueWith))\n }\n\n return Result.andThenAsync(effect, continueWith)\n}\n\nconst recoverRuntime = (\n effect: RuntimeEffect,\n recover: RuntimeContinuation\n): Promise<AnyResult> => {\n const continueWith = (error: any) => Promise.resolve(invoke(recover(error)))\n\n if (isAsyncEffect(effect)) {\n return Promise.resolve(effect).then((result) => Result.tryRecoverAsync(result, continueWith))\n }\n\n return Result.tryRecoverAsync(effect, continueWith)\n}\n\nconst mapProgram = <Input extends RuntimeProgram, B>(\n program: ProgramInput<Input>,\n fn: (value: EffectSuccess<Input>) => B\n): MappedProgram<Input, B> => {\n const mapped = asProgram<MappedProgram<Input, B>>(() => mapRuntime(program(), fn))\n\n return inheritProgramName(program, mapped)\n}\n\nconst mapErrorProgram = <Input extends RuntimeProgram, E2>(\n program: ProgramInput<Input>,\n fn: (error: EffectError<Input>) => E2\n): ErrorMappedProgram<Input, E2> => {\n const mapped = asProgram<ErrorMappedProgram<Input, E2>>(() => mapErrorRuntime(program(), fn))\n\n return inheritProgramName(program, mapped)\n}\n\nconst tapProgram = <Input extends RuntimeProgram>(\n program: ProgramInput<Input>,\n fn: (value: EffectSuccess<Input>) => any\n): TappedProgram<Input> => {\n const tapped = asProgram<TappedProgram<Input>>(() => tapRuntime(program(), fn))\n\n return inheritProgramName(program, tapped)\n}\n\nconst tapErrorProgram = <Input extends RuntimeProgram>(\n program: ProgramInput<Input>,\n fn: (error: EffectError<Input>) => any\n): TappedProgram<Input> => {\n const tapped = asProgram<TappedProgram<Input>>(() => tapErrorRuntime(program(), fn))\n\n return inheritProgramName(program, tapped)\n}\n\n/** Lazily map the successful Result value of a Program. */\nexport function map<A, B>(fn: (value: A) => B): MapOperation<A, B>\nexport function map<Input extends RuntimeProgram, B>(\n program: ProgramInput<Input>,\n fn: (value: EffectSuccess<Input>) => B\n): MappedProgram<Input, B>\nexport function map(first: RuntimeProgram | RuntimeCallback, second?: RuntimeCallback): any {\n if (second === undefined) {\n return (program: RuntimeProgram) => {\n // SAFETY: The curried overload supplies a Program and a callback that accepts its success channel.\n return mapProgram(program as ProgramInput<typeof program>, first)\n }\n }\n\n // SAFETY: The data-first overload supplies a Program as its first argument.\n return mapProgram(first as ProgramInput<RuntimeProgram>, second)\n}\n\n/** Lazily map the error Result value of a Program. */\nexport function mapError<E1, E2>(fn: (error: E1) => E2): MapErrorOperation<E1, E2>\nexport function mapError<Input extends RuntimeProgram, E2>(\n program: ProgramInput<Input>,\n fn: (error: EffectError<Input>) => E2\n): ErrorMappedProgram<Input, E2>\nexport function mapError(first: RuntimeProgram | RuntimeCallback, second?: RuntimeCallback): any {\n if (second === undefined) {\n return (program: RuntimeProgram) => {\n // SAFETY: The curried overload supplies a Program and a callback that accepts its error channel.\n return mapErrorProgram(program as ProgramInput<typeof program>, first)\n }\n }\n\n // SAFETY: The data-first overload supplies a Program as its first argument.\n return mapErrorProgram(first as ProgramInput<RuntimeProgram>, second)\n}\n\n/** Lazily continue a successful Program with an Effect or Program. */\nexport function andThen<A, Next>(\n next: (value: A) => Next & ProgramOutput<Next>\n): AndThenOperation<A, Next>\nexport function andThen<Input extends RuntimeProgram, Next>(\n program: ProgramInput<Input>,\n next: (value: EffectSuccess<Input>) => Next & ProgramOutput<Next>\n): ChainedProgram<Input, Next>\nexport function andThen(\n first: RuntimeProgram | RuntimeContinuation,\n second?: RuntimeContinuation\n): any {\n if (second === undefined) {\n return (program: RuntimeProgram) => {\n // SAFETY: The curried overload supplies a Program and a continuation for its success channel.\n const chained = () => andThenRuntime(program(), first as RuntimeContinuation)\n\n return inheritProgramName(program, chained)\n }\n }\n\n // SAFETY: The data-first overload supplies a Program as its first argument.\n const source = first as RuntimeProgram\n const chained = () => andThenRuntime(source(), second)\n\n return inheritProgramName(source, chained)\n}\n\n/** Lazily observe a successful Program value without changing its Result. */\nexport function tap<A>(fn: (value: A) => void): TapOperation<A>\nexport function tap<Input extends RuntimeProgram>(\n program: ProgramInput<Input>,\n fn: (value: EffectSuccess<Input>) => void\n): TappedProgram<Input>\nexport function tap(first: RuntimeProgram | RuntimeCallback, second?: RuntimeCallback): any {\n if (second === undefined) {\n return (program: RuntimeProgram) => {\n // SAFETY: The curried overload supplies a Program and a callback that accepts its success channel.\n return tapProgram(program as ProgramInput<typeof program>, first)\n }\n }\n\n // SAFETY: The data-first overload supplies a Program as its first argument.\n return tapProgram(first as ProgramInput<RuntimeProgram>, second)\n}\n\n/** Lazily observe a failed Program value without changing its Result. */\nexport function tapError<E>(fn: (error: E) => void): TapErrorOperation<E>\nexport function tapError<Input extends RuntimeProgram>(\n program: ProgramInput<Input>,\n fn: (error: EffectError<Input>) => void\n): TappedProgram<Input>\nexport function tapError(first: RuntimeProgram | RuntimeCallback, second?: RuntimeCallback): any {\n if (second === undefined) {\n return (program: RuntimeProgram) => {\n // SAFETY: The curried overload supplies a Program and a callback that accepts its error channel.\n return tapErrorProgram(program as ProgramInput<typeof program>, first)\n }\n }\n\n // SAFETY: The data-first overload supplies a Program as its first argument.\n return tapErrorProgram(first as ProgramInput<RuntimeProgram>, second)\n}\n\n/** Lazily recover a failed Program with an Effect or Program. */\nexport function recover<E, Next>(\n fn: (error: E) => Next & ProgramOutput<Next>\n): RecoverOperation<E, Next>\nexport function recover<Input extends RuntimeProgram, Next>(\n program: ProgramInput<Input>,\n recover: (error: EffectError<Input>) => Next & ProgramOutput<Next>\n): RecoveredProgram<Input, Next>\nexport function recover(\n first: RuntimeProgram | RuntimeContinuation,\n second?: RuntimeContinuation\n): any {\n if (second === undefined) {\n return (program: RuntimeProgram) => {\n // SAFETY: The curried overload supplies a Program and a recovery callback for its error channel.\n const recovered = () => recoverRuntime(program(), first as RuntimeContinuation)\n\n return inheritProgramName(program, recovered)\n }\n }\n\n // SAFETY: The data-first overload supplies a Program as its first argument.\n const source = first as RuntimeProgram\n const recovered = () => recoverRuntime(source(), second)\n\n return inheritProgramName(source, recovered)\n}\n","import { Err } from 'better-result'\n\nimport type { Result as ResultType } from 'better-result'\n\ntype AnyResult = ResultType<any, any>\n\ntype ProgramCollectionFailure =\n | { readonly kind: 'result'; readonly result: AnyResult }\n | { readonly kind: 'defect'; readonly cause: unknown }\n\ntype ProgramCollectionDefect = { readonly cause: unknown }\n\ntype ProgramCollectionOutcome = {\n readonly results: Array<AnyResult | undefined>\n readonly defects: Array<ProgramCollectionDefect | undefined>\n}\n\nexport type ProgramCollectionOptions = {\n readonly concurrency: number | undefined\n readonly stopOnResultError: boolean\n}\n\ntype ProgramTask = (index: number) => AnyResult | PromiseLike<AnyResult>\n\ntype SchedulerState = {\n nextIndex: number\n stopScheduling: boolean\n readonly results: Array<AnyResult | undefined>\n readonly defects: Array<ProgramCollectionDefect | undefined>\n}\n\n/** Validate the shared bounded-concurrency option before a Program is run. */\nexport const validateProgramConcurrency = (concurrency: number | undefined): void => {\n if (\n concurrency !== undefined &&\n (!Number.isFinite(concurrency) || !Number.isInteger(concurrency) || concurrency <= 0)\n ) {\n throw new RangeError('Program.all concurrency must be a positive integer')\n }\n}\n\nconst runWorker = async (\n length: number,\n task: ProgramTask,\n stopOnResultError: boolean,\n state: SchedulerState\n): Promise<void> => {\n while (!state.stopScheduling) {\n const index = state.nextIndex++\n\n if (index >= length) {\n return\n }\n\n try {\n const result = await task(index)\n state.results[index] = result\n\n if (result instanceof Err) {\n state.stopScheduling ||= stopOnResultError\n }\n } catch (cause) {\n state.defects[index] = { cause }\n state.stopScheduling = true\n }\n }\n}\n\n/** Run claimed Programs with a shared FIFO worker pool and no cancellation. */\nexport const runProgramCollection = async (\n length: number,\n task: ProgramTask,\n options: ProgramCollectionOptions\n): Promise<ProgramCollectionOutcome> => {\n const state: SchedulerState = {\n nextIndex: 0,\n stopScheduling: false,\n results: Array.from({ length }),\n defects: Array.from({ length })\n }\n const workerCount = Math.min(options.concurrency ?? length, length)\n const workers = Array.from({ length: workerCount }, () =>\n runWorker(length, task, options.stopOnResultError, state)\n )\n\n await Promise.all(workers)\n\n return state\n}\n\n/** Select the first defect by input index, independent of settlement order. */\nexport const firstProgramDefect = (\n defects: readonly (ProgramCollectionDefect | undefined)[]\n): ProgramCollectionDefect | undefined => {\n for (const defect of defects) {\n if (defect !== undefined) {\n return defect\n }\n }\n\n return undefined\n}\n\n/** Select the first short-circuiting failure by input index. */\nexport const firstProgramFailure = (\n results: readonly (AnyResult | undefined)[],\n defects: readonly (ProgramCollectionDefect | undefined)[]\n): ProgramCollectionFailure | undefined => {\n const length = Math.max(results.length, defects.length)\n\n for (let index = 0; index < length; index++) {\n const defect = defects[index]\n if (defect !== undefined) {\n return { kind: 'defect', cause: defect.cause }\n }\n\n const result = results[index]\n if (result instanceof Err) {\n return { kind: 'result', result }\n }\n }\n\n return undefined\n}\n","import { Result } from 'better-result'\n\nimport type { Err, Result as ResultType, UnhandledException } from 'better-result'\n\nimport { Scope } from '../scope'\n\nimport type { DisposableResource, MaybePromise, ScopeOutcome } from '../scope'\n\nimport { setProgramName } from './program-metadata'\nimport type { AnyService } from '../service'\n\nimport type {\n AnyEffect,\n Effect as EffectType,\n EffectError,\n EffectFromGenerator,\n EffectRequirements,\n EffectSuccess,\n EffectYield,\n Program as ProgramType,\n ProgramFromGenerator\n} from './types'\n\nimport {\n all,\n andThen,\n andThenAsync,\n as,\n asVoid,\n flatten,\n map,\n mapError,\n match,\n matchError,\n matchErrorPartial,\n recover,\n recoverAsync,\n tap,\n tapAsync,\n tapBoth,\n tapBothAsync,\n tapError,\n tapErrorAsync,\n zip\n} from './combinators'\nimport {\n andThen as programAndThen,\n map as programMap,\n mapError as programMapError,\n recover as programRecover,\n tap as programTap,\n tapError as programTapError\n} from './program-combinators'\nimport {\n firstProgramDefect,\n firstProgramFailure,\n runProgramCollection,\n validateProgramConcurrency\n} from './program-scheduler'\n\nexport type Effect<A, E, R extends AnyService = never> = EffectType<A, E, R>\n\ntype LazyProgram<A, E, R extends AnyService = never> = ProgramType<A, E, R>\n\n/** A nominal lazy computation that produces an Effect when invoked. */\nexport type Program<A, E, R extends AnyService = never> = LazyProgram<A, E, R>\n\ntype AnyResult = ResultType<any, any>\n\ntype AnyProgram = ProgramType<any, any, AnyService>\n\ntype ProgramAllSuccess<Programs extends readonly AnyProgram[]> = {\n -readonly [Index in keyof Programs]: EffectSuccess<Programs[Index]>\n}\n\ntype ProgramAllError<Programs extends readonly AnyProgram[]> = EffectError<Programs[number]>\n\ntype ProgramAllRequirements<Programs extends readonly AnyProgram[]> = EffectRequirements<\n Programs[number]\n>\n\ntype ProgramAllResult<Programs extends readonly AnyProgram[]> = ProgramType<\n ProgramAllSuccess<Programs>,\n ProgramAllError<Programs>,\n ProgramAllRequirements<Programs>\n>\n\ntype ProgramResultFor<Child> = Child extends AnyProgram\n ? ResultType<EffectSuccess<Child>, EffectError<Child>>\n : never\n\ntype ProgramAllResultsSuccess<Programs extends readonly AnyProgram[]> =\n number extends Programs['length']\n ? ReadonlyArray<ResultType<EffectSuccess<Programs[number]>, EffectError<Programs[number]>>>\n : { readonly [Index in keyof Programs]: ProgramResultFor<Programs[Index]> }\n\ntype ProgramAllResultsResult<Programs extends readonly AnyProgram[]> = ProgramType<\n ProgramAllResultsSuccess<Programs>,\n never,\n ProgramAllRequirements<Programs>\n>\n\ntype ProgramForEachResult<Child extends AnyProgram> = ProgramType<\n ReadonlyArray<EffectSuccess<Child>>,\n EffectError<Child>,\n EffectRequirements<Child>\n>\n\nexport type ProgramAllOptions = {\n readonly concurrency?: number\n /** Optional diagnostic name for the collection execution. */\n readonly name?: string\n}\n\ntype EffectGenerator =\n | (() => Generator<EffectYield, AnyResult, unknown>)\n | (() => AsyncGenerator<EffectYield, AnyResult, unknown>)\n\ntype RuntimeResultGenerator = (body: EffectGenerator) => AnyResult | Promise<AnyResult>\n\n// SAFETY: Service iterators yield no runtime markers, so Result.gen receives only the Err values that exist at runtime.\nconst runResultGenerator = Result.gen as RuntimeResultGenerator\n\n/**\n * Compose `better-result` operations while preserving Service requirements in\n * a declaration-only type channel.\n *\n * A generator may yield Service tokens and Result operations. It must return a\n * `Result` as its final value; Service yields are resolved by the active\n * Runtime and do not add runtime values to the Result stream.\n * Use `fn` when generator execution should wait for a Runtime boundary.\n *\n * @example\n * ```ts\n * const loadUser = Effect.gen(async function* () {\n * const database = yield* Database\n * const user = yield* Result.await(database.findUser('u1'))\n *\n * return Result.ok(user)\n * })\n * ```\n */\nexport function gen<Yield extends EffectYield, Returned extends AnyResult>(\n body: () => Generator<Yield, Returned, unknown>\n): EffectFromGenerator<Yield, Returned>\n\nexport function gen<Yield extends EffectYield, Returned extends AnyResult>(\n body: () => AsyncGenerator<Yield, Returned, unknown>\n): Promise<EffectFromGenerator<Yield, Returned>>\n\nexport function gen(body: EffectGenerator): AnyResult | Promise<AnyResult> {\n return runResultGenerator(body)\n}\n\n/** Build a lazy Program without running its generator. */\nexport function fn<Yield extends EffectYield, Returned extends AnyResult>(\n body: () => Generator<Yield, Returned, unknown>\n): ProgramFromGenerator<Yield, Returned>\n\nexport function fn<Yield extends EffectYield, Returned extends AnyResult>(\n body: () => AsyncGenerator<Yield, Returned, unknown>\n): ProgramFromGenerator<Yield, Returned>\n\nexport function fn(body: EffectGenerator): Program<any, any, AnyService> {\n const program = () => runResultGenerator(body)\n\n // SAFETY: The generator overloads derive the Program channels; this cast only adds the declaration-only nominal marker.\n return program as Program<any, any, AnyService>\n}\n\ntype ProgramNamedOperation = {\n <Input extends AnyProgram>(program: Input): Input\n}\n\nconst validateProgramName = (name: string): void => {\n // oxlint-disable-next-line anti-slop/no-runtime-typeof -- validate JavaScript callers at the public boundary.\n if (typeof name !== 'string') {\n throw new TypeError('Program name must be a string')\n }\n}\n\n/** Attach a lazy diagnostic name to a Program without invoking it. */\nfunction programNamed(name: string): ProgramNamedOperation\nfunction programNamed<Input extends AnyProgram>(name: string, program: Input): Input\nfunction programNamed(name: string, program?: AnyProgram): AnyProgram | ProgramNamedOperation {\n validateProgramName(name)\n\n if (program === undefined) {\n return (source) => setProgramName(source, name)\n }\n\n return setProgramName(program, name)\n}\n\nconst runShortCircuitingCollection = async (\n length: number,\n task: (index: number) => AnyResult | PromiseLike<AnyResult>,\n concurrency: number | undefined\n): Promise<AnyResult> => {\n const outcome = await runProgramCollection(length, task, {\n concurrency,\n stopOnResultError: true\n })\n const failure = firstProgramFailure(outcome.results, outcome.defects)\n\n if (failure?.kind === 'defect') {\n throw failure.cause\n }\n\n if (failure?.kind === 'result') {\n return failure.result\n }\n\n // SAFETY: The scheduler records one Result per claimed index before completing successfully.\n return Result.all(outcome.results as AnyResult[])\n}\n\nconst runAllResultsCollection = async (\n length: number,\n task: (index: number) => AnyResult | PromiseLike<AnyResult>,\n concurrency: number | undefined\n): Promise<AnyResult> => {\n const outcome = await runProgramCollection(length, task, {\n concurrency,\n stopOnResultError: false\n })\n const defect = firstProgramDefect(outcome.defects)\n\n if (defect !== undefined) {\n throw defect.cause\n }\n\n // SAFETY: The scheduler records each Result object at its input index.\n return Result.ok(outcome.results as AnyResult[])\n}\n\n/** Build a lazy Program collection with optional bounded concurrency. */\nexport function programAll<const Programs extends readonly AnyProgram[]>(\n programs: Programs,\n options: ProgramAllOptions = {}\n): ProgramAllResult<Programs> {\n const concurrency = options.concurrency\n const name = options?.name\n validateProgramConcurrency(concurrency)\n const program = () =>\n runShortCircuitingCollection(programs.length, (index) => programs[index]!(), concurrency)\n\n if (name !== undefined) {\n validateProgramName(name)\n setProgramName(program, name)\n }\n\n // SAFETY: Program channels are declaration-only and are restored from the input tuple here.\n return program as ProgramAllResult<Programs>\n}\n\n/** Build a lazy Program collection from an input array and Program factory. */\nexport function programForEach<const Items extends readonly unknown[], Child extends AnyProgram>(\n items: Items,\n makeProgram: (item: Items[number], index: number) => Child,\n options: ProgramAllOptions = {}\n): ProgramForEachResult<Child> {\n const concurrency = options.concurrency\n const name = options?.name\n validateProgramConcurrency(concurrency)\n const program = () =>\n runShortCircuitingCollection(\n items.length,\n (index) => makeProgram(items[index]!, index)(),\n concurrency\n )\n\n if (name !== undefined) {\n validateProgramName(name)\n setProgramName(program, name)\n }\n\n // SAFETY: Program channels are declaration-only and are restored from the factory's result type.\n return program as ProgramForEachResult<Child>\n}\n\n/** Build a lazy Program collection that retains every child Result. */\nexport function programAllResults<const Programs extends readonly AnyProgram[]>(\n programs: Programs,\n options: ProgramAllOptions = {}\n): ProgramAllResultsResult<Programs> {\n const concurrency = options.concurrency\n const name = options?.name\n validateProgramConcurrency(concurrency)\n const program = () =>\n runAllResultsCollection(programs.length, (index) => programs[index]!(), concurrency)\n\n if (name !== undefined) {\n validateProgramName(name)\n setProgramName(program, name)\n }\n\n // SAFETY: Program channels are declaration-only and are restored from the input tuple here.\n return program as ProgramAllResultsResult<Programs>\n}\n\n/** Value-level namespace for lazy Program combinators. */\nexport const Program = {\n named: programNamed,\n all: programAll,\n forEach: programForEach,\n allResults: programAllResults,\n map: programMap,\n mapError: programMapError,\n andThen: programAndThen,\n tap: programTap,\n tapError: programTapError,\n recover: programRecover\n} as const\n\n/**\n * Acquire a resource in the current Scope and register its release callback.\n *\n * Acquisition failures are represented in the Effect Result error channel;\n * release failures remain owned by Scope cleanup. The release callback\n * receives the final outcome chosen by the enclosing execution boundary.\n *\n * @example\n * ```ts\n * const connection = yield* Effect.acquireRelease(\n * () => pool.connect(),\n * (connection, outcome) => connection.close(outcome)\n * )\n * ```\n */\nexport function acquireRelease<R>(\n acquire: () => MaybePromise<R>,\n release: (resource: R, outcome: ScopeOutcome) => MaybePromise<void>\n): AsyncGenerator<Err<never, UnhandledException>, R, unknown> {\n const scope = Scope.current()\n\n return Result.await(Result.tryPromise(() => scope.acquire(acquire, release)))\n}\n\nclass AcquireReleaseResultFailure<R, E> {\n constructor(readonly result: Err<R, E>) {}\n}\n\n/**\n * Acquire a Result-valued resource and register only successful acquisitions.\n *\n * Typed acquisition failures remain unchanged in the Effect error channel;\n * unexpected acquisition and registration failures are normalized by\n * `better-result`. Release failures remain Scope cleanup failures.\n */\nexport function acquireReleaseResult<R, E>(\n acquire: () => MaybePromise<ResultType<R, E>>,\n release: (resource: R, outcome: ScopeOutcome) => MaybePromise<void>\n): AsyncGenerator<Err<never, E | UnhandledException>, R, unknown> {\n const scope = Scope.current()\n const registered = Result.tryPromise(async (): Promise<ResultType<R, E>> => {\n try {\n const resource = await scope.acquire(async () => {\n const result = await acquire()\n\n if (Result.isError(result)) {\n throw new AcquireReleaseResultFailure(result)\n }\n\n return result.value\n }, release)\n\n return Result.ok(resource)\n } catch (cause) {\n if (cause instanceof AcquireReleaseResultFailure) {\n return cause.result\n }\n\n throw cause\n }\n })\n\n return Result.await(registered.then((result) => result.andThen((acquired) => acquired)))\n}\n\n/**\n * Lazily acquire and register a disposable resource in the current Scope.\n *\n * Disposal is delegated to `Scope.add`, including protocol preference,\n * validation, race-safe registration, and cleanup error handling.\n */\nexport function acquireDisposable<R extends DisposableResource>(\n acquire: () => MaybePromise<R>\n): AsyncGenerator<Err<never, UnhandledException>, R, unknown> {\n const scope = Scope.current()\n\n return Result.await(Result.tryPromise(async () => scope.add(await acquire())))\n}\n\n/**\n * Register an already-acquired disposable resource in the current Scope.\n *\n * The resource is not acquired by this helper. Registration failures are\n * represented in the Effect Result error channel; disposal failures remain\n * owned by Scope cleanup.\n *\n * @example\n * ```ts\n * const file = yield* Effect.add(await openFile('notes.txt'))\n * ```\n */\nexport function add<R extends DisposableResource>(\n resource: R\n): AsyncGenerator<Err<never, UnhandledException>, R, unknown> {\n const scope = Scope.current()\n\n return Result.await(Result.tryPromise(() => scope.add(resource)))\n}\n\n/**\n * Effect namespace containing generator, resource, and Result combinators.\n *\n * Prefer these helpers when a program needs typed Service requirements or\n * Scope-aware acquisition and cleanup.\n */\ntype EffectNamespace = {\n readonly gen: typeof gen\n readonly fn: typeof fn\n readonly acquireRelease: typeof acquireRelease\n readonly acquireReleaseResult: typeof acquireReleaseResult\n readonly acquireDisposable: typeof acquireDisposable\n readonly add: typeof add\n readonly map: typeof map\n readonly mapError: typeof mapError\n readonly andThen: typeof andThen\n readonly andThenAsync: typeof andThenAsync\n readonly tap: typeof tap\n readonly tapAsync: typeof tapAsync\n readonly tapError: typeof tapError\n readonly tapErrorAsync: typeof tapErrorAsync\n readonly tapBoth: typeof tapBoth\n readonly tapBothAsync: typeof tapBothAsync\n readonly matchError: typeof matchError\n readonly matchErrorPartial: typeof matchErrorPartial\n readonly recover: typeof recover\n readonly recoverAsync: typeof recoverAsync\n readonly flatten: typeof flatten\n readonly as: typeof as\n readonly asVoid: typeof asVoid\n readonly match: typeof match\n readonly all: typeof all\n readonly zip: typeof zip\n}\n\nexport const Effect: EffectNamespace = {\n /** Compose a generator-based Effect program. */\n gen,\n /** Build a lazy Program from a generator. */\n fn,\n /** Acquire and register a resource in the current Scope. */\n acquireRelease,\n /** Acquire a Result-valued resource and register successful acquisitions. */\n acquireReleaseResult,\n /** Acquire and register a disposable resource in the current Scope. */\n acquireDisposable,\n /** Register an already-acquired disposable in the current Scope. */\n add,\n /** Map a successful Effect result. */\n map,\n /** Map an Effect error. */\n mapError,\n /** Chain a synchronous Effect result. */\n andThen,\n /** Chain an asynchronous Effect result. */\n andThenAsync,\n /** Observe successful values without changing the Result. */\n tap,\n /** Observe successful values asynchronously without changing the Result. */\n tapAsync,\n /** Observe error values without changing the Result. */\n tapError,\n /** Observe error values asynchronously without changing the Result. */\n tapErrorAsync,\n /** Observe the active Result branch without changing the Result. */\n tapBoth,\n /** Observe the active Result branch asynchronously without changing the Result. */\n tapBothAsync,\n /** Match every tagged error variant and map it to a new error value. */\n matchError,\n /** Match selected tagged errors and retain unhandled variants. */\n matchErrorPartial,\n /** Recover an error with another Effect. */\n recover,\n /** Recover an error asynchronously with another Effect. */\n recoverAsync,\n /** Remove one nested Effect layer. */\n flatten,\n /** Replace a successful value. */\n as,\n /** Replace a successful value with void. */\n asVoid,\n /** Match either Result branch. */\n match,\n /** Collect Effects in input order. */\n all,\n /** Zip two Effects in input order. */\n zip\n} as const\n\n/** Type-level aliases for inspecting Effect result channels and requirements. */\nexport declare namespace Effect {\n /** A nominal lazy computation that produces an Effect when invoked. */\n export type Program<A, E, R extends AnyService = never> = LazyProgram<A, E, R>\n\n /** Extract the success channel from an Effect result or Promise. */\n export type Success<T> = EffectSuccess<T>\n\n /** Extract the error channel from an Effect result or Promise. */\n export type Error<T> = EffectError<T>\n\n /** Extract the Service requirements from an Effect result or Promise. */\n export type Requirements<T> = EffectRequirements<T>\n\n /** An Effect with erased success, error, and requirements. */\n export type Any = AnyEffect\n}\n"],"mappings":";;;;AAwLA,MAAM,YAAmB,UAAuC;CAE9D,OAAO;AACT;AAEA,MAAM,aACJ,QACA,OAC+B;CAE/B,OAAO,OAAO,IAAI,QAAQ,EAAE;AAC9B;AAEA,MAAM,kBACJ,QACA,OACgC;CAEhC,OAAO,OAAO,SAAS,QAAQ,EAAE;AACnC;AAEA,MAAM,iBAQJ,QACA,SACsD;CAEtD,MAAM,aAAa;CAGnB,OAAO,OAAO,QAAQ,QAAQ,UAAU;AAC1C;AAEA,MAAM,sBAQJ,QACA,SAC+D;CAE/D,MAAM,cAAc,UAAa;EAE/B,OAAO,QAAQ,QAAQ,KAAK,KAAK,CAAC;CACpC;CAGA,OAAO,OAAO,aAAa,QAAQ,UAAU;AAG/C;AAmBA,SAAgBA,MAAI,OAAwB,QAAkC;CAC5E,IAAI,iBAAiB,YAAY,WAAW,KAAA,GAAW;EAErD,MAAM,WAAW;EAEjB,QAAQ,WAA2B;GAEjC,OAAOA,MAAI,QAAiB,QAAiB;EAC/C;CACF;CAGA,MAAM,KAAK;CAEX,IAAI,cAAc,KAAK,GACrB,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,MAAM,WAAW;EAE7C,OAAO,UAAU,QAAgC,EAAE;CACrD,CAAC;CAIH,OAAO,UAAU,OAA+B,EAAE;AACpD;AAgBA,SAAgBC,WAAS,OAAwB,QAAkC;CACjF,IAAI,iBAAiB,YAAY,WAAW,KAAA,GAAW;EAErD,MAAM,WAAW;EAEjB,QAAQ,WAA2B;GAEjC,OAAOA,WAAS,QAAiB,QAAiB;EACpD;CACF;CAGA,MAAM,KAAK;CAEX,IAAI,cAAc,KAAK,GACrB,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,MAAM,WAAW;EAE7C,OAAO,eAAe,QAA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ectSuccess, M as AnyService, k as Program } from "./index-heuaRmXR.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { A as MissingServices, D as LayerInput, E as ExecutionMissing, F as ValidateOneOverride, M as ProvidedEnvironment, N as RequiredEnvironment, P as ValidateLayerInput, z as MissingDependencies } from "./outcome-CB43bnFW.mjs";
|
|
3
|
+
import { l as Runtime } from "./index-GYJ4qm9K.mjs";
|
|
4
|
+
import { s as CurrentRequest } from "./index-B1nH4luq.mjs";
|
|
5
5
|
import { Result } from "better-result";
|
|
6
6
|
import { Context, Env, Handler, HonoRequest, Input, MiddlewareHandler } from "hono";
|
|
7
7
|
//#region src/hono/types.d.ts
|
package/dist/hono.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Effect } from "./effect-
|
|
3
|
-
import { a as CurrentRequest } from "./standard-services-
|
|
1
|
+
import { t as Layer } from "./layer-D56fRdLt.mjs";
|
|
2
|
+
import { t as Effect } from "./effect-CK4YZaX0.mjs";
|
|
3
|
+
import { a as CurrentRequest } from "./standard-services-GBZ32tll.mjs";
|
|
4
4
|
import { Result } from "better-result";
|
|
5
5
|
import { createMiddleware } from "hono/factory";
|
|
6
6
|
//#region src/hono/request-boundary.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { H as ServiceToken, I as ServiceIdentity, b as Service, j as ServiceRequirement } from "./index-heuaRmXR.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import "./index-
|
|
2
|
+
import { R as ProviderEntry, k as LayerResult } from "./outcome-CB43bnFW.mjs";
|
|
3
|
+
import "./index-GYJ4qm9K.mjs";
|
|
4
4
|
import { Err, StandardSchemaV1, UnhandledException } from "better-result";
|
|
5
5
|
//#region src/standard-services/config.d.ts
|
|
6
6
|
/** Raw string values supplied to a configuration schema. */
|
|
@@ -67,7 +67,59 @@ declare class Config extends Config_base {
|
|
|
67
67
|
/** The default lazy host-environment Config provider. */
|
|
68
68
|
declare const ConfigLive: LayerResult<ProviderEntry<Config, never>>;
|
|
69
69
|
//#endregion
|
|
70
|
+
//#region src/standard-services/id-generator.d.ts
|
|
71
|
+
/** Thrown when the host does not expose the supported Web Crypto UUID API. */
|
|
72
|
+
declare class IdGeneratorUnavailableError extends Error {
|
|
73
|
+
constructor();
|
|
74
|
+
}
|
|
75
|
+
/** Thrown when an {@link IdGeneratorTest} queue has no IDs left. */
|
|
76
|
+
declare class IdGeneratorExhaustedError extends Error {
|
|
77
|
+
readonly generated: number;
|
|
78
|
+
constructor(generated: number);
|
|
79
|
+
}
|
|
80
|
+
declare const IdGenerator_base: (abstract new () => ServiceIdentity<"IdGenerator">) & {
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly serviceTag: "IdGenerator";
|
|
83
|
+
} & {
|
|
84
|
+
readonly of: Service.FactoryOf<IdGenerator, "IdGenerator">;
|
|
85
|
+
readonly [Symbol.asyncIterator]: (this: ServiceToken<"IdGenerator", IdGenerator & ServiceIdentity<"IdGenerator">>) => AsyncGenerator<ServiceRequirement<IdGenerator>, IdGenerator, unknown>;
|
|
86
|
+
};
|
|
87
|
+
/** Host-backed UUID string ID service. */
|
|
88
|
+
declare class IdGenerator extends IdGenerator_base {
|
|
89
|
+
/** Generate a cryptographically strong UUID string using the host Web Crypto API. */
|
|
90
|
+
next(): string;
|
|
91
|
+
}
|
|
92
|
+
/** The default host IdGenerator provider. */
|
|
93
|
+
declare const IdGeneratorLive: LayerResult<ProviderEntry<IdGenerator, never>>;
|
|
94
|
+
type IdFactory = (index: number) => string;
|
|
95
|
+
/** Deterministic queue- or factory-backed IdGenerator implementation for tests. */
|
|
96
|
+
declare class IdGeneratorTest implements Service.Contract<IdGenerator> {
|
|
97
|
+
private readonly queue;
|
|
98
|
+
private factory;
|
|
99
|
+
private generatedCount;
|
|
100
|
+
constructor(ids?: readonly string[]);
|
|
101
|
+
/** Number of IDs successfully returned by this test generator. */
|
|
102
|
+
get generated(): number;
|
|
103
|
+
/** Number of queued IDs still available, or Infinity for a factory. */
|
|
104
|
+
get remaining(): number;
|
|
105
|
+
/** Return the next queued or factory-generated string ID. */
|
|
106
|
+
next(): string;
|
|
107
|
+
/**
|
|
108
|
+
* Create a factory-backed generator. The factory receives a monotonic
|
|
109
|
+
* zero-based index: the first call receives 0, then 1, and so on.
|
|
110
|
+
*/
|
|
111
|
+
static from(factory: IdFactory): IdGeneratorTest;
|
|
112
|
+
/** Create a Layer for this generator, allocating a fresh empty queue by default. */
|
|
113
|
+
static layer(generator?: IdGeneratorTest): LayerResult<ProviderEntry<IdGenerator, never>>;
|
|
114
|
+
}
|
|
115
|
+
/** Compatible functional shorthand for {@link IdGeneratorTest.layer}. */
|
|
116
|
+
declare const IdGeneratorTestLayer: (generator?: IdGeneratorTest) => LayerResult<ProviderEntry<IdGenerator, never>>;
|
|
117
|
+
//#endregion
|
|
70
118
|
//#region src/standard-services/index.d.ts
|
|
119
|
+
/** Optional cooperative cancellation for a host or test Clock sleep. */
|
|
120
|
+
type ClockSleepOptions = {
|
|
121
|
+
readonly signal?: AbortSignal;
|
|
122
|
+
};
|
|
71
123
|
declare const Clock_base: (abstract new () => ServiceIdentity<"Clock">) & {
|
|
72
124
|
readonly name: string;
|
|
73
125
|
readonly serviceTag: "Clock";
|
|
@@ -78,21 +130,36 @@ declare const Clock_base: (abstract new () => ServiceIdentity<"Clock">) & {
|
|
|
78
130
|
/** Host-backed time and waiting service. */
|
|
79
131
|
declare class Clock extends Clock_base {
|
|
80
132
|
now(): Date;
|
|
81
|
-
|
|
133
|
+
/** Rejects with the signal reason, or an AbortError-compatible fallback. */
|
|
134
|
+
sleep(milliseconds: number, options?: ClockSleepOptions): Promise<void>;
|
|
82
135
|
}
|
|
83
136
|
/** The default host Clock provider. */
|
|
84
137
|
declare const ClockLive: LayerResult<ProviderEntry<Clock, never>>;
|
|
138
|
+
/** Limits deadline advances performed by `ClockTest.runAll`. */
|
|
139
|
+
type ClockTestRunAllOptions = {
|
|
140
|
+
readonly maxSteps?: number;
|
|
141
|
+
};
|
|
85
142
|
/** Deterministic Clock implementation for tests. */
|
|
86
143
|
declare class ClockTest implements Service.Contract<Clock> {
|
|
87
144
|
private currentTime;
|
|
88
145
|
private readonly waiters;
|
|
89
146
|
constructor(initial?: Date | number);
|
|
147
|
+
/** Number of sleeps that have not been settled or cancelled. */
|
|
148
|
+
get pendingSleeps(): number;
|
|
90
149
|
now(): Date;
|
|
150
|
+
/** Set an absolute time; moving backward leaves existing absolute deadlines unchanged. */
|
|
91
151
|
setTime(value: Date | number): void;
|
|
92
152
|
advance(milliseconds: number): void;
|
|
93
|
-
sleep(milliseconds: number): Promise<void>;
|
|
153
|
+
sleep(milliseconds: number, options?: ClockSleepOptions): Promise<void>;
|
|
154
|
+
/** Advance synchronously; due Promise continuations run after this method returns. */
|
|
155
|
+
advanceToNext(): boolean;
|
|
156
|
+
/** Advance all pending deadlines, guarding at 1,000 steps by default. */
|
|
157
|
+
runAll(options?: ClockTestRunAllOptions): Promise<number>;
|
|
94
158
|
static layer(initial?: Date | number): LayerResult<ProviderEntry<Clock, never>>;
|
|
159
|
+
private enqueueWaiter;
|
|
160
|
+
private cancelWaiter;
|
|
95
161
|
private flushWaiters;
|
|
162
|
+
private finishWaiter;
|
|
96
163
|
}
|
|
97
164
|
declare const ClockTestLayer: (initial?: Date | number) => LayerResult<ProviderEntry<Clock, never>>;
|
|
98
165
|
declare const Random_base: (abstract new () => ServiceIdentity<"Random">) & {
|
|
@@ -178,5 +245,5 @@ declare class CurrentRequest extends CurrentRequest_base {
|
|
|
178
245
|
}
|
|
179
246
|
declare const CurrentRequestLayer: (value: unknown) => LayerResult<ProviderEntry<CurrentRequest, never>>;
|
|
180
247
|
//#endregion
|
|
181
|
-
export {
|
|
182
|
-
//# sourceMappingURL=index-
|
|
248
|
+
export { ConfigIssue as A, IdGeneratorTest as C, ConfigError as D, Config as E, ConfigSourceOptions as F, ConfigValidationError as I, ConfigValue as L, ConfigOutput as M, ConfigSource as N, ConfigFromEnvOptions as O, ConfigSourceError as P, StandardSchemaV1 as R, IdGeneratorLive as S, IdGeneratorUnavailableError as T, RandomLive as _, ClockTestLayer as a, IdGenerator as b, CurrentRequestLayer as c, LoggerEvent as d, LoggerLevel as f, Random as g, LoggerTestLayer as h, ClockTest as i, ConfigLive as j, ConfigInput as k, Logger as l, LoggerTest as m, ClockLive as n, ClockTestRunAllOptions as o, LoggerLive as p, ClockSleepOptions as r, CurrentRequest as s, Clock as t, LoggerData as u, RandomSeeded as v, IdGeneratorTestLayer as w, IdGeneratorExhaustedError as x, RandomSeededLayer as y };
|
|
249
|
+
//# sourceMappingURL=index-B1nH4luq.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-B1nH4luq.d.mts","names":[],"sources":["../src/standard-services/config.ts","../src/standard-services/id-generator.ts","../src/standard-services/index.ts"],"mappings":";;;;;;KAcY,eAAe,SAAS;;KAGxB;WACD;WACA,YAAY;;;KAIX,qBAAqB,eAAe,oBAAoB;WACzD,QAAQ;;;KAIP,aAAa,eAAe,oBAAoB,iBAAiB,YAAY;;KAG7E,YAAY,eAAe,oBAAoB,iBAAiB,WAAW;;KAG3E,cAAc,iBAAiB;;;cAG9B,8BAA8B;WAChC,QAAQ,cAAc;WACtB;;;;cAIE,0BAA0B;WAC5B;WACA;WACA;;;KAIC,cAAc,wBAAwB,oBAAoB;KAEjE,YAAY,qBAAqB,QAAQ,KAAK,SAC/C,WAAW,SACX,mBAAmB;;KAGX,YACV,eAAe,kBACf,qBAAqB,QAAQ,aAC7B,QAAQ;GAEP,OAAO,kBAAkB,eACxB,YAAY,cAAc,QAC1B,aAAa;;;;;;;;;;cAuNJ,eAAe;WACL,QAAQ;EAAR,YAAA,QAAQ;;EAK7B,IAAI;;SAKG,MAAM,QAAQ,eAAY,YAAA,cAAA;;SAK1B,aAAa,UAAS,sBAAwB,YAAA,cAAA;;SAW9C,OAAO,eAAe,kBAAkB,QAAQ,SAAS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KAGG,kEAMC;YACG,cAAc;;;;;;;;;;cAqBjB,eAAe;EAC1B,IAAI,OAAO;EACX,IAAI,OAAO,aAAa,iBAAiB,OAAO;EAahD,MAAM,iBAAiB,OAAO;EAI9B,KAAK,iBAAiB,OAAO;EAI7B,KAAK,iBAAiB,OAAO;EAI7B,MAAM,iBAAiB,OAAO;;;cAMnB,YAAU,YAAA,cAAA;;cAGV,sBAAsB,QAAQ,SAAS;WACzC,QAAQ;EAEjB,IAAI,OAAO;EACX,IAAI,OAAO,aAAa,iBAAiB,OAAO;EAOhD,MAAM,iBAAiB,OAAO;EAI9B,KAAK,iBAAiB,OAAO;EAI7B,KAAK,iBAAiB,OAAO;EAI7B,MAAM,iBAAiB,OAAO;EAI9B;SAIO;;;;SAKA,MAAM,SAAQ,aAA6B,YAAA,cAAA;;cAKvC,uBAAe,YAAA,cAAA;;;;;;;;;cAGf,uBAAuB;WAIb;WAHZ;EAGY,YAAA;SAMd,MAAM,iBAAc,YAAA,cAAA;;cAMhB,sBAAuB,mBAAc,YAAA,cAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { N as AnyServiceToken } from "./index-heuaRmXR.mjs";
|
|
2
|
+
import { S as LayerRegistration, b as LayerBackendDisposeOptions, y as LayerBackend } from "./outcome-CB43bnFW.mjs";
|
|
3
|
+
//#region src/layer/map-layer-backend.d.ts
|
|
4
|
+
/** Native map-backed Layer backend used by Runtime when no adapter is supplied. */
|
|
5
|
+
declare class MapLayerBackend implements LayerBackend {
|
|
6
|
+
private readonly providers;
|
|
7
|
+
private readonly instances;
|
|
8
|
+
private readonly pending;
|
|
9
|
+
/** Register a provider, rejecting duplicate or colliding Service tags. */
|
|
10
|
+
register(registration: LayerRegistration): void;
|
|
11
|
+
/** Resolve and cache a provider instance by Service tag. */
|
|
12
|
+
resolve<T extends AnyServiceToken>(token: T): Promise<InstanceType<T>>;
|
|
13
|
+
/** Clear pending acquisitions, cached instances, and provider registrations. */
|
|
14
|
+
disposeAll(options?: LayerBackendDisposeOptions): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { MapLayerBackend as t };
|
|
18
|
+
//# sourceMappingURL=index-BMdU_Z72.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BMdU_Z72.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"}
|
|
@@ -1,95 +1,5 @@
|
|
|
1
|
-
import { A as ProgramFromGenerator, C as EffectError, D as EffectYield, E as EffectSuccess, M as AnyService, S as Effect$1, T as EffectRequirements, f as DisposableResource, h as ScopeOutcome, k as Program$1, p as MaybePromise
|
|
2
|
-
import { C as CompleteExecutionLayer, E as LayerInput, S as CompleteExecution, a as RuntimeShutdownDiagnostic, b as Layer, i as RuntimeRunOptions, j as ProvidedEnvironment, n as RuntimeDisposeOptions, r as RuntimeOptions, v as LayerBackend, w as CompleteInput } from "./index-rQhZk3Nt.mjs";
|
|
1
|
+
import { A as ProgramFromGenerator, C as EffectError, D as EffectYield, E as EffectSuccess, M as AnyService, S as Effect$1, T as EffectRequirements, f as DisposableResource, h as ScopeOutcome, k as Program$1, p as MaybePromise, w as EffectFromGenerator, x as AnyEffect } from "./index-heuaRmXR.mjs";
|
|
3
2
|
import { Err, Result, UnhandledException } from "better-result";
|
|
4
|
-
//#region src/runtime/types.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Name a Runtime type from a concrete Layer without repeating its provided
|
|
7
|
-
* branded Service instance union.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* type AppRuntime = RuntimeFor<typeof AppLive>
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
type RuntimeFor<L extends LayerInput> = Runtime<Layer.Provided<L>>;
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/runtime/runtime.d.ts
|
|
17
|
-
/**
|
|
18
|
-
* Long-lived execution environment backed by a complete Layer.
|
|
19
|
-
*
|
|
20
|
-
* A Runtime owns Layer resources until `dispose()` is called. Each `run()` is
|
|
21
|
-
* isolated in a child Scope, while Layer-scoped resources remain shared.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```ts
|
|
25
|
-
* const runtime = await Runtime.make(AppLive)
|
|
26
|
-
* const result = await runtime.run(loadUser('u1'))
|
|
27
|
-
* await runtime.dispose()
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @typeParam Provided The branded Service instances supplied by the Layer.
|
|
31
|
-
*/
|
|
32
|
-
declare class Runtime<Provided extends AnyService = any> {
|
|
33
|
-
private readonly handle;
|
|
34
|
-
private constructor();
|
|
35
|
-
/**
|
|
36
|
-
* Create a long-lived Runtime that owns its Layer resources.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* const runtime = await Runtime.make(AppLive)
|
|
41
|
-
* const result = await runtime.run(program)
|
|
42
|
-
* await runtime.dispose()
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
static make<L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, options?: RuntimeOptions): Promise<Runtime<ProvidedEnvironment<L>>>;
|
|
46
|
-
static make<L extends LayerInput>(layer: L & CompleteInput<L>, options?: RuntimeOptions): Promise<Runtime<ProvidedEnvironment<L>>>;
|
|
47
|
-
/**
|
|
48
|
-
* Run one program and dispose its Layer resources before resolving.
|
|
49
|
-
*
|
|
50
|
-
* This is convenient for request-style or command-style execution where a
|
|
51
|
-
* Runtime should not outlive the operation.
|
|
52
|
-
*/
|
|
53
|
-
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, backend: LayerBackend, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
54
|
-
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, program: CompleteExecution<ProvidedEnvironment<L>, A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
55
|
-
static run<A, L extends LayerInput>(layer: L & CompleteInput<L>, options: RuntimeOptions, program: CompleteExecution<ProvidedEnvironment<L>, A>): Promise<Awaited<A>>;
|
|
56
|
-
/** Run a callback with a managed Runtime and always dispose it afterward. */
|
|
57
|
-
static use<A, L extends LayerInput>(layer: L & CompleteInput<L>, use: (runtime: Runtime<ProvidedEnvironment<L>>) => A | PromiseLike<A>, options?: RuntimeOptions): Promise<Awaited<A>>;
|
|
58
|
-
/** Resolve every Layer provider and dispose the Runtime if warmup fails. */
|
|
59
|
-
warmup(): Promise<void>;
|
|
60
|
-
/** Run one execution in this Runtime's child Scope. */
|
|
61
|
-
run<A>(program: CompleteExecution<Provided, A>, options?: RuntimeRunOptions): Promise<Awaited<A>>;
|
|
62
|
-
/** Run one execution with a Layer owned by that execution's child Scope. */
|
|
63
|
-
runWith<Request extends LayerInput, A>(layer: Request & CompleteExecutionLayer<Provided, Request>, program: CompleteExecution<Provided | ProvidedEnvironment<Request>, A>, options?: RuntimeRunOptions): Promise<Awaited<A>>;
|
|
64
|
-
private runUnchecked;
|
|
65
|
-
/** Stop new executions and release the Runtime's Layer resources. */
|
|
66
|
-
dispose(options?: RuntimeDisposeOptions): Promise<void>;
|
|
67
|
-
/** @deprecated Scope outcomes are kept for internal compatibility. */
|
|
68
|
-
dispose(outcome: ScopeOutcome): Promise<void>;
|
|
69
|
-
/** Release Runtime-owned resources through JavaScript's async disposal protocol. */
|
|
70
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
71
|
-
private disposeWithOutcome;
|
|
72
|
-
}
|
|
73
|
-
/** Type-level aliases for naming Runtime handles and shutdown options. */
|
|
74
|
-
declare namespace Runtime {
|
|
75
|
-
/** Name a Runtime type from a concrete Layer. */
|
|
76
|
-
type For<L extends LayerInput> = RuntimeFor<L>;
|
|
77
|
-
/** Optional Runtime shutdown configuration. */
|
|
78
|
-
type Options = RuntimeOptions;
|
|
79
|
-
/** Optional signal supplied to one managed Runtime execution. */
|
|
80
|
-
type RunOptions = RuntimeRunOptions;
|
|
81
|
-
/** Cooperative shutdown policy for a managed Runtime. */
|
|
82
|
-
type DisposeOptions = RuntimeDisposeOptions;
|
|
83
|
-
/** Diagnostic reported for aggregated Runtime shutdown cleanup failures. */
|
|
84
|
-
type ShutdownDiagnostic = RuntimeShutdownDiagnostic;
|
|
85
|
-
}
|
|
86
|
-
//#endregion
|
|
87
|
-
//#region src/runtime/signal.d.ts
|
|
88
|
-
/** Yieldable access to the signal of the current Runtime execution. */
|
|
89
|
-
declare const CurrentAbortSignal: {
|
|
90
|
-
readonly [Symbol.iterator]: () => Generator<never, AbortSignal, unknown>;
|
|
91
|
-
};
|
|
92
|
-
//#endregion
|
|
93
3
|
//#region src/effect/combinators.d.ts
|
|
94
4
|
type EffectInput<A, E> = Result<A, E> | PromiseLike<Result<A, E>>;
|
|
95
5
|
type AnyEffectInput = EffectInput<any, any>;
|
|
@@ -341,6 +251,8 @@ type ProgramAllResultsResult<Programs extends readonly AnyProgram[]> = Program$1
|
|
|
341
251
|
type ProgramForEachResult<Child extends AnyProgram> = Program$1<ReadonlyArray<EffectSuccess<Child>>, EffectError<Child>, EffectRequirements<Child>>;
|
|
342
252
|
type ProgramAllOptions = {
|
|
343
253
|
readonly concurrency?: number;
|
|
254
|
+
/** Optional diagnostic name for the collection execution. */
|
|
255
|
+
readonly name?: string;
|
|
344
256
|
};
|
|
345
257
|
/**
|
|
346
258
|
* Compose `better-result` operations while preserving Service requirements in
|
|
@@ -366,6 +278,12 @@ declare function gen<Yield extends EffectYield, Returned extends AnyResult>(body
|
|
|
366
278
|
/** Build a lazy Program without running its generator. */
|
|
367
279
|
declare function fn<Yield extends EffectYield, Returned extends AnyResult>(body: () => Generator<Yield, Returned, unknown>): ProgramFromGenerator<Yield, Returned>;
|
|
368
280
|
declare function fn<Yield extends EffectYield, Returned extends AnyResult>(body: () => AsyncGenerator<Yield, Returned, unknown>): ProgramFromGenerator<Yield, Returned>;
|
|
281
|
+
type ProgramNamedOperation = {
|
|
282
|
+
<Input extends AnyProgram>(program: Input): Input;
|
|
283
|
+
};
|
|
284
|
+
/** Attach a lazy diagnostic name to a Program without invoking it. */
|
|
285
|
+
declare function programNamed(name: string): ProgramNamedOperation;
|
|
286
|
+
declare function programNamed<Input extends AnyProgram>(name: string, program: Input): Input;
|
|
369
287
|
/** Build a lazy Program collection with optional bounded concurrency. */
|
|
370
288
|
declare function programAll<const Programs extends readonly AnyProgram[]>(programs: Programs, options?: ProgramAllOptions): ProgramAllResult<Programs>;
|
|
371
289
|
/** Build a lazy Program collection from an input array and Program factory. */
|
|
@@ -374,6 +292,7 @@ declare function programForEach<const Items extends readonly unknown[], Child ex
|
|
|
374
292
|
declare function programAllResults<const Programs extends readonly AnyProgram[]>(programs: Programs, options?: ProgramAllOptions): ProgramAllResultsResult<Programs>;
|
|
375
293
|
/** Value-level namespace for lazy Program combinators. */
|
|
376
294
|
declare const Program: {
|
|
295
|
+
readonly named: typeof programNamed;
|
|
377
296
|
readonly all: typeof programAll;
|
|
378
297
|
readonly forEach: typeof programForEach;
|
|
379
298
|
readonly allResults: typeof programAllResults;
|
|
@@ -399,7 +318,7 @@ declare const Program: {
|
|
|
399
318
|
* )
|
|
400
319
|
* ```
|
|
401
320
|
*/
|
|
402
|
-
declare function acquireRelease<R>(acquire: () => MaybePromise
|
|
321
|
+
declare function acquireRelease<R>(acquire: () => MaybePromise<R>, release: (resource: R, outcome: ScopeOutcome) => MaybePromise<void>): AsyncGenerator<Err<never, UnhandledException>, R, unknown>;
|
|
403
322
|
/**
|
|
404
323
|
* Acquire a Result-valued resource and register only successful acquisitions.
|
|
405
324
|
*
|
|
@@ -407,14 +326,14 @@ declare function acquireRelease<R>(acquire: () => MaybePromise$1<R>, release: (r
|
|
|
407
326
|
* unexpected acquisition and registration failures are normalized by
|
|
408
327
|
* `better-result`. Release failures remain Scope cleanup failures.
|
|
409
328
|
*/
|
|
410
|
-
declare function acquireReleaseResult<R, E>(acquire: () => MaybePromise
|
|
329
|
+
declare function acquireReleaseResult<R, E>(acquire: () => MaybePromise<Result<R, E>>, release: (resource: R, outcome: ScopeOutcome) => MaybePromise<void>): AsyncGenerator<Err<never, E | UnhandledException>, R, unknown>;
|
|
411
330
|
/**
|
|
412
331
|
* Lazily acquire and register a disposable resource in the current Scope.
|
|
413
332
|
*
|
|
414
333
|
* Disposal is delegated to `Scope.add`, including protocol preference,
|
|
415
334
|
* validation, race-safe registration, and cleanup error handling.
|
|
416
335
|
*/
|
|
417
|
-
declare function acquireDisposable<R extends DisposableResource>(acquire: () => MaybePromise
|
|
336
|
+
declare function acquireDisposable<R extends DisposableResource>(acquire: () => MaybePromise<R>): AsyncGenerator<Err<never, UnhandledException>, R, unknown>;
|
|
418
337
|
/**
|
|
419
338
|
* Register an already-acquired disposable resource in the current Scope.
|
|
420
339
|
*
|
|
@@ -477,60 +396,5 @@ declare namespace Effect {
|
|
|
477
396
|
type Any = AnyEffect;
|
|
478
397
|
}
|
|
479
398
|
//#endregion
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
declare function pipe<A>(value: A): A;
|
|
483
|
-
declare function pipe<A, B>(value: A, ab: Unary<A, B>): B;
|
|
484
|
-
declare function pipe<A, B, C>(value: A, ab: Unary<A, B>, bc: Unary<B, C>): C;
|
|
485
|
-
declare function pipe<A, B, C, D>(value: A, ab: Unary<A, B>, bc: Unary<B, C>, cd: Unary<C, D>): D;
|
|
486
|
-
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;
|
|
487
|
-
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;
|
|
488
|
-
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;
|
|
489
|
-
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;
|
|
490
|
-
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;
|
|
491
|
-
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;
|
|
492
|
-
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;
|
|
493
|
-
//#endregion
|
|
494
|
-
//#region src/resource/errors.d.ts
|
|
495
|
-
declare const ResourceReleaseFailure_base: import("better-result").TaggedErrorClass<"ResourceReleaseFailure">;
|
|
496
|
-
/** Describes a failure encountered while releasing a Resource. */
|
|
497
|
-
declare class ResourceReleaseFailure extends ResourceReleaseFailure_base<{
|
|
498
|
-
readonly resource: string;
|
|
499
|
-
readonly cause: unknown;
|
|
500
|
-
readonly message: string;
|
|
501
|
-
}> {}
|
|
502
|
-
//#endregion
|
|
503
|
-
//#region src/resource/types.d.ts
|
|
504
|
-
/** A value that may be delivered synchronously or through a thenable. */
|
|
505
|
-
type MaybePromise<T> = T | PromiseLike<T>;
|
|
506
|
-
/** A synchronous or asynchronous better-result Result operation. */
|
|
507
|
-
type AsyncResult<T, E> = MaybePromise<Result<T, E>>;
|
|
508
|
-
/** The allowed return value of a custom Resource release callback. */
|
|
509
|
-
type ReleaseOutcome = void | Result<void, unknown>;
|
|
510
|
-
/** Receives release failures for diagnostics without changing error precedence. */
|
|
511
|
-
type ReleaseFailureObserver = (failure: ResourceReleaseFailure) => MaybePromise<void>;
|
|
512
|
-
/** Options controlling `Resource.acquireUseRelease`. */
|
|
513
|
-
type AcquireUseReleaseOptions<R, A, AcquireError, UseError> = {
|
|
514
|
-
/** Human-readable name included in release failures. */
|
|
515
|
-
readonly name: string;
|
|
516
|
-
/** Acquire the resource. A failure skips use and release. */
|
|
517
|
-
readonly acquire: () => AsyncResult<R, AcquireError>;
|
|
518
|
-
/** Use the acquired resource. Release is attempted afterward. */
|
|
519
|
-
readonly use: (resource: R) => AsyncResult<A, UseError>;
|
|
520
|
-
/** Release the resource, or omit it to use its disposal protocol. */
|
|
521
|
-
readonly release?: (resource: R) => MaybePromise<ReleaseOutcome>;
|
|
522
|
-
/**
|
|
523
|
-
* Observe cleanup failures without changing error precedence. This is most
|
|
524
|
-
* useful when both `use` and `release` can fail.
|
|
525
|
-
*/
|
|
526
|
-
readonly onReleaseFailure?: ReleaseFailureObserver;
|
|
527
|
-
};
|
|
528
|
-
//#endregion
|
|
529
|
-
//#region src/resource/resource.d.ts
|
|
530
|
-
declare const Resource: {
|
|
531
|
-
/** Acquire, use, and release a resource with deterministic error precedence. */
|
|
532
|
-
readonly acquireUseRelease: <R, A, AcquireError, UseError>({ name, acquire, use, release, onReleaseFailure }: AcquireUseReleaseOptions<R, A, AcquireError, UseError>) => Promise<Result<A, AcquireError | UseError | UnhandledException | ResourceReleaseFailure>>;
|
|
533
|
-
};
|
|
534
|
-
//#endregion
|
|
535
|
-
export { ReleaseOutcome as a, Effect as c, CurrentAbortSignal as d, Runtime as f, ReleaseFailureObserver as i, Program as l, AcquireUseReleaseOptions as n, ResourceReleaseFailure as o, RuntimeFor as p, AsyncResult as r, pipe as s, Resource as t, ProgramAllOptions as u };
|
|
536
|
-
//# sourceMappingURL=index-C7Qild0_.d.mts.map
|
|
399
|
+
export { Program as n, ProgramAllOptions as r, Effect as t };
|
|
400
|
+
//# sourceMappingURL=index-CX6iAoCB.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CX6iAoCB.d.mts","names":[],"sources":["../src/effect/combinators.ts","../src/effect/program-combinators.ts","../src/effect/effect.ts"],"mappings":";;;KAYK,YAAY,GAAG,KAAK,OAAW,GAAG,KAAK,YAAY,OAAW,GAAG;KAEjE,iBAAiB;KACjB,iBAAiB;KACjB,sBAAsB,YAAY;KAIlC,cAAc,OAAO,UAAU,cAAc,uBAAuB,QAAQ,UAAU;KAEtF,aAAa,OAAO,KAAK,SAAO,GAAG,YAAY,QAAQ,mBAAmB;KAE1E,kBAAkB,OAAO,MAAM,SAAO,cAAc,QAAQ,IAAI,mBAAmB;KAEnF,cAAc,OAAO,QAAQ,SAChC,cAAc,OACd,YAAY,SAAS,YAAY,OACjC,mBAAmB,SAAS,mBAAmB;KAG5C,cAAc,OAAO,QAAQ,cAAc,OAAO;KAElD,mBAAmB,OAAO,QAAQ,QAAQ,cAAc,OAAO;KAE/D,eAAa,GAAG;GAClB,OAAO,QAAQ,QAAQ,YAAY,UAAU,cAAc,OAAO,aAAa,OAAO;;KAGpF,oBAAkB,IAAI;GACxB,OAAO,QAAQ,QAAQ,iBAAiB,MAAM,cAAc,OAAO,kBAAkB,OAAO;;KAG1F,mBAAiB;GACnB,OAAO,QAAQ,QAAQ,iBAAiB,cAAc,OAAO;;KAG3D,sBAAsB,GAAG;GAC3B,OAAO,QAAQ,QAAQ,YAAY,UAAU,mBAAmB,OAAO;;KAGrE,aAAa,SAAS,SACzB,cAAc,QACd,YAAY,QACZ,mBAAmB;KAGhB,gBAAgB,OAAO,QAAQ,SAClC,cAAc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