@lukoweb/apitogo 0.2.54 → 0.2.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/cli/cli.js +2196 -1352
  2. package/dist/declarations/cli/platform/client/platform-api.d.ts +29 -0
  3. package/dist/declarations/cli/platform/helpers/platform-plan-catalog.d.ts +6 -0
  4. package/dist/declarations/config/validators/ZudokuConfig.d.ts +2 -0
  5. package/dist/declarations/lib/authentication/providers/openid.d.ts +2 -1
  6. package/dist/declarations/lib/plugins/markdown/index.d.ts +2 -1
  7. package/dist/flat-config.d.ts +1 -0
  8. package/docs/cli/commands.md +50 -32
  9. package/docs/cli/go-live.md +66 -93
  10. package/docs/cli/overview.md +18 -17
  11. package/docs/cli/setup.md +130 -141
  12. package/docs/cli/shape.md +94 -11
  13. package/docs/cli/walkthrough.md +1 -1
  14. package/docs/components/slot.mdx +116 -119
  15. package/docs/configuration/api-reference.md +98 -397
  16. package/docs/configuration/authentication.md +118 -159
  17. package/docs/configuration/footer.mdx +89 -118
  18. package/docs/configuration/make-config.mdx +2 -2
  19. package/docs/configuration/overview.md +97 -166
  20. package/docs/configuration/plans.md +100 -110
  21. package/docs/configuration/portal.md +116 -0
  22. package/docs/customization/colors-theme.mdx +255 -278
  23. package/docs/customization/fonts.md +105 -110
  24. package/docs/customization/landing-page.md +189 -188
  25. package/docs/deploy/apitogo.md +13 -17
  26. package/docs/deployment.md +15 -9
  27. package/docs/guides/stripe-setup.mdx +123 -0
  28. package/docs/markdown/frontmatter.md +172 -173
  29. package/docs/mcp/go-live.md +100 -100
  30. package/docs/mcp/overview.md +76 -76
  31. package/docs/quickstart.md +88 -72
  32. package/docs/writing.mdx +68 -72
  33. package/package.json +1 -1
  34. package/src/config/v2/docs-navigation.ts +7 -2
  35. package/src/config/v2/index.ts +1 -0
  36. package/src/config/v2/resolve.ts +28 -0
  37. package/src/config/v2/rules.ts +32 -1
  38. package/src/config/v2/schema.ts +9 -0
  39. package/src/config/v2/services.ts +90 -15
  40. package/src/config/v2/starter-landing.ts +41 -0
  41. package/src/config/v2/wrapper.ts +141 -7
  42. package/src/config/validators/ZudokuConfig.ts +794 -792
  43. package/src/lib/authentication/providers/openid.tsx +6 -1
  44. package/src/lib/plugins/markdown/index.tsx +86 -82
  45. package/src/vite/dev-server.ts +9 -1
  46. package/src/vite/dev-ssr-config.ts +32 -0
  47. package/src/vite/plugin-config.ts +4 -2
  48. package/src/vite/plugin-docs.ts +213 -205
  49. package/docs/concepts/auth-provider-api-identities.md +0 -105
  50. package/docs/configuration/ai-assistants.md +0 -65
  51. package/docs/configuration/api-catalog.md +0 -109
  52. package/docs/configuration/authentication-auth0.md +0 -181
  53. package/docs/configuration/authentication-azure-ad.md +0 -245
  54. package/docs/configuration/authentication-clerk.md +0 -117
  55. package/docs/configuration/authentication-firebase.md +0 -69
  56. package/docs/configuration/authentication-pingfederate.md +0 -143
  57. package/docs/configuration/authentication-supabase.md +0 -233
  58. package/docs/configuration/build-configuration.mdx +0 -147
  59. package/docs/configuration/docs.md +0 -282
  60. package/docs/configuration/llms.md +0 -90
  61. package/docs/configuration/manifest.md +0 -129
  62. package/docs/configuration/navigation.mdx +0 -415
  63. package/docs/configuration/protected-routes.md +0 -150
  64. package/docs/configuration/search.md +0 -164
  65. package/docs/configuration/sentry.mdx +0 -44
  66. package/docs/configuration/site.md +0 -124
  67. package/docs/configuration/slots.mdx +0 -125
  68. package/docs/configuration/vite-config.md +0 -18
  69. package/docs/custom-plugins.md +0 -285
  70. package/docs/deploy/apache-nginx.md +0 -41
  71. package/docs/deploy/cloudflare-pages.md +0 -74
  72. package/docs/deploy/direct-upload.md +0 -17
  73. package/docs/deploy/github-pages.md +0 -49
  74. package/docs/deploy/vercel.md +0 -101
  75. package/docs/extending/events.md +0 -124
  76. package/docs/guides/environment-variables.md +0 -94
  77. package/docs/guides/managing-api-keys-and-identities.md +0 -89
  78. package/docs/guides/navigation-rules.mdx +0 -203
  79. package/docs/guides/processors.mdx +0 -234
  80. package/docs/guides/transforming-examples.md +0 -156
  81. package/docs/guides/using-multiple-apis.md +0 -87
  82. package/docs/plugins.md +0 -24
