@orpc/client
Advanced tools
Comparing version 0.0.0-next-20241123144325 to 0.0.0-next-20241126025042
import type { Promisable } from '@orpc/shared'; | ||
import { type Schema, type SchemaInput, type SchemaOutput } from '@orpc/contract'; | ||
export interface ProcedureClient<TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaOutput<TOutputSchema>> { | ||
(input: SchemaInput<TInputSchema>): Promise<SchemaOutput<TOutputSchema, THandlerOutput>>; | ||
export interface ProcedureClient<TInputSchema extends Schema, TOutputSchema extends Schema, TFuncOutput extends SchemaOutput<TOutputSchema>> { | ||
(input: SchemaInput<TInputSchema>): Promise<SchemaOutput<TOutputSchema, TFuncOutput>>; | ||
} | ||
@@ -26,3 +26,3 @@ export interface CreateProcedureClientOptions { | ||
} | ||
export declare function createProcedureClient<TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaOutput<TOutputSchema>>(options: CreateProcedureClientOptions): ProcedureClient<TInputSchema, TOutputSchema, THandlerOutput>; | ||
export declare function createProcedureClient<TInputSchema extends Schema, TOutputSchema extends Schema, TFuncOutput extends SchemaOutput<TOutputSchema>>(options: CreateProcedureClientOptions): ProcedureClient<TInputSchema, TOutputSchema, TFuncOutput>; | ||
//# sourceMappingURL=procedure.d.ts.map |
@@ -9,3 +9,3 @@ import type { ContractProcedure, ContractRouter, SchemaOutput } from '@orpc/contract'; | ||
export type RouterClientWithRouter<TRouter extends Router<any>> = { | ||
[K in keyof TRouter]: TRouter[K] extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UHandlerOutput> ? ProcedureClient<UInputSchema, UOutputSchema, UHandlerOutput> : TRouter[K] extends Router<any> ? RouterClientWithRouter<TRouter[K]> : never; | ||
[K in keyof TRouter]: TRouter[K] extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput> ? ProcedureClient<UInputSchema, UOutputSchema, UFuncOutput> : TRouter[K] extends Router<any> ? RouterClientWithRouter<TRouter[K]> : never; | ||
}; | ||
@@ -12,0 +12,0 @@ export interface CreateRouterClientOptions { |
{ | ||
"name": "@orpc/client", | ||
"type": "module", | ||
"version": "0.0.0-next-20241123144325", | ||
"version": "0.0.0-next-20241126025042", | ||
"author": { | ||
@@ -38,9 +38,9 @@ "name": "unnoq", | ||
"dependencies": { | ||
"@orpc/shared": "0.0.5", | ||
"@orpc/transformer": "0.0.4" | ||
"@orpc/shared": "0.0.0-next-20241126025042", | ||
"@orpc/transformer": "0.0.0-next-20241126025042" | ||
}, | ||
"devDependencies": { | ||
"zod": "^3.23.8", | ||
"@orpc/contract": "0.0.0-next-20241123144325", | ||
"@orpc/server": "0.0.0-next-20241123144325" | ||
"@orpc/contract": "0.0.0-next-20241126025042", | ||
"@orpc/server": "0.0.0-next-20241126025042" | ||
}, | ||
@@ -47,0 +47,0 @@ "scripts": { |
@@ -10,3 +10,3 @@ import { ORPCError, os } from '@orpc/server' | ||
}) | ||
const ping = os.input(schema).handler((_, __, { path }) => path) | ||
const ping = os.input(schema).func((_, __, { path }) => path) | ||
const router = os.router({ | ||
@@ -115,3 +115,3 @@ ping, | ||
.input(z.object({ value: z.date() })) | ||
.handler(input => input.value), | ||
.func(input => input.value), | ||
}) | ||
@@ -142,3 +142,3 @@ | ||
const router = os.router({ | ||
ping: os.handler((input) => { | ||
ping: os.func((input) => { | ||
throw new ORPCError({ | ||
@@ -186,3 +186,3 @@ code: 'BAD_GATEWAY', | ||
const router = os.router({ | ||
signal: os.input(z.instanceof(Blob)).handler((input) => { | ||
signal: os.input(z.instanceof(Blob)).func((input) => { | ||
return input | ||
@@ -194,3 +194,3 @@ }), | ||
) | ||
.handler((input) => { | ||
.func((input) => { | ||
return input | ||
@@ -197,0 +197,0 @@ }), |
@@ -19,7 +19,7 @@ /// <reference lib="dom" /> | ||
TOutputSchema extends Schema, | ||
THandlerOutput extends SchemaOutput<TOutputSchema>, | ||
TFuncOutput extends SchemaOutput<TOutputSchema>, | ||
> { | ||
( | ||
input: SchemaInput<TInputSchema>, | ||
): Promise<SchemaOutput<TOutputSchema, THandlerOutput>> | ||
): Promise<SchemaOutput<TOutputSchema, TFuncOutput>> | ||
} | ||
@@ -54,6 +54,6 @@ | ||
TOutputSchema extends Schema, | ||
THandlerOutput extends SchemaOutput<TOutputSchema>, | ||
TFuncOutput extends SchemaOutput<TOutputSchema>, | ||
>( | ||
options: CreateProcedureClientOptions, | ||
): ProcedureClient<TInputSchema, TOutputSchema, THandlerOutput> { | ||
): ProcedureClient<TInputSchema, TOutputSchema, TFuncOutput> { | ||
const serializer = new ORPCSerializer() | ||
@@ -60,0 +60,0 @@ const deserializer = new ORPCDeserializer() |
@@ -11,3 +11,3 @@ import { oc } from '@orpc/contract' | ||
}) | ||
const ping = os.input(schema).handler((_, __, { path }) => path) | ||
const ping = os.input(schema).func((_, __, { path }) => path) | ||
const router = os.router({ | ||
@@ -69,5 +69,5 @@ ping, | ||
}) | ||
const ping = os.input(schema).handler(() => '') | ||
const pong = os.output(schema).handler(() => ({ value: 'string' })) | ||
const peng = os.route({}).handler(() => ({ age: 1244 })) | ||
const ping = os.input(schema).func(() => '') | ||
const pong = os.output(schema).func(() => ({ value: 'string' })) | ||
const peng = os.route({}).func(() => ({ age: 1244 })) | ||
@@ -128,3 +128,3 @@ const router = os.router({ | ||
.input(z.object({ value: z.date() })) | ||
.handler(input => input.value), | ||
.func(input => input.value), | ||
}) | ||
@@ -131,0 +131,0 @@ |
@@ -29,5 +29,5 @@ /// <reference lib="dom" /> | ||
infer UOutputSchema, | ||
infer UHandlerOutput | ||
infer UFuncOutput | ||
> | ||
? ProcedureClient<UInputSchema, UOutputSchema, UHandlerOutput> | ||
? ProcedureClient<UInputSchema, UOutputSchema, UFuncOutput> | ||
: TRouter[K] extends Router<any> | ||
@@ -34,0 +34,0 @@ ? RouterClientWithRouter<TRouter[K]> |
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
106994
+ Added@orpc/shared@0.0.0-next-20241126025042(transitive)
+ Added@orpc/transformer@0.0.0-next-20241126025042(transitive)
- Removed@orpc/shared@0.0.5(transitive)
- Removed@orpc/transformer@0.0.4(transitive)