@lukoweb/apitogo 0.1.1 → 0.1.3
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/cli/cli.js +168 -57
- package/dist/declarations/lib/ui/Command.d.ts +1 -1
- package/dist/declarations/lib/util/MdxComponents.d.ts +1 -1
- package/package.json +2 -1
- package/src/app/main.tsx +150 -150
- package/src/config/loader.ts +245 -245
- package/src/index.ts +33 -33
- package/src/lib/authentication/components/CallbackHandler.tsx +45 -45
- package/src/lib/authentication/components/SignIn.tsx +46 -46
- package/src/lib/authentication/components/SignUp.tsx +48 -48
- package/src/lib/authentication/providers/clerk.tsx +224 -224
- package/src/lib/authentication/ui/AuthCard.tsx +7 -7
- package/src/lib/authentication/ui/EmailLinkCallbackUi.tsx +129 -125
- package/src/lib/authentication/ui/EmailLinkSentUi.tsx +105 -101
- package/src/lib/authentication/ui/EmailLinkSignInUi.tsx +100 -96
- package/src/lib/authentication/ui/EmailVerificationUi.tsx +128 -124
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +620 -616
- package/src/lib/components/AiAssistantMenuItems.tsx +102 -102
- package/src/lib/components/Autocomplete.tsx +123 -123
- package/src/lib/components/DeveloperHint.tsx +39 -35
- package/src/lib/components/Header.tsx +260 -260
- package/src/lib/components/Layout.tsx +53 -53
- package/src/lib/components/Main.tsx +51 -51
- package/src/lib/components/Mermaid.tsx +74 -70
- package/src/lib/components/MobileTopNavigation.tsx +276 -276
- package/src/lib/components/MultiSelect.tsx +86 -82
- package/src/lib/components/TopNavigation.tsx +103 -103
- package/src/lib/components/index.ts +26 -26
- package/src/lib/components/navigation/NavigationCategory.tsx +157 -157
- package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -35
- package/src/lib/components/navigation/NavigationItem.tsx +181 -177
- package/src/lib/core/RouteGuard.tsx +193 -193
- package/src/lib/errors/ErrorMessage.tsx +50 -46
- package/src/lib/plugins/api-catalog/Catalog.tsx +80 -80
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +128 -124
- package/src/lib/plugins/api-keys/CreateApiKeyDialog.tsx +49 -49
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +72 -72
- package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -342
- package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +127 -127
- package/src/lib/plugins/markdown/MdxPage.tsx +285 -285
- package/src/lib/plugins/openapi/ApiHeader.tsx +96 -96
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +88 -88
- package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +94 -94
- package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -52
- package/src/lib/plugins/openapi/OperationListItem.tsx +183 -183
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +63 -63
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +120 -117
- package/src/lib/plugins/openapi/SchemaInfo.tsx +344 -344
- package/src/lib/plugins/openapi/SchemaList.tsx +113 -113
- package/src/lib/plugins/openapi/Sidecar.tsx +312 -309
- package/src/lib/plugins/openapi/SidecarExamples.tsx +177 -174
- package/src/lib/plugins/openapi/components/EnumValues.tsx +58 -58
- package/src/lib/plugins/openapi/components/ResponseContent.tsx +117 -114
- package/src/lib/plugins/openapi/playground/BodyPanel.tsx +274 -271
- package/src/lib/plugins/openapi/playground/CollapsibleHeader.tsx +51 -51
- package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +60 -60
- package/src/lib/plugins/openapi/playground/Headers.tsx +188 -181
- package/src/lib/plugins/openapi/playground/IdentityDialog.tsx +75 -75
- package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +38 -38
- package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +45 -45
- package/src/lib/plugins/openapi/playground/Playground.tsx +602 -599
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +56 -56
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +151 -148
- package/src/lib/plugins/openapi/playground/RequestLoginDialog.tsx +70 -70
- package/src/lib/plugins/openapi/playground/request-panel/MultipartField.tsx +91 -91
- package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -50
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +355 -355
- package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +106 -102
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +189 -184
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +299 -299
- package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +162 -162
- package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +202 -202
- package/src/lib/plugins/search-pagefind/ResultList.tsx +122 -118
- package/src/lib/ui/ActionButton.tsx +21 -21
- package/src/lib/ui/Command.tsx +191 -191
- package/src/lib/util/MdxComponents.tsx +150 -150
- package/src/vite/config.ts +234 -231
- package/src/vite/dev-server.ts +291 -291
- package/src/vite/plugin-api-keys.ts +50 -50
- package/src/vite/plugin-api.ts +320 -318
- package/src/vite/plugin-auth.ts +38 -38
- package/src/vite/plugin-component.ts +45 -39
- package/src/vite/plugin-config.ts +75 -75
- package/src/vite/plugin-custom-pages.ts +36 -36
- package/src/vite/plugin-docs.ts +202 -202
- package/src/vite/plugin-markdown-export.ts +214 -214
- package/src/vite/plugin-mdx.ts +149 -149
- package/src/vite/plugin-navigation.ts +106 -106
- package/src/vite/plugin-search.ts +47 -47
- package/src/vite/plugin.ts +42 -42
- package/src/vite/prerender/prerender.ts +233 -233
package/src/app/main.tsx
CHANGED
|
@@ -1,150 +1,150 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import {
|
|
20
|
-
import type { ZudokuConfig } from "../config/config.js";
|
|
21
|
-
import { BuildCheck } from "../lib/components/BuildCheck.js";
|
|
22
|
-
import "./main.css";
|
|
23
|
-
import { Meta } from "../lib/components/Meta.js";
|
|
24
|
-
import "./polyfills.js";
|
|
25
|
-
import { StatusPage } from "../lib/components/StatusPage.js";
|
|
26
|
-
import { isNavigationPlugin } from "../lib/core/plugins.js";
|
|
27
|
-
import { RouteGuard } from "../lib/core/RouteGuard.js";
|
|
28
|
-
import type { ZudokuContextOptions } from "../lib/core/ZudokuContext.js";
|
|
29
|
-
import { RouterError } from "../lib/errors/RouterError.js";
|
|
30
|
-
import { ZuploEnv } from "./env.js";
|
|
31
|
-
import { processRoutes } from "./processRoutes.js";
|
|
32
|
-
import { createRedirectRoutes } from "./utils/createRedirectRoutes.js";
|
|
33
|
-
|
|
34
|
-
export const shikiReady: Promise<HighlighterCore> =
|
|
35
|
-
import("../lib/shiki.js").then(async ({ highlighterPromise }) => {
|
|
36
|
-
const highlighter = await highlighterPromise;
|
|
37
|
-
const { registerShiki } = await import("virtual:zudoku-shiki-register");
|
|
38
|
-
await registerShiki(highlighter);
|
|
39
|
-
return highlighter;
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export const convertZudokuConfigToOptions = (
|
|
43
|
-
config: ZudokuConfig,
|
|
44
|
-
): ZudokuContextOptions => {
|
|
45
|
-
return {
|
|
46
|
-
basePath: config.basePath,
|
|
47
|
-
canonicalUrlOrigin: config.canonicalUrlOrigin,
|
|
48
|
-
aiAssistants: config.aiAssistants,
|
|
49
|
-
protectedRoutes: config.protectedRoutes,
|
|
50
|
-
site: {
|
|
51
|
-
...config.site,
|
|
52
|
-
showPoweredBy:
|
|
53
|
-
ZuploEnv.buildConfig?.entitlements.devPortalZuploBranding ??
|
|
54
|
-
config.site?.showPoweredBy,
|
|
55
|
-
logo: config.site?.logo,
|
|
56
|
-
},
|
|
57
|
-
slots: config.slots,
|
|
58
|
-
metadata: {
|
|
59
|
-
favicon: "https://cdn.zudoku.dev/logos/favicon.svg",
|
|
60
|
-
title: "%s - Zudoku",
|
|
61
|
-
...config.metadata,
|
|
62
|
-
},
|
|
63
|
-
header: {
|
|
64
|
-
navigation: configuredHeaderNavigation,
|
|
65
|
-
placements: config.header?.placements,
|
|
66
|
-
},
|
|
67
|
-
navigation: configuredNavigation,
|
|
68
|
-
navigationRules: configuredNavigationRules,
|
|
69
|
-
mdx: config.mdx,
|
|
70
|
-
plugins: [
|
|
71
|
-
...(configuredAuthProvider ? [configuredAuthProvider] : []),
|
|
72
|
-
...(configuredDocsPlugin ? [configuredDocsPlugin] : []),
|
|
73
|
-
...configuredApiPlugins,
|
|
74
|
-
...(configuredSearchPlugin ? [configuredSearchPlugin] : []),
|
|
75
|
-
...(configuredApiKeysPlugin ? [configuredApiKeysPlugin] : []),
|
|
76
|
-
...(configuredCustomPagesPlugin ? [configuredCustomPagesPlugin] : []),
|
|
77
|
-
...configuredApiCatalogPlugins,
|
|
78
|
-
...(config.plugins ?? []),
|
|
79
|
-
],
|
|
80
|
-
syntaxHighlighting: {
|
|
81
|
-
highlighterPromise: shikiReady,
|
|
82
|
-
themes: config.syntaxHighlighting?.themes,
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export const getRoutesByOptions = (
|
|
88
|
-
options: ZudokuContextOptions,
|
|
89
|
-
enableStatusPages = true,
|
|
90
|
-
) => {
|
|
91
|
-
const allPlugins = [
|
|
92
|
-
...(options.plugins ?? []),
|
|
93
|
-
...(options.authentication ? [options.authentication] : []),
|
|
94
|
-
];
|
|
95
|
-
|
|
96
|
-
const routes = allPlugins
|
|
97
|
-
.flatMap((plugin) => (isNavigationPlugin(plugin) ? plugin.getRoutes() : []))
|
|
98
|
-
.concat(
|
|
99
|
-
enableStatusPages
|
|
100
|
-
? [400, 404, 500].map((statusCode) => ({
|
|
101
|
-
path: `/${statusCode}`,
|
|
102
|
-
element: <StatusPage statusCode={statusCode} />,
|
|
103
|
-
}))
|
|
104
|
-
: [],
|
|
105
|
-
)
|
|
106
|
-
.concat([{ path: "*", element: <StatusPage statusCode={404} /> }])
|
|
107
|
-
.map((route) => ({
|
|
108
|
-
...route,
|
|
109
|
-
errorElement: <RouterError className="w-full m-0" />,
|
|
110
|
-
}));
|
|
111
|
-
|
|
112
|
-
// @TODO Detect conflicts in routes and log warning
|
|
113
|
-
|
|
114
|
-
return routes;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export const getRoutesByConfig = (config: ZudokuConfig): RouteObject[] => {
|
|
118
|
-
const options = convertZudokuConfigToOptions(config);
|
|
119
|
-
const routes = getRoutesByOptions(
|
|
120
|
-
options,
|
|
121
|
-
import.meta.env.IS_ZUPLO || config.enableStatusPages,
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
return [
|
|
125
|
-
...createRedirectRoutes(config.redirects),
|
|
126
|
-
{
|
|
127
|
-
element: (
|
|
128
|
-
<Zudoku {...options} env={import.meta.env}>
|
|
129
|
-
<BuildCheck
|
|
130
|
-
buildId={import.meta.env.ZUPLO_BUILD_ID}
|
|
131
|
-
environmentType={import.meta.env.ZUPLO_ENVIRONMENT_TYPE}
|
|
132
|
-
/>
|
|
133
|
-
<Outlet />
|
|
134
|
-
</Zudoku>
|
|
135
|
-
),
|
|
136
|
-
hydrateFallbackElement: <div>Loading...</div>,
|
|
137
|
-
children: [
|
|
138
|
-
{
|
|
139
|
-
element: (
|
|
140
|
-
<Meta>
|
|
141
|
-
<RouteGuard />
|
|
142
|
-
</Meta>
|
|
143
|
-
),
|
|
144
|
-
errorElement: <RouterError />,
|
|
145
|
-
children: processRoutes(routes),
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
];
|
|
150
|
-
};
|
|
1
|
+
import { Zudoku } from "@lukoweb/apitogo/components";
|
|
2
|
+
import { Outlet } from "@lukoweb/apitogo/router";
|
|
3
|
+
import type { RouteObject } from "react-router";
|
|
4
|
+
import type { HighlighterCore } from "shiki";
|
|
5
|
+
import { configuredApiKeysPlugin } from "virtual:zudoku-api-keys-plugin";
|
|
6
|
+
import {
|
|
7
|
+
configuredApiCatalogPlugins,
|
|
8
|
+
configuredApiPlugins,
|
|
9
|
+
} from "virtual:zudoku-api-plugins";
|
|
10
|
+
import { configuredAuthProvider } from "virtual:zudoku-auth";
|
|
11
|
+
import { configuredCustomPagesPlugin } from "virtual:zudoku-custom-pages-plugin";
|
|
12
|
+
import { configuredDocsPlugin } from "virtual:zudoku-docs-plugin";
|
|
13
|
+
import "virtual:zudoku-theme.css";
|
|
14
|
+
import {
|
|
15
|
+
configuredHeaderNavigation,
|
|
16
|
+
configuredNavigation,
|
|
17
|
+
configuredNavigationRules,
|
|
18
|
+
} from "virtual:zudoku-navigation";
|
|
19
|
+
import { configuredSearchPlugin } from "virtual:zudoku-search-plugin";
|
|
20
|
+
import type { ZudokuConfig } from "../config/config.js";
|
|
21
|
+
import { BuildCheck } from "../lib/components/BuildCheck.js";
|
|
22
|
+
import "./main.css";
|
|
23
|
+
import { Meta } from "../lib/components/Meta.js";
|
|
24
|
+
import "./polyfills.js";
|
|
25
|
+
import { StatusPage } from "../lib/components/StatusPage.js";
|
|
26
|
+
import { isNavigationPlugin } from "../lib/core/plugins.js";
|
|
27
|
+
import { RouteGuard } from "../lib/core/RouteGuard.js";
|
|
28
|
+
import type { ZudokuContextOptions } from "../lib/core/ZudokuContext.js";
|
|
29
|
+
import { RouterError } from "../lib/errors/RouterError.js";
|
|
30
|
+
import { ZuploEnv } from "./env.js";
|
|
31
|
+
import { processRoutes } from "./processRoutes.js";
|
|
32
|
+
import { createRedirectRoutes } from "./utils/createRedirectRoutes.js";
|
|
33
|
+
|
|
34
|
+
export const shikiReady: Promise<HighlighterCore> =
|
|
35
|
+
import("../lib/shiki.js").then(async ({ highlighterPromise }) => {
|
|
36
|
+
const highlighter = await highlighterPromise;
|
|
37
|
+
const { registerShiki } = await import("virtual:zudoku-shiki-register");
|
|
38
|
+
await registerShiki(highlighter);
|
|
39
|
+
return highlighter;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const convertZudokuConfigToOptions = (
|
|
43
|
+
config: ZudokuConfig,
|
|
44
|
+
): ZudokuContextOptions => {
|
|
45
|
+
return {
|
|
46
|
+
basePath: config.basePath,
|
|
47
|
+
canonicalUrlOrigin: config.canonicalUrlOrigin,
|
|
48
|
+
aiAssistants: config.aiAssistants,
|
|
49
|
+
protectedRoutes: config.protectedRoutes,
|
|
50
|
+
site: {
|
|
51
|
+
...config.site,
|
|
52
|
+
showPoweredBy:
|
|
53
|
+
ZuploEnv.buildConfig?.entitlements.devPortalZuploBranding ??
|
|
54
|
+
config.site?.showPoweredBy,
|
|
55
|
+
logo: config.site?.logo,
|
|
56
|
+
},
|
|
57
|
+
slots: config.slots,
|
|
58
|
+
metadata: {
|
|
59
|
+
favicon: "https://cdn.zudoku.dev/logos/favicon.svg",
|
|
60
|
+
title: "%s - Zudoku",
|
|
61
|
+
...config.metadata,
|
|
62
|
+
},
|
|
63
|
+
header: {
|
|
64
|
+
navigation: configuredHeaderNavigation,
|
|
65
|
+
placements: config.header?.placements,
|
|
66
|
+
},
|
|
67
|
+
navigation: configuredNavigation,
|
|
68
|
+
navigationRules: configuredNavigationRules,
|
|
69
|
+
mdx: config.mdx,
|
|
70
|
+
plugins: [
|
|
71
|
+
...(configuredAuthProvider ? [configuredAuthProvider] : []),
|
|
72
|
+
...(configuredDocsPlugin ? [configuredDocsPlugin] : []),
|
|
73
|
+
...configuredApiPlugins,
|
|
74
|
+
...(configuredSearchPlugin ? [configuredSearchPlugin] : []),
|
|
75
|
+
...(configuredApiKeysPlugin ? [configuredApiKeysPlugin] : []),
|
|
76
|
+
...(configuredCustomPagesPlugin ? [configuredCustomPagesPlugin] : []),
|
|
77
|
+
...configuredApiCatalogPlugins,
|
|
78
|
+
...(config.plugins ?? []),
|
|
79
|
+
],
|
|
80
|
+
syntaxHighlighting: {
|
|
81
|
+
highlighterPromise: shikiReady,
|
|
82
|
+
themes: config.syntaxHighlighting?.themes,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const getRoutesByOptions = (
|
|
88
|
+
options: ZudokuContextOptions,
|
|
89
|
+
enableStatusPages = true,
|
|
90
|
+
) => {
|
|
91
|
+
const allPlugins = [
|
|
92
|
+
...(options.plugins ?? []),
|
|
93
|
+
...(options.authentication ? [options.authentication] : []),
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
const routes = allPlugins
|
|
97
|
+
.flatMap((plugin) => (isNavigationPlugin(plugin) ? plugin.getRoutes() : []))
|
|
98
|
+
.concat(
|
|
99
|
+
enableStatusPages
|
|
100
|
+
? [400, 404, 500].map((statusCode) => ({
|
|
101
|
+
path: `/${statusCode}`,
|
|
102
|
+
element: <StatusPage statusCode={statusCode} />,
|
|
103
|
+
}))
|
|
104
|
+
: [],
|
|
105
|
+
)
|
|
106
|
+
.concat([{ path: "*", element: <StatusPage statusCode={404} /> }])
|
|
107
|
+
.map((route) => ({
|
|
108
|
+
...route,
|
|
109
|
+
errorElement: <RouterError className="w-full m-0" />,
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
// @TODO Detect conflicts in routes and log warning
|
|
113
|
+
|
|
114
|
+
return routes;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const getRoutesByConfig = (config: ZudokuConfig): RouteObject[] => {
|
|
118
|
+
const options = convertZudokuConfigToOptions(config);
|
|
119
|
+
const routes = getRoutesByOptions(
|
|
120
|
+
options,
|
|
121
|
+
import.meta.env.IS_ZUPLO || config.enableStatusPages,
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
return [
|
|
125
|
+
...createRedirectRoutes(config.redirects),
|
|
126
|
+
{
|
|
127
|
+
element: (
|
|
128
|
+
<Zudoku {...options} env={import.meta.env}>
|
|
129
|
+
<BuildCheck
|
|
130
|
+
buildId={import.meta.env.ZUPLO_BUILD_ID}
|
|
131
|
+
environmentType={import.meta.env.ZUPLO_ENVIRONMENT_TYPE}
|
|
132
|
+
/>
|
|
133
|
+
<Outlet />
|
|
134
|
+
</Zudoku>
|
|
135
|
+
),
|
|
136
|
+
hydrateFallbackElement: <div>Loading...</div>,
|
|
137
|
+
children: [
|
|
138
|
+
{
|
|
139
|
+
element: (
|
|
140
|
+
<Meta>
|
|
141
|
+
<RouteGuard />
|
|
142
|
+
</Meta>
|
|
143
|
+
),
|
|
144
|
+
errorElement: <RouterError />,
|
|
145
|
+
children: processRoutes(routes),
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
];
|
|
150
|
+
};
|