@aphexcms/cms-core 11.3.0 → 12.0.0-next.20261109084846

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 (227) hide show
  1. package/dist/admin/client-auth.svelte.d.ts +120 -0
  2. package/dist/admin/client-auth.svelte.d.ts.map +1 -0
  3. package/dist/admin/client-auth.svelte.js +14 -0
  4. package/dist/admin/client-config.d.ts +72 -0
  5. package/dist/admin/client-config.d.ts.map +1 -0
  6. package/dist/admin/client-config.js +1 -0
  7. package/dist/admin/settings-header-actions.d.ts +12 -0
  8. package/dist/admin/settings-header-actions.d.ts.map +1 -0
  9. package/dist/admin/settings-header-actions.js +1 -0
  10. package/dist/admin/view-data.d.ts +189 -0
  11. package/dist/admin/view-data.d.ts.map +1 -0
  12. package/dist/admin/view-data.js +1 -0
  13. package/dist/admin.css +6 -0
  14. package/dist/api/invitations.d.ts +2 -2
  15. package/dist/api/invitations.d.ts.map +1 -1
  16. package/dist/api/organizations.d.ts +5 -4
  17. package/dist/api/organizations.d.ts.map +1 -1
  18. package/dist/api/organizations.js +2 -3
  19. package/dist/api/user.d.ts +6 -1
  20. package/dist/api/user.d.ts.map +1 -1
  21. package/dist/api/user.js +7 -0
  22. package/dist/app-augment.d.ts +2 -3
  23. package/dist/app-augment.d.ts.map +1 -1
  24. package/dist/app.d.ts +1 -1
  25. package/dist/auth/auth-errors.d.ts +6 -0
  26. package/dist/auth/auth-errors.d.ts.map +1 -1
  27. package/dist/auth/auth-errors.js +8 -0
  28. package/dist/auth/auth-hooks.d.ts.map +1 -1
  29. package/dist/auth/auth-hooks.js +36 -17
  30. package/dist/auth/invitation-email.d.ts +9 -0
  31. package/dist/auth/invitation-email.d.ts.map +1 -0
  32. package/dist/auth/invitation-email.js +49 -0
  33. package/dist/auth/pages.d.ts +16 -0
  34. package/dist/auth/pages.d.ts.map +1 -0
  35. package/dist/auth/pages.js +23 -0
  36. package/dist/auth/provider.d.ts +31 -1
  37. package/dist/auth/provider.d.ts.map +1 -1
  38. package/dist/client/index.d.ts +5 -0
  39. package/dist/client/index.d.ts.map +1 -1
  40. package/dist/client/index.js +9 -0
  41. package/dist/client/ui.d.ts +16 -0
  42. package/dist/client/ui.d.ts.map +1 -1
  43. package/dist/client/ui.js +26 -1
  44. package/dist/components/AphexStudio.svelte +268 -0
  45. package/dist/components/AphexStudio.svelte.d.ts +16 -0
  46. package/dist/components/AphexStudio.svelte.d.ts.map +1 -0
  47. package/dist/components/admin/AccountSettings.svelte +339 -0
  48. package/dist/components/admin/AccountSettings.svelte.d.ts +8 -0
  49. package/dist/components/admin/AccountSettings.svelte.d.ts.map +1 -0
  50. package/dist/components/admin/AccountSettingsView.svelte +61 -0
  51. package/dist/components/admin/AccountSettingsView.svelte.d.ts +19 -0
  52. package/dist/components/admin/AccountSettingsView.svelte.d.ts.map +1 -0
  53. package/dist/components/admin/ApiKeysSettings.svelte +435 -0
  54. package/dist/components/admin/ApiKeysSettings.svelte.d.ts +15 -0
  55. package/dist/components/admin/ApiKeysSettings.svelte.d.ts.map +1 -0
  56. package/dist/components/admin/AuthPageShell.svelte +32 -0
  57. package/dist/components/admin/AuthPageShell.svelte.d.ts +16 -0
  58. package/dist/components/admin/AuthPageShell.svelte.d.ts.map +1 -0
  59. package/dist/components/admin/CreateOrganization.svelte +158 -0
  60. package/dist/components/admin/CreateOrganization.svelte.d.ts +11 -0
  61. package/dist/components/admin/CreateOrganization.svelte.d.ts.map +1 -0
  62. package/dist/components/admin/DeleteAccountSettings.svelte +124 -0
  63. package/dist/components/admin/DeleteAccountSettings.svelte.d.ts +7 -0
  64. package/dist/components/admin/DeleteAccountSettings.svelte.d.ts.map +1 -0
  65. package/dist/components/admin/DeleteOrganizationSettings.svelte +123 -0
  66. package/dist/components/admin/DeleteOrganizationSettings.svelte.d.ts +11 -0
  67. package/dist/components/admin/DeleteOrganizationSettings.svelte.d.ts.map +1 -0
  68. package/dist/components/admin/DocumentEditor.svelte +92 -22
  69. package/dist/components/admin/DocumentEditor.svelte.d.ts.map +1 -1
  70. package/dist/components/admin/GeneralSettings.svelte +45 -0
  71. package/dist/components/admin/GeneralSettings.svelte.d.ts +10 -0
  72. package/dist/components/admin/GeneralSettings.svelte.d.ts.map +1 -0
  73. package/dist/components/admin/GodModeView.svelte +112 -0
  74. package/dist/components/admin/GodModeView.svelte.d.ts +9 -0
  75. package/dist/components/admin/GodModeView.svelte.d.ts.map +1 -0
  76. package/dist/components/admin/InvitationsView.svelte +277 -0
  77. package/dist/components/admin/InvitationsView.svelte.d.ts +11 -0
  78. package/dist/components/admin/InvitationsView.svelte.d.ts.map +1 -0
  79. package/dist/components/admin/InviteView.svelte +98 -0
  80. package/dist/components/admin/InviteView.svelte.d.ts +9 -0
  81. package/dist/components/admin/InviteView.svelte.d.ts.map +1 -0
  82. package/dist/components/admin/LoginView.svelte +478 -0
  83. package/dist/components/admin/LoginView.svelte.d.ts +5 -0
  84. package/dist/components/admin/LoginView.svelte.d.ts.map +1 -0
  85. package/dist/components/admin/MembersSettings.svelte +25 -3
  86. package/dist/components/admin/MembersSettings.svelte.d.ts +5 -1
  87. package/dist/components/admin/MembersSettings.svelte.d.ts.map +1 -1
  88. package/dist/components/admin/OrganizationSettings.svelte +367 -0
  89. package/dist/components/admin/OrganizationSettings.svelte.d.ts +9 -0
  90. package/dist/components/admin/OrganizationSettings.svelte.d.ts.map +1 -0
  91. package/dist/components/admin/OrganizationsList.svelte +92 -0
  92. package/dist/components/admin/OrganizationsList.svelte.d.ts +8 -0
  93. package/dist/components/admin/OrganizationsList.svelte.d.ts.map +1 -0
  94. package/dist/components/admin/OrganizationsView.svelte +31 -0
  95. package/dist/components/admin/OrganizationsView.svelte.d.ts +9 -0
  96. package/dist/components/admin/OrganizationsView.svelte.d.ts.map +1 -0
  97. package/dist/components/admin/PasswordInput.svelte +43 -0
  98. package/dist/components/admin/PasswordInput.svelte.d.ts +8 -0
  99. package/dist/components/admin/PasswordInput.svelte.d.ts.map +1 -0
  100. package/dist/components/admin/PasswordSettings.svelte +179 -0
  101. package/dist/components/admin/PasswordSettings.svelte.d.ts +4 -0
  102. package/dist/components/admin/PasswordSettings.svelte.d.ts.map +1 -0
  103. package/dist/components/admin/PreferencesSettings.svelte +80 -0
  104. package/dist/components/admin/PreferencesSettings.svelte.d.ts +20 -0
  105. package/dist/components/admin/PreferencesSettings.svelte.d.ts.map +1 -0
  106. package/dist/components/admin/ResetPasswordView.svelte +117 -0
  107. package/dist/components/admin/ResetPasswordView.svelte.d.ts +9 -0
  108. package/dist/components/admin/ResetPasswordView.svelte.d.ts.map +1 -0
  109. package/dist/components/admin/RolesSettings.svelte +360 -0
  110. package/dist/components/admin/RolesSettings.svelte.d.ts +11 -0
  111. package/dist/components/admin/RolesSettings.svelte.d.ts.map +1 -0
  112. package/dist/components/admin/SchemaField.svelte +2 -1
  113. package/dist/components/admin/SchemaField.svelte.d.ts.map +1 -1
  114. package/dist/components/admin/SettingsHeaderActions.svelte +25 -0
  115. package/dist/components/admin/SettingsHeaderActions.svelte.d.ts +8 -0
  116. package/dist/components/admin/SettingsHeaderActions.svelte.d.ts.map +1 -0
  117. package/dist/components/admin/SettingsShell.svelte +136 -0
  118. package/dist/components/admin/SettingsShell.svelte.d.ts +9 -0
  119. package/dist/components/admin/SettingsShell.svelte.d.ts.map +1 -0
  120. package/dist/components/admin/TwoFactorChallengeView.svelte +377 -0
  121. package/dist/components/admin/TwoFactorChallengeView.svelte.d.ts +11 -0
  122. package/dist/components/admin/TwoFactorChallengeView.svelte.d.ts.map +1 -0
  123. package/dist/components/admin/TwoFactorSettings.svelte +436 -0
  124. package/dist/components/admin/TwoFactorSettings.svelte.d.ts +7 -0
  125. package/dist/components/admin/TwoFactorSettings.svelte.d.ts.map +1 -0
  126. package/dist/components/admin/fields/ImageField.svelte +4 -2
  127. package/dist/components/admin/fields/richtext/PortableTextImageView.svelte +3 -2
  128. package/dist/components/admin/fields/richtext/RichtextField.svelte +48 -6
  129. package/dist/components/admin/fields/richtext/RichtextField.svelte.d.ts.map +1 -1
  130. package/dist/components/layout/sidebar/NavUser.svelte +2 -2
  131. package/dist/config.d.ts +2 -1
  132. package/dist/config.d.ts.map +1 -1
  133. package/dist/email/index.d.ts +1 -0
  134. package/dist/email/index.d.ts.map +1 -1
  135. package/dist/email/index.js +2 -0
  136. package/dist/email/interfaces/email.d.ts +2 -0
  137. package/dist/email/interfaces/email.d.ts.map +1 -1
  138. package/dist/email/link-email.d.ts +15 -0
  139. package/dist/email/link-email.d.ts.map +1 -0
  140. package/dist/email/link-email.js +30 -0
  141. package/dist/field-validation/utils.d.ts +29 -0
  142. package/dist/field-validation/utils.d.ts.map +1 -1
  143. package/dist/field-validation/utils.js +138 -5
  144. package/dist/graphql/index.d.ts.map +1 -1
  145. package/dist/graphql/index.js +1 -1
  146. package/dist/hooks.d.ts +6 -3
  147. package/dist/hooks.d.ts.map +1 -1
  148. package/dist/hooks.js +53 -17
  149. package/dist/jobs/recurring.d.ts +4 -1
  150. package/dist/jobs/recurring.d.ts.map +1 -1
  151. package/dist/jobs/recurring.js +28 -0
  152. package/dist/local-api/auth-helpers.d.ts +4 -4
  153. package/dist/local-api/auth-helpers.js +4 -4
  154. package/dist/local-api/collection-api.d.ts +10 -1
  155. package/dist/local-api/collection-api.d.ts.map +1 -1
  156. package/dist/local-api/collection-api.js +25 -7
  157. package/dist/local-api/index.d.ts +1 -1
  158. package/dist/local-api/index.d.ts.map +1 -1
  159. package/dist/local-api/index.js +7 -5
  160. package/dist/local-api/types.d.ts +1 -1
  161. package/dist/preview/perspective.d.ts +1 -1
  162. package/dist/preview/perspective.js +1 -1
  163. package/dist/resolve-config.d.ts +22 -0
  164. package/dist/resolve-config.d.ts.map +1 -0
  165. package/dist/resolve-config.js +106 -0
  166. package/dist/routes/assets-cdn.d.ts +7 -2
  167. package/dist/routes/assets-cdn.d.ts.map +1 -1
  168. package/dist/routes/assets-cdn.js +1 -1
  169. package/dist/server/api/index.d.ts +1 -2
  170. package/dist/server/api/index.d.ts.map +1 -1
  171. package/dist/server/api/index.js +10 -3
  172. package/dist/server/api/openapi/registry.d.ts.map +1 -1
  173. package/dist/server/api/openapi/registry.js +62 -0
  174. package/dist/server/api/routes/api-keys.d.ts +4 -0
  175. package/dist/server/api/routes/api-keys.d.ts.map +1 -0
  176. package/dist/server/api/routes/api-keys.js +88 -0
  177. package/dist/server/api/routes/documents-by-id.d.ts.map +1 -1
  178. package/dist/server/api/routes/documents-by-id.js +16 -1
  179. package/dist/server/api/routes/documents-publish.d.ts.map +1 -1
  180. package/dist/server/api/routes/documents-publish.js +11 -1
  181. package/dist/server/api/routes/documents.d.ts.map +1 -1
  182. package/dist/server/api/routes/documents.js +16 -2
  183. package/dist/server/api/routes/instance-settings.d.ts +4 -0
  184. package/dist/server/api/routes/instance-settings.d.ts.map +1 -0
  185. package/dist/server/api/routes/instance-settings.js +47 -0
  186. package/dist/server/api/routes/invitations.d.ts +9 -0
  187. package/dist/server/api/routes/invitations.d.ts.map +1 -0
  188. package/dist/server/api/routes/invitations.js +79 -0
  189. package/dist/server/api/routes/organizations-invitations.d.ts +0 -6
  190. package/dist/server/api/routes/organizations-invitations.d.ts.map +1 -1
  191. package/dist/server/api/routes/organizations-invitations.js +6 -7
  192. package/dist/server/api/routes/organizations-team.d.ts.map +1 -1
  193. package/dist/server/api/routes/organizations-team.js +2 -52
  194. package/dist/server/api/routes/organizations.d.ts.map +1 -1
  195. package/dist/server/api/routes/organizations.js +35 -9
  196. package/dist/server/core-routes.d.ts +8 -0
  197. package/dist/server/core-routes.d.ts.map +1 -0
  198. package/dist/server/core-routes.js +67 -0
  199. package/dist/server/index.d.ts +5 -1
  200. package/dist/server/index.d.ts.map +1 -1
  201. package/dist/server/index.js +7 -1
  202. package/dist/server/pages/admin.d.ts +24 -0
  203. package/dist/server/pages/admin.d.ts.map +1 -0
  204. package/dist/server/pages/admin.js +468 -0
  205. package/dist/server/queries/organization-team.d.ts +14 -0
  206. package/dist/server/queries/organization-team.d.ts.map +1 -0
  207. package/dist/server/queries/organization-team.js +65 -0
  208. package/dist/server/queries/pending-invitations.d.ts +8 -0
  209. package/dist/server/queries/pending-invitations.d.ts.map +1 -0
  210. package/dist/server/queries/pending-invitations.js +24 -0
  211. package/dist/types/api-key.d.ts +18 -0
  212. package/dist/types/api-key.d.ts.map +1 -0
  213. package/dist/types/api-key.js +1 -0
  214. package/dist/types/auth.d.ts +35 -0
  215. package/dist/types/auth.d.ts.map +1 -1
  216. package/dist/types/capabilities.d.ts +1 -2
  217. package/dist/types/capabilities.d.ts.map +1 -1
  218. package/dist/types/config.d.ts +124 -4
  219. package/dist/types/config.d.ts.map +1 -1
  220. package/dist/types/filters.d.ts +1 -1
  221. package/dist/types/index.d.ts +1 -0
  222. package/dist/types/index.d.ts.map +1 -1
  223. package/dist/types/index.js +1 -0
  224. package/dist/types/organization.d.ts +1 -1
  225. package/dist/vite/index.d.ts.map +1 -1
  226. package/dist/vite/index.js +46 -39
  227. package/package.json +19 -29
