diff --git a/packages/server/deno.json b/packages/server/deno.json new file mode 100644 index 00000000000..eae5c4061d0 --- /dev/null +++ b/packages/server/deno.json @@ -0,0 +1,22 @@ +{ + "name": "@trpc/server", + "version": "0.0.4", + "exports": { + ".": "./src/@trpc/server/index.ts", + "./adapters/aws-lambda": "./src/adapters/aws-lambda/index.ts", + "./adapters/express": "./src/adapters/express.ts", + "./adapters/fastify": "./src/adapters/fastify/index.ts", + "./adapters/fetch": "./src/adapters/fetch/index.ts", + "./adapters/next": "./src/adapters/next.ts", + "./adapters/node-http/content-type/form-data": "./src/adapters/node-http/content-type/form-data/index.ts", + "./adapters/node-http/content-type/json": "./src/adapters/node-http/content-type/json/index.ts", + "./adapters/node-http": "./src/adapters/node-http/index.ts", + "./adapters/standalone": "./src/adapters/standalone.ts", + "./adapters/ws": "./src/adapters/ws.ts", + "./http": "./src/http.ts", + "./observable": "./src/observable/index.ts", + "./rpc": "./src/rpc.ts", + "./shared": "./src/shared.ts", + "./unstable-core-do-not-import": "./src/unstable-core-do-not-import.ts" + } +} diff --git a/packages/server/src/@trpc/server/http.ts b/packages/server/src/@trpc/server/http.ts index a05f082860d..b05c49f96e7 100644 --- a/packages/server/src/@trpc/server/http.ts +++ b/packages/server/src/@trpc/server/http.ts @@ -1,8 +1,8 @@ export { getHTTPStatusCode, getHTTPStatusCodeFromError, -} from '../../unstable-core-do-not-import'; -export { resolveHTTPResponse } from '../../unstable-core-do-not-import'; +} from '../../unstable-core-do-not-import.ts'; +export { resolveHTTPResponse } from '../../unstable-core-do-not-import.ts'; export type { BaseHandlerOptions, HTTPBaseHandlerOptions, @@ -16,12 +16,12 @@ export type { ResponseMeta, ResponseMetaFn, TRPCRequestInfo, -} from '../../unstable-core-do-not-import'; +} from '../../unstable-core-do-not-import.ts'; -export { getBatchStreamFormatter } from '../../unstable-core-do-not-import'; +export { getBatchStreamFormatter } from '../../unstable-core-do-not-import.ts'; export type { BaseContentTypeHandler, BodyResult, -} from '../../unstable-core-do-not-import'; -export { getJsonContentTypeInputs } from '../../unstable-core-do-not-import'; -export { toURL } from '../../unstable-core-do-not-import'; +} from '../../unstable-core-do-not-import.ts'; +export { getJsonContentTypeInputs } from '../../unstable-core-do-not-import.ts'; +export { toURL } from '../../unstable-core-do-not-import.ts'; diff --git a/packages/server/src/@trpc/server/index.ts b/packages/server/src/@trpc/server/index.ts index 933f708f026..5b61cd1c5fa 100644 --- a/packages/server/src/@trpc/server/index.ts +++ b/packages/server/src/@trpc/server/index.ts @@ -32,7 +32,7 @@ export { type RouterRecord as TRPCRouterRecord, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, type ProcedureOptions as TRPCProcedureOptions, -} from '../../unstable-core-do-not-import'; +} from '../../unstable-core-do-not-import.ts'; export type { /** @@ -78,7 +78,7 @@ export type { * @deprecated use `AnyTRPCSubscriptionProcedure` instead */ AnySubscriptionProcedure, -} from '../../unstable-core-do-not-import'; +} from '../../unstable-core-do-not-import.ts'; export { /** @@ -90,7 +90,7 @@ export { * @deprecated use `callTRPCProcedure` instead */ callProcedure, -} from '../../unstable-core-do-not-import'; +} from '../../unstable-core-do-not-import.ts'; /** * @deprecated diff --git a/packages/server/src/@trpc/server/rpc.ts b/packages/server/src/@trpc/server/rpc.ts index 6f0eb1025f7..ce7de814724 100644 --- a/packages/server/src/@trpc/server/rpc.ts +++ b/packages/server/src/@trpc/server/rpc.ts @@ -18,9 +18,9 @@ export type { TRPCSuccessResponse, TRPC_ERROR_CODE_KEY, TRPC_ERROR_CODE_NUMBER, -} from '../../unstable-core-do-not-import'; +} from '../../unstable-core-do-not-import.ts'; export { TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER, parseTRPCMessage, -} from '../../unstable-core-do-not-import'; +} from '../../unstable-core-do-not-import.ts'; diff --git a/packages/server/src/adapters/aws-lambda/index.ts b/packages/server/src/adapters/aws-lambda/index.ts index 0b9c1a623b5..f49fdf380ee 100644 --- a/packages/server/src/adapters/aws-lambda/index.ts +++ b/packages/server/src/adapters/aws-lambda/index.ts @@ -14,21 +14,21 @@ import type { APIGatewayProxyStructuredResultV2, Context as APIGWContext, } from 'aws-lambda'; -// @trpc/server -import type { AnyRouter } from '../../@trpc/server'; -// @trpc/server -import { TRPCError } from '../../@trpc/server'; import type { HTTPRequest, HTTPResponse, ResolveHTTPRequestOptionsContextFn, -} from '../../@trpc/server/http'; -import { resolveHTTPResponse } from '../../@trpc/server/http'; +} from '../../@trpc/server/http.ts'; +import { resolveHTTPResponse } from '../../@trpc/server/http.ts'; +// @trpc/server +import type { AnyRouter } from '../../@trpc/server/index.ts'; +// @trpc/server +import { TRPCError } from '../../@trpc/server/index.ts'; import type { APIGatewayEvent, APIGatewayResult, AWSLambdaOptions, -} from './utils'; +} from './utils.ts'; import { getHTTPMethod, getPath, @@ -36,9 +36,9 @@ import { isPayloadV2, transformHeaders, UNKNOWN_PAYLOAD_FORMAT_VERSION_ERROR_MESSAGE, -} from './utils'; +} from './utils.ts'; -export * from './utils'; +export * from './utils.ts'; function lambdaEventToHTTPRequest(event: APIGatewayEvent): HTTPRequest { const query = new URLSearchParams(); diff --git a/packages/server/src/adapters/aws-lambda/utils.ts b/packages/server/src/adapters/aws-lambda/utils.ts index edddc7f2dfa..d67fee32fd0 100644 --- a/packages/server/src/adapters/aws-lambda/utils.ts +++ b/packages/server/src/adapters/aws-lambda/utils.ts @@ -14,16 +14,20 @@ import type { APIGatewayProxyStructuredResultV2, Context as APIGWContext, } from 'aws-lambda'; -import type { AnyRouter, inferRouterContext } from '../../@trpc/server'; // import @trpc/server - -// @trpc/server -import { TRPCError } from '../../@trpc/server'; import type { HTTPHeaders, OnErrorFunction, ResponseMetaFn, TRPCRequestInfo, -} from '../../@trpc/server/http'; +} from '../../@trpc/server/http.ts'; +import type { + AnyRouter, + inferRouterContext, +} from '../../@trpc/server/index.ts'; +// import @trpc/server + +// @trpc/server +import { TRPCError } from '../../@trpc/server/index.ts'; export type APIGatewayEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2; export type APIGatewayResult = diff --git a/packages/server/src/adapters/express.ts b/packages/server/src/adapters/express.ts index 6561ce98c15..42d03a3a106 100644 --- a/packages/server/src/adapters/express.ts +++ b/packages/server/src/adapters/express.ts @@ -8,12 +8,12 @@ * ``` */ import type * as express from 'express'; -import type { AnyRouter } from '../@trpc/server'; +import type { AnyRouter } from '../@trpc/server/index.ts'; import type { NodeHTTPCreateContextFnOptions, NodeHTTPHandlerOptions, -} from './node-http'; -import { nodeHTTPRequestHandler } from './node-http'; +} from './node-http/index.ts'; +import { nodeHTTPRequestHandler } from './node-http/index.ts'; export type CreateExpressContextOptions = NodeHTTPCreateContextFnOptions< express.Request, diff --git a/packages/server/src/adapters/fastify/fastifyRequestHandler.ts b/packages/server/src/adapters/fastify/fastifyRequestHandler.ts index ad109e2f817..3cc960ec195 100644 --- a/packages/server/src/adapters/fastify/fastifyRequestHandler.ts +++ b/packages/server/src/adapters/fastify/fastifyRequestHandler.ts @@ -9,20 +9,20 @@ */ import { Readable } from 'node:stream'; import type { FastifyReply, FastifyRequest } from 'fastify'; -// @trpc/server -import type { AnyRouter } from '../../@trpc/server'; import type { HTTPBaseHandlerOptions, HTTPRequest, HTTPResponse, ResolveHTTPRequestOptionsContextFn, ResponseChunk, -} from '../../@trpc/server/http'; +} from '../../@trpc/server/http.ts'; import { getBatchStreamFormatter, resolveHTTPResponse, -} from '../../@trpc/server/http'; -import type { NodeHTTPCreateContextOption } from '../node-http'; +} from '../../@trpc/server/http.ts'; +// @trpc/server +import type { AnyRouter } from '../../@trpc/server/index.ts'; +import type { NodeHTTPCreateContextOption } from '../node-http/index.ts'; export type FastifyHandlerOptions< TRouter extends AnyRouter, diff --git a/packages/server/src/adapters/fastify/fastifyTRPCPlugin.ts b/packages/server/src/adapters/fastify/fastifyTRPCPlugin.ts index f3de258edcc..8b987302f8a 100644 --- a/packages/server/src/adapters/fastify/fastifyTRPCPlugin.ts +++ b/packages/server/src/adapters/fastify/fastifyTRPCPlugin.ts @@ -9,13 +9,13 @@ */ /// import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify'; -import type { FastifyHandlerOptions } from '.'; // @trpc/server -import type { AnyRouter } from '../../@trpc/server'; -import type { NodeHTTPCreateContextFnOptions } from '../node-http'; -import type { WSSHandlerOptions } from '../ws'; -import { applyWSSHandler } from '../ws'; -import { fastifyRequestHandler } from './fastifyRequestHandler'; +import type { AnyRouter } from '../../@trpc/server/index.ts'; +import type { NodeHTTPCreateContextFnOptions } from '../node-http/index.ts'; +import type { WSSHandlerOptions } from '../ws.ts'; +import { applyWSSHandler } from '../ws.ts'; +import { fastifyRequestHandler } from './fastifyRequestHandler.ts'; +import type { FastifyHandlerOptions } from './index.ts'; export interface FastifyTRPCPluginOptions { prefix?: string; diff --git a/packages/server/src/adapters/fastify/index.ts b/packages/server/src/adapters/fastify/index.ts index 8d20cc62d5c..92660cb13a7 100644 --- a/packages/server/src/adapters/fastify/index.ts +++ b/packages/server/src/adapters/fastify/index.ts @@ -1,2 +1,2 @@ -export * from './fastifyRequestHandler'; -export * from './fastifyTRPCPlugin'; +export * from './fastifyRequestHandler.ts'; +export * from './fastifyTRPCPlugin.ts'; diff --git a/packages/server/src/adapters/fetch/fetchRequestHandler.ts b/packages/server/src/adapters/fetch/fetchRequestHandler.ts index b654a1ddd46..f1bc6d2c7ba 100644 --- a/packages/server/src/adapters/fetch/fetchRequestHandler.ts +++ b/packages/server/src/adapters/fetch/fetchRequestHandler.ts @@ -9,19 +9,19 @@ */ // @trpc/server -import type { AnyRouter } from '../../@trpc/server'; import type { HTTPRequest, HTTPResponse, ResolveHTTPRequestOptionsContextFn, ResponseChunk, -} from '../../@trpc/server/http'; +} from '../../@trpc/server/http.ts'; import { getBatchStreamFormatter, resolveHTTPResponse, toURL, -} from '../../@trpc/server/http'; -import type { FetchHandlerOptions } from './types'; +} from '../../@trpc/server/http.ts'; +import type { AnyRouter } from '../../@trpc/server/index.ts'; +import type { FetchHandlerOptions } from './types.ts'; export type FetchHandlerRequestOptions = FetchHandlerOptions & { diff --git a/packages/server/src/adapters/fetch/index.ts b/packages/server/src/adapters/fetch/index.ts index 85afc44332a..7d75d5045ed 100644 --- a/packages/server/src/adapters/fetch/index.ts +++ b/packages/server/src/adapters/fetch/index.ts @@ -1,2 +1,2 @@ -export * from './fetchRequestHandler'; -export * from './types'; +export * from './fetchRequestHandler.ts'; +export * from './types.ts'; diff --git a/packages/server/src/adapters/fetch/types.ts b/packages/server/src/adapters/fetch/types.ts index 4a68a0105bb..a285bb5dd3c 100644 --- a/packages/server/src/adapters/fetch/types.ts +++ b/packages/server/src/adapters/fetch/types.ts @@ -8,12 +8,16 @@ * ``` */ // @trpc/server -import type { AnyRouter, inferRouterContext } from '../../@trpc/server'; + // @trpc/server/http import type { HTTPBaseHandlerOptions, TRPCRequestInfo, -} from '../../@trpc/server/http'; +} from '../../@trpc/server/http.ts'; +import type { + AnyRouter, + inferRouterContext, +} from '../../@trpc/server/index.ts'; export type FetchCreateContextFnOptions = { req: Request; diff --git a/packages/server/src/adapters/next.ts b/packages/server/src/adapters/next.ts index 82776ab6970..a42be61cfcc 100644 --- a/packages/server/src/adapters/next.ts +++ b/packages/server/src/adapters/next.ts @@ -9,14 +9,14 @@ */ import type { NextApiHandler, NextApiRequest, NextApiResponse } from 'next'; // @trpc/server -import type { AnyRouter } from '../@trpc/server'; +import type { AnyRouter } from '../@trpc/server/index.ts'; // @trpc/server -import { getErrorShape, TRPCError } from '../@trpc/server'; +import { getErrorShape, TRPCError } from '../@trpc/server/index.ts'; import type { NodeHTTPCreateContextFnOptions, NodeHTTPHandlerOptions, -} from './node-http'; -import { nodeHTTPRequestHandler } from './node-http'; +} from './node-http/index.ts'; +import { nodeHTTPRequestHandler } from './node-http/index.ts'; export type CreateNextContextOptions = NodeHTTPCreateContextFnOptions< NextApiRequest, diff --git a/packages/server/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts b/packages/server/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts index b7701a95420..cac7bd3a8b8 100644 --- a/packages/server/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts +++ b/packages/server/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts @@ -17,9 +17,9 @@ import { tmpdir } from 'node:os'; import { basename, dirname, extname, resolve as resolvePath } from 'node:path'; import { finished, Readable } from 'node:stream'; import { promisify } from 'node:util'; -import { streamSlice } from './streamSlice'; -import type { UploadHandler } from './uploadHandler'; -import { MaxPartSizeExceededError } from './uploadHandler'; +import { streamSlice } from './streamSlice.ts'; +import type { UploadHandler } from './uploadHandler.ts'; +import { MaxPartSizeExceededError } from './uploadHandler.ts'; export async function readableStreamToString( stream: ReadableStream, diff --git a/packages/server/src/adapters/node-http/content-type/form-data/index.ts b/packages/server/src/adapters/node-http/content-type/form-data/index.ts index 63d55350309..0e549713a25 100644 --- a/packages/server/src/adapters/node-http/content-type/form-data/index.ts +++ b/packages/server/src/adapters/node-http/content-type/form-data/index.ts @@ -8,17 +8,17 @@ /** * @link https://github.com/remix-run/remix/blob/0bcb4a304dd2f08f6032c3bf0c3aa7eb5b976901/packages/remix-server-runtime/formData.ts */ -import * as fs from 'fs/promises'; +import * as fs from 'node:fs/promises'; import { Readable } from 'node:stream'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore the type definitions for this package are borked import { streamMultipart } from '@web3-storage/multipart-parser'; // @trpc/server -import { createNodeHTTPContentTypeHandler } from '../../internals/contentType'; -import type { NodeHTTPRequest } from '../../types'; -import { NodeOnDiskFile } from './fileUploadHandler'; -import type { UploadHandler, UploadHandlerPart } from './uploadHandler'; -import { MaxBodySizeExceededError } from './uploadHandler'; +import { createNodeHTTPContentTypeHandler } from '../../internals/contentType.ts'; +import type { NodeHTTPRequest } from '../../types.ts'; +import { NodeOnDiskFile } from './fileUploadHandler.ts'; +import type { UploadHandler, UploadHandlerPart } from './uploadHandler.ts'; +import { MaxBodySizeExceededError } from './uploadHandler.ts'; const utfTextDecoder = new TextDecoder('utf-8'); @@ -149,14 +149,14 @@ export const nodeHTTPFormDataContentTypeHandler = export { NodeOnDiskFile as experimental_NodeOnDiskFile, createFileUploadHandler as experimental_createFileUploadHandler, -} from './fileUploadHandler'; -export { createMemoryUploadHandler as experimental_createMemoryUploadHandler } from './memoryUploadHandler'; +} from './fileUploadHandler.ts'; +export { createMemoryUploadHandler as experimental_createMemoryUploadHandler } from './memoryUploadHandler.ts'; export { MaxBodySizeExceededError, MaxPartSizeExceededError, composeUploadHandlers as experimental_composeUploadHandlers, type UploadHandler, -} from './uploadHandler'; +} from './uploadHandler.ts'; export { isMultipartFormDataRequest as experimental_isMultipartFormDataRequest, parseMultipartFormData as experimental_parseMultipartFormData, diff --git a/packages/server/src/adapters/node-http/content-type/form-data/memoryUploadHandler.ts b/packages/server/src/adapters/node-http/content-type/form-data/memoryUploadHandler.ts index 93f6581e56f..201b975d893 100644 --- a/packages/server/src/adapters/node-http/content-type/form-data/memoryUploadHandler.ts +++ b/packages/server/src/adapters/node-http/content-type/form-data/memoryUploadHandler.ts @@ -8,8 +8,8 @@ /** * @link https://github.com/remix-run/remix/blob/0bcb4a304dd2f08f6032c3bf0c3aa7eb5b976901/packages/remix-server-runtime/upload/memoryUploadHandler.ts */ -import type { UploadHandler } from './uploadHandler'; -import { MaxPartSizeExceededError } from './uploadHandler'; +import type { UploadHandler } from './uploadHandler.ts'; +import { MaxPartSizeExceededError } from './uploadHandler.ts'; export type MemoryUploadHandlerFilterArgs = { filename?: string; diff --git a/packages/server/src/adapters/node-http/content-type/form-data/uploadHandler.ts b/packages/server/src/adapters/node-http/content-type/form-data/uploadHandler.ts index 26d896ff72e..99b26eb9352 100644 --- a/packages/server/src/adapters/node-http/content-type/form-data/uploadHandler.ts +++ b/packages/server/src/adapters/node-http/content-type/form-data/uploadHandler.ts @@ -1,4 +1,4 @@ -import type { NodeOnDiskFile } from './fileUploadHandler'; +import type { NodeOnDiskFile } from './fileUploadHandler.ts'; /** * @link https://github.com/remix-run/remix/blob/0bcb4a304dd2f08f6032c3bf0c3aa7eb5b976901/packages/remix-server-runtime/formData.ts diff --git a/packages/server/src/adapters/node-http/content-type/json/getPostBody.ts b/packages/server/src/adapters/node-http/content-type/json/getPostBody.ts index 7d0b94158c6..34658ffc092 100644 --- a/packages/server/src/adapters/node-http/content-type/json/getPostBody.ts +++ b/packages/server/src/adapters/node-http/content-type/json/getPostBody.ts @@ -1,7 +1,7 @@ // @trpc/server -import { TRPCError } from '../../../../@trpc/server'; -import type { BodyResult } from '../../../../@trpc/server/http'; -import type { NodeHTTPRequest } from '../../types'; +import type { BodyResult } from '../../../../@trpc/server/http.ts'; +import { TRPCError } from '../../../../@trpc/server/index.ts'; +import type { NodeHTTPRequest } from '../../types.ts'; export async function getPostBody(opts: { req: NodeHTTPRequest; diff --git a/packages/server/src/adapters/node-http/content-type/json/index.ts b/packages/server/src/adapters/node-http/content-type/json/index.ts index 2a79414cdc8..3ab66d580ee 100644 --- a/packages/server/src/adapters/node-http/content-type/json/index.ts +++ b/packages/server/src/adapters/node-http/content-type/json/index.ts @@ -1,6 +1,6 @@ -import { getJsonContentTypeInputs } from '../../../../@trpc/server/http'; -import { createNodeHTTPContentTypeHandler } from '../../internals/contentType'; -import { getPostBody } from './getPostBody'; +import { getJsonContentTypeInputs } from '../../../../@trpc/server/http.ts'; +import { createNodeHTTPContentTypeHandler } from '../../internals/contentType.ts'; +import { getPostBody } from './getPostBody.ts'; export const nodeHTTPJSONContentTypeHandler = createNodeHTTPContentTypeHandler({ isMatch(opts) { diff --git a/packages/server/src/adapters/node-http/index.ts b/packages/server/src/adapters/node-http/index.ts index d2edbb3b3c8..e279eea57b4 100644 --- a/packages/server/src/adapters/node-http/index.ts +++ b/packages/server/src/adapters/node-http/index.ts @@ -1,2 +1,2 @@ -export * from './nodeHTTPRequestHandler'; -export * from './types'; +export * from './nodeHTTPRequestHandler.ts'; +export * from './types.ts'; diff --git a/packages/server/src/adapters/node-http/internals/contentType.ts b/packages/server/src/adapters/node-http/internals/contentType.ts index 7b58d150994..697cc12e7d7 100644 --- a/packages/server/src/adapters/node-http/internals/contentType.ts +++ b/packages/server/src/adapters/node-http/internals/contentType.ts @@ -1,12 +1,13 @@ // @trpc/server -import type { AnyRouter } from '../../../@trpc/server'; + // @trpc/server/http -import type { BaseContentTypeHandler } from '../../../@trpc/server/http'; +import type { BaseContentTypeHandler } from '../../../@trpc/server/http.ts'; +import type { AnyRouter } from '../../../@trpc/server/index.ts'; import type { NodeHTTPRequest, NodeHTTPRequestHandlerOptions, NodeHTTPResponse, -} from '../types'; +} from '../types.ts'; export interface NodeHTTPContentTypeHandler< TRequest extends NodeHTTPRequest, diff --git a/packages/server/src/adapters/node-http/nodeHTTPRequestHandler.ts b/packages/server/src/adapters/node-http/nodeHTTPRequestHandler.ts index 6b2146606d5..7a7433f2ebf 100644 --- a/packages/server/src/adapters/node-http/nodeHTTPRequestHandler.ts +++ b/packages/server/src/adapters/node-http/nodeHTTPRequestHandler.ts @@ -9,24 +9,24 @@ */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ // @trpc/server -import type { AnyRouter } from '../../@trpc/server'; import type { HTTPRequest, HTTPResponse, ResolveHTTPRequestOptionsContextFn, ResponseChunk, -} from '../../@trpc/server/http'; +} from '../../@trpc/server/http.ts'; import { getBatchStreamFormatter, resolveHTTPResponse, -} from '../../@trpc/server/http'; -import { nodeHTTPJSONContentTypeHandler } from './content-type/json'; -import type { NodeHTTPContentTypeHandler } from './internals/contentType'; +} from '../../@trpc/server/http.ts'; +import type { AnyRouter } from '../../@trpc/server/index.ts'; +import { nodeHTTPJSONContentTypeHandler } from './content-type/json/index.ts'; +import type { NodeHTTPContentTypeHandler } from './internals/contentType.ts'; import type { NodeHTTPRequest, NodeHTTPRequestHandlerOptions, NodeHTTPResponse, -} from './types'; +} from './types.ts'; const defaultJSONContentTypeHandler = nodeHTTPJSONContentTypeHandler(); diff --git a/packages/server/src/adapters/node-http/types.ts b/packages/server/src/adapters/node-http/types.ts index 06ca4590dfe..1a22a7fa4fa 100644 --- a/packages/server/src/adapters/node-http/types.ts +++ b/packages/server/src/adapters/node-http/types.ts @@ -7,17 +7,20 @@ * import type { HTTPBaseHandlerOptions } from '@trpc/server/http' * ``` */ -import type * as http from 'http'; -// @trpc/server -import type { AnyRouter, inferRouterContext } from '../../@trpc/server'; +import type * as http from 'node:http'; // @trpc/server/http import type { HTTPBaseHandlerOptions, TRPCRequestInfo, -} from '../../@trpc/server/http'; +} from '../../@trpc/server/http.ts'; +// @trpc/server +import type { + AnyRouter, + inferRouterContext, +} from '../../@trpc/server/index.ts'; // eslint-disable-next-line no-restricted-imports -import type { MaybePromise } from '../../unstable-core-do-not-import'; -import type { NodeHTTPContentTypeHandler } from './internals/contentType'; +import type { MaybePromise } from '../../unstable-core-do-not-import.ts'; +import type { NodeHTTPContentTypeHandler } from './internals/contentType.ts'; interface ParsedQs { [key: string]: ParsedQs | ParsedQs[] | string[] | string | undefined; diff --git a/packages/server/src/adapters/standalone.ts b/packages/server/src/adapters/standalone.ts index f40453ad51a..64dfdd84234 100644 --- a/packages/server/src/adapters/standalone.ts +++ b/packages/server/src/adapters/standalone.ts @@ -8,15 +8,15 @@ * ``` */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ -import http from 'http'; +import http from 'node:http'; +import { toURL } from '../@trpc/server/http.ts'; // @trpc/server -import type { AnyRouter } from '../@trpc/server'; -import { toURL } from '../@trpc/server/http'; +import type { AnyRouter } from '../@trpc/server/index.ts'; import type { NodeHTTPCreateContextFnOptions, NodeHTTPHandlerOptions, -} from './node-http'; -import { nodeHTTPRequestHandler } from './node-http'; +} from './node-http/index.ts'; +import { nodeHTTPRequestHandler } from './node-http/index.ts'; export type CreateHTTPHandlerOptions = NodeHTTPHandlerOptions; diff --git a/packages/server/src/adapters/ws.ts b/packages/server/src/adapters/ws.ts index 4a99f8e77dc..0d2a4661b95 100644 --- a/packages/server/src/adapters/ws.ts +++ b/packages/server/src/adapters/ws.ts @@ -1,27 +1,27 @@ -import type { IncomingMessage } from 'http'; +import type { IncomingMessage } from 'node:http'; import type ws from 'ws'; -import type { AnyRouter, inferRouterContext } from '../@trpc/server'; +import type { BaseHandlerOptions } from '../@trpc/server/http.ts'; +import type { AnyRouter, inferRouterContext } from '../@trpc/server/index.ts'; import { callProcedure, getErrorShape, getTRPCErrorFromUnknown, transformTRPCResponse, TRPCError, -} from '../@trpc/server'; -import type { BaseHandlerOptions } from '../@trpc/server/http'; -import { parseTRPCMessage } from '../@trpc/server/rpc'; +} from '../@trpc/server/index.ts'; +import { parseTRPCMessage } from '../@trpc/server/rpc.ts'; // @trpc/server/rpc import type { JSONRPC2, TRPCClientOutgoingMessage, TRPCReconnectNotification, TRPCResponseMessage, -} from '../@trpc/server/rpc'; -import { isObservable } from '../observable'; -import type { Unsubscribable } from '../observable'; +} from '../@trpc/server/rpc.ts'; +import { isObservable } from '../observable/index.ts'; +import type { Unsubscribable } from '../observable/index.ts'; // eslint-disable-next-line no-restricted-imports -import type { MaybePromise } from '../unstable-core-do-not-import'; -import type { NodeHTTPCreateContextFnOptions } from './node-http'; +import type { MaybePromise } from '../unstable-core-do-not-import.ts'; +import type { NodeHTTPCreateContextFnOptions } from './node-http/index.ts'; /** * Importing ws causes a build error diff --git a/packages/server/src/http.ts b/packages/server/src/http.ts index 128cdc91d61..b41897e8385 100644 --- a/packages/server/src/http.ts +++ b/packages/server/src/http.ts @@ -1 +1 @@ -export * from './@trpc/server/http'; +export * from './@trpc/server/http.ts'; diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 8d4a6dcf7e1..df84970b1a4 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -1 +1 @@ -export * from './@trpc/server'; +export * from './@trpc/server/index.ts'; diff --git a/packages/server/src/observable/index.ts b/packages/server/src/observable/index.ts index 04b6e0e0406..d3b2ea734e6 100644 --- a/packages/server/src/observable/index.ts +++ b/packages/server/src/observable/index.ts @@ -1,10 +1,10 @@ -export type { inferObservableValue } from './observable'; -export { isObservable, observable, observableToPromise } from './observable'; -export { map, share, tap } from './operators'; +export type { inferObservableValue } from './observable.ts'; +export { isObservable, observable, observableToPromise } from './observable.ts'; +export { map, share, tap } from './operators.ts'; export type { Observable, Observer, TeardownLogic, Unsubscribable, UnsubscribeFn, -} from './types'; +} from './types.ts'; diff --git a/packages/server/src/observable/observable.ts b/packages/server/src/observable/observable.ts index 339502208af..0ba91e47598 100644 --- a/packages/server/src/observable/observable.ts +++ b/packages/server/src/observable/observable.ts @@ -4,7 +4,7 @@ import type { OperatorFunction, TeardownLogic, UnaryFunction, -} from './types'; +} from './types.ts'; function identity(x: TType): TType { return x; diff --git a/packages/server/src/observable/operators.ts b/packages/server/src/observable/operators.ts index e27859d06e3..001b5c806f0 100644 --- a/packages/server/src/observable/operators.ts +++ b/packages/server/src/observable/operators.ts @@ -3,7 +3,7 @@ import type { Observer, OperatorFunction, Unsubscribable, -} from './types'; +} from './types.ts'; export function map( project: (value: TValueBefore, index: number) => TValueAfter, diff --git a/packages/server/src/rpc.ts b/packages/server/src/rpc.ts index 5aff199e181..d3aadddbd8e 100644 --- a/packages/server/src/rpc.ts +++ b/packages/server/src/rpc.ts @@ -1 +1 @@ -export * from './@trpc/server/rpc'; +export * from './@trpc/server/rpc.ts'; diff --git a/packages/server/src/shared.ts b/packages/server/src/shared.ts index b56112b2d8f..92e165cc6b6 100644 --- a/packages/server/src/shared.ts +++ b/packages/server/src/shared.ts @@ -23,4 +23,4 @@ export { * @deprecated `import { createTRPCFlatProxy } from '@trpc/server'` instead */ createTRPCFlatProxy as createFlatProxy, -} from './@trpc/server'; +} from './@trpc/server/index.ts'; diff --git a/packages/server/src/unstable-core-do-not-import.ts b/packages/server/src/unstable-core-do-not-import.ts index c4fe90ec8e4..62dad9fbc13 100644 --- a/packages/server/src/unstable-core-do-not-import.ts +++ b/packages/server/src/unstable-core-do-not-import.ts @@ -8,23 +8,23 @@ * * If you seem to need to import anything from here, please open an issue at https://github.com/trpc/trpc/issues */ -export * from './unstable-core-do-not-import/clientish/inference'; -export * from './unstable-core-do-not-import/clientish/inferrable'; -export * from './unstable-core-do-not-import/clientish/serialize'; -export * from './unstable-core-do-not-import/createProxy'; -export * from './unstable-core-do-not-import/error/formatter'; -export * from './unstable-core-do-not-import/error/getErrorShape'; -export * from './unstable-core-do-not-import/error/TRPCError'; -export * from './unstable-core-do-not-import/http'; -export * from './unstable-core-do-not-import/initTRPC'; -export * from './unstable-core-do-not-import/middleware'; -export * from './unstable-core-do-not-import/parser'; -export * from './unstable-core-do-not-import/procedure'; -export * from './unstable-core-do-not-import/procedureBuilder'; -export * from './unstable-core-do-not-import/rootConfig'; -export * from './unstable-core-do-not-import/router'; -export * from './unstable-core-do-not-import/router'; -export * from './unstable-core-do-not-import/rpc'; -export * from './unstable-core-do-not-import/transformer'; -export * from './unstable-core-do-not-import/types'; -export * from './unstable-core-do-not-import/utils'; +export * from './unstable-core-do-not-import/clientish/inference.ts'; +export * from './unstable-core-do-not-import/clientish/inferrable.ts'; +export * from './unstable-core-do-not-import/clientish/serialize.ts'; +export * from './unstable-core-do-not-import/createProxy.ts'; +export * from './unstable-core-do-not-import/error/formatter.ts'; +export * from './unstable-core-do-not-import/error/getErrorShape.ts'; +export * from './unstable-core-do-not-import/error/TRPCError.ts'; +export * from './unstable-core-do-not-import/http/index.ts'; +export * from './unstable-core-do-not-import/initTRPC.ts'; +export * from './unstable-core-do-not-import/middleware.ts'; +export * from './unstable-core-do-not-import/parser.ts'; +export * from './unstable-core-do-not-import/procedure.ts'; +export * from './unstable-core-do-not-import/procedureBuilder.ts'; +export * from './unstable-core-do-not-import/rootConfig.ts'; +export * from './unstable-core-do-not-import/router.ts'; +export * from './unstable-core-do-not-import/router.ts'; +export * from './unstable-core-do-not-import/rpc/index.ts'; +export * from './unstable-core-do-not-import/transformer.ts'; +export * from './unstable-core-do-not-import/types.ts'; +export * from './unstable-core-do-not-import/utils.ts'; diff --git a/packages/server/src/unstable-core-do-not-import/clientish/inference.ts b/packages/server/src/unstable-core-do-not-import/clientish/inference.ts index c706c1e4164..704af51877e 100644 --- a/packages/server/src/unstable-core-do-not-import/clientish/inference.ts +++ b/packages/server/src/unstable-core-do-not-import/clientish/inference.ts @@ -1,12 +1,12 @@ -import type { inferObservableValue } from '../../observable'; -import type { AnyProcedure, inferProcedureInput } from '../procedure'; -import type { AnyRouter, RouterRecord } from '../router'; +import type { inferObservableValue } from '../../observable/index.ts'; +import type { AnyProcedure, inferProcedureInput } from '../procedure.ts'; +import type { AnyRouter, RouterRecord } from '../router.ts'; import type { AnyClientTypes, inferClientTypes, InferrableClientTypes, -} from './inferrable'; -import type { Serialize } from './serialize'; +} from './inferrable.ts'; +import type { Serialize } from './serialize.ts'; /** * @internal diff --git a/packages/server/src/unstable-core-do-not-import/clientish/inferrable.ts b/packages/server/src/unstable-core-do-not-import/clientish/inferrable.ts index fdf33393c6b..9b1fa3fff54 100644 --- a/packages/server/src/unstable-core-do-not-import/clientish/inferrable.ts +++ b/packages/server/src/unstable-core-do-not-import/clientish/inferrable.ts @@ -1,4 +1,4 @@ -import type { AnyRootTypes } from '../rootConfig'; +import type { AnyRootTypes } from '../rootConfig.ts'; export type AnyClientTypes = Pick; diff --git a/packages/server/src/unstable-core-do-not-import/clientish/serialize.ts b/packages/server/src/unstable-core-do-not-import/clientish/serialize.ts index 34c2b11cb18..b57378fbff1 100644 --- a/packages/server/src/unstable-core-do-not-import/clientish/serialize.ts +++ b/packages/server/src/unstable-core-do-not-import/clientish/serialize.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type { Simplify, WithoutIndexSignature } from '../types'; +import type { Simplify, WithoutIndexSignature } from '../types.ts'; /** * @link https://github.com/remix-run/remix/blob/2248669ed59fd716e267ea41df5d665d4781f4a9/packages/remix-server-runtime/serialize.ts diff --git a/packages/server/src/unstable-core-do-not-import/error/TRPCError.ts b/packages/server/src/unstable-core-do-not-import/error/TRPCError.ts index 04769e771a3..4b3baa2d44b 100644 --- a/packages/server/src/unstable-core-do-not-import/error/TRPCError.ts +++ b/packages/server/src/unstable-core-do-not-import/error/TRPCError.ts @@ -1,5 +1,5 @@ -import type { TRPC_ERROR_CODE_KEY } from '../rpc/codes'; -import { isObject } from '../utils'; +import type { TRPC_ERROR_CODE_KEY } from '../rpc/codes.ts'; +import { isObject } from '../utils.ts'; class UnknownCauseError extends Error { [key: string]: unknown; diff --git a/packages/server/src/unstable-core-do-not-import/error/formatter.ts b/packages/server/src/unstable-core-do-not-import/error/formatter.ts index c0bcddf9ba9..5cbe4d8c086 100644 --- a/packages/server/src/unstable-core-do-not-import/error/formatter.ts +++ b/packages/server/src/unstable-core-do-not-import/error/formatter.ts @@ -1,10 +1,10 @@ -import type { ProcedureType } from '../procedure'; +import type { ProcedureType } from '../procedure.ts'; import type { TRPC_ERROR_CODE_KEY, TRPC_ERROR_CODE_NUMBER, TRPCErrorShape, -} from '../rpc'; -import type { TRPCError } from './TRPCError'; +} from '../rpc/index.ts'; +import type { TRPCError } from './TRPCError.ts'; /** * @internal diff --git a/packages/server/src/unstable-core-do-not-import/error/getErrorShape.ts b/packages/server/src/unstable-core-do-not-import/error/getErrorShape.ts index 1dbfc75afb7..e839c0d5800 100644 --- a/packages/server/src/unstable-core-do-not-import/error/getErrorShape.ts +++ b/packages/server/src/unstable-core-do-not-import/error/getErrorShape.ts @@ -1,9 +1,9 @@ -import { getHTTPStatusCodeFromError } from '../http/getHTTPStatusCode'; -import type { ProcedureType } from '../procedure'; -import type { AnyRootTypes, RootConfig } from '../rootConfig'; -import { TRPC_ERROR_CODES_BY_KEY } from '../rpc'; -import type { DefaultErrorShape } from './formatter'; -import type { TRPCError } from './TRPCError'; +import { getHTTPStatusCodeFromError } from '../http/getHTTPStatusCode.ts'; +import type { ProcedureType } from '../procedure.ts'; +import type { AnyRootTypes, RootConfig } from '../rootConfig.ts'; +import { TRPC_ERROR_CODES_BY_KEY } from '../rpc/index.ts'; +import type { DefaultErrorShape } from './formatter.ts'; +import type { TRPCError } from './TRPCError.ts'; /** * @internal diff --git a/packages/server/src/unstable-core-do-not-import/http/contentType.ts b/packages/server/src/unstable-core-do-not-import/http/contentType.ts index e37ed2718dd..01c8028e979 100644 --- a/packages/server/src/unstable-core-do-not-import/http/contentType.ts +++ b/packages/server/src/unstable-core-do-not-import/http/contentType.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ -import { TRPCError } from '../error/TRPCError'; -import type { AnyRouter } from '../router'; -import type { CombinedDataTransformer } from '../transformer'; -import type { MaybePromise } from '../types'; -import type { HTTPRequest } from './types'; +import { TRPCError } from '../error/TRPCError.ts'; +import type { AnyRouter } from '../router.ts'; +import type { CombinedDataTransformer } from '../transformer.ts'; +import type { MaybePromise } from '../types.ts'; +import type { HTTPRequest } from './types.ts'; type GetInputs = (opts: { req: HTTPRequest; diff --git a/packages/server/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts b/packages/server/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts index 448768c5e48..570301f9c85 100644 --- a/packages/server/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +++ b/packages/server/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts @@ -1,7 +1,7 @@ -import type { DefaultErrorData } from '../error/formatter'; -import type { TRPCError } from '../error/TRPCError'; -import type { TRPC_ERROR_CODES_BY_KEY, TRPCResponse } from '../rpc'; -import { TRPC_ERROR_CODES_BY_NUMBER } from '../rpc'; +import type { DefaultErrorData } from '../error/formatter.ts'; +import type { TRPCError } from '../error/TRPCError.ts'; +import type { TRPC_ERROR_CODES_BY_KEY, TRPCResponse } from '../rpc/index.ts'; +import { TRPC_ERROR_CODES_BY_NUMBER } from '../rpc/index.ts'; const JSONRPC2_TO_HTTP_CODE: Record< keyof typeof TRPC_ERROR_CODES_BY_KEY, diff --git a/packages/server/src/unstable-core-do-not-import/http/index.ts b/packages/server/src/unstable-core-do-not-import/http/index.ts index 0e01af81d4f..a59c7394ae4 100644 --- a/packages/server/src/unstable-core-do-not-import/http/index.ts +++ b/packages/server/src/unstable-core-do-not-import/http/index.ts @@ -1,8 +1,8 @@ export { getHTTPStatusCode, getHTTPStatusCodeFromError, -} from './getHTTPStatusCode'; -export { resolveHTTPResponse } from './resolveHTTPResponse'; +} from './getHTTPStatusCode.ts'; +export { resolveHTTPResponse } from './resolveHTTPResponse.ts'; export type { BaseHandlerOptions, HTTPBaseHandlerOptions, @@ -16,10 +16,10 @@ export type { ResponseMeta, ResponseMetaFn, TRPCRequestInfo, -} from './types'; +} from './types.ts'; -export { getBatchStreamFormatter } from './batchStreamFormatter'; -export type { BaseContentTypeHandler, BodyResult } from './contentType'; -export { getJsonContentTypeInputs } from './contentType'; +export { getBatchStreamFormatter } from './batchStreamFormatter.ts'; +export type { BaseContentTypeHandler, BodyResult } from './contentType.ts'; +export { getJsonContentTypeInputs } from './contentType.ts'; -export { toURL } from './toURL'; +export { toURL } from './toURL.ts'; diff --git a/packages/server/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts b/packages/server/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts index 127d4c420ff..a6fdaf37cb7 100644 --- a/packages/server/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts +++ b/packages/server/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts @@ -1,18 +1,18 @@ -import { getErrorShape } from '../error/getErrorShape'; -import { getTRPCErrorFromUnknown, TRPCError } from '../error/TRPCError'; -import type { ProcedureType } from '../procedure'; +import { getErrorShape } from '../error/getErrorShape.ts'; +import { getTRPCErrorFromUnknown, TRPCError } from '../error/TRPCError.ts'; +import type { ProcedureType } from '../procedure.ts'; import type { AnyRouter, inferRouterContext, inferRouterError, -} from '../router'; -import { callProcedure } from '../router'; -import type { TRPCResponse } from '../rpc'; -import { transformTRPCResponse } from '../transformer'; -import type { Maybe } from '../types'; -import type { BaseContentTypeHandler } from './contentType'; -import { getJsonContentTypeInputs } from './contentType'; -import { getHTTPStatusCode } from './getHTTPStatusCode'; +} from '../router.ts'; +import { callProcedure } from '../router.ts'; +import type { TRPCResponse } from '../rpc/index.ts'; +import { transformTRPCResponse } from '../transformer.ts'; +import type { Maybe } from '../types.ts'; +import type { BaseContentTypeHandler } from './contentType.ts'; +import { getJsonContentTypeInputs } from './contentType.ts'; +import { getHTTPStatusCode } from './getHTTPStatusCode.ts'; import type { HTTPBaseHandlerOptions, HTTPHeaders, diff --git a/packages/server/src/unstable-core-do-not-import/http/types.ts b/packages/server/src/unstable-core-do-not-import/http/types.ts index 150852ac6d0..bb2935263b6 100644 --- a/packages/server/src/unstable-core-do-not-import/http/types.ts +++ b/packages/server/src/unstable-core-do-not-import/http/types.ts @@ -1,12 +1,12 @@ -import type { TRPCError } from '../error/TRPCError'; -import type { ProcedureType } from '../procedure'; +import type { TRPCError } from '../error/TRPCError.ts'; +import type { ProcedureType } from '../procedure.ts'; import type { AnyRouter, inferRouterContext, inferRouterError, -} from '../router'; -import type { TRPCResponse } from '../rpc'; -import type { Dict } from '../types'; +} from '../router.ts'; +import type { TRPCResponse } from '../rpc/index.ts'; +import type { Dict } from '../types.ts'; export type HTTPHeaders = Dict; diff --git a/packages/server/src/unstable-core-do-not-import/initTRPC.ts b/packages/server/src/unstable-core-do-not-import/initTRPC.ts index 817a63a0524..2644cad3d8c 100644 --- a/packages/server/src/unstable-core-do-not-import/initTRPC.ts +++ b/packages/server/src/unstable-core-do-not-import/initTRPC.ts @@ -1,21 +1,21 @@ -import { createFlatProxy } from './createProxy'; +import { createFlatProxy } from './createProxy.ts'; import { defaultFormatter, type DefaultErrorShape, type ErrorFormatter, -} from './error/formatter'; -import { createMiddlewareFactory } from './middleware'; -import { createBuilder } from './procedureBuilder'; -import type { CreateRootTypes } from './rootConfig'; -import { isServerDefault, type RootConfig } from './rootConfig'; +} from './error/formatter.ts'; +import { createMiddlewareFactory } from './middleware.ts'; +import { createBuilder } from './procedureBuilder.ts'; +import type { CreateRootTypes } from './rootConfig.ts'; +import { isServerDefault, type RootConfig } from './rootConfig.ts'; import { createCallerFactory, createRouterFactory, mergeRouters, -} from './router'; -import type { DataTransformerOptions } from './transformer'; -import { defaultTransformer, getDataTransformer } from './transformer'; -import type { Unwrap, ValidateShape } from './types'; +} from './router.ts'; +import type { DataTransformerOptions } from './transformer.ts'; +import { defaultTransformer, getDataTransformer } from './transformer.ts'; +import type { Unwrap, ValidateShape } from './types.ts'; type inferErrorFormatterShape = TType extends ErrorFormatter< any, diff --git a/packages/server/src/unstable-core-do-not-import/middleware.ts b/packages/server/src/unstable-core-do-not-import/middleware.ts index 2d800491e46..4d16f557700 100644 --- a/packages/server/src/unstable-core-do-not-import/middleware.ts +++ b/packages/server/src/unstable-core-do-not-import/middleware.ts @@ -1,8 +1,8 @@ -import { TRPCError } from './error/TRPCError'; -import type { ParseFn } from './parser'; -import type { ProcedureType } from './procedure'; -import type { GetRawInputFn, Overwrite, Simplify } from './types'; -import { isObject } from './utils'; +import { TRPCError } from './error/TRPCError.ts'; +import type { ParseFn } from './parser.ts'; +import type { ProcedureType } from './procedure.ts'; +import type { GetRawInputFn, Overwrite, Simplify } from './types.ts'; +import { isObject } from './utils.ts'; /** @internal */ export const middlewareMarker = 'middlewareMarker' as 'middlewareMarker' & { diff --git a/packages/server/src/unstable-core-do-not-import/procedure.ts b/packages/server/src/unstable-core-do-not-import/procedure.ts index 83ee8f1213f..d6b5a4c387e 100644 --- a/packages/server/src/unstable-core-do-not-import/procedure.ts +++ b/packages/server/src/unstable-core-do-not-import/procedure.ts @@ -1,4 +1,4 @@ -import type { ProcedureCallOptions } from './procedureBuilder'; +import type { ProcedureCallOptions } from './procedureBuilder.ts'; export const procedureTypes = ['query', 'mutation', 'subscription'] as const; /** diff --git a/packages/server/src/unstable-core-do-not-import/procedureBuilder.ts b/packages/server/src/unstable-core-do-not-import/procedureBuilder.ts index 97455312bfe..35e77020424 100644 --- a/packages/server/src/unstable-core-do-not-import/procedureBuilder.ts +++ b/packages/server/src/unstable-core-do-not-import/procedureBuilder.ts @@ -1,18 +1,18 @@ -import type { inferObservableValue } from '../observable'; -import { getTRPCErrorFromUnknown, TRPCError } from './error/TRPCError'; +import type { inferObservableValue } from '../observable/index.ts'; +import { getTRPCErrorFromUnknown, TRPCError } from './error/TRPCError.ts'; import type { AnyMiddlewareFunction, MiddlewareBuilder, MiddlewareFunction, MiddlewareResult, -} from './middleware'; +} from './middleware.ts'; import { createInputMiddleware, createOutputMiddleware, middlewareMarker, -} from './middleware'; -import type { inferParser, Parser } from './parser'; -import { getParseFn } from './parser'; +} from './middleware.ts'; +import type { inferParser, Parser } from './parser.ts'; +import { getParseFn } from './parser.ts'; import type { AnyMutationProcedure, AnyProcedure, @@ -22,15 +22,15 @@ import type { ProcedureType, QueryProcedure, SubscriptionProcedure, -} from './procedure'; +} from './procedure.ts'; import type { GetRawInputFn, MaybePromise, Overwrite, Simplify, TypeError, -} from './types'; -import { mergeWithoutOverrides } from './utils'; +} from './types.ts'; +import { mergeWithoutOverrides } from './utils.ts'; type IntersectIfDefined = TType extends UnsetMarker ? TWith diff --git a/packages/server/src/unstable-core-do-not-import/rootConfig.ts b/packages/server/src/unstable-core-do-not-import/rootConfig.ts index 472bced1127..cc14e5d9ae5 100644 --- a/packages/server/src/unstable-core-do-not-import/rootConfig.ts +++ b/packages/server/src/unstable-core-do-not-import/rootConfig.ts @@ -1,5 +1,5 @@ -import type { CombinedDataTransformer } from '../unstable-core-do-not-import'; -import type { DefaultErrorShape, ErrorFormatter } from './error/formatter'; +import type { DefaultErrorShape, ErrorFormatter } from './error/formatter.ts'; +import type { CombinedDataTransformer } from './transformer.ts'; /** * The initial generics that are used in the init function diff --git a/packages/server/src/unstable-core-do-not-import/router.ts b/packages/server/src/unstable-core-do-not-import/router.ts index 104441e8817..b5172056a57 100644 --- a/packages/server/src/unstable-core-do-not-import/router.ts +++ b/packages/server/src/unstable-core-do-not-import/router.ts @@ -1,13 +1,13 @@ -import type { Observable } from '../observable'; -import { createRecursiveProxy } from './createProxy'; -import { defaultFormatter } from './error/formatter'; -import { TRPCError } from './error/TRPCError'; -import type { AnyProcedure, inferProcedureInput } from './procedure'; -import type { ProcedureCallOptions } from './procedureBuilder'; -import type { AnyRootTypes, RootConfig } from './rootConfig'; -import { defaultTransformer } from './transformer'; -import type { MaybePromise, ValueOf } from './types'; -import { mergeWithoutOverrides, omitPrototype } from './utils'; +import type { Observable } from '../observable/index.ts'; +import { createRecursiveProxy } from './createProxy.ts'; +import { defaultFormatter } from './error/formatter.ts'; +import { TRPCError } from './error/TRPCError.ts'; +import type { AnyProcedure, inferProcedureInput } from './procedure.ts'; +import type { ProcedureCallOptions } from './procedureBuilder.ts'; +import type { AnyRootTypes, RootConfig } from './rootConfig.ts'; +import { defaultTransformer } from './transformer.ts'; +import type { MaybePromise, ValueOf } from './types.ts'; +import { mergeWithoutOverrides, omitPrototype } from './utils.ts'; export interface RouterRecord { [key: string]: AnyProcedure | RouterRecord; diff --git a/packages/server/src/unstable-core-do-not-import/rpc/codes.ts b/packages/server/src/unstable-core-do-not-import/rpc/codes.ts index 65c0df05df9..3aa330f4021 100644 --- a/packages/server/src/unstable-core-do-not-import/rpc/codes.ts +++ b/packages/server/src/unstable-core-do-not-import/rpc/codes.ts @@ -1,4 +1,4 @@ -import type { ValueOf } from '../types'; +import type { ValueOf } from '../types.ts'; // reference: https://www.jsonrpc.org/specification diff --git a/packages/server/src/unstable-core-do-not-import/rpc/envelopes.ts b/packages/server/src/unstable-core-do-not-import/rpc/envelopes.ts index 7ef85d04c28..2aee8966bb6 100644 --- a/packages/server/src/unstable-core-do-not-import/rpc/envelopes.ts +++ b/packages/server/src/unstable-core-do-not-import/rpc/envelopes.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-namespace */ -import type { ProcedureType } from '../procedure'; -import type { TRPC_ERROR_CODE_NUMBER } from './codes'; +import type { ProcedureType } from '../procedure.ts'; +import type { TRPC_ERROR_CODE_NUMBER } from './codes.ts'; /** * Error response diff --git a/packages/server/src/unstable-core-do-not-import/rpc/index.ts b/packages/server/src/unstable-core-do-not-import/rpc/index.ts index a1f3271192b..e091d628524 100644 --- a/packages/server/src/unstable-core-do-not-import/rpc/index.ts +++ b/packages/server/src/unstable-core-do-not-import/rpc/index.ts @@ -1,5 +1,8 @@ -export { TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER } from './codes'; -export type { TRPC_ERROR_CODE_KEY, TRPC_ERROR_CODE_NUMBER } from './codes'; +export { + TRPC_ERROR_CODES_BY_KEY, + TRPC_ERROR_CODES_BY_NUMBER, +} from './codes.ts'; +export type { TRPC_ERROR_CODE_KEY, TRPC_ERROR_CODE_NUMBER } from './codes.ts'; export type { JSONRPC2, TRPCClientIncomingMessage, @@ -17,5 +20,5 @@ export type { TRPCResultMessage, TRPCSubscriptionStopNotification, TRPCSuccessResponse, -} from './envelopes'; -export { parseTRPCMessage } from './parseTRPCMessage'; +} from './envelopes.ts'; +export { parseTRPCMessage } from './parseTRPCMessage.ts'; diff --git a/packages/server/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts b/packages/server/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts index 4ff9771bfd4..1379ed00a2a 100644 --- a/packages/server/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts +++ b/packages/server/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts @@ -1,7 +1,7 @@ -import { procedureTypes, type ProcedureType } from '../procedure'; -import type { CombinedDataTransformer } from '../transformer'; -import { isObject } from '../utils'; -import type { TRPCClientOutgoingMessage } from './envelopes'; +import { procedureTypes, type ProcedureType } from '../procedure.ts'; +import type { CombinedDataTransformer } from '../transformer.ts'; +import { isObject } from '../utils.ts'; +import type { TRPCClientOutgoingMessage } from './envelopes.ts'; /* istanbul ignore next -- @preserve */ function assertIsObject(obj: unknown): asserts obj is Record { diff --git a/packages/server/src/unstable-core-do-not-import/transformer.ts b/packages/server/src/unstable-core-do-not-import/transformer.ts index 0a662ec534b..0b2c6b493ec 100644 --- a/packages/server/src/unstable-core-do-not-import/transformer.ts +++ b/packages/server/src/unstable-core-do-not-import/transformer.ts @@ -1,11 +1,11 @@ -import type { AnyRootTypes, RootConfig } from './rootConfig'; -import type { AnyRouter, inferRouterError } from './router'; +import type { AnyRootTypes, RootConfig } from './rootConfig.ts'; +import type { AnyRouter, inferRouterError } from './router.ts'; import type { TRPCResponse, TRPCResponseMessage, TRPCResultMessage, -} from './rpc'; -import { isObject } from './utils'; +} from './rpc/index.ts'; +import { isObject } from './utils.ts'; /** * @public diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json index 0955f5af496..b3a98ddcc2d 100644 --- a/packages/server/tsconfig.json +++ b/packages/server/tsconfig.json @@ -5,7 +5,9 @@ // https://github.com/tsconfig/bases/blob/main/bases/node18.json "lib": ["es2023", "DOM", "DOM.Iterable"], "target": "es2022", - "module": "Node16", - "moduleResolution": "Node16" + "module": "NodeNext", + "moduleResolution": "NodeNext", + "allowImportingTsExtensions": true, + "noEmit": true } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 05da0ef5ff5..4adf5b8d5ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1039,7 +1039,7 @@ importers: version: 2.8.8 prisma: specifier: https://registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%40examplestrpc-next-prisma-starter - version: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-starter' + version: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%25252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-starter' start-server-and-test: specifier: ^1.12.0 version: 1.14.0 @@ -1133,7 +1133,7 @@ importers: version: 4.1.5 prisma: specifier: https://registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%40examplestrpc-next-prisma-todomvc - version: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-todomvc' + version: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%25252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-todomvc' start-server-and-test: specifier: ^1.12.0 version: 1.14.0 @@ -1239,7 +1239,7 @@ importers: version: 2.8.8 prisma: specifier: https://registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%40examplesnext-websockets-starter - version: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%252525252525252525252525252525252525252525252525252525252525252540examplesnext-websockets-starter' + version: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%25252525252525252525252525252525252525252525252525252525252525252540examplesnext-websockets-starter' start-server-and-test: specifier: ^1.12.0 version: 1.14.0 @@ -23104,7 +23104,7 @@ packages: prisma: optional: true dependencies: - prisma: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%252525252525252525252525252525252525252525252525252525252525252540examplesnext-websockets-starter' + prisma: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%25252525252525252525252525252525252525252525252525252525252525252540examplesnext-websockets-starter' dev: false '@registry.npmjs.com/@prisma/client/-/client-5.8.1.tgz?id=examplestrpc-next-prisma-starter(prisma@5.8.1)': @@ -23120,7 +23120,7 @@ packages: prisma: optional: true dependencies: - prisma: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-starter' + prisma: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%25252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-starter' dev: false '@registry.npmjs.com/@prisma/client/-/client-5.8.1.tgz?id=examplestrpc-next-prisma-todomvc(prisma@5.8.1)': @@ -23136,10 +23136,10 @@ packages: prisma: optional: true dependencies: - prisma: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-todomvc' + prisma: '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%25252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-todomvc' dev: false - '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%252525252525252525252525252525252525252525252525252525252525252540examplesnext-websockets-starter': + '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%25252525252525252525252525252525252525252525252525252525252525252540examplesnext-websockets-starter': resolution: {tarball: https://registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%40examplesnext-websockets-starter} name: prisma version: 5.8.1 @@ -23149,7 +23149,7 @@ packages: dependencies: '@prisma/engines': 5.8.1 - '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-starter': + '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%25252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-starter': resolution: {tarball: https://registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%40examplestrpc-next-prisma-starter} name: prisma version: 5.8.1 @@ -23159,7 +23159,7 @@ packages: dependencies: '@prisma/engines': 5.8.1 - '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-todomvc': + '@registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%25252525252525252525252525252525252525252525252525252525252525252540examplestrpc-next-prisma-todomvc': resolution: {tarball: https://registry.npmjs.com/prisma/-/prisma-5.8.1.tgz?id=%40examplestrpc-next-prisma-todomvc} name: prisma version: 5.8.1