@trpc/server 11.22.2-canary.9.85bcf328a → 11.23.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.
Files changed (114) hide show
  1. package/README.md +0 -8
  2. package/dist/adapters/aws-lambda/index.cjs +1 -1
  3. package/dist/adapters/aws-lambda/index.d.cts.map +1 -1
  4. package/dist/adapters/aws-lambda/index.d.mts.map +1 -1
  5. package/dist/adapters/aws-lambda/index.mjs +1 -1
  6. package/dist/adapters/aws-lambda/index.mjs.map +1 -1
  7. package/dist/adapters/express.cjs +1 -1
  8. package/dist/adapters/express.mjs +1 -1
  9. package/dist/adapters/express.mjs.map +1 -1
  10. package/dist/adapters/fastify/index.cjs +3 -3
  11. package/dist/adapters/fastify/index.mjs +3 -3
  12. package/dist/adapters/fetch/index.cjs +1 -1
  13. package/dist/adapters/fetch/index.mjs +1 -1
  14. package/dist/adapters/next-app-dir.mjs.map +1 -1
  15. package/dist/adapters/next.cjs +1 -1
  16. package/dist/adapters/next.mjs +1 -1
  17. package/dist/adapters/next.mjs.map +1 -1
  18. package/dist/adapters/node-http/index.cjs +1 -1
  19. package/dist/adapters/node-http/index.mjs +1 -1
  20. package/dist/adapters/standalone.cjs +9 -3
  21. package/dist/adapters/standalone.d.cts +0 -1
  22. package/dist/adapters/standalone.d.cts.map +1 -1
  23. package/dist/adapters/standalone.d.mts +0 -1
  24. package/dist/adapters/standalone.d.mts.map +1 -1
  25. package/dist/adapters/standalone.mjs +9 -3
  26. package/dist/adapters/standalone.mjs.map +1 -1
  27. package/dist/adapters/ws.cjs +1 -1
  28. package/dist/adapters/ws.mjs +1 -1
  29. package/dist/asyncGeneratorDelegate-FcEJT04i.mjs.map +1 -1
  30. package/dist/codes-C9N0z0an.mjs.map +1 -1
  31. package/dist/getErrorShape-zlj81BiC.mjs.map +1 -1
  32. package/dist/http.cjs +1 -1
  33. package/dist/http.mjs +1 -1
  34. package/dist/initTRPC-RMeQIy9H.mjs.map +1 -1
  35. package/dist/{node-http-B5jkpWn7.mjs → node-http-ChhZEv1k.mjs} +2 -2
  36. package/dist/node-http-ChhZEv1k.mjs.map +1 -0
  37. package/dist/{node-http-BZ0HlzkC.cjs → node-http-X8RiQEuH.cjs} +1 -1
  38. package/dist/parseTRPCMessage-CJ4DJVBp.mjs.map +1 -1
  39. package/dist/{resolveResponse-b9D_SrLs.cjs → resolveResponse-CoGjFxK0.cjs} +8 -4
  40. package/dist/{resolveResponse-DH5L33sC.mjs → resolveResponse-DksrxZ2k.mjs} +9 -5
  41. package/dist/resolveResponse-DksrxZ2k.mjs.map +1 -0
  42. package/dist/unstable-core-do-not-import-B8epiErP.d.cts.map +1 -1
  43. package/dist/unstable-core-do-not-import-Dbo98mkh.d.mts.map +1 -1
  44. package/dist/unstable-core-do-not-import.cjs +1 -1
  45. package/dist/unstable-core-do-not-import.mjs +1 -1
  46. package/dist/unstable-core-do-not-import.mjs.map +1 -1
  47. package/dist/{ws-83TNWW-W.cjs → ws-7qWW7Uec.cjs} +2 -2
  48. package/dist/{ws-DJ2SSChC.mjs → ws-BYfo-HED.mjs} +3 -3
  49. package/dist/ws-BYfo-HED.mjs.map +1 -0
  50. package/package.json +9 -12
  51. package/skills/adapter-aws-lambda/SKILL.md +152 -134
  52. package/skills/adapter-express/SKILL.md +127 -113
  53. package/skills/adapter-fastify/SKILL.md +228 -136
  54. package/skills/adapter-fetch/SKILL.md +388 -111
  55. package/skills/adapter-standalone/SKILL.md +184 -94
  56. package/skills/auth/SKILL.md +327 -202
  57. package/skills/auth/references/client-cors.md +29 -0
  58. package/skills/caching/SKILL.md +58 -148
  59. package/skills/error-handling/SKILL.md +280 -174
  60. package/skills/middlewares/SKILL.md +320 -121
  61. package/skills/non-json-content-types/SKILL.md +149 -168
  62. package/skills/server-setup/SKILL.md +355 -253
  63. package/skills/server-setup/references/server-context.md +219 -0
  64. package/skills/server-setup/references/server-merging-routers.md +141 -0
  65. package/skills/server-setup/references/server-metadata.md +105 -0
  66. package/skills/server-setup/references/server-procedures.md +172 -0
  67. package/skills/server-setup/references/server-routers.md +123 -0
  68. package/skills/server-side-calls/SKILL.md +247 -152
  69. package/skills/service-oriented-architecture/SKILL.md +81 -177
  70. package/skills/subscriptions/SKILL.md +341 -297
  71. package/skills/subscriptions/references/client-links-httpSubscriptionLink.md +404 -0
  72. package/skills/subscriptions/references/client-links-wsLink.md +122 -0
  73. package/skills/subscriptions/references/server-websockets.md +297 -0
  74. package/skills/trpc-router/SKILL.md +156 -86
  75. package/skills/validators/SKILL.md +384 -128
  76. package/src/adapters/aws-lambda/getPlanner.ts +4 -3
  77. package/src/adapters/aws-lambda/index.ts +2 -1
  78. package/src/adapters/express.ts +1 -1
  79. package/src/adapters/next-app-dir/nextAppDirCaller.ts +4 -4
  80. package/src/adapters/next-app-dir/rethrowNextErrors.ts +1 -1
  81. package/src/adapters/next.ts +1 -1
  82. package/src/adapters/node-http/incomingMessageToRequest.ts +1 -1
  83. package/src/adapters/node-http/nodeHTTPRequestHandler.ts +1 -1
  84. package/src/adapters/node-http/types.ts +1 -1
  85. package/src/adapters/node-http/writeResponse.ts +1 -1
  86. package/src/adapters/standalone.ts +12 -6
  87. package/src/adapters/ws.ts +5 -5
  88. package/src/unstable-core-do-not-import/clientish/inferrable.ts +4 -1
  89. package/src/unstable-core-do-not-import/clientish/serialize.ts +4 -4
  90. package/src/unstable-core-do-not-import/error/TRPCError.ts +3 -3
  91. package/src/unstable-core-do-not-import/http/formDataToObject.ts +1 -1
  92. package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +1 -1
  93. package/src/unstable-core-do-not-import/http/resolveResponse.ts +13 -2
  94. package/src/unstable-core-do-not-import/procedure.ts +5 -2
  95. package/src/unstable-core-do-not-import/procedureBuilder.ts +3 -2
  96. package/src/unstable-core-do-not-import/rootConfig.ts +2 -2
  97. package/src/unstable-core-do-not-import/router.ts +5 -2
  98. package/src/unstable-core-do-not-import/rpc/envelopes.ts +3 -2
  99. package/src/unstable-core-do-not-import/stream/jsonl.ts +2 -1
  100. package/src/unstable-core-do-not-import/stream/sse.types.ts +1 -1
  101. package/src/unstable-core-do-not-import/stream/utils/asyncIterable.ts +1 -1
  102. package/src/unstable-core-do-not-import/stream/utils/createDeferred.ts +1 -1
  103. package/src/unstable-core-do-not-import/stream/utils/disposable.ts +6 -6
  104. package/src/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.ts +2 -2
  105. package/src/unstable-core-do-not-import/stream/utils/withPing.ts +3 -1
  106. package/src/unstable-core-do-not-import/transformer.ts +4 -1
  107. package/src/unstable-core-do-not-import/types.ts +3 -2
  108. package/src/unstable-core-do-not-import/utils.ts +1 -1
  109. package/src/vendor/standard-schema-v1/spec.ts +2 -2
  110. package/src/vendor/unpromise/unpromise.ts +1 -1
  111. package/bin/intent.js +0 -20
  112. package/dist/node-http-B5jkpWn7.mjs.map +0 -1
  113. package/dist/resolveResponse-DH5L33sC.mjs.map +0 -1
  114. package/dist/ws-DJ2SSChC.mjs.map +0 -1
