@orpc/experimental-effect 2.0.0-beta.33 → 2.0.0-beta.34

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.
@@ -1,25 +1,25 @@
1
1
  import { ErrorMap, InferSchemaOutput, InitialInputSchema, Schema, AnySchema, InferSchemaInput } from '@orpc/contract';
2
- import { Context, ORPCErrorConstructorMap, DecoratedProcedure, AnyORPCError, MergedContext, ImplementedProcedure } from '@orpc/server';
2
+ import { Context, ORPCErrorConstructorMap, DecoratedProcedure, MergedContext, ImplementedProcedure } from '@orpc/server';
3
3
  import { Effect } from 'effect';
4
- import { InferEffectServices, HandlerGen, InferYieldError } from '../index.mjs';
4
+ import { InferEffectServices, HandlerGen } from '../index.mjs';
5
5
 
6
6
  declare module '@orpc/server' {
7
7
  interface Builder<TInitialContext extends Context, TErrorMap extends ErrorMap> {
8
- effect<TYield extends Effect.Effect<any, any, InferEffectServices<TInitialContext>>, TReturn>(handler: HandlerGen<TInitialContext, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, object, InitialInputSchema, Schema<Exclude<TReturn, AnyORPCError>>, TErrorMap, Extract<TReturn | InferYieldError<TYield>, AnyORPCError>>;
8
+ effect<TYield extends Effect.Effect<any, any, InferEffectServices<TInitialContext>>, TReturn>(handler: HandlerGen<TInitialContext, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, object, InitialInputSchema, Schema<TReturn>, TErrorMap>;
9
9
  }
10
10
  interface BuilderWithMiddlewares<TInitialContext extends Context, TInjectedContext extends Context, TErrorMap extends ErrorMap> {
11
- effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, Schema<Exclude<TReturn, AnyORPCError>>, TErrorMap, Extract<TReturn | InferYieldError<TYield>, AnyORPCError>>;
11
+ effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, Schema<TReturn>, TErrorMap>;
12
12
  }
13
13
  interface BuilderWithInput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TErrorMap extends ErrorMap> {
14
- effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, Schema<Exclude<TReturn, AnyORPCError>>, TErrorMap, Extract<TReturn | InferYieldError<TYield>, AnyORPCError>>;
14
+ effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, Schema<TReturn>, TErrorMap>;
15
15
  }
16
16
  interface BuilderWithOutput<TInitialContext extends Context, TInjectedContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
17
- effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn extends InferSchemaInput<TOutputSchema> | AnyORPCError>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, TOutputSchema, TErrorMap, Extract<TReturn | InferYieldError<TYield>, AnyORPCError>>;
17
+ effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn extends InferSchemaInput<TOutputSchema>>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, TOutputSchema, TErrorMap>;
18
18
  }
19
19
  interface BuilderWithInputOutput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
20
- effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn extends InferSchemaInput<TOutputSchema> | AnyORPCError>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, Extract<TReturn | InferYieldError<TYield>, AnyORPCError>>;
20
+ effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn extends InferSchemaInput<TOutputSchema>>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
21
21
  }
22
22
  interface ProcedureImplementer<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
23
- effect(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, AnyORPCError | InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>>): ImplementedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
23
+ effect(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>>): ImplementedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
24
24
  }
25
25
  }
@@ -1,25 +1,25 @@
1
1
  import { ErrorMap, InferSchemaOutput, InitialInputSchema, Schema, AnySchema, InferSchemaInput } from '@orpc/contract';
2
- import { Context, ORPCErrorConstructorMap, DecoratedProcedure, AnyORPCError, MergedContext, ImplementedProcedure } from '@orpc/server';
2
+ import { Context, ORPCErrorConstructorMap, DecoratedProcedure, MergedContext, ImplementedProcedure } from '@orpc/server';
3
3
  import { Effect } from 'effect';
4
- import { InferEffectServices, HandlerGen, InferYieldError } from '../index.js';
4
+ import { InferEffectServices, HandlerGen } from '../index.js';
5
5
 
