@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.
Files changed (209) hide show
  1. package/dist/@trpc-core-unstable-do-not-import-this-please.d.ts +9 -0
  2. package/dist/@trpc-core-unstable-do-not-import-this-please.d.ts.map +1 -0
  3. package/dist/@trpc-server/http.d.ts +1 -1
  4. package/dist/@trpc-server/http.d.ts.map +1 -1
  5. package/dist/@trpc-server.d.ts +3 -3
  6. package/dist/@trpc-server.d.ts.map +1 -1
  7. package/dist/adapters/aws-lambda/index.d.ts +1 -1
  8. package/dist/adapters/aws-lambda/index.js +7 -13
  9. package/dist/adapters/aws-lambda/index.mjs +3 -9
  10. package/dist/adapters/aws-lambda/utils.d.ts +1 -1
  11. package/dist/adapters/express.d.ts +1 -1
  12. package/dist/adapters/express.d.ts.map +1 -1
  13. package/dist/adapters/express.js +2 -9
  14. package/dist/adapters/express.mjs +2 -9
  15. package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts +1 -1
  16. package/dist/adapters/fastify/index.js +4 -13
  17. package/dist/adapters/fastify/index.mjs +2 -11
  18. package/dist/adapters/fetch/fetchRequestHandler.d.ts +1 -1
  19. package/dist/adapters/fetch/index.js +4 -11
  20. package/dist/adapters/fetch/index.mjs +2 -9
  21. package/dist/adapters/fetch/types.d.ts +1 -1
  22. package/dist/adapters/next.d.ts +1 -1
  23. package/dist/adapters/next.js +5 -12
  24. package/dist/adapters/next.mjs +3 -10
  25. package/dist/adapters/node-http/content-type/json/index.js +3 -6
  26. package/dist/adapters/node-http/content-type/json/index.mjs +1 -4
  27. package/dist/adapters/node-http/index.js +2 -9
  28. package/dist/adapters/node-http/index.mjs +2 -9
  29. package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts +1 -1
  30. package/dist/adapters/node-http/types.d.ts +2 -2
  31. package/dist/adapters/node-http/types.d.ts.map +1 -1
  32. package/dist/adapters/standalone.d.ts +1 -1
  33. package/dist/adapters/standalone.js +2 -9
  34. package/dist/adapters/standalone.mjs +2 -9
  35. package/dist/adapters/ws.d.ts +1 -2
  36. package/dist/adapters/ws.d.ts.map +1 -1
  37. package/dist/adapters/ws.js +26 -32
  38. package/dist/adapters/ws.mjs +1 -7
  39. package/dist/http.d.ts +6 -6
  40. package/dist/http.d.ts.map +1 -1
  41. package/dist/http.js +21 -13
  42. package/dist/http.mjs +1 -8
  43. package/dist/index.js +41 -16
  44. package/dist/index.mjs +1 -6
  45. package/dist/{nodeHTTPRequestHandler-d8558115.mjs → nodeHTTPRequestHandler-2d5c8791.mjs} +2 -4
  46. package/dist/{nodeHTTPRequestHandler-0bc1dc41.js → nodeHTTPRequestHandler-55f05150.js} +4 -6
  47. package/dist/{nodeHTTPRequestHandler-c7d41cde.js → nodeHTTPRequestHandler-7691fc79.js} +1 -3
  48. package/dist/observable.d.ts +3 -0
  49. package/dist/observable.d.ts.map +1 -0
  50. package/dist/observable.js +32 -0
  51. package/dist/observable.mjs +1 -0
  52. package/dist/rpc.d.ts +2 -2
  53. package/dist/rpc.d.ts.map +1 -1
  54. package/dist/rpc.js +13 -6
  55. package/dist/rpc.mjs +1 -3
  56. package/dist/shared.js +9 -5
  57. package/dist/shared.mjs +1 -3
  58. package/package.json +125 -53
  59. package/src/@trpc-core-unstable-do-not-import-this-please.ts +9 -0
  60. package/src/@trpc-server/http.ts +1 -2
  61. package/src/@trpc-server.ts +3 -3
  62. package/src/adapters/aws-lambda/index.ts +1 -1
  63. package/src/adapters/aws-lambda/utils.ts +1 -1
  64. package/src/adapters/express.ts +2 -1
  65. package/src/adapters/fastify/fastifyRequestHandler.ts +1 -1
  66. package/src/adapters/fastify/fastifyTRPCPlugin.ts +1 -1
  67. package/src/adapters/fetch/fetchRequestHandler.ts +1 -1
  68. package/src/adapters/fetch/types.ts +1 -1
  69. package/src/adapters/next.ts +1 -1
  70. package/src/adapters/node-http/nodeHTTPRequestHandler.ts +1 -1
  71. package/src/adapters/node-http/types.ts +3 -2
  72. package/src/adapters/standalone.ts +1 -1
  73. package/src/adapters/ws.ts +10 -9
  74. package/src/http.ts +6 -6
  75. package/src/observable.ts +16 -0
  76. package/src/rpc.ts +2 -2
  77. package/dist/TRPCError-57838b33.js +0 -67
  78. package/dist/TRPCError-af754aba.mjs +0 -63
  79. package/dist/TRPCError-ebbde27d.js +0 -61
  80. package/dist/batchStreamFormatter-1971db27.js +0 -32
  81. package/dist/batchStreamFormatter-378277dc.mjs +0 -30
  82. package/dist/batchStreamFormatter-4375dc8b.js +0 -31
  83. package/dist/bundle-analysis.json +0 -770
  84. package/dist/contentType-9756da28.js +0 -59
  85. package/dist/contentType-b31eab56.js +0 -54
  86. package/dist/contentType-f93c6ba8.mjs +0 -52
  87. package/dist/createProxy-7293f632.mjs +0 -121
  88. package/dist/createProxy-c5cd21e8.js +0 -127
  89. package/dist/createProxy-f6960c7b.js +0 -116
  90. package/dist/initTRPC-6c16fa27.mjs +0 -377
  91. package/dist/initTRPC-8b5714ea.js +0 -385
  92. package/dist/initTRPC-b65b35e2.js +0 -372
  93. package/dist/observable/index.d.ts +0 -5
  94. package/dist/observable/index.d.ts.map +0 -1
  95. package/dist/observable/index.js +0 -111
  96. package/dist/observable/index.mjs +0 -102
  97. package/dist/observable/observable.d.ts +0 -13
  98. package/dist/observable/observable.d.ts.map +0 -1
  99. package/dist/observable/operators.d.ts +0 -8
  100. package/dist/observable/operators.d.ts.map +0 -1
  101. package/dist/observable/types.d.ts +0 -26
  102. package/dist/observable/types.d.ts.map +0 -1
  103. package/dist/observable-7233bd21.mjs +0 -121
  104. package/dist/observable-7865c812.js +0 -125
  105. package/dist/observable-cbbc588a.js +0 -125
  106. package/dist/parseTRPCMessage-3ae1b295.js +0 -67
  107. package/dist/parseTRPCMessage-abbd6862.mjs +0 -62
  108. package/dist/parseTRPCMessage-c6022e94.js +0 -65
  109. package/dist/resolveHTTPResponse-3133d603.js +0 -265
  110. package/dist/resolveHTTPResponse-80c99f62.mjs +0 -291
  111. package/dist/resolveHTTPResponse-9e260431.js +0 -293
  112. package/dist/rootConfig-a1ad09d0.js +0 -48
  113. package/dist/rootConfig-db88d377.js +0 -44
  114. package/dist/rootConfig-f741a4e7.mjs +0 -40
  115. package/dist/router-68063d64.mjs +0 -252
  116. package/dist/router-7a7bb4fd.js +0 -262
  117. package/dist/router-c5bd7780.js +0 -259
  118. package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts +0 -6
  119. package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts.map +0 -1
  120. package/dist/unstable-core-do-not-import/createProxy.d.ts +0 -19
  121. package/dist/unstable-core-do-not-import/createProxy.d.ts.map +0 -1
  122. package/dist/unstable-core-do-not-import/error/TRPCError.d.ts +0 -13
  123. package/dist/unstable-core-do-not-import/error/TRPCError.d.ts.map +0 -1
  124. package/dist/unstable-core-do-not-import/error/formatter.d.ts +0 -33
  125. package/dist/unstable-core-do-not-import/error/formatter.d.ts.map +0 -1
  126. package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts +0 -15
  127. package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts.map +0 -1
  128. package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts +0 -24
  129. package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts.map +0 -1
  130. package/dist/unstable-core-do-not-import/http/contentType.d.ts +0 -29
  131. package/dist/unstable-core-do-not-import/http/contentType.d.ts.map +0 -1
  132. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts +0 -5
  133. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +0 -1
  134. package/dist/unstable-core-do-not-import/http/index.d.ts +0 -7
  135. package/dist/unstable-core-do-not-import/http/index.d.ts.map +0 -1
  136. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts +0 -51
  137. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts.map +0 -1
  138. package/dist/unstable-core-do-not-import/http/types.d.ts +0 -96
  139. package/dist/unstable-core-do-not-import/http/types.d.ts.map +0 -1
  140. package/dist/unstable-core-do-not-import/index.d.ts +0 -34
  141. package/dist/unstable-core-do-not-import/index.d.ts.map +0 -1
  142. package/dist/unstable-core-do-not-import/index.js +0 -44
  143. package/dist/unstable-core-do-not-import/index.mjs +0 -10
  144. package/dist/unstable-core-do-not-import/initTRPC.d.ts +0 -96
  145. package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +0 -1
  146. package/dist/unstable-core-do-not-import/middleware.d.ts +0 -105
  147. package/dist/unstable-core-do-not-import/middleware.d.ts.map +0 -1
  148. package/dist/unstable-core-do-not-import/parser.d.ts +0 -30
  149. package/dist/unstable-core-do-not-import/parser.d.ts.map +0 -1
  150. package/dist/unstable-core-do-not-import/procedure.d.ts +0 -72
  151. package/dist/unstable-core-do-not-import/procedure.d.ts.map +0 -1
  152. package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +0 -101
  153. package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +0 -1
  154. package/dist/unstable-core-do-not-import/rootConfig.d.ts +0 -75
  155. package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +0 -1
  156. package/dist/unstable-core-do-not-import/router.d.ts +0 -85
  157. package/dist/unstable-core-do-not-import/router.d.ts.map +0 -1
  158. package/dist/unstable-core-do-not-import/rpc/codes.d.ts +0 -51
  159. package/dist/unstable-core-do-not-import/rpc/codes.d.ts.map +0 -1
  160. package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +0 -97
  161. package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +0 -1
  162. package/dist/unstable-core-do-not-import/rpc/index.d.ts +0 -5
  163. package/dist/unstable-core-do-not-import/rpc/index.d.ts.map +0 -1
  164. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts +0 -5
  165. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts.map +0 -1
  166. package/dist/unstable-core-do-not-import/serialize.d.ts +0 -62
  167. package/dist/unstable-core-do-not-import/serialize.d.ts.map +0 -1
  168. package/dist/unstable-core-do-not-import/transformer.d.ts +0 -107
  169. package/dist/unstable-core-do-not-import/transformer.d.ts.map +0 -1
  170. package/dist/unstable-core-do-not-import/types.d.ts +0 -98
  171. package/dist/unstable-core-do-not-import/types.d.ts.map +0 -1
  172. package/dist/unstable-core-do-not-import/utils.d.ts +0 -31
  173. package/dist/unstable-core-do-not-import/utils.d.ts.map +0 -1
  174. package/dist/utils-42a3ba6d.js +0 -50
  175. package/dist/utils-cf6178ec.mjs +0 -44
  176. package/dist/utils-e1d51fac.js +0 -49
  177. package/src/observable/index.ts +0 -10
  178. package/src/observable/observable.ts +0 -155
  179. package/src/observable/operators.ts +0 -119
  180. package/src/observable/types.ts +0 -76
  181. package/src/unstable-core-do-not-import/TRPCInferrable.ts +0 -9
  182. package/src/unstable-core-do-not-import/createProxy.ts +0 -59
  183. package/src/unstable-core-do-not-import/error/TRPCError.ts +0 -82
  184. package/src/unstable-core-do-not-import/error/formatter.ts +0 -51
  185. package/src/unstable-core-do-not-import/error/getErrorShape.ts +0 -36
  186. package/src/unstable-core-do-not-import/http/batchStreamFormatter.ts +0 -29
  187. package/src/unstable-core-do-not-import/http/contentType.ts +0 -99
  188. package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +0 -57
  189. package/src/unstable-core-do-not-import/http/index.ts +0 -23
  190. package/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts +0 -458
  191. package/src/unstable-core-do-not-import/http/types.ts +0 -111
  192. package/src/unstable-core-do-not-import/index.ts +0 -107
  193. package/src/unstable-core-do-not-import/initTRPC.ts +0 -206
  194. package/src/unstable-core-do-not-import/middleware.ts +0 -233
  195. package/src/unstable-core-do-not-import/parser.ts +0 -94
  196. package/src/unstable-core-do-not-import/procedure.ts +0 -108
  197. package/src/unstable-core-do-not-import/procedureBuilder.ts +0 -458
  198. package/src/unstable-core-do-not-import/rootConfig.ts +0 -90
  199. package/src/unstable-core-do-not-import/router.ts +0 -370
  200. package/src/unstable-core-do-not-import/rpc/codes.ts +0 -44
  201. package/src/unstable-core-do-not-import/rpc/envelopes.ts +0 -136
  202. package/src/unstable-core-do-not-import/rpc/index.ts +0 -21
  203. package/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts +0 -85
  204. package/src/unstable-core-do-not-import/serialize.ts +0 -122
  205. package/src/unstable-core-do-not-import/transformer.ts +0 -202
  206. package/src/unstable-core-do-not-import/types.ts +0 -151
  207. package/src/unstable-core-do-not-import/utils.ts +0 -66
  208. package/unstable-core-do-not-import/index.d.ts +0 -1
  209. 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 };