@@ -62,7 +62,7 @@ export const rethrowNextErrors = (error: TRPCError) => {
62
62
 
63
63
  // Before Next.js 15, we have to check and rethrow the error manually.
64
64
  if (isRedirectError(cause) || isNotFoundError(cause)) {
65
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
65
+ // oxlint-disable-next-line typescript/no-non-null-assertion
66
66
  throw cause!;
67
67
  }
68
68
  };
@@ -12,7 +12,7 @@ import type { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
12
12
  import type { AnyRouter } from '../@trpc/server';
13
13
  // @trpc/server
14
14
  import { TRPCError } from '../@trpc/server';
15
- // eslint-disable-next-line no-restricted-imports
15
+ // oxlint-disable-next-line no-restricted-imports
16
16
  import { run } from '../unstable-core-do-not-import';
17
17
  import type {
18
18
  NodeHTTPCreateContextFnOptions,
@@ -103,7 +103,7 @@ export function createURL(req: NodeHTTPRequest): URL {
103
103
 
104
104
  const host = req.headers.host ?? req.headers[':authority'] ?? 'localhost';
105
105
 
106
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
106
+ // oxlint-disable-next-line typescript/no-non-null-assertion
107
107
  return new URL(req.url!, `${protocol}//${host}`);
108
108
  } catch (cause) {
109
109
  throw new TRPCError({
@@ -17,7 +17,7 @@ import {
17
17
  } from '../../@trpc/server';
18
18
  import type { ResolveHTTPRequestOptionsContextFn } from '../../@trpc/server/http';
19
19
  import { resolveResponse } from '../../@trpc/server/http';
20
- // eslint-disable-next-line no-restricted-imports
20
+ // oxlint-disable-next-line no-restricted-imports
21
21
  import { getErrorShape, run } from '../../unstable-core-do-not-import';
22
22
  import { incomingMessageToRequest } from './incomingMessageToRequest';
23
23
  import type {
@@ -20,7 +20,7 @@ import type {
20
20
  HTTPBaseHandlerOptions,
21
21
  TRPCRequestInfo,
22
22
  } from '../../@trpc/server/http';
23
- // eslint-disable-next-line no-restricted-imports
23
+ // oxlint-disable-next-line no-restricted-imports
24
24
  import type {
25
25
  DistributiveOmit,
26
26
  MaybePromise,
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line no-restricted-imports
1
+ // oxlint-disable-next-line no-restricted-imports
2
2
  import { isAbortError } from '../../unstable-core-do-not-import';
3
3
  import type { NodeHTTPResponse } from './types';
4
4
 
@@ -13,7 +13,7 @@ import http from 'http';
13
13
  import type * as http2 from 'http2';
14
14
  // @trpc/server
15
15
  import { type AnyRouter } from '../@trpc/server';
16
- // eslint-disable-next-line no-restricted-imports
16
+ // oxlint-disable-next-line no-restricted-imports
17
17
  import { run } from '../unstable-core-do-not-import';
18
18
  import type {
19
19
  NodeHTTPCreateContextFnOptions,
@@ -27,6 +27,14 @@ import {
27
27
  nodeHTTPRequestHandler,
28
28
  } from './node-http';
29
29
 
30
+ // same as in the fetch adapter
31
+ const trimSlashes = (path: string): string => {
32
+ path = path.startsWith('/') ? path.slice(1) : path;
33
+ path = path.endsWith('/') ? path.slice(0, -1) : path;
34
+
35
+ return path;
36
+ };
37
+
30
38
  type StandaloneHandlerOptions<
31
39
  TRouter extends AnyRouter,
32
40
  TRequest extends NodeHTTPRequest,
@@ -35,7 +43,6 @@ type StandaloneHandlerOptions<
35
43
  /**
36
44
  * The base path to handle requests for.
37
45
  * This will be sliced from the beginning of the request path
38
- * (Do not miss including the trailing slash)
39
46
  * @default '/'
40
47
  * @example '/trpc/'
41
48
  * @example '/trpc/api/'
@@ -59,8 +66,7 @@ function createHandler<
59
66
  >(
60
67
  opts: StandaloneHandlerOptions<TRouter, TRequest, TResponse>,
61
68
  ): (req: TRequest, res: TResponse) => void {
62
- const basePath = opts.basePath ?? '/';
63
- const sliceLength = basePath.length;
69
+ const basePath = trimSlashes(opts.basePath ?? '/');
64
70
 
65
71
  return (req, res) => {
66
72
  let path = '';
@@ -68,8 +74,8 @@ function createHandler<
68
74
  run(async () => {
69
75
  const url = createURL(req);
70
76
 
71
- // get procedure(s) path and remove the leading slash
72
- path = url.pathname.slice(sliceLength);
77
+ // get procedure(s) path and remove the slashes around it
78
+ path = trimSlashes(trimSlashes(url.pathname).slice(basePath.length));
73
79
 
74
80
  await nodeHTTPRequestHandler({
75
81
  ...opts,
@@ -25,7 +25,7 @@ import type {
25
25
  } from '../@trpc/server/rpc';
26
26
  import { parseConnectionParamsFromUnknown } from '../http';
27
27
  import { isObservable, observableToAsyncIterable } from '../observable';
28
- // eslint-disable-next-line no-restricted-imports
28
+ // oxlint-disable-next-line no-restricted-imports
29
29
  import {
30
30
  isAsyncIterable,
31
31
  isObject,
@@ -33,9 +33,9 @@ import {
33
33
  run,
34
34
  type MaybePromise,
35
35
  } from '../unstable-core-do-not-import';
36
- // eslint-disable-next-line no-restricted-imports
36
+ // oxlint-disable-next-line no-restricted-imports
37
37
  import type { Result } from '../unstable-core-do-not-import';
38
- // eslint-disable-next-line no-restricted-imports
38
+ // oxlint-disable-next-line no-restricted-imports
39
39
  import { iteratorResource } from '../unstable-core-do-not-import/stream/utils/asyncIterable';
40
40
  import { Unpromise } from '../vendor/unpromise';
41
41
  import { createURL, type NodeHTTPCreateContextFnOptions } from './node-http';
@@ -257,7 +257,7 @@ export function getWSConnectionHandler<TRouter extends AnyRouter>(
257
257
  }
258
258
  }
259
259
  run(async () => {
260
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
260
+ // oxlint-disable-next-line typescript/no-non-null-assertion
261
261
  const res = await ctxPromise!; // asserts context has been set
262
262
  if (!res.ok) {
263
263
  throw res.error;
@@ -453,7 +453,7 @@ export function getWSConnectionHandler<TRouter extends AnyRouter>(
453
453
  client.on('message', (rawData, isBinary) => {
454
454
  // Handle PING/PONG as text regardless of encoder
455
455
  if (!isBinary) {
456
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
456
+ // oxlint-disable-next-line typescript/no-base-to-string
457
457
  const msgStr = rawData.toString();
458
458
  if (msgStr === 'PONG') {
459
459
  return;
@@ -29,7 +29,10 @@ type RootConfigLike = {
29
29
  * Anything that can be inferred to the root config types needed for a TRPC client
30
30
  */
31
31
  export type InferrableClientTypes =
32
- RouterLike | InitLike | RootConfigLike | AnyClientTypes;
32
+ | RouterLike
33
+ | InitLike
34
+ | RootConfigLike
35
+ | AnyClientTypes;
33
36
 
34
37
  type PickTypes<T extends AnyClientTypes> = {
35
38
  transformer: T['transformer'];
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
1
+ /* oxlint-disable trpc/type-parameter-naming */
2
2
  import type { Simplify, WithoutIndexSignature } from '../types';
3
3
 
4
4
  /**
@@ -14,7 +14,7 @@ type JsonValue = JsonPrimitive | JsonObject | JsonArray;
14
14
 
15
15
  type IsJson<T> = T extends JsonValue ? true : false;
16
16
 
17
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
17
+ // oxlint-disable-next-line typescript/no-unsafe-function-type
18
18
  type NonJsonPrimitive = Function | symbol | undefined;
19
19
  /*
20
20
  * `any` is the only type that can let you equate `0` with `1`
@@ -31,7 +31,7 @@ type IsRecord<T extends object> = keyof WithoutIndexSignature<T> extends never
31
31
  ? true
32
32
  : false;
33
33
 
34
- /* prettier-ignore */
34
+ /* oxfmt-ignore */
35
35
  export type Serialize<T> =
36
36
  IsAny<T> extends true ? any :
37
37
  unknown extends T ? unknown :
@@ -66,7 +66,7 @@ type SerializeTuple<T extends [unknown, ...unknown[]]> = {
66
66
  [K in keyof T]: T[K] extends NonJsonPrimitive ? null : Serialize<T[K]>;
67
67
  };
68
68
 
69
- // prettier-ignore
69
+ // oxfmt-ignore
70
70
  type SerializeObjectKey<T extends Record<any, any>, K> =
71
71
  // never include entries where the key is a symbol
72
72
  K extends symbol ? never :
@@ -44,7 +44,7 @@ export function getCauseFromUnknown(cause: unknown): Error | undefined {
44
44
 
45
45
  // Primitive types just get wrapped in an error
46
46
  if (type !== 'object') {
47
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
47
+ // oxlint-disable-next-line typescript/no-base-to-string
48
48
  return new Error(String(cause));
49
49
  }
50
50
 
@@ -79,7 +79,7 @@ export function getTRPCErrorFromUnknown(cause: unknown): TRPCError {
79
79
  }
80
80
 
81
81
  export class TRPCError extends Error {
82
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
82
+ // oxlint-disable-next-line typescript/ban-ts-comment
83
83
  // @ts-ignore override doesn't work in all environments due to "This member cannot have an 'override' modifier because it is not declared in the base class 'Error'"
84
84
  public override readonly cause?: Error;
85
85
  public readonly code;
@@ -92,7 +92,7 @@ export class TRPCError extends Error {
92
92
  const cause = getCauseFromUnknown(opts.cause);
93
93
  const message = opts.message ?? cause?.message ?? opts.code;
94
94
 
95
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
95
+ // oxlint-disable-next-line typescript/ban-ts-comment
96
96
  // @ts-ignore https://github.com/tc39/proposal-error-cause
97
97
  super(message, { cause });
98
98
 
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
1
+ /* oxlint-disable typescript/no-non-null-assertion */
2
2
 
3
3
  import { emptyObject } from '../utils';
4
4
 
@@ -89,7 +89,7 @@ export function getHTTPStatusCode(json: TRPCResponse | TRPCResponse[]) {
89
89
 
90
90
  const httpStatus = httpStatuses.values().next().value;
91
91
 
92
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
92
+ // oxlint-disable-next-line typescript/no-non-null-assertion
93
93
  return httpStatus!;
94
94
  }
95
95
 
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
1
+ /* oxlint-disable typescript/no-non-null-assertion */
2
2
  import {
3
3
  isObservable,
4
4
  observableToAsyncIterable,
@@ -52,7 +52,13 @@ function errorToAsyncIterable(err: TRPCError): AsyncIterable<never> {
52
52
  });
53
53
  }
54
54
  type HTTPMethods =
55
- 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'PATCH';
55
+ | 'GET'
56
+ | 'POST'
57
+ | 'HEAD'
58
+ | 'OPTIONS'
59
+ | 'PUT'
60
+ | 'DELETE'
61
+ | 'PATCH';
56
62
 
57
63
  function combinedAbortController(signal: AbortSignal) {
58
64
  const controller = new AbortController();
@@ -391,6 +397,11 @@ export async function resolveResponse<TRouter extends AnyRouter>(
391
397
  }
392
398
 
393
399
  if (!methodMapper[proc._def.type].includes(req.method as HTTPMethods)) {
400
+ const accepted = opts.allowMethodOverride
401
+ ? TYPE_ACCEPTED_METHOD_MAP_WITH_METHOD_OVERRIDE
402
+ : TYPE_ACCEPTED_METHOD_MAP;
403
+ // a 405 must list the methods the procedure accepts (RFC 9110 15.5.6)
404
+ headers.set('allow', accepted[proc._def.type].join(', '));
394
405
  throw new TRPCError({
395
406
  code: 'METHOD_NOT_SUPPORTED',
396
407
  message: `Unsupported ${req.method}-request to ${proc._def.type} procedure at path "${call.path}"`,
@@ -78,10 +78,13 @@ export interface LegacyObservableSubscriptionProcedure<
78
78
  export type AnyQueryProcedure = QueryProcedure<any>;
79
79
  export type AnyMutationProcedure = MutationProcedure<any>;
80
80
  export type AnySubscriptionProcedure =
81
- SubscriptionProcedure<any> | LegacyObservableSubscriptionProcedure<any>;
81
+ | SubscriptionProcedure<any>
82
+ | LegacyObservableSubscriptionProcedure<any>;
82
83
 
83
84
  export type AnyProcedure =
84
- AnyQueryProcedure | AnyMutationProcedure | AnySubscriptionProcedure;
85
+ | AnyQueryProcedure
86
+ | AnyMutationProcedure
87
+ | AnySubscriptionProcedure;
85
88
 
86
89
  export type inferProcedureInput<TProcedure extends AnyProcedure> =
87
90
  undefined extends inferProcedureParams<TProcedure>['$types']['input']
@@ -50,7 +50,8 @@ type DefaultValue<TValue, TFallback> = TValue extends UnsetMarker
50
50
  : TValue;
51
51
 
52
52
  type FoldErrorShape<TErrorShape, $Shape> =
53
- Extract<$Shape, TRPCErrorShape> | TErrorShape;
53
+ | Extract<$Shape, TRPCErrorShape>
54
+ | TErrorShape;
54
55
 
55
56
  type inferAsyncIterable<TOutput> =
56
57
  TOutput extends AsyncIterable<infer $Yield, infer $Return, infer $Next>
@@ -703,7 +704,7 @@ async function callRecursive(
703
704
  opts: ProcedureCallOptions<any>,
704
705
  ): Promise<MiddlewareResult<any>> {
705
706
  try {
706
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
707
+ // oxlint-disable-next-line typescript/no-non-null-assertion
707
708
  const middleware = _def.middlewares[index]!;
708
709
  const result = await middleware({
709
710
  ...opts,
@@ -42,7 +42,7 @@ export interface JSONLConfig extends Pick<JSONLProducerOptions, 'pingMs'> {
42
42
  export const isServerDefault: boolean =
43
43
  typeof window === 'undefined' ||
44
44
  'Deno' in window ||
45
- // eslint-disable-next-line @typescript-eslint/dot-notation
45
+ // oxlint-disable-next-line typescript/dot-notation
46
46
  globalThis.process?.env?.['NODE_ENV'] === 'test' ||
47
47
  !!globalThis.process?.env?.['JEST_WORKER_ID'] ||
48
48
  !!globalThis.process?.env?.['VITEST_WORKER_ID'];
@@ -51,7 +51,7 @@ export const isServerDefault: boolean =
51
51
  * The default check to see if we're in development
52
52
  */
53
53
  export function isDevDefault(): boolean {
54
- // eslint-disable-next-line @typescript-eslint/dot-notation
54
+ // oxlint-disable-next-line typescript/dot-notation
55
55
  return globalThis.process?.env['NODE_ENV'] !== 'production';
56
56
  }
57
57
 
@@ -225,7 +225,10 @@ const reservedWords = [
225
225
  /** @internal */
226
226
  export type CreateRouterOptions = {
227
227
  [key: string]:
228
- AnyProcedure | AnyRouter | CreateRouterOptions | Lazy<AnyRouter>;
228
+ | AnyProcedure
229
+ | AnyRouter
230
+ | CreateRouterOptions
231
+ | Lazy<AnyRouter>;
229
232
  };
230
233
 
231
234
  /** @internal */
@@ -393,7 +396,7 @@ export async function getProcedureAtPath(
393
396
  return null;
394
397
  }
395
398
  // console.log('loading', key, '.......');
396
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
399
+ // oxlint-disable-next-line typescript/no-non-null-assertion
397
400
  const lazyRouter = _def.lazy[key]!;
398
401
  await lazyRouter.load();
399
402
 
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-namespace */
1
+ /* oxlint-disable typescript/no-namespace */
2
2
  import type { TRPCRequestInfo } from '../http/types';
3
3
  import type { ProcedureType } from '../procedure';
4
4
  import type { TRPC_ERROR_CODE_NUMBER } from './codes';
@@ -121,7 +121,8 @@ export type TRPCResponseMessage<
121
121
  TData = unknown,
122
122
  TError extends TRPCErrorShape = TRPCErrorShape,
123
123
  > = { id: JSONRPC2.RequestId } & (
124
- TRPCErrorResponse<TError> | TRPCResultMessage<TData>
124
+ | TRPCErrorResponse<TError>
125
+ | TRPCResultMessage<TData>
125
126
  );
126
127
 
127
128
  /**
@@ -58,7 +58,8 @@ type ChunkDefinitionKey =
58
58
 
59
59
  type ChunkIndex = number & { __chunkIndex: true };
60
60
  type ChunkValueType =
61
- CHUNK_VALUE_TYPE_PROMISE | CHUNK_VALUE_TYPE_ASYNC_ITERABLE;
61
+ | CHUNK_VALUE_TYPE_PROMISE
62
+ | CHUNK_VALUE_TYPE_ASYNC_ITERABLE;
62
63
  type ChunkDefinition = [
63
64
  key: ChunkDefinitionKey,
64
65
  type: ChunkValueType,
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-namespace */
1
+ /* oxlint-disable typescript/no-namespace */
2
2
 
3
3
  /**
4
4
  * @internal
@@ -9,7 +9,7 @@ export function iteratorResource<TYield, TReturn, TNext>(
9
9
  const iterator = iterable[Symbol.asyncIterator]();
10
10
 
11
11
  // @ts-expect-error - this is added in node 24 which we don't officially support yet
12
- // eslint-disable-next-line no-restricted-syntax
12
+ // oxlint-disable-next-line trpc/no-symbol-dispose
13
13
  if (iterator[Symbol.asyncDispose]) {
14
14
  return iterator as AsyncIterator<TYield, TReturn, TNext> & AsyncDisposable;
15
15
  }
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
1
+ /* oxlint-disable typescript/no-non-null-assertion */
2
2
  export function createDeferred<TValue = void>() {
3
3
  let resolve: (value: TValue) => void;
4
4
  let reject: (error: unknown) => void;
@@ -1,9 +1,9 @@
1
1
  // @ts-expect-error - polyfilling symbol
2
- // eslint-disable-next-line no-restricted-syntax
2
+ // oxlint-disable-next-line trpc/no-symbol-dispose
3
3
  Symbol.dispose ??= Symbol();
4
4
 
5
5
  // @ts-expect-error - polyfilling symbol
6
- // eslint-disable-next-line no-restricted-syntax
6
+ // oxlint-disable-next-line trpc/no-symbol-dispose
7
7
  Symbol.asyncDispose ??= Symbol();
8
8
 
9
9
  /**
@@ -16,10 +16,10 @@ Symbol.asyncDispose ??= Symbol();
16
16
  export function makeResource<T>(thing: T, dispose: () => void): T & Disposable {
17
17
  const it = thing as T & Partial<Disposable>;
18
18
 
19
- // eslint-disable-next-line no-restricted-syntax
19
+ // oxlint-disable-next-line trpc/no-symbol-dispose
20
20
  const existing = it[Symbol.dispose];
21
21
 
22
- // eslint-disable-next-line no-restricted-syntax
22
+ // oxlint-disable-next-line trpc/no-symbol-dispose
23
23
  it[Symbol.dispose] = () => {
24
24
  dispose();
25
25
  existing?.call(it);
@@ -41,10 +41,10 @@ export function makeAsyncResource<T>(
41
41
  ): T & AsyncDisposable {
42
42
  const it = thing as T & Partial<AsyncDisposable>;
43
43
 
44
- // eslint-disable-next-line no-restricted-syntax
44
+ // oxlint-disable-next-line trpc/no-symbol-dispose
45
45
  const existing = it[Symbol.asyncDispose];
46
46
 
47
- // eslint-disable-next-line no-restricted-syntax
47
+ // oxlint-disable-next-line trpc/no-symbol-dispose
48
48
  it[Symbol.asyncDispose] = async () => {
49
49
  await dispose();
50
50
  await existing?.call(it);
@@ -169,7 +169,7 @@ export function mergeAsyncIterables<TYield>(): MergedAsyncIterables<TYield> {
169
169
  });
170
170
 
171
171
  while (iterables.length > 0) {
172
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
172
+ // oxlint-disable-next-line typescript/no-non-null-assertion
173
173
  initIterable(iterables.shift()!);
174
174
  }
175
175
 
@@ -177,7 +177,7 @@ export function mergeAsyncIterables<TYield>(): MergedAsyncIterables<TYield> {
177
177
  await flushSignal.promise;
178
178
 
179
179
  while (buffer.length > 0) {
180
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
180
+ // oxlint-disable-next-line typescript/no-non-null-assertion
181
181
  const [iterator, result] = buffer.shift()!;
182
182
 
183
183
  switch (result.status) {
@@ -16,7 +16,9 @@ export async function* withPing<TValue>(
16
16
 
17
17
  // declaration outside the loop for garbage collection reasons
18
18
  let result:
19
- null | IteratorResult<TValue> | typeof disposablePromiseTimerResult;
19
+ | null
20
+ | IteratorResult<TValue>
21
+ | typeof disposablePromiseTimerResult;
20
22
 
21
23
  let nextPromise = iterator.next();
22
24
 
@@ -112,7 +112,10 @@ function transformTRPCResponseItem<
112
112
  **/
113
113
  export function transformTRPCResponse<
114
114
  TResponse extends
115
- TRPCResponse | TRPCResponse[] | TRPCResponseMessage | TRPCResponseMessage[],
115
+ | TRPCResponse
116
+ | TRPCResponse[]
117
+ | TRPCResponseMessage
118
+ | TRPCResponseMessage[],
116
119
  >(config: RootConfig<AnyRootTypes>, itemOrItems: TResponse) {
117
120
  return Array.isArray(itemOrItems)
118
121
  ? itemOrItems.map((item) => transformTRPCResponseItem(config, item))
@@ -35,7 +35,8 @@ export type FilterKeys<TObj extends object, TFilter> = {
35
35
  * @internal
36
36
  */
37
37
  export type Result<TType, TErr = unknown> =
38
- { ok: true; value: TType } | { ok: false; error: TErr };
38
+ | { ok: true; value: TType }
39
+ | { ok: false; error: TErr };
39
40
 
40
41
  /**
41
42
  * @internal
@@ -94,7 +95,7 @@ export type Overwrite<TType, TWith> = TWith extends any
94
95
  ? TType extends object
95
96
  ? {
96
97
  [
97
- K in // Exclude index signature from keys
98
+ K in // Exclude index signature from keys
98
99
  | keyof WithoutIndexSignature<TType>
99
100
  | keyof WithoutIndexSignature<TWith>
100
101
  ]: K extends keyof TWith
@@ -61,7 +61,7 @@ export function isAsyncIterable<TValue>(
61
61
  */
62
62
  export const run = <TValue>(fn: () => TValue): TValue => fn();
63
63
 
64
- // eslint-disable-next-line @typescript-eslint/no-empty-function
64
+ // oxlint-disable-next-line typescript/no-empty-function
65
65
  export function noop(): void {}
66
66
 
67
67
  export function identity<T>(it: T): T {
@@ -3,8 +3,8 @@
3
3
  * @see https://github.com/standard-schema/standard-schema/blob/main/packages/spec/src/index.ts
4
4
  */
5
5
 
6
- /* eslint-disable @typescript-eslint/no-namespace */
7
- /* eslint-disable @typescript-eslint/naming-convention */
6
+ /* oxlint-disable typescript/no-namespace */
7
+ /* oxlint-disable trpc/type-parameter-naming */
8
8
 
9
9
  /** The Standard Schema interface. */
10
10
  export interface StandardSchemaV1<Input = unknown, Output = Input> {
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/unbound-method */
1
+ /* oxlint-disable typescript/unbound-method */
2
2
 
3
3
 
4
4
 
package/bin/intent.js DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env node
2
- // Auto-generated by @tanstack/intent setup
3
- // Exposes the intent end-user CLI for consumers of this library.
4
- // Commit this file, then add to your package.json:
5
- // "bin": { "intent": "./bin/intent.js" }
6
- try {
7
- await import('@tanstack/intent/intent-library');
8
- } catch (e) {
9
- if (e?.code === 'ERR_MODULE_NOT_FOUND' || e?.code === 'MODULE_NOT_FOUND') {
10
- console.error('@tanstack/intent is not installed.');
11
- console.error('');
12
- console.error('Install it as a dev dependency:');
13
- console.error(' npm add -D @tanstack/intent');
14
- console.error('');
15
- console.error('Or run directly:');
16
- console.error(' npx @tanstack/intent@latest list');
17
- process.exit(1);
18
- }
19
- throw e;
20
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"node-http-B5jkpWn7.mjs","names":[],"sources":["../src/adapters/node-http/incomingMessageToRequest.ts","../src/adapters/node-http/writeResponse.ts","../src/adapters/node-http/nodeHTTPRequestHandler.ts"],"sourcesContent":["import type * as http from 'http';\nimport { IncomingMessage } from 'node:http';\nimport { TRPCError } from '../../@trpc/server';\nimport type { NodeHTTPRequest, NodeHTTPResponse } from './types';\n\nfunction createBody(\n req: NodeHTTPRequest,\n opts: {\n /**\n * Max body size in bytes. If the body is larger than this, the request will be aborted\n */\n maxBodySize: number | null;\n },\n): RequestInit['body'] {\n // Some adapters will pre-parse the body and add it to the request object\n if ('body' in req) {\n if (req.body !== undefined) {\n // If the body is already a string, return it directly\n if (typeof req.body === 'string') {\n return req.body;\n }\n // formData use\n if (req.body instanceof IncomingMessage) {\n return req.body as any;\n }\n // If body exists but isn't a string, stringify it as JSON\n return JSON.stringify(req.body);\n }\n if (req.readableEnded) {\n // The stream was consumed without producing a parsed body — there is\n // nothing left to read\n return undefined;\n }\n // The property was defined without the stream being read — e.g. express\n // 5's body-parser assigns `req.body = undefined` on content types it\n // skips (such as multipart/form-data) — so stream it like an unparsed\n // request\n } else if (req.readableEnded) {\n // Another middleware drained the stream without handing over what it\n // read, so waiting for `data`/`end` would hang forever\n return new ReadableStream({\n start(controller) {\n controller.error(\n new TRPCError({\n code: 'INTERNAL_SERVER_ERROR',\n message:\n 'The request body has already been read by another middleware. Assign the parsed body to `req.body` so tRPC can use it',\n }),\n );\n },\n });\n }\n let size = 0;\n let hasClosed = false;\n\n return new ReadableStream({\n start(controller) {\n const onData = (chunk: Buffer) => {\n size += chunk.length;\n if (!opts.maxBodySize || size <= opts.maxBodySize) {\n controller.enqueue(\n new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength),\n );\n return;\n }\n controller.error(\n new TRPCError({\n code: 'PAYLOAD_TOO_LARGE',\n }),\n );\n hasClosed = true;\n req.off('data', onData);\n req.off('end', onEnd);\n };\n\n const onEnd = () => {\n if (hasClosed) {\n return;\n }\n hasClosed = true;\n req.off('data', onData);\n req.off('end', onEnd);\n controller.close();\n };\n\n req.on('data', onData);\n req.on('end', onEnd);\n },\n cancel() {\n req.destroy();\n },\n });\n}\nexport function createURL(req: NodeHTTPRequest): URL {\n try {\n const protocol =\n // http2\n (req.headers[':scheme'] && req.headers[':scheme'] === 'https') ||\n // http1\n (req.socket && 'encrypted' in req.socket && req.socket.encrypted)\n ? 'https:'\n : 'http:';\n\n const host = req.headers.host ?? req.headers[':authority'] ?? 'localhost';\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return new URL(req.url!, `${protocol}//${host}`);\n } catch (cause) {\n throw new TRPCError({\n code: 'BAD_REQUEST',\n message: 'Invalid URL',\n cause,\n });\n }\n}\n\nfunction createHeaders(incoming: http.IncomingHttpHeaders): Headers {\n const headers = new Headers();\n\n for (const key in incoming) {\n const value = incoming[key];\n if (typeof key === 'string' && key.startsWith(':')) {\n // Skip HTTP/2 pseudo-headers\n continue;\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n headers.append(key, item);\n }\n } else if (value != null) {\n headers.append(key, value);\n }\n }\n\n return headers;\n}\n\n/**\n * Convert an [`IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)\n */\nexport function incomingMessageToRequest(\n req: NodeHTTPRequest,\n res: NodeHTTPResponse,\n opts: {\n /**\n * Max body size in bytes. If the body is larger than this, the request will be aborted\n */\n maxBodySize: number | null;\n },\n): Request {\n const ac = new AbortController();\n\n const onAbort = () => {\n res.off('close', onClose);\n req.off('aborted', onAbort);\n\n // abort the request\n ac.abort();\n };\n\n const onClose = () => {\n // `close` is also emitted after a response that was sent completely,\n // so only abort if the connection closed before the response was ended\n if (res.writableEnded) {\n req.off('aborted', onAbort);\n return;\n }\n onAbort();\n };\n\n res.once('close', onClose);\n req.once('aborted', onAbort);\n\n // Get host from either regular header or HTTP/2 pseudo-header\n const url = createURL(req);\n\n const init: RequestInit = {\n headers: createHeaders(req.headers),\n method: req.method,\n signal: ac.signal,\n };\n\n if (req.method !== 'GET' && req.method !== 'HEAD') {\n init.body = createBody(req, opts);\n\n // init.duplex = 'half' must be set when body is a ReadableStream, and Node follows the spec.\n // However, this property is not defined in the TypeScript types for RequestInit, so we have\n // to cast it here in order to set it without a type error.\n // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex\n // @ts-expect-error this is fine\n init.duplex = 'half';\n }\n\n const request = new Request(url, init);\n\n return request;\n}\n","// eslint-disable-next-line no-restricted-imports\nimport { isAbortError } from '../../unstable-core-do-not-import';\nimport type { NodeHTTPResponse } from './types';\n\nasync function writeResponseBodyChunk(\n res: NodeHTTPResponse,\n chunk: Uint8Array,\n) {\n // useful for debugging 🙃\n // console.debug('writing', new TextDecoder().decode(chunk));\n\n if (res.write(chunk) === false) {\n await new Promise<void>((resolve, reject) => {\n const onError = (err: unknown) => {\n reject(err);\n cleanup();\n };\n const onDrain = () => {\n resolve();\n cleanup();\n };\n const cleanup = () => {\n res.off('error', onError);\n res.off('drain', onDrain);\n res.off('close', onDrain);\n };\n res.once('error', onError);\n res.once('drain', onDrain);\n res.once('close', onDrain);\n });\n }\n}\n/**\n * @internal\n */\n\nexport async function writeResponseBody(opts: {\n res: NodeHTTPResponse;\n signal: AbortSignal;\n body: NonNullable<Response['body']>;\n}) {\n const { res } = opts;\n\n try {\n const writableStream = new WritableStream({\n async write(chunk) {\n await writeResponseBodyChunk(res, chunk);\n res.flush?.();\n },\n });\n\n await opts.body.pipeTo(writableStream, {\n signal: opts.signal,\n });\n } catch (err) {\n if (isAbortError(err)) {\n return;\n }\n throw err;\n }\n}\n/**\n * @internal\n */\n\nexport async function writeResponse(opts: {\n request: Request;\n response: Response;\n rawResponse: NodeHTTPResponse;\n}) {\n const { response, rawResponse } = opts;\n\n // Only override status code if it hasn't been explicitly set in a procedure etc\n if (rawResponse.statusCode === 200) {\n rawResponse.statusCode = response.status;\n }\n for (const [key, value] of response.headers) {\n if (key.toLowerCase() === 'set-cookie') continue;\n rawResponse.setHeader(key, value);\n }\n const cookies = response.headers.getSetCookie();\n if (cookies.length > 0) {\n rawResponse.setHeader('set-cookie', cookies);\n }\n try {\n if (response.body) {\n await writeResponseBody({\n res: rawResponse,\n signal: opts.request.signal,\n body: response.body,\n });\n }\n } catch (err) {\n if (!rawResponse.headersSent) {\n rawResponse.statusCode = 500;\n }\n throw err;\n } finally {\n rawResponse.end();\n }\n}\n","/**\n * If you're making an adapter for tRPC and looking at this file for reference, you should import types and functions from `@trpc/server` and `@trpc/server/http`\n *\n * @example\n * ```ts\n * import type { AnyTRPCRouter } from '@trpc/server'\n * import type { HTTPBaseHandlerOptions } from '@trpc/server/http'\n * ```\n */\n\n// @trpc/server\n\nimport {\n getTRPCErrorFromUnknown,\n transformTRPCResponse,\n type AnyRouter,\n} from '../../@trpc/server';\nimport type { ResolveHTTPRequestOptionsContextFn } from '../../@trpc/server/http';\nimport { resolveResponse } from '../../@trpc/server/http';\n// eslint-disable-next-line no-restricted-imports\nimport { getErrorShape, run } from '../../unstable-core-do-not-import';\nimport { incomingMessageToRequest } from './incomingMessageToRequest';\nimport type {\n NodeHTTPRequest,\n NodeHTTPRequestHandlerOptions,\n NodeHTTPResponse,\n} from './types';\nimport { writeResponse } from './writeResponse';\n\n/**\n * @internal\n */\nexport function internal_exceptionHandler<\n TRouter extends AnyRouter,\n TRequest extends NodeHTTPRequest,\n TResponse extends NodeHTTPResponse,\n>(opts: NodeHTTPRequestHandlerOptions<TRouter, TRequest, TResponse>) {\n return (cause: unknown) => {\n const { res, req } = opts;\n const error = getTRPCErrorFromUnknown(cause);\n\n const shape = getErrorShape({\n config: opts.router._def._config,\n error,\n type: 'unknown',\n path: undefined,\n input: undefined,\n ctx: undefined,\n });\n\n opts.onError?.({\n req,\n error,\n type: 'unknown',\n path: undefined,\n input: undefined,\n ctx: undefined,\n });\n\n const transformed = transformTRPCResponse(opts.router._def._config, {\n error: shape,\n });\n\n res.statusCode = shape.data.httpStatus;\n res.end(JSON.stringify(transformed));\n };\n}\n\n/**\n * @remark the promise never rejects\n */\nexport async function nodeHTTPRequestHandler<\n TRouter extends AnyRouter,\n TRequest extends NodeHTTPRequest,\n TResponse extends NodeHTTPResponse,\n>(opts: NodeHTTPRequestHandlerOptions<TRouter, TRequest, TResponse>) {\n return new Promise<void>((resolve) => {\n const handleViaMiddleware =\n opts.middleware ?? ((_req, _res, next) => next());\n\n opts.res.once('finish', () => {\n resolve();\n });\n return handleViaMiddleware(opts.req, opts.res, (err: unknown) => {\n run(async () => {\n const request = incomingMessageToRequest(opts.req, opts.res, {\n maxBodySize: opts.maxBodySize ?? null,\n });\n\n // Build tRPC dependencies\n const createContext: ResolveHTTPRequestOptionsContextFn<\n TRouter\n > = async (innerOpts) => {\n return await opts.createContext?.({\n ...opts,\n ...innerOpts,\n });\n };\n\n const response = await resolveResponse({\n ...opts,\n req: request,\n error: err ? getTRPCErrorFromUnknown(err) : null,\n createContext,\n onError(o) {\n opts?.onError?.({\n ...o,\n req: opts.req,\n });\n },\n });\n\n await writeResponse({\n request,\n response,\n rawResponse: opts.res,\n });\n }).catch(internal_exceptionHandler(opts));\n });\n });\n}\n"],"mappings":";;;;;;AAKA,SAAS,WACP,KACA,MAMqB;CAErB,IAAI,UAAU,KAAK;EACjB,IAAI,IAAI,SAAS,KAAA,GAAW;GAE1B,IAAI,OAAO,IAAI,SAAS,UACtB,OAAO,IAAI;GAGb,IAAI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