6
6
  declare module '@orpc/server' {
7
7
  interface Builder<TInitialContext extends Context, TErrorMap extends ErrorMap> {
8
- effect<TYield extends Effect.Effect<any, any, InferEffectServices<TInitialContext>>, TReturn>(handler: HandlerGen<TInitialContext, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, object, InitialInputSchema, Schema<Exclude<TReturn, AnyORPCError>>, TErrorMap, Extract<TReturn | InferYieldError<TYield>, AnyORPCError>>;
8
+ effect<TYield extends Effect.Effect<any, any, InferEffectServices<TInitialContext>>, TReturn>(handler: HandlerGen<TInitialContext, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, object, InitialInputSchema, Schema<TReturn>, TErrorMap>;
9
9
  }
10
10
  interface BuilderWithMiddlewares<TInitialContext extends Context, TInjectedContext extends Context, TErrorMap extends ErrorMap> {
11
- effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, Schema<Exclude<TReturn, AnyORPCError>>, TErrorMap, Extract<TReturn | InferYieldError<TYield>, AnyORPCError>>;
11
+ effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, Schema<TReturn>, TErrorMap>;
12
12
  }
13
13
  interface BuilderWithInput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TErrorMap extends ErrorMap> {
14
- effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, Schema<Exclude<TReturn, AnyORPCError>>, TErrorMap, Extract<TReturn | InferYieldError<TYield>, AnyORPCError>>;
14
+ effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, Schema<TReturn>, TErrorMap>;
15
15
  }
16
16
  interface BuilderWithOutput<TInitialContext extends Context, TInjectedContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
17
- effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn extends InferSchemaInput<TOutputSchema> | AnyORPCError>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, TOutputSchema, TErrorMap, Extract<TReturn | InferYieldError<TYield>, AnyORPCError>>;
17
+ effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn extends InferSchemaInput<TOutputSchema>>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, TOutputSchema, TErrorMap>;
18
18
  }
19
19
  interface BuilderWithInputOutput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
20
- effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn extends InferSchemaInput<TOutputSchema> | AnyORPCError>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, Extract<TReturn | InferYieldError<TYield>, AnyORPCError>>;
20
+ effect<TYield extends Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, TReturn extends InferSchemaInput<TOutputSchema>>(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, TYield, TReturn, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
21
21
  }
22
22
  interface ProcedureImplementer<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
23
- effect(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, AnyORPCError | InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>>): ImplementedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
23
+ effect(handler: HandlerGen<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, Effect.Effect<any, any, InferEffectServices<MergedContext<TInitialContext, TInjectedContext>>>, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>>): ImplementedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
24
24
  }
25
25
  }
@@ -1,5 +1,5 @@
1
1
  import { Builder, ProcedureImplementer } from '@orpc/server';
2
- import { h as handlerGen } from '../shared/experimental-effect.C9oJcd5q.mjs';
2
+ import { h as handlerGen } from '../shared/experimental-effect._sKLzweg.mjs';
3
3
  import 'effect';
4
4
  import '@orpc/shared';
5
5
 
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AnyNestedClient, Client, ClientRest } from '@orpc/client';
2
2
  import { Effect, Schema } from 'effect';
3
- import { I as InferEffectServices } from './shared/experimental-effect.DTnbcz7i.mjs';
4
- export { H as HandlerGen, a as InferYieldError, W as WithEffectContext, h as handlerGen } from './shared/experimental-effect.DTnbcz7i.mjs';
3
+ import { I as InferEffectServices } from './shared/experimental-effect.D0zFxpKr.mjs';
4
+ export { H as HandlerGen, a as InferYieldError, W as WithEffectContext, h as handlerGen } from './shared/experimental-effect.D0zFxpKr.mjs';
5
5
  import { AnySchema, ErrorMap, Schema as Schema$1 } from '@orpc/contract';
6
6
  import { JsonSchemaConverter, JsonSchemaConverterDirection, JsonSchema } from '@orpc/json-schema';
7
7
  import { AnyORPCError, ORPCError, ORPCErrorCode, Context, ORPCErrorConstructorMap, MiddlewareOptions, MiddlewareNextOptions, MiddlewareResult, MiddlewareDone, Middleware } from '@orpc/server';
@@ -155,7 +155,8 @@ type AnyMiddlewareGen = MiddlewareGen<any, any, any, any, any, any>;
155
155
  *
