@trpc/server 11.0.0-alpha-tmp-nosideeffects.257 → 11.0.0-alpha-tmp-02-08-tmp.274

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 (46) hide show
  1. package/dist/@trpc/server/http.d.ts +1 -0
  2. package/dist/@trpc/server/http.d.ts.map +1 -1
  3. package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts.map +1 -1
  4. package/dist/adapters/fastify/fastifyTRPCPlugin.js +2 -0
  5. package/dist/adapters/fastify/fastifyTRPCPlugin.mjs +2 -0
  6. package/dist/adapters/fetch/fetchRequestHandler.d.ts.map +1 -1
  7. package/dist/adapters/fetch/fetchRequestHandler.js +2 -1
  8. package/dist/adapters/fetch/fetchRequestHandler.mjs +2 -1
  9. package/dist/adapters/standalone.d.ts.map +1 -1
  10. package/dist/adapters/standalone.js +7 -3
  11. package/dist/adapters/standalone.mjs +7 -3
  12. package/dist/adapters/ws.d.ts +1 -0
  13. package/dist/adapters/ws.d.ts.map +1 -1
  14. package/dist/adapters/ws.js +4 -1
  15. package/dist/adapters/ws.mjs +4 -1
  16. package/dist/bundle-analysis.json +728 -0
  17. package/dist/http.js +2 -0
  18. package/dist/http.mjs +1 -0
  19. package/dist/unstable-core-do-not-import/clientish/inference.d.ts +4 -4
  20. package/dist/unstable-core-do-not-import/clientish/inference.d.ts.map +1 -1
  21. package/dist/unstable-core-do-not-import/clientish/inferrable.d.ts +5 -6
  22. package/dist/unstable-core-do-not-import/clientish/inferrable.d.ts.map +1 -1
  23. package/dist/unstable-core-do-not-import/http/index.d.ts +1 -0
  24. package/dist/unstable-core-do-not-import/http/index.d.ts.map +1 -1
  25. package/dist/unstable-core-do-not-import/http/toURL.d.ts +2 -0
  26. package/dist/unstable-core-do-not-import/http/toURL.d.ts.map +1 -0
  27. package/dist/unstable-core-do-not-import/http/toURL.js +8 -0
  28. package/dist/unstable-core-do-not-import/http/toURL.mjs +6 -0
  29. package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +4 -3
  30. package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +1 -1
  31. package/dist/unstable-core-do-not-import/router.d.ts +3 -1
  32. package/dist/unstable-core-do-not-import/router.d.ts.map +1 -1
  33. package/dist/unstable-core-do-not-import.js +2 -0
  34. package/dist/unstable-core-do-not-import.mjs +1 -0
  35. package/package.json +4 -4
  36. package/src/@trpc/server/http.ts +1 -0
  37. package/src/adapters/fastify/fastifyTRPCPlugin.ts +2 -0
  38. package/src/adapters/fetch/fetchRequestHandler.ts +3 -1
  39. package/src/adapters/standalone.ts +6 -3
  40. package/src/adapters/ws.ts +6 -1
  41. package/src/unstable-core-do-not-import/clientish/inference.ts +5 -5
  42. package/src/unstable-core-do-not-import/clientish/inferrable.ts +6 -12
  43. package/src/unstable-core-do-not-import/http/index.ts +2 -0
  44. package/src/unstable-core-do-not-import/http/toURL.ts +7 -0
  45. package/src/unstable-core-do-not-import/procedureBuilder.ts +8 -4
  46. package/src/unstable-core-do-not-import/router.ts +6 -1