@@ -0,0 +1,120 @@
1
+ import type { Readable } from 'svelte/store';
2
+ /**
3
+ * Client-side auth seam — the browser twin of the server `AuthProvider`.
4
+ *
5
+ * The account settings panels (change password, two-factor, delete account) are
6
+ * auth mutations, which only the host's auth provider can perform. Core stays
7
+ * provider-agnostic, so instead of importing the host's `authClient` it depends
8
+ * on this interface; the host passes a provider-backed implementation to
9
+ * `<AphexStudio adminAuthClient={…}>`, which publishes it here for the panels to
10
+ * read. The shapes mirror Better Auth's client so a host wrapper is a near
11
+ * pass-through, but any provider that satisfies the interface works.
12
+ */
13
+ /** Result envelope: `{ data?, error? }`, matching Better Auth's client calls. */
14
+ export interface AdminAuthResult<T = unknown> {
15
+ data?: T | null;
16
+ error?: {
17
+ message?: string;
18
+ code?: string;
19
+ } | null;
20
+ }
21
+ /**
22
+ * Reactive session, as a Svelte store. Only `user.twoFactorEnabled` is read by
23
+ * the panels; `refetch` forces an uncached read (the signed session cookie is
24
+ * cached ~60s and isn't rewritten when 2FA toggles).
25
+ */
26
+ export interface AdminSessionState {
27
+ data?: {
28
+ user?: {
29
+ twoFactorEnabled?: boolean | null;
30
+ } | null;
31
+ } | null;
32
+ refetch?: (opts?: {
33
+ query?: {
34
+ disableCookieCache?: boolean;
35
+ };
36
+ }) => Promise<unknown>;
37
+ }
38
+ export interface AdminAuthClient {
39
+ /**
40
+ * Sign-in / sign-up / verification live on the same seam because the embedded
41
+ * login view (`/admin/login`, folded into the admin catch-all) is core-mounted
42
+ * and must drive the host's auth provider without importing it. They are
43
+ * optional: a host that only wants the account-security panels (and keeps its
44
+ * own login route) can omit them, and `LoginView` guards on their presence.
45
+ */
46
+ signIn?(input: {
47
+ email: string;
48
+ password: string;
49
+ }): Promise<AdminAuthResult>;
50
+ signUp?(input: {
51
+ email: string;
52
+ password: string;
53
+ name: string;
54
+ callbackURL?: string;
55
+ }): Promise<AdminAuthResult>;
56
+ sendVerificationEmail?(input: {
57
+ email: string;
58
+ callbackURL?: string;
59
+ }): Promise<AdminAuthResult>;
60
+ /** Ends the session. Without it, the invitations page can't offer to sign out. */
61
+ signOut?(): Promise<unknown>;
62
+ /**
63
+ * Did a successful password check return a two-factor challenge instead of a
64
+ * session? (Better Auth returns `{ twoFactorRedirect: true }`.) Core can't know
65
+ * the provider's shape, so the host answers.
66
+ */
67
+ isTwoFactorRedirect?(data: unknown): boolean;
68
+ changePassword(input: {
69
+ currentPassword: string;
70
+ newPassword: string;
71
+ revokeOtherSessions?: boolean;
72
+ }): Promise<AdminAuthResult>;
73
+ deleteUser(input: {
74
+ password: string;
75
+ }): Promise<AdminAuthResult>;
76
+ twoFactor: {
77
+ enable(input: {
78
+ password: string;
79
+ }): Promise<AdminAuthResult<{
80
+ backupCodes: string[];
81
+ totpURI: string;
82
+ }>>;
83
+ verifyTotp(input: {
84
+ code: string;
85
+ trustDevice?: boolean;
86
+ }): Promise<AdminAuthResult>;
87
+ /**
88
+ * The sign-in challenge's other two ways through. Each is hidden from the
89
+ * challenge page when the host doesn't provide it.
90
+ */
91
+ sendOtp?(): Promise<AdminAuthResult>;
92
+ verifyOtp?(input: {
93
+ code: string;
94
+ trustDevice?: boolean;
95
+ }): Promise<AdminAuthResult>;
96
+ verifyBackupCode?(input: {
97
+ code: string;
98
+ trustDevice?: boolean;
99
+ }): Promise<AdminAuthResult>;
100
+ disable(input: {
101
+ password: string;
102
+ }): Promise<AdminAuthResult>;
103
+ generateBackupCodes(input: {
104
+ password: string;
105
+ }): Promise<AdminAuthResult<{
106
+ backupCodes: string[];
107
+ }>>;
108
+ };
109
+ /** Reactive session store (e.g. Better Auth's `authClient.useSession()`). */
110
+ useSession(): Readable<AdminSessionState>;
111
+ }
112
+ /** Publish the admin auth client to descendants (call once in the shell). */
113
+ export declare function setAdminAuthClient(client: AdminAuthClient): void;
114
+ /**
115
+ * Read the admin auth client. Returns `undefined` when the host didn't provide
116
+ * one — the account security panels guard on it and show a hint rather than
117
+ * throw, so an app that opts out of those panels still renders the rest.
118
+ */
119
+ export declare function useAdminAuthClient(): AdminAuthClient | undefined;
120
+ //# sourceMappingURL=client-auth.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-auth.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/admin/client-auth.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;;;;;;GAUG;AAEH,iFAAiF;AACjF,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC3C,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAChB,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACnD;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE;YAAE,gBAAgB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;S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('aphex.admin.authClient');
3
+ /** Publish the admin auth client to descendants (call once in the shell). */
4
+ export function setAdminAuthClient(client) {
5
+ setContext(ADMIN_AUTH_CLIENT_KEY, client);
6
+ }
7
+ /**
8
+ * Read the admin auth client. Returns `undefined` when the host didn't provide
9
+ * one — the account security panels guard on it and show a hint rather than
10
+ * throw, so an app that opts out of those panels still renders the rest.
11
+ */
12
+ export function useAdminAuthClient() {
13
+ return getContext(ADMIN_AUTH_CLIENT_KEY);
14
+ }
@@ -0,0 +1,72 @@
1
+ import type { Component } from 'svelte';
2
+ import type { SchemaType } from '../types/index.js';
3
+ import type { CMSPlugin } from '../plugins/types.js';
4
+ import type { BlockPreviewProps } from './block-previews.svelte.js';
5
+ import type { AdminAuthClient } from './client-auth.svelte.js';
6
+ import type { AdminLoginData } from './view-data.js';
7
+ import type { SidebarData } from '../types/sidebar.js';
8
+ /**
9
+ * Props every core-mounted view hands its override. A host that replaces a view
10
+ * gets the same SSR payload, branding and auth client the core view would, so a
11
+ * custom component is a drop-in — fully styled by the host, still served by the
12
+ * one `/admin` catch-all (zero extra route files).
13
+ */
14
+ export interface LoginViewProps {
15
+ data: AdminLoginData;
16
+ /** Branding title (from `AphexClientConfig.title`). */
17
+ title: string;
18
+ /** The host's client auth adapter — `signIn`/`signUp`/`sendVerificationEmail`. */
19
+ authClient?: AdminAuthClient;
20
+ }
21
+ /**
22
+ * Component override map — the editability seam for core-mounted views (Payload's
23
+ * `admin.components`). Each view is frozen-by-default (zero host files) *and* an
24
+ * override point: provide a component and the catch-all renders yours instead,
25
+ * still at the same `/admin/*` URL. Omit it for the core default.
26
+ */
27
+ export interface AphexComponentOverrides {
28
+ /** Replace the `/admin/login` view with your own (keeps it in the catch-all). */
29
+ login?: Component<LoginViewProps>;
30
+ }
31
+ /**
32
+ * The client-side customization seam for the embedded admin — the SvelteKit twin
33
+ * of the server `aphex.config.ts`.
34
+ *
35
+ * SvelteKit's server/client boundary means `aphex.config.ts` (DB, storage, auth
36
+ * adapters — all node-only) can't be imported into a `.svelte` route file. So
37
+ * everything the admin needs *in the browser* is gathered here instead, in one
38
+ * small client-safe module a host exports as `aphex.client.ts` and hands to
39
+ * `<AphexStudio config={...} />`. Keeping it in one object is what lets the mount
40
+ * route files stay frozen re-exports: a host customizes this, never the routes.
41
+ */
42
+ export interface AphexClientConfig {
43
+ /** App-defined content schemas (shared with the server config). */
44
+ schemas: SchemaType[];
45
+ /** Build-time plugins — component parts can't cross a `load` boundary. */
46
+ plugins?: CMSPlugin[];
47
+ /** Inline editor previews for custom rich-text blocks, keyed by `_type`. */
48
+ blockPreviews?: Record<string, Component<BlockPreviewProps>>;
49
+ /**
50
+ * Host-provided client-side auth adapter for the account security panels
51
+ * (change password, two-factor, delete account). The browser twin of the
52
+ * server `AuthProvider`; auth stays host-owned.
53
+ */
54
+ adminAuthClient?: AdminAuthClient;
55
+ /**
56
+ * Overrides the title shown in the studio chrome. Usually leave this unset: the
57
+ * studio uses `customization.branding.title` from the server config.
58
+ */
59
+ title?: string;
60
+ /**
61
+ * Replaces the sidebar's links. Each field you set replaces that tier; the defaults
62
+ * are Home and View site (`/`) in `navItems`, and Activity in `systemNavItems`.
63
+ */
64
+ sidebar?: Pick<SidebarData, 'navGroups' | 'navItems' | 'systemNavItems' | 'secondaryNavItems'>;
65
+ /**
66
+ * Component overrides for core-mounted views (login, …). The escape hatch for
67
+ * "we lose editability": default = frozen core view driven by branding; set an
68
+ * override here to fully customize it while keeping it in the `/admin` catch-all.
69
+ */
70
+ components?: AphexComponentOverrides;
71
+ }
72
+ //# sourceMappingURL=client-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-config.d.ts","sourceRoot":"","sources":["../../src/lib/admin/client-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,UAAU,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACvC,iFAAiF;IACjF,KAAK,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CAClC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IACjC,mEAAmE;IACnE,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC7D;;;;OAIG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,GAAG,gBAAgB,GAAG,mBAAmB,CAAC,CAAC;IAC/F;;;;OAIG;IACH,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACrC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { Snippet } from 'svelte';
2
+ /**
3
+ * Lets a settings panel push buttons into the shared settings header (e.g. a
4
+ * "Create role" action) without the shell hard-coding per-panel knowledge. The
5
+ * shell provides this context; a panel calls `setActions(snippet)` to fill the
6
+ * header's action slot, and `setActions(null)` to clear it.
7
+ */
8
+ export type SettingsHeaderActionContext = {
9
+ setActions: (actions: Snippet | null) => void;
10
+ };
11
+ export declare const settingsHeaderActionContextKey: unique symbol;
12
+ //# sourceMappingURL=settings-header-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-header-actions.d.ts","sourceRoot":"","sources":["../../src/lib/admin/settings-header-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACzC,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,eAAO,MAAM,8BAA8B,eAA6C,CAAC"}
@@ -0,0 +1 @@
1
+ export const settingsHeaderActionContextKey = Symbol.for('aphex.settings.headerActions');
@@ -0,0 +1,189 @@
1
+ import type { UserSessionPreferences, OrganizationTeam, Organization } from '../types/organization.js';
2
+ import type { Role, CapabilityDefinition } from '../types/capabilities.js';
3
+ import type { CMSUser } from '../types/user.js';
4
+ import type { ApiKeySummary } from '../types/api-key.js';
5
+ import type { LoginBranding, SessionAuth } from '../types/auth.js';
6
+ import type { SidebarOrganization } from '../types/sidebar.js';
7
+ import type { PendingInvitation } from '../api/invitations.js';
8
+ /**
9
+ * The data `createAdminLoad` produces for each admin route, discriminated by
10
+ * `view`. `AphexStudio` switches on `view` to pick the component to mount.
11
+ *
12
+ * This lives in a plain (Svelte-free, import-light) module so both the server
13
+ * load helper and the client shell can share the type without dragging server
14
+ * code into the client type graph.
15
+ */
16
+ export interface AdminStudioData {
17
+ view: 'studio';
18
+ documentTypes: Array<{
19
+ name: string;
20
+ title: string;
21
+ description?: string;
22
+ }>;
23
+ schemaError: {
24
+ message: string;
25
+ } | null;
26
+ graphqlSettings: {
27
+ endpoint: string;
28
+ enableGraphiQL: boolean;
29
+ } | null;
30
+ isReadOnly: boolean;
31
+ userPreferences: UserSessionPreferences | null;
32
+ }
33
+ export interface AdminActivityData {
34
+ view: 'activity';
35
+ }
36
+ /**
37
+ * Login view payload. Login is a view in the one admin catch-all (Payload-style:
38
+ * `/admin/login` is served by the same mount, not a separate host route), so an
39
+ * unauthenticated request to any `/admin/*` URL renders this instead of bouncing
40
+ * to a host-owned login page. Mode / prefilled email / one-shot error code are
41
+ * read client-side from the URL; these are the facts only the server knows.
42
+ */
43
+ export interface AdminLoginData {
44
+ view: 'login';
45
+ /** Verification on → sign-up shows a "check your email" step instead of redirecting. */
46
+ requireEmailVerification: boolean;
47
+ /** True only before anyone has signed up — reveals the claim-code field. */
48
+ unclaimed: boolean;
49
+ /** Where sign-up lands once complete (`/admin` for the bootstrap owner, else `/admin/invitations`). */
50
+ signUpDestination: string;
51
+ /**
52
+ * Per-tenant branding resolved server-side from the request (e.g. subdomain →
53
+ * org), or `null` for the default. Lets one deployment show each company its
54
+ * own login. Produced by `config.auth.loginBranding`.
55
+ */
56
+ branding: LoginBranding | null;
57
+ }
58
+ /** Invitations waiting for the signed-in user, who may have no organization yet. */
59
+ export interface AdminInvitationsData {
60
+ view: 'invitations';
61
+ pendingInvitations: PendingInvitation[];
62
+ hasOrganization: boolean;
63
+ canCreateOrganization: boolean;
64
+ userEmail: string;
65
+ branding: LoginBranding | null;
66
+ }
67
+ /** Someone following an invite link. A signed-in invitee is accepted and redirected. */
68
+ export interface AdminInviteData {
69
+ view: 'invite';
70
+ token: string;
71
+ status: 'open' | 'invalid' | 'expired' | 'already_accepted' | 'email_mismatch';
72
+ invitation: {
73
+ email: string;
74
+ role: string;
75
+ } | null;
76
+ organization: {
77
+ name: string;
78
+ slug: string;
79
+ } | null;
80
+ branding: LoginBranding | null;
81
+ }
82
+ /** Someone following a password reset link. */
83
+ export interface AdminResetPasswordData {
84
+ view: 'reset-password';
85
+ token: string;
86
+ branding: LoginBranding | null;
87
+ }
88
+ /** The second step of sign-in: the password was right and there is no session yet. */
89
+ export interface AdminTwoFactorData {
90
+ view: 'two-factor';
91
+ totpAvailable: boolean;
92
+ otpAvailable: boolean;
93
+ branding: LoginBranding | null;
94
+ }
95
+ /**
96
+ * Settings views share one shell (`SettingsShell`); `tab` picks the panel and
97
+ * carries that panel's SSR payload. Grows a member per settings tab as each
98
+ * folds into the catch-all.
99
+ */
100
+ export type AdminSettingsData = {
101
+ view: 'settings';
102
+ tab: 'general';
103
+ organization: Organization | null;
104
+ memberCount: number;
105
+ canDelete: boolean;
106
+ } | {
107
+ view: 'settings';
108
+ tab: 'members';
109
+ team: OrganizationTeam;
110
+ } | {
111
+ view: 'settings';
112
+ tab: 'roles';
113
+ roles: Role[];
114
+ capabilityCatalog: CapabilityDefinition[];
115
+ /** Member count per role name, pre-computed so the panel needs no user join. */
116
+ roleMemberCounts: Record<string, number>;
117
+ } | {
118
+ view: 'settings';
119
+ tab: 'account';
120
+ user: CMSUser;
121
+ userPreferences: UserSessionPreferences | null;
122
+ hasChildOrganizations: boolean;
123
+ totpAvailable: boolean;
124
+ } | {
125
+ view: 'settings';
126
+ tab: 'api-keys';
127
+ apiKeys: ApiKeySummary[];
128
+ organizationRole: string | null;
129
+ /** Path to the rendered API reference, or `null` when that UI is unmounted. */
130
+ apiDocsHref: string | null;
131
+ } | {
132
+ view: 'settings';
133
+ tab: 'plugins';
134
+ };
135
+ /** Union of every admin view's SSR payload. Grows as settings views fold in. */
136
+ export type AdminViewData = AdminStudioData | AdminActivityData | AdminSettingsData | AdminLoginData | AdminInvitationsData | AdminInviteData | AdminResetPasswordData | AdminTwoFactorData | AdminOrganizationsData | AdminGodModeData;
137
+ /** An organization in the lists under `/admin/organizations` and God Mode. */
138
+ export interface AdminOrganizationListItem {
139
+ id: string;
140
+ name: string;
141
+ slug: string;
142
+ role: string;
143
+ isActive: boolean;
144
+ memberCount: number;
145
+ ownerEmail?: string;
146
+ }
147
+ /** The organizations the signed-in user belongs to. */
148
+ export interface AdminOrganizationsData {
149
+ view: 'organizations';
150
+ organizations: AdminOrganizationListItem[];
151
+ /** The organization a new one can go under, if the user administers it. */
152
+ parentOption: {
153
+ id: string;
154
+ name: string;
155
+ } | null;
156
+ }
157
+ /** Administration of the whole instance, for super admins. */
158
+ export type AdminGodModeData = {
159
+ view: 'god-mode';
160
+ tab: 'general';
161
+ } | {
162
+ view: 'god-mode';
163
+ tab: 'organizations';
164
+ organizations: AdminOrganizationListItem[];
165
+ allowUserOrgCreation: boolean;
166
+ };
167
+ /** What the sidebar needs. Every view has it unless it's a full-page one. */
168
+ export interface AdminShellData {
169
+ auth: SessionAuth;
170
+ organizations: SidebarOrganization[];
171
+ activeOrganization?: SidebarOrganization;
172
+ canCreateOrganization: boolean;
173
+ agentEnabled: boolean;
174
+ faviconUrl: string | null;
175
+ }
176
+ /** What `createAdminLoad` returns: the view's data, the server's branding title and the shell. */
177
+ export type AdminPageData = AdminViewData & {
178
+ title?: string;
179
+ /** A full-page view, so there's no sidebar. */
180
+ standalone: boolean;
181
+ /** `null` on a full-page view, or with no full session. */
182
+ shell: AdminShellData | null;
183
+ /** Also read by plugin components through `page.data.rbac`. */
184
+ rbac?: {
185
+ role: string | null;
186
+ capabilities: string[];
187
+ };
188
+ };
189
+ //# sourceMappingURL=view-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-data.d.ts","sourceRoot":"","sources":["../../src/lib/admin/view-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACpG,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC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AAM,gBAAgB,GACzB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,SAAS,CAAA;CAAE,GACpC;IACA,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,eAAe,CAAC;IACrB,aAAa,EAAE,yBAAyB,EAAE,CAAC;IAC3C,oBAAoB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEL,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,kGAAkG;AAClG,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,UAAU,EAAE,OAAO,CAAC;IACpB,2DAA2D;IAC3D,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7B,+DAA+D;IAC/D,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CACvD,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
package/dist/admin.css ADDED
@@ -0,0 +1,6 @@
1
+ /* The admin's styles. Import this from the admin route, so it only loads there. */
2
+ @import 'tailwindcss';
3
+ @import 'tw-animate-css';
4
+ @import '@aphexcms/ui/shadcn/css';
5
+
6
+ @source './**/*.{html,js,svelte,ts}';
@@ -1,11 +1,11 @@
1
- import type { OrganizationRole } from '../types/organization.js';
1
+ import type { OrganizationRoleName } from '../types/organization.js';
2
2
  import type { ApiResponse } from './types.js';
