@aphexcms/cms-core 11.1.0 → 11.2.0

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 (41) hide show
  1. package/dist/api/docs-ui.d.ts +22 -0
  2. package/dist/api/docs-ui.d.ts.map +1 -0
  3. package/dist/api/docs-ui.js +19 -0
  4. package/dist/api/schemas/assets.d.ts +11 -0
  5. package/dist/api/schemas/assets.d.ts.map +1 -1
  6. package/dist/api/schemas/assets.js +24 -0
  7. package/dist/auth/auth-hooks.d.ts.map +1 -1
  8. package/dist/auth/auth-hooks.js +4 -1
  9. package/dist/components/admin/AssetImage.svelte +33 -11
  10. package/dist/components/admin/AssetImage.svelte.d.ts +9 -0
  11. package/dist/components/admin/AssetImage.svelte.d.ts.map +1 -1
  12. package/dist/components/layout/OrganizationSwitcher.svelte +24 -23
  13. package/dist/components/layout/OrganizationSwitcher.svelte.d.ts.map +1 -1
  14. package/dist/components/layout/sidebar/NavUser.svelte +20 -13
  15. package/dist/components/layout/sidebar/NavUser.svelte.d.ts.map +1 -1
  16. package/dist/server/api/index.d.ts.map +1 -1
  17. package/dist/server/api/index.js +7 -0
  18. package/dist/server/api/openapi/generate.d.ts +13 -0
  19. package/dist/server/api/openapi/generate.d.ts.map +1 -0
  20. package/dist/server/api/openapi/generate.js +529 -0
  21. package/dist/server/api/openapi/json-schema.d.ts +45 -0
  22. package/dist/server/api/openapi/json-schema.d.ts.map +1 -0
  23. package/dist/server/api/openapi/json-schema.js +206 -0
  24. package/dist/server/api/openapi/registry.d.ts +78 -0
  25. package/dist/server/api/openapi/registry.d.ts.map +1 -0
  26. package/dist/server/api/openapi/registry.js +628 -0
  27. package/dist/server/api/routes/agent-change-sets.d.ts +6 -0
  28. package/dist/server/api/routes/agent-change-sets.d.ts.map +1 -1
  29. package/dist/server/api/routes/agent-change-sets.js +2 -1
  30. package/dist/server/api/routes/jobs.d.ts +32 -0
  31. package/dist/server/api/routes/jobs.d.ts.map +1 -1
  32. package/dist/server/api/routes/jobs.js +7 -3
  33. package/dist/server/api/routes/openapi.d.ts +34 -0
  34. package/dist/server/api/routes/openapi.d.ts.map +1 -0
  35. package/dist/server/api/routes/openapi.js +97 -0
  36. package/dist/server/index.d.ts +1 -0
  37. package/dist/server/index.d.ts.map +1 -1
  38. package/dist/server/index.js +1 -0
  39. package/dist/types/config.d.ts +15 -0
  40. package/dist/types/config.d.ts.map +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Whether this instance serves the rendered API reference at `GET /api/docs`.
3
+ *
4
+ * Its own tiny module, no imports, for the same reason as `limits.ts`: the
5
+ * route that mounts the page and the admin UI that links to it have to agree,
6
+ * and two copies of `!== false` agree right up until someone changes one of
7
+ * them. A link to a 404 is worse than no link.
8
+ *
9
+ * On by default. The page is authenticated, so anyone who can load it could
10
+ * already read `/api/openapi.json` — this instance's whole content model — and
11
+ * the page shows them nothing further. The one thing it does that the JSON
12
+ * endpoint doesn't is load Scalar from a public CDN, so `docsUi: false` is the
13
+ * switch for a deployment that shouldn't pull third-party scripts.
14
+ */
15
+ export declare function isApiDocsEnabled(config: {
16
+ openapi?: {
17
+ docsUi?: boolean;
18
+ };
19
+ } | null | undefined): boolean;
20
+ /** Where that reference lives, for anything that wants to link to it. */
21
+ export declare const API_DOCS_PATH = "/api/docs";
22
+ //# sourceMappingURL=docs-ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-ui.d.ts","sourceRoot":"","sources":["../../src/lib/api/docs-ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,WAE7F;AAED,yEAAyE;AACzE,eAAO,MAAM,aAAa,cAAc,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Whether this instance serves the rendered API reference at `GET /api/docs`.
3
+ *
4
+ * Its own tiny module, no imports, for the same reason as `limits.ts`: the
5
+ * route that mounts the page and the admin UI that links to it have to agree,
6
+ * and two copies of `!== false` agree right up until someone changes one of
7
+ * them. A link to a 404 is worse than no link.
8
+ *
9
+ * On by default. The page is authenticated, so anyone who can load it could
10
+ * already read `/api/openapi.json` — this instance's whole content model — and
11
+ * the page shows them nothing further. The one thing it does that the JSON
12
+ * endpoint doesn't is load Scalar from a public CDN, so `docsUi: false` is the
13
+ * switch for a deployment that shouldn't pull third-party scripts.
14
+ */
15
+ export function isApiDocsEnabled(config) {
16
+ return config?.openapi?.docsUi !== false;
17
+ }
18
+ /** Where that reference lives, for anything that wants to link to it. */
19
+ export const API_DOCS_PATH = '/api/docs';
@@ -91,6 +91,17 @@ export declare const listAssetsResponse: z.ZodObject<{
91
91
  hasNextPage: z.ZodBoolean;
92
92
  hasPrevPage: z.ZodBoolean;
93
93
  }, z.core.$strip>;
