@lukoweb/apitogo 0.1.120 → 0.1.126

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 (46) hide show
  1. package/LICENSE.md +18 -0
  2. package/dist/cli/cli.js +733 -396
  3. package/dist/declarations/config/local-manifest.d.ts +1 -1
  4. package/dist/declarations/lib/authentication/auth-header-nav.d.ts +5 -1
  5. package/dist/declarations/lib/authentication/hook.d.ts +25 -3
  6. package/dist/declarations/lib/authentication/state.d.ts +39 -3
  7. package/dist/declarations/lib/plugins/openapi/processors/injectApitogoGatewayServer.d.ts +1 -1
  8. package/docs/cli/go-live.md +21 -20
  9. package/docs/components/slot.mdx +2 -2
  10. package/docs/components.mdx +34 -34
  11. package/docs/concepts/auth-provider-api-identities.md +2 -2
  12. package/docs/configuration/authentication.md +16 -14
  13. package/docs/configuration/build-configuration.mdx +2 -2
  14. package/docs/configuration/make-config.mdx +5 -5
  15. package/docs/configuration/manifest.md +8 -14
  16. package/docs/configuration/navigation.mdx +4 -4
  17. package/docs/configuration/overview.md +6 -7
  18. package/docs/configuration/plans.md +19 -16
  19. package/docs/deploy/vercel.md +3 -4
  20. package/docs/deployment.md +5 -4
  21. package/docs/guides/custom-pages.md +2 -2
  22. package/docs/guides/environment-variables.md +19 -17
  23. package/docs/guides/managing-api-keys-and-identities.md +10 -18
  24. package/docs/mcp/go-live.md +12 -12
  25. package/docs/mcp/overview.md +10 -10
  26. package/docs/mcp/setup.md +9 -9
  27. package/docs/mcp/shape.md +4 -3
  28. package/docs/mcp/tools.md +61 -61
  29. package/docs/plugins.md +2 -2
  30. package/docs/quickstart.md +5 -6
  31. package/package.json +10 -155
  32. package/src/config/apitogo-config-core.ts +5 -1
  33. package/src/config/gateway-limits.ts +7 -2
  34. package/src/config/loader.ts +5 -7
  35. package/src/config/local-manifest.ts +7 -7
  36. package/src/config/resolve-modules.ts +5 -7
  37. package/src/lib/authentication/auth-header-nav.ts +3 -3
  38. package/src/lib/authentication/providers/dev-portal-auth-pages.tsx +2 -5
  39. package/src/lib/authentication/state.ts +1 -1
  40. package/src/lib/components/Layout.tsx +1 -4
  41. package/src/lib/components/SiteTitle.tsx +3 -1
  42. package/src/lib/plugins/openapi/processors/injectApitogoGatewayServer.ts +9 -3
  43. package/src/vite/config.ts +0 -21
  44. package/src/vite/plugin-api.ts +1 -1
  45. package/src/vite/plugin-modules.ts +1 -2
  46. package/src/vite/plugin-offroot-resolve.ts +2 -6
