@trpc/server 9.7.0 → 9.8.1-alpha.1
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/adapters/express/dist/trpc-server-adapters-express.cjs.dev.js +1 -1
- package/adapters/express/dist/trpc-server-adapters-express.cjs.prod.js +1 -1
- package/adapters/express/dist/trpc-server-adapters-express.esm.js +1 -1
- package/adapters/next/dist/trpc-server-adapters-next.cjs.dev.js +1 -1
- package/adapters/next/dist/trpc-server-adapters-next.cjs.prod.js +1 -1
- package/adapters/next/dist/trpc-server-adapters-next.esm.js +1 -1
- package/adapters/node-http/dist/trpc-server-adapters-node-http.cjs.dev.js +1 -1
- package/adapters/node-http/dist/trpc-server-adapters-node-http.cjs.prod.js +1 -1
- package/adapters/node-http/dist/trpc-server-adapters-node-http.esm.js +1 -1
- package/adapters/standalone/dist/trpc-server-adapters-standalone.cjs.dev.js +1 -1
- package/adapters/standalone/dist/trpc-server-adapters-standalone.cjs.prod.js +1 -1
- package/adapters/standalone/dist/trpc-server-adapters-standalone.esm.js +1 -1
- package/dist/declarations/src/internals/procedure.d.ts +3 -10
- package/dist/declarations/src/internals/procedure.d.ts.map +1 -1
- package/dist/declarations/src/router.d.ts +4 -4
- package/dist/declarations/src/router.d.ts.map +1 -1
- package/dist/{nodeHTTPRequestHandler-3c64002f.esm.js → nodeHTTPRequestHandler-716fb8d7.esm.js} +1 -1
- package/dist/{nodeHTTPRequestHandler-d18bd586.cjs.prod.js → nodeHTTPRequestHandler-76403d9b.cjs.prod.js} +1 -1
- package/dist/{nodeHTTPRequestHandler-a20cbe34.cjs.dev.js → nodeHTTPRequestHandler-827c7c7e.cjs.dev.js} +1 -1
- package/dist/trpc-server.cjs.dev.js +13 -32
- package/dist/trpc-server.cjs.prod.js +13 -32
- package/dist/trpc-server.esm.js +14 -33
- package/package.json +2 -2
- package/src/assertNotBrowser.ts +1 -1
- package/src/internals/procedure.ts +21 -61
- package/src/router.ts +22 -21
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-
|
|
5
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-827c7c7e.cjs.dev.js');
|
|
6
6
|
require('url');
|
|
7
7
|
require('../../../dist/transformTRPCResponse-8248515e.cjs.dev.js');
|
|
8
8
|
require('../../../dist/codes-a0cce7aa.cjs.dev.js');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-
|
|
5
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-76403d9b.cjs.prod.js');
|
|
6
6
|
require('url');
|
|
7
7
|
require('../../../dist/transformTRPCResponse-dcbf66c5.cjs.prod.js');
|
|
8
8
|
require('../../../dist/codes-6b99b935.cjs.prod.js');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as nodeHTTPRequestHandler } from '../../../dist/nodeHTTPRequestHandler-
|
|
1
|
+
import { n as nodeHTTPRequestHandler } from '../../../dist/nodeHTTPRequestHandler-716fb8d7.esm.js';
|
|
2
2
|
import 'url';
|
|
3
3
|
import '../../../dist/transformTRPCResponse-f73dc4a2.esm.js';
|
|
4
4
|
import '../../../dist/codes-3dd40769.esm.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var transformTRPCResponse = require('../../../dist/transformTRPCResponse-8248515e.cjs.dev.js');
|
|
6
|
-
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-
|
|
6
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-827c7c7e.cjs.dev.js');
|
|
7
7
|
require('url');
|
|
8
8
|
require('../../../dist/codes-a0cce7aa.cjs.dev.js');
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var transformTRPCResponse = require('../../../dist/transformTRPCResponse-dcbf66c5.cjs.prod.js');
|
|
6
|
-
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-
|
|
6
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-76403d9b.cjs.prod.js');
|
|
7
7
|
require('url');
|
|
8
8
|
require('../../../dist/codes-6b99b935.cjs.prod.js');
|
|
9
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { T as TRPCError } from '../../../dist/transformTRPCResponse-f73dc4a2.esm.js';
|
|
2
|
-
import { n as nodeHTTPRequestHandler } from '../../../dist/nodeHTTPRequestHandler-
|
|
2
|
+
import { n as nodeHTTPRequestHandler } from '../../../dist/nodeHTTPRequestHandler-716fb8d7.esm.js';
|
|
3
3
|
import 'url';
|
|
4
4
|
import '../../../dist/codes-3dd40769.esm.js';
|
|
5
5
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-
|
|
5
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-827c7c7e.cjs.dev.js');
|
|
6
6
|
require('url');
|
|
7
7
|
require('../../../dist/transformTRPCResponse-8248515e.cjs.dev.js');
|
|
8
8
|
require('../../../dist/codes-a0cce7aa.cjs.dev.js');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-
|
|
5
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-76403d9b.cjs.prod.js');
|
|
6
6
|
require('url');
|
|
7
7
|
require('../../../dist/transformTRPCResponse-dcbf66c5.cjs.prod.js');
|
|
8
8
|
require('../../../dist/codes-6b99b935.cjs.prod.js');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { n as nodeHTTPRequestHandler } from '../../../dist/nodeHTTPRequestHandler-
|
|
1
|
+
export { n as nodeHTTPRequestHandler } from '../../../dist/nodeHTTPRequestHandler-716fb8d7.esm.js';
|
|
2
2
|
import 'url';
|
|
3
3
|
import '../../../dist/transformTRPCResponse-f73dc4a2.esm.js';
|
|
4
4
|
import '../../../dist/codes-3dd40769.esm.js';
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var http = require('http');
|
|
6
6
|
var url = require('url');
|
|
7
|
-
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-
|
|
7
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-827c7c7e.cjs.dev.js');
|
|
8
8
|
require('../../../dist/transformTRPCResponse-8248515e.cjs.dev.js');
|
|
9
9
|
require('../../../dist/codes-a0cce7aa.cjs.dev.js');
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var http = require('http');
|
|
6
6
|
var url = require('url');
|
|
7
|
-
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-
|
|
7
|
+
var nodeHTTPRequestHandler = require('../../../dist/nodeHTTPRequestHandler-76403d9b.cjs.prod.js');
|
|
8
8
|
require('../../../dist/transformTRPCResponse-dcbf66c5.cjs.prod.js');
|
|
9
9
|
require('../../../dist/codes-6b99b935.cjs.prod.js');
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
2
|
import url from 'url';
|
|
3
|
-
import { n as nodeHTTPRequestHandler } from '../../../dist/nodeHTTPRequestHandler-
|
|
3
|
+
import { n as nodeHTTPRequestHandler } from '../../../dist/nodeHTTPRequestHandler-716fb8d7.esm.js';
|
|
4
4
|
import '../../../dist/transformTRPCResponse-f73dc4a2.esm.js';
|
|
5
5
|
import '../../../dist/codes-3dd40769.esm.js';
|
|
6
6
|
|
|
@@ -30,8 +30,7 @@ export interface ProcedureCallOptions<TContext> {
|
|
|
30
30
|
/**
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
33
|
-
export declare
|
|
34
|
-
TContext, TInput, TOutput> {
|
|
33
|
+
export declare class Procedure<TInputContext, TContext, TInput, TOutput> {
|
|
35
34
|
private middlewares;
|
|
36
35
|
private resolver;
|
|
37
36
|
private readonly inputParser;
|
|
@@ -49,10 +48,6 @@ TContext, TInput, TOutput> {
|
|
|
49
48
|
*/
|
|
50
49
|
inheritMiddlewares(middlewares: MiddlewareFunction<TInputContext, TContext>[]): this;
|
|
51
50
|
}
|
|
52
|
-
export declare class ProcedureWithoutInput<TInputContext, TContext, TOutput> extends Procedure<TInputContext, TContext, undefined, TOutput> {
|
|
53
|
-
}
|
|
54
|
-
export declare class ProcedureWithInput<TInputContext, TContext, TInput, TOutput> extends Procedure<TInputContext, TContext, TInput, TOutput> {
|
|
55
|
-
}
|
|
56
51
|
export declare type CreateProcedureWithInput<TContext, TInput, TOutput> = {
|
|
57
52
|
input: ProcedureInputParser<TInput>;
|
|
58
53
|
resolve: ProcedureResolver<TContext, TInput, TOutput>;
|
|
@@ -61,9 +56,7 @@ export declare type CreateProcedureWithoutInput<TContext, TOutput> = {
|
|
|
61
56
|
resolve: ProcedureResolver<TContext, undefined, TOutput>;
|
|
62
57
|
};
|
|
63
58
|
export declare type CreateProcedureOptions<TContext = unknown, TInput = unknown, TOutput = unknown> = CreateProcedureWithInput<TContext, TInput, TOutput> | CreateProcedureWithoutInput<TContext, TOutput>;
|
|
64
|
-
export declare function createProcedure<
|
|
65
|
-
export declare
|
|
66
|
-
export declare function createProcedure<TInputContext, TContext, TInput, TOutput>(opts: CreateProcedureOptions<TContext, TInput, TOutput>): Procedure<TInputContext, TContext, TInput, TOutput>;
|
|
67
|
-
export declare type inferProcedureFromOptions<TInputContext, TOptions extends CreateProcedureOptions<any, any, any>> = TOptions extends CreateProcedureWithInput<infer TContext, infer TInput, infer TOutput> ? ProcedureWithInput<TInputContext, TContext, TInput, TOutput> : TOptions extends CreateProcedureWithoutInput<infer TContext, infer TOutput> ? ProcedureWithoutInput<TInputContext, TContext, TOutput> : Procedure<unknown, unknown, unknown, unknown>;
|
|
59
|
+
export declare function createProcedure<TContext, TInput, TOutput>(opts: CreateProcedureOptions<TContext, TInput, TOutput>): Procedure<unknown, TContext, TInput, TOutput>;
|
|
60
|
+
export declare type inferProcedureFromOptions<TInputContext, TOptions extends CreateProcedureOptions<any, any, any>> = TOptions extends CreateProcedureOptions<infer TContext, infer TInput, infer TOutput> ? Procedure<TInputContext, TContext, TInput, TOutput> : never;
|
|
68
61
|
export {};
|
|
69
62
|
//# sourceMappingURL=procedure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedure.d.ts","sourceRoot":"../../../../src/internals","sources":["procedure.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAoB,MAAM,eAAe,CAAC;AAMrE,oBAAY,4BAA4B,CAAC,MAAM,GAAG,OAAO,IAAI;IAC3D,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAC;CAC/B,CAAC;AAEF,oBAAY,wCAAwC,CAAC,MAAM,GAAG,OAAO,IAAI,CACvE,KAAK,EAAE,OAAO,KACX,MAAM,CAAC;AAEZ,oBAAY,4BAA4B,CAAC,MAAM,GAAG,OAAO,IAAI;IAC3D,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM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AQ,SAAS,sBAAsB,CACzC,MAAM,QAAQ,EACd,MAAM,MAAM,EACZ,MAAM,OAAO,CACd,GACG,SAAS,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,GACnD,KAAK,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MiddlewareFunction } from './internals/middlewares';
|
|
2
|
-
import { CreateProcedureWithInput, CreateProcedureWithoutInput, inferProcedureFromOptions, Procedure
|
|
2
|
+
import { CreateProcedureWithInput, CreateProcedureWithoutInput, inferProcedureFromOptions, Procedure } from './internals/procedure';
|
|
3
3
|
import { TRPCErrorShape, TRPC_ERROR_CODE_KEY, TRPC_ERROR_CODE_NUMBER } from './rpc';
|
|
4
4
|
import { Subscription } from './subscription';
|
|
5
5
|
import { CombinedDataTransformer, DataTransformerOptions } from './transformer';
|
|
@@ -16,7 +16,7 @@ export declare type ProcedureRecord<TInputContext = any, TContext = any, TInput
|
|
|
16
16
|
/**
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
|
-
export declare type inferProcedureInput<TProcedure extends Procedure<any, any, any, any>> = TProcedure extends
|
|
19
|
+
export declare type inferProcedureInput<TProcedure extends Procedure<any, any, any, any>> = TProcedure extends Procedure<any, any, infer Input, any> ? undefined extends Input ? Input | null | void : Input : undefined;
|
|
20
20
|
/**
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
@@ -33,7 +33,7 @@ export declare type inferSubscriptionOutput<TRouter extends AnyRouter, TPath ext
|
|
|
33
33
|
/**
|
|
34
34
|
* @internal
|
|
35
35
|
*/
|
|
36
|
-
export declare type inferHandlerInput<TProcedure extends Procedure<any, any, any, any>> = TProcedure extends
|
|
36
|
+
export declare type inferHandlerInput<TProcedure extends Procedure<any, any, any, any>> = TProcedure extends Procedure<any, any, infer TInput, any> ? undefined extends TInput ? unknown extends TInput ? [(null | undefined)?] : [(TInput | null | undefined)?] : [TInput] : [(undefined | null)?];
|
|
37
37
|
declare type inferHandlerFn<TProcedures extends ProcedureRecord> = <TProcedure extends TProcedures[TPath], TPath extends keyof TProcedures & string>(path: TPath, ...args: inferHandlerInput<TProcedure>) => Promise<inferProcedureOutput<TProcedures[TPath]>>;
|
|
38
38
|
/**
|
|
39
39
|
* @internal
|
|
@@ -71,7 +71,7 @@ export interface DefaultErrorShape extends TRPCErrorShape<TRPC_ERROR_CODE_NUMBER
|
|
|
71
71
|
message: string;
|
|
72
72
|
code: TRPC_ERROR_CODE_NUMBER;
|
|
73
73
|
}
|
|
74
|
-
declare type SwapProcedureContext<TProcedure extends Procedure<any, any, any, any>, TNewContext> = TProcedure extends
|
|
74
|
+
declare type SwapProcedureContext<TProcedure extends Procedure<any, any, any, any>, TNewContext> = TProcedure extends Procedure<infer TInputContext, infer _TOldContext, infer TInput, infer TOutput> ? Procedure<TInputContext, TNewContext, TInput, TOutput> : never;
|
|
75
75
|
declare type SwapContext<TObj extends ProcedureRecord<any, any, any, any>, TNewContext> = format<{
|
|
76
76
|
[P in keyof TObj]: SwapProcedureContext<TObj[P], TNewContext>;
|
|
77
77
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"../../../src","sources":["router.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAGL,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,SAAS,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"../../../src","sources":["router.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAGL,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,SAAS,EAEV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EAEd,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,g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,EAAE,MAAM,GAAG,SAAS,CAAC;QACzB,KAAK,EAAE,OAAO,CAAC;QACf,GAAG,EAAE,SAAS,GAAG,QAAQ,CAAC;KAC3B,GAAG,WAAW;IAuBf;;;OAGG;IACH,WAAW,CAAC,YAAY,EAAE,sBAAsB;CAoBjD;AAED;;;;GAIG;AACH,qBAAa,YAAY,CACvB,QAAQ,EACR,QAAQ,SAAS,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACpD,UAAU,SAAS,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACtD,cAAc,SAAS,eAAe,CACpC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,YAAY,CAAC,OAAO,CAAC,CACtB,EACD,WAAW,SAAS,cAAc,CAAC,MAAM,CAAC,CAC1C,SAAQ,MAAM,CACd,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,cAAc,EACd,WAAW,CACZ;CAAG;AAEJ,wBAAgB,MAAM,CAAC,QAAQ,+DAE9B"}
|
package/dist/{nodeHTTPRequestHandler-3c64002f.esm.js → nodeHTTPRequestHandler-716fb8d7.esm.js}
RENAMED
|
@@ -5,7 +5,7 @@ import { i as invert, T as TRPC_ERROR_CODES_BY_KEY } from './codes-3dd40769.esm.
|
|
|
5
5
|
/* istanbul ignore file */
|
|
6
6
|
function assertNotBrowser() {
|
|
7
7
|
if (typeof window !== 'undefined' && process.env.NODE_ENV !== 'test' && process.env.JEST_WORKER_ID === undefined) {
|
|
8
|
-
throw new Error('Imported server-only code in the
|
|
8
|
+
throw new Error('Imported server-only code in the browser');
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -7,7 +7,7 @@ var codes = require('./codes-6b99b935.cjs.prod.js');
|
|
|
7
7
|
/* istanbul ignore file */
|
|
8
8
|
function assertNotBrowser() {
|
|
9
9
|
if (typeof window !== 'undefined' && "production" !== 'test' && process.env.JEST_WORKER_ID === undefined) {
|
|
10
|
-
throw new Error('Imported server-only code in the
|
|
10
|
+
throw new Error('Imported server-only code in the browser');
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ var codes = require('./codes-a0cce7aa.cjs.dev.js');
|
|
|
7
7
|
/* istanbul ignore file */
|
|
8
8
|
function assertNotBrowser() {
|
|
9
9
|
if (typeof window !== 'undefined' && process.env.NODE_ENV !== 'test' && process.env.JEST_WORKER_ID === undefined) {
|
|
10
|
-
throw new Error('Imported server-only code in the
|
|
10
|
+
throw new Error('Imported server-only code in the browser');
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeHTTPRequestHandler = require('./nodeHTTPRequestHandler-
|
|
5
|
+
var nodeHTTPRequestHandler = require('./nodeHTTPRequestHandler-827c7c7e.cjs.dev.js');
|
|
6
6
|
var subscription = require('./subscription-b8831081.cjs.dev.js');
|
|
7
7
|
var transformTRPCResponse = require('./transformTRPCResponse-8248515e.cjs.dev.js');
|
|
8
8
|
var adapters_standalone_dist_trpcServerAdaptersStandalone = require('../adapters/standalone/dist/trpc-server-adapters-standalone.cjs.dev.js');
|
|
@@ -179,37 +179,21 @@ class Procedure {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
}
|
|
182
|
-
class ProcedureWithoutInput extends Procedure {}
|
|
183
|
-
class ProcedureWithInput extends Procedure {}
|
|
184
|
-
|
|
185
|
-
function isProcedureWithInput(opts) {
|
|
186
|
-
return !!opts.input;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
182
|
function createProcedure(opts) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return new ProcedureWithoutInput({
|
|
199
|
-
resolver: opts.resolve,
|
|
200
|
-
middlewares: [],
|
|
201
|
-
|
|
202
|
-
inputParser(input) {
|
|
203
|
-
if (input != null) {
|
|
204
|
-
throw new transformTRPCResponse.TRPCError({
|
|
205
|
-
code: 'BAD_REQUEST',
|
|
206
|
-
message: 'No input expected'
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return undefined;
|
|
183
|
+
const inputParser = 'input' in opts ? opts.input : input => {
|
|
184
|
+
if (input != null) {
|
|
185
|
+
throw new transformTRPCResponse.TRPCError({
|
|
186
|
+
code: 'BAD_REQUEST',
|
|
187
|
+
message: 'No input expected'
|
|
188
|
+
});
|
|
211
189
|
}
|
|
212
190
|
|
|
191
|
+
return undefined;
|
|
192
|
+
};
|
|
193
|
+
return new Procedure({
|
|
194
|
+
inputParser: inputParser,
|
|
195
|
+
resolver: opts.resolve,
|
|
196
|
+
middlewares: []
|
|
213
197
|
});
|
|
214
198
|
}
|
|
215
199
|
|
|
@@ -314,9 +298,6 @@ class Router {
|
|
|
314
298
|
*/
|
|
315
299
|
|
|
316
300
|
|
|
317
|
-
/**
|
|
318
|
-
* @beta Might change without a major version bump
|
|
319
|
-
*/
|
|
320
301
|
subscription(path, procedure) {
|
|
321
302
|
const router = new Router({
|
|
322
303
|
subscriptions: safeObject({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeHTTPRequestHandler = require('./nodeHTTPRequestHandler-
|
|
5
|
+
var nodeHTTPRequestHandler = require('./nodeHTTPRequestHandler-76403d9b.cjs.prod.js');
|
|
6
6
|
var subscription = require('./subscription-c2e0bfbc.cjs.prod.js');
|
|
7
7
|
var transformTRPCResponse = require('./transformTRPCResponse-dcbf66c5.cjs.prod.js');
|
|
8
8
|
var adapters_standalone_dist_trpcServerAdaptersStandalone = require('../adapters/standalone/dist/trpc-server-adapters-standalone.cjs.prod.js');
|
|
@@ -179,37 +179,21 @@ class Procedure {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
}
|
|
182
|
-
class ProcedureWithoutInput extends Procedure {}
|
|
183
|
-
class ProcedureWithInput extends Procedure {}
|
|
184
|
-
|
|
185
|
-
function isProcedureWithInput(opts) {
|
|
186
|
-
return !!opts.input;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
182
|
function createProcedure(opts) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return new ProcedureWithoutInput({
|
|
199
|
-
resolver: opts.resolve,
|
|
200
|
-
middlewares: [],
|
|
201
|
-
|
|
202
|
-
inputParser(input) {
|
|
203
|
-
if (input != null) {
|
|
204
|
-
throw new transformTRPCResponse.TRPCError({
|
|
205
|
-
code: 'BAD_REQUEST',
|
|
206
|
-
message: 'No input expected'
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return undefined;
|
|
183
|
+
const inputParser = 'input' in opts ? opts.input : input => {
|
|
184
|
+
if (input != null) {
|
|
185
|
+
throw new transformTRPCResponse.TRPCError({
|
|
186
|
+
code: 'BAD_REQUEST',
|
|
187
|
+
message: 'No input expected'
|
|
188
|
+
});
|
|
211
189
|
}
|
|
212
190
|
|
|
191
|
+
return undefined;
|
|
192
|
+
};
|
|
193
|
+
return new Procedure({
|
|
194
|
+
inputParser: inputParser,
|
|
195
|
+
resolver: opts.resolve,
|
|
196
|
+
middlewares: []
|
|
213
197
|
});
|
|
214
198
|
}
|
|
215
199
|
|
|
@@ -314,9 +298,6 @@ class Router {
|
|
|
314
298
|
*/
|
|
315
299
|
|
|
316
300
|
|
|
317
|
-
/**
|
|
318
|
-
* @beta Might change without a major version bump
|
|
319
|
-
*/
|
|
320
301
|
subscription(path, procedure) {
|
|
321
302
|
const router = new Router({
|
|
322
303
|
subscriptions: safeObject({
|
package/dist/trpc-server.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as assertNotBrowser, n as nodeHTTPRequestHandler, g as getHTTPStatusCodeFromError } from './nodeHTTPRequestHandler-
|
|
2
|
-
export { a as assertNotBrowser, r as resolveHTTPResponse } from './nodeHTTPRequestHandler-
|
|
1
|
+
import { a as assertNotBrowser, n as nodeHTTPRequestHandler, g as getHTTPStatusCodeFromError } from './nodeHTTPRequestHandler-716fb8d7.esm.js';
|
|
2
|
+
export { a as assertNotBrowser, r as resolveHTTPResponse } from './nodeHTTPRequestHandler-716fb8d7.esm.js';
|
|
3
3
|
export { S as Subscription, s as subscriptionPullFactory } from './subscription-fbda2888.esm.js';
|
|
4
4
|
import { T as TRPCError, g as getErrorFromUnknown } from './transformTRPCResponse-f73dc4a2.esm.js';
|
|
5
5
|
export { T as TRPCError } from './transformTRPCResponse-f73dc4a2.esm.js';
|
|
@@ -177,37 +177,21 @@ class Procedure {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
}
|
|
180
|
-
class ProcedureWithoutInput extends Procedure {}
|
|
181
|
-
class ProcedureWithInput extends Procedure {}
|
|
182
|
-
|
|
183
|
-
function isProcedureWithInput(opts) {
|
|
184
|
-
return !!opts.input;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
180
|
function createProcedure(opts) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return new ProcedureWithoutInput({
|
|
197
|
-
resolver: opts.resolve,
|
|
198
|
-
middlewares: [],
|
|
199
|
-
|
|
200
|
-
inputParser(input) {
|
|
201
|
-
if (input != null) {
|
|
202
|
-
throw new TRPCError({
|
|
203
|
-
code: 'BAD_REQUEST',
|
|
204
|
-
message: 'No input expected'
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return undefined;
|
|
181
|
+
const inputParser = 'input' in opts ? opts.input : input => {
|
|
182
|
+
if (input != null) {
|
|
183
|
+
throw new TRPCError({
|
|
184
|
+
code: 'BAD_REQUEST',
|
|
185
|
+
message: 'No input expected'
|
|
186
|
+
});
|
|
209
187
|
}
|
|
210
188
|
|
|
189
|
+
return undefined;
|
|
190
|
+
};
|
|
191
|
+
return new Procedure({
|
|
192
|
+
inputParser: inputParser,
|
|
193
|
+
resolver: opts.resolve,
|
|
194
|
+
middlewares: []
|
|
211
195
|
});
|
|
212
196
|
}
|
|
213
197
|
|
|
@@ -312,9 +296,6 @@ class Router {
|
|
|
312
296
|
*/
|
|
313
297
|
|
|
314
298
|
|
|
315
|
-
/**
|
|
316
|
-
* @beta Might change without a major version bump
|
|
317
|
-
*/
|
|
318
299
|
subscription(path, procedure) {
|
|
319
300
|
const router = new Router({
|
|
320
301
|
subscriptions: safeObject({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.1-alpha.1",
|
|
4
4
|
"description": "tRPC Server",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"yup": "^0.32.8",
|
|
64
64
|
"zod": "^3.0.0"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "3b28514fb97b5c497397013bd44c2069cd10a761",
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"tslib": "^2.1.0"
|
|
69
69
|
}
|
package/src/assertNotBrowser.ts
CHANGED
|
@@ -71,12 +71,7 @@ function getParseFn<TInput>(
|
|
|
71
71
|
/**
|
|
72
72
|
* @internal
|
|
73
73
|
*/
|
|
74
|
-
export
|
|
75
|
-
TInputContext, //
|
|
76
|
-
TContext,
|
|
77
|
-
TInput,
|
|
78
|
-
TOutput,
|
|
79
|
-
> {
|
|
74
|
+
export class Procedure<TInputContext, TContext, TInput, TOutput> {
|
|
80
75
|
private middlewares: Readonly<Array<MiddlewareFunction<any, any>>>;
|
|
81
76
|
private resolver: ProcedureResolver<TContext, TInput, TOutput>;
|
|
82
77
|
private readonly inputParser: ProcedureInputParser<TInput>;
|
|
@@ -184,19 +179,6 @@ export abstract class Procedure<
|
|
|
184
179
|
}
|
|
185
180
|
}
|
|
186
181
|
|
|
187
|
-
export class ProcedureWithoutInput<
|
|
188
|
-
TInputContext,
|
|
189
|
-
TContext,
|
|
190
|
-
TOutput,
|
|
191
|
-
> extends Procedure<TInputContext, TContext, undefined, TOutput> {}
|
|
192
|
-
|
|
193
|
-
export class ProcedureWithInput<
|
|
194
|
-
TInputContext,
|
|
195
|
-
TContext,
|
|
196
|
-
TInput,
|
|
197
|
-
TOutput,
|
|
198
|
-
> extends Procedure<TInputContext, TContext, TInput, TOutput> {}
|
|
199
|
-
|
|
200
182
|
export type CreateProcedureWithInput<TContext, TInput, TOutput> = {
|
|
201
183
|
input: ProcedureInputParser<TInput>;
|
|
202
184
|
resolve: ProcedureResolver<TContext, TInput, TOutput>;
|
|
@@ -213,58 +195,36 @@ export type CreateProcedureOptions<
|
|
|
213
195
|
| CreateProcedureWithInput<TContext, TInput, TOutput>
|
|
214
196
|
| CreateProcedureWithoutInput<TContext, TOutput>;
|
|
215
197
|
|
|
216
|
-
function isProcedureWithInput<TContext, TInput, TOutput>(
|
|
217
|
-
opts: any,
|
|
218
|
-
): opts is CreateProcedureWithInput<TContext, TInput, TOutput> {
|
|
219
|
-
return !!opts.input;
|
|
220
|
-
}
|
|
221
|
-
export function createProcedure<TInputContext, TContext, TInput, TOutput>(
|
|
222
|
-
opts: CreateProcedureWithInput<TContext, TInput, TOutput>,
|
|
223
|
-
): ProcedureWithInput<TInputContext, TContext, TInput, TOutput>;
|
|
224
|
-
export function createProcedure<TInputContext, TContext, TOutput>(
|
|
225
|
-
opts: CreateProcedureWithoutInput<TContext, TOutput>,
|
|
226
|
-
): ProcedureWithoutInput<TInputContext, TContext, TOutput>;
|
|
227
|
-
export function createProcedure<TInputContext, TContext, TInput, TOutput>(
|
|
228
|
-
opts: CreateProcedureOptions<TContext, TInput, TOutput>,
|
|
229
|
-
): Procedure<TInputContext, TContext, TInput, TOutput>;
|
|
230
198
|
export function createProcedure<TContext, TInput, TOutput>(
|
|
231
199
|
opts: CreateProcedureOptions<TContext, TInput, TOutput>,
|
|
232
|
-
) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
200
|
+
): Procedure<unknown, TContext, TInput, TOutput> {
|
|
201
|
+
const inputParser =
|
|
202
|
+
'input' in opts
|
|
203
|
+
? opts.input
|
|
204
|
+
: (input: unknown) => {
|
|
205
|
+
if (input != null) {
|
|
206
|
+
throw new TRPCError({
|
|
207
|
+
code: 'BAD_REQUEST',
|
|
208
|
+
message: 'No input expected',
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
return new Procedure({
|
|
215
|
+
inputParser: inputParser as any,
|
|
216
|
+
resolver: opts.resolve as any,
|
|
242
217
|
middlewares: [],
|
|
243
|
-
inputParser(input: unknown) {
|
|
244
|
-
if (input != null) {
|
|
245
|
-
throw new TRPCError({
|
|
246
|
-
code: 'BAD_REQUEST',
|
|
247
|
-
message: 'No input expected',
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
return undefined;
|
|
251
|
-
},
|
|
252
218
|
});
|
|
253
219
|
}
|
|
254
220
|
|
|
255
221
|
export type inferProcedureFromOptions<
|
|
256
222
|
TInputContext,
|
|
257
223
|
TOptions extends CreateProcedureOptions<any, any, any>,
|
|
258
|
-
> = TOptions extends
|
|
224
|
+
> = TOptions extends CreateProcedureOptions<
|
|
259
225
|
infer TContext,
|
|
260
226
|
infer TInput,
|
|
261
227
|
infer TOutput
|
|
262
228
|
>
|
|
263
|
-
?
|
|
264
|
-
:
|
|
265
|
-
//
|
|
266
|
-
infer TContext,
|
|
267
|
-
infer TOutput
|
|
268
|
-
>
|
|
269
|
-
? ProcedureWithoutInput<TInputContext, TContext, TOutput>
|
|
270
|
-
: Procedure<unknown, unknown, unknown, unknown>;
|
|
229
|
+
? Procedure<TInputContext, TContext, TInput, TOutput>
|
|
230
|
+
: never;
|
package/src/router.ts
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
inferProcedureFromOptions,
|
|
13
13
|
Procedure,
|
|
14
14
|
ProcedureCallOptions,
|
|
15
|
-
ProcedureWithInput,
|
|
16
15
|
} from './internals/procedure';
|
|
17
16
|
import {
|
|
18
17
|
TRPCErrorShape,
|
|
@@ -47,8 +46,10 @@ export type ProcedureRecord<
|
|
|
47
46
|
*/
|
|
48
47
|
export type inferProcedureInput<
|
|
49
48
|
TProcedure extends Procedure<any, any, any, any>,
|
|
50
|
-
> = TProcedure extends
|
|
51
|
-
? Input
|
|
49
|
+
> = TProcedure extends Procedure<any, any, infer Input, any>
|
|
50
|
+
? undefined extends Input
|
|
51
|
+
? Input | null | void // void is necessary to allow procedures with nullish input to be called without an input
|
|
52
|
+
: Input
|
|
52
53
|
: undefined;
|
|
53
54
|
|
|
54
55
|
/**
|
|
@@ -90,7 +91,7 @@ function getDataTransformer(
|
|
|
90
91
|
*/
|
|
91
92
|
export type inferHandlerInput<
|
|
92
93
|
TProcedure extends Procedure<any, any, any, any>,
|
|
93
|
-
> = TProcedure extends
|
|
94
|
+
> = TProcedure extends Procedure<any, any, infer TInput, any>
|
|
94
95
|
? undefined extends TInput // ? is input optional
|
|
95
96
|
? unknown extends TInput // ? is input unset
|
|
96
97
|
? [(null | undefined)?] // -> there is no input
|
|
@@ -205,14 +206,14 @@ const defaultTransformer: CombinedDataTransformer = {
|
|
|
205
206
|
type SwapProcedureContext<
|
|
206
207
|
TProcedure extends Procedure<any, any, any, any>,
|
|
207
208
|
TNewContext,
|
|
208
|
-
> = TProcedure extends
|
|
209
|
+
> = TProcedure extends Procedure<
|
|
209
210
|
infer TInputContext,
|
|
210
211
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
211
212
|
infer _TOldContext,
|
|
212
213
|
infer TInput,
|
|
213
214
|
infer TOutput
|
|
214
215
|
>
|
|
215
|
-
?
|
|
216
|
+
? Procedure<TInputContext, TNewContext, TInput, TOutput>
|
|
216
217
|
: never;
|
|
217
218
|
|
|
218
219
|
type SwapContext<
|
|
@@ -290,6 +291,7 @@ export class Router<
|
|
|
290
291
|
TSubscriptions,
|
|
291
292
|
TErrorShape
|
|
292
293
|
>;
|
|
294
|
+
|
|
293
295
|
public query<TPath extends string, TOutput>(
|
|
294
296
|
path: TPath,
|
|
295
297
|
procedure: CreateProcedureWithoutInput<TContext, TOutput>,
|
|
@@ -304,10 +306,8 @@ export class Router<
|
|
|
304
306
|
TSubscriptions,
|
|
305
307
|
TErrorShape
|
|
306
308
|
>;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
procedure: CreateProcedureOptions<TContext, TInput, TOutput>,
|
|
310
|
-
) {
|
|
309
|
+
|
|
310
|
+
query(path: string, procedure: CreateProcedureOptions<TContext, any, any>) {
|
|
311
311
|
const router = new Router<TContext, TContext, any, {}, {}, any>({
|
|
312
312
|
queries: safeObject({
|
|
313
313
|
[path]: createProcedure(procedure),
|
|
@@ -331,6 +331,7 @@ export class Router<
|
|
|
331
331
|
TSubscriptions,
|
|
332
332
|
TErrorShape
|
|
333
333
|
>;
|
|
334
|
+
|
|
334
335
|
public mutation<TPath extends string, TOutput>(
|
|
335
336
|
path: TPath,
|
|
336
337
|
procedure: CreateProcedureWithoutInput<TContext, TOutput>,
|
|
@@ -345,9 +346,10 @@ export class Router<
|
|
|
345
346
|
TSubscriptions,
|
|
346
347
|
TErrorShape
|
|
347
348
|
>;
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
|
|
350
|
+
public mutation(
|
|
351
|
+
path: string,
|
|
352
|
+
procedure: CreateProcedureOptions<TContext, any, any>,
|
|
351
353
|
) {
|
|
352
354
|
const router = new Router<TContext, TContext, {}, any, {}, any>({
|
|
353
355
|
mutations: safeObject({
|
|
@@ -357,6 +359,7 @@ export class Router<
|
|
|
357
359
|
|
|
358
360
|
return this.merge(router);
|
|
359
361
|
}
|
|
362
|
+
|
|
360
363
|
/**
|
|
361
364
|
* @beta Might change without a major version bump
|
|
362
365
|
*/
|
|
@@ -376,6 +379,7 @@ export class Router<
|
|
|
376
379
|
Record<TPath, inferProcedureFromOptions<TInputContext, typeof procedure>>,
|
|
377
380
|
TErrorShape
|
|
378
381
|
>;
|
|
382
|
+
|
|
379
383
|
/**
|
|
380
384
|
* @beta Might change without a major version bump
|
|
381
385
|
*/
|
|
@@ -394,14 +398,11 @@ export class Router<
|
|
|
394
398
|
Record<TPath, inferProcedureFromOptions<TInputContext, typeof procedure>>,
|
|
395
399
|
TErrorShape
|
|
396
400
|
>;
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
TInput,
|
|
403
|
-
TOutput extends Subscription<unknown>,
|
|
404
|
-
>(path: TPath, procedure: CreateProcedureOptions<TContext, TInput, TOutput>) {
|
|
401
|
+
|
|
402
|
+
public subscription(
|
|
403
|
+
path: string,
|
|
404
|
+
procedure: CreateProcedureOptions<TContext, any, any>,
|
|
405
|
+
) {
|
|
405
406
|
const router = new Router<TContext, TContext, {}, {}, any, any>({
|
|
406
407
|
subscriptions: safeObject({
|
|
407
408
|
[path]: createProcedure(procedure),
|