@@ -4,4 +4,5 @@ export type { BaseHandlerOptions, HTTPBaseHandlerOptions, HTTPHeaders, HTTPReque
4
4
  export { getBatchStreamFormatter } from '../../unstable-core-do-not-import';
5
5
  export type { BaseContentTypeHandler, BodyResult, } from '../../unstable-core-do-not-import';
6
6
  export { getJsonContentTypeInputs } from '../../unstable-core-do-not-import';
7
+ export { toURL } from '../../unstable-core-do-not-import';
7
8
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kCAAkC,EAClC,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,YAAY,EACV,sBAAsB,EACtB,UAAU,GACX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kCAAkC,EAClC,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,YAAY,EACV,sBAAsB,EACtB,UAAU,GACX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fastifyTRPCPlugin.d.ts","sourceRoot":"","sources":["../../../src/adapters/fastify/fastifyTRPCPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,GAAG,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,8BAA8B,EA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AAwB,CAAC,OAAO,CAAC,EACvC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,QAoC5B"}
@@ -20,6 +20,7 @@ function fastifyTRPCPlugin(fastify, opts, done) {
20
20
  _done(null, body);
21
21
  });
22
22
  let prefix = opts.prefix ?? '';
23
+ const websocketPrefix = prefix;
23
24
  // https://github.com/fastify/fastify-plugin/blob/fe079bef6557a83794bf437e14b9b9edb8a74104/plugin.js#L11
24
25
  // @ts-expect-error property 'default' does not exists on type ...