94
+ indexing: z.ZodBoolean;
95
+ limits: z.ZodObject<{
96
+ maxUploadBytes: z.ZodNumber;
97
+ allowedMimeTypes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
98
+ directUpload: z.ZodBoolean;
99
+ }, z.core.$strip>;
100
+ images: z.ZodNullable<z.ZodObject<{
101
+ widths: z.ZodArray<z.ZodNumber>;
102
+ quality: z.ZodNumber;
103
+ configHash: z.ZodString;
104
+ }, z.core.$strip>>;
94
105
  }, z.core.$strip>;
95
106
  export declare const getAssetResponse: z.ZodObject<{
96
107
  success: z.ZodLiteral<true>;
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/lib/api/schemas/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;iBAuBT,CAAC;AAEhB,eAAO,MAAM,oBAAoB;;;;;;iBAW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,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -81,7 +81,31 @@ export const listAssetsResponse = z.object({
81
81
  totalPages: z.number(),
82
82
  hasNextPage: z.boolean(),
83
83
  hasPrevPage: z.boolean()
84
+ }),
85
+ /**
86
+ * True when a `usage` filter was requested before the asset-reference index
87
+ * exists, so the admin can say "indexing" rather than present an empty or
88
+ * wholly-unused library as fact.
89
+ */
90
+ indexing: z.boolean(),
91
+ /**
92
+ * Server-side upload limits, reported so a client can refuse an oversized file
93
+ * before sending it instead of hardcoding a number that drifts.
94
+ */
95
+ limits: z.object({
96
+ maxUploadBytes: z.number(),
97
+ allowedMimeTypes: z.array(z.string()).nullable().optional(),
98
+ /** Whether `/assets/upload-url` will work — depends on adapter and config. */
99
+ directUpload: z.boolean()
100
+ }),
101
+ /** Responsive-variant config, or null when image processing is off. */
102
+ images: z
103
+ .object({
104
+ widths: z.array(z.number()),
105
+ quality: z.number(),
106
+ configHash: z.string()
84
107
  })
108
+ .nullable()
85
109
  });
86
110
  // ---------- GET /assets/[id] ----------
87
111
  export const getAssetResponse = z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"auth-hooks.d.ts","sourceRoot":"","sources":["../../src/lib/auth/auth-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAQ,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkB/C,wBAAsB,cAAc,CACnC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,eAAe,EACnB,YAAY,EAAE,YAAY,GACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA2J1B"}
