@trpc/server 10.26.0 → 10.27.0
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/adapters/aws-lambda/index.js +5 -5
- package/dist/adapters/aws-lambda/index.mjs +5 -5
- package/dist/adapters/express.js +6 -6
- package/dist/adapters/express.mjs +6 -6
- package/dist/adapters/fastify/index.js +5 -5
- package/dist/adapters/fastify/index.mjs +5 -5
- package/dist/adapters/fetch/index.js +5 -5
- package/dist/adapters/fetch/index.mjs +5 -5
- package/dist/adapters/next.d.ts.map +1 -1
- package/dist/adapters/next.js +8 -7
- package/dist/adapters/next.mjs +8 -7
- package/dist/adapters/node-http/index.js +6 -6
- package/dist/adapters/node-http/index.mjs +6 -6
- package/dist/adapters/standalone.js +6 -6
- package/dist/adapters/standalone.mjs +6 -6
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +13 -9
- package/dist/adapters/ws.mjs +13 -9
- package/dist/{codes-0a561c20.js → codes-0eeb600d.js} +3 -1
- package/dist/{codes-e5d244b6.mjs → codes-24aa1ce1.mjs} +3 -1
- package/dist/{codes-dddd9731.js → codes-b3c262d8.js} +3 -0
- package/dist/{config-2d85b8f0.js → config-91ab0b1d.js} +3 -47
- package/dist/{config-f0387de5.mjs → config-d1cf9de0.mjs} +3 -49
- package/dist/{config-e6e74385.js → config-f355c4d8.js} +3 -52
- package/dist/core/router.d.ts +4 -0
- package/dist/core/router.d.ts.map +1 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/http/index.js +8 -8
- package/dist/http/index.mjs +5 -5
- package/dist/http/resolveHTTPResponse.d.ts.map +1 -1
- package/dist/index-315a9f08.mjs +96 -0
- package/dist/index-8e243a74.js +102 -0
- package/dist/index-cddfa242.js +93 -0
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/internals/invert.d.ts +3 -0
- package/dist/internals/invert.d.ts.map +1 -1
- package/dist/internals/types.d.ts +4 -0
- package/dist/internals/types.d.ts.map +1 -1
- package/dist/{nodeHTTPRequestHandler-ace6dac5.js → nodeHTTPRequestHandler-7762c7d4.js} +1 -1
- package/dist/{nodeHTTPRequestHandler-f0efcff4.mjs → nodeHTTPRequestHandler-8a261b10.mjs} +1 -1
- package/dist/{nodeHTTPRequestHandler-54aea883.js → nodeHTTPRequestHandler-fc509b47.js} +1 -1
- package/dist/{resolveHTTPResponse-a7abb046.js → resolveHTTPResponse-27fe1108.js} +9 -6
- package/dist/{resolveHTTPResponse-e1286cb3.mjs → resolveHTTPResponse-36f4e729.mjs} +8 -5
- package/dist/{resolveHTTPResponse-9a9f3436.js → resolveHTTPResponse-5f8945d7.js} +8 -5
- package/dist/rpc/index.js +1 -1
- package/dist/rpc/index.mjs +1 -1
- package/dist/shared/getErrorShape.d.ts +15 -0
- package/dist/shared/getErrorShape.d.ts.map +1 -0
- package/dist/shared/index.d.ts +2 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +4 -2
- package/dist/shared/index.mjs +3 -2
- package/dist/shared/transformTRPCResponse.d.ts +2 -2
- package/dist/shared/transformTRPCResponse.d.ts.map +1 -1
- package/dist/transformTRPCResponse-6887ae6d.mjs +53 -0
- package/dist/transformTRPCResponse-8cb7e890.js +54 -0
- package/dist/transformTRPCResponse-f7b2ffd1.js +56 -0
- package/package.json +4 -3
- package/src/adapters/next.ts +3 -1
- package/src/adapters/ws.ts +12 -5
- package/src/core/initTRPC.ts +1 -1
- package/src/core/router.ts +6 -2
- package/src/core/types.ts +1 -1
- package/src/http/resolveHTTPResponse.ts +10 -4
- package/src/internals/invert.ts +3 -0
- package/src/internals/types.ts +4 -0
- package/src/shared/getErrorShape.ts +35 -0
- package/src/shared/index.ts +3 -1
- package/src/shared/transformTRPCResponse.ts +7 -9
- package/dist/index-4d2d31b6.js +0 -51
- package/dist/index-972002da.mjs +0 -48
- package/dist/index-f38f12ba.js +0 -47
- package/dist/transformTRPCResponse-0ea8c0ca.mjs +0 -25
- package/dist/transformTRPCResponse-560a1eb1.js +0 -28
- package/dist/transformTRPCResponse-8afb9a5c.js +0 -27
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var TRPCError = require('../../TRPCError-16b2e52d.js');
|
|
6
|
-
require('../../
|
|
7
|
-
require('../../codes-
|
|
8
|
-
|
|
9
|
-
require('../../
|
|
10
|
-
require('../../transformTRPCResponse-
|
|
6
|
+
require('../../index-8e243a74.js');
|
|
7
|
+
require('../../codes-0eeb600d.js');
|
|
8
|
+
require('../../config-f355c4d8.js');
|
|
9
|
+
var resolveHTTPResponse = require('../../resolveHTTPResponse-27fe1108.js');
|
|
10
|
+
require('../../transformTRPCResponse-f7b2ffd1.js');
|
|
11
11
|
require('../../contentType-8356d528.js');
|
|
12
12
|
|
|
13
13
|
function isPayloadV1(event) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { T as TRPCError } from '../../TRPCError-2b10c8d2.mjs';
|
|
2
|
-
import '../../
|
|
3
|
-
import '../../codes-
|
|
4
|
-
import
|
|
5
|
-
import '../../
|
|
6
|
-
import '../../transformTRPCResponse-
|
|
2
|
+
import '../../index-315a9f08.mjs';
|
|
3
|
+
import '../../codes-24aa1ce1.mjs';
|
|
4
|
+
import '../../config-d1cf9de0.mjs';
|
|
5
|
+
import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-36f4e729.mjs';
|
|
6
|
+
import '../../transformTRPCResponse-6887ae6d.mjs';
|
|
7
7
|
import '../../contentType-acc3be52.mjs';
|
|
8
8
|
|
|
9
9
|
function isPayloadV1(event) {
|
package/dist/adapters/express.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-
|
|
6
|
-
require('../resolveHTTPResponse-
|
|
7
|
-
require('../config-
|
|
5
|
+
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-7762c7d4.js');
|
|
6
|
+
require('../resolveHTTPResponse-27fe1108.js');
|
|
7
|
+
require('../config-f355c4d8.js');
|
|
8
8
|
require('../TRPCError-16b2e52d.js');
|
|
9
|
-
require('../
|
|
10
|
-
require('../
|
|
11
|
-
require('../transformTRPCResponse-
|
|
9
|
+
require('../index-8e243a74.js');
|
|
10
|
+
require('../codes-0eeb600d.js');
|
|
11
|
+
require('../transformTRPCResponse-f7b2ffd1.js');
|
|
12
12
|
require('../contentType-8356d528.js');
|
|
13
13
|
require('./node-http/content-type/json/index.js');
|
|
14
14
|
require('../contentType-8c16408e.js');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-
|
|
2
|
-
import '../resolveHTTPResponse-
|
|
3
|
-
import '../config-
|
|
1
|
+
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-8a261b10.mjs';
|
|
2
|
+
import '../resolveHTTPResponse-36f4e729.mjs';
|
|
3
|
+
import '../config-d1cf9de0.mjs';
|
|
4
4
|
import '../TRPCError-2b10c8d2.mjs';
|
|
5
|
-
import '../
|
|
6
|
-
import '../
|
|
7
|
-
import '../transformTRPCResponse-
|
|
5
|
+
import '../index-315a9f08.mjs';
|
|
6
|
+
import '../codes-24aa1ce1.mjs';
|
|
7
|
+
import '../transformTRPCResponse-6887ae6d.mjs';
|
|
8
8
|
import '../contentType-acc3be52.mjs';
|
|
9
9
|
import './node-http/content-type/json/index.mjs';
|
|
10
10
|
import '../contentType-3194ed5f.mjs';
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var resolveHTTPResponse = require('../../resolveHTTPResponse-
|
|
5
|
+
var resolveHTTPResponse = require('../../resolveHTTPResponse-27fe1108.js');
|
|
6
6
|
var adapters_ws = require('../ws.js');
|
|
7
|
-
require('../../config-
|
|
7
|
+
require('../../config-f355c4d8.js');
|
|
8
8
|
require('../../TRPCError-16b2e52d.js');
|
|
9
|
-
require('../../
|
|
10
|
-
require('../../
|
|
11
|
-
require('../../transformTRPCResponse-
|
|
9
|
+
require('../../index-8e243a74.js');
|
|
10
|
+
require('../../codes-0eeb600d.js');
|
|
11
|
+
require('../../transformTRPCResponse-f7b2ffd1.js');
|
|
12
12
|
require('../../contentType-8356d528.js');
|
|
13
13
|
require('../../observable-464116ac.js');
|
|
14
14
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-
|
|
1
|
+
import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-36f4e729.mjs';
|
|
2
2
|
import { applyWSSHandler } from '../ws.mjs';
|
|
3
|
-
import '../../config-
|
|
3
|
+
import '../../config-d1cf9de0.mjs';
|
|
4
4
|
import '../../TRPCError-2b10c8d2.mjs';
|
|
5
|
-
import '../../
|
|
6
|
-
import '../../
|
|
7
|
-
import '../../transformTRPCResponse-
|
|
5
|
+
import '../../index-315a9f08.mjs';
|
|
6
|
+
import '../../codes-24aa1ce1.mjs';
|
|
7
|
+
import '../../transformTRPCResponse-6887ae6d.mjs';
|
|
8
8
|
import '../../contentType-acc3be52.mjs';
|
|
9
9
|
import '../../observable-ade1bad8.mjs';
|
|
10
10
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var resolveHTTPResponse = require('../../resolveHTTPResponse-
|
|
6
|
-
require('../../config-
|
|
5
|
+
var resolveHTTPResponse = require('../../resolveHTTPResponse-27fe1108.js');
|
|
6
|
+
require('../../config-f355c4d8.js');
|
|
7
7
|
require('../../TRPCError-16b2e52d.js');
|
|
8
|
-
require('../../
|
|
9
|
-
require('../../
|
|
10
|
-
require('../../transformTRPCResponse-
|
|
8
|
+
require('../../index-8e243a74.js');
|
|
9
|
+
require('../../codes-0eeb600d.js');
|
|
10
|
+
require('../../transformTRPCResponse-f7b2ffd1.js');
|
|
11
11
|
require('../../contentType-8356d528.js');
|
|
12
12
|
|
|
13
13
|
async function fetchRequestHandler(opts) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-
|
|
2
|
-
import '../../config-
|
|
1
|
+
import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-36f4e729.mjs';
|
|
2
|
+
import '../../config-d1cf9de0.mjs';
|
|
3
3
|
import '../../TRPCError-2b10c8d2.mjs';
|
|
4
|
-
import '../../
|
|
5
|
-
import '../../
|
|
6
|
-
import '../../transformTRPCResponse-
|
|
4
|
+
import '../../index-315a9f08.mjs';
|
|
5
|
+
import '../../codes-24aa1ce1.mjs';
|
|
6
|
+
import '../../transformTRPCResponse-6887ae6d.mjs';
|
|
7
7
|
import '../../contentType-acc3be52.mjs';
|
|
8
8
|
|
|
9
9
|
async function fetchRequestHandler(opts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/adapters/next.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/adapters/next.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIpC,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAErB,oBAAY,wBAAwB,GAAG,8BAA8B,CACnE,cAAc,EACd,eAAe,CAChB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,SAAS,EAC5D,IAAI,EAAE,sBAAsB,CAAC,OAAO,EAAE,cAAc,EAAE,eAAe,CAAC,GACrE,cAAc,CAyChB"}
|
package/dist/adapters/next.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var TRPCError = require('../TRPCError-16b2e52d.js');
|
|
6
|
-
var
|
|
7
|
-
require('../
|
|
8
|
-
require('../
|
|
9
|
-
require('../codes-
|
|
10
|
-
require('../
|
|
11
|
-
require('../
|
|
6
|
+
var transformTRPCResponse = require('../transformTRPCResponse-f7b2ffd1.js');
|
|
7
|
+
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-7762c7d4.js');
|
|
8
|
+
require('../index-8e243a74.js');
|
|
9
|
+
require('../codes-0eeb600d.js');
|
|
10
|
+
require('../resolveHTTPResponse-27fe1108.js');
|
|
11
|
+
require('../config-f355c4d8.js');
|
|
12
12
|
require('../contentType-8356d528.js');
|
|
13
13
|
require('./node-http/content-type/json/index.js');
|
|
14
14
|
require('../contentType-8c16408e.js');
|
|
@@ -26,7 +26,8 @@ function createNextApiHandler(opts) {
|
|
|
26
26
|
}
|
|
27
27
|
const path = getPath();
|
|
28
28
|
if (path === null) {
|
|
29
|
-
const error =
|
|
29
|
+
const error = transformTRPCResponse.getErrorShape({
|
|
30
|
+
config: opts.router._def._config,
|
|
30
31
|
error: new TRPCError.TRPCError({
|
|
31
32
|
message: 'Query "trpc" not found - is the file named `[trpc]`.ts or `[...trpc].ts`?',
|
|
32
33
|
code: 'INTERNAL_SERVER_ERROR'
|
package/dist/adapters/next.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { T as TRPCError } from '../TRPCError-2b10c8d2.mjs';
|
|
2
|
-
import {
|
|
3
|
-
import '../
|
|
4
|
-
import '../
|
|
5
|
-
import '../codes-
|
|
6
|
-
import '../
|
|
7
|
-
import '../
|
|
2
|
+
import { g as getErrorShape } from '../transformTRPCResponse-6887ae6d.mjs';
|
|
3
|
+
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-8a261b10.mjs';
|
|
4
|
+
import '../index-315a9f08.mjs';
|
|
5
|
+
import '../codes-24aa1ce1.mjs';
|
|
6
|
+
import '../resolveHTTPResponse-36f4e729.mjs';
|
|
7
|
+
import '../config-d1cf9de0.mjs';
|
|
8
8
|
import '../contentType-acc3be52.mjs';
|
|
9
9
|
import './node-http/content-type/json/index.mjs';
|
|
10
10
|
import '../contentType-3194ed5f.mjs';
|
|
@@ -22,7 +22,8 @@ function createNextApiHandler(opts) {
|
|
|
22
22
|
}
|
|
23
23
|
const path = getPath();
|
|
24
24
|
if (path === null) {
|
|
25
|
-
const error =
|
|
25
|
+
const error = getErrorShape({
|
|
26
|
+
config: opts.router._def._config,
|
|
26
27
|
error: new TRPCError({
|
|
27
28
|
message: 'Query "trpc" not found - is the file named `[trpc]`.ts or `[...trpc].ts`?',
|
|
28
29
|
code: 'INTERNAL_SERVER_ERROR'
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var nodeHTTPRequestHandler = require('../../nodeHTTPRequestHandler-
|
|
6
|
-
require('../../resolveHTTPResponse-
|
|
7
|
-
require('../../config-
|
|
5
|
+
var nodeHTTPRequestHandler = require('../../nodeHTTPRequestHandler-7762c7d4.js');
|
|
6
|
+
require('../../resolveHTTPResponse-27fe1108.js');
|
|
7
|
+
require('../../config-f355c4d8.js');
|
|
8
8
|
require('../../TRPCError-16b2e52d.js');
|
|
9
|
-
require('../../
|
|
10
|
-
require('../../
|
|
11
|
-
require('../../transformTRPCResponse-
|
|
9
|
+
require('../../index-8e243a74.js');
|
|
10
|
+
require('../../codes-0eeb600d.js');
|
|
11
|
+
require('../../transformTRPCResponse-f7b2ffd1.js');
|
|
12
12
|
require('../../contentType-8356d528.js');
|
|
13
13
|
require('./content-type/json/index.js');
|
|
14
14
|
require('../../contentType-8c16408e.js');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { n as nodeHTTPRequestHandler } from '../../nodeHTTPRequestHandler-
|
|
2
|
-
import '../../resolveHTTPResponse-
|
|
3
|
-
import '../../config-
|
|
1
|
+
export { n as nodeHTTPRequestHandler } from '../../nodeHTTPRequestHandler-8a261b10.mjs';
|
|
2
|
+
import '../../resolveHTTPResponse-36f4e729.mjs';
|
|
3
|
+
import '../../config-d1cf9de0.mjs';
|
|
4
4
|
import '../../TRPCError-2b10c8d2.mjs';
|
|
5
|
-
import '../../
|
|
6
|
-
import '../../
|
|
7
|
-
import '../../transformTRPCResponse-
|
|
5
|
+
import '../../index-315a9f08.mjs';
|
|
6
|
+
import '../../codes-24aa1ce1.mjs';
|
|
7
|
+
import '../../transformTRPCResponse-6887ae6d.mjs';
|
|
8
8
|
import '../../contentType-acc3be52.mjs';
|
|
9
9
|
import './content-type/json/index.mjs';
|
|
10
10
|
import '../../contentType-3194ed5f.mjs';
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var http = require('node:http');
|
|
6
|
-
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-
|
|
7
|
-
require('../resolveHTTPResponse-
|
|
8
|
-
require('../config-
|
|
6
|
+
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-7762c7d4.js');
|
|
7
|
+
require('../resolveHTTPResponse-27fe1108.js');
|
|
8
|
+
require('../config-f355c4d8.js');
|
|
9
9
|
require('../TRPCError-16b2e52d.js');
|
|
10
|
-
require('../
|
|
11
|
-
require('../
|
|
12
|
-
require('../transformTRPCResponse-
|
|
10
|
+
require('../index-8e243a74.js');
|
|
11
|
+
require('../codes-0eeb600d.js');
|
|
12
|
+
require('../transformTRPCResponse-f7b2ffd1.js');
|
|
13
13
|
require('../contentType-8356d528.js');
|
|
14
14
|
require('./node-http/content-type/json/index.js');
|
|
15
15
|
require('../contentType-8c16408e.js');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
|
-
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-
|
|
3
|
-
import '../resolveHTTPResponse-
|
|
4
|
-
import '../config-
|
|
2
|
+
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-8a261b10.mjs';
|
|
3
|
+
import '../resolveHTTPResponse-36f4e729.mjs';
|
|
4
|
+
import '../config-d1cf9de0.mjs';
|
|
5
5
|
import '../TRPCError-2b10c8d2.mjs';
|
|
6
|
-
import '../
|
|
7
|
-
import '../
|
|
8
|
-
import '../transformTRPCResponse-
|
|
6
|
+
import '../index-315a9f08.mjs';
|
|
7
|
+
import '../codes-24aa1ce1.mjs';
|
|
8
|
+
import '../transformTRPCResponse-6887ae6d.mjs';
|
|
9
9
|
import '../contentType-acc3be52.mjs';
|
|
10
10
|
import './node-http/content-type/json/index.mjs';
|
|
11
11
|
import '../contentType-3194ed5f.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/adapters/ws.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EACL,SAAS,EAIV,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAEL,yBAAyB,EAG1B,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/adapters/ws.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EACL,SAAS,EAIV,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAEL,yBAAyB,EAG1B,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AAyCrB,wBAAgB,YAAY,CAC1B,GAAG,EAAE,OAAO,EACZ,WAAW,EAAE,uBAAuB,GACnC,yBAAyB,CA2B3B;AAED;;GAEG;AACH,oBAAY,iBAAiB,CAAC,OAAO,SAAS,SAAS,IAAI,kBAAkB,CAC3E,OAAO,EACP,eAAe,CAChB,GAAG;IACF,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;CAC1B,GAAG,2BAA2B,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC;AAE9D,oBAAY,yBAAyB,GAAG,8BAA8B,CACpE,eAAe,EACf,EAAE,CACH,CAAC;AAEF,wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EACvD,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC;;EAuQjC"}
|
package/dist/adapters/ws.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var config = require('../config-
|
|
5
|
+
var config = require('../config-f355c4d8.js');
|
|
6
6
|
var TRPCError = require('../TRPCError-16b2e52d.js');
|
|
7
|
-
var transformTRPCResponse = require('../transformTRPCResponse-8afb9a5c.js');
|
|
8
7
|
var observable = require('../observable-464116ac.js');
|
|
9
|
-
require('../
|
|
10
|
-
require('../index-
|
|
8
|
+
var transformTRPCResponse = require('../transformTRPCResponse-f7b2ffd1.js');
|
|
9
|
+
require('../index-8e243a74.js');
|
|
10
|
+
require('../codes-0eeb600d.js');
|
|
11
11
|
|
|
12
12
|
/* istanbul ignore next -- @preserve */ function assertIsObject(obj) {
|
|
13
13
|
if (typeof obj !== 'object' || Array.isArray(obj) || !obj) {
|
|
@@ -67,7 +67,7 @@ function applyWSSHandler(opts) {
|
|
|
67
67
|
wss.on('connection', async (client, req)=>{
|
|
68
68
|
const clientSubscriptions = new Map();
|
|
69
69
|
function respond(untransformedJSON) {
|
|
70
|
-
client.send(JSON.stringify(transformTRPCResponse.transformTRPCResponse(router, untransformedJSON)));
|
|
70
|
+
client.send(JSON.stringify(transformTRPCResponse.transformTRPCResponse(router._def._config, untransformedJSON)));
|
|
71
71
|
}
|
|
72
72
|
function stopSubscription(subscription, { id , jsonrpc }) {
|
|
73
73
|
subscription.unsubscribe();
|
|
@@ -158,7 +158,8 @@ function applyWSSHandler(opts) {
|
|
|
158
158
|
respond({
|
|
159
159
|
id,
|
|
160
160
|
jsonrpc,
|
|
161
|
-
error:
|
|
161
|
+
error: transformTRPCResponse.getErrorShape({
|
|
162
|
+
config: router._def._config,
|
|
162
163
|
error,
|
|
163
164
|
type,
|
|
164
165
|
path,
|
|
@@ -216,7 +217,8 @@ function applyWSSHandler(opts) {
|
|
|
216
217
|
respond({
|
|
217
218
|
id,
|
|
218
219
|
jsonrpc,
|
|
219
|
-
error:
|
|
220
|
+
error: transformTRPCResponse.getErrorShape({
|
|
221
|
+
config: router._def._config,
|
|
220
222
|
error,
|
|
221
223
|
type,
|
|
222
224
|
path,
|
|
@@ -241,7 +243,8 @@ function applyWSSHandler(opts) {
|
|
|
241
243
|
});
|
|
242
244
|
respond({
|
|
243
245
|
id: null,
|
|
244
|
-
error:
|
|
246
|
+
error: transformTRPCResponse.getErrorShape({
|
|
247
|
+
config: router._def._config,
|
|
245
248
|
error,
|
|
246
249
|
type: 'unknown',
|
|
247
250
|
path: undefined,
|
|
@@ -286,7 +289,8 @@ function applyWSSHandler(opts) {
|
|
|
286
289
|
});
|
|
287
290
|
respond({
|
|
288
291
|
id: null,
|
|
289
|
-
error:
|
|
292
|
+
error: transformTRPCResponse.getErrorShape({
|
|
293
|
+
config: router._def._config,
|
|
290
294
|
error,
|
|
291
295
|
type: 'unknown',
|
|
292
296
|
path: undefined,
|
package/dist/adapters/ws.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as callProcedure } from '../config-d1cf9de0.mjs';
|
|
2
2
|
import { T as TRPCError, g as getCauseFromUnknown, a as getTRPCErrorFromUnknown } from '../TRPCError-2b10c8d2.mjs';
|
|
3
|
-
import { t as transformTRPCResponse } from '../transformTRPCResponse-0ea8c0ca.mjs';
|
|
4
3
|
import { i as isObservable } from '../observable-ade1bad8.mjs';
|
|
5
|
-
import '../
|
|
6
|
-
import '../index-
|
|
4
|
+
import { g as getErrorShape, t as transformTRPCResponse } from '../transformTRPCResponse-6887ae6d.mjs';
|
|
5
|
+
import '../index-315a9f08.mjs';
|
|
6
|
+
import '../codes-24aa1ce1.mjs';
|
|
7
7
|
|
|
8
8
|
/* istanbul ignore next -- @preserve */ function assertIsObject(obj) {
|
|
9
9
|
if (typeof obj !== 'object' || Array.isArray(obj) || !obj) {
|
|
@@ -63,7 +63,7 @@ function applyWSSHandler(opts) {
|
|
|
63
63
|
wss.on('connection', async (client, req)=>{
|
|
64
64
|
const clientSubscriptions = new Map();
|
|
65
65
|
function respond(untransformedJSON) {
|
|
66
|
-
client.send(JSON.stringify(transformTRPCResponse(router, untransformedJSON)));
|
|
66
|
+
client.send(JSON.stringify(transformTRPCResponse(router._def._config, untransformedJSON)));
|
|
67
67
|
}
|
|
68
68
|
function stopSubscription(subscription, { id , jsonrpc }) {
|
|
69
69
|
subscription.unsubscribe();
|
|
@@ -154,7 +154,8 @@ function applyWSSHandler(opts) {
|
|
|
154
154
|
respond({
|
|
155
155
|
id,
|
|
156
156
|
jsonrpc,
|
|
157
|
-
error:
|
|
157
|
+
error: getErrorShape({
|
|
158
|
+
config: router._def._config,
|
|
158
159
|
error,
|
|
159
160
|
type,
|
|
160
161
|
path,
|
|
@@ -212,7 +213,8 @@ function applyWSSHandler(opts) {
|
|
|
212
213
|
respond({
|
|
213
214
|
id,
|
|
214
215
|
jsonrpc,
|
|
215
|
-
error:
|
|
216
|
+
error: getErrorShape({
|
|
217
|
+
config: router._def._config,
|
|
216
218
|
error,
|
|
217
219
|
type,
|
|
218
220
|
path,
|
|
@@ -237,7 +239,8 @@ function applyWSSHandler(opts) {
|
|
|
237
239
|
});
|
|
238
240
|
respond({
|
|
239
241
|
id: null,
|
|
240
|
-
error:
|
|
242
|
+
error: getErrorShape({
|
|
243
|
+
config: router._def._config,
|
|
241
244
|
error,
|
|
242
245
|
type: 'unknown',
|
|
243
246
|
path: undefined,
|
|
@@ -282,7 +285,8 @@ function applyWSSHandler(opts) {
|
|
|
282
285
|
});
|
|
283
286
|
respond({
|
|
284
287
|
id: null,
|
|
285
|
-
error:
|
|
288
|
+
error: getErrorShape({
|
|
289
|
+
config: router._def._config,
|
|
286
290
|
error,
|
|
287
291
|
type: 'unknown',
|
|
288
292
|
path: undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { T as TRPCError } from './TRPCError-61026c9a.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { a as createRecursiveProxy, g as getHTTPStatusCodeFromError } from './index-cddfa242.js';
|
|
3
|
+
import { T as TRPC_ERROR_CODES_BY_KEY } from './codes-b3c262d8.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
@@ -24,50 +24,6 @@ const defaultFormatter = ({ shape, }) => {
|
|
|
24
24
|
return shape;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const TRPC_ERROR_CODES_BY_NUMBER = invert(TRPC_ERROR_CODES_BY_KEY);
|
|
28
|
-
const JSONRPC2_TO_HTTP_CODE = {
|
|
29
|
-
PARSE_ERROR: 400,
|
|
30
|
-
BAD_REQUEST: 400,
|
|
31
|
-
NOT_FOUND: 404,
|
|
32
|
-
INTERNAL_SERVER_ERROR: 500,
|
|
33
|
-
UNAUTHORIZED: 401,
|
|
34
|
-
FORBIDDEN: 403,
|
|
35
|
-
TIMEOUT: 408,
|
|
36
|
-
CONFLICT: 409,
|
|
37
|
-
CLIENT_CLOSED_REQUEST: 499,
|
|
38
|
-
PRECONDITION_FAILED: 412,
|
|
39
|
-
PAYLOAD_TOO_LARGE: 413,
|
|
40
|
-
METHOD_NOT_SUPPORTED: 405,
|
|
41
|
-
UNPROCESSABLE_CONTENT: 422,
|
|
42
|
-
TOO_MANY_REQUESTS: 429,
|
|
43
|
-
};
|
|
44
|
-
function getStatusCodeFromKey(code) {
|
|
45
|
-
return JSONRPC2_TO_HTTP_CODE[code] ?? 500;
|
|
46
|
-
}
|
|
47
|
-
function getHTTPStatusCode(json) {
|
|
48
|
-
const arr = Array.isArray(json) ? json : [json];
|
|
49
|
-
const httpStatuses = new Set(arr.map((res) => {
|
|
50
|
-
if ('error' in res) {
|
|
51
|
-
const data = res.error.data;
|
|
52
|
-
if (typeof data.httpStatus === 'number') {
|
|
53
|
-
return data.httpStatus;
|
|
54
|
-
}
|
|
55
|
-
const code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];
|
|
56
|
-
return getStatusCodeFromKey(code);
|
|
57
|
-
}
|
|
58
|
-
return 200;
|
|
59
|
-
}));
|
|
60
|
-
if (httpStatuses.size !== 1) {
|
|
61
|
-
return 207;
|
|
62
|
-
}
|
|
63
|
-
const httpStatus = httpStatuses.values().next().value;
|
|
64
|
-
return httpStatus;
|
|
65
|
-
}
|
|
66
|
-
function getHTTPStatusCodeFromError(error) {
|
|
67
|
-
const { code } = error;
|
|
68
|
-
return getStatusCodeFromKey(code);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
27
|
/**
|
|
72
28
|
* Create an object without inheriting anything from `Object.prototype`
|
|
73
29
|
* @internal
|
|
@@ -247,4 +203,4 @@ const isServerDefault = typeof window === 'undefined' ||
|
|
|
247
203
|
!!globalThis.process?.env?.JEST_WORKER_ID ||
|
|
248
204
|
!!globalThis.process?.env?.VITEST_WORKER_ID;
|
|
249
205
|
|
|
250
|
-
export {
|
|
206
|
+
export { defaultTransformer as a, callProcedure as b, createRouterFactory as c, defaultFormatter as d, getDataTransformer as g, isServerDefault as i, procedureTypes as p };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { T as TRPCError } from './TRPCError-2b10c8d2.mjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { a as createRecursiveProxy, g as getHTTPStatusCodeFromError } from './index-315a9f08.mjs';
|
|
3
|
+
import { T as TRPC_ERROR_CODES_BY_KEY } from './codes-24aa1ce1.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @public
|
|
@@ -33,52 +33,6 @@ const defaultFormatter = ({ shape })=>{
|
|
|
33
33
|
return shape;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const TRPC_ERROR_CODES_BY_NUMBER = invert(TRPC_ERROR_CODES_BY_KEY);
|
|
37
|
-
const JSONRPC2_TO_HTTP_CODE = {
|
|
38
|
-
PARSE_ERROR: 400,
|
|
39
|
-
BAD_REQUEST: 400,
|
|
40
|
-
NOT_FOUND: 404,
|
|
41
|
-
INTERNAL_SERVER_ERROR: 500,
|
|
42
|
-
UNAUTHORIZED: 401,
|
|
43
|
-
FORBIDDEN: 403,
|
|
44
|
-
TIMEOUT: 408,
|
|
45
|
-
CONFLICT: 409,
|
|
46
|
-
CLIENT_CLOSED_REQUEST: 499,
|
|
47
|
-
PRECONDITION_FAILED: 412,
|
|
48
|
-
PAYLOAD_TOO_LARGE: 413,
|
|
49
|
-
METHOD_NOT_SUPPORTED: 405,
|
|
50
|
-
UNPROCESSABLE_CONTENT: 422,
|
|
51
|
-
TOO_MANY_REQUESTS: 429
|
|
52
|
-
};
|
|
53
|
-
function getStatusCodeFromKey(code) {
|
|
54
|
-
return JSONRPC2_TO_HTTP_CODE[code] ?? 500;
|
|
55
|
-
}
|
|
56
|
-
function getHTTPStatusCode(json) {
|
|
57
|
-
const arr = Array.isArray(json) ? json : [
|
|
58
|
-
json
|
|
59
|
-
];
|
|
60
|
-
const httpStatuses = new Set(arr.map((res)=>{
|
|
61
|
-
if ('error' in res) {
|
|
62
|
-
const data = res.error.data;
|
|
63
|
-
if (typeof data.httpStatus === 'number') {
|
|
64
|
-
return data.httpStatus;
|
|
65
|
-
}
|
|
66
|
-
const code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];
|
|
67
|
-
return getStatusCodeFromKey(code);
|
|
68
|
-
}
|
|
69
|
-
return 200;
|
|
70
|
-
}));
|
|
71
|
-
if (httpStatuses.size !== 1) {
|
|
72
|
-
return 207;
|
|
73
|
-
}
|
|
74
|
-
const httpStatus = httpStatuses.values().next().value;
|
|
75
|
-
return httpStatus;
|
|
76
|
-
}
|
|
77
|
-
function getHTTPStatusCodeFromError(error) {
|
|
78
|
-
const { code } = error;
|
|
79
|
-
return getStatusCodeFromKey(code);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
36
|
/**
|
|
83
37
|
* Create an object without inheriting anything from `Object.prototype`
|
|
84
38
|
* @internal
|
|
@@ -254,4 +208,4 @@ const emptyRouter = {
|
|
|
254
208
|
* The default check to see if we're in a server
|
|
255
209
|
*/ const isServerDefault = typeof window === 'undefined' || 'Deno' in window || globalThis.process?.env?.NODE_ENV === 'test' || !!globalThis.process?.env?.JEST_WORKER_ID || !!globalThis.process?.env?.VITEST_WORKER_ID;
|
|
256
210
|
|
|
257
|
-
export {
|
|
211
|
+
export { defaultTransformer as a, callProcedure as b, createRouterFactory as c, defaultFormatter as d, getDataTransformer as g, isServerDefault as i, procedureTypes as p };
|