@trpc/server 11.0.0-alpha-tmp-export-from-main-nuke-core.219 → 11.0.0-alpha-tmp-export-from-main.211
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/dist/@trpc-core-unstable-do-not-import-this-please.d.ts +9 -0
- package/dist/@trpc-core-unstable-do-not-import-this-please.d.ts.map +1 -0
- package/dist/@trpc-server/http.d.ts +1 -1
- package/dist/@trpc-server/http.d.ts.map +1 -1
- package/dist/@trpc-server.d.ts +3 -3
- package/dist/@trpc-server.d.ts.map +1 -1
- package/dist/adapters/aws-lambda/index.d.ts +1 -1
- package/dist/adapters/aws-lambda/index.js +7 -13
- package/dist/adapters/aws-lambda/index.mjs +3 -9
- package/dist/adapters/aws-lambda/utils.d.ts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.d.ts.map +1 -1
- package/dist/adapters/express.js +2 -9
- package/dist/adapters/express.mjs +2 -9
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts +1 -1
- package/dist/adapters/fastify/index.js +4 -13
- package/dist/adapters/fastify/index.mjs +2 -11
- package/dist/adapters/fetch/fetchRequestHandler.d.ts +1 -1
- package/dist/adapters/fetch/index.js +4 -11
- package/dist/adapters/fetch/index.mjs +2 -9
- package/dist/adapters/fetch/types.d.ts +1 -1
- package/dist/adapters/next.d.ts +1 -1
- package/dist/adapters/next.js +5 -12
- package/dist/adapters/next.mjs +3 -10
- package/dist/adapters/node-http/content-type/json/index.js +3 -6
- package/dist/adapters/node-http/content-type/json/index.mjs +1 -4
- package/dist/adapters/node-http/index.js +2 -9
- package/dist/adapters/node-http/index.mjs +2 -9
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts +1 -1
- package/dist/adapters/node-http/types.d.ts +2 -2
- package/dist/adapters/node-http/types.d.ts.map +1 -1
- package/dist/adapters/standalone.d.ts +1 -1
- package/dist/adapters/standalone.js +2 -9
- package/dist/adapters/standalone.mjs +2 -9
- package/dist/adapters/ws.d.ts +1 -2
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +26 -32
- package/dist/adapters/ws.mjs +1 -7
- package/dist/http.d.ts +6 -6
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +21 -13
- package/dist/http.mjs +1 -8
- package/dist/index.js +41 -16
- package/dist/index.mjs +1 -6
- package/dist/{nodeHTTPRequestHandler-d8558115.mjs → nodeHTTPRequestHandler-2d5c8791.mjs} +2 -4
- package/dist/{nodeHTTPRequestHandler-0bc1dc41.js → nodeHTTPRequestHandler-55f05150.js} +4 -6
- package/dist/{nodeHTTPRequestHandler-c7d41cde.js → nodeHTTPRequestHandler-7691fc79.js} +1 -3
- package/dist/observable.d.ts +3 -0
- package/dist/observable.d.ts.map +1 -0
- package/dist/observable.js +32 -0
- package/dist/observable.mjs +1 -0
- package/dist/rpc.d.ts +2 -2
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +13 -6
- package/dist/rpc.mjs +1 -3
- package/dist/shared.js +9 -5
- package/dist/shared.mjs +1 -3
- package/package.json +125 -53
- package/src/@trpc-core-unstable-do-not-import-this-please.ts +9 -0
- package/src/@trpc-server/http.ts +1 -2
- package/src/@trpc-server.ts +3 -3
- package/src/adapters/aws-lambda/index.ts +1 -1
- package/src/adapters/aws-lambda/utils.ts +1 -1
- package/src/adapters/express.ts +2 -1
- package/src/adapters/fastify/fastifyRequestHandler.ts +1 -1
- package/src/adapters/fastify/fastifyTRPCPlugin.ts +1 -1
- package/src/adapters/fetch/fetchRequestHandler.ts +1 -1
- package/src/adapters/fetch/types.ts +1 -1
- package/src/adapters/next.ts +1 -1
- package/src/adapters/node-http/nodeHTTPRequestHandler.ts +1 -1
- package/src/adapters/node-http/types.ts +3 -2
- package/src/adapters/standalone.ts +1 -1
- package/src/adapters/ws.ts +10 -9
- package/src/http.ts +6 -6
- package/src/observable.ts +16 -0
- package/src/rpc.ts +2 -2
- package/dist/TRPCError-57838b33.js +0 -67
- package/dist/TRPCError-af754aba.mjs +0 -63
- package/dist/TRPCError-ebbde27d.js +0 -61
- package/dist/batchStreamFormatter-1971db27.js +0 -32
- package/dist/batchStreamFormatter-378277dc.mjs +0 -30
- package/dist/batchStreamFormatter-4375dc8b.js +0 -31
- package/dist/bundle-analysis.json +0 -770
- package/dist/contentType-9756da28.js +0 -59
- package/dist/contentType-b31eab56.js +0 -54
- package/dist/contentType-f93c6ba8.mjs +0 -52
- package/dist/createProxy-7293f632.mjs +0 -121
- package/dist/createProxy-c5cd21e8.js +0 -127
- package/dist/createProxy-f6960c7b.js +0 -116
- package/dist/initTRPC-6c16fa27.mjs +0 -377
- package/dist/initTRPC-8b5714ea.js +0 -385
- package/dist/initTRPC-b65b35e2.js +0 -372
- package/dist/observable/index.d.ts +0 -5
- package/dist/observable/index.d.ts.map +0 -1
- package/dist/observable/index.js +0 -111
- package/dist/observable/index.mjs +0 -102
- package/dist/observable/observable.d.ts +0 -13
- package/dist/observable/observable.d.ts.map +0 -1
- package/dist/observable/operators.d.ts +0 -8
- package/dist/observable/operators.d.ts.map +0 -1
- package/dist/observable/types.d.ts +0 -26
- package/dist/observable/types.d.ts.map +0 -1
- package/dist/observable-7233bd21.mjs +0 -121
- package/dist/observable-7865c812.js +0 -125
- package/dist/observable-cbbc588a.js +0 -125
- package/dist/parseTRPCMessage-3ae1b295.js +0 -67
- package/dist/parseTRPCMessage-abbd6862.mjs +0 -62
- package/dist/parseTRPCMessage-c6022e94.js +0 -65
- package/dist/resolveHTTPResponse-3133d603.js +0 -265
- package/dist/resolveHTTPResponse-80c99f62.mjs +0 -291
- package/dist/resolveHTTPResponse-9e260431.js +0 -293
- package/dist/rootConfig-a1ad09d0.js +0 -48
- package/dist/rootConfig-db88d377.js +0 -44
- package/dist/rootConfig-f741a4e7.mjs +0 -40
- package/dist/router-68063d64.mjs +0 -252
- package/dist/router-7a7bb4fd.js +0 -262
- package/dist/router-c5bd7780.js +0 -259
- package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts +0 -6
- package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/createProxy.d.ts +0 -19
- package/dist/unstable-core-do-not-import/createProxy.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/error/TRPCError.d.ts +0 -13
- package/dist/unstable-core-do-not-import/error/TRPCError.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/error/formatter.d.ts +0 -33
- package/dist/unstable-core-do-not-import/error/formatter.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts +0 -15
- package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts +0 -24
- package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/contentType.d.ts +0 -29
- package/dist/unstable-core-do-not-import/http/contentType.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts +0 -5
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/index.d.ts +0 -7
- package/dist/unstable-core-do-not-import/http/index.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts +0 -51
- package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/http/types.d.ts +0 -96
- package/dist/unstable-core-do-not-import/http/types.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/index.d.ts +0 -34
- package/dist/unstable-core-do-not-import/index.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/index.js +0 -44
- package/dist/unstable-core-do-not-import/index.mjs +0 -10
- package/dist/unstable-core-do-not-import/initTRPC.d.ts +0 -96
- package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/middleware.d.ts +0 -105
- package/dist/unstable-core-do-not-import/middleware.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/parser.d.ts +0 -30
- package/dist/unstable-core-do-not-import/parser.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/procedure.d.ts +0 -72
- package/dist/unstable-core-do-not-import/procedure.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +0 -101
- package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/rootConfig.d.ts +0 -75
- package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/router.d.ts +0 -85
- package/dist/unstable-core-do-not-import/router.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts +0 -51
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +0 -97
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/rpc/index.d.ts +0 -5
- package/dist/unstable-core-do-not-import/rpc/index.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts +0 -5
- package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/serialize.d.ts +0 -62
- package/dist/unstable-core-do-not-import/serialize.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/transformer.d.ts +0 -107
- package/dist/unstable-core-do-not-import/transformer.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/types.d.ts +0 -98
- package/dist/unstable-core-do-not-import/types.d.ts.map +0 -1
- package/dist/unstable-core-do-not-import/utils.d.ts +0 -31
- package/dist/unstable-core-do-not-import/utils.d.ts.map +0 -1
- package/dist/utils-42a3ba6d.js +0 -50
- package/dist/utils-cf6178ec.mjs +0 -44
- package/dist/utils-e1d51fac.js +0 -49
- package/src/observable/index.ts +0 -10
- package/src/observable/observable.ts +0 -155
- package/src/observable/operators.ts +0 -119
- package/src/observable/types.ts +0 -76
- package/src/unstable-core-do-not-import/TRPCInferrable.ts +0 -9
- package/src/unstable-core-do-not-import/createProxy.ts +0 -59
- package/src/unstable-core-do-not-import/error/TRPCError.ts +0 -82
- package/src/unstable-core-do-not-import/error/formatter.ts +0 -51
- package/src/unstable-core-do-not-import/error/getErrorShape.ts +0 -36
- package/src/unstable-core-do-not-import/http/batchStreamFormatter.ts +0 -29
- package/src/unstable-core-do-not-import/http/contentType.ts +0 -99
- package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +0 -57
- package/src/unstable-core-do-not-import/http/index.ts +0 -23
- package/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts +0 -458
- package/src/unstable-core-do-not-import/http/types.ts +0 -111
- package/src/unstable-core-do-not-import/index.ts +0 -107
- package/src/unstable-core-do-not-import/initTRPC.ts +0 -206
- package/src/unstable-core-do-not-import/middleware.ts +0 -233
- package/src/unstable-core-do-not-import/parser.ts +0 -94
- package/src/unstable-core-do-not-import/procedure.ts +0 -108
- package/src/unstable-core-do-not-import/procedureBuilder.ts +0 -458
- package/src/unstable-core-do-not-import/rootConfig.ts +0 -90
- package/src/unstable-core-do-not-import/router.ts +0 -370
- package/src/unstable-core-do-not-import/rpc/codes.ts +0 -44
- package/src/unstable-core-do-not-import/rpc/envelopes.ts +0 -136
- package/src/unstable-core-do-not-import/rpc/index.ts +0 -21
- package/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts +0 -85
- package/src/unstable-core-do-not-import/serialize.ts +0 -122
- package/src/unstable-core-do-not-import/transformer.ts +0 -202
- package/src/unstable-core-do-not-import/types.ts +0 -151
- package/src/unstable-core-do-not-import/utils.ts +0 -66
- package/unstable-core-do-not-import/index.d.ts +0 -1
- package/unstable-core-do-not-import/index.js +0 -1
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { a as isObject } from './utils-e1d51fac.js';
|
|
2
|
-
|
|
3
|
-
class UnknownCauseError extends Error {
|
|
4
|
-
}
|
|
5
|
-
function getCauseFromUnknown(cause) {
|
|
6
|
-
if (cause instanceof Error) {
|
|
7
|
-
return cause;
|
|
8
|
-
}
|
|
9
|
-
const type = typeof cause;
|
|
10
|
-
if (type === 'undefined' || type === 'function' || cause === null) {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
// Primitive types just get wrapped in an error
|
|
14
|
-
if (type !== 'object') {
|
|
15
|
-
return new Error(String(cause));
|
|
16
|
-
}
|
|
17
|
-
// If it's an object, we'll create a synthetic error
|
|
18
|
-
if (isObject(cause)) {
|
|
19
|
-
const err = new UnknownCauseError();
|
|
20
|
-
for (const key in cause) {
|
|
21
|
-
err[key] = cause[key];
|
|
22
|
-
}
|
|
23
|
-
return err;
|
|
24
|
-
}
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
function getTRPCErrorFromUnknown(cause) {
|
|
28
|
-
if (cause instanceof TRPCError) {
|
|
29
|
-
return cause;
|
|
30
|
-
}
|
|
31
|
-
if (cause instanceof Error && cause.name === 'TRPCError') {
|
|
32
|
-
// https://github.com/trpc/trpc/pull/4848
|
|
33
|
-
return cause;
|
|
34
|
-
}
|
|
35
|
-
const trpcError = new TRPCError({
|
|
36
|
-
code: 'INTERNAL_SERVER_ERROR',
|
|
37
|
-
cause,
|
|
38
|
-
});
|
|
39
|
-
// Inherit stack from error
|
|
40
|
-
if (cause instanceof Error && cause.stack) {
|
|
41
|
-
trpcError.stack = cause.stack;
|
|
42
|
-
}
|
|
43
|
-
return trpcError;
|
|
44
|
-
}
|
|
45
|
-
class TRPCError extends Error {
|
|
46
|
-
constructor(opts) {
|
|
47
|
-
const cause = getCauseFromUnknown(opts.cause);
|
|
48
|
-
const message = opts.message ?? cause?.message ?? opts.code;
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
50
|
-
// @ts-ignore https://github.com/tc39/proposal-error-cause
|
|
51
|
-
super(message, { cause });
|
|
52
|
-
this.code = opts.code;
|
|
53
|
-
this.name = 'TRPCError';
|
|
54
|
-
if (!this.cause) {
|
|
55
|
-
// < ES2022 / < Node 16.9.0 compatability
|
|
56
|
-
this.cause = cause;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { TRPCError as T, getCauseFromUnknown as a, getTRPCErrorFromUnknown as g };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Format a batch response as a line-delimited JSON stream
|
|
5
|
-
* that the `unstable_httpBatchStreamLink` can parse:
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* const formatter = getBatchStreamFormatter();
|
|
10
|
-
* res.send(formatter(1, 'response #2'));
|
|
11
|
-
* res.send(formatter(0, 'response #1'));
|
|
12
|
-
* res.send(formatter.end());
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* Expected format:
|
|
16
|
-
* ```json
|
|
17
|
-
* {"1":"response #2"
|
|
18
|
-
* ,"0":"response #1"
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*/ function getBatchStreamFormatter() {
|
|
22
|
-
let first = true;
|
|
23
|
-
function format(index, string) {
|
|
24
|
-
const prefix = first ? '{' : ',';
|
|
25
|
-
first = false;
|
|
26
|
-
return `${prefix}"${index}":${string}\n`;
|
|
27
|
-
}
|
|
28
|
-
format.end = ()=>'}';
|
|
29
|
-
return format;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
exports.getBatchStreamFormatter = getBatchStreamFormatter;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format a batch response as a line-delimited JSON stream
|
|
3
|
-
* that the `unstable_httpBatchStreamLink` can parse:
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* const formatter = getBatchStreamFormatter();
|
|
8
|
-
* res.send(formatter(1, 'response #2'));
|
|
9
|
-
* res.send(formatter(0, 'response #1'));
|
|
10
|
-
* res.send(formatter.end());
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* Expected format:
|
|
14
|
-
* ```json
|
|
15
|
-
* {"1":"response #2"
|
|
16
|
-
* ,"0":"response #1"
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*/ function getBatchStreamFormatter() {
|
|
20
|
-
let first = true;
|
|
21
|
-
function format(index, string) {
|
|
22
|
-
const prefix = first ? '{' : ',';
|
|
23
|
-
first = false;
|
|
24
|
-
return `${prefix}"${index}":${string}\n`;
|
|
25
|
-
}
|
|
26
|
-
format.end = ()=>'}';
|
|
27
|
-
return format;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { getBatchStreamFormatter as g };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format a batch response as a line-delimited JSON stream
|
|
3
|
-
* that the `unstable_httpBatchStreamLink` can parse:
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* const formatter = getBatchStreamFormatter();
|
|
8
|
-
* res.send(formatter(1, 'response #2'));
|
|
9
|
-
* res.send(formatter(0, 'response #1'));
|
|
10
|
-
* res.send(formatter.end());
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* Expected format:
|
|
14
|
-
* ```json
|
|
15
|
-
* {"1":"response #2"
|
|
16
|
-
* ,"0":"response #1"
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
function getBatchStreamFormatter() {
|
|
21
|
-
let first = true;
|
|
22
|
-
function format(index, string) {
|
|
23
|
-
const prefix = first ? '{' : ',';
|
|
24
|
-
first = false;
|
|
25
|
-
return `${prefix}"${index}":${string}\n`;
|
|
26
|
-
}
|
|
27
|
-
format.end = () => '}';
|
|
28
|
-
return format;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { getBatchStreamFormatter as g };
|