1
+ {"version":3,"file":"auth-hooks.d.ts","sourceRoot":"","sources":["../../src/lib/auth/auth-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAQ,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkB/C,wBAAsB,cAAc,CACnC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,eAAe,EACnB,YAAY,EAAE,YAAY,GACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA8J1B"}
@@ -84,7 +84,10 @@ export async function handleAuthHook(event, config, authProvider, db, rolesServi
84
84
  '/api/invitations',
85
85
  '/api/roles',
86
86
  '/api/settings',
87
- '/api/instance-settings'
87
+ '/api/instance-settings',
88
+ // The generated spec enumerates this deployment's whole content model.
89
+ // No content, but not for anonymous callers either.
90
+ '/api/openapi.json'
88
91
  ];
89
92
  if (graphqlEndpoint) {
90
93
  protectedApiRoutes.push(graphqlEndpoint);
@@ -16,6 +16,7 @@
16
16
  * no image at all.
17
17
  */
18
18
  import { ImageOff } from '@lucide/svelte';
19
+ import type { Snippet } from 'svelte';
19
20
  import { browserCanDecodeImage } from '../../utils/image-support';
20
21
 
21
22
  interface Props {
@@ -29,9 +30,26 @@
29
30
  mimeType?: string | null;
30
31
  /** Caption under the placeholder icon. Omit in tiles too small to read it. */
31
32
  label?: string;
33
+ /**
34
+ * Rendered instead of the `ImageOff` placeholder when there is nothing to
35
+ * show. For an avatar or a logo the meaningful empty state is the initials
36
+ * block the surrounding component already draws when no image is set —
37
+ * falling back to it keeps a *failed* load looking like an *absent* one,
38
+ * rather than introducing a second, unrelated empty state.
39
+ */
40
+ fallback?: Snippet;
32
41
  }
33
42
 
34
- let { src, alt = '', class: className = '', style, loading, mimeType, label }: Props = $props();
43
+ let {
44
+ src,
45
+ alt = '',
46
+ class: className = '',
47
+ style,
48
+ loading,
49
+ mimeType,
50
+ label,
51
+ fallback
52
+ }: Props = $props();
35
53
 
36
54
  // Keyed by the src that failed rather than a bare boolean: pointing this
37
55
  // instance at a different asset must get a fresh attempt, or one broken image
@@ -42,16 +60,20 @@
42
60
  </script>
43
61
 
44
62
  {#if showPlaceholder}
45
- <div
46
- class="bg-muted/40 text-muted-foreground flex flex-col items-center justify-center gap-1 {className}"
47
- {style}
48
- title={label ?? alt}
49
- >
50
- <ImageOff class="h-4 w-4 shrink-0" />
51
- {#if label}
52
- <span class="px-2 text-center text-[10px] leading-tight">{label}</span>
53
- {/if}
54
- </div>
63
+ {#if fallback}
64
+ {@render fallback()}
65
+ {:else}
66
+ <div
67
+ class="bg-muted/40 text-muted-foreground flex flex-col items-center justify-center gap-1 {className}"
68
+ {style}
69
+ title={label ?? alt}
70
+ >
71
+ <ImageOff class="h-4 w-4 shrink-0" />
72
+ {#if label}
73
+ <span class="px-2 text-center text-[10px] leading-tight">{label}</span>
74
+ {/if}
75
+ </div>
76
+ {/if}
55
77
  {:else}
56
78
  <img {src} {alt} class={className} {style} {loading} onerror={() => (failedSrc = src ?? null)} />
57
79
  {/if}
@@ -1,3 +1,4 @@
1
+ import type { Snippet } from 'svelte';
1
2
  interface Props {
2
3
  src: string | null | undefined;
3
4
  alt?: string;
@@ -9,6 +10,14 @@ interface Props {
9
10
  mimeType?: string | null;
10
11
  /** Caption under the placeholder icon. Omit in tiles too small to read it. */
11
12
  label?: string;
13
+ /**
14
+ * Rendered instead of the `ImageOff` placeholder when there is nothing to
15
+ * show. For an avatar or a logo the meaningful empty state is the initials
16
+ * block the surrounding component already draws when no image is set —
17
+ * falling back to it keeps a *failed* load looking like an *absent* one,
18
+ * rather than introducing a second, unrelated empty state.
19
+ */
20
+ fallback?: Snippet;
12
21
  }
13
22
  declare const AssetImage: import("svelte").Component<Props, {}, "">;
14
23
  type AssetImage = ReturnType<typeof AssetImage>;
@@ -1 +1 @@
1
- {"version":3,"file":"AssetImage.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/admin/AssetImage.svelte.ts"],"names":[],"mappings":"AAuBC,UAAU,KAAK;IACd,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AA8BF,QAAA,MAAM,UAAU,2CAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"AssetImage.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/admin/AssetImage.svelte.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIrC,UAAU,KAAK;IACd,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AA4CF,QAAA,MAAM,UAAU,2CAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
@@ -17,6 +17,7 @@
17
17
  SidebarMenuButton,
18
18
  useSidebar
19
19
  } from '@aphexcms/ui/shadcn/sidebar';
20
+ import AssetImage from '../admin/AssetImage.svelte';
20
21
  import type { SidebarOrganization } from '../../types/sidebar';
21
22
  import { cn } from '../../utils';
22
23
  import { toast } from 'svelte-sonner';
@@ -120,22 +121,22 @@
120
121
  disabled={isSwitching}
121
122
  >
122
123
  {#if activeOrganization}
123
- {#if getOrganizationLogo(activeOrganization)}
124
- <img
125
- src={getOrganizationLogo(activeOrganization)!}
126
- alt={activeOrganization.name}
127
- class={cn(
128
- 'aspect-square size-8 object-cover',
129
- shouldInvertOrganizationLogo(activeOrganization) && 'dark:invert'
130
- )}
131
- />
132
- {:else}
124
+ {#snippet activeOrgInitials()}
133
125
  <div
134
126
  class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg text-sm font-semibold"
135
127
  >
136
- {getOrganizationInitials(activeOrganization.name)}
128
+ {getOrganizationInitials(activeOrganization!.name)}
137
129
  </div>
138
- {/if}
130
+ {/snippet}
131
+ <AssetImage
132
+ src={getOrganizationLogo(activeOrganization)}
133
+ alt={activeOrganization.name}
134
+ class={cn(
135
+ 'aspect-square size-8 object-cover',
136
+ shouldInvertOrganizationLogo(activeOrganization) && 'dark:invert'
137
+ )}
138
+ fallback={activeOrgInitials}
139
+ />
139
140
  <div class="grid flex-1 text-left text-sm leading-tight">
140
141
  <span class="truncate font-medium">
141
142
  {activeOrganization.name}
@@ -185,22 +186,22 @@
185
186
  onclick={() => handleSwitchOrganization(org)}
186
187
  disabled={isSwitching}
187
188
  >
188
- {#if getOrganizationLogo(org)}
189
- <img
190
- src={getOrganizationLogo(org)!}
191
- alt={org.name}
192
- class={cn(
193
- 'size-8 shrink-0 rounded-md object-cover',
194
- shouldInvertOrganizationLogo(org) && 'dark:invert'
195
- )}
196
- />
197
- {:else}
189
+ {#snippet orgInitials()}
198
190
  <div
199
191
  class="bg-primary text-primary-foreground flex size-8 shrink-0 items-center justify-center rounded-md text-xs font-semibold"
200
192
  >
201
193
  {getOrganizationInitials(org.name)}
202
194
  </div>
203
- {/if}
195
+ {/snippet}
196
+ <AssetImage
197
+ src={getOrganizationLogo(org)}
198
+ alt={org.name}
199
+ class={cn(
200
+ 'size-8 shrink-0 rounded-md object-cover',
201
+ shouldInvertOrganizationLogo(org) && 'dark:invert'
202
+ )}
203
+ fallback={orgInitials}
204
+ />
204
205
  <div class="min-w-0 flex-1">
205
206
  <div class="flex items-center justify-between">
206
207
  <p class="truncate font-medium">{org.name}</p>
@@ -1 +1 @@
1
- {"version":3,"file":"OrganizationSwitcher.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/layout/OrganizationSwitcher.svelte.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK9D,KAAK,KAAK,GAAG;IACZ,aAAa,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACtC,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC,CAAC;AAiMH,QAAA,MAAM,oBAAoB,2CAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"OrganizationSwitcher.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/layout/OrganizationSwitcher.svelte.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK9D,KAAK,KAAK,GAAG;IACZ,aAAa,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACtC,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC,CAAC;AAgMH,QAAA,MAAM,oBAAoB,2CAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
@@ -14,6 +14,7 @@
14
14
  DropdownMenuTrigger
15
15
  } from '@aphexcms/ui/shadcn/dropdown-menu';
16
16
  import { ChevronsUpDown, Settings, LogOut, Mail, Shield } from '@lucide/svelte';
17
+ import AssetImage from '../../admin/AssetImage.svelte';
17
18
  import type { SidebarUser } from '../../../types/sidebar';
18
19
 
19
20
  type Props = {
@@ -37,24 +38,30 @@
37
38
  <DropdownMenu>
38
39
  <DropdownMenuTrigger>
39
40
  {#snippet child({ props })}
41
+ <!-- Declared here, not inside SidebarMenuButton: a snippet that is a
42
+ direct child of a component is passed to it as a prop. -->
43
+ {#snippet userInitial()}
44
+ <div
45
+ class="bg-sidebar-primary text-sidebar-primary-foreground flex h-8 w-8 items-center justify-center rounded-lg text-sm font-semibold"
46
+ >
47
+ {user.name?.[0]?.toUpperCase() || user.email[0]?.toUpperCase()}
48
+ </div>
49
+ {/snippet}
40
50
  <SidebarMenuButton
41
51
  {...props}
42
52
  size="lg"
43
53
  class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground cursor-pointer"
44
54
  >
45
- {#if user.image}
46
- <img
47
- src={user.image}
48
- alt={user.name || user.email}
49
- class="h-8 w-8 rounded-lg object-cover"
50
- />
51
- {:else}
52
- <div
53
- class="bg-sidebar-primary text-sidebar-primary-foreground flex h-8 w-8 items-center justify-center rounded-lg text-sm font-semibold"
54
- >
55
- {user.name?.[0]?.toUpperCase() || user.email[0]?.toUpperCase()}
56
- </div>
57
- {/if}
55
+ <!-- An avatar URL that 404s (a deleted upload, an expired remote
56
+ avatar) fell through to the browser's broken-image glyph. Route
57
+ it through AssetImage so a failed load lands on the same initials
58
+ block as no avatar at all. -->
59
+ <AssetImage
60
+ src={user.image}
61
+ alt={user.name || user.email}
62
+ class="h-8 w-8 rounded-lg object-cover"
63
+ fallback={userInitial}
64
+ />
58
65
  {#if sidebar.isMobile || sidebar.state !== 'collapsed'}
59
66
  <div class="grid flex-1 text-left text-sm leading-tight">
60
67
  <span class="truncate font-medium">{user.name || user.email}</span>
@@ -1 +1 @@
1
- {"version":3,"file":"NavUser.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/sidebar/NavUser.svelte.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGzD,KAAK,KAAK,GAAG;IACZ,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC,CAAC;AA2EH,QAAA,MAAM,OAAO,2CAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"NavUser.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/sidebar/NavUser.svelte.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGzD,KAAK,KAAK,GAAG;IACZ,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC,CAAC;AA6EH,QAAA,MAAM,OAAO,2CAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/server/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA6B7C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG;IACtB,SAAS,EAAE;QACV,QAAQ,EAAE,YAAY,CAAC;QACvB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;KAClB,CAAC;IACF,QAAQ,EAAE;QACT,QAAQ,EAAE,YAAY,CAAC;QACvB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;QAClB,wEAAwE;QACxE,aAAa,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,cAAc,kGAqC7B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,QAmGrD;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AA0C1D;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,IACtE,GAAG,OAAO,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,uBAejD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/server/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA8B7C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG;IACtB,SAAS,EAAE;QACV,QAAQ,EAAE,YAAY,CAAC;QACvB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;KAClB,CAAC;IACF,QAAQ,EAAE;QACT,QAAQ,EAAE,YAAY,CAAC;QACvB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;QAClB,wEAAwE;QACxE,aAAa,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,cAAc,kGAqC7B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,QA0GrD;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AA0C1D;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,IACtE,GAAG,OAAO,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,uBAejD"}
@@ -26,6 +26,7 @@ import { workersRunRouter } from './routes/workers-run.js';
26
26
  import { jobsRouter } from './routes/jobs.js';
27
27
  import { agentChatRouter } from './routes/agent-chat.js';
28
28
  import { agentChangeSetsRouter } from './routes/agent-change-sets.js';
29
+ import { openapiRouter, openapiDocsRouter } from './routes/openapi.js';
29
30
  /**
30
31
  * Build the Aphex API Hono app shell.
31
32
  *
@@ -118,6 +119,12 @@ export function mountAphexBuiltins(app) {
118
119
  app.route('/internal/workers', workersRunRouter);
119
120
  // Read-only job/event history (observability). → GET /api/jobs, GET /api/events
120
121
  app.route('/', jobsRouter);
122
+ // Machine-readable description of everything mounted above, generated from the
123
+ // zod contracts and this instance's schema types. → GET /api/openapi.json
124
+ app.route('/openapi.json', openapiRouter);
125
+ // Rendered reference over that document. Static shell; it fetches the spec
126
+ // client-side, so it needs no auth of its own. → GET /api/docs
127
+ app.route('/docs', openapiDocsRouter);
121
128
  // In-admin agent streaming chat — 404s unless `aiProvider` is configured.
122
129
  // → POST /api/agent/chat
123
130
  app.route('/agent', agentChatRouter);
@@ -0,0 +1,13 @@
1
+ import type { SchemaType } from '../../../types/schemas.js';
2
+ import { type JsonSchema } from './json-schema.js';
3
+ export interface OpenApiOptions {
4
+ /** Document types drive the per-collection request bodies. */
5
+ schemaTypes?: SchemaType[];
6
+ /** Server URL to advertise, e.g. `https://cms.example.com`. */
7
+ serverUrl?: string;
8
+ title?: string;
9
+ version?: string;
10
+ }
11
+ /** Build the full OpenAPI document. */
12
+ export declare function generateOpenApiDocument(options?: OpenApiOptions): JsonSchema;
13
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/api/openapi/generate.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAIN,KAAK,UAAU,EACf,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,cAAc;IAC9B,8DAA8D;IAC9D,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAmeD,uCAAuC;AACvC,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,cAAmB,GAAG,UAAU,CAyEhF"}