fets 0.6.3 → 0.6.4-alpha-20231123161237-01c40a7

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.
@@ -4,12 +4,13 @@ exports.createRouter = exports.createRouterBase = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const DefaultFetchAPI = tslib_1.__importStar(require("@whatwg-node/fetch"));
6
6
  const server_1 = require("@whatwg-node/server");
7
+ const landing_page_js_1 = tslib_1.__importDefault(require("./landing-page.js"));
7
8
  const define_routes_js_1 = require("./plugins/define-routes.js");
8
9
  const openapi_js_1 = require("./plugins/openapi.js");
9
10
  const typebox_js_1 = require("./plugins/typebox.js");
10
11
  const utils_js_1 = require("./utils.js");
11
12
  const EMPTY_OBJECT = {};
12
- function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath = '/', plugins = [], swaggerUI, } = {}, openAPIDocument) {
13
+ function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath = '/', plugins = [], openAPI, swaggerUI, landingPage = true, } = {}, openAPIDocument) {
13
14
  const fetchAPI = {
14
15
  ...DefaultFetchAPI,
15
16
  ...givenFetchAPI,
@@ -30,16 +31,19 @@ function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath = '/', plugi
30
31
  }
31
32
  const routeByPatternByMethod = new Map();
32
33
  const routeByPathByMethod = new Map();
33
- function handleUnhandledRoute() {
34
- if (swaggerUI?.endpoint) {
35
- return new fetchAPI.Response(null, {
36
- status: 302,
34
+ function handleUnhandledRoute(requestPath) {
35
+ if (landingPage) {
36
+ return new fetchAPI.Response(landing_page_js_1.default
37
+ .replaceAll('__BASE_PATH__', basePath)
38
+ .replaceAll('__OAS_PATH__', openAPI?.endpoint || '/openapi.json')
39
+ .replaceAll('__SWAGGER_UI_PATH__', swaggerUI?.endpoint || '/docs')
40
+ .replaceAll('__REQUEST_PATH__', requestPath), {
37
41
  headers: {
38
- location: `${basePath}${swaggerUI.endpoint}`,
42
+ 'Content-Type': 'text/html',
39
43
  },
40
44
  });
41
45
  }
42
- return new fetchAPI.Response(null, { status: 404 });
46
+ return undefined;
43
47
  }
44
48
  return {
45
49
  openAPIDocument,
@@ -102,7 +106,7 @@ function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath = '/', plugi
102
106
  if (handlerResult) {
103
107
  return handlerResult;
104
108
  }
105
- return handleUnhandledRoute();
109
+ return handleUnhandledRoute(request.url);
106
110
  });
107
111
  }
108
112
  if (handlerResult$) {
@@ -159,14 +163,14 @@ function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath = '/', plugi
159
163
  if (patternHandlerResult) {
160
164
  return patternHandlerResult;
161
165
  }
162
- return handleUnhandledRoute();
166
+ return handleUnhandledRoute(request.url);
163
167
  });
164
168
  }
165
169
  if (patternHandlerResult$) {
166
170
  return patternHandlerResult$;
167
171
  }
168
172
  }
169
- return handleUnhandledRoute();
173
+ return handleUnhandledRoute(request.url);
170
174
  },
