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

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 CHANGED
@@ -55,20 +55,20 @@ You can read the documentation [here](https://orpc.dev).
55
55
 
56
56
  **Framework & ecosystem integrations**
57
57
 
58
- | Package | Purpose | Docs |
59
- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
60
- | [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data). | [Next.js](https://orpc.dev/docs/integrations/next) |
61
- | [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools. | [AI SDK](https://orpc.dev/docs/integrations/ai-sdk) |
62
- | [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest). | [TanStack Query](https://orpc.dev/docs/integrations/tanstack-query) |
63
- | [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/). | [Pinia Colada](https://orpc.dev/docs/integrations/pinia-colada) |
64
- | [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
65
- | [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/). | [MSW](https://orpc.dev/docs/integrations/msw) |
66
- | [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
67
- | [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
68
- | [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads. | [Static File](https://orpc.dev/docs/plugins/static-file), [Tmp File Upload](https://orpc.dev/docs/plugins/tmp-file-upload), [Batch Response Compression](https://orpc.dev/docs/plugins/batch-response-compression) |
69
- | [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
70
- | [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare's RateLimit and Durable Objects](https://developers.cloudflare.com/workers/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
71
- | [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC. | [tRPC](https://orpc.dev/docs/integrations/trpc) |
58
+ | Package | Purpose | Docs |
59
+ | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
60
+ | [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data). | [Next.js](https://orpc.dev/docs/integrations/next) |
61
+ | [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools. | [AI SDK](https://orpc.dev/docs/integrations/ai-sdk) |
62
+ | [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest). | [TanStack Query](https://orpc.dev/docs/integrations/tanstack-query) |
63
+ | [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/). | [Pinia Colada](https://orpc.dev/docs/integrations/pinia-colada) |
64
+ | [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
65
+ | [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/). | [MSW](https://orpc.dev/docs/integrations/msw) |
66
+ | [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
67
+ | [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
68
+ | [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads. | [Static File](https://orpc.dev/docs/plugins/static-file), [Tmp File Upload](https://orpc.dev/docs/plugins/tmp-file-upload), [Batch Response Compression](https://orpc.dev/docs/plugins/batch-response-compression) |
69
+ | [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
70
+ | [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare Workers](https://developers.cloudflare.com/workers/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Traces](https://orpc.dev/docs/integrations/cloudflare-traces) |
71
+ | [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC. | [tRPC](https://orpc.dev/docs/integrations/trpc) |
72
72
 
73
73
  **Observability**
74
74
 
@@ -127,6 +127,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
127
127
  <td align="center"><a href="https://github.com/ellis-driscoll?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Ellis Driscoll"><img src="https://avatars.githubusercontent.com/u/70685966?u=c5f95bc33b5991d9744abe00052542e4a2ed3cb9&amp;v=4" width="139" alt="Ellis Driscoll"/><br />Ellis Driscoll</a></td>
128
128
  <td align="center"><a href="https://github.com/hoangbn?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Hoang Nguyen"><img src="https://avatars.githubusercontent.com/u/38968280?u=c90084c6de65c56facabab7ba13a72a49ddbc3e4&amp;v=4" width="139" alt="Hoang Nguyen"/><br />Hoang Nguyen</a></td>
129
129
  <td align="center"><a href="https://opencollective.com/guest-ac41de3b?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Orestis Ioannou"><img src="https://images.opencollective.com/guest-ac41de3b/avatar/460.png" width="139" alt="Orestis Ioannou"/><br />Orestis Ioannou</a></td>
130
+ <td align="center"><a href="https://automatio.ai/?ref=middleapi&amp;utm_source=middleapi&amp;utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Stefan Smiljkovic"><img src="https://avatars.githubusercontent.com/u/1984909?u=b7bf5bc40ed49df3c22f69d2da7b8d78709c49ed&amp;v=4" width="139" alt="Stefan Smiljkovic"/><br />Stefan Smiljkovic</a></td>
130
131
  </tr>
131
132
  </table>
132
133
 
@@ -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.35",
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.35",
55
+ "@orpc/contract": "2.0.0-beta.35",
56
+ "@orpc/json-schema": "2.0.0-beta.35",
57
+ "@orpc/server": "2.0.0-beta.35",
58
+ "@orpc/shared": "2.0.0-beta.35"
59
59
  },
60
60
  "devDependencies": {
61
61
  "effect": "4.0.0-rc.112"