@@ -81,7 +81,10 @@ export function mergeLimitsSource<T extends object>(
81
81
  ): T {
82
82
  const merged = prior ? { ...prior, ...patch } : { ...patch };
83
83
  const patchSource = patch as GatewayLimitsSource;
84
- if (patchSource.limits === undefined && patchSource.limitsJson !== undefined) {
84
+ if (
85
+ patchSource.limits === undefined &&
86
+ patchSource.limitsJson !== undefined
87
+ ) {
85
88
  delete (merged as GatewayLimitsSource).limits;
86
89
  }
87
90
  return planForConfig(merged);
@@ -89,7 +92,9 @@ export function mergeLimitsSource<T extends object>(
89
92
 
90
93
  /** Stringify for the platform HTTP/DB `limitsJson` field. */
91
94
  export function planLimitsForPlatform(plan: object): string | undefined {
92
- return stringifyGatewayLimits(coerceGatewayLimits(plan as GatewayLimitsSource));
95
+ return stringifyGatewayLimits(
96
+ coerceGatewayLimits(plan as GatewayLimitsSource),
97
+ );
93
98
  }
94
99
 
95
100
  export function validateLimitsField(
@@ -167,7 +167,7 @@ async function loadZudokuConfigWithMeta(
167
167
  dependencies,
168
168
  configPath,
169
169
  },
170
- __resolvedModules: resolveModulesConfig(config, { rootDir }),
170
+ __resolvedModules: resolveModulesConfig(config),
171
171
  };
172
172
 
173
173
  return configWithMetadata;
@@ -213,9 +213,9 @@ function isWatchableConfigDependency(depPath: string): boolean {
213
213
  }
214
214
 
215
215
  function getWatchableConfigDependencies(config: ConfigWithMeta): string[] {
216
- const manifestEnv = resolveManifestEnv(
217
- config.__meta.mode === "production" ? "production" : "development",
218
- );
216
+ // Only called from dev-watch helpers (hasConfigChanged/updateModifiedTimes),
217
+ // which are meaningless outside the dev server, so always resolve dev paths.
218
+ const manifestEnv = resolveManifestEnv("development");
219
219
  const { watchPaths } = manifestPathsForEnv(
220
220
  config.__meta.rootDir,
221
221
  manifestEnv,
@@ -327,9 +327,7 @@ export async function loadZudokuConfig(
327
327
  ...transformedConfig.__meta,
328
328
  ...configWithManifestMeta.__meta,
329
329
  },
330
- __resolvedModules: resolveModulesConfig(transformedConfig, {
331
- rootDir: transformedConfig.__meta.rootDir,
332
- }),
330
+ __resolvedModules: resolveModulesConfig(transformedConfig),
333
331
  };
334
332
 
335
333
  if (!process.env.APITOGO_JSON_ONLY) {
@@ -1,6 +1,13 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { z } from "zod";
4
+ import {
5
+ APITOGO_CONFIG_FILENAME,
6
+ extractManifest,
7
+ isBillingEnabled,
8
+ loadApitogoConfig,
9
+ readPlanCatalogItems,
10
+ } from "./apitogo-config-loader.js";
4
11
  import {
5
12
  type GatewayLimits,
6
13
  coerceGatewayLimits,
@@ -9,13 +16,6 @@ import {
9
16
  mergeLimitsSource,
10
17
  planLimitsForPlatform,
11
18
  } from "./gateway-limits.js";
12
- import {
13
- APITOGO_CONFIG_FILENAME,
14
- extractManifest,
15
- isBillingEnabled,
16
- loadApitogoConfig,
17
- readPlanCatalogItems,
18
- } from "./apitogo-config-loader.js";
19
19
  import {
20
20
  type LandingManifestInput,
21
21
  LandingManifestContentSchema,
@@ -112,10 +112,10 @@ export const resolveLandingContent = (
112
112
  content?.hero?.titleAccent ??
113
113
  (content?.hero?.title ? undefined : defaults.hero?.titleAccent),
114
114
  },
115
- featuresSection: mergeLandingSection(
116
- defaults.featuresSection,
117
- content?.featuresSection,
118
- ),
115
+ featuresSection:
116
+ defaults.featuresSection || content?.featuresSection
117
+ ? { ...defaults.featuresSection, ...content?.featuresSection }
118
+ : undefined,
119
119
  features: content?.features ?? defaults.features,
120
120
  primaryAction: content?.primaryAction ?? defaults.primaryAction,
121
121
  secondaryAction: content?.secondaryAction ?? defaults.secondaryAction,
@@ -150,9 +150,7 @@ export const resolveLandingContent = (
150
150
  ...content.hero,
151
151
  title: content.hero?.title ?? siteTitle,
152
152
  },
153
- featuresSection: content.featuresSection
154
- ? mergeLandingSection(undefined, content.featuresSection)
155
- : undefined,
153
+ featuresSection: content.featuresSection,
156
154
  features: content.features,
157
155
  primaryAction: content.primaryAction,
158
156
  secondaryAction: content.secondaryAction,
@@ -17,9 +17,9 @@ export function withoutLoginNavigation(
17
17
  );
18
18
  }
19
19
 
20
- export function applyAuthenticationHeaderNav<T extends ZudokuConfig>(
21
- config: T,
22
- ): T {
20
+ export function applyAuthenticationHeaderNav<
21
+ T extends ZudokuConfig & { __meta?: { authenticationEnabled?: boolean } },
22
+ >(config: T): T {
23
23
  if (!config.authentication) {
24
24
  return config;
25
25
  }
@@ -1,5 +1,4 @@
1
1
  import { Spinner } from "@lukoweb/apitogo/components";
2
- import { Badge } from "@lukoweb/apitogo/ui/Badge.js";
3
2
  import { Button } from "@lukoweb/apitogo/ui/Button.js";
4
3
  import {
5
4
  Card,
@@ -301,7 +300,7 @@ export function DevPortalLoginPage({
301
300
  <div className="flex justify-center">
302
301
  <Spinner />
303
302
  </div>
304
- ) : config && !demoAuthAvailable ? (
303
+ ) : config && !demoAuthAvailable && baseUrl ? (
305
304
  <>
306
305
  <OidcProviderButtons
307
306
  apiBaseUrl={baseUrl}
@@ -372,9 +371,7 @@ export function DevPortalRegisterPage({
372
371
  }
373
372
 
374
373
  return (
375
- <AuthPageShell
376
- title="Create your account"
377
- >
374
+ <AuthPageShell title="Create your account">
378
375
  <form className="flex flex-col gap-4" onSubmit={onSubmit}>
379
376
  <div className="space-y-2">
380
377
  <Label htmlFor="displayName">Full name</Label>
@@ -53,7 +53,7 @@ declare global {
53
53
  var __APITOGO_AUTH_STATE: AuthStateStore | undefined;
54
54
  }
55
55
 
56
- function createAuthStateStore(): AuthStateStore {
56
+ function createAuthStateStore() {
57
57
  return create<AuthState>()(
58
58
  persist(
59
59
  (set) => ({
@@ -4,10 +4,7 @@ import { Outlet } from "react-router";
4
4
  import { cn } from "../util/cn.js";
5
5
  import { useScrollToAnchor } from "../util/useScrollToAnchor.js";
6
6
  import { useScrollToTop } from "../util/useScrollToTop.js";
7
- import {
8
- useCurrentNavigation,
9
- useZudoku,
10
- } from "./context/ZudokuContext.js";
7
+ import { useCurrentNavigation, useZudoku } from "./context/ZudokuContext.js";
11
8
  import { Footer } from "./Footer.js";
12
9
  import { Header } from "./Header.js";
13
10
  import { Main } from "./Main.js";
@@ -50,7 +50,9 @@ export const SiteTitle = ({ title, className }: SiteTitleProps) => {
50
50
  style={{ color: "var(--foreground)" }}
51
51
  >
52
52
  {prefix}
53
- {accent ? <span style={{ color: "var(--primary)" }}>{accent}</span> : null}
53
+ {accent ? (
54
+ <span style={{ color: "var(--primary)" }}>{accent}</span>
55
+ ) : null}
54
56
  </span>
55
57
  );
56
58
  };
@@ -1,4 +1,4 @@
1
- import type { Processor } from "../../../config/validators/BuildSchema.js";
1
+ import type { Processor } from "../../../../config/validators/BuildSchema.js";
2
2
 
3
3
  /** Env var set by APItoGo MCP publish/build to inject the project gateway into API Reference. */
4
4
  export const APITOGO_GATEWAY_URL_ENV = "APITOGO_GATEWAY_URL";
@@ -13,11 +13,17 @@ export function injectApitogoGatewayServer(options?: {
13
13
  disableEnv?: string;
14
14
  }): Processor {
15
15
  return ({ schema }) => {
16
- if (process.env[options?.disableEnv ?? "APITOGO_PUBLIC_DISABLE_INJECT_GATEWAY"]) {
16
+ if (
17
+ process.env[
18
+ options?.disableEnv ?? "APITOGO_PUBLIC_DISABLE_INJECT_GATEWAY"
19
+ ]
20
+ ) {
17
21
  return schema;
18
22
  }
19
23
 
20
- const url = (options?.gatewayUrl ?? process.env[APITOGO_GATEWAY_URL_ENV])?.trim();
24
+ const url = (
25
+ options?.gatewayUrl ?? process.env[APITOGO_GATEWAY_URL_ENV]
26
+ )?.trim();
21
27
  if (!url) {
22
28
  return schema;
23
29
  }
@@ -21,11 +21,6 @@ import { ensurePagefindDevStub } from "./pagefind-dev-stub.js";
21
21
  import vitePlugin from "./plugin.js";
22
22
  import { getZuploSystemConfigurations } from "./zuplo.js";
23
23
 
24
- const browserConfigLoaderPath = path.join(
25
- getZudokuRootDir(),
26
- "src/config/apitogo-config-loader.browser.ts",
27
- );
28
-
29
24
  /** Resolved absolute public directory (Vite default: `<root>/public`). */
30
25
  const resolveMergedPublicDir = (
31
26
  rootDir: string,
@@ -119,22 +114,6 @@ export async function getViteConfig(
119
114
  "@mdx-js/react": import.meta.resolve("@mdx-js/react"),
120
115
  },
121
116
  },
122
- environments: {
123
- client: {
124
- resolve: {
125
- alias: {
126
- [path.join(
127
- getZudokuRootDir(),
128
- "src/config/apitogo-config-loader.node.ts",
129
- )]: browserConfigLoaderPath,
130
- [path.join(
131
- getZudokuRootDir(),
132
- "src/config/apitogo-config-loader.node.js",
133
- )]: browserConfigLoaderPath,
134
- },
135
- },
136
- },
137
- },
138
117
  define: {
139
118
  "process.env.ZUDOKU_VERSION": JSON.stringify(packageJson.version),
140
119
  "process.env.IS_ZUPLO": ZuploEnv.isZuplo,
@@ -14,8 +14,8 @@ import type {
14
14
  ApiCatalogItem,
15
15
  ApiCatalogPluginOptions,
16
16
  } from "../lib/plugins/api-catalog/index.js";
17
- import { injectApitogoGatewayServer } from "../lib/plugins/openapi/processors/injectApitogoGatewayServer.js";
18
17
  import type { VersionedInput } from "../lib/plugins/openapi/interfaces.js";
18
+ import { injectApitogoGatewayServer } from "../lib/plugins/openapi/processors/injectApitogoGatewayServer.js";
19
19
  import { ensureArray } from "../lib/util/ensureArray.js";
20
20
  import { SchemaManager } from "./api/SchemaManager.js";
21
21
  import { reload } from "./plugin-config-reload.js";
@@ -98,8 +98,7 @@ const viteModulesPlugin = (): Plugin => {
98
98
  );
99
99
  }
100
100
 
101
- const useBillingDashboard =
102
- !dashboardPagePath && userPanel.plans.enabled;
101
+ const useBillingDashboard = !dashboardPagePath && userPanel.plans.enabled;
103
102
 
104
103
  if (dashboardPagePath) {
105
104
  code.push(
@@ -1,5 +1,5 @@
1
1
  import path from "node:path";
2
- import type { Plugin, ResolveIdOptions } from "vite";
2
+ import type { Plugin } from "vite";
3
3
  import { getCurrentConfig } from "../config/loader.js";
4
4
 
5
5
  function stripQuery(id: string): string {
@@ -53,11 +53,7 @@ export default function viteOffrootResolvePlugin(): Plugin {
53
53
  return {
54
54
  name: "zudoku-offroot-resolve",
55
55
  enforce: "pre",
56
- async resolveId(
57
- source: string,
58
- importer: string | undefined,
59
- options: ResolveIdOptions,
60
- ) {
56
+ async resolveId(source, importer, options) {
61
57
  const rootDir = getCurrentConfig().__meta.rootDir;
62
58
  if (!shouldResolveFromSiteRoot(source, importer, rootDir)) {
63
59
  return;