171
175
  route(route) {
172
176
  for (const onRouteHook of onRouteHooks) {
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = "<!doctype html><html lang=en><head><meta charset=utf-8><title>Welcome to feTS</title><base href=__BASE_PATH__><link rel=icon href=https://raw.githubusercontent.com/ardatan/feTS/main/website/public/favicon.ico><style>body,html{padding:0;margin:0;height:100%;font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Fira Sans','Droid Sans','Helvetica Neue',sans-serif;color:#fff;background-color:#000}main>section.hero{display:flex;height:90vh;justify-content:center;align-items:center;flex-direction:column}.logo{display:flex;align-items:center}.buttons{margin-top:24px}h1{font-size:80px}h2{color:#888;max-width:50%;margin-top:0;text-align:center}a{color:#fff;text-decoration:none;margin-left:10px;margin-right:10px;font-weight:700;transition:color .3s ease;padding:4px;overflow:visible}a.swagger-ui:hover{color:rgba(255,0,255,.7)}a.docs:hover{color:rgba(28,200,238,.7)}a.oas:hover{color:rgba(125,85,245,.7)}svg{margin-right:24px}.not-what-your-looking-for{margin-top:5vh}.not-what-your-looking-for>*{margin-left:auto;margin-right:auto}.not-what-your-looking-for>p{text-align:center}.not-what-your-looking-for>h2{color:#464646}.not-what-your-looking-for>p{max-width:600px;line-height:1.3em}.not-what-your-looking-for>pre{max-width:300px}</style></head><body id=body><main><section class=hero><div class=logo><div><svg height=150 viewBox=\"0 0 34 36\" fill=none xmlns=http://www.w3.org/2000/svg class=\"mr-1.5 h-9 w-9\"><g clip-path=url(#clip0_238_881)><path fill-rule=evenodd clip-rule=evenodd d=\"M7.29206 10.6399C9.07389 5.32261 14.0961 1.4912 20.0133 1.4912C27.4213 1.4912 33.4267 7.49658 33.4267 14.9046C33.4267 20.9724 29.3976 26.0992 23.8689 27.7556V31.8839C23.8689 33.3336 22.6937 34.5088 21.2441 34.5088H2.62488C1.1752 34.5088 0 33.3336 0 31.8839V13.2647C0 11.8151 1.1752 10.6399 2.62488 10.6399H7.29206ZM9.69332 10.6399C11.3687 6.59027 15.3582 3.7411 20.0133 3.7411C26.1787 3.7411 31.1768 8.73917 31.1768 14.9046C31.1768 19.7148 28.1344 23.8145 23.8689 25.3844V13.2647C23.8689 11.8151 22.6937 10.6399 21.2441 10.6399H9.69332ZM21.619 28.2229V31.8839C21.619 32.091 21.4511 32.2589 21.2441 32.2589H2.62488C2.41778 32.2589 2.24989 32.091 2.24989 31.8839V13.2647C2.24989 13.0577 2.41778 12.8898 2.62488 12.8898H6.75019C6.65118 13.547 6.59987 14.2198 6.59987 14.9046C6.59987 22.3126 12.6052 28.318 20.0133 28.318C20.5567 28.318 21.0925 28.2857 21.619 28.2229ZM20.283 16.3302L18.5198 14.9326L15.1078 19.237L12.9334 17.2179L11.4025 18.8667L14.4683 21.7134C14.6981 21.9268 15.0065 22.0346 15.3192 22.0108C15.6319 21.9869 15.9205 21.8336 16.1153 21.5879L20.283 16.3302Z\" fill=#1886FF></path></g><defs><clipPath id=clip0_238_881><rect width=33.4267 height=36 fill=white></rect></clipPath></defs></svg></div><h1>feTS</h1></div><h2>404 Not Found</h2><div class=buttons><a href=https://the-guild.dev/openapi/fets/server/quick-start class=docs target=_blank>Read the Docs</a> <a download=openapi.json href=__OAS_PATH__ class=oas>Download OpenAPI Spec </a><a href=__SWAGGER_UI_PATH__ class=swagger-ui>Visit Swagger UI</a></div></section><section class=not-what-your-looking-for><h2>Not the page you are looking for? 👀</h2><p>This page is shown be default whenever a 404 is hit.<br>You can disable this by behavior via the <code>landingPage</code> option.</p><pre>\n <code>\nimport { createRouter } from 'fets';\n\nconst router = createRouter({\n landingPage: false\n})\n </code>\n </pre><p>If you expected this page to be the Swagger UI route, you need to configure feTS. Currently, the Swagger UI route is configured to be on <code>__SWAGGER_UI_PATH__</code>.</p><pre>\n <code>\nimport { createRouter } from 'fets';\n\nconst router = createRouter({\n swaggerUI: {\n endpoint: '__REQUEST_PATH__'\n },\n})\n </code>\n </pre></section></main></body></html>";
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = "<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content=\"width=device-width,initial-scale=1\"><meta name=description content=SwaggerUI><title>SwaggerUI</title><style>@import url(https://cdn.jsdelivr.net/gh/Itz-fork/Fastapi-Swagger-UI-Dark/assets/swagger_ui_dark.min.css) (prefers-color-scheme: dark);@import url(https://unpkg.com/swagger-ui-dist/swagger-ui.css) (prefers-color-scheme: light);@media (prefers-color-scheme:dark){.swagger-ui textarea{background:hsl(358.8deg 1.05% 1.91% / 80%)!important}.swagger-ui .scheme-container{background:#1e1e2e}.swagger-ui select{background:rgba(0,0,0,.2)}.opblock-control-arrow{background:#000}.opblock-tag{border-bottom:1px solid #96ccff}.swagger-ui .responses-inner{display:flex;flex-direction:row;justify-content:space-around}.responses-table{flex:0.5}}</style></head><body><div id=swagger-ui></div><script src=https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js crossorigin></script><script>window.onload=()=>{window.ui=SwaggerUIBundle(__SWAGGER_UI_OPTIONS__)}</script></body></html>";
3
+ exports.default = "<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content=\"width=device-width,initial-scale=1\"><meta name=description content=SwaggerUI><title>SwaggerUI</title><style>@import url(https://cdn.jsdelivr.net/gh/Itz-fork/Fastapi-Swagger-UI-Dark/assets/swagger_ui_dark.min.css) (prefers-color-scheme: dark);@import url(https://unpkg.com/swagger-ui-dist/swagger-ui.css) (prefers-color-scheme: light);@media (prefers-color-scheme:dark){.swagger-ui textarea{background:hsl(358.8deg 1.05% 1.91% / 80%)!important}.swagger-ui .scheme-container{background:#1e1e2e}.swagger-ui select{background:rgba(0,0,0,.2)}.opblock-control-arrow{background:#000}.opblock-tag{border-bottom:1px solid #96ccff}.swagger-ui .opblock .opblock-summary-path{display:inline}.models-control{color:#f5f5f5!important}.model-title{color:#f8f8ff!important}}</style></head><body><div id=swagger-ui></div><script src=https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js crossorigin></script><script>window.onload=()=>{window.ui=SwaggerUIBundle(__SWAGGER_UI_OPTIONS__)}</script></body></html>";
@@ -1,11 +1,12 @@
1
1
  import * as DefaultFetchAPI from '@whatwg-node/fetch';
2
2
  import { createServerAdapter, isPromise, useErrorHandling } from '@whatwg-node/server';
3
+ import landingPageRaw from './landing-page.js';
3
4
  import { useDefineRoutes } from './plugins/define-routes.js';
4
5
  import { useOpenAPI } from './plugins/openapi.js';
5
6
  import { useTypeBox } from './plugins/typebox.js';
6
7
  import { asyncIterationUntilReturn } from './utils.js';
7
8
  const EMPTY_OBJECT = {};
8
- export function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath = '/', plugins = [], swaggerUI, } = {}, openAPIDocument) {
9
+ export function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath = '/', plugins = [], openAPI, swaggerUI, landingPage = true, } = {}, openAPIDocument) {
9
10
  const fetchAPI = {
10
11
  ...DefaultFetchAPI,
11
12
  ...givenFetchAPI,
@@ -26,16 +27,19 @@ export function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath = '/'
26
27
  }
27
28
  const routeByPatternByMethod = new Map();
28
29
  const routeByPathByMethod = new Map();
29
- function handleUnhandledRoute() {
30
- if (swaggerUI?.endpoint) {
31
- return new fetchAPI.Response(null, {
32
- status: 302,
30
+ function handleUnhandledRoute(requestPath) {
31
+ if (landingPage) {
32
+ return new fetchAPI.Response(landingPageRaw
33
+ .replaceAll('__BASE_PATH__', basePath)
34
+ .replaceAll('__OAS_PATH__', openAPI?.endpoint || '/openapi.json')
35
+ .replaceAll('__SWAGGER_UI_PATH__', swaggerUI?.endpoint || '/docs')
36
+ .replaceAll('__REQUEST_PATH__', requestPath), {
33
37
  headers: {
34
- location: `${basePath}${swaggerUI.endpoint}`,
38
+ 'Content-Type': 'text/html',
35
39
  },
36
40
  });
37
41
  }
38
- return new fetchAPI.Response(null, { status: 404 });
42
+ return undefined;
39
43
  }
40
44
  return {
41
45
  openAPIDocument,
@@ -98,7 +102,7 @@ export function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath = '/'
98
102
  if (handlerResult) {
99
103
  return handlerResult;
100
104
  }
101
- return handleUnhandledRoute();
105
+ return handleUnhandledRoute(request.url);
102
106
  });
103
107
  }
104
108
  if (handlerResult$) {
@@ -155,14 +159,14 @@ export function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath = '/'
155
159
  if (patternHandlerResult) {
156
160
  return patternHandlerResult;
157
161
  }
158
- return handleUnhandledRoute();
162
+ return handleUnhandledRoute(request.url);
159
163
  });
160
164
  }
161
165
  if (patternHandlerResult$) {
162
166
  return patternHandlerResult$;
163
167
  }
164
168
  }