156
156
  * @see {@link https://orpc.dev/docs/integrations/effect#effectful-middleware | Effect Integration - Effectful Middleware}
157
157
  */
158
- declare function middlewareGen<TInContext extends Context, TInput, TOutput, TErrorMap extends ErrorMap, TYield extends Effect.Effect<any, any, InferEffectServices<TInContext>>, TOutContext extends Context = object>(middleware: MiddlewareGen<TInContext, TOutContext, TInput, TOutput, TYield, ORPCErrorConstructorMap<TErrorMap>>): Middleware<TInContext, TOutContext, TInput, TOutput, TErrorMap>;
158
+ declare function middlewareGen<TInContext extends Context, TOutContext extends Context = object, TInput = unknown, TOutput = any, // TOutput = any by default is important to make middleware can be used in any output by default
159
+ TErrorMap extends ErrorMap = Record<never, never>, TYield extends Effect.Effect<any, any, InferEffectServices<TInContext>> = Effect.Effect<any, any, InferEffectServices<TInContext>>>(middleware: MiddlewareGen<TInContext, TOutContext, TInput, TOutput, TYield, ORPCErrorConstructorMap<TErrorMap>>): Middleware<TInContext, TOutContext, TInput, TOutput, TErrorMap>;
159
160
 
160
161
  interface RunPromiseOptions {
161
162
  signal?: undefined | AbortSignal;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AnyNestedClient, Client, ClientRest } from '@orpc/client';
2
2
  import { Effect, Schema } from 'effect';
3
- import { I as InferEffectServices } from './shared/experimental-effect.DTnbcz7i.js';
4
- export { H as HandlerGen, a as InferYieldError, W as WithEffectContext, h as handlerGen } from './shared/experimental-effect.DTnbcz7i.js';
3
+ import { I as InferEffectServices } from './shared/experimental-effect.D0zFxpKr.js';
4
+ export { H as HandlerGen, a as InferYieldError, W as WithEffectContext, h as handlerGen } from './shared/experimental-effect.D0zFxpKr.js';
5
5
  import { AnySchema, ErrorMap, Schema as Schema$1 } from '@orpc/contract';
6
6
  import { JsonSchemaConverter, JsonSchemaConverterDirection, JsonSchema } from '@orpc/json-schema';
7
7
  import { AnyORPCError, ORPCError, ORPCErrorCode, Context, ORPCErrorConstructorMap, MiddlewareOptions, MiddlewareNextOptions, MiddlewareResult, MiddlewareDone, Middleware } from '@orpc/server';
@@ -155,7 +155,8 @@ type AnyMiddlewareGen = MiddlewareGen<any, any, any, any, any, any>;
155
155
  *
156
156
  * @see {@link https://orpc.dev/docs/integrations/effect#effectful-middleware | Effect Integration - Effectful Middleware}
157
157
  */
158
- declare function middlewareGen<TInContext extends Context, TInput, TOutput, TErrorMap extends ErrorMap, TYield extends Effect.Effect<any, any, InferEffectServices<TInContext>>, TOutContext extends Context = object>(middleware: MiddlewareGen<TInContext, TOutContext, TInput, TOutput, TYield, ORPCErrorConstructorMap<TErrorMap>>): Middleware<TInContext, TOutContext, TInput, TOutput, TErrorMap>;
158
+ declare function middlewareGen<TInContext extends Context, TOutContext extends Context = object, TInput = unknown, TOutput = any, // TOutput = any by default is important to make middleware can be used in any output by default
159
+ TErrorMap extends ErrorMap = Record<never, never>, TYield extends Effect.Effect<any, any, InferEffectServices<TInContext>> = Effect.Effect<any, any, InferEffectServices<TInContext>>>(middleware: MiddlewareGen<TInContext, TOutContext, TInput, TOutput, TYield, ORPCErrorConstructorMap<TErrorMap>>): Middleware<TInContext, TOutContext, TInput, TOutput, TErrorMap>;
159
160
 
160
161
  interface RunPromiseOptions {
161
162
  signal?: undefined | AbortSignal;
package/dist/index.mjs CHANGED
@@ -3,8 +3,8 @@ import { isTypescriptObject, anyAbortSignal, getOwn } from '@orpc/shared';
3
3
  import { Effect, Schema, Function, Context } from 'effect';
4
4
  import { StandardJsonSchemaConverter } from '@orpc/json-schema';
5
5
  import { ORPCError } from '@orpc/server';
6
- import { r as runPromise } from './shared/experimental-effect.C9oJcd5q.mjs';
7
- export { h as handlerGen } from './shared/experimental-effect.C9oJcd5q.mjs';
6
+ import { r as runPromise } from './shared/experimental-effect._sKLzweg.mjs';
7
+ export { h as handlerGen } from './shared/experimental-effect._sKLzweg.mjs';
8
8
  export { t as toStandardSchema } from './shared/experimental-effect.YQKompVf.mjs';
9
9
  import '@orpc/contract';
10
10
 
@@ -1,4 +1,4 @@
1
- import { Context, AnyProcedure, ORPCErrorConstructorMap, ProcedureHandlerOptions, ProcedureHandler, AnyORPCError } from '@orpc/server';
1
+ import { Context, AnyProcedure, ORPCErrorConstructorMap, ProcedureHandlerOptions, ProcedureHandler } from '@orpc/server';
2
2
  import { Context as Context$1, Effect } from 'effect';
3
3
 
4
4
  /**
@@ -71,7 +71,7 @@ interface HandlerGen<TCurrentContext extends Context, TInput, TYield extends Eff
71
71
  *
72
72
  * @see {@link https://orpc.dev/docs/integrations/effect#effectful-handlers | Effect Integration - Effectful Handlers}
73
73
  */
74
- declare function handlerGen<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TYield extends Effect.Effect<any, any, InferEffectServices<TCurrentContext>>, TReturn>(handler: HandlerGen<TCurrentContext, TInput, TYield, TReturn, TErrorConstructorMap>): ProcedureHandler<TCurrentContext, TInput, TReturn | Extract<InferYieldError<TYield>, AnyORPCError>, TErrorConstructorMap>;
74
+ declare function handlerGen<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TYield extends Effect.Effect<any, any, InferEffectServices<TCurrentContext>>, TReturn>(handler: HandlerGen<TCurrentContext, TInput, TYield, TReturn, TErrorConstructorMap>): ProcedureHandler<TCurrentContext, TInput, TReturn, TErrorConstructorMap>;
75
75
 
76
76
  export { handlerGen as h };
77
77
  export type { HandlerGen as H, InferEffectServices as I, WithEffectContext as W, InferYieldError as a };
@@ -1,4 +1,4 @@
1
- import { Context, AnyProcedure, ORPCErrorConstructorMap, ProcedureHandlerOptions, ProcedureHandler, AnyORPCError } from '@orpc/server';
1
+ import { Context, AnyProcedure, ORPCErrorConstructorMap, ProcedureHandlerOptions, ProcedureHandler } from '@orpc/server';
2
2
  import { Context as Context$1, Effect } from 'effect';
3
3
 
4
4
  /**
@@ -71,7 +71,7 @@ interface HandlerGen<TCurrentContext extends Context, TInput, TYield extends Eff
71
71
  *
72
72
  * @see {@link https://orpc.dev/docs/integrations/effect#effectful-handlers | Effect Integration - Effectful Handlers}
73
73
  */
74
- declare function handlerGen<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TYield extends Effect.Effect<any, any, InferEffectServices<TCurrentContext>>, TReturn>(handler: HandlerGen<TCurrentContext, TInput, TYield, TReturn, TErrorConstructorMap>): ProcedureHandler<TCurrentContext, TInput, TReturn | Extract<InferYieldError<TYield>, AnyORPCError>, TErrorConstructorMap>;
74
+ declare function handlerGen<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TYield extends Effect.Effect<any, any, InferEffectServices<TCurrentContext>>, TReturn>(handler: HandlerGen<TCurrentContext, TInput, TYield, TReturn, TErrorConstructorMap>): ProcedureHandler<TCurrentContext, TInput, TReturn, TErrorConstructorMap>;
75
75
 
76
76
  export { handlerGen as h };
77
77
  export type { HandlerGen as H, InferEffectServices as I, WithEffectContext as W, InferYieldError as a };
@@ -1,4 +1,3 @@
1
- import { ORPCError } from '@orpc/server';
2
1
  import { Effect, Exit, Cause, Context } from 'effect';
3
2
  import { AbortError } from '@orpc/shared';
4
3
 
@@ -16,10 +15,9 @@ async function runPromise(effect, options = {}) {
16
15
  throw Cause.squash(exit.cause);
17
16
  }
18
17
 
19
- const succeedOnORPCError = Effect.catch((error) => error instanceof ORPCError ? Effect.succeed(error) : Effect.fail(error));
20
18
  function handlerGen(handler) {
21
19
  return (opts, input) => {
22
- let ef = Effect.gen(() => handler(opts, input)).pipe(succeedOnORPCError);
20
+ let ef = Effect.gen(() => handler(opts, input));
23
21
  if (Context.isContext(opts.context["effect/context"])) {
24
22
  ef = ef.pipe(Effect.provide(opts.context["effect/context"]));
25
23
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/experimental-effect",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.33",
4
+ "version": "2.0.0-beta.34",
5
5
  "description": "Effect integration for oRPC: build typesafe procedures with Effect",
6
6
  "license": "MIT",
7
7
  "funding": [
@@ -51,11 +51,11 @@
51
51
  "effect": ">=4.0.0-beta.90"
52
52
  },
53
53
  "dependencies": {
54
- "@orpc/client": "2.0.0-beta.33",
55
- "@orpc/contract": "2.0.0-beta.33",
56
- "@orpc/json-schema": "2.0.0-beta.33",
57
- "@orpc/server": "2.0.0-beta.33",
58
- "@orpc/shared": "2.0.0-beta.33"
54
+ "@orpc/client": "2.0.0-beta.34",
55
+ "@orpc/contract": "2.0.0-beta.34",
56
+ "@orpc/json-schema": "2.0.0-beta.34",
57
+ "@orpc/server": "2.0.0-beta.34",
58
+ "@orpc/shared": "2.0.0-beta.34"
59
59
  },
60
60
  "devDependencies": {
61
61
  "effect": "4.0.0-rc.112"