25
26
  if (typeof fastifyTRPCPlugin.default !== 'function') {
@@ -37,6 +38,7 @@ function fastifyTRPCPlugin(fastify, opts, done) {
37
38
  if (opts.useWSS) {
38
39
  ws.applyWSSHandler({
39
40
  ...opts.trpcOptions,
41
+ prefix: websocketPrefix,
40
42
  wss: fastify.websocketServer
41
43
  });
42
44
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -18,6 +18,7 @@ function fastifyTRPCPlugin(fastify, opts, done) {
18
18
  _done(null, body);
19
19
  });
20
20
  let prefix = opts.prefix ?? '';
21
+ const websocketPrefix = prefix;
21
22
  // https://github.com/fastify/fastify-plugin/blob/fe079bef6557a83794bf437e14b9b9edb8a74104/plugin.js#L11
22
23
  // @ts-expect-error property 'default' does not exists on type ...
23
24
  if (typeof fastifyTRPCPlugin.default !== 'function') {
@@ -35,6 +36,7 @@ function fastifyTRPCPlugin(fastify, opts, done) {
35
36
  if (opts.useWSS) {
36
37
  applyWSSHandler({
37
38
  ...opts.trpcOptions,
39
+ prefix: websocketPrefix,
38
40
  wss: fastify.websocketServer
39
41
  });
40
42
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -1 +1 @@
1
- {"version":3,"file":"fetchRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/fetchRequestHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAWpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,0BAA0B,CAAC,OAAO,SAAS,SAAS,IAC9D,mBAAmB,CAAC,OAAO,CAAC,GAAG;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AASJ,wBAAsB,mBAAmB,CAAC,OAAO,SAAS,SAAS,EACjE,IAAI,EAAE,0BAA0B,CAAC,OAAO,CAAC,GACxC,OAAO,CAAC,QAAQ,CAAC,CAyGnB"}
1
+ {"version":3,"file":"fetchRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/fetchRequestHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAYpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,0BAA0B,CAAC,OAAO,SAAS,SAAS,IAC9D,mBAAmB,CAAC,OAAO,CAAC,GAAG;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AASJ,wBAAsB,mBAAmB,CAAC,OAAO,SAAS,SAAS,EACjE,IAAI,EAAE,0BAA0B,CAAC,OAAO,CAAC,GACxC,OAAO,CAAC,QAAQ,CAAC,CAyGnB"}
@@ -3,6 +3,7 @@
3
3
  require('../../unstable-core-do-not-import/rpc/codes.js');
4
4
  var resolveHTTPResponse = require('../../unstable-core-do-not-import/http/resolveHTTPResponse.js');
5
5
  var batchStreamFormatter = require('../../unstable-core-do-not-import/http/batchStreamFormatter.js');
6
+ var toURL = require('../../unstable-core-do-not-import/http/toURL.js');
6
7
  require('../../unstable-core-do-not-import/rootConfig.js');
7
8
 
8
9
  /**
@@ -28,7 +29,7 @@ async function fetchRequestHandler(opts) {
28
29
  ...innerOpts
29
30
  });
30
31
  };
31
- const url = new URL(opts.req.url);
32
+ const url = toURL.toURL(opts.req.url);
32
33
  const pathname = trimSlashes(url.pathname);
33
34
  const endpoint = trimSlashes(opts.endpoint);
34
35
  const path = trimSlashes(pathname.slice(endpoint.length));
@@ -1,6 +1,7 @@
1
1
  import '../../unstable-core-do-not-import/rpc/codes.mjs';
2
2
  import { resolveHTTPResponse } from '../../unstable-core-do-not-import/http/resolveHTTPResponse.mjs';
3
3
  import { getBatchStreamFormatter } from '../../unstable-core-do-not-import/http/batchStreamFormatter.mjs';
4
+ import { toURL } from '../../unstable-core-do-not-import/http/toURL.mjs';
4
5
  import '../../unstable-core-do-not-import/rootConfig.mjs';
5
6
 
6
7
  /**
@@ -26,7 +27,7 @@ async function fetchRequestHandler(opts) {
26
27
  ...innerOpts
27
28
  });
28
29
  };
29
- const url = new URL(opts.req.url);
30
+ const url = toURL(opts.req.url);
30
31
  const pathname = trimSlashes(url.pathname);
31
32
  const endpoint = trimSlashes(opts.endpoint);
32
33
  const path = trimSlashes(pathname.slice(endpoint.length));
@@ -1 +1 @@
1
- {"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../src/adapters/standalone.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EACV,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,wBAAwB,CAAC,OAAO,SAAS,SAAS,IAC5D,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AAE7E,MAAM,MAAM,wBAAwB,GAAG,8BAA8B,CACnE,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,cAAc,CACpB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,SAAS,EACzD,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,SAEpB,KAAK,eAAe,OAAO,KAAK,cAAc,mBAclE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,SAAS,EACxD,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,wEAIxC"}
1
+ {"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../src/adapters/standalone.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EACV,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,wBAAwB,CAAC,OAAO,SAAS,SAAS,IAC5D,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AAE7E,MAAM,MAAM,wBAAwB,GAAG,8BAA8B,CACnE,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,cAAc,CACpB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,SAAS,EACzD,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,SAEpB,KAAK,eAAe,OAAO,KAAK,cAAc,mBAgBlE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,SAAS,EACxD,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,wEAIxC"}
@@ -1,13 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var http = require('node:http');
4
+ require('../unstable-core-do-not-import/rpc/codes.js');
5
+ var toURL = require('../unstable-core-do-not-import/http/toURL.js');
6
+ require('../unstable-core-do-not-import/rootConfig.js');
4
7
  var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
5
8
 
6
9
  function createHTTPHandler(opts) {
7
10
  return async (req, res)=>{
8
- // Get procedure path and remove the leading slash, `/procedure -> procedure`
9
- // Use dummy hostname if one is not provided.
10
- const path = new URL(req.url, 'http://127.0.0.1').pathname.slice(1);
11
+ const url = toURL.toURL(req.url);
12
+ // get procedure path and remove the leading slash
13
+ // /procedure -> procedure
14
+ const path = url.pathname.slice(1);
11
15
  await nodeHTTPRequestHandler.nodeHTTPRequestHandler({
12
16
  // FIXME: no typecasting should be needed here
13
17
  ...opts,
@@ -1,11 +1,15 @@
1
1
  import http from 'node:http';
2
+ import '../unstable-core-do-not-import/rpc/codes.mjs';
3
+ import { toURL } from '../unstable-core-do-not-import/http/toURL.mjs';
4
+ import '../unstable-core-do-not-import/rootConfig.mjs';
2
5
  import { nodeHTTPRequestHandler } from './node-http/nodeHTTPRequestHandler.mjs';
3
6
 
4
7
  function createHTTPHandler(opts) {
5
8
  return async (req, res)=>{
6
- // Get procedure path and remove the leading slash, `/procedure -> procedure`
7
- // Use dummy hostname if one is not provided.
8
- const path = new URL(req.url, 'http://127.0.0.1').pathname.slice(1);
9
+ const url = toURL(req.url);
10
+ // get procedure path and remove the leading slash
11
+ // /procedure -> procedure
12
+ const path = url.pathname.slice(1);
9
13
  await nodeHTTPRequestHandler({
10
14
  // FIXME: no typecasting should be needed here
11
15
  ...opts,
@@ -31,6 +31,7 @@ export type WSSHandlerOptions<TRouter extends AnyRouter> = BaseHandlerOptions<TR
31
31
  }) & {
32
32
  wss: ws.WebSocketServer;
33
33
  process?: NodeJS.Process;
34
+ prefix?: string;
34
35
  };
35
36
  export declare function applyWSSHandler<TRouter extends AnyRouter>(opts: WSSHandlerOptions<TRouter>): {
36
37
  broadcastReconnectNotification: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../src/adapters/ws.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAQrE,OAAO,KAAK,EAAE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EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAY/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAQlE;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,8BAA8B,CAAC,eAAe,EAAE,EAAE,CAAC,SAAS,CAAC,EAC7D,MAAM,CACP,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,SAAS,IAAI,CAC1D,IAAI,EAAE,yBAAyB,KAC5B,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,OAAO,SAAS,SAAS,IAAI,kBAAkB,CAC3E,OAAO,EACP,eAAe,CAChB,GACC,CAAC,MAAM,SAAS,kBAAkB,CAAC,OAAO,CAAC,GACvC;IACE;;QAEI;IACJ,aAAa,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;CAC7C,GACD;IACE;;QAEI;IACJ,aAAa,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;CAC5C,CAAC,GAAG;IACP,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEJ,wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EACvD,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC;;EA4QjC"}
@@ -14,9 +14,12 @@ var observable = require('../observable/observable.js');
14
14
  * @link https://github.com/trpc/trpc/pull/5279
15
15
  */ const WEBSOCKET_OPEN = 1; /* ws.WebSocket.OPEN */
16
16
  function applyWSSHandler(opts) {
17
- const { wss , createContext , router: router$1 } = opts;
17
+ const { wss , createContext , router: router$1 , prefix } = opts;
18
18
  const { transformer: transformer$1 } = router$1._def._config;
19
19
  wss.on('connection', async (client, req)=>{
20
+ if (prefix && !req.url?.startsWith(prefix)) {
21
+ return;
22
+ }
20
23
  const clientSubscriptions = new Map();
21
24
  function respond(untransformedJSON) {
22
25
  client.send(JSON.stringify(transformer.transformTRPCResponse(router$1._def._config, untransformedJSON)));
@@ -12,9 +12,12 @@ import { isObservable } from '../observable/observable.mjs';
12
12
  * @link https://github.com/trpc/trpc/pull/5279
13
13
  */ const WEBSOCKET_OPEN = 1; /* ws.WebSocket.OPEN */
14
14
  function applyWSSHandler(opts) {
15
- const { wss , createContext , router } = opts;
15
+ const { wss , createContext , router , prefix } = opts;
16
16
  const { transformer } = router._def._config;
17
17
  wss.on('connection', async (client, req)=>{
18
+ if (prefix && !req.url?.startsWith(prefix)) {
19
+ return;
20
+ }
18
21
  const clientSubscriptions = new Map();
19
22
  function respond(untransformedJSON) {
20
23
  client.send(JSON.stringify(transformTRPCResponse(router._def._config, untransformedJSON)));