3
3
  export interface PendingInvitation {
4
4
  id: string;
5
5
  organizationId: string;
6
6
  organizationName: string;
7
7
  organizationSlug: string;
8
- role: OrganizationRole;
8
+ role: OrganizationRoleName;
9
9
  email: string;
10
10
  expiresAt: Date;
11
11
  createdAt: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["../../src/lib/api/invitations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACxC,cAAc,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,cAAc;IAC1B;;OAEG;WACU,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAIrE;;OAEG;WACU,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;IAI/E;;OAEG;WACU,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAG3E;AAED,eAAO,MAAM,WAAW;;;;CAIvB,CAAC"}
1
+ {"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["../../src/lib/api/invitations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACxC,cAAc,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,cAAc;IAC1B;;OAEG;WACU,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAIrE;;OAEG;WACU,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;IAI/E;;OAEG;WACU,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAG3E;AAED,eAAO,MAAM,WAAW;;;;CAIvB,CAAC"}
@@ -47,11 +47,12 @@ export declare class OrganizationsApi {
47
47
  */
48
48
  static getTeam(): Promise<ApiResponse<OrganizationTeam>>;
49
49
  /**
50
- * Invite a member to the organization. The response is the invitation row,
51
- * including its `token` — the accept URL is `/invite/<token>`, so a caller
52
- * can hand the link over directly when email isn't an option.
50
+ * Invite a member to the organization. The response is the invitation row plus
51
+ * its accept link, so a caller can hand that over when email isn't an option.
53
52
  */
54
- static inviteMember(data: InviteMemberRequest): Promise<ApiResponse<Invitation>>;
53
+ static inviteMember(data: InviteMemberRequest): Promise<ApiResponse<Invitation & {
54
+ inviteUrl: string;
55
+ }>>;
55
56
  /**
56
57
  * Remove a member from the organization
57
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../src/lib/api/organizations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,UAAU,EAC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,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAI9D;;;OAGG;WACU,YAAY,CACxB,IAAI,EAAE,mBAAmB,GACvB,OAAO,CAAC,WAAW,CAAC,UAAU,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAI3D;;OAEG;WACU,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAIhG;;OAEG;WACU,gBAAgB,CAC5B,IAAI,EAAE,uBAAuB,GAC3B,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAI3C;;OAEG;WACU,MAAM,CAClB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,yBAAyB,GAC7B,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAIrC;;OAEG;WACU,gBAAgB,CAC5B,IAAI,EAAE,uBAAuB,GAC3B,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAI7C;;;OAGG;WACU,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAG3E;AAGD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;CAczB,CAAC"}
@@ -54,9 +54,8 @@ export class OrganizationsApi {
54
54
  return apiClient.get('/organizations/team');
55
55
  }
56
56
  /**
57
- * Invite a member to the organization. The response is the invitation row,
58
- * including its `token` — the accept URL is `/invite/<token>`, so a caller
59
- * can hand the link over directly when email isn't an option.
57
+ * Invite a member to the organization. The response is the invitation row plus
58
+ * its accept link, so a caller can hand that over when email isn't an option.
60
59
  */
61
60
  static async inviteMember(data) {
62
61
  return apiClient.post('/organizations/invitations', data);
@@ -1,8 +1,12 @@
1
1
  import type { CMSUser } from '../types/user.js';
2
2
  import type { ApiResponse } from './types.js';
3
- import type { UpdateUserRequest, UpdateUserPreferencesRequest } from './schemas/user.js';
3
+ import type { UpdateUserRequest, UpdateUserPreferencesRequest, ResetPasswordRequest } from './schemas/user.js';
4
4
  export type UpdateProfileData = UpdateUserRequest;
5
5
  export declare class UserApi {
6
+ /**
7
+ * Set a new password using the token from a reset email. Needs no session.
8
+ */
9
+ static resetPassword(data: ResetPasswordRequest): Promise<ApiResponse<unknown>>;
6
10
  /**
7
11
  * Update user profile
8
12
  */
@@ -15,6 +19,7 @@ export declare class UserApi {
15
19
  }>>;
16
20
  }
17
21
  export declare const user: {
22
+ resetPassword: typeof UserApi.resetPassword;
18
23
  updateProfile: typeof UserApi.updateProfile;
19
24
  updatePreferences: typeof UserApi.updatePreferences;
20
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/lib/api/user.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAItF,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAElD,qBAAa,OAAO;IACnB;;OAEG;WACU,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAIlF;;OAEG;WACU,iBAAiB,CAC7B,KAAK,EAAE,4BAA4B,GACjC,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAG7C;AAED,eAAO,MAAM,IAAI;;;CAGhB,CAAC"}
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/lib/api/user.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EACX,iBAAiB,EACjB,4BAA4B,EAC5B,oBAAoB,EACpB,MAAM,gBAAgB,CAAC;AAIxB,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAElD,qBAAa,OAAO;IACnB;;OAEG;WACU,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAIrF;;OAEG;WACU,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAIlF;;OAEG;WACU,iBAAiB,CAC7B,KAAK,EAAE,4BAA4B,GACjC,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAG7C;AAED,eAAO,MAAM,IAAI;;;;CAIhB,CAAC"}
package/dist/api/user.js CHANGED
@@ -1,6 +1,12 @@
1
1
  // User API client - composable user operations
2
2
  import { apiClient } from './client.js';
3
3
  export class UserApi {
4
+ /**
5
+ * Set a new password using the token from a reset email. Needs no session.
6
+ */
7
+ static async resetPassword(data) {
8
+ return apiClient.post('/user/reset-password', data);
9
+ }
4
10
  /**
5
11
  * Update user profile
6
12
  */
@@ -15,6 +21,7 @@ export class UserApi {
15
21
  }
16
22
  }
17
23
  export const user = {
24
+ resetPassword: UserApi.resetPassword.bind(UserApi),
18
25
  updateProfile: UserApi.updateProfile.bind(UserApi),
19
26
  updatePreferences: UserApi.updatePreferences.bind(UserApi)
20
27
  };
@@ -31,9 +31,8 @@ declare global {
31
31
  }
32
32
  interface PageData {
33
33
  /**
34
- * RBAC snapshot emitted by the admin layout's server load
35
- * (`/admin/+layout.server.ts`). Absent on public routes (login,
36
- * invitations) that don't pass through the admin layout.
34
+ * RBAC snapshot from `createAdminLoad`. Absent on public routes, and on the
35
+ * admin's full-page views (login, invitations).
37
36
  */
38
37
  rbac?: RbacPayload;
39
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"app-augment.d.ts","sourceRoot":"","sources":["../src/lib/app-augment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,GAAG,CAAC;QACb,UAAU,MAAM;YACf;;;;;;eAMG;YACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;SACxC;QACD,UAAU,QAAQ;YACjB;;;;eAIG;YACH,IAAI,CAAC,EAAE,WAAW,CAAC;SACnB;KACD;CACD;AAED,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"app-augment.d.ts","sourceRoot":"","sources":["../src/lib/app-augment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,GAAG,CAAC;QACb,UAAU,MAAM;YACf;;;;;;eAMG;YACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;SACxC;QACD,UAAU,QAAQ;YACjB;;;eAGG;YACH,IAAI,CAAC,EAAE,WAAW,CAAC;SACnB;KACD;CACD;AAED,OAAO,EAAE,CAAC"}
package/dist/app.d.ts CHANGED
@@ -9,7 +9,7 @@ declare global {
9
9
  // interface Error {}
10
10
  interface Locals {
11
11
  aphexCMS: CMSInstances;
12
- auth?: Auth; // Available in protected routes
12
+ aphexAuth?: Auth; // CMS session, populated by the Aphex auth hook on /admin, /api and /media
13
13
  previewPerspective?: PreviewPerspective; // Read perspective, resolved per-request by the CMS hook
14
14
  }
15
15
  // interface PageData {}
@@ -3,5 +3,11 @@ export declare class AuthError extends Error {
3
3
  code: AuthErrorCode;
4
4
  constructor(code: AuthErrorCode, message: string);
5
5
  }
6
+ /**
7
+ * Use this rather than `instanceof`. An auth provider is a separate package that Node
8
+ * can load outside Vite's bundle, with its own copy of this class, so `instanceof` is
9
+ * false for the errors it throws.
10
+ */
11
+ export declare function isAuthError(error: unknown): error is AuthError;
6
12
  export declare function createAuthError(code: AuthErrorCode, message: string): AuthError;
7
13
  //# sourceMappingURL=auth-errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-errors.d.ts","sourceRoot":"","sources":["../../src/lib/auth/auth-errors.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GACtB,YAAY,GACZ,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,GACrB,iBAAiB,GACjB,cAAc,CAAC;AAElB,qBAAa,SAAU,SAAQ,KAAK;IACnC,IAAI,EAAE,aAAa,CAAC;gBAER,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM;CAKhD;AAGD,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAE/E"}
1
+ {"version":3,"file":"auth-errors.d.ts","sourceRoot":"","sources":["../../src/lib/auth/auth-errors.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GACtB,YAAY,GACZ,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,GACrB,iBAAiB,GACjB,cAAc,CAAC;AAElB,qBAAa,SAAU,SAAQ,KAAK;IACnC,IAAI,EAAE,aAAa,CAAC;gBAER,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM;CAKhD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAGD,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAE/E"}
@@ -7,6 +7,14 @@ export class AuthError extends Error {
7
7
  this.name = 'AuthError';
8
8
  }
9
9
  }
10
+ /**
11
+ * Use this rather than `instanceof`. An auth provider is a separate package that Node
12
+ * can load outside Vite's bundle, with its own copy of this class, so `instanceof` is
13
+ * false for the errors it throws.
14
+ */
15
+ export function isAuthError(error) {
16
+ return error instanceof Error && error.name === 'AuthError' && 'code' in error;
17
+ }
10
18
  // Helper function to create auth errors
11
19
  export function createAuthError(code, message) {
12
20
  return new AuthError(code, message);
@@ -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,CA8J1B"}
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;AAmB/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,CAkL1B"}