@effect/rpc
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -6,2 +6,3 @@ 'use strict'; | ||
var Effect = require('effect/Effect'); | ||
var Either = require('effect/Either'); | ||
var Function = require('effect/Function'); | ||
@@ -12,3 +13,3 @@ var Error_dist_effectRpcError = require('../../Error/dist/effect-rpc-Error.cjs.dev.js'); | ||
var codec = require('../../dist/codec-9e558b5b.cjs.dev.js'); | ||
var schema = require('../../dist/schema-3743c0fe.cjs.dev.js'); | ||
var schema = require('../../dist/schema-8954f941.cjs.dev.js'); | ||
require('@effect/schema/Schema'); | ||
@@ -23,3 +24,2 @@ require('../../SchemaC/dist/effect-rpc-SchemaC.cjs.dev.js'); | ||
require('effect/RequestResolver'); | ||
require('effect/Either'); | ||
@@ -45,2 +45,3 @@ function _interopNamespace(e) { | ||
var Effect__namespace = /*#__PURE__*/_interopNamespace(Effect); | ||
var Either__namespace = /*#__PURE__*/_interopNamespace(Either); | ||
@@ -50,3 +51,4 @@ const unsafeDecode = schemas => { | ||
return (method, output) => { | ||
const result = map[method].output(output); | ||
const codec = map[method].output; | ||
const result = codec ? codec(output) : Either__namespace.right(void 0); | ||
if (result._tag !== "Left") { | ||
@@ -88,3 +90,3 @@ return result.right; | ||
const parseError = codec.decodeEffect(schema.schemasToUnion(errorSchemas)); | ||
const parseOutput = codec.decodeEffect(schema$1.output); | ||
const parseOutput = "output" in schema$1 ? codec.decodeEffect(schema$1.output) : _ => Effect__namespace.unit; | ||
if ("input" in schema$1) { | ||
@@ -91,0 +93,0 @@ const encodeInput = codec.encodeEffect(schema$1.input); |
@@ -6,2 +6,3 @@ 'use strict'; | ||
var Effect = require('effect/Effect'); | ||
var Either = require('effect/Either'); | ||
var Function = require('effect/Function'); | ||
@@ -12,3 +13,3 @@ var Error_dist_effectRpcError = require('../../Error/dist/effect-rpc-Error.cjs.prod.js'); | ||
var codec = require('../../dist/codec-5a821358.cjs.prod.js'); | ||
var schema = require('../../dist/schema-a76bb547.cjs.prod.js'); | ||
var schema = require('../../dist/schema-343e348a.cjs.prod.js'); | ||
require('@effect/schema/Schema'); | ||
@@ -23,3 +24,2 @@ require('../../SchemaC/dist/effect-rpc-SchemaC.cjs.prod.js'); | ||
require('effect/RequestResolver'); | ||
require('effect/Either'); | ||
@@ -45,2 +45,3 @@ function _interopNamespace(e) { | ||
var Effect__namespace = /*#__PURE__*/_interopNamespace(Effect); | ||
var Either__namespace = /*#__PURE__*/_interopNamespace(Either); | ||
@@ -50,3 +51,4 @@ const unsafeDecode = schemas => { | ||
return (method, output) => { | ||
const result = map[method].output(output); | ||
const codec = map[method].output; | ||
const result = codec ? codec(output) : Either__namespace.right(void 0); | ||
if (result._tag !== "Left") { | ||
@@ -88,3 +90,3 @@ return result.right; | ||
const parseError = codec.decodeEffect(schema.schemasToUnion(errorSchemas)); | ||
const parseOutput = codec.decodeEffect(schema$1.output); | ||
const parseOutput = "output" in schema$1 ? codec.decodeEffect(schema$1.output) : _ => Effect__namespace.unit; | ||
if ("input" in schema$1) { | ||
@@ -91,0 +93,0 @@ const encodeInput = codec.encodeEffect(schema$1.input); |
@@ -15,3 +15,3 @@ /** | ||
*/ | ||
export type Rpc<C extends RpcSchema.Any, R, SE> = C extends RpcSchema.IO<infer _IE, infer E, infer _II, infer I, infer _IO, infer O> ? (input: I) => Effect<R, RpcError | SE | E, O> : C extends RpcSchema.NoError<infer _II, infer I, infer _IO, infer O> ? (input: I) => Effect<R, RpcError | SE, O> : C extends RpcSchema.NoInput<infer _IE, infer E, infer _IO, infer O> ? Effect<R, RpcError | SE | E, O> : C extends RpcSchema.NoInputNoError<infer _IO, infer O> ? Effect<R, RpcError | SE, O> : never; | ||
export type Rpc<C extends RpcSchema.Any, R, SE> = C extends RpcSchema.IO<infer _IE, infer E, infer _II, infer I, infer _IO, infer O> ? (input: I) => Effect<R, RpcError | SE | E, O> : C extends RpcSchema.NoError<infer _II, infer I, infer _IO, infer O> ? (input: I) => Effect<R, RpcError | SE, O> : C extends RpcSchema.NoOutput<infer _IE, infer E, infer _II, infer I> ? (input: I) => Effect<R, RpcError | SE | E, void> : C extends RpcSchema.NoErrorNoOutput<infer _II, infer I> ? (input: I) => Effect<R, RpcError | SE, void> : C extends RpcSchema.NoInput<infer _IE, infer E, infer _IO, infer O> ? Effect<R, RpcError | SE | E, O> : C extends RpcSchema.NoInputNoError<infer _IO, infer O> ? Effect<R, RpcError | SE, O> : never; | ||
type RpcClientRpcs<S extends RpcService.DefinitionWithId, R, SE = never> = { | ||
@@ -18,0 +18,0 @@ readonly [K in Exclude<keyof S, "__setup">]: S[K] extends RpcService.DefinitionWithId ? RpcClientRpcs<S[K], R, SE | RpcService.Errors<S>> : S[K] extends RpcSchema.Any ? Rpc<S[K], R, SE | RpcService.Errors<S>> : never; |
@@ -48,3 +48,3 @@ /** | ||
*/ | ||
type FromSetupSchema<C extends RpcSchema.Any> = C extends RpcSchema.IO<infer _IE, infer E, infer _II, infer I, infer _IO, infer O> ? O extends Context<infer A> ? IO<any, E, I, Context<A>> | IOLayer<any, E, I, A> : never : C extends RpcSchema.NoError<infer _II, infer I, infer _IO, infer O> ? O extends Context<infer A> ? IO<any, never, I, Context<A>> | IOLayer<any, never, I, A> : never : never; | ||
type FromSetupSchema<C> = C extends RpcSchema.NoOutput<infer _IE, infer E, infer _II, infer I> ? IO<any, E, I, Context<any>> | IOLayer<any, E, I, any> : C extends RpcSchema.NoErrorNoOutput<infer _II, infer I> ? IO<any, never, I, Context<any>> | IOLayer<any, never, I, any> : never; | ||
/** | ||
@@ -78,3 +78,3 @@ * @category handler utils | ||
handlers: FromService<S[K]>; | ||
} : S[K] extends RpcSchema.Any ? K extends "__setup" ? RpcHandler.FromSetupSchema<S[K]> : RpcHandler.FromSchema<S[K]> : never; | ||
} : K extends "__setup" ? RpcHandler.FromSetupSchema<S[K]> : S[K] extends RpcSchema.Any ? RpcHandler.FromSchema<S[K]> : never; | ||
}; | ||
@@ -81,0 +81,0 @@ /** |
@@ -5,3 +5,2 @@ /** | ||
import * as Schema from "@effect/schema/Schema"; | ||
import type { Context } from "effect/Context"; | ||
import * as internal from "./internal/schema.js"; | ||
@@ -50,3 +49,6 @@ import type { Json } from "./internal/schema.js"; | ||
*/ | ||
type Any = IO<any, any, any, any, any, any> | NoError<any, any, any, any> | NoInput<any, any, any, any> | NoInputNoError<any, any>; | ||
interface NoOutput<IE, E, II, I> { | ||
input: Schema.Schema<II, I>; | ||
error: Schema.Schema<IE, E>; | ||
} | ||
/** | ||
@@ -56,5 +58,17 @@ * @category models | ||
*/ | ||
interface NoErrorNoOutput<II, I> { | ||
input: Schema.Schema<II, I>; | ||
} | ||
/** | ||
* @category models | ||
* @since 1.0.0 | ||
*/ | ||
type Any = IO<any, any, any, any, any, any> | NoError<any, any, any, any> | NoInput<any, any, any, any> | NoInputNoError<any, any> | NoOutput<any, any, any, any> | NoErrorNoOutput<any, any>; | ||
/** | ||
* @category models | ||
* @since 1.0.0 | ||
*/ | ||
interface Base { | ||
readonly input?: Schema.Schema<any>; | ||
readonly output: Schema.Schema<any>; | ||
readonly output?: Schema.Schema<any>; | ||
readonly error: Schema.Schema<any>; | ||
@@ -66,3 +80,3 @@ } | ||
*/ | ||
type Input<S extends RpcSchema.Any> = S extends { | ||
type Input<S> = S extends { | ||
readonly input: Schema.Schema<infer _I, infer A>; | ||
@@ -74,3 +88,3 @@ } ? A : never; | ||
*/ | ||
type Error<S extends RpcSchema.Any> = S extends { | ||
type Error<S> = S extends { | ||
readonly error: Schema.Schema<infer _I, infer A>; | ||
@@ -82,3 +96,3 @@ } ? A : never; | ||
*/ | ||
type Output<S extends RpcSchema.Any> = S extends { | ||
type Output<S> = S extends { | ||
readonly output: Schema.Schema<infer _I, infer A>; | ||
@@ -112,3 +126,3 @@ } ? A : never; | ||
interface Definition extends Record<string, RpcSchema.Any | WithId<any, any, any>> { | ||
__setup?: RpcSchema.IO<any, any, any, any, Context<any>, Context<any>> | RpcSchema.NoError<any, any, Context<any>, Context<any>>; | ||
__setup?: RpcSchema.NoErrorNoOutput<any, any> | RpcSchema.NoOutput<any, any, any, any>; | ||
} | ||
@@ -169,7 +183,2 @@ /** | ||
*/ | ||
type SetupOutput<S extends DefinitionWithSetup> = RpcSchema.Output<S["__setup"]>; | ||
/** | ||
* @category utils | ||
* @since 1.0.0 | ||
*/ | ||
type Methods<S extends DefinitionWithId, P extends string = ``> = { | ||
@@ -253,8 +262,3 @@ [M in keyof S]: M extends string ? S[M] extends DefinitionWithId ? Methods<S[M], `${P}${M}.`> : `${P}${M}` : never; | ||
*/ | ||
export declare const context: <R>() => Schema.Schema<Context<R>, Context<R>>; | ||
/** | ||
* @category constructors | ||
* @since 1.0.0 | ||
*/ | ||
export declare const makeRequestUnion: <S extends RpcService.Definition>(schema: S) => Schema.Schema<RpcRequestSchema.From<S, "">, RpcRequestSchema.To<S, "">>; | ||
//# sourceMappingURL=Schema.d.ts.map |
import * as Effect from 'effect/Effect'; | ||
import * as Either from 'effect/Either'; | ||
import { pipe } from 'effect/Function'; | ||
@@ -13,3 +14,4 @@ import { RpcError } from '../Error/dist/effect-rpc-Error.esm.js'; | ||
return (method, output) => { | ||
const result = map[method].output(output); | ||
const codec = map[method].output; | ||
const result = codec ? codec(output) : Either.right(void 0); | ||
if (result._tag !== "Left") { | ||
@@ -51,3 +53,3 @@ return result.right; | ||
const parseError = decodeEffect(schemasToUnion(errorSchemas)); | ||
const parseOutput = decodeEffect(schema.output); | ||
const parseOutput = "output" in schema ? decodeEffect(schema.output) : _ => Effect.unit; | ||
if ("input" in schema) { | ||
@@ -54,0 +56,0 @@ const encodeInput = encodeEffect(schema.input); |
@@ -45,3 +45,3 @@ import * as Schema from '@effect/schema/Schema'; | ||
input: schema.input ? decode(schema.input) : undefined, | ||
output: encode(schema.output), | ||
output: schema.output ? encode(schema.output) : undefined, | ||
error: encode(schema.error) | ||
@@ -53,3 +53,3 @@ })); | ||
input: schema.input ? encode(schema.input) : undefined, | ||
output: decode(schema.output), | ||
output: schema.output ? decode(schema.output) : undefined, | ||
error: decode(schema.error) | ||
@@ -56,0 +56,0 @@ })); |
@@ -55,3 +55,3 @@ import * as Schema from '@effect/schema/Schema'; | ||
onSome: ctx => Effect.provide(effect, ctx) | ||
}))) : effect, Effect.map(codecs.output), Effect.catchAll(_ => Effect.succeed(Either.flatMap(codecs.error(_), Either.left)))); | ||
}))) : effect, codecs.output ? Effect.map(codecs.output) : Effect.asUnit, Effect.catchAll(_ => Effect.succeed(Either.flatMap(codecs.error(_), Either.left)))); | ||
}), Effect.match({ | ||
@@ -134,7 +134,7 @@ onFailure: error => ({ | ||
...acc, | ||
[method]: pipe(definition, Effect.flatMap(encode(schema.output)), Effect.withSpan(`${options.spanPrefix}.undecoded.${method}`)) | ||
[method]: pipe(definition, "output" in schema ? Effect.flatMap(encode(schema.output)) : Effect.asUnit, Effect.withSpan(`${options.spanPrefix}.undecoded.${method}`)) | ||
}; | ||
} | ||
const decodeInput = decodeEffect(Schema.to(schema.input)); | ||
const encodeOutput = encode(schema.output); | ||
const encodeOutput = "output" in schema ? encode(schema.output) : _ => Effect.unit; | ||
return { | ||
@@ -141,0 +141,0 @@ ...acc, |
{ | ||
"name": "@effect/rpc", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"description": "", | ||
@@ -33,8 +33,8 @@ "main": "dist/effect-rpc.cjs.js", | ||
"devDependencies": { | ||
"@effect/schema": "^0.41.0", | ||
"effect": "2.0.0-next.46" | ||
"@effect/schema": "^0.42.0", | ||
"effect": "2.0.0-next.47" | ||
}, | ||
"peerDependencies": { | ||
"@effect/schema": "^0.41.0", | ||
"effect": "2.0.0-next.46" | ||
"@effect/schema": "^0.42.0", | ||
"effect": "2.0.0-next.47" | ||
}, | ||
@@ -106,3 +106,3 @@ "files": [ | ||
"example": "ts-node --project tsconfig.examples.json", | ||
"lint": "eslint --ext .ts,.tsx src/**/* test/**/*", | ||
"lint": "eslint src/**/*.ts test/**/*.ts", | ||
"tc": "tsc --noEmit", | ||
@@ -109,0 +109,0 @@ "test": "vitest", |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var Layer = require('effect/Layer'); | ||
var server = require('../../dist/server-60859473.cjs.dev.js'); | ||
var server = require('../../dist/server-7fa401c8.cjs.dev.js'); | ||
require('@effect/schema/Schema'); | ||
@@ -20,3 +20,3 @@ require('effect/Context'); | ||
require('../../dist/codec-9e558b5b.cjs.dev.js'); | ||
require('../../dist/schema-3743c0fe.cjs.dev.js'); | ||
require('../../dist/schema-8954f941.cjs.dev.js'); | ||
@@ -23,0 +23,0 @@ function _interopNamespace(e) { |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var Layer = require('effect/Layer'); | ||
var server = require('../../dist/server-671e5ac8.cjs.prod.js'); | ||
var server = require('../../dist/server-b4aa5c4d.cjs.prod.js'); | ||
require('@effect/schema/Schema'); | ||
@@ -20,3 +20,3 @@ require('effect/Context'); | ||
require('../../dist/codec-5a821358.cjs.prod.js'); | ||
require('../../dist/schema-a76bb547.cjs.prod.js'); | ||
require('../../dist/schema-343e348a.cjs.prod.js'); | ||
@@ -23,0 +23,0 @@ function _interopNamespace(e) { |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var Schema = require('@effect/schema/Schema'); | ||
var schema = require('../../dist/schema-3743c0fe.cjs.dev.js'); | ||
var schema = require('../../dist/schema-8954f941.cjs.dev.js'); | ||
require('effect/Function'); | ||
@@ -98,8 +98,2 @@ require('../../dist/codec-9e558b5b.cjs.dev.js'); | ||
*/ | ||
const context = () => Schema__namespace.any; | ||
/** | ||
* @category constructors | ||
* @since 1.0.0 | ||
*/ | ||
const makeRequestUnion = schema => Schema__namespace.union(...Object.entries(schema).map(([tag, schema]) => "input" in schema ? Schema__namespace.struct({ | ||
@@ -117,3 +111,2 @@ _tag: Schema__namespace.literal(tag), | ||
exports.RpcServiceId = RpcServiceId; | ||
exports.context = context; | ||
exports.make = make; | ||
@@ -120,0 +113,0 @@ exports.makeRequestUnion = makeRequestUnion; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var Schema = require('@effect/schema/Schema'); | ||
var schema = require('../../dist/schema-a76bb547.cjs.prod.js'); | ||
var schema = require('../../dist/schema-343e348a.cjs.prod.js'); | ||
require('effect/Function'); | ||
@@ -98,8 +98,2 @@ require('../../dist/codec-5a821358.cjs.prod.js'); | ||
*/ | ||
const context = () => Schema__namespace.any; | ||
/** | ||
* @category constructors | ||
* @since 1.0.0 | ||
*/ | ||
const makeRequestUnion = schema => Schema__namespace.union(...Object.entries(schema).map(([tag, schema]) => "input" in schema ? Schema__namespace.struct({ | ||
@@ -117,3 +111,2 @@ _tag: Schema__namespace.literal(tag), | ||
exports.RpcServiceId = RpcServiceId; | ||
exports.context = context; | ||
exports.make = make; | ||
@@ -120,0 +113,0 @@ exports.makeRequestUnion = makeRequestUnion; |
@@ -66,8 +66,2 @@ import * as Schema from '@effect/schema/Schema'; | ||
*/ | ||
const context = () => Schema.any; | ||
/** | ||
* @category constructors | ||
* @since 1.0.0 | ||
*/ | ||
const makeRequestUnion = schema => Schema.union(...Object.entries(schema).map(([tag, schema]) => "input" in schema ? Schema.struct({ | ||
@@ -80,2 +74,2 @@ _tag: Schema.literal(tag), | ||
export { RpcRequestSchema, RpcSchema, RpcService, RpcServiceErrorId, RpcServiceId, context, make, makeRequestUnion, makeWith, withServiceError }; | ||
export { RpcRequestSchema, RpcSchema, RpcService, RpcServiceErrorId, RpcServiceId, make, makeRequestUnion, makeWith, withServiceError }; |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var server = require('../../dist/server-60859473.cjs.dev.js'); | ||
var server = require('../../dist/server-7fa401c8.cjs.dev.js'); | ||
require('@effect/schema/Schema'); | ||
@@ -20,3 +20,3 @@ require('effect/Context'); | ||
require('../../dist/codec-9e558b5b.cjs.dev.js'); | ||
require('../../dist/schema-3743c0fe.cjs.dev.js'); | ||
require('../../dist/schema-8954f941.cjs.dev.js'); | ||
@@ -23,0 +23,0 @@ /** |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var server = require('../../dist/server-671e5ac8.cjs.prod.js'); | ||
var server = require('../../dist/server-b4aa5c4d.cjs.prod.js'); | ||
require('@effect/schema/Schema'); | ||
@@ -20,3 +20,3 @@ require('effect/Context'); | ||
require('../../dist/codec-5a821358.cjs.prod.js'); | ||
require('../../dist/schema-a76bb547.cjs.prod.js'); | ||
require('../../dist/schema-343e348a.cjs.prod.js'); | ||
@@ -23,0 +23,0 @@ /** |
@@ -26,2 +26,5 @@ /** | ||
: C extends RpcSchema.NoError<infer _II, infer I, infer _IO, infer O> ? (input: I) => Effect<R, RpcError | SE, O> | ||
: C extends RpcSchema.NoOutput<infer _IE, infer E, infer _II, infer I> ? | ||
(input: I) => Effect<R, RpcError | SE | E, void> | ||
: C extends RpcSchema.NoErrorNoOutput<infer _II, infer I> ? (input: I) => Effect<R, RpcError | SE, void> | ||
: C extends RpcSchema.NoInput<infer _IE, infer E, infer _IO, infer O> ? Effect<R, RpcError | SE | E, O> | ||
@@ -28,0 +31,0 @@ : C extends RpcSchema.NoInputNoError<infer _IO, infer O> ? Effect<R, RpcError | SE, O> |
import type * as Schema from "@effect/schema/Schema" | ||
import * as Effect from "effect/Effect" | ||
import * as Either from "effect/Either" | ||
import { pipe } from "effect/Function" | ||
@@ -17,3 +18,4 @@ import type * as client from "../Client" | ||
return (method: RpcService.Methods<S>, output: unknown) => { | ||
const result = map[method as string].output(output) | ||
const codec = map[method as string].output | ||
const result = codec ? codec(output) : Either.right(void 0) | ||
if (result._tag !== "Left") { | ||
@@ -152,3 +154,3 @@ return result.right as unknown | ||
) | ||
const parseOutput = codec.decodeEffect(schema.output) | ||
const parseOutput = "output" in schema ? codec.decodeEffect(schema.output) : (_: any) => Effect.unit | ||
@@ -155,0 +157,0 @@ if ("input" in schema) { |
@@ -39,3 +39,3 @@ import * as Schema from "@effect/schema/Schema" | ||
input?: Schema.Schema<any> | ||
output: Schema.Schema<any> | ||
output?: Schema.Schema<any> | ||
error: Schema.Schema<any> | ||
@@ -87,3 +87,3 @@ }) => A | ||
input: schema.input ? decode(schema.input) : undefined, | ||
output: encode(schema.output), | ||
output: schema.output ? encode(schema.output) : undefined, | ||
error: encode(schema.error) | ||
@@ -95,3 +95,3 @@ })) | ||
input: schema.input ? encode(schema.input) : undefined, | ||
output: decode(schema.output), | ||
output: schema.output ? decode(schema.output) : undefined, | ||
error: decode(schema.error) | ||
@@ -98,0 +98,0 @@ })) |
@@ -122,3 +122,5 @@ import * as Schema from "@effect/schema/Schema" | ||
: effect, | ||
Effect.map(codecs.output), | ||
codecs.output ? | ||
Effect.map(codecs.output) : | ||
Effect.asUnit, | ||
Effect.catchAll((_) => Effect.succeed(Either.flatMap(codecs.error(_), Either.left))) | ||
@@ -327,3 +329,5 @@ ) as Effect.Effect<any, never, Either.Either<RpcError, unknown>> | ||
definition, | ||
Effect.flatMap(codec.encode(schema.output)), | ||
"output" in schema ? | ||
Effect.flatMap(codec.encode(schema.output)) : | ||
Effect.asUnit, | ||
Effect.withSpan(`${options.spanPrefix}.undecoded.${method}`) | ||
@@ -335,3 +339,3 @@ ) | ||
const decodeInput = codec.decodeEffect(Schema.to((schema as any).input)) | ||
const encodeOutput = codec.encode(schema.output) | ||
const encodeOutput = "output" in schema ? codec.encode(schema.output) : (_: any) => Effect.unit | ||
@@ -338,0 +342,0 @@ return { |
@@ -70,15 +70,11 @@ /** | ||
*/ | ||
export type FromSetupSchema<C extends RpcSchema.Any> = C extends RpcSchema.IO< | ||
export type FromSetupSchema<C> = C extends RpcSchema.NoOutput< | ||
infer _IE, | ||
infer E, | ||
infer _II, | ||
infer I, | ||
infer _IO, | ||
infer O | ||
> ? O extends Context<infer A> ? IO<any, E, I, Context<A>> | IOLayer<any, E, I, A> | ||
infer I | ||
> ? IO<any, E, I, Context<any>> | IOLayer<any, E, I, any> | ||
: C extends RpcSchema.NoErrorNoOutput<infer _II, infer I> | ||
? IO<any, never, I, Context<any>> | IOLayer<any, never, I, any> | ||
: never | ||
: C extends RpcSchema.NoError<infer _II, infer I, infer _IO, infer O> | ||
? O extends Context<infer A> ? IO<any, never, I, Context<A>> | IOLayer<any, never, I, A> | ||
: never | ||
: never | ||
@@ -117,4 +113,4 @@ /** | ||
]: S[K] extends RpcService.DefinitionWithId ? { handlers: FromService<S[K]> } | ||
: S[K] extends RpcSchema.Any ? K extends "__setup" ? RpcHandler.FromSetupSchema<S[K]> | ||
: RpcHandler.FromSchema<S[K]> | ||
: K extends "__setup" ? RpcHandler.FromSetupSchema<S[K]> : | ||
S[K] extends RpcSchema.Any ? RpcHandler.FromSchema<S[K]> | ||
: never | ||
@@ -121,0 +117,0 @@ } |
@@ -5,3 +5,2 @@ /** | ||
import * as Schema from "@effect/schema/Schema" | ||
import type { Context } from "effect/Context" | ||
import * as internal from "./internal/schema" | ||
@@ -55,2 +54,19 @@ import type { Json } from "./internal/schema" | ||
*/ | ||
export interface NoOutput<IE, E, II, I> { | ||
input: Schema.Schema<II, I> | ||
error: Schema.Schema<IE, E> | ||
} | ||
/** | ||
* @category models | ||
* @since 1.0.0 | ||
*/ | ||
export interface NoErrorNoOutput<II, I> { | ||
input: Schema.Schema<II, I> | ||
} | ||
/** | ||
* @category models | ||
* @since 1.0.0 | ||
*/ | ||
export type Any = | ||
@@ -61,2 +77,4 @@ | IO<any, any, any, any, any, any> | ||
| NoInputNoError<any, any> | ||
| NoOutput<any, any, any, any> | ||
| NoErrorNoOutput<any, any> | ||
@@ -69,3 +87,3 @@ /** | ||
readonly input?: Schema.Schema<any> | ||
readonly output: Schema.Schema<any> | ||
readonly output?: Schema.Schema<any> | ||
readonly error: Schema.Schema<any> | ||
@@ -78,3 +96,3 @@ } | ||
*/ | ||
export type Input<S extends RpcSchema.Any> = S extends { | ||
export type Input<S> = S extends { | ||
readonly input: Schema.Schema<infer _I, infer A> | ||
@@ -88,3 +106,3 @@ } ? A | ||
*/ | ||
export type Error<S extends RpcSchema.Any> = S extends { | ||
export type Error<S> = S extends { | ||
readonly error: Schema.Schema<infer _I, infer A> | ||
@@ -98,3 +116,3 @@ } ? A | ||
*/ | ||
export type Output<S extends RpcSchema.Any> = S extends { | ||
export type Output<S> = S extends { | ||
readonly output: Schema.Schema<infer _I, infer A> | ||
@@ -135,4 +153,4 @@ } ? A | ||
__setup?: | ||
| RpcSchema.IO<any, any, any, any, Context<any>, Context<any>> | ||
| RpcSchema.NoError<any, any, Context<any>, Context<any>> | ||
| RpcSchema.NoErrorNoOutput<any, any> | ||
| RpcSchema.NoOutput<any, any, any, any> | ||
} | ||
@@ -212,10 +230,2 @@ | ||
*/ | ||
export type SetupOutput<S extends DefinitionWithSetup> = RpcSchema.Output< | ||
S["__setup"] | ||
> | ||
/** | ||
* @category utils | ||
* @since 1.0.0 | ||
*/ | ||
export type Methods<S extends DefinitionWithId, P extends string = ``> = { | ||
@@ -401,8 +411,2 @@ [M in keyof S]: M extends string ? S[M] extends DefinitionWithId ? Methods<S[M], `${P}${M}.`> | ||
*/ | ||
export const context = <R>(): Schema.Schema<Context<R>> => Schema.any | ||
/** | ||
* @category constructors | ||
* @since 1.0.0 | ||
*/ | ||
export const makeRequestUnion = <S extends RpcService.Definition>( | ||
@@ -409,0 +413,0 @@ schema: S |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
243423
129
6400