@orpc/server 0.0.0-next.d42488d → 0.0.0-next.d7b5662
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-FN62GL22.js → chunk-YAVPFNPF.js} +1 -1
- package/dist/fetch.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/lazy-decorated.d.ts +1 -1
- package/dist/src/procedure-client.d.ts +8 -3
- package/dist/src/procedure-decorated.d.ts +1 -1
- package/dist/src/router-client.d.ts +3 -3
- package/package.json +3 -3
package/dist/fetch.js
CHANGED
package/dist/index.js
CHANGED
@@ -3,7 +3,7 @@ import type { Lazy } from './lazy';
|
|
3
3
|
import type { Procedure } from './procedure';
|
4
4
|
import type { ProcedureClient } from './procedure-client';
|
5
5
|
import { type ANY_ROUTER } from './router';
|
6
|
-
export type DecoratedLazy<T> = T extends Lazy<infer U> ? DecoratedLazy<U> : Lazy<T> & (T extends Procedure<infer UContext, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput> ? undefined extends UContext ? ProcedureClient<SchemaInput<UInputSchema>, SchemaOutput<UOutputSchema, UFuncOutput
|
6
|
+
export type DecoratedLazy<T> = T extends Lazy<infer U> ? DecoratedLazy<U> : Lazy<T> & (T extends Procedure<infer UContext, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput> ? undefined extends UContext ? ProcedureClient<SchemaInput<UInputSchema>, SchemaOutput<UOutputSchema, UFuncOutput>, unknown> : unknown : {
|
7
7
|
[K in keyof T]: T[K] extends object ? DecoratedLazy<T[K]> : never;
|
8
8
|
});
|
9
9
|
export declare function decorateLazy<T extends Lazy<ANY_ROUTER | undefined>>(lazied: T): DecoratedLazy<T>;
|
@@ -3,8 +3,13 @@ import type { Hooks, Value } from '@orpc/shared';
|
|
3
3
|
import type { Lazyable } from './lazy';
|
4
4
|
import type { Procedure } from './procedure';
|
5
5
|
import type { Context, Meta, WELL_CONTEXT, WithSignal } from './types';
|
6
|
-
export
|
7
|
-
|
6
|
+
export type ProcedureClientOptions<TClientContext> = WithSignal & (undefined extends TClientContext ? {
|
7
|
+
context?: TClientContext;
|
8
|
+
} : {
|
9
|
+
context: TClientContext;
|
10
|
+
});
|
11
|
+
export interface ProcedureClient<TInput, TOutput, TClientContext> {
|
12
|
+
(...opts: [input: TInput, options: ProcedureClientOptions<TClientContext>] | (undefined extends TInput & TClientContext ? [] : never) | (undefined extends TClientContext ? [input: TInput] : never)): Promise<TOutput>;
|
8
13
|
}
|
9
14
|
/**
|
10
15
|
* Options for creating a procedure caller with comprehensive type safety
|
@@ -25,5 +30,5 @@ export type CreateProcedureClientOptions<TContext extends Context, TInputSchema
|
|
25
30
|
} | (undefined extends TContext ? {
|
26
31
|
context?: undefined;
|
27
32
|
} : never)) & Hooks<unknown, SchemaOutput<TOutputSchema, TFuncOutput>, TContext, Meta>;
|
28
|
-
export declare function createProcedureClient<TContext extends Context = WELL_CONTEXT, TInputSchema extends Schema = undefined, TOutputSchema extends Schema = undefined, TFuncOutput extends SchemaInput<TOutputSchema> = SchemaInput<TOutputSchema>>(options: CreateProcedureClientOptions<TContext, TInputSchema, TOutputSchema, TFuncOutput>): ProcedureClient<SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, TFuncOutput
|
33
|
+
export declare function createProcedureClient<TContext extends Context = WELL_CONTEXT, TInputSchema extends Schema = undefined, TOutputSchema extends Schema = undefined, TFuncOutput extends SchemaInput<TOutputSchema> = SchemaInput<TOutputSchema>>(options: CreateProcedureClientOptions<TContext, TInputSchema, TOutputSchema, TFuncOutput>): ProcedureClient<SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, TFuncOutput>, unknown>;
|
29
34
|
//# sourceMappingURL=procedure-client.d.ts.map
|
@@ -9,6 +9,6 @@ export type DecoratedProcedure<TContext extends Context, TExtraContext extends C
|
|
9
9
|
use: (<U extends Context & Partial<MergeContext<TContext, TExtraContext>> | undefined = undefined>(middleware: Middleware<MergeContext<TContext, TExtraContext>, U, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema, TFuncOutput>>) => DecoratedProcedure<TContext, MergeContext<TExtraContext, U>, TInputSchema, TOutputSchema, TFuncOutput>) & (<UExtra extends Context & Partial<MergeContext<TContext, TExtraContext>> | undefined = undefined, UInput = unknown>(middleware: Middleware<MergeContext<TContext, TExtraContext>, UExtra, UInput, SchemaInput<TOutputSchema, TFuncOutput>>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema, TFuncOutput>, UInput>) => DecoratedProcedure<TContext, MergeContext<TExtraContext, UExtra>, TInputSchema, TOutputSchema, TFuncOutput>);
|
10
10
|
unshiftTag: (...tags: string[]) => DecoratedProcedure<TContext, TExtraContext, TInputSchema, TOutputSchema, TFuncOutput>;
|
11
11
|
unshiftMiddleware: <U extends Context & Partial<MergeContext<TContext, TExtraContext>> | undefined = undefined>(...middlewares: Middleware<TContext, U, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema, TFuncOutput>>[]) => DecoratedProcedure<TContext, TExtraContext, TInputSchema, TOutputSchema, TFuncOutput>;
|
12
|
-
} & (undefined extends TContext ? ProcedureClient<SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, TFuncOutput
|
12
|
+
} & (undefined extends TContext ? ProcedureClient<SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, TFuncOutput>, unknown> : unknown);
|
13
13
|
export declare function decorateProcedure<TContext extends Context, TExtraContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TFuncOutput extends SchemaInput<TOutputSchema>>(procedure: Procedure<TContext, TExtraContext, TInputSchema, TOutputSchema, TFuncOutput>): DecoratedProcedure<TContext, TExtraContext, TInputSchema, TOutputSchema, TFuncOutput>;
|
14
14
|
//# sourceMappingURL=procedure-decorated.d.ts.map
|
@@ -5,8 +5,8 @@ import type { Procedure } from './procedure';
|
|
5
5
|
import type { ProcedureClient } from './procedure-client';
|
6
6
|
import type { Meta } from './types';
|
7
7
|
import { type ANY_ROUTER, type Router } from './router';
|
8
|
-
export type RouterClient<
|
9
|
-
[K in keyof
|
8
|
+
export type RouterClient<TRouter extends ANY_ROUTER | ContractRouter, TClientContext> = TRouter extends Lazy<infer U extends ANY_ROUTER | ContractRouter> ? RouterClient<U, TClientContext> : TRouter extends ContractProcedure<infer UInputSchema, infer UOutputSchema> | Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput> ? ProcedureClient<SchemaInput<UInputSchema>, SchemaOutput<UOutputSchema, UFuncOutput>, TClientContext> : {
|
9
|
+
[K in keyof TRouter]: TRouter[K] extends ANY_ROUTER | ContractRouter ? RouterClient<TRouter[K], TClientContext> : never;
|
10
10
|
};
|
11
11
|
export type CreateRouterClientOptions<TRouter extends ANY_ROUTER> = {
|
12
12
|
router: TRouter | Lazy<undefined>;
|
@@ -21,5 +21,5 @@ export type CreateRouterClientOptions<TRouter extends ANY_ROUTER> = {
|
|
21
21
|
} : {
|
22
22
|
context: Value<UContext>;
|
23
23
|
} : never) & Hooks<unknown, unknown, TRouter extends Router<infer UContext, any> ? UContext : never, Meta>;
|
24
|
-
export declare function createRouterClient<TRouter extends ANY_ROUTER>(options: CreateRouterClientOptions<TRouter>): RouterClient<TRouter>;
|
24
|
+
export declare function createRouterClient<TRouter extends ANY_ROUTER>(options: CreateRouterClientOptions<TRouter>): RouterClient<TRouter, unknown>;
|
25
25
|
//# sourceMappingURL=router-client.d.ts.map
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/server",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.0-next.
|
4
|
+
"version": "0.0.0-next.d7b5662",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -34,8 +34,8 @@
|
|
34
34
|
"dist"
|
35
35
|
],
|
36
36
|
"dependencies": {
|
37
|
-
"@orpc/
|
38
|
-
"@orpc/
|
37
|
+
"@orpc/contract": "0.0.0-next.d7b5662",
|
38
|
+
"@orpc/shared": "0.0.0-next.d7b5662"
|
39
39
|
},
|
40
40
|
"devDependencies": {
|
41
41
|
"zod": "^3.24.1"
|