@lukoweb/apitogo 0.1.67 → 0.1.69
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 +552 -380
- package/dist/declarations/lib/plugins/openapi/processors/injectApitogoGatewayServer.d.ts +6 -0
- package/docs/components/playground.mdx +6 -8
- package/docs/components/slot.mdx +2 -2
- package/docs/concepts/auth-provider-api-identities.md +8 -12
- package/docs/configuration/ai-assistants.md +3 -3
- package/docs/configuration/api-catalog.md +4 -4
- package/docs/configuration/api-reference.md +11 -11
- package/docs/configuration/authentication-auth0.md +8 -1
- package/docs/configuration/authentication-azure-ad.md +8 -1
- package/docs/configuration/authentication-clerk.md +8 -1
- package/docs/configuration/authentication-firebase.md +8 -1
- package/docs/configuration/authentication-pingfederate.md +8 -1
- package/docs/configuration/authentication-supabase.md +10 -3
- package/docs/configuration/authentication.md +96 -195
- package/docs/configuration/build-configuration.mdx +2 -2
- package/docs/configuration/docs.md +10 -10
- package/docs/configuration/footer.mdx +84 -180
- package/docs/configuration/llms.md +1 -1
- package/docs/configuration/make-config.mdx +12 -5
- package/docs/configuration/manifest.md +4 -14
- package/docs/configuration/navigation.mdx +2 -2
- package/docs/configuration/overview.md +95 -310
- package/docs/configuration/protected-routes.md +3 -3
- package/docs/configuration/search.md +4 -3
- package/docs/configuration/site.md +5 -5
- package/docs/configuration/slots.mdx +1 -1
- package/docs/custom-plugins.md +1 -1
- package/docs/customization/colors-theme.mdx +8 -8
- package/docs/customization/fonts.md +4 -4
- package/docs/deploy/apitogo.md +18 -12
- package/docs/deploy/cloudflare-pages.md +0 -1
- package/docs/deploy/direct-upload.md +0 -1
- package/docs/deploy/github-pages.md +1 -2
- package/docs/deploy/vercel.md +2 -3
- package/docs/deployment.md +11 -10
- package/docs/extending/events.md +1 -1
- package/docs/guides/custom-pages.md +4 -8
- package/docs/guides/environment-variables.md +41 -49
- package/docs/guides/managing-api-keys-and-identities.md +40 -115
- package/docs/guides/navigation-rules.mdx +1 -1
- package/docs/guides/processors.mdx +2 -2
- package/docs/guides/transforming-examples.md +1 -1
- package/docs/markdown/code-blocks.md +2 -2
- package/docs/markdown/mdx.md +1 -1
- package/docs/mcp/go-live.md +100 -0
- package/docs/mcp/overview.md +76 -0
- package/docs/mcp/setup.md +173 -0
- package/docs/mcp/shape.md +76 -0
- package/docs/mcp/tools.md +102 -0
- package/docs/plugins.md +20 -1
- package/docs/quickstart.md +49 -54
- package/docs/writing.mdx +1 -1
- package/package.json +1 -1
- package/src/lib/authentication/components/ProductionUnlockPage.tsx +4 -5
- package/src/lib/plugins/openapi/processors/injectApitogoGatewayServer.ts +30 -0
- package/src/vite/plugin-api.ts +6 -1
- package/src/vite/plugin-config.ts +3 -0
- package/docs/guides/navigation-migration.md +0 -87
|
@@ -15,7 +15,7 @@ You can use predefined Google Fonts, external sources, or local fonts.
|
|
|
15
15
|
The easiest way to use fonts is with predefined Google Fonts. Simply specify the font name as a
|
|
16
16
|
string:
|
|
17
17
|
|
|
18
|
-
```ts title=
|
|
18
|
+
```ts title=config
|
|
19
19
|
const config = {
|
|
20
20
|
theme: {
|
|
21
21
|
fonts: {
|
|
@@ -44,7 +44,7 @@ Geist Mono
|
|
|
44
44
|
|
|
45
45
|
For more control or to use fonts not in the predefined list, you can specify a custom font URL:
|
|
46
46
|
|
|
47
|
-
```ts title=
|
|
47
|
+
```ts title=config
|
|
48
48
|
const config = {
|
|
49
49
|
theme: {
|
|
50
50
|
fonts: {
|
|
@@ -76,7 +76,7 @@ To use local fonts, add them to the `public` folder and create a `fonts.css` fil
|
|
|
76
76
|
|
|
77
77
|
Then reference the local CSS file:
|
|
78
78
|
|
|
79
|
-
```ts title=
|
|
79
|
+
```ts title=config
|
|
80
80
|
const config = {
|
|
81
81
|
theme: {
|
|
82
82
|
fonts: {
|
|
@@ -93,7 +93,7 @@ const config = {
|
|
|
93
93
|
|
|
94
94
|
You can mix predefined fonts with custom fonts:
|
|
95
95
|
|
|
96
|
-
```ts title=
|
|
96
|
+
```ts title=config
|
|
97
97
|
const config = {
|
|
98
98
|
theme: {
|
|
99
99
|
fonts: {
|
package/docs/deploy/apitogo.md
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: APIToGo
|
|
3
|
-
zuplo: false
|
|
2
|
+
title: Deploy with APIToGo CLI
|
|
4
3
|
---
|
|
5
4
|
|
|
6
|
-
[APIToGo](https://
|
|
7
|
-
|
|
5
|
+
[APIToGo](https://apitogo.com) hosts your documentation site. This page covers the **CLI** path
|
|
6
|
+
(`apitogo deploy` with a deployment token).
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
For a full API product (plans, `dev-portal` auth, gateway, platform Free / Starter / Professional),
|
|
9
|
+
use MCP **`publish_dev_portal`** / `apply_product_intent` mode `goLive` — see
|
|
10
|
+
[MCP go-live](../mcp/go-live.md).
|
|
11
|
+
|
|
12
|
+
| Path | When |
|
|
13
|
+
| ------------------------ | ------------------------------------------------- |
|
|
14
|
+
| MCP `publish_dev_portal` | Connected portal + plans + hosting go-live |
|
|
15
|
+
| CLI `apitogo deploy` | Build and upload a site with a deployment token |
|
|
10
16
|
|
|
11
|
-
Before
|
|
17
|
+
## Before you deploy
|
|
12
18
|
|
|
13
19
|
```bash
|
|
14
20
|
npm run dev
|
|
15
21
|
```
|
|
16
22
|
|
|
17
|
-
## Deploy with
|
|
23
|
+
## Deploy with the CLI
|
|
18
24
|
|
|
19
|
-
To publish
|
|
25
|
+
To publish a site with a deployment token:
|
|
20
26
|
|
|
21
|
-
1. Sign in to [
|
|
27
|
+
1. Sign in to [apitogo.com](https://apitogo.com)
|
|
22
28
|
2. Create a new project or open an existing one
|
|
23
29
|
3. Navigate to Project settings and copy the deployment token
|
|
24
30
|
4. Run the following command:
|
|
@@ -78,7 +84,7 @@ request gets a **preview** URL.
|
|
|
78
84
|
|
|
79
85
|
### 1. Generate the workflow
|
|
80
86
|
|
|
81
|
-
From your documentation project root (the folder that contains `apitogo.config` and `package.json`),
|
|
87
|
+
From your documentation project root (the folder that contains `apitogo.config.json` and `package.json`),
|
|
82
88
|
run:
|
|
83
89
|
|
|
84
90
|
```bash
|
|
@@ -95,7 +101,7 @@ If the file already exists, pass `--force` to overwrite it.
|
|
|
95
101
|
|
|
96
102
|
### 2. Add your deployment token as a GitHub secret
|
|
97
103
|
|
|
98
|
-
1. In [APIToGo](https://
|
|
104
|
+
1. In [APIToGo](https://apitogo.com), open your project and copy the **deployment token** from
|
|
99
105
|
project settings (the same token you use with `apitogo deploy`).
|
|
100
106
|
2. On GitHub, open your repository → **Settings** → **Secrets and variables** → **Actions**.
|
|
101
107
|
3. Create a new repository secret named **`APITOGO_TOKEN`** and paste the token.
|
|
@@ -136,4 +142,4 @@ After your site is live, check the following:
|
|
|
136
142
|
|
|
137
143
|
To get started, sign in here:
|
|
138
144
|
|
|
139
|
-
- [APIToGo Dashboard](https://
|
|
145
|
+
- [APIToGo Dashboard](https://apitogo.com)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: GitHub Pages
|
|
3
|
-
zuplo: false
|
|
4
3
|
---
|
|
5
4
|
|
|
6
5
|
[GitHub Pages](https://pages.github.com/) is a great way to publish your documentation, especially
|
|
@@ -17,7 +16,7 @@ To publish your site to GitHub Pages you will need:
|
|
|
17
16
|
Use the
|
|
18
17
|
[GitHub Actions Workflow](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow).
|
|
19
18
|
|
|
20
|
-
You might need to configure the `basePath` in your
|
|
19
|
+
You might need to configure the `basePath` in your site config.ts depending on how your site is
|
|
21
20
|
hosted. For instance, if your site is available at username.github.io/your-repo/ you would set the
|
|
22
21
|
`basePath` to `/your-repo`.
|
|
23
22
|
|
package/docs/deploy/vercel.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Vercel
|
|
3
|
-
zuplo: false
|
|
4
3
|
---
|
|
5
4
|
|
|
6
5
|
[Vercel](https://vercel.com) offers multiple ways to deploy to its service, including via GitHub,
|
|
@@ -74,8 +73,8 @@ information.
|
|
|
74
73
|
|
|
75
74
|
:::caution{title="Redirects"}
|
|
76
75
|
|
|
77
|
-
If you have redirects
|
|
78
|
-
|
|
76
|
+
If you have redirects in `apitogo.config.json`, you may also need matching entries in
|
|
77
|
+
`vercel.json`. See the
|
|
79
78
|
[Vercel Configuration](https://vercel.com/docs/projects/project-configuration#redirects) for more
|
|
80
79
|
information.
|
|
81
80
|
|
package/docs/deployment.md
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Deploying APIToGo
|
|
3
|
-
zuplo: false
|
|
4
3
|
---
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
you will need to deploy it to your own server, or a hosted service of your choice.
|
|
5
|
+
Choose how you publish:
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
| Path | Guide |
|
|
8
|
+
| ---- | ----- |
|
|
9
|
+
| **MCP go-live** (portal + plans + hosting) | [MCP go-live](./mcp/go-live.md) |
|
|
10
|
+
| **CLI** (`apitogo deploy` + token) | [Deploy with APIToGo CLI](./deploy/apitogo.md) |
|
|
11
|
+
| **Static host** (GitHub Pages, upload `dist`) | Below and sibling deploy guides |
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
your own server.
|
|
13
|
+
## Build locally
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
Produce static HTML, JavaScript, and CSS for any host:
|
|
15
16
|
|
|
16
|
-
```
|
|
17
|
+
```bash
|
|
17
18
|
npm run build
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
Output is in `dist/`. Upload that folder, or use [direct upload](./deploy/direct-upload.md) /
|
|
22
|
+
[GitHub Pages](./deploy/github-pages.md).
|
package/docs/extending/events.md
CHANGED
|
@@ -48,7 +48,7 @@ const navigationLoggerPlugin: ApitogoPlugin = {
|
|
|
48
48
|
|
|
49
49
|
### Example in APIToGo Config
|
|
50
50
|
|
|
51
|
-
In your
|
|
51
|
+
In your your site config, you can define the events like this:
|
|
52
52
|
|
|
53
53
|
```typescript
|
|
54
54
|
export default {
|
|
@@ -47,14 +47,10 @@ export const MyCustomPage = () => {
|
|
|
47
47
|
|
|
48
48
|
In the [APIToGo Configuration](../configuration/overview.md) you will need to do the following:
|
|
49
49
|
|
|
50
|
-
###
|
|
50
|
+
### Config that embeds JSX
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
apitogo.config.ts -> apitogo.config.tsx
|
|
57
|
-
```
|
|
52
|
+
If you embed React components in config (for example custom pages), use a JSX-capable config module
|
|
53
|
+
and import your page component from there.
|
|
58
54
|
|
|
59
55
|
### Import Your Module
|
|
60
56
|
|
|
@@ -101,6 +97,6 @@ pages, but in case it isn't, it should look like this:
|
|
|
101
97
|
```json
|
|
102
98
|
{
|
|
103
99
|
...
|
|
104
|
-
"include": ["src", "
|
|
100
|
+
"include": ["src", "src/MyCustomPage.tsx"]
|
|
105
101
|
}
|
|
106
102
|
```
|
|
@@ -3,86 +3,77 @@ title: Environment Variables
|
|
|
3
3
|
sidebar_icon: table
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
APIToGo
|
|
7
|
-
|
|
6
|
+
APIToGo uses Vite’s [env and mode](https://vite.dev/guide/env-and-mode) model, plus
|
|
7
|
+
`APITOGO_CONFIG_*` overrides for `apitogo.config.json`.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Portal / publish (`.env`)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
| Variable | Purpose |
|
|
12
|
+
| -------- | ------- |
|
|
13
|
+
| `VITE_APITOGO_AUTHENTICATION_API_BASE_URL` | Dev-portal API base URL (client) |
|
|
14
|
+
| `APITOGO_CONFIG_AUTHENTICATION__API_BASE_URL` | Same, via config override |
|
|
15
|
+
| `APITOGO_CONFIG_AUTHENTICATION__OIDC__*` | OIDC authority / client id / secret for publish |
|
|
16
|
+
| `APITOGO_CONFIG_AUTHENTICATION__STRIPE__*` | Stripe secret + webhook (paid plans) |
|
|
17
|
+
| `APITOGO_CONFIG_DEMO_MODE` | `false` to disable local demo sign-in |
|
|
18
|
+
| `APITOGO_CONFIG_SITE__TITLE` | Override `site.title` |
|
|
19
|
+
| `APITOGO_CONFIG_PROJECT_ID` | Local project id override |
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
Nested overrides use `__` path segments (SCREAMING_SNAKE). See [Manifest](../configuration/manifest.md).
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
other secrets.
|
|
23
|
+
**Never commit** OIDC client secrets or Stripe keys. MCP never puts secrets in chat — you write them
|
|
24
|
+
to `.env` before [go-live](../mcp/go-live.md).
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
Example:
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
```sh
|
|
29
|
+
VITE_APITOGO_AUTHENTICATION_API_BASE_URL=https://your-dev-portal-api.example.com
|
|
30
|
+
APITOGO_CONFIG_AUTHENTICATION__OIDC__AUTHORITY=https://login.example.com
|
|
31
|
+
APITOGO_CONFIG_AUTHENTICATION__OIDC__CLIENT_ID=your-client-id
|
|
32
|
+
APITOGO_CONFIG_AUTHENTICATION__OIDC__CLIENT_SECRET=your-client-secret
|
|
33
|
+
```
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
environment-specific variables. See the
|
|
26
|
-
[Vite documentation](https://vite.dev/guide/env-and-mode.html#env-files) for more information on
|
|
27
|
-
supported files.
|
|
35
|
+
## Client-visible custom vars (`APITOGO_PUBLIC_*`)
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
Variables prefixed with `APITOGO_PUBLIC_` are exposed to client code under `import.meta.env`. Do not
|
|
38
|
+
use this prefix for secrets.
|
|
30
39
|
|
|
31
40
|
```sh
|
|
32
41
|
APITOGO_PUBLIC_PAGE_TITLE=My Page Title
|
|
33
42
|
```
|
|
34
43
|
|
|
35
|
-
You can access this variable in your application like this:
|
|
36
|
-
|
|
37
44
|
```ts
|
|
38
45
|
const title = import.meta.env.APITOGO_PUBLIC_PAGE_TITLE;
|
|
39
46
|
```
|
|
40
47
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Environment variables can also be used in your configuration files. When referencing environment
|
|
44
|
-
variables in your configuration files, you can use `process.env` directly.
|
|
48
|
+
In a TSX config you may also read `process.env` for build-time values (SPA providers, etc.):
|
|
45
49
|
|
|
46
50
|
```ts
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
clientId: process.env.APITOGO_PUBLIC_AUTH_CLIENT_ID,
|
|
53
|
-
domain: process.env.APITOGO_PUBLIC_AUTH_DOMAIN,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
51
|
+
authentication: {
|
|
52
|
+
type: "auth0",
|
|
53
|
+
clientId: process.env.APITOGO_PUBLIC_AUTH_CLIENT_ID,
|
|
54
|
+
domain: process.env.APITOGO_PUBLIC_AUTH_DOMAIN,
|
|
55
|
+
}
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
Prefer `dev-portal` + `APITOGO_CONFIG_*` for portal products.
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
`import.meta.env`. Public environment variables are inlined during the build process.
|
|
60
|
+
## React components
|
|
62
61
|
|
|
63
62
|
```tsx
|
|
64
|
-
import React from "react";
|
|
65
|
-
|
|
66
63
|
export const MyComponent = () => {
|
|
67
64
|
return <h1>{import.meta.env.APITOGO_PUBLIC_PAGE_TITLE}</h1>;
|
|
68
65
|
};
|
|
69
66
|
```
|
|
70
67
|
|
|
71
|
-
## IntelliSense
|
|
72
|
-
|
|
73
|
-
By default, APIToGo provides type definitions for `import.meta.env` in `apitogo/client.d.ts`. While
|
|
74
|
-
you can define more custom env variables in `.env.[mode]` files, you may want to get TypeScript
|
|
75
|
-
IntelliSense for user-defined env variables that are prefixed with `APITOGO_PUBLIC_`.
|
|
68
|
+
## TypeScript IntelliSense
|
|
76
69
|
|
|
77
|
-
|
|
78
|
-
`ImportMetaEnv` like this:
|
|
70
|
+
Augment `ImportMetaEnv` in a declaration file (no imports in that file):
|
|
79
71
|
|
|
80
72
|
```typescript
|
|
81
73
|
/// <reference types="@lukoweb/apitogo/client" />
|
|
82
74
|
|
|
83
75
|
interface ImportMetaEnv {
|
|
84
76
|
readonly APITOGO_PUBLIC_APP_TITLE: string;
|
|
85
|
-
// more env variables...
|
|
86
77
|
}
|
|
87
78
|
|
|
88
79
|
interface ImportMeta {
|
|
@@ -90,10 +81,11 @@ interface ImportMeta {
|
|
|
90
81
|
}
|
|
91
82
|
```
|
|
92
83
|
|
|
93
|
-
|
|
84
|
+
## MCP host (agent machine)
|
|
94
85
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
| Variable | Purpose |
|
|
87
|
+
| -------- | ------- |
|
|
88
|
+
| `APITOGO_API_KEY_ID` / `APITOGO_API_SECRET` | Required for MCP |
|
|
89
|
+
| `APITOGO_DOC_TOOL_PATH` | Optional local doc-tool for scaffold |
|
|
98
90
|
|
|
99
|
-
|
|
91
|
+
See [MCP overview](../mcp/overview.md).
|
|
@@ -2,89 +2,75 @@
|
|
|
2
2
|
title: Managing API Keys and Identities
|
|
3
3
|
sidebar_label: API Keys and Identities
|
|
4
4
|
sidebar_icon: key-square
|
|
5
|
-
zuplo: false
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
##
|
|
7
|
+
## Portal products (APItoGo)
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
creating, viewing, updating, and deleting API keys, as well as managing consumer information.
|
|
9
|
+
For developer portals, enable API keys under **`modules.userPanel.apiKeys`** in
|
|
10
|
+
`apitogo.config.json` (not a root `apiKeys` key):
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
The most convenient way to use this plugin is to use it in Zuplo. However the plugin can be used
|
|
17
|
-
with any other API key management system - you can use a 3rd party API key management system or
|
|
18
|
-
build your own and still use the APIToGo UI.
|
|
19
|
-
|
|
20
|
-
:::
|
|
21
|
-
|
|
22
|
-
## Using in Zuplo
|
|
23
|
-
|
|
24
|
-
To get started with a basic setup, simply enable `apiKeys` in your config. (In the default template,
|
|
25
|
-
this is already enabled.)
|
|
26
|
-
|
|
27
|
-
```typescript title=apitogo.config.ts
|
|
12
|
+
```json
|
|
28
13
|
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
"modules": {
|
|
15
|
+
"userPanel": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"apiKeys": { "enabled": true }
|
|
18
|
+
}
|
|
32
19
|
}
|
|
33
20
|
}
|
|
34
21
|
```
|
|
35
22
|
|
|
36
|
-
|
|
23
|
+
With MCP, prefer `update_dev_portal_manifest`. Subscription / gateway keys for provisioned portals
|
|
24
|
+
are issued by the APItoGo platform after sign-in; see [Authentication](../configuration/authentication.md)
|
|
25
|
+
and [MCP go-live](../mcp/go-live.md).
|
|
26
|
+
|
|
27
|
+
Legacy root `apiKeys: { enabled: true }` is still migrated on load into
|
|
28
|
+
`modules.userPanel.apiKeys`.
|
|
37
29
|
|
|
38
|
-
|
|
30
|
+
## Custom API key UI plugin
|
|
39
31
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
API Key** button. The callback is passed the `apiKey` object that the user has entered, the
|
|
43
|
-
`context` object, and the `auth` object. The `apiKey` object is the object that the user has entered
|
|
44
|
-
in the Create API Key form.
|
|
32
|
+
APIToGo includes a UI plugin for managing API consumers and keys (create, view, update, delete).
|
|
33
|
+
You can point it at any backend by implementing callbacks / `ApiKeyService`.
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
to access the current users auth state. Most likley you want to call your API to create a new API
|
|
48
|
-
key.
|
|
35
|
+
Enable and customize from TSX when you need custom create/list logic:
|
|
49
36
|
|
|
50
|
-
```typescript title=
|
|
37
|
+
```typescript title=config
|
|
51
38
|
const config = {
|
|
52
|
-
// ...
|
|
53
39
|
apiKeys: {
|
|
54
40
|
enabled: true,
|
|
55
41
|
createKey: async ({ apiKey, context, auth }) => {
|
|
56
|
-
const createApiKeyRequest = new Request(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// Sign the request using current users Authentication
|
|
42
|
+
const createApiKeyRequest = new Request(
|
|
43
|
+
"https://api.example.com/v1/developer/api-key",
|
|
44
|
+
{
|
|
45
|
+
method: "POST",
|
|
46
|
+
body: JSON.stringify({ apiKey }),
|
|
47
|
+
},
|
|
48
|
+
);
|
|
64
49
|
const signedRequest = await context.signRequest(createApiKeyRequest);
|
|
65
|
-
|
|
66
50
|
const response = await fetch(signedRequest);
|
|
67
|
-
|
|
68
51
|
if (!response.ok) {
|
|
69
52
|
throw new Error("Could not create API Key");
|
|
70
53
|
}
|
|
71
|
-
|
|
72
54
|
return true;
|
|
73
55
|
},
|
|
74
56
|
},
|
|
75
57
|
};
|
|
76
58
|
```
|
|
77
59
|
|
|
78
|
-
|
|
60
|
+
The account UI is typically available under `/account/settings/api-keys` when the user panel is
|
|
61
|
+
enabled.
|
|
79
62
|
|
|
80
|
-
|
|
81
|
-
interface to connect to any API key management system.
|
|
63
|
+
## Custom `ApiKeyService`
|
|
82
64
|
|
|
83
65
|
```typescript
|
|
84
66
|
interface ApiKeyService {
|
|
85
67
|
getConsumers: (context: ApitogoContext) => Promise<ApiConsumer[]>;
|
|
86
68
|
rollKey?: (consumerId: string, context: ApitogoContext) => Promise<void>;
|
|
87
|
-
deleteKey?: (
|
|
69
|
+
deleteKey?: (
|
|
70
|
+
consumerId: string,
|
|
71
|
+
keyId: string,
|
|
72
|
+
context: ApitogoContext,
|
|
73
|
+
) => Promise<void>;
|
|
88
74
|
updateConsumer?: (
|
|
89
75
|
consumer: { id: string; label?: string },
|
|
90
76
|
context: ApitogoContext,
|
|
@@ -100,73 +86,12 @@ interface ApiKeyService {
|
|
|
100
86
|
auth: UseAuthReturn;
|
|
101
87
|
}) => Promise<void>;
|
|
102
88
|
}
|
|
103
|
-
|
|
104
|
-
interface ApiConsumer {
|
|
105
|
-
id: string;
|
|
106
|
-
label: string;
|
|
107
|
-
keys: ApiKey[];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
interface ApiKey {
|
|
111
|
-
id: string;
|
|
112
|
-
key: string;
|
|
113
|
-
description?: string;
|
|
114
|
-
createdOn: string;
|
|
115
|
-
expiresOn?: string;
|
|
116
|
-
}
|
|
117
89
|
```
|
|
118
90
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Here's a step-by-step guide to implementing API key management:
|
|
91
|
+
Wire the service through the `apiKeys` config object in TSX (same callbacks as above). Prefer
|
|
92
|
+
`modules.userPanel.apiKeys.enabled` in JSON for portal toggles.
|
|
122
93
|
|
|
123
|
-
|
|
94
|
+
## Related
|
|
124
95
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// ...
|
|
128
|
-
apiKeys: {
|
|
129
|
-
enabled: true,
|
|
130
|
-
|
|
131
|
-
// Retrieve all API consumers and their keys
|
|
132
|
-
getConsumers: async (context) => {
|
|
133
|
-
// Implement fetching consumers from your storage
|
|
134
|
-
// Each consumer can have multiple API keys
|
|
135
|
-
return consumers;
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
// Create a new API key for a consumer
|
|
139
|
-
createKey: async ({ apiKey, context, auth }) => {
|
|
140
|
-
const newKey: ApiKey = {
|
|
141
|
-
id: crypto.randomUUID(),
|
|
142
|
-
key: `key-${crypto.randomUUID()}`,
|
|
143
|
-
description: apiKey.description,
|
|
144
|
-
createdOn: new Date().toISOString(),
|
|
145
|
-
expiresOn: apiKey.expiresOn,
|
|
146
|
-
};
|
|
147
|
-
// Save the new key to your storage
|
|
148
|
-
// Associate it with the current user/consumer
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
// Delete an API key
|
|
152
|
-
deleteKey: async (consumerId, keyId, context) => {
|
|
153
|
-
// Remove the key from the consumer's keys in your storage
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
// Regenerate an API key
|
|
157
|
-
rollKey: async (consumerId, context) => {
|
|
158
|
-
// Update the key value for the consumer while maintaining metadata
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
// Update consumer information
|
|
162
|
-
updateConsumer: async (consumer, context) => {
|
|
163
|
-
// Update the consumer's label or other metadata
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
// Get API usage statistics (optional)
|
|
167
|
-
getUsage: async (apiKeys, context) => {
|
|
168
|
-
// Fetch usage data for the provided API keys
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
```
|
|
96
|
+
- [Auth providers and API identities](../concepts/auth-provider-api-identities.md)
|
|
97
|
+
- [Manifest](../configuration/manifest.md)
|
|
@@ -22,7 +22,7 @@ customize that generated sidebar without changing the source. You can:
|
|
|
22
22
|
|
|
23
23
|
## Setup
|
|
24
24
|
|
|
25
|
-
Add a `navigationRules` array to your `apitogo.config.
|
|
25
|
+
Add a `navigationRules` array to your `apitogo.config.json`:
|
|
26
26
|
|
|
27
27
|
```tsx
|
|
28
28
|
import type { ApitogoConfig } from "@lukoweb/apitogo";
|
|
@@ -39,7 +39,7 @@ const buildConfig: ApitogoBuildConfig = {
|
|
|
39
39
|
|
|
40
40
|
// Remove extensions based on a custom filter
|
|
41
41
|
removeExtensions({
|
|
42
|
-
shouldRemove: (key) => key.startsWith("x-
|
|
42
|
+
shouldRemove: (key) => key.startsWith("x-internal"),
|
|
43
43
|
}),
|
|
44
44
|
],
|
|
45
45
|
};
|
|
@@ -173,7 +173,7 @@ want to split into separate pages.
|
|
|
173
173
|
Plain strings work out of the box. Version paths and dropdown labels are auto-generated from the
|
|
174
174
|
query parameter values. For more control, use the object form with explicit `path` and `label`.
|
|
175
175
|
|
|
176
|
-
```ts title=
|
|
176
|
+
```ts title=config
|
|
177
177
|
const config = {
|
|
178
178
|
apis: {
|
|
179
179
|
type: "file",
|
|
@@ -14,7 +14,7 @@ documentation. This feature is particularly useful when you need to:
|
|
|
14
14
|
## Configuration
|
|
15
15
|
|
|
16
16
|
To use this feature, you need to configure the `transformExamples` function in your
|
|
17
|
-
`apitogo.config.
|
|
17
|
+
`apitogo.config.json` file. Here's how to do it:
|
|
18
18
|
|
|
19
19
|
```tsx
|
|
20
20
|
import type { ApitogoConfig } from "@lukoweb/apitogo";
|
|
@@ -117,7 +117,7 @@ function Example() {
|
|
|
117
117
|
|
|
118
118
|
## Configuration
|
|
119
119
|
|
|
120
|
-
You can configure syntax highlighting in your `apitogo.config.
|
|
120
|
+
You can configure syntax highlighting in your `apitogo.config.json`:
|
|
121
121
|
|
|
122
122
|
:::info
|
|
123
123
|
|
|
@@ -125,7 +125,7 @@ Changes to the syntax `highlighting` configuration require a restart of APIToGo
|
|
|
125
125
|
|
|
126
126
|
:::
|
|
127
127
|
|
|
128
|
-
```tsx {5-15} title=
|
|
128
|
+
```tsx {5-15} title=config
|
|
129
129
|
import { defaultLanguages, type ApitogoConfig } from "@lukoweb/apitogo";
|
|
130
130
|
|
|
131
131
|
const config: ApitogoConfig = {
|
package/docs/markdown/mdx.md
CHANGED
|
@@ -41,7 +41,7 @@ export default function MyCustomComponent() {
|
|
|
41
41
|
In [APIToGo Configuration](./overview.md) you will need to import the component and add it to the
|
|
42
42
|
`customComponents` option in the configuration.
|
|
43
43
|
|
|
44
|
-
```ts title=
|
|
44
|
+
```ts title=config
|
|
45
45
|
import MyCustomComponent from "./src/MyCustomComponent";
|
|
46
46
|
|
|
47
47
|
const config: ApitogoConfig = {
|