165
- return handleUnhandledRoute();
169
+ return handleUnhandledRoute(request.url);
166
170
  },
167
171
  route(route) {
168
172
  for (const onRouteHook of onRouteHooks) {
@@ -0,0 +1 @@
1
+ export default "<!doctype html><html lang=en><head><meta charset=utf-8><title>Welcome to feTS</title><base href=__BASE_PATH__><link rel=icon href=https://raw.githubusercontent.com/ardatan/feTS/main/website/public/favicon.ico><style>body,html{padding:0;margin:0;height:100%;font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Fira Sans','Droid Sans','Helvetica Neue',sans-serif;color:#fff;background-color:#000}main>section.hero{display:flex;height:90vh;justify-content:center;align-items:center;flex-direction:column}.logo{display:flex;align-items:center}.buttons{margin-top:24px}h1{font-size:80px}h2{color:#888;max-width:50%;margin-top:0;text-align:center}a{color:#fff;text-decoration:none;margin-left:10px;margin-right:10px;font-weight:700;transition:color .3s ease;padding:4px;overflow:visible}a.swagger-ui:hover{color:rgba(255,0,255,.7)}a.docs:hover{color:rgba(28,200,238,.7)}a.oas:hover{color:rgba(125,85,245,.7)}svg{margin-right:24px}.not-what-your-looking-for{margin-top:5vh}.not-what-your-looking-for>*{margin-left:auto;margin-right:auto}.not-what-your-looking-for>p{text-align:center}.not-what-your-looking-for>h2{color:#464646}.not-what-your-looking-for>p{max-width:600px;line-height:1.3em}.not-what-your-looking-for>pre{max-width:300px}</style></head><body id=body><main><section class=hero><div class=logo><div><svg height=150 viewBox=\"0 0 34 36\" fill=none xmlns=http://www.w3.org/2000/svg class=\"mr-1.5 h-9 w-9\"><g clip-path=url(#clip0_238_881)><path fill-rule=evenodd clip-rule=evenodd d=\"M7.29206 10.6399C9.07389 5.32261 14.0961 1.4912 20.0133 1.4912C27.4213 1.4912 33.4267 7.49658 33.4267 14.9046C33.4267 20.9724 29.3976 26.0992 23.8689 27.7556V31.8839C23.8689 33.3336 22.6937 34.5088 21.2441 34.5088H2.62488C1.1752 34.5088 0 33.3336 0 31.8839V13.2647C0 11.8151 1.1752 10.6399 2.62488 10.6399H7.29206ZM9.69332 10.6399C11.3687 6.59027 15.3582 3.7411 20.0133 3.7411C26.1787 3.7411 31.1768 8.73917 31.1768 14.9046C31.1768 19.7148 28.1344 23.8145 23.8689 25.3844V13.2647C23.8689 11.8151 22.6937 10.6399 21.2441 10.6399H9.69332ZM21.619 28.2229V31.8839C21.619 32.091 21.4511 32.2589 21.2441 32.2589H2.62488C2.41778 32.2589 2.24989 32.091 2.24989 31.8839V13.2647C2.24989 13.0577 2.41778 12.8898 2.62488 12.8898H6.75019C6.65118 13.547 6.59987 14.2198 6.59987 14.9046C6.59987 22.3126 12.6052 28.318 20.0133 28.318C20.5567 28.318 21.0925 28.2857 21.619 28.2229ZM20.283 16.3302L18.5198 14.9326L15.1078 19.237L12.9334 17.2179L11.4025 18.8667L14.4683 21.7134C14.6981 21.9268 15.0065 22.0346 15.3192 22.0108C15.6319 21.9869 15.9205 21.8336 16.1153 21.5879L20.283 16.3302Z\" fill=#1886FF></path></g><defs><clipPath id=clip0_238_881><rect width=33.4267 height=36 fill=white></rect></clipPath></defs></svg></div><h1>feTS</h1></div><h2>404 Not Found</h2><div class=buttons><a href=https://the-guild.dev/openapi/fets/server/quick-start class=docs target=_blank>Read the Docs</a> <a download=openapi.json href=__OAS_PATH__ class=oas>Download OpenAPI Spec </a><a href=__SWAGGER_UI_PATH__ class=swagger-ui>Visit Swagger UI</a></div></section><section class=not-what-your-looking-for><h2>Not the page you are looking for? 👀</h2><p>This page is shown be default whenever a 404 is hit.<br>You can disable this by behavior via the <code>landingPage</code> option.</p><pre>\n <code>\nimport { createRouter } from 'fets';\n\nconst router = createRouter({\n landingPage: false\n})\n </code>\n </pre><p>If you expected this page to be the Swagger UI route, you need to configure feTS. Currently, the Swagger UI route is configured to be on <code>__SWAGGER_UI_PATH__</code>.</p><pre>\n <code>\nimport { createRouter } from 'fets';\n\nconst router = createRouter({\n swaggerUI: {\n endpoint: '__REQUEST_PATH__'\n },\n})\n </code>\n </pre></section></main></body></html>";
@@ -1 +1 @@
1
- export default "<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content=\"width=device-width,initial-scale=1\"><meta name=description content=SwaggerUI><title>SwaggerUI</title><style>@import url(https://cdn.jsdelivr.net/gh/Itz-fork/Fastapi-Swagger-UI-Dark/assets/swagger_ui_dark.min.css) (prefers-color-scheme: dark);@import url(https://unpkg.com/swagger-ui-dist/swagger-ui.css) (prefers-color-scheme: light);@media (prefers-color-scheme:dark){.swagger-ui textarea{background:hsl(358.8deg 1.05% 1.91% / 80%)!important}.swagger-ui .scheme-container{background:#1e1e2e}.swagger-ui select{background:rgba(0,0,0,.2)}.opblock-control-arrow{background:#000}.opblock-tag{border-bottom:1px solid #96ccff}.swagger-ui .responses-inner{display:flex;flex-direction:row;justify-content:space-around}.responses-table{flex:0.5}}</style></head><body><div id=swagger-ui></div><script src=https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js crossorigin></script><script>window.onload=()=>{window.ui=SwaggerUIBundle(__SWAGGER_UI_OPTIONS__)}</script></body></html>";
1
+ export default "<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content=\"width=device-width,initial-scale=1\"><meta name=description content=SwaggerUI><title>SwaggerUI</title><style>@import url(https://cdn.jsdelivr.net/gh/Itz-fork/Fastapi-Swagger-UI-Dark/assets/swagger_ui_dark.min.css) (prefers-color-scheme: dark);@import url(https://unpkg.com/swagger-ui-dist/swagger-ui.css) (prefers-color-scheme: light);@media (prefers-color-scheme:dark){.swagger-ui textarea{background:hsl(358.8deg 1.05% 1.91% / 80%)!important}.swagger-ui .scheme-container{background:#1e1e2e}.swagger-ui select{background:rgba(0,0,0,.2)}.opblock-control-arrow{background:#000}.opblock-tag{border-bottom:1px solid #96ccff}.swagger-ui .opblock .opblock-summary-path{display:inline}.models-control{color:#f5f5f5!important}.model-title{color:#f8f8ff!important}}</style></head><body><div id=swagger-ui></div><script src=https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js crossorigin></script><script>window.onload=()=>{window.ui=SwaggerUIBundle(__SWAGGER_UI_OPTIONS__)}</script></body></html>";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fets",
3
- "version": "0.6.3",
3
+ "version": "0.6.4-alpha-20231123161237-01c40a7",
4
4
  "description": "TypeScript HTTP Framework focusing on e2e type-safety, easy setup, performance & great developer experience",
5
5
  "sideEffects": false,
6
6
  "dependencies": {
@@ -1,6 +1,6 @@
1
1
  import { TypedRequest, TypedResponse } from './typed-fetch.cjs';
2
2
  import type { OpenAPIDocument, Router, RouterBaseObject, RouterComponentsBase, RouterOptions, RouterSDK } from './types.cjs';
3
- export declare function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath, plugins, swaggerUI, }: RouterOptions<any, any> | undefined, openAPIDocument: OpenAPIDocument): RouterBaseObject<any, any, any>;
3
+ export declare function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath, plugins, openAPI, swaggerUI, landingPage, }: RouterOptions<any, any> | undefined, openAPIDocument: OpenAPIDocument): RouterBaseObject<any, any, any>;
4
4
  export declare function createRouter<TServerContext, TComponents extends RouterComponentsBase = {}, TRouterSDK extends RouterSDK<string, TypedRequest, TypedResponse> = {
5
5
  [TKey: string]: never;
6
6
  }>(options?: RouterOptions<TServerContext, TComponents>): Router<TServerContext, TComponents, TRouterSDK>;
