@tanstack/start-server-core 1.131.6 → 1.132.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/createStartHandler.d.ts +1 -1
- package/dist/esm/createStartHandler.js +8 -9
- package/dist/esm/createStartHandler.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +6 -90
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loadVirtualModule.js +2 -0
- package/dist/esm/loadVirtualModule.js.map +1 -1
- package/dist/esm/request-response.d.ts +124 -0
- package/dist/esm/request-response.js +177 -0
- package/dist/esm/request-response.js.map +1 -0
- package/dist/esm/router-manifest.js +6 -3
- package/dist/esm/router-manifest.js.map +1 -1
- package/dist/esm/server-functions-handler.js +25 -59
- package/dist/esm/server-functions-handler.js.map +1 -1
- package/dist/esm/serverRoute.js +1 -2
- package/dist/esm/serverRoute.js.map +1 -1
- package/dist/esm/session.d.ts +66 -0
- package/dist/esm/virtual-modules.d.ts +2 -0
- package/dist/esm/virtual-modules.js +2 -1
- package/dist/esm/virtual-modules.js.map +1 -1
- package/package.json +9 -19
- package/src/createStartHandler.ts +7 -7
- package/src/global.d.ts +1 -3
- package/src/index.tsx +1 -1
- package/src/loadVirtualModule.ts +2 -0
- package/src/request-response.ts +335 -0
- package/src/router-manifest.ts +6 -3
- package/src/server-functions-handler.ts +29 -67
- package/src/session.ts +75 -0
- package/src/tanstack-start.d.ts +4 -0
- package/src/virtual-modules.ts +2 -0
- package/dist/cjs/constants.cjs +0 -7
- package/dist/cjs/constants.cjs.map +0 -1
- package/dist/cjs/constants.d.cts +0 -3
- package/dist/cjs/createStartHandler.cjs +0 -342
- package/dist/cjs/createStartHandler.cjs.map +0 -1
- package/dist/cjs/createStartHandler.d.cts +0 -7
- package/dist/cjs/h3.cjs +0 -355
- package/dist/cjs/h3.cjs.map +0 -1
- package/dist/cjs/h3.d.cts +0 -109
- package/dist/cjs/index.cjs +0 -257
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.d.cts +0 -10
- package/dist/cjs/loadVirtualModule.cjs +0 -39
- package/dist/cjs/loadVirtualModule.cjs.map +0 -1
- package/dist/cjs/loadVirtualModule.d.cts +0 -6
- package/dist/cjs/router-manifest.cjs +0 -46
- package/dist/cjs/router-manifest.cjs.map +0 -1
- package/dist/cjs/router-manifest.d.cts +0 -17
- package/dist/cjs/server-functions-handler.cjs +0 -181
- package/dist/cjs/server-functions-handler.cjs.map +0 -1
- package/dist/cjs/server-functions-handler.d.cts +0 -3
- package/dist/cjs/serverRoute.cjs +0 -104
- package/dist/cjs/serverRoute.cjs.map +0 -1
- package/dist/cjs/serverRoute.d.cts +0 -124
- package/dist/cjs/virtual-modules.cjs +0 -9
- package/dist/cjs/virtual-modules.cjs.map +0 -1
- package/dist/cjs/virtual-modules.d.cts +0 -10
- package/dist/esm/h3.d.ts +0 -109
- package/dist/esm/h3.js +0 -248
- package/dist/esm/h3.js.map +0 -1
- package/src/h3.ts +0 -492
package/dist/cjs/serverRoute.cjs
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const routerCore = require("@tanstack/router-core");
|
|
4
|
-
function createServerFileRoute(_) {
|
|
5
|
-
return createServerRoute();
|
|
6
|
-
}
|
|
7
|
-
function createServerRoute(__, __opts) {
|
|
8
|
-
const options = __opts || {};
|
|
9
|
-
const route = {
|
|
10
|
-
isRoot: false,
|
|
11
|
-
path: "",
|
|
12
|
-
id: "",
|
|
13
|
-
fullPath: "",
|
|
14
|
-
to: "",
|
|
15
|
-
options,
|
|
16
|
-
parentRoute: void 0,
|
|
17
|
-
_types: {},
|
|
18
|
-
// children: undefined as TChildren,
|
|
19
|
-
middleware: (middlewares) => createServerRoute(void 0, {
|
|
20
|
-
...options,
|
|
21
|
-
middleware: middlewares
|
|
22
|
-
}),
|
|
23
|
-
methods: (methodsOrGetMethods) => {
|
|
24
|
-
const methods = (() => {
|
|
25
|
-
if (typeof methodsOrGetMethods === "function") {
|
|
26
|
-
return methodsOrGetMethods(createMethodBuilder());
|
|
27
|
-
}
|
|
28
|
-
return methodsOrGetMethods;
|
|
29
|
-
})();
|
|
30
|
-
return createServerRoute(void 0, {
|
|
31
|
-
...__opts,
|
|
32
|
-
methods
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
update: (opts) => createServerRoute(void 0, {
|
|
36
|
-
...options,
|
|
37
|
-
...opts
|
|
38
|
-
}),
|
|
39
|
-
init: (opts) => {
|
|
40
|
-
var _a;
|
|
41
|
-
options.originalIndex = opts.originalIndex;
|
|
42
|
-
const isRoot = !options.path && !options.id;
|
|
43
|
-
route.parentRoute = (_a = options.getParentRoute) == null ? void 0 : _a.call(options);
|
|
44
|
-
if (isRoot) {
|
|
45
|
-
route.path = routerCore.rootRouteId;
|
|
46
|
-
} else if (!route.parentRoute) {
|
|
47
|
-
throw new Error(
|
|
48
|
-
`Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a ServerRoute instance.`
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
let path = isRoot ? routerCore.rootRouteId : options.path;
|
|
52
|
-
if (path && path !== "/") {
|
|
53
|
-
path = routerCore.trimPathLeft(path);
|
|
54
|
-
}
|
|
55
|
-
const customId = options.id || path;
|
|
56
|
-
let id = isRoot ? routerCore.rootRouteId : routerCore.joinPaths([
|
|
57
|
-
route.parentRoute.id === routerCore.rootRouteId ? "" : route.parentRoute.id,
|
|
58
|
-
customId
|
|
59
|
-
]);
|
|
60
|
-
if (path === routerCore.rootRouteId) {
|
|
61
|
-
path = "/";
|
|
62
|
-
}
|
|
63
|
-
if (id !== routerCore.rootRouteId) {
|
|
64
|
-
id = routerCore.joinPaths(["/", id]);
|
|
65
|
-
}
|
|
66
|
-
const fullPath = id === routerCore.rootRouteId ? "/" : routerCore.joinPaths([route.parentRoute.fullPath, path]);
|
|
67
|
-
route.path = path;
|
|
68
|
-
route.id = id;
|
|
69
|
-
route.fullPath = fullPath;
|
|
70
|
-
route.to = fullPath;
|
|
71
|
-
route.isRoot = isRoot;
|
|
72
|
-
},
|
|
73
|
-
_addFileChildren: (children) => {
|
|
74
|
-
if (Array.isArray(children)) {
|
|
75
|
-
route.children = children;
|
|
76
|
-
}
|
|
77
|
-
if (typeof children === "object" && children !== null) {
|
|
78
|
-
route.children = Object.values(children);
|
|
79
|
-
}
|
|
80
|
-
return route;
|
|
81
|
-
},
|
|
82
|
-
_addFileTypes: () => route
|
|
83
|
-
};
|
|
84
|
-
return route;
|
|
85
|
-
}
|
|
86
|
-
const createServerRootRoute = createServerRoute;
|
|
87
|
-
const createMethodBuilder = (__opts) => {
|
|
88
|
-
return {
|
|
89
|
-
_options: __opts || {},
|
|
90
|
-
_types: {},
|
|
91
|
-
middleware: (middlewares) => createMethodBuilder({
|
|
92
|
-
...__opts,
|
|
93
|
-
middlewares
|
|
94
|
-
}),
|
|
95
|
-
handler: (handler) => createMethodBuilder({
|
|
96
|
-
...__opts,
|
|
97
|
-
handler
|
|
98
|
-
})
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
exports.createServerFileRoute = createServerFileRoute;
|
|
102
|
-
exports.createServerRootRoute = createServerRootRoute;
|
|
103
|
-
exports.createServerRoute = createServerRoute;
|
|
104
|
-
//# sourceMappingURL=serverRoute.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverRoute.cjs","sources":["../../src/serverRoute.ts"],"sourcesContent":["import { joinPaths, rootRouteId, trimPathLeft } from '@tanstack/router-core'\nimport type {\n Assign,\n Constrain,\n Expand,\n ResolveParams,\n RouteConstraints,\n TrimPathRight,\n} from '@tanstack/router-core'\nimport type {\n AnyRequestMiddleware,\n AssignAllServerContext,\n} from '@tanstack/start-client-core'\n\nexport function createServerFileRoute<\n TFilePath extends keyof ServerFileRoutesByPath,\n TParentRoute extends\n AnyServerRouteWithTypes = ServerFileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = ServerFileRoutesByPath[TFilePath]['id'],\n TPath extends\n RouteConstraints['TPath'] = ServerFileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = ServerFileRoutesByPath[TFilePath]['fullPath'],\n TChildren = ServerFileRoutesByPath[TFilePath]['children'],\n>(_: TFilePath): ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren> {\n return createServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren>(\n undefined,\n )\n}\n\nexport interface ServerFileRoutesByPath {}\n\nexport interface ServerRouteOptions<\n TParentRoute extends AnyServerRouteWithTypes,\n TId extends RouteConstraints['TId'],\n TPath extends RouteConstraints['TPath'],\n TFullPath extends RouteConstraints['TFullPath'],\n TMiddlewares,\n> {\n id: TId\n path: TPath\n pathname: TFullPath\n originalIndex: number\n getParentRoute?: () => TParentRoute\n middleware?: Constrain<TMiddlewares, ReadonlyArray<AnyRequestMiddleware>>\n methods?: Record<\n string,\n | ServerRouteMethodHandlerFn<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n any,\n any\n >\n | {\n _options: ServerRouteMethodBuilderOptions<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n unknown,\n unknown\n >\n }\n >\n caseSensitive?: boolean\n}\n\nexport type ServerRouteManifest = {\n middleware: boolean\n methods: Record<string, { middleware: boolean }>\n}\n\nexport function createServerRoute<\n TParentRoute extends AnyServerRouteWithTypes,\n TId extends RouteConstraints['TId'],\n TPath extends RouteConstraints['TPath'],\n TFullPath extends RouteConstraints['TFullPath'],\n TChildren,\n>(\n __?: never,\n __opts?: Partial<\n ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, undefined>\n >,\n): ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren> {\n const options = __opts || {}\n\n const route: ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren> = {\n isRoot: false as any,\n path: '' as TPath,\n id: '' as TId,\n fullPath: '' as TFullPath,\n to: '' as TrimPathRight<TFullPath>,\n options: options as ServerRouteOptions<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n any\n >,\n parentRoute: undefined as unknown as TParentRoute,\n _types: {} as ServerRouteTypes<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n undefined,\n undefined\n >,\n // children: undefined as TChildren,\n middleware: (middlewares) =>\n createServerRoute(undefined, {\n ...options,\n middleware: middlewares,\n }) as never,\n methods: (methodsOrGetMethods) => {\n const methods = (() => {\n if (typeof methodsOrGetMethods === 'function') {\n return methodsOrGetMethods(createMethodBuilder())\n }\n\n return methodsOrGetMethods\n })()\n\n return createServerRoute(undefined, {\n ...__opts,\n methods: methods as never,\n }) as never\n },\n update: (opts) =>\n createServerRoute(undefined, {\n ...options,\n ...opts,\n }),\n init: (opts: { originalIndex: number }): void => {\n options.originalIndex = opts.originalIndex\n\n const isRoot = !options.path && !options.id\n\n route.parentRoute = options.getParentRoute?.() as TParentRoute\n\n if (isRoot) {\n route.path = rootRouteId as TPath\n } else if (!(route.parentRoute as any)) {\n throw new Error(\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a ServerRoute instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPathLeft(path)\n }\n\n const customId = options.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n route.parentRoute.id === rootRouteId ? '' : route.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([route.parentRoute.fullPath, path])\n\n route.path = path as TPath\n route.id = id as TId\n route.fullPath = fullPath as TFullPath\n route.to = fullPath as TrimPathRight<TFullPath>\n route.isRoot = isRoot as any\n },\n\n _addFileChildren: (children) => {\n if (Array.isArray(children)) {\n route.children = children as TChildren\n }\n\n if (typeof children === 'object' && children !== null) {\n route.children = Object.values(children) as TChildren\n }\n\n return route\n },\n\n _addFileTypes: <TFileTypes>() => route,\n }\n\n return route\n}\n\n// TODO this needs to be restricted to only allow middleware, no methods\n// TODO we also need to restrict pathless server routes to only allow middleware\nexport const createServerRootRoute = createServerRoute\n\nexport type ServerRouteAddFileChildrenFn<\n in out TParentRoute extends AnyServerRouteWithTypes,\n in out TId extends RouteConstraints['TId'],\n in out TPath extends RouteConstraints['TPath'],\n in out TFullPath extends RouteConstraints['TFullPath'],\n in out TMiddlewares,\n in out TMethods,\n in out TChildren,\n> = (\n children: TChildren,\n) => ServerRouteWithTypes<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n TMiddlewares,\n TMethods,\n TChildren\n>\n\nconst createMethodBuilder = <\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n>(\n __opts?: ServerRouteMethodBuilderOptions<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n unknown,\n unknown\n >,\n): ServerRouteMethodBuilder<TParentRoute, TFullPath, TMiddlewares> => {\n return {\n _options: (__opts || {}) as never,\n _types: {} as never,\n middleware: (middlewares) =>\n createMethodBuilder({\n ...__opts,\n middlewares,\n }) as never,\n handler: (handler) =>\n createMethodBuilder({\n ...__opts,\n handler: handler as never,\n }) as never,\n }\n}\n\nexport interface ServerRouteMethodBuilderOptions<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n TMethodMiddlewares,\n TResponse,\n> {\n handler?: ServerRouteMethodHandlerFn<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares,\n TResponse\n >\n middlewares?: Constrain<\n TMethodMiddlewares,\n ReadonlyArray<AnyRequestMiddleware>\n >\n}\n\nexport type CreateServerFileRoute<\n TParentRoute extends AnyServerRouteWithTypes,\n TId extends RouteConstraints['TId'],\n TPath extends RouteConstraints['TPath'],\n TFullPath extends RouteConstraints['TFullPath'],\n TChildren,\n> = () => ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren>\n\nexport type AnyServerRouteWithTypes = ServerRouteWithTypes<\n any,\n any,\n any,\n any,\n any,\n any,\n any\n>\n\nexport interface ServerRouteWithTypes<\n TParentRoute extends AnyServerRouteWithTypes,\n TId extends RouteConstraints['TId'],\n TPath extends RouteConstraints['TPath'],\n TFullPath extends RouteConstraints['TFullPath'],\n TMiddlewares,\n TMethods,\n TChildren,\n> {\n _types: ServerRouteTypes<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n TMiddlewares,\n TMethods\n >\n isRoot: TParentRoute extends AnyServerRouteWithTypes ? true : false\n path: TPath\n id: TId\n fullPath: TFullPath\n to: TrimPathRight<TFullPath>\n parentRoute: TParentRoute\n children?: TChildren\n options: ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, TMiddlewares>\n update: (\n opts: ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, undefined>,\n ) => ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren>\n init: (opts: { originalIndex: number }) => void\n _addFileChildren: ServerRouteAddFileChildrenFn<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n TMiddlewares,\n TMethods,\n TChildren\n >\n _addFileTypes: () => ServerRouteWithTypes<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n TMiddlewares,\n TMethods,\n TChildren\n >\n}\n\nexport interface ServerRouteTypes<\n TParentRoute extends AnyServerRouteWithTypes,\n TId extends RouteConstraints['TId'],\n TPath extends RouteConstraints['TPath'],\n TFullPath extends RouteConstraints['TFullPath'],\n TMiddlewares,\n TMethods,\n> {\n isRoot: TParentRoute extends AnyServerRouteWithTypes ? true : false\n id: TId\n path: TPath\n fullPath: TFullPath\n middlewares: TMiddlewares\n methods: TMethods\n parentRoute: TParentRoute\n allContext: ResolveAllServerContext<TParentRoute, TMiddlewares>\n}\n\nexport type ResolveAllServerContext<\n TParentRoute extends AnyServerRouteWithTypes,\n TMiddlewares,\n> = unknown extends TParentRoute\n ? AssignAllServerContext<TMiddlewares>\n : Assign<\n TParentRoute['_types']['allContext'],\n AssignAllServerContext<TMiddlewares>\n >\n\nexport type AnyServerRoute = AnyServerRouteWithTypes\n\nexport interface ServerRoute<\n TParentRoute extends AnyServerRouteWithTypes,\n TId extends RouteConstraints['TId'],\n TPath extends RouteConstraints['TPath'],\n TFullPath extends RouteConstraints['TFullPath'],\n TChildren,\n> extends ServerRouteWithTypes<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n undefined,\n undefined,\n TChildren\n >,\n ServerRouteMiddleware<TParentRoute, TId, TPath, TFullPath, TChildren>,\n ServerRouteMethods<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n undefined,\n TChildren\n > {}\n\nexport interface ServerRouteMiddleware<\n TParentRoute extends AnyServerRouteWithTypes,\n TId extends RouteConstraints['TId'],\n TPath extends RouteConstraints['TPath'],\n TFullPath extends RouteConstraints['TFullPath'],\n TChildren,\n> {\n middleware: <const TNewMiddleware>(\n middleware: Constrain<TNewMiddleware, ReadonlyArray<AnyRequestMiddleware>>,\n ) => ServerRouteAfterMiddleware<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n TNewMiddleware,\n TChildren\n >\n}\n\nexport interface ServerRouteAfterMiddleware<\n TParentRoute extends AnyServerRouteWithTypes,\n TId extends RouteConstraints['TId'],\n TPath extends RouteConstraints['TPath'],\n TFullPath extends RouteConstraints['TFullPath'],\n TMiddlewares,\n TChildren,\n> extends ServerRouteWithTypes<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n TMiddlewares,\n undefined,\n TChildren\n >,\n ServerRouteMethods<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n TMiddlewares,\n TChildren\n > {}\n\nexport interface ServerRouteMethods<\n TParentRoute extends AnyServerRouteWithTypes,\n TId extends RouteConstraints['TId'],\n TPath extends RouteConstraints['TPath'],\n TFullPath extends RouteConstraints['TFullPath'],\n TMiddlewares,\n TChildren,\n> {\n methods: <const TMethods>(\n methodsOrGetMethods: Constrain<\n TMethods,\n ServerRouteMethodsOptions<TParentRoute, TFullPath, TMiddlewares>\n >,\n ) => ServerRouteAfterMethods<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n TMiddlewares,\n TMethods,\n TChildren\n >\n}\n\nexport type ServerRouteMethodsOptions<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n> =\n | ServerRouteMethodsRecord<TParentRoute, TFullPath, TMiddlewares>\n | ((\n api: ServerRouteMethodBuilder<TParentRoute, TFullPath, TMiddlewares>,\n ) => ServerRouteMethodsRecord<TParentRoute, TFullPath, TMiddlewares>)\n\nexport interface ServerRouteMethodsRecord<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n> {\n GET?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>\n POST?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>\n PUT?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>\n PATCH?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>\n DELETE?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>\n OPTIONS?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>\n HEAD?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>\n}\n\nexport type ServerRouteMethodRecordValue<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n> =\n | ServerRouteMethodHandlerFn<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n undefined,\n any\n >\n | AnyRouteMethodsBuilder\n\nexport type ServerRouteVerb = (typeof ServerRouteVerbs)[number]\n\nexport const ServerRouteVerbs = [\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n 'HEAD',\n] as const\n\nexport type ServerRouteMethodHandlerFn<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n TMethodMiddlewares,\n TResponse,\n> = (\n ctx: ServerRouteMethodHandlerCtx<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares\n >,\n) => TResponse | Promise<TResponse>\n\nexport interface ServerRouteMethodHandlerCtx<\n in out TParentRoute extends AnyServerRouteWithTypes,\n in out TFullPath extends string,\n in out TMiddlewares,\n in out TMethodMiddlewares,\n> {\n context: Expand<\n AssignAllMethodContext<TParentRoute, TMiddlewares, TMethodMiddlewares>\n >\n request: Request\n params: Expand<ResolveParams<TFullPath>>\n pathname: TFullPath\n}\n\nexport type MergeMethodMiddlewares<TMiddlewares, TMethodMiddlewares> =\n TMiddlewares extends ReadonlyArray<any>\n ? TMethodMiddlewares extends ReadonlyArray<any>\n ? readonly [...TMiddlewares, ...TMethodMiddlewares]\n : TMiddlewares\n : TMethodMiddlewares\n\nexport type AssignAllMethodContext<\n TParentRoute extends AnyServerRouteWithTypes,\n TMiddlewares,\n TMethodMiddlewares,\n> = ResolveAllServerContext<\n TParentRoute,\n MergeMethodMiddlewares<TMiddlewares, TMethodMiddlewares>\n>\n\nexport type AnyRouteMethodsBuilder = ServerRouteMethodBuilderWithTypes<\n any,\n any,\n any,\n any,\n any\n>\n\nexport interface ServerRouteMethodBuilder<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n> extends ServerRouteMethodBuilderWithTypes<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n undefined,\n undefined\n >,\n ServerRouteMethodBuilderMiddleware<TParentRoute, TFullPath, TMiddlewares>,\n ServerRouteMethodBuilderHandler<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n undefined\n > {}\n\nexport interface ServerRouteMethodBuilderWithTypes<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n TMethodMiddlewares,\n TResponse,\n> {\n _options: ServerRouteMethodBuilderOptions<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares,\n TResponse\n >\n _types: ServerRouteMethodBuilderTypes<\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares,\n TResponse\n >\n}\n\nexport interface ServerRouteMethodBuilderTypes<\n in out TFullPath extends string,\n in out TMiddlewares,\n in out TMethodMiddlewares,\n in out TResponse,\n> {\n middlewares: TMiddlewares\n methodMiddleware: TMethodMiddlewares\n fullPath: TFullPath\n response: TResponse\n}\n\nexport interface ServerRouteMethodBuilderMiddleware<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n> {\n middleware: <const TNewMethodMiddlewares>(\n middleware: Constrain<\n TNewMethodMiddlewares,\n ReadonlyArray<AnyRequestMiddleware>\n >,\n ) => ServerRouteMethodBuilderAfterMiddleware<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TNewMethodMiddlewares\n >\n}\n\nexport interface ServerRouteMethodBuilderAfterMiddleware<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n TMethodMiddlewares,\n> extends ServerRouteMethodBuilderWithTypes<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares,\n undefined\n >,\n ServerRouteMethodBuilderHandler<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares\n > {}\n\nexport interface ServerRouteMethodBuilderHandler<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n TMethodMiddlewares,\n> {\n handler: <TResponse>(\n handler: ServerRouteMethodHandlerFn<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares,\n TResponse\n >,\n ) => ServerRouteMethodBuilderAfterHandler<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares,\n TResponse\n >\n}\n\nexport interface ServerRouteMethodBuilderAfterHandler<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n TMethodMiddlewares,\n TResponse,\n> extends ServerRouteMethodBuilderWithTypes<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares,\n TResponse\n > {\n opts: ServerRouteMethod<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares\n >\n}\n\nexport interface ServerRouteMethod<\n TParentRoute extends AnyServerRouteWithTypes,\n TFullPath extends string,\n TMiddlewares,\n TMethodMiddlewares,\n> {\n middleware?: Constrain<TMiddlewares, Array<AnyRequestMiddleware>>\n handler?: ServerRouteMethodHandlerFn<\n TParentRoute,\n TFullPath,\n TMiddlewares,\n TMethodMiddlewares,\n undefined\n >\n}\n\nexport interface ServerRouteAfterMethods<\n TParentRoute extends AnyServerRouteWithTypes,\n TId extends RouteConstraints['TId'],\n TPath extends RouteConstraints['TPath'],\n TFullPath extends RouteConstraints['TFullPath'],\n TMiddlewares,\n TMethods,\n TChildren,\n> extends ServerRouteWithTypes<\n TParentRoute,\n TId,\n TPath,\n TFullPath,\n TMiddlewares,\n TMethods,\n TChildren\n > {\n options: ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, TMiddlewares>\n}\n"],"names":["rootRouteId","trimPathLeft","joinPaths"],"mappings":";;;AAcO,SAAS,sBAUd,GAA2E;AACpE,SAAA,kBAEP;AACF;AA4CgB,SAAA,kBAOd,IACA,QAG6D;AACvD,QAAA,UAAU,UAAU,CAAC;AAE3B,QAAM,QAAqE;AAAA,IACzE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,IAAI;AAAA,IACJ;AAAA,IAOA,aAAa;AAAA,IACb,QAAQ,CAAC;AAAA;AAAA,IAST,YAAY,CAAC,gBACX,kBAAkB,QAAW;AAAA,MAC3B,GAAG;AAAA,MACH,YAAY;AAAA,IAAA,CACb;AAAA,IACH,SAAS,CAAC,wBAAwB;AAChC,YAAM,WAAW,MAAM;AACjB,YAAA,OAAO,wBAAwB,YAAY;AACtC,iBAAA,oBAAoB,qBAAqB;AAAA,QAAA;AAG3C,eAAA;AAAA,MAAA,GACN;AAEH,aAAO,kBAAkB,QAAW;AAAA,QAClC,GAAG;AAAA,QACH;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,QAAQ,CAAC,SACP,kBAAkB,QAAW;AAAA,MAC3B,GAAG;AAAA,MACH,GAAG;AAAA,IAAA,CACJ;AAAA,IACH,MAAM,CAAC,SAA0C;;AAC/C,cAAQ,gBAAgB,KAAK;AAE7B,YAAM,SAAS,CAAC,QAAQ,QAAQ,CAAC,QAAQ;AAEnC,YAAA,eAAc,aAAQ,mBAAR;AAEpB,UAAI,QAAQ;AACV,cAAM,OAAOA,WAAA;AAAA,MAAA,WACJ,CAAE,MAAM,aAAqB;AACtC,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MAAA;AAGE,UAAA,OAA2B,SAASA,WAAA,cAAc,QAAQ;AAG1D,UAAA,QAAQ,SAAS,KAAK;AACxB,eAAOC,wBAAa,IAAI;AAAA,MAAA;AAGpB,YAAA,WAAW,QAAQ,MAAM;AAG3B,UAAA,KAAK,SACLD,WAAA,cACAE,qBAAU;AAAA,QACR,MAAM,YAAY,OAAOF,WAAAA,cAAc,KAAK,MAAM,YAAY;AAAA,QAC9D;AAAA,MAAA,CACD;AAEL,UAAI,SAASA,WAAAA,aAAa;AACjB,eAAA;AAAA,MAAA;AAGT,UAAI,OAAOA,WAAAA,aAAa;AACtB,aAAKE,WAAU,UAAA,CAAC,KAAK,EAAE,CAAC;AAAA,MAAA;AAGpB,YAAA,WACJ,OAAOF,WAAA,cAAc,MAAME,WAAAA,UAAU,CAAC,MAAM,YAAY,UAAU,IAAI,CAAC;AAEzE,YAAM,OAAO;AACb,YAAM,KAAK;AACX,YAAM,WAAW;AACjB,YAAM,KAAK;AACX,YAAM,SAAS;AAAA,IACjB;AAAA,IAEA,kBAAkB,CAAC,aAAa;AAC1B,UAAA,MAAM,QAAQ,QAAQ,GAAG;AAC3B,cAAM,WAAW;AAAA,MAAA;AAGnB,UAAI,OAAO,aAAa,YAAY,aAAa,MAAM;AAC/C,cAAA,WAAW,OAAO,OAAO,QAAQ;AAAA,MAAA;AAGlC,aAAA;AAAA,IACT;AAAA,IAEA,eAAe,MAAkB;AAAA,EACnC;AAEO,SAAA;AACT;AAIO,MAAM,wBAAwB;AAsBrC,MAAM,sBAAsB,CAK1B,WAOoE;AAC7D,SAAA;AAAA,IACL,UAAW,UAAU,CAAC;AAAA,IACtB,QAAQ,CAAC;AAAA,IACT,YAAY,CAAC,gBACX,oBAAoB;AAAA,MAClB,GAAG;AAAA,MACH;AAAA,IAAA,CACD;AAAA,IACH,SAAS,CAAC,YACR,oBAAoB;AAAA,MAClB,GAAG;AAAA,MACH;AAAA,IACD,CAAA;AAAA,EACL;AACF;;;;"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { Assign, Constrain, Expand, ResolveParams, RouteConstraints, TrimPathRight } from '@tanstack/router-core';
|
|
2
|
-
import { AnyRequestMiddleware, AssignAllServerContext } from '@tanstack/start-client-core';
|
|
3
|
-
export declare function createServerFileRoute<TFilePath extends keyof ServerFileRoutesByPath, TParentRoute extends AnyServerRouteWithTypes = ServerFileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = ServerFileRoutesByPath[TFilePath]['id'], TPath extends RouteConstraints['TPath'] = ServerFileRoutesByPath[TFilePath]['path'], TFullPath extends RouteConstraints['TFullPath'] = ServerFileRoutesByPath[TFilePath]['fullPath'], TChildren = ServerFileRoutesByPath[TFilePath]['children']>(_: TFilePath): ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren>;
|
|
4
|
-
export interface ServerFileRoutesByPath {
|
|
5
|
-
}
|
|
6
|
-
export interface ServerRouteOptions<TParentRoute extends AnyServerRouteWithTypes, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TMiddlewares> {
|
|
7
|
-
id: TId;
|
|
8
|
-
path: TPath;
|
|
9
|
-
pathname: TFullPath;
|
|
10
|
-
originalIndex: number;
|
|
11
|
-
getParentRoute?: () => TParentRoute;
|
|
12
|
-
middleware?: Constrain<TMiddlewares, ReadonlyArray<AnyRequestMiddleware>>;
|
|
13
|
-
methods?: Record<string, ServerRouteMethodHandlerFn<TParentRoute, TFullPath, TMiddlewares, any, any> | {
|
|
14
|
-
_options: ServerRouteMethodBuilderOptions<TParentRoute, TFullPath, TMiddlewares, unknown, unknown>;
|
|
15
|
-
}>;
|
|
16
|
-
caseSensitive?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export type ServerRouteManifest = {
|
|
19
|
-
middleware: boolean;
|
|
20
|
-
methods: Record<string, {
|
|
21
|
-
middleware: boolean;
|
|
22
|
-
}>;
|
|
23
|
-
};
|
|
24
|
-
export declare function createServerRoute<TParentRoute extends AnyServerRouteWithTypes, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TChildren>(__?: never, __opts?: Partial<ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, undefined>>): ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren>;
|
|
25
|
-
export declare const createServerRootRoute: typeof createServerRoute;
|
|
26
|
-
export type ServerRouteAddFileChildrenFn<in out TParentRoute extends AnyServerRouteWithTypes, in out TId extends RouteConstraints['TId'], in out TPath extends RouteConstraints['TPath'], in out TFullPath extends RouteConstraints['TFullPath'], in out TMiddlewares, in out TMethods, in out TChildren> = (children: TChildren) => ServerRouteWithTypes<TParentRoute, TId, TPath, TFullPath, TMiddlewares, TMethods, TChildren>;
|
|
27
|
-
export interface ServerRouteMethodBuilderOptions<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares, TMethodMiddlewares, TResponse> {
|
|
28
|
-
handler?: ServerRouteMethodHandlerFn<TParentRoute, TFullPath, TMiddlewares, TMethodMiddlewares, TResponse>;
|
|
29
|
-
middlewares?: Constrain<TMethodMiddlewares, ReadonlyArray<AnyRequestMiddleware>>;
|
|
30
|
-
}
|
|
31
|
-
export type CreateServerFileRoute<TParentRoute extends AnyServerRouteWithTypes, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TChildren> = () => ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren>;
|
|
32
|
-
export type AnyServerRouteWithTypes = ServerRouteWithTypes<any, any, any, any, any, any, any>;
|
|
33
|
-
export interface ServerRouteWithTypes<TParentRoute extends AnyServerRouteWithTypes, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TMiddlewares, TMethods, TChildren> {
|
|
34
|
-
_types: ServerRouteTypes<TParentRoute, TId, TPath, TFullPath, TMiddlewares, TMethods>;
|
|
35
|
-
isRoot: TParentRoute extends AnyServerRouteWithTypes ? true : false;
|
|
36
|
-
path: TPath;
|
|
37
|
-
id: TId;
|
|
38
|
-
fullPath: TFullPath;
|
|
39
|
-
to: TrimPathRight<TFullPath>;
|
|
40
|
-
parentRoute: TParentRoute;
|
|
41
|
-
children?: TChildren;
|
|
42
|
-
options: ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, TMiddlewares>;
|
|
43
|
-
update: (opts: ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, undefined>) => ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren>;
|
|
44
|
-
init: (opts: {
|
|
45
|
-
originalIndex: number;
|
|
46
|
-
}) => void;
|
|
47
|
-
_addFileChildren: ServerRouteAddFileChildrenFn<TParentRoute, TId, TPath, TFullPath, TMiddlewares, TMethods, TChildren>;
|
|
48
|
-
_addFileTypes: () => ServerRouteWithTypes<TParentRoute, TId, TPath, TFullPath, TMiddlewares, TMethods, TChildren>;
|
|
49
|
-
}
|
|
50
|
-
export interface ServerRouteTypes<TParentRoute extends AnyServerRouteWithTypes, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TMiddlewares, TMethods> {
|
|
51
|
-
isRoot: TParentRoute extends AnyServerRouteWithTypes ? true : false;
|
|
52
|
-
id: TId;
|
|
53
|
-
path: TPath;
|
|
54
|
-
fullPath: TFullPath;
|
|
55
|
-
middlewares: TMiddlewares;
|
|
56
|
-
methods: TMethods;
|
|
57
|
-
parentRoute: TParentRoute;
|
|
58
|
-
allContext: ResolveAllServerContext<TParentRoute, TMiddlewares>;
|
|
59
|
-
}
|
|
60
|
-
export type ResolveAllServerContext<TParentRoute extends AnyServerRouteWithTypes, TMiddlewares> = unknown extends TParentRoute ? AssignAllServerContext<TMiddlewares> : Assign<TParentRoute['_types']['allContext'], AssignAllServerContext<TMiddlewares>>;
|
|
61
|
-
export type AnyServerRoute = AnyServerRouteWithTypes;
|
|
62
|
-
export interface ServerRoute<TParentRoute extends AnyServerRouteWithTypes, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TChildren> extends ServerRouteWithTypes<TParentRoute, TId, TPath, TFullPath, undefined, undefined, TChildren>, ServerRouteMiddleware<TParentRoute, TId, TPath, TFullPath, TChildren>, ServerRouteMethods<TParentRoute, TId, TPath, TFullPath, undefined, TChildren> {
|
|
63
|
-
}
|
|
64
|
-
export interface ServerRouteMiddleware<TParentRoute extends AnyServerRouteWithTypes, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TChildren> {
|
|
65
|
-
middleware: <const TNewMiddleware>(middleware: Constrain<TNewMiddleware, ReadonlyArray<AnyRequestMiddleware>>) => ServerRouteAfterMiddleware<TParentRoute, TId, TPath, TFullPath, TNewMiddleware, TChildren>;
|
|
66
|
-
}
|
|
67
|
-
export interface ServerRouteAfterMiddleware<TParentRoute extends AnyServerRouteWithTypes, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TMiddlewares, TChildren> extends ServerRouteWithTypes<TParentRoute, TId, TPath, TFullPath, TMiddlewares, undefined, TChildren>, ServerRouteMethods<TParentRoute, TId, TPath, TFullPath, TMiddlewares, TChildren> {
|
|
68
|
-
}
|
|
69
|
-
export interface ServerRouteMethods<TParentRoute extends AnyServerRouteWithTypes, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TMiddlewares, TChildren> {
|
|
70
|
-
methods: <const TMethods>(methodsOrGetMethods: Constrain<TMethods, ServerRouteMethodsOptions<TParentRoute, TFullPath, TMiddlewares>>) => ServerRouteAfterMethods<TParentRoute, TId, TPath, TFullPath, TMiddlewares, TMethods, TChildren>;
|
|
71
|
-
}
|
|
72
|
-
export type ServerRouteMethodsOptions<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares> = ServerRouteMethodsRecord<TParentRoute, TFullPath, TMiddlewares> | ((api: ServerRouteMethodBuilder<TParentRoute, TFullPath, TMiddlewares>) => ServerRouteMethodsRecord<TParentRoute, TFullPath, TMiddlewares>);
|
|
73
|
-
export interface ServerRouteMethodsRecord<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares> {
|
|
74
|
-
GET?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>;
|
|
75
|
-
POST?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>;
|
|
76
|
-
PUT?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>;
|
|
77
|
-
PATCH?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>;
|
|
78
|
-
DELETE?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>;
|
|
79
|
-
OPTIONS?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>;
|
|
80
|
-
HEAD?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>;
|
|
81
|
-
}
|
|
82
|
-
export type ServerRouteMethodRecordValue<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares> = ServerRouteMethodHandlerFn<TParentRoute, TFullPath, TMiddlewares, undefined, any> | AnyRouteMethodsBuilder;
|
|
83
|
-
export type ServerRouteVerb = (typeof ServerRouteVerbs)[number];
|
|
84
|
-
export declare const ServerRouteVerbs: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
|
|
85
|
-
export type ServerRouteMethodHandlerFn<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares, TMethodMiddlewares, TResponse> = (ctx: ServerRouteMethodHandlerCtx<TParentRoute, TFullPath, TMiddlewares, TMethodMiddlewares>) => TResponse | Promise<TResponse>;
|
|
86
|
-
export interface ServerRouteMethodHandlerCtx<in out TParentRoute extends AnyServerRouteWithTypes, in out TFullPath extends string, in out TMiddlewares, in out TMethodMiddlewares> {
|
|
87
|
-
context: Expand<AssignAllMethodContext<TParentRoute, TMiddlewares, TMethodMiddlewares>>;
|
|
88
|
-
request: Request;
|
|
89
|
-
params: Expand<ResolveParams<TFullPath>>;
|
|
90
|
-
pathname: TFullPath;
|
|
91
|
-
}
|
|
92
|
-
export type MergeMethodMiddlewares<TMiddlewares, TMethodMiddlewares> = TMiddlewares extends ReadonlyArray<any> ? TMethodMiddlewares extends ReadonlyArray<any> ? readonly [...TMiddlewares, ...TMethodMiddlewares] : TMiddlewares : TMethodMiddlewares;
|
|
93
|
-
export type AssignAllMethodContext<TParentRoute extends AnyServerRouteWithTypes, TMiddlewares, TMethodMiddlewares> = ResolveAllServerContext<TParentRoute, MergeMethodMiddlewares<TMiddlewares, TMethodMiddlewares>>;
|
|
94
|
-
export type AnyRouteMethodsBuilder = ServerRouteMethodBuilderWithTypes<any, any, any, any, any>;
|
|
95
|
-
export interface ServerRouteMethodBuilder<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares> extends ServerRouteMethodBuilderWithTypes<TParentRoute, TFullPath, TMiddlewares, undefined, undefined>, ServerRouteMethodBuilderMiddleware<TParentRoute, TFullPath, TMiddlewares>, ServerRouteMethodBuilderHandler<TParentRoute, TFullPath, TMiddlewares, undefined> {
|
|
96
|
-
}
|
|
97
|
-
export interface ServerRouteMethodBuilderWithTypes<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares, TMethodMiddlewares, TResponse> {
|
|
98
|
-
_options: ServerRouteMethodBuilderOptions<TParentRoute, TFullPath, TMiddlewares, TMethodMiddlewares, TResponse>;
|
|
99
|
-
_types: ServerRouteMethodBuilderTypes<TFullPath, TMiddlewares, TMethodMiddlewares, TResponse>;
|
|
100
|
-
}
|
|
101
|
-
export interface ServerRouteMethodBuilderTypes<in out TFullPath extends string, in out TMiddlewares, in out TMethodMiddlewares, in out TResponse> {
|
|
102
|
-
middlewares: TMiddlewares;
|
|
103
|
-
methodMiddleware: TMethodMiddlewares;
|
|
104
|
-
fullPath: TFullPath;
|
|
105
|
-
response: TResponse;
|
|
106
|
-
}
|
|
107
|
-
export interface ServerRouteMethodBuilderMiddleware<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares> {
|
|
108
|
-
middleware: <const TNewMethodMiddlewares>(middleware: Constrain<TNewMethodMiddlewares, ReadonlyArray<AnyRequestMiddleware>>) => ServerRouteMethodBuilderAfterMiddleware<TParentRoute, TFullPath, TMiddlewares, TNewMethodMiddlewares>;
|
|
109
|
-
}
|
|
110
|
-
export interface ServerRouteMethodBuilderAfterMiddleware<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares, TMethodMiddlewares> extends ServerRouteMethodBuilderWithTypes<TParentRoute, TFullPath, TMiddlewares, TMethodMiddlewares, undefined>, ServerRouteMethodBuilderHandler<TParentRoute, TFullPath, TMiddlewares, TMethodMiddlewares> {
|
|
111
|
-
}
|
|
112
|
-
export interface ServerRouteMethodBuilderHandler<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares, TMethodMiddlewares> {
|
|
113
|
-
handler: <TResponse>(handler: ServerRouteMethodHandlerFn<TParentRoute, TFullPath, TMiddlewares, TMethodMiddlewares, TResponse>) => ServerRouteMethodBuilderAfterHandler<TParentRoute, TFullPath, TMiddlewares, TMethodMiddlewares, TResponse>;
|
|
114
|
-
}
|
|
115
|
-
export interface ServerRouteMethodBuilderAfterHandler<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares, TMethodMiddlewares, TResponse> extends ServerRouteMethodBuilderWithTypes<TParentRoute, TFullPath, TMiddlewares, TMethodMiddlewares, TResponse> {
|
|
116
|
-
opts: ServerRouteMethod<TParentRoute, TFullPath, TMiddlewares, TMethodMiddlewares>;
|
|
117
|
-
}
|
|
118
|
-
export interface ServerRouteMethod<TParentRoute extends AnyServerRouteWithTypes, TFullPath extends string, TMiddlewares, TMethodMiddlewares> {
|
|
119
|
-
middleware?: Constrain<TMiddlewares, Array<AnyRequestMiddleware>>;
|
|
120
|
-
handler?: ServerRouteMethodHandlerFn<TParentRoute, TFullPath, TMiddlewares, TMethodMiddlewares, undefined>;
|
|
121
|
-
}
|
|
122
|
-
export interface ServerRouteAfterMethods<TParentRoute extends AnyServerRouteWithTypes, TId extends RouteConstraints['TId'], TPath extends RouteConstraints['TPath'], TFullPath extends RouteConstraints['TFullPath'], TMiddlewares, TMethods, TChildren> extends ServerRouteWithTypes<TParentRoute, TId, TPath, TFullPath, TMiddlewares, TMethods, TChildren> {
|
|
123
|
-
options: ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, TMiddlewares>;
|
|
124
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const VIRTUAL_MODULES = {
|
|
4
|
-
routeTree: "tanstack-start-route-tree:v",
|
|
5
|
-
startManifest: "tanstack-start-manifest:v",
|
|
6
|
-
serverFnManifest: "tanstack-start-server-fn-manifest:v"
|
|
7
|
-
};
|
|
8
|
-
exports.VIRTUAL_MODULES = VIRTUAL_MODULES;
|
|
9
|
-
//# sourceMappingURL=virtual-modules.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-modules.cjs","sources":["../../src/virtual-modules.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/consistent-type-imports */\n\nexport const VIRTUAL_MODULES = {\n routeTree: 'tanstack-start-route-tree:v',\n startManifest: 'tanstack-start-manifest:v',\n serverFnManifest: 'tanstack-start-server-fn-manifest:v',\n} as const\n\nexport type VirtualModules = {\n [VIRTUAL_MODULES.routeTree]: typeof import('tanstack-start-route-tree:v')\n [VIRTUAL_MODULES.startManifest]: typeof import('tanstack-start-manifest:v')\n [VIRTUAL_MODULES.serverFnManifest]: typeof import('tanstack-start-server-fn-manifest:v')\n}\n"],"names":[],"mappings":";;AAEO,MAAM,kBAAkB;AAAA,EAC7B,WAAW;AAAA,EACX,eAAe;AAAA,EACf,kBAAkB;AACpB;;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const VIRTUAL_MODULES: {
|
|
2
|
-
readonly routeTree: "tanstack-start-route-tree:v";
|
|
3
|
-
readonly startManifest: "tanstack-start-manifest:v";
|
|
4
|
-
readonly serverFnManifest: "tanstack-start-server-fn-manifest:v";
|
|
5
|
-
};
|
|
6
|
-
export type VirtualModules = {
|
|
7
|
-
[VIRTUAL_MODULES.routeTree]: typeof import('tanstack-start-route-tree:v');
|
|
8
|
-
[VIRTUAL_MODULES.startManifest]: typeof import('tanstack-start-manifest:v');
|
|
9
|
-
[VIRTUAL_MODULES.serverFnManifest]: typeof import('tanstack-start-server-fn-manifest:v');
|
|
10
|
-
};
|
package/dist/esm/h3.d.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { H3Event, appendCorsHeaders as _appendCorsHeaders, appendCorsPreflightHeaders as _appendCorsPreflightHeaders, appendHeader as _appendHeader, appendResponseHeader as _appendResponseHeader, appendResponseHeaders as _appendResponseHeaders, assertMethod as _assertMethod, clearResponseHeaders as _clearResponseHeaders, clearSession as _clearSession, defaultContentType as _defaultContentType, deleteCookie as _deleteCookie, fetchWithEvent as _fetchWithEvent, getCookie as _getCookie, getProxyRequestHeaders as _getProxyRequestHeaders, getQuery as _getQuery, getRequestFingerprint as _getRequestFingerprint, getRequestHeader as _getRequestHeader, getRequestHeaders as _getRequestHeaders, getRequestHost as _getRequestHost, getRequestIP as _getRequestIP, getRequestProtocol as _getRequestProtocol, getRequestURL as _getRequestURL, getRequestWebStream as _getRequestWebStream, getResponseHeader as _getResponseHeader, getResponseHeaders as _getResponseHeaders, getResponseStatus as _getResponseStatus, getResponseStatusText as _getResponseStatusText, getRouterParam as _getRouterParam, getRouterParams as _getRouterParams, getSession as _getSession, getValidatedQuery as _getValidatedQuery, getValidatedRouterParams as _getValidatedRouterParams, handleCacheHeaders as _handleCacheHeaders, handleCors as _handleCors, isMethod as _isMethod, isPreflightRequest as _isPreflightRequest, parseCookies as _parseCookies, proxyRequest as _proxyRequest, readBody as _readBody, readFormData as _readFormData, readMultipartFormData as _readMultipartFormData, readRawBody as _readRawBody, readValidatedBody as _readValidatedBody, removeResponseHeader as _removeResponseHeader, sealSession as _sealSession, send as _send, sendError as _sendError, sendNoContent as _sendNoContent, sendProxy as _sendProxy, sendRedirect as _sendRedirect, sendStream as _sendStream, sendWebResponse as _sendWebResponse, setCookie as _setCookie, setHeader as _setHeader, setResponseHeader as _setResponseHeader, setResponseHeaders as _setResponseHeaders, setResponseStatus as _setResponseStatus, toWebRequest as _toWebRequest, unsealSession as _unsealSession, updateSession as _updateSession, useSession as _useSession, writeEarlyHints as _writeEarlyHints, Encoding, EventHandler, HTTPHeaderName, InferEventInput, _RequestMiddleware, _ResponseMiddleware } from 'h3';
|
|
2
|
-
declare function _setContext(event: H3Event, key: string, value: any): void;
|
|
3
|
-
declare function _getContext(event: H3Event, key: string): any;
|
|
4
|
-
export declare function defineMiddleware(options: {
|
|
5
|
-
onRequest?: _RequestMiddleware | Array<_RequestMiddleware>;
|
|
6
|
-
onBeforeResponse?: _ResponseMiddleware | Array<_ResponseMiddleware>;
|
|
7
|
-
}): {
|
|
8
|
-
onRequest?: _RequestMiddleware | Array<_RequestMiddleware>;
|
|
9
|
-
onBeforeResponse?: _ResponseMiddleware | Array<_ResponseMiddleware>;
|
|
10
|
-
};
|
|
11
|
-
export { H3Error, H3Event, MIMES, callNodeListener, createApp, createAppEventHandler, createEvent, createRouter, defineLazyEventHandler, defineNodeListener, defineNodeMiddleware, defineRequestMiddleware, defineResponseMiddleware, dynamicEventHandler, defineWebSocket, splitCookiesString, fromNodeMiddleware, fromPlainHandler, fromWebHandler, isError, isEventHandler, isWebResponse, lazyEventHandler, promisifyNodeListener, serveStatic, toEventHandler, toNodeListener, toPlainHandler, toWebHandler, toWebRequest, isCorsOriginAllowed, isStream, createError, sanitizeStatusCode, sanitizeStatusMessage, useBase, type AddRouteShortcuts, type App, type AppOptions, type AppUse, type CacheConditions, type CreateRouterOptions, type Duplex, type DynamicEventHandler, type Encoding, type EventHandler, type EventHandlerObject, type EventHandlerRequest, type EventHandlerResponse, type H3CorsOptions, type H3EventContext, type HTTPHeaderName, type HTTPMethod, type InferEventInput, type InputLayer, type InputStack, type Layer, type LazyEventHandler, type Matcher, type MultiPartData, type NodeEventContext, type NodeListener, type NodeMiddleware, type NodePromisifiedHandler, type PlainHandler, type PlainRequest, type PlainResponse, type ProxyOptions, type RequestFingerprintOptions, type RequestHeaders, type RouteNode, type Router, type RouterMethod, type RouterUse, type ServeStaticOptions, type Session, type SessionConfig, type SessionData, type Stack, type StaticAssetMeta, type ValidateFunction, type ValidateResult, type WebEventContext, type WebHandler, type _RequestMiddleware, type _ResponseMiddleware, } from 'h3';
|
|
12
|
-
export declare function defineEventHandler(handler: EventHandler): EventHandler<import('h3').EventHandlerRequest, Promise<any>>;
|
|
13
|
-
export declare function eventHandler(handler: EventHandler): EventHandler<import('h3').EventHandlerRequest, Promise<any>>;
|
|
14
|
-
export declare function runWithEvent<T>(event: H3Event, fn: () => T | Promise<T>): Promise<T>;
|
|
15
|
-
export declare function getEvent(): H3Event<import('h3').EventHandlerRequest>;
|
|
16
|
-
export declare const HTTPEventSymbol: unique symbol;
|
|
17
|
-
export declare function isEvent(obj: any): obj is H3Event | {
|
|
18
|
-
[HTTPEventSymbol]: H3Event;
|
|
19
|
-
};
|
|
20
|
-
type Tail<T> = T extends [any, ...infer U] ? U : never;
|
|
21
|
-
type PrependOverload<TOriginal extends (...args: Array<any>) => any, TOverload extends (...args: Array<any>) => any> = TOverload & TOriginal;
|
|
22
|
-
type WrapFunction<TFn extends (...args: Array<any>) => any> = PrependOverload<TFn, (...args: Parameters<TFn> extends [H3Event, ...infer TArgs] ? TArgs : Parameters<TFn>) => ReturnType<TFn>>;
|
|
23
|
-
type WrappedReadRawBody = <TEncoding extends Encoding = 'utf8'>(...args: Tail<Parameters<typeof _readRawBody<TEncoding>>>) => ReturnType<typeof _readRawBody<TEncoding>>;
|
|
24
|
-
export declare const readRawBody: PrependOverload<typeof _readRawBody, WrappedReadRawBody>;
|
|
25
|
-
type WrappedReadBody = <T, TEventInput = InferEventInput<'body', H3Event, T>>(...args: Tail<Parameters<typeof _readBody<T, H3Event, TEventInput>>>) => ReturnType<typeof _readBody<T, H3Event, TEventInput>>;
|
|
26
|
-
export declare const readBody: PrependOverload<typeof _readBody, WrappedReadBody>;
|
|
27
|
-
type WrappedGetQuery = <T, TEventInput = Exclude<InferEventInput<'query', H3Event, T>, undefined>>(...args: Tail<Parameters<typeof _getQuery<T, H3Event, TEventInput>>>) => ReturnType<typeof _getQuery<T, H3Event, TEventInput>>;
|
|
28
|
-
export declare const getQuery: PrependOverload<typeof _getQuery, WrappedGetQuery>;
|
|
29
|
-
export declare const isMethod: WrapFunction<typeof _isMethod>;
|
|
30
|
-
export declare const isPreflightRequest: WrapFunction<typeof _isPreflightRequest>;
|
|
31
|
-
type WrappedGetValidatedQuery = <T, TEventInput = InferEventInput<'query', H3Event, T>>(...args: Tail<Parameters<typeof _getValidatedQuery<T, H3Event, TEventInput>>>) => ReturnType<typeof _getValidatedQuery<T, H3Event, TEventInput>>;
|
|
32
|
-
export declare const getValidatedQuery: PrependOverload<typeof _getValidatedQuery, WrappedGetValidatedQuery>;
|
|
33
|
-
export declare const getRouterParams: WrapFunction<typeof _getRouterParams>;
|
|
34
|
-
export declare const getRouterParam: WrapFunction<typeof _getRouterParam>;
|
|
35
|
-
type WrappedGetValidatedRouterParams = <T, TEventInput = InferEventInput<'routerParams', H3Event, T>>(...args: Tail<Parameters<typeof _getValidatedRouterParams<T, H3Event, TEventInput>>>) => ReturnType<typeof _getValidatedRouterParams<T, H3Event, TEventInput>>;
|
|
36
|
-
export declare const getValidatedRouterParams: PrependOverload<typeof _getValidatedRouterParams, WrappedGetValidatedRouterParams>;
|
|
37
|
-
export declare const assertMethod: WrapFunction<typeof _assertMethod>;
|
|
38
|
-
export declare const getRequestHeaders: WrapFunction<typeof _getRequestHeaders>;
|
|
39
|
-
export declare const getRequestHeader: WrapFunction<typeof _getRequestHeader>;
|
|
40
|
-
export declare const getRequestURL: WrapFunction<typeof _getRequestURL>;
|
|
41
|
-
export declare const getRequestHost: WrapFunction<typeof _getRequestHost>;
|
|
42
|
-
export declare const getRequestProtocol: WrapFunction<typeof _getRequestProtocol>;
|
|
43
|
-
export declare const getRequestIP: WrapFunction<typeof _getRequestIP>;
|
|
44
|
-
export declare const send: WrapFunction<typeof _send>;
|
|
45
|
-
export declare const sendNoContent: WrapFunction<typeof _sendNoContent>;
|
|
46
|
-
export declare const setResponseStatus: WrapFunction<typeof _setResponseStatus>;
|
|
47
|
-
export declare const getResponseStatus: WrapFunction<typeof _getResponseStatus>;
|
|
48
|
-
export declare const getResponseStatusText: WrapFunction<typeof _getResponseStatusText>;
|
|
49
|
-
export declare const getResponseHeaders: WrapFunction<typeof _getResponseHeaders>;
|
|
50
|
-
export declare const getResponseHeader: WrapFunction<typeof _getResponseHeader>;
|
|
51
|
-
export declare const setResponseHeaders: WrapFunction<typeof _setResponseHeaders>;
|
|
52
|
-
type WrappedSetResponseHeader = <T extends HTTPHeaderName>(...args: Tail<Parameters<typeof _setResponseHeader<T>>>) => ReturnType<typeof _setResponseHeader<T>>;
|
|
53
|
-
export declare const setResponseHeader: PrependOverload<typeof _setResponseHeader, WrappedSetResponseHeader>;
|
|
54
|
-
export declare const appendResponseHeaders: WrapFunction<typeof _appendResponseHeaders>;
|
|
55
|
-
type WrappedAppendResponseHeader = <T extends HTTPHeaderName>(...args: Tail<Parameters<typeof _appendResponseHeader<T>>>) => ReturnType<typeof _appendResponseHeader<T>>;
|
|
56
|
-
export declare const appendResponseHeader: PrependOverload<typeof _appendResponseHeader, WrappedAppendResponseHeader>;
|
|
57
|
-
export declare const defaultContentType: WrapFunction<typeof _defaultContentType>;
|
|
58
|
-
export declare const sendRedirect: WrapFunction<typeof _sendRedirect>;
|
|
59
|
-
export declare const sendStream: WrapFunction<typeof _sendStream>;
|
|
60
|
-
export declare const writeEarlyHints: WrapFunction<typeof _writeEarlyHints>;
|
|
61
|
-
export declare const sendError: WrapFunction<typeof _sendError>;
|
|
62
|
-
export declare const sendProxy: WrapFunction<typeof _sendProxy>;
|
|
63
|
-
export declare const proxyRequest: WrapFunction<typeof _proxyRequest>;
|
|
64
|
-
type WrappedFetchWithEvent = <T = unknown, TResponse = any, TFetch extends (req: RequestInfo | URL, opts?: any) => any = typeof fetch>(...args: Tail<Parameters<typeof _fetchWithEvent<T, TResponse, TFetch>>>) => ReturnType<typeof _fetchWithEvent<T, TResponse, TFetch>>;
|
|
65
|
-
export declare const fetchWithEvent: PrependOverload<typeof _fetchWithEvent, WrappedFetchWithEvent>;
|
|
66
|
-
export declare const getProxyRequestHeaders: WrapFunction<typeof _getProxyRequestHeaders>;
|
|
67
|
-
export declare const parseCookies: WrapFunction<typeof _parseCookies>;
|
|
68
|
-
export declare const getCookie: WrapFunction<typeof _getCookie>;
|
|
69
|
-
export declare const setCookie: WrapFunction<typeof _setCookie>;
|
|
70
|
-
export declare const deleteCookie: WrapFunction<typeof _deleteCookie>;
|
|
71
|
-
type SessionDataT = Record<string, any>;
|
|
72
|
-
type WrappedUseSession = <T extends SessionDataT>(...args: Tail<Parameters<typeof _useSession<T>>>) => ReturnType<typeof _useSession<T>>;
|
|
73
|
-
export declare const useSession: PrependOverload<typeof _useSession, WrappedUseSession>;
|
|
74
|
-
type WrappedGetSession = <T extends SessionDataT>(...args: Tail<Parameters<typeof _getSession<T>>>) => ReturnType<typeof _getSession<T>>;
|
|
75
|
-
export declare const getSession: PrependOverload<typeof _getSession, WrappedGetSession>;
|
|
76
|
-
type WrappedUpdateSession = <T extends SessionDataT>(...args: Tail<Parameters<typeof _updateSession<T>>>) => ReturnType<typeof _updateSession<T>>;
|
|
77
|
-
export declare const updateSession: PrependOverload<typeof _updateSession, WrappedUpdateSession>;
|
|
78
|
-
type WrappedSealSession = <T extends SessionDataT>(...args: Tail<Parameters<typeof _sealSession<T>>>) => ReturnType<typeof _sealSession<T>>;
|
|
79
|
-
export declare const sealSession: PrependOverload<typeof _sealSession, WrappedSealSession>;
|
|
80
|
-
export declare const unsealSession: WrapFunction<typeof _unsealSession>;
|
|
81
|
-
export declare const clearSession: WrapFunction<typeof _clearSession>;
|
|
82
|
-
export declare const handleCacheHeaders: WrapFunction<typeof _handleCacheHeaders>;
|
|
83
|
-
export declare const handleCors: WrapFunction<typeof _handleCors>;
|
|
84
|
-
export declare const appendCorsHeaders: WrapFunction<typeof _appendCorsHeaders>;
|
|
85
|
-
export declare const appendCorsPreflightHeaders: WrapFunction<typeof _appendCorsPreflightHeaders>;
|
|
86
|
-
export declare const sendWebResponse: WrapFunction<typeof _sendWebResponse>;
|
|
87
|
-
type WrappedAppendHeader = <T extends HTTPHeaderName>(...args: Tail<Parameters<typeof _appendHeader<T>>>) => ReturnType<typeof _appendHeader<T>>;
|
|
88
|
-
export declare const appendHeader: PrependOverload<typeof _appendHeader, WrappedAppendHeader>;
|
|
89
|
-
export declare const appendHeaders: WrapFunction<typeof _appendResponseHeaders>;
|
|
90
|
-
type WrappedSetHeader = <T extends HTTPHeaderName>(...args: Tail<Parameters<typeof _setHeader<T>>>) => ReturnType<typeof _setHeader<T>>;
|
|
91
|
-
export declare const setHeader: PrependOverload<typeof _setHeader, WrappedSetHeader>;
|
|
92
|
-
export declare const setHeaders: WrapFunction<typeof _setResponseHeaders>;
|
|
93
|
-
export declare const getHeader: WrapFunction<typeof _getRequestHeader>;
|
|
94
|
-
export declare const getHeaders: WrapFunction<typeof _getRequestHeaders>;
|
|
95
|
-
export declare const getRequestFingerprint: WrapFunction<typeof _getRequestFingerprint>;
|
|
96
|
-
export declare const getRequestWebStream: WrapFunction<typeof _getRequestWebStream>;
|
|
97
|
-
export declare const readFormData: WrapFunction<typeof _readFormData>;
|
|
98
|
-
export declare const readMultipartFormData: WrapFunction<typeof _readMultipartFormData>;
|
|
99
|
-
type WrappedReadValidatedBody = <T, TEventInput = InferEventInput<'body', H3Event, T>>(...args: Tail<Parameters<typeof _readValidatedBody<T, H3Event, TEventInput>>>) => ReturnType<typeof _readValidatedBody<T, H3Event, TEventInput>>;
|
|
100
|
-
export declare const readValidatedBody: PrependOverload<typeof _readValidatedBody, WrappedReadValidatedBody>;
|
|
101
|
-
export declare const removeResponseHeader: WrapFunction<typeof _removeResponseHeader>;
|
|
102
|
-
export declare const getContext: WrapFunction<typeof _getContext>;
|
|
103
|
-
export declare const setContext: WrapFunction<typeof _setContext>;
|
|
104
|
-
export declare const clearResponseHeaders: WrapFunction<typeof _clearResponseHeaders>;
|
|
105
|
-
export declare const getWebRequest: WrapFunction<typeof _toWebRequest>;
|
|
106
|
-
export type RequestHandler = (ctx: {
|
|
107
|
-
request: Request;
|
|
108
|
-
}) => Promise<Response> | Response;
|
|
109
|
-
export declare function requestHandler(handler: RequestHandler): RequestHandler;
|