@@ -1,415 +0,0 @@
1
- ---
2
- title: Navigation
3
- sidebar_icon: compass
4
- description:
5
- Learn how to configure the navigation in APIToGo, including links, categories, documents, and
6
- custom pages. Understand the structure of the navigation array and how to use icons, labels, and
7
- paths.
8
- ---
9
-
10
- import { Book, Code, FileText } from "@lukoweb/apitogo/icons";
11
-
12
- APIToGo uses a single `navigation` array to control both the top navigation tabs and the sidebar.
13
- Items at the root of this array appear as tabs, and nested items build the sidebar tree. Navigation
14
- entries can be links, document references, categories or custom pages.
15
-
16
- ## Basic configuration
17
-
18
- The navigation is defined using the `navigation` array in the APIToGo config file. Each item can be
19
- one of several types. At the simplest level you may only have links and categories.
20
-
21
- ```tsx title="config"
22
- {
23
- "navigation": [
24
- {
25
- "type": "category",
26
- "label": "Documentation",
27
- "icon": "book",
28
- "items": [
29
- {
30
- "type": "doc",
31
- "file": "documentation/introduction",
32
- "label": "Introduction",
33
- "icon": "file-text"
34
- },
35
- {
36
- "type": "doc",
37
- "file": "documentation/getting-started",
38
- "path": "/docs/quick-start",
39
- "label": "Quick Start"
40
- }
41
- ]
42
- },
43
- {
44
- "type": "link",
45
- "to": "/api",
46
- "label": "API Reference",
47
- "icon": "code",
48
- "description": "Complete API documentation",
49
- "badge": {
50
- "label": "v2.0",
51
- "color": "blue"
52
- },
53
- "display": "always"
54
- }
55
- ]
56
- }
57
- ```
58
-
59
- ## Generate navigation automatically
60
-
61
- In a config version 2 project, the portal builds the sidebar from the pages under
62
- `apitogo/portal/pages/`: the index page first, then the other pages by name, then one section per
63
- folder. There is no `navigation` key to maintain. Add a page with **`npx apitogo config`** (see
64
- **[Make config (CLI)](./make-config.mdx)**) or by creating the `.md`, `.mdx` or `.tsx` (React) file.
65
-
66
- ## Navigation Items
67
-
68
- Navigation items can be of these types: `category`, `doc`, `link`, or `custom-page`.
69
-
70
- - `link`: A direct link to a page or external URL.
71
- - `category`: A group of links that can be expanded or collapsed.
72
- - `doc`: A reference to a document by it's file path: `file`.
73
- - `custom-pages`: A custom page that is made of a React component, see
74
- [Custom Pages](../guides/custom-pages.md)
75
-
76
- ### `type: link`
77
-
78
- `link` is the most basic item, it directly links to a path or URL. Use this for external resources
79
- or standalone pages.
80
-
81
- ```json
82
- {
83
- "type": "link",
84
- "label": "Support",
85
- "to": "/my/api" // or: https://example.com/my-external-link
86
- }
87
- ```
88
-
89
- <details>
90
- <summary>**TypeScript type declaration**</summary>
91
- ```ts
92
- type NavigationLink = {
93
- type: "link";
94
- to: string;
95
- label: string;
96
- icon?: string; // Lucide icon name
97
- description?: string;
98
- badge?: {
99
- label: string;
100
- color: "green" | "blue" | "yellow" | "red" | "purple" | "indigo" | "gray" | "outline";
101
- };
102
- display?:
103
- | "auth"
104
- | "anon"
105
- | "always"
106
- | "hide"
107
- | ((params: { context: ApitogoContext; auth: UseAuthReturn }) => boolean);
108
- target?: "_self" | "_blank";
109
- };
110
- ```
111
- </details>
112
-
113
- ### `type: category`
114
-
115
- The `category` type groups related items under a collapsible section. The `label` is the displayed
116
- text, and the `items` array contains `id`s of documents, links, or other categories.
117
-
118
- ```json
119
- {
120
- "type": "category",
121
- "label": "Getting Started",
122
- "collapsible": true, // optional
123
- "collapsed": false, // optional
124
- "items": [
125
- {
126
- "type": "link",
127
- "label": "Support",
128
- "to": "https://support.example.com"
129
- }
130
- ]
131
- }
132
- ```
133
-
134
- <details>
135
- <summary>**TypeScript type declaration**</summary>
136
-
137
- ```ts
138
- type NavigationCategory = {
139
- type: "category";
140
- icon?: string; // Lucide icon name
141
- items: Array<NavigationDoc | NavigationLink | NavigationCategory | NavigationCustomPage>;
142
- label: string;
143
- collapsible?: boolean;
144
- collapsed?: boolean;
145
- link?: string | { type: "doc"; file: string; label?: string };
146
- display?:
147
- | "auth"
148
- | "anon"
149
- | "always"
150
- | "hide"
151
- | ((params: { context: ApitogoContext; auth: UseAuthReturn }) => boolean);
152
- };
153
- ```
154
-
155
- </details>
156
-
157
- ### `type: doc`
158
-
159
- Doc is used to reference markdown files. The `label` is the text that will be displayed, and the
160
- `file` is the file path associated with a markdown file.
161
-
162
- ```json
163
- {
164
- "type": "doc",
165
- "label": "Overview",
166
- "file": "docs/overview"
167
- }
168
- ```
169
-
170
- <details>
171
- <summary>**TypeScript type declaration**</summary>
172
-
173
- ```ts
174
- type NavigationDoc = {
175
- type: "doc";
176
- file: string;
177
- path?: string;
178
- icon?: string;
179
- label?: string;
180
- badge?: {
181
- label: string;
182
- color: "green" | "blue" | "yellow" | "red" | "purple" | "indigo" | "gray" | "outline";
183
- };
184
- display?:
185
- | "auth"
186
- | "anon"
187
- | "always"
188
- | "hide"
189
- | ((params: { context: ApitogoContext; auth: UseAuthReturn }) => boolean);
190
- };
191
- ```
192
-
193
- </details>
194
-
195
- #### Using shorthands
196
-
197
- Documents can be referenced as strings (using their file path), which is equivalent to
198
- `{ "type": "doc", "file": "path" }`:
199
-
200
- ```json
201
- {
202
- "navigation": [
203
- {
204
- "type": "category",
205
- "label": "Documentation",
206
- "icon": "book",
207
- "items": [
208
- "documentation/introduction",
209
- "documentation/getting-started",
210
- "documentation/installation"
211
- ]
212
- },
213
- {
214
- "type": "link",
215
- "to": "/api",
216
- "label": "API Reference",
217
- "icon": "code"
218
- }
219
- ]
220
- }
221
- ```
222
-
223
- This is much more concise when you don't need custom labels, icons, or other properties for
224
- individual documents.
225
-
226
- Learn more in the [Markdown documentation](/docs/markdown/overview)
227
-
228
- #### Custom paths
229
-
230
- The `path` property allows you to customize the URL path for a document. By default, APIToGo uses
231
- the file path to generate the URL, but you can override this behavior by specifying a custom path.
232
-
233
- ### `type: custom-page`
234
-
235
- Custom pages allow you to create standalone pages that are not tied to a Markdown document. This is
236
- useful for creating landing pages, dashboards, or any other custom content.
237
-
238
- ```tsx
239
- {
240
- type: "custom-page",
241
- path: "/a-custom-page",
242
- element: <MyCustomPage />,
243
- display: "always"
244
- }
245
- ```
246
-
247
- <details>
248
- <summary>**TypeScript type declaration**</summary>
249
-
250
- ```ts
251
- type NavigationCustomPage = {
252
- type: "custom-page";
253
- path: string;
254
- label?: string;
255
- element: any;
256
- icon?: string; // Lucide icon name
257
- badge?: {
258
- label: string;
259
- color: "green" | "blue" | "yellow" | "red" | "purple" | "indigo" | "gray" | "outline";
260
- invert?: boolean;
261
- };
262
- display?:
263
- | "auth"
264
- | "anon"
265
- | "always"
266
- | "hide"
267
- | ((params: { context: ApitogoContext; auth: UseAuthReturn }) => boolean);
268
- };
269
- ```
270
-
271
- </details>
272
-
273
- ## Display Control
274
-
275
- All navigation items support a `display` property that controls when the item should be visible:
276
-
277
- - `"always"` (default): Always visible
278
- - `"auth"`: Only visible when user is authenticated
279
- - `"anon"`: Only visible when user is not authenticated
280
- - `"hide"`: Never visible (useful for temporarily hiding items)
281
- - **callback function**: For custom logic, pass a function that receives `{ context, auth }` and
282
- returns a boolean
283
-
284
- ```json
285
- {
286
- "type": "link",
287
- "label": "Admin Panel",
288
- "to": "/admin",
289
- "display": "auth"
290
- }
291
- ```
292
-
293
- ### Custom Display Logic
294
-
295
- For more complex visibility rules, use a callback function:
296
-
297
- ```tsx
298
- {
299
- type: "link",
300
- label: "Premium Features",
301
- to: "/premium",
302
- display: ({ auth }) => {
303
- // Show only for users with premium role
304
- return auth.user?.role === "premium";
305
- }
306
- }
307
- ```
308
-
309
- The callback receives:
310
-
311
- - `context`: The APIToGo runtime context (TypeScript type: `ApitogoContext`)
312
- - `auth`: The authentication state from `UseAuthReturn`, including `user`, `isAuthenticated`, etc.
313
-
314
- ## Badges
315
-
316
- Navigation items can display badges with labels and colors. Badges support an optional `invert`
317
- property for styling:
318
-
319
- ```json
320
- {
321
- "type": "doc",
322
- "file": "api/v2",
323
- "badge": {
324
- "label": "Beta",
325
- "color": "yellow"
326
- }
327
- }
328
- ```
329
-
330
- ## Icons
331
-
332
- Icons can be added to categories and documents by specifying an `icon` property. The value should be
333
- the name of a [Lucide icon](https://lucide.dev/icons) (e.g., `book` <Book size={16}
334
- style={{ display: 'inline' }} />, `code` <Code size={16} style={{ display: 'inline' }} />,
335
- `file-text` <FileText size={16} style={{ display: 'inline' }} />).
336
-
337
- ```json
338
- {
339
- "type": "category",
340
- "label": "Getting Started",
341
- "icon": "book"
342
- }
343
- ```
344
-
345
- They can also be set on individual documents in their front matter:
346
-
347
- ```md
348
- ---
349
- title: My Document
350
- sidebar_icon: book
351
- ---
352
- ```
353
-
354
- ## Title & Labels
355
-
356
- All navigation items can have a `label` property that determines the displayed text. For `doc`
357
- items, the `label` is optional; if omitted, APIToGo uses the document's `title` from its front
358
- matter or the first `#` header.
359
-
360
- To override the navigation label without changing the document's `title`, use the `sidebar_label`
361
- property in the front matter:
362
-
363
- ```md
364
- ---
365
- title: My Long Title
366
- sidebar_label: Short Title
367
- ---
368
- ```
369
-
370
- In this example, the document's title remains "My Long Title," but the sidebar displays "Short
371
- Title."
372
-
373
- ## Navigation Rules
374
-
375
- Plugins generate sidebar navigation automatically (e.g. from OpenAPI tags). Navigation rules let you
376
- customize that generated sidebar by inserting, modifying, sorting, moving, or removing items. To
377
- change the top-level tabs themselves, use the `navigation` array directly.
378
-
379
- ```tsx
380
- navigationRules: [
381
- {
382
- type: "sort",
383
- match: "Shipments",
384
- by: (a, b) => a.label.localeCompare(b.label),
385
- },
386
- ],
387
- ```
388
-
389
- For a practical walkthrough with more examples, see the
390
- [Navigation Rules](/docs/guides/navigation-rules) guide.
391
-
392
- ### Rule Types
393
-
394
- Each rule has a `type` and a `match` property that targets a navigation item.
395
-
396
- | Type | Description |
397
- | -------- | ------------------------------------------------------------------------- |
398
- | `insert` | Add items `before` or `after` a matched item |
399
- | `modify` | Change `label`, `icon`, `badge`, `collapsed`, `collapsible`, or `display` |
400
- | `remove` | Remove a matched item from the sidebar |
401
- | `sort` | Sort children of a matched category using a custom comparator |
402
- | `move` | Relocate a matched item `before` or `after` another item |
403
-
404
- ### Match Syntax
405
-
406
- The `match` property uses slash-separated segments to target items. The first segment identifies the
407
- top-level tab by label, and remaining segments navigate into the sidebar tree. Label matching is
408
- case-insensitive.
409
-
410
- ```json
411
- match: "Users/Get User"; // by label
412
- match: "Users/0"; // first item
413
- match: "Users/-1"; // last item
414
- match: "Users/Advanced/0"; // mixed nesting
415
- ```
@@ -1,150 +0,0 @@
1
- ---
2
- title: Protected Routes
3
- sidebar_icon: squares-subtract
4
- description:
5
- Learn how to protect specific routes in your documentation using authentication, including simple
6
- array patterns, advanced authorization with reason codes, and custom callback functions.
7
- ---
8
-
9
- You can protect specific routes in your documentation by adding the `protectedRoutes` property to
10
- your [APIToGo configuration](./overview.md). This requires [authentication](./authentication.md) to
11
- be configured. The property supports two formats: a simple array of path patterns, or an advanced
12
- object format with custom authorization logic.
13
-
14
- :::note{title="Client-side protection only"}
15
-
16
- `protectedRoutes` are client-side only. Do not rely on `protectedRoutes` to hide sensitive
17
- information.
18
-
19
- We are working on an additional offering that secures this data server-side.
20
-
21
- :::
22
-
23
- ## Array Format
24
-
25
- The simplest way to protect routes is to provide an array of path patterns. Users must be
26
- authenticated to access these routes.
27
-
28
- ```typescript title="config"
29
- {
30
- // ...
31
- protectedRoutes: [
32
- "/admin/*", // Protect all routes under /admin
33
- "/settings", // Protect the settings page
34
- "/api/*", // Protect all API-related routes
35
- "/private/:id" // Protect dynamic routes with parameters
36
- ],
37
- // ...
38
- }
39
- ```
40
-
41
- When a user tries to access a protected route, a login dialog will appear prompting them to sign in
42
- or register. After logging in, they are automatically redirected back to the route they were trying
43
- to access.
44
-
45
- ## Object Format
46
-
47
- For more complex authorization logic, you can provide a record mapping route patterns to custom
48
- callback functions:
49
-
50
- ```typescript title="config"
51
- {
52
- // ...
53
- protectedRoutes: {
54
- // Only allow authenticated users with admin role
55
- "/admin/*": ({ auth }) =>
56
- auth.isAuthenticated && auth.user?.role === "admin",
57
-
58
- // Check if user has enterprise access
59
- "/api/enterprise/*": ({ auth }) =>
60
- auth.isAuthenticated && auth.user?.subscription === "enterprise",
61
-
62
- // Allow access to beta features based on user attributes
63
- "/beta/*": ({ auth }) =>
64
- auth.isAuthenticated && auth.user?.betaAccess === true,
65
- },
66
- // ...
67
- }
68
- ```
69
-
70
- ### Callback Parameters
71
-
72
- The callback function receives an object with:
73
-
74
- - `auth` - The current authentication state, including `isAuthenticated`, `isPending`, `profile`,
75
- and more
76
- - `context` - The APIToGo context providing access to configuration and utilities
77
- - `reasonCode` - An object containing the reason code constants `UNAUTHORIZED` and `FORBIDDEN` (see
78
- [Reason Codes](#reason-codes))
79
-
80
- ### Return Values
81
-
82
- The callback can return a `boolean` or a reason code string:
83
-
84
- | Return value | Behavior |
85
- | ------------------------- | ------------------------------------------------- |
86
- | `true` | Allow access to the route |
87
- | `false` | Treated as `UNAUTHORIZED` - prompts login |
88
- | `reasonCode.UNAUTHORIZED` | Show a login dialog prompting the user to sign in |
89
- | `reasonCode.FORBIDDEN` | Show a 403 "Access Denied" page |
90
-
91
- ## Reason Codes
92
-
93
- Reason codes allow you to distinguish between users who need to sign in and users who are signed in
94
- but lack permission. This is useful for building role-based or attribute-based access control.
95
-
96
- - **`UNAUTHORIZED`** - The user is not authenticated. A login dialog is shown, and navigation to the
97
- route is blocked until the user signs in.
98
- - **`FORBIDDEN`** - The user is authenticated but does not have permission. A 403 "Access Denied"
99
- page is displayed instead of the route content.
100
-
101
- ```typescript title="config"
102
- {
103
- // ...
104
- protectedRoutes: {
105
- // Members-only page: unauthenticated users see a login prompt
106
- "/only-members": ({ auth, reasonCode }) =>
107
- auth.isAuthenticated ? true : reasonCode.UNAUTHORIZED,
108
-
109
- // VIP page: unauthenticated users see a login prompt,
110
- // authenticated users without permission see "Access Denied"
111
- "/vip-lounge": ({ auth, reasonCode }) =>
112
- !auth.isAuthenticated
113
- ? reasonCode.UNAUTHORIZED
114
- : auth.profile?.email?.endsWith("@example.com")
115
- ? true
116
- : reasonCode.FORBIDDEN,
117
- },
118
- // ...
119
- }
120
- ```
121
-
122
- ## Navigation Blocking
123
-
124
- When a user navigates to a route that returns `false` or `UNAUTHORIZED`, navigation is intercepted
125
- before the page changes. The user stays on the current page while a login dialog is displayed. If
126
- the user cancels, they remain on the current page. If they log in successfully, navigation
127
- automatically proceeds to the protected route.
128
-
129
- Routes that return `FORBIDDEN` do not block navigation — the user navigates to the route and sees
130
- the "Access Denied" page.
131
-
132
- ## Path Patterns
133
-
134
- The path patterns follow the same syntax as [React Router](https://reactrouter.com):
135
-
136
- - `:param` matches a URL segment up to the next `/`, `?`, or `#`
137
- - `*` matches zero or more characters up to the next `/`, `?`, or `#`
138
- - `/*` matches all characters after the pattern
139
-
140
- For example:
141
-
142
- - `/users/:id` matches `/users/123` or `/users/abc`
143
- - `/docs/*` matches `/docs/getting-started` or `/docs/api/reference`
144
- - `/settings` matches only the exact path `/settings`
145
-
146
- ## Next Steps
147
-
148
- - Learn about [authentication providers](./authentication.md#authentication-providers) supported by
149
- APIToGo
150
- - Configure [user data](./authentication.md#user-data) display