@@ -1,6 +1,6 @@
1
1
  import { TypedRequest, TypedResponse } from './typed-fetch.js';
2
2
  import type { OpenAPIDocument, Router, RouterBaseObject, RouterComponentsBase, RouterOptions, RouterSDK } from './types.js';
3
- export declare function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath, plugins, swaggerUI, }: RouterOptions<any, any> | undefined, openAPIDocument: OpenAPIDocument): RouterBaseObject<any, any, any>;
3
+ export declare function createRouterBase({ fetchAPI: givenFetchAPI, base: basePath, plugins, openAPI, swaggerUI, landingPage, }: RouterOptions<any, any> | undefined, openAPIDocument: OpenAPIDocument): RouterBaseObject<any, any, any>;
4
4
  export declare function createRouter<TServerContext, TComponents extends RouterComponentsBase = {}, TRouterSDK extends RouterSDK<string, TypedRequest, TypedResponse> = {
5
5
  [TKey: string]: never;
6
6
  }>(options?: RouterOptions<TServerContext, TComponents>): Router<TServerContext, TComponents, TRouterSDK>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="@whatwg-node/fetch" />
1
2
  export * from './types.cjs';
2
3
  export * from './createRouter.cjs';
3
4
  export { URLPattern } from '@whatwg-node/fetch';
@@ -1,3 +1,4 @@
1
+ /// <reference types="@whatwg-node/fetch" />
1
2
  export * from './types.js';
2
3
  export * from './createRouter.js';
3
4
  export { URLPattern } from '@whatwg-node/fetch';
@@ -0,0 +1,2 @@
1
+ declare const _default: "<!doctype html><html lang=en><head><meta charset=utf-8><title>Welcome to feTS</title><base href=__BASE_PATH__><link rel=icon href=https://raw.githubusercontent.com/ardatan/feTS/main/website/public/favicon.ico><style>body,html{padding:0;margin:0;height:100%;font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Fira Sans','Droid Sans','Helvetica Neue',sans-serif;color:#fff;background-color:#000}main>section.hero{display:flex;height:90vh;justify-content:center;align-items:center;flex-direction:column}.logo{display:flex;align-items:center}.buttons{margin-top:24px}h1{font-size:80px}h2{color:#888;max-width:50%;margin-top:0;text-align:center}a{color:#fff;text-decoration:none;margin-left:10px;margin-right:10px;font-weight:700;transition:color .3s ease;padding:4px;overflow:visible}a.swagger-ui:hover{color:rgba(255,0,255,.7)}a.docs:hover{color:rgba(28,200,238,.7)}a.oas:hover{color:rgba(125,85,245,.7)}svg{margin-right:24px}.not-what-your-looking-for{margin-top:5vh}.not-what-your-looking-for>*{margin-left:auto;margin-right:auto}.not-what-your-looking-for>p{text-align:center}.not-what-your-looking-for>h2{color:#464646}.not-what-your-looking-for>p{max-width:600px;line-height:1.3em}.not-what-your-looking-for>pre{max-width:300px}</style></head><body id=body><main><section class=hero><div class=logo><div><svg height=150 viewBox=\"0 0 34 36\" fill=none xmlns=http://www.w3.org/2000/svg class=\"mr-1.5 h-9 w-9\"><g clip-path=url(#clip0_238_881)><path fill-rule=evenodd clip-rule=evenodd d=\"M7.29206 10.6399C9.07389 5.32261 14.0961 1.4912 20.0133 1.4912C27.4213 1.4912 33.4267 7.49658 33.4267 14.9046C33.4267 20.9724 29.3976 26.0992 23.8689 27.7556V31.8839C23.8689 33.3336 22.6937 34.5088 21.2441 34.5088H2.62488C1.1752 34.5088 0 33.3336 0 31.8839V13.2647C0 11.8151 1.1752 10.6399 2.62488 10.6399H7.29206ZM9.69332 10.6399C11.3687 6.59027 15.3582 3.7411 20.0133 3.7411C26.1787 3.7411 31.1768 8.73917 31.1768 14.9046C31.1768 19.7148 28.1344 23.8145 23.8689 25.3844V13.2647C23.8689 11.8151 22.6937 10.6399 21.2441 10.6399H9.69332ZM21.619 28.2229V31.8839C21.619 32.091 21.4511 32.2589 21.2441 32.2589H2.62488C2.41778 32.2589 2.24989 32.091 2.24989 31.8839V13.2647C2.24989 13.0577 2.41778 12.8898 2.62488 12.8898H6.75019C6.65118 13.547 6.59987 14.2198 6.59987 14.9046C6.59987 22.3126 12.6052 28.318 20.0133 28.318C20.5567 28.318 21.0925 28.2857 21.619 28.2229ZM20.283 16.3302L18.5198 14.9326L15.1078 19.237L12.9334 17.2179L11.4025 18.8667L14.4683 21.7134C14.6981 21.9268 15.0065 22.0346 15.3192 22.0108C15.6319 21.9869 15.9205 21.8336 16.1153 21.5879L20.283 16.3302Z\" fill=#1886FF></path></g><defs><clipPath id=clip0_238_881><rect width=33.4267 height=36 fill=white></rect></clipPath></defs></svg></div><h1>feTS</h1></div><h2>404 Not Found</h2><div class=buttons><a href=https://the-guild.dev/openapi/fets/server/quick-start class=docs target=_blank>Read the Docs</a> <a download=openapi.json href=__OAS_PATH__ class=oas>Download OpenAPI Spec </a><a href=__SWAGGER_UI_PATH__ class=swagger-ui>Visit Swagger UI</a></div></section><section class=not-what-your-looking-for><h2>Not the page you are looking for? 👀</h2><p>This page is shown be default whenever a 404 is hit.<br>You can disable this by behavior via the <code>landingPage</code> option.</p><pre>\n <code>\nimport { createRouter } from 'fets';\n\nconst router = createRouter({\n landingPage: false\n})\n </code>\n </pre><p>If you expected this page to be the Swagger UI route, you need to configure feTS. Currently, the Swagger UI route is configured to be on <code>__SWAGGER_UI_PATH__</code>.</p><pre>\n <code>\nimport { createRouter } from 'fets';\n\nconst router = createRouter({\n swaggerUI: {\n endpoint: '__REQUEST_PATH__'\n },\n})\n </code>\n </pre></section></main></body></html>";
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: "<!doctype html><html lang=en><head><meta charset=utf-8><title>Welcome to feTS</title><base href=__BASE_PATH__><link rel=icon href=https://raw.githubusercontent.com/ardatan/feTS/main/website/public/favicon.ico><style>body,html{padding:0;margin:0;height:100%;font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Fira Sans','Droid Sans','Helvetica Neue',sans-serif;color:#fff;background-color:#000}main>section.hero{display:flex;height:90vh;justify-content:center;align-items:center;flex-direction:column}.logo{display:flex;align-items:center}.buttons{margin-top:24px}h1{font-size:80px}h2{color:#888;max-width:50%;margin-top:0;text-align:center}a{color:#fff;text-decoration:none;margin-left:10px;margin-right:10px;font-weight:700;transition:color .3s ease;padding:4px;overflow:visible}a.swagger-ui:hover{color:rgba(255,0,255,.7)}a.docs:hover{color:rgba(28,200,238,.7)}a.oas:hover{color:rgba(125,85,245,.7)}svg{margin-right:24px}.not-what-your-looking-for{margin-top:5vh}.not-what-your-looking-for>*{margin-left:auto;margin-right:auto}.not-what-your-looking-for>p{text-align:center}.not-what-your-looking-for>h2{color:#464646}.not-what-your-looking-for>p{max-width:600px;line-height:1.3em}.not-what-your-looking-for>pre{max-width:300px}</style></head><body id=body><main><section class=hero><div class=logo><div><svg height=150 viewBox=\"0 0 34 36\" fill=none xmlns=http://www.w3.org/2000/svg class=\"mr-1.5 h-9 w-9\"><g clip-path=url(#clip0_238_881)><path fill-rule=evenodd clip-rule=evenodd d=\"M7.29206 10.6399C9.07389 5.32261 14.0961 1.4912 20.0133 1.4912C27.4213 1.4912 33.4267 7.49658 33.4267 14.9046C33.4267 20.9724 29.3976 26.0992 23.8689 27.7556V31.8839C23.8689 33.3336 22.6937 34.5088 21.2441 34.5088H2.62488C1.1752 34.5088 0 33.3336 0 31.8839V13.2647C0 11.8151 1.1752 10.6399 2.62488 10.6399H7.29206ZM9.69332 10.6399C11.3687 6.59027 15.3582 3.7411 20.0133 3.7411C26.1787 3.7411 31.1768 8.73917 31.1768 14.9046C31.1768 19.7148 28.1344 23.8145 23.8689 25.3844V13.2647C23.8689 11.8151 22.6937 10.6399 21.2441 10.6399H9.69332ZM21.619 28.2229V31.8839C21.619 32.091 21.4511 32.2589 21.2441 32.2589H2.62488C2.41778 32.2589 2.24989 32.091 2.24989 31.8839V13.2647C2.24989 13.0577 2.41778 12.8898 2.62488 12.8898H6.75019C6.65118 13.547 6.59987 14.2198 6.59987 14.9046C6.59987 22.3126 12.6052 28.318 20.0133 28.318C20.5567 28.318 21.0925 28.2857 21.619 28.2229ZM20.283 16.3302L18.5198 14.9326L15.1078 19.237L12.9334 17.2179L11.4025 18.8667L14.4683 21.7134C14.6981 21.9268 15.0065 22.0346 15.3192 22.0108C15.6319 21.9869 15.9205 21.8336 16.1153 21.5879L20.283 16.3302Z\" fill=#1886FF></path></g><defs><clipPath id=clip0_238_881><rect width=33.4267 height=36 fill=white></rect></clipPath></defs></svg></div><h1>feTS</h1></div><h2>404 Not Found</h2><div class=buttons><a href=https://the-guild.dev/openapi/fets/server/quick-start class=docs target=_blank>Read the Docs</a> <a download=openapi.json href=__OAS_PATH__ class=oas>Download OpenAPI Spec </a><a href=__SWAGGER_UI_PATH__ class=swagger-ui>Visit Swagger UI</a></div></section><section class=not-what-your-looking-for><h2>Not the page you are looking for? 👀</h2><p>This page is shown be default whenever a 404 is hit.<br>You can disable this by behavior via the <code>landingPage</code> option.</p><pre>\n <code>\nimport { createRouter } from 'fets';\n\nconst router = createRouter({\n landingPage: false\n})\n </code>\n </pre><p>If you expected this page to be the Swagger UI route, you need to configure feTS. Currently, the Swagger UI route is configured to be on <code>__SWAGGER_UI_PATH__</code>.</p><pre>\n <code>\nimport { createRouter } from 'fets';\n\nconst router = createRouter({\n swaggerUI: {\n endpoint: '__REQUEST_PATH__'\n },\n})\n </code>\n </pre></section></main></body></html>";
2
+ export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: "<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content=\"width=device-width,initial-scale=1\"><meta name=description content=SwaggerUI><title>SwaggerUI</title><style>@import url(https://cdn.jsdelivr.net/gh/Itz-fork/Fastapi-Swagger-UI-Dark/assets/swagger_ui_dark.min.css) (prefers-color-scheme: dark);@import url(https://unpkg.com/swagger-ui-dist/swagger-ui.css) (prefers-color-scheme: light);@media (prefers-color-scheme:dark){.swagger-ui textarea{background:hsl(358.8deg 1.05% 1.91% / 80%)!important}.swagger-ui .scheme-container{background:#1e1e2e}.swagger-ui select{background:rgba(0,0,0,.2)}.opblock-control-arrow{background:#000}.opblock-tag{border-bottom:1px solid #96ccff}.swagger-ui .responses-inner{display:flex;flex-direction:row;justify-content:space-around}.responses-table{flex:0.5}}</style></head><body><div id=swagger-ui></div><script src=https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js crossorigin></script><script>window.onload=()=>{window.ui=SwaggerUIBundle(__SWAGGER_UI_OPTIONS__)}</script></body></html>";
1
+ declare const _default: "<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content=\"width=device-width,initial-scale=1\"><meta name=description content=SwaggerUI><title>SwaggerUI</title><style>@import url(https://cdn.jsdelivr.net/gh/Itz-fork/Fastapi-Swagger-UI-Dark/assets/swagger_ui_dark.min.css) (prefers-color-scheme: dark);@import url(https://unpkg.com/swagger-ui-dist/swagger-ui.css) (prefers-color-scheme: light);@media (prefers-color-scheme:dark){.swagger-ui textarea{background:hsl(358.8deg 1.05% 1.91% / 80%)!important}.swagger-ui .scheme-container{background:#1e1e2e}.swagger-ui select{background:rgba(0,0,0,.2)}.opblock-control-arrow{background:#000}.opblock-tag{border-bottom:1px solid #96ccff}.swagger-ui .opblock .opblock-summary-path{display:inline}.models-control{color:#f5f5f5!important}.model-title{color:#f8f8ff!important}}</style></head><body><div id=swagger-ui></div><script src=https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js crossorigin></script><script>window.onload=()=>{window.ui=SwaggerUIBundle(__SWAGGER_UI_OPTIONS__)}</script></body></html>";
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: "<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content=\"width=device-width,initial-scale=1\"><meta name=description content=SwaggerUI><title>SwaggerUI</title><style>@import url(https://cdn.jsdelivr.net/gh/Itz-fork/Fastapi-Swagger-UI-Dark/assets/swagger_ui_dark.min.css) (prefers-color-scheme: dark);@import url(https://unpkg.com/swagger-ui-dist/swagger-ui.css) (prefers-color-scheme: light);@media (prefers-color-scheme:dark){.swagger-ui textarea{background:hsl(358.8deg 1.05% 1.91% / 80%)!important}.swagger-ui .scheme-container{background:#1e1e2e}.swagger-ui select{background:rgba(0,0,0,.2)}.opblock-control-arrow{background:#000}.opblock-tag{border-bottom:1px solid #96ccff}.swagger-ui .responses-inner{display:flex;flex-direction:row;justify-content:space-around}.responses-table{flex:0.5}}</style></head><body><div id=swagger-ui></div><script src=https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js crossorigin></script><script>window.onload=()=>{window.ui=SwaggerUIBundle(__SWAGGER_UI_OPTIONS__)}</script></body></html>";
1
+ declare const _default: "<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content=\"width=device-width,initial-scale=1\"><meta name=description content=SwaggerUI><title>SwaggerUI</title><style>@import url(https://cdn.jsdelivr.net/gh/Itz-fork/Fastapi-Swagger-UI-Dark/assets/swagger_ui_dark.min.css) (prefers-color-scheme: dark);@import url(https://unpkg.com/swagger-ui-dist/swagger-ui.css) (prefers-color-scheme: light);@media (prefers-color-scheme:dark){.swagger-ui textarea{background:hsl(358.8deg 1.05% 1.91% / 80%)!important}.swagger-ui .scheme-container{background:#1e1e2e}.swagger-ui select{background:rgba(0,0,0,.2)}.opblock-control-arrow{background:#000}.opblock-tag{border-bottom:1px solid #96ccff}.swagger-ui .opblock .opblock-summary-path{display:inline}.models-control{color:#f5f5f5!important}.model-title{color:#f8f8ff!important}}</style></head><body><div id=swagger-ui></div><script src=https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js crossorigin></script><script>window.onload=()=>{window.ui=SwaggerUIBundle(__SWAGGER_UI_OPTIONS__)}</script></body></html>";
2
2
  export default _default;
@@ -74,6 +74,7 @@ export interface RouterOptions<TServerContext, TComponents extends RouterCompone
74
74
  plugins?: RouterPlugin<TServerContext, TComponents>[];
75
75
  openAPI?: RouterOpenAPIOptions<TComponents>;
76
76
  swaggerUI?: RouterSwaggerUIOptions;
77
+ landingPage?: boolean;
77
78
  onError?: ErrorHandler<TServerContext>;
78
79
  }
79
80
  export type RouterComponentsBase = {
@@ -74,6 +74,7 @@ export interface RouterOptions<TServerContext, TComponents extends RouterCompone
74
74
  plugins?: RouterPlugin<TServerContext, TComponents>[];
75
75
  openAPI?: RouterOpenAPIOptions<TComponents>;
76
76
  swaggerUI?: RouterSwaggerUIOptions;
77
+ landingPage?: boolean;
77
78
  onError?: ErrorHandler<TServerContext>;
78
79
  }
79
80
  export type RouterComponentsBase = {