@aphexcms/cms-core 11.2.1 → 12.0.0-next.20261109083516
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/admin/client-auth.svelte.d.ts +120 -0
- package/dist/admin/client-auth.svelte.d.ts.map +1 -0
- package/dist/admin/client-auth.svelte.js +14 -0
- package/dist/admin/client-config.d.ts +72 -0
- package/dist/admin/client-config.d.ts.map +1 -0
- package/dist/admin/client-config.js +1 -0
- package/dist/admin/settings-header-actions.d.ts +12 -0
- package/dist/admin/settings-header-actions.d.ts.map +1 -0
- package/dist/admin/settings-header-actions.js +1 -0
- package/dist/admin/view-data.d.ts +189 -0
- package/dist/admin/view-data.d.ts.map +1 -0
- package/dist/admin/view-data.js +1 -0
- package/dist/admin.css +6 -0
- package/dist/api/invitations.d.ts +2 -2
- package/dist/api/invitations.d.ts.map +1 -1
- package/dist/api/organizations.d.ts +13 -3
- package/dist/api/organizations.d.ts.map +1 -1
- package/dist/api/organizations.js +11 -1
- package/dist/api/user.d.ts +6 -1
- package/dist/api/user.d.ts.map +1 -1
- package/dist/api/user.js +7 -0
- package/dist/app-augment.d.ts +2 -3
- package/dist/app-augment.d.ts.map +1 -1
- package/dist/app.d.ts +1 -1
- package/dist/auth/auth-errors.d.ts +6 -0
- package/dist/auth/auth-errors.d.ts.map +1 -1
- package/dist/auth/auth-errors.js +8 -0
- package/dist/auth/auth-hooks.d.ts.map +1 -1
- package/dist/auth/auth-hooks.js +36 -17
- package/dist/auth/invitation-email.d.ts +9 -0
- package/dist/auth/invitation-email.d.ts.map +1 -0
- package/dist/auth/invitation-email.js +49 -0
- package/dist/auth/pages.d.ts +16 -0
- package/dist/auth/pages.d.ts.map +1 -0
- package/dist/auth/pages.js +23 -0
- package/dist/auth/provider.d.ts +31 -1
- package/dist/auth/provider.d.ts.map +1 -1
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +9 -0
- package/dist/client/ui.d.ts +17 -0
- package/dist/client/ui.d.ts.map +1 -1
- package/dist/client/ui.js +27 -0
- package/dist/components/AdminApp.svelte +7 -4
- package/dist/components/AdminApp.svelte.d.ts.map +1 -1
- package/dist/components/AphexStudio.svelte +268 -0
- package/dist/components/AphexStudio.svelte.d.ts +16 -0
- package/dist/components/AphexStudio.svelte.d.ts.map +1 -0
- package/dist/components/admin/AccountSettings.svelte +339 -0
- package/dist/components/admin/AccountSettings.svelte.d.ts +8 -0
- package/dist/components/admin/AccountSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/AccountSettingsView.svelte +61 -0
- package/dist/components/admin/AccountSettingsView.svelte.d.ts +19 -0
- package/dist/components/admin/AccountSettingsView.svelte.d.ts.map +1 -0
- package/dist/components/admin/ApiKeysSettings.svelte +435 -0
- package/dist/components/admin/ApiKeysSettings.svelte.d.ts +15 -0
- package/dist/components/admin/ApiKeysSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/AuthPageShell.svelte +32 -0
- package/dist/components/admin/AuthPageShell.svelte.d.ts +16 -0
- package/dist/components/admin/AuthPageShell.svelte.d.ts.map +1 -0
- package/dist/components/admin/CreateOrganization.svelte +158 -0
- package/dist/components/admin/CreateOrganization.svelte.d.ts +11 -0
- package/dist/components/admin/CreateOrganization.svelte.d.ts.map +1 -0
- package/dist/components/admin/DeleteAccountSettings.svelte +124 -0
- package/dist/components/admin/DeleteAccountSettings.svelte.d.ts +7 -0
- package/dist/components/admin/DeleteAccountSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/DeleteOrganizationSettings.svelte +123 -0
- package/dist/components/admin/DeleteOrganizationSettings.svelte.d.ts +11 -0
- package/dist/components/admin/DeleteOrganizationSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/DocumentEditor.svelte +108 -36
- package/dist/components/admin/DocumentEditor.svelte.d.ts.map +1 -1
- package/dist/components/admin/GeneralSettings.svelte +45 -0
- package/dist/components/admin/GeneralSettings.svelte.d.ts +10 -0
- package/dist/components/admin/GeneralSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/GodModeView.svelte +112 -0
- package/dist/components/admin/GodModeView.svelte.d.ts +9 -0
- package/dist/components/admin/GodModeView.svelte.d.ts.map +1 -0
- package/dist/components/admin/InvitationsView.svelte +277 -0
- package/dist/components/admin/InvitationsView.svelte.d.ts +11 -0
- package/dist/components/admin/InvitationsView.svelte.d.ts.map +1 -0
- package/dist/components/admin/InviteView.svelte +98 -0
- package/dist/components/admin/InviteView.svelte.d.ts +9 -0
- package/dist/components/admin/InviteView.svelte.d.ts.map +1 -0
- package/dist/components/admin/LoginView.svelte +478 -0
- package/dist/components/admin/LoginView.svelte.d.ts +5 -0
- package/dist/components/admin/LoginView.svelte.d.ts.map +1 -0
- package/dist/components/admin/MembersSettings.svelte +661 -0
- package/dist/components/admin/MembersSettings.svelte.d.ts +8 -0
- package/dist/components/admin/MembersSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/OrganizationSettings.svelte +367 -0
- package/dist/components/admin/OrganizationSettings.svelte.d.ts +9 -0
- package/dist/components/admin/OrganizationSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/OrganizationsList.svelte +92 -0
- package/dist/components/admin/OrganizationsList.svelte.d.ts +8 -0
- package/dist/components/admin/OrganizationsList.svelte.d.ts.map +1 -0
- package/dist/components/admin/OrganizationsView.svelte +31 -0
- package/dist/components/admin/OrganizationsView.svelte.d.ts +9 -0
- package/dist/components/admin/OrganizationsView.svelte.d.ts.map +1 -0
- package/dist/components/admin/PasswordInput.svelte +43 -0
- package/dist/components/admin/PasswordInput.svelte.d.ts +8 -0
- package/dist/components/admin/PasswordInput.svelte.d.ts.map +1 -0
- package/dist/components/admin/PasswordSettings.svelte +179 -0
- package/dist/components/admin/PasswordSettings.svelte.d.ts +4 -0
- package/dist/components/admin/PasswordSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/PreferencesSettings.svelte +80 -0
- package/dist/components/admin/PreferencesSettings.svelte.d.ts +20 -0
- package/dist/components/admin/PreferencesSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/ResetPasswordView.svelte +117 -0
- package/dist/components/admin/ResetPasswordView.svelte.d.ts +9 -0
- package/dist/components/admin/ResetPasswordView.svelte.d.ts.map +1 -0
- package/dist/components/admin/RolesSettings.svelte +360 -0
- package/dist/components/admin/RolesSettings.svelte.d.ts +11 -0
- package/dist/components/admin/RolesSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/SchemaField.svelte +12 -2
- package/dist/components/admin/SchemaField.svelte.d.ts.map +1 -1
- package/dist/components/admin/SettingsHeaderActions.svelte +25 -0
- package/dist/components/admin/SettingsHeaderActions.svelte.d.ts +8 -0
- package/dist/components/admin/SettingsHeaderActions.svelte.d.ts.map +1 -0
- package/dist/components/admin/SettingsShell.svelte +136 -0
- package/dist/components/admin/SettingsShell.svelte.d.ts +9 -0
- package/dist/components/admin/SettingsShell.svelte.d.ts.map +1 -0
- package/dist/components/admin/TwoFactorChallengeView.svelte +377 -0
- package/dist/components/admin/TwoFactorChallengeView.svelte.d.ts +11 -0
- package/dist/components/admin/TwoFactorChallengeView.svelte.d.ts.map +1 -0
- package/dist/components/admin/TwoFactorSettings.svelte +436 -0
- package/dist/components/admin/TwoFactorSettings.svelte.d.ts +7 -0
- package/dist/components/admin/TwoFactorSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/fields/ImageField.svelte +4 -2
- package/dist/components/admin/fields/SlugField.svelte +3 -1
- package/dist/components/admin/fields/SlugField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/richtext/PortableTextImageView.svelte +3 -2
- package/dist/components/admin/fields/richtext/RichtextField.svelte +54 -7
- package/dist/components/admin/fields/richtext/RichtextField.svelte.d.ts.map +1 -1
- package/dist/components/layout/sidebar/NavUser.svelte +2 -2
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/db/interfaces/document.d.ts +15 -2
- package/dist/db/interfaces/document.d.ts.map +1 -1
- package/dist/db/interfaces/index.d.ts +1 -1
- package/dist/db/interfaces/index.d.ts.map +1 -1
- package/dist/email/index.d.ts +1 -0
- package/dist/email/index.d.ts.map +1 -1
- package/dist/email/index.js +2 -0
- package/dist/email/interfaces/email.d.ts +2 -0
- package/dist/email/interfaces/email.d.ts.map +1 -1
- package/dist/email/link-email.d.ts +15 -0
- package/dist/email/link-email.d.ts.map +1 -0
- package/dist/email/link-email.js +30 -0
- package/dist/field-validation/date-utils.d.ts.map +1 -1
- package/dist/field-validation/date-utils.js +4 -2
- package/dist/field-validation/utils.d.ts +42 -2
- package/dist/field-validation/utils.d.ts.map +1 -1
- package/dist/field-validation/utils.js +176 -14
- package/dist/graphql/index.d.ts.map +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/hooks.d.ts +6 -3
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +53 -17
- package/dist/jobs/recurring.d.ts +4 -1
- package/dist/jobs/recurring.d.ts.map +1 -1
- package/dist/jobs/recurring.js +28 -0
- package/dist/local-api/auth-helpers.d.ts +4 -4
- package/dist/local-api/auth-helpers.js +4 -4
- package/dist/local-api/collection-api.d.ts +10 -1
- package/dist/local-api/collection-api.d.ts.map +1 -1
- package/dist/local-api/collection-api.js +40 -12
- package/dist/local-api/index.d.ts +1 -1
- package/dist/local-api/index.d.ts.map +1 -1
- package/dist/local-api/index.js +12 -6
- package/dist/local-api/types.d.ts +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +3 -1
- package/dist/preview/perspective.d.ts +1 -1
- package/dist/preview/perspective.js +1 -1
- package/dist/resolve-config.d.ts +22 -0
- package/dist/resolve-config.d.ts.map +1 -0
- package/dist/resolve-config.js +106 -0
- package/dist/routes/assets-cdn.d.ts +7 -2
- package/dist/routes/assets-cdn.d.ts.map +1 -1
- package/dist/routes/assets-cdn.js +11 -5
- package/dist/server/api/index.d.ts +1 -2
- package/dist/server/api/index.d.ts.map +1 -1
- package/dist/server/api/index.js +12 -3
- package/dist/server/api/openapi/registry.d.ts.map +1 -1
- package/dist/server/api/openapi/registry.js +70 -0
- package/dist/server/api/routes/api-keys.d.ts +4 -0
- package/dist/server/api/routes/api-keys.d.ts.map +1 -0
- package/dist/server/api/routes/api-keys.js +88 -0
- package/dist/server/api/routes/documents-by-id.d.ts.map +1 -1
- package/dist/server/api/routes/documents-by-id.js +16 -1
- package/dist/server/api/routes/documents-publish.d.ts.map +1 -1
- package/dist/server/api/routes/documents-publish.js +11 -1
- package/dist/server/api/routes/documents.d.ts.map +1 -1
- package/dist/server/api/routes/documents.js +16 -2
- package/dist/server/api/routes/instance-settings.d.ts +4 -0
- package/dist/server/api/routes/instance-settings.d.ts.map +1 -0
- package/dist/server/api/routes/instance-settings.js +47 -0
- package/dist/server/api/routes/invitations.d.ts +9 -0
- package/dist/server/api/routes/invitations.d.ts.map +1 -0
- package/dist/server/api/routes/invitations.js +79 -0
- package/dist/server/api/routes/organizations-invitations.d.ts +0 -6
- package/dist/server/api/routes/organizations-invitations.d.ts.map +1 -1
- package/dist/server/api/routes/organizations-invitations.js +6 -7
- package/dist/server/api/routes/organizations-team.d.ts +14 -0
- package/dist/server/api/routes/organizations-team.d.ts.map +1 -0
- package/dist/server/api/routes/organizations-team.js +36 -0
- package/dist/server/api/routes/organizations.d.ts.map +1 -1
- package/dist/server/api/routes/organizations.js +35 -9
- package/dist/server/core-routes.d.ts +8 -0
- package/dist/server/core-routes.d.ts.map +1 -0
- package/dist/server/core-routes.js +67 -0
- package/dist/server/index.d.ts +5 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +7 -1
- package/dist/server/pages/admin.d.ts +24 -0
- package/dist/server/pages/admin.d.ts.map +1 -0
- package/dist/server/pages/admin.js +468 -0
- package/dist/server/queries/organization-team.d.ts +14 -0
- package/dist/server/queries/organization-team.d.ts.map +1 -0
- package/dist/server/queries/organization-team.js +65 -0
- package/dist/server/queries/pending-invitations.d.ts +8 -0
- package/dist/server/queries/pending-invitations.d.ts.map +1 -0
- package/dist/server/queries/pending-invitations.js +24 -0
- package/dist/types/api-key.d.ts +18 -0
- package/dist/types/api-key.d.ts.map +1 -0
- package/dist/types/api-key.js +1 -0
- package/dist/types/auth.d.ts +35 -0
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/capabilities.d.ts +1 -2
- package/dist/types/capabilities.d.ts.map +1 -1
- package/dist/types/config.d.ts +124 -4
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/filters.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/organization.d.ts +30 -0
- package/dist/types/organization.d.ts.map +1 -1
- package/dist/utils/preview.d.ts +8 -1
- package/dist/utils/preview.d.ts.map +1 -1
- package/dist/utils/preview.js +35 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +46 -39
- package/package.json +19 -29
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import { isAccepted, isExpired } from '../../../auth/invitation-status.js';
|
|
3
|
+
import { cmsLogger } from '../../../utils/logger.js';
|
|
4
|
+
import { getPendingInvitations } from '../../queries/pending-invitations.js';
|
|
5
|
+
const UNAUTHORIZED = {
|
|
6
|
+
success: false,
|
|
7
|
+
error: 'Unauthorized',
|
|
8
|
+
message: 'Session authentication required'
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Invitations addressed to the signed-in user, as opposed to the ones an organization
|
|
12
|
+
* has sent (`/organizations/invitations`). A session with no organization can use
|
|
13
|
+
* these, because accepting an invitation is how it gets one.
|
|
14
|
+
*/
|
|
15
|
+
export const invitationsRouter = new Hono()
|
|
16
|
+
.get('/', async (c) => {
|
|
17
|
+
const auth = c.var.auth;
|
|
18
|
+
if (!auth || auth.type === 'api_key')
|
|
19
|
+
return c.json(UNAUTHORIZED, 401);
|
|
20
|
+
try {
|
|
21
|
+
const data = await getPendingInvitations(c.var.aphexCMS.databaseAdapter, auth.user.email);
|
|
22
|
+
return c.json({ success: true, data });
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
cmsLogger.error('Failed to fetch invitations:', error);
|
|
26
|
+
return c.json({ success: false, error: 'Failed to fetch invitations' }, 500);
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
.post('/:id/accept', async (c) => {
|
|
30
|
+
const auth = c.var.auth;
|
|
31
|
+
if (!auth || auth.type === 'api_key')
|
|
32
|
+
return c.json(UNAUTHORIZED, 401);
|
|
33
|
+
try {
|
|
34
|
+
const { databaseAdapter } = c.var.aphexCMS;
|
|
35
|
+
// Looked up through the caller's address, so an id alone can't claim someone
|
|
36
|
+
// else's invitation.
|
|
37
|
+
const invitations = await databaseAdapter.findInvitationsByEmail(auth.user.email);
|
|
38
|
+
const invitation = invitations.find(({ id }) => id === c.req.param('id'));
|
|
39
|
+
if (!invitation)
|
|
40
|
+
return c.json({ success: false, error: 'Invitation not found' }, 404);
|
|
41
|
+
if (isAccepted(invitation)) {
|
|
42
|
+
return c.json({ success: false, error: 'Invitation already accepted' }, 400);
|
|
43
|
+
}
|
|
44
|
+
if (isExpired(invitation)) {
|
|
45
|
+
return c.json({ success: false, error: 'Invitation has expired' }, 400);
|
|
46
|
+
}
|
|
47
|
+
await databaseAdapter.acceptInvitation(invitation.token, auth.user.id);
|
|
48
|
+
return c.json({
|
|
49
|
+
success: true,
|
|
50
|
+
data: { organizationId: invitation.organizationId },
|
|
51
|
+
message: 'Invitation accepted'
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
cmsLogger.error('Failed to accept invitation:', error);
|
|
56
|
+
return c.json({ success: false, error: 'Failed to accept invitation' }, 500);
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
.post('/:id/reject', async (c) => {
|
|
60
|
+
const auth = c.var.auth;
|
|
61
|
+
if (!auth || auth.type === 'api_key')
|
|
62
|
+
return c.json(UNAUTHORIZED, 401);
|
|
63
|
+
try {
|
|
64
|
+
const { databaseAdapter } = c.var.aphexCMS;
|
|
65
|
+
const invitations = await databaseAdapter.findInvitationsByEmail(auth.user.email);
|
|
66
|
+
const invitation = invitations.find(({ id }) => id === c.req.param('id'));
|
|
67
|
+
if (!invitation)
|
|
68
|
+
return c.json({ success: false, error: 'Invitation not found' }, 404);
|
|
69
|
+
if (isAccepted(invitation)) {
|
|
70
|
+
return c.json({ success: false, error: 'Invitation already accepted' }, 400);
|
|
71
|
+
}
|
|
72
|
+
await databaseAdapter.deleteInvitation(invitation.id, invitation.organizationId);
|
|
73
|
+
return c.json({ success: true, message: 'Invitation declined' });
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
cmsLogger.error('Failed to reject invitation:', error);
|
|
77
|
+
return c.json({ success: false, error: 'Failed to reject invitation' }, 500);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import type { AphexEnv } from '../index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Note: in studio, invitations are wrapped by a SvelteKit `+server.ts`
|
|
5
|
-
* that adds email sending after the invite row is created. While that
|
|
6
|
-
* shim exists, this Hono router sits dormant (specific SK routes win
|
|
7
|
-
* over the catch-all). Phase 5 moves the wrapper into `config.api`.
|
|
8
|
-
*/
|
|
9
3
|
export declare const organizationsInvitationsRouter: Hono<AphexEnv>;
|
|
10
4
|
//# sourceMappingURL=organizations-invitations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizations-invitations.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/api/routes/organizations-invitations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"organizations-invitations.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/api/routes/organizations-invitations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAY5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,8BAA8B,EAAE,IAAI,CAAC,QAAQ,CAgPxD,CAAC"}
|
|
@@ -4,12 +4,8 @@ import { cmsLogger } from '../../../utils/logger.js';
|
|
|
4
4
|
import { inviteMemberRequest, cancelInvitationRequest } from '../../../api/schemas/organizations.js';
|
|
5
5
|
import { hasCapability } from '../../../types/capabilities.js';
|
|
6
6
|
import { isPendingInvitation, isStaleInvitation, invitationExpiryFrom } from '../../../auth/invitation-status.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* that adds email sending after the invite row is created. While that
|
|
10
|
-
* shim exists, this Hono router sits dormant (specific SK routes win
|
|
11
|
-
* over the catch-all). Phase 5 moves the wrapper into `config.api`.
|
|
12
|
-
*/
|
|
7
|
+
import { sendInvitationEmail } from '../../../auth/invitation-email.js';
|
|
8
|
+
import { invitationUrl } from '../../../auth/pages.js';
|
|
13
9
|
export const organizationsInvitationsRouter = new Hono()
|
|
14
10
|
.post('/invitations', zValidator('json', inviteMemberRequest, (result, c) => {
|
|
15
11
|
if (!result.success) {
|
|
@@ -113,9 +109,12 @@ export const organizationsInvitationsRouter = new Hono()
|
|
|
113
109
|
token,
|
|
114
110
|
expiresAt: invitationExpiryFrom()
|
|
115
111
|
});
|
|
112
|
+
const { origin } = new URL(c.req.url);
|
|
113
|
+
// Not awaited: mail is slow, and a failed send doesn't undo the invitation.
|
|
114
|
+
void sendInvitationEmail(c.var.aphexCMS, invitation, origin);
|
|
116
115
|
return c.json({
|
|
117
116
|
success: true,
|
|
118
|
-
data: invitation,
|
|
117
|
+
data: { ...invitation, inviteUrl: invitationUrl(c.var.aphexCMS.config, origin, token) },
|
|
119
118
|
message: 'Invitation created successfully.'
|
|
120
119
|
}, 201);
|
|
121
120
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import type { AphexEnv } from '../index.js';
|
|
3
|
+
/**
|
|
4
|
+
* `GET /organizations/team` — the members settings page in one round-trip:
|
|
5
|
+
* members with their user profile, pending invitations (with the accept link
|
|
6
|
+
* for callers who can invite), the invitable roles, and whether email is
|
|
7
|
+
* configured. Exists so the page can be a cms-core component rather than an
|
|
8
|
+
* app-owned `+page.server.ts`, which every scaffold would otherwise have to
|
|
9
|
+
* patch by hand to pick up improvements.
|
|
10
|
+
*
|
|
11
|
+
* Mounted before the `/:id` router — `team` must not be read as an org id.
|
|
12
|
+
*/
|
|
13
|
+
export declare const organizationsTeamRouter: Hono<AphexEnv>;
|
|
14
|
+
//# sourceMappingURL=organizations-team.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organizations-team.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/api/routes/organizations-team.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,EAAE,IAAI,CAAC,QAAQ,CAiClD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import { cmsLogger } from '../../../utils/logger.js';
|
|
3
|
+
import { getOrganizationTeam } from '../../queries/organization-team.js';
|
|
4
|
+
/**
|
|
5
|
+
* `GET /organizations/team` — the members settings page in one round-trip:
|
|
6
|
+
* members with their user profile, pending invitations (with the accept link
|
|
7
|
+
* for callers who can invite), the invitable roles, and whether email is
|
|
8
|
+
* configured. Exists so the page can be a cms-core component rather than an
|
|
9
|
+
* app-owned `+page.server.ts`, which every scaffold would otherwise have to
|
|
10
|
+
* patch by hand to pick up improvements.
|
|
11
|
+
*
|
|
12
|
+
* Mounted before the `/:id` router — `team` must not be read as an org id.
|
|
13
|
+
*/
|
|
14
|
+
export const organizationsTeamRouter = new Hono().get('/team', async (c) => {
|
|
15
|
+
try {
|
|
16
|
+
const auth = c.var.auth;
|
|
17
|
+
if (!auth || auth.type !== 'session') {
|
|
18
|
+
return c.json({
|
|
19
|
+
success: false,
|
|
20
|
+
error: 'Unauthorized',
|
|
21
|
+
message: 'Session authentication required'
|
|
22
|
+
}, 401);
|
|
23
|
+
}
|
|
24
|
+
const origin = new URL(c.req.url).origin;
|
|
25
|
+
const team = await getOrganizationTeam(c.var.aphexCMS, auth, origin);
|
|
26
|
+
return c.json({ success: true, data: team });
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
cmsLogger.error('Failed to fetch organization team:', error);
|
|
30
|
+
return c.json({
|
|
31
|
+
success: false,
|
|
32
|
+
error: 'Failed to fetch team',
|
|
33
|
+
message: error instanceof Error ? error.message : 'Unknown error'
|
|
34
|
+
}, 500);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/api/routes/organizations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/api/routes/organizations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,QAAQ,CAqK7C,CAAC"}
|
|
@@ -46,21 +46,26 @@ export const organizationsRouter = new Hono()
|
|
|
46
46
|
}
|
|
47
47
|
}), async (c) => {
|
|
48
48
|
try {
|
|
49
|
-
const { databaseAdapter } = c.var.aphexCMS;
|
|
49
|
+
const { databaseAdapter, rolesService } = c.var.aphexCMS;
|
|
50
50
|
const auth = c.var.auth;
|
|
51
|
-
|
|
51
|
+
// A session with no organization yet counts, because this is how it gets one.
|
|
52
|
+
if (!auth || auth.type === 'api_key') {
|
|
52
53
|
return c.json({
|
|
53
54
|
success: false,
|
|
54
55
|
error: 'Unauthorized',
|
|
55
56
|
message: 'Session authentication required'
|
|
56
57
|
}, 401);
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
const isSuperAdmin = auth.user.role === 'super_admin';
|
|
60
|
+
if (!isSuperAdmin) {
|
|
61
|
+
const { allowUserOrgCreation } = await databaseAdapter.getInstanceSettings();
|
|
62
|
+
if (!allowUserOrgCreation) {
|
|
63
|
+
return c.json({
|
|
64
|
+
success: false,
|
|
65
|
+
error: 'Forbidden',
|
|
66
|
+
message: 'Only super admins can create organizations on this instance'
|
|
67
|
+
}, 403);
|
|
68
|
+
}
|
|
64
69
|
}
|
|
65
70
|
const body = c.req.valid('json');
|
|
66
71
|
const existingOrg = await databaseAdapter.findOrganizationBySlug(body.slug);
|
|
@@ -71,11 +76,32 @@ export const organizationsRouter = new Hono()
|
|
|
71
76
|
message: `Organization with slug '${body.slug}' already exists`
|
|
72
77
|
}, 409);
|
|
73
78
|
}
|
|
79
|
+
// Members of a parent organization can reach its children, so a new organization
|
|
80
|
+
// only goes under one when the caller asks for it and administers it. With no
|
|
81
|
+
// parent named it is top-level, for super admins too: defaulting to the active
|
|
82
|
+
// organization put organizations under whatever the caller happened to be in.
|
|
83
|
+
const requestedParent = body.parentOrganizationId;
|
|
84
|
+
if (requestedParent && !isSuperAdmin) {
|
|
85
|
+
const membership = await databaseAdapter.findUserMembership(auth.user.id, requestedParent);
|
|
86
|
+
const capabilities = membership
|
|
87
|
+
? await rolesService.getCapabilities(requestedParent, membership.role)
|
|
88
|
+
: [];
|
|
89
|
+
if (!capabilities.includes('org.settings')) {
|
|
90
|
+
return c.json({
|
|
91
|
+
success: false,
|
|
92
|
+
error: 'Forbidden',
|
|
93
|
+
message: 'You can only add organizations under one you administer'
|
|
94
|
+
}, 403);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (requestedParent && !(await databaseAdapter.findOrganizationById(requestedParent))) {
|
|
98
|
+
return c.json({ success: false, error: 'Parent organization not found' }, 404);
|
|
99
|
+
}
|
|
74
100
|
const newOrganization = await databaseAdapter.createOrganization({
|
|
75
101
|
name: body.name,
|
|
76
102
|
slug: body.slug,
|
|
77
103
|
metadata: body.metadata || null,
|
|
78
|
-
parentOrganizationId:
|
|
104
|
+
parentOrganizationId: requestedParent ?? null,
|
|
79
105
|
createdBy: auth.user.id
|
|
80
106
|
});
|
|
81
107
|
// Seed with the install's full capability set (core + plugin-declared), the
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RequestEvent } from '@sveltejs/kit';
|
|
2
|
+
/**
|
|
3
|
+
* The routes core answers from the hook, so a host needs no route file for them. A
|
|
4
|
+
* route the host did define matched before the hook ran and wins, whether that's its
|
|
5
|
+
* own `/api/orders` or an older `/api/[...slug]` that forwards here.
|
|
6
|
+
*/
|
|
7
|
+
export declare function serveCoreRoute(event: RequestEvent): Promise<Response | null>;
|
|
8
|
+
//# sourceMappingURL=core-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-routes.d.ts","sourceRoot":"","sources":["../../src/lib/server/core-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAKlD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAoBlF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { GET as serveAsset } from '../routes/assets-cdn.js';
|
|
2
|
+
const MEDIA_PATH = /^\/media\/([^/]+)\/([^/]+)$/;
|
|
3
|
+
/**
|
|
4
|
+
* The routes core answers from the hook, so a host needs no route file for them. A
|
|
5
|
+
* route the host did define matched before the hook ran and wins, whether that's its
|
|
6
|
+
* own `/api/orders` or an older `/api/[...slug]` that forwards here.
|
|
7
|
+
*/
|
|
8
|
+
export async function serveCoreRoute(event) {
|
|
9
|
+
if (event.route.id !== null)
|
|
10
|
+
return null;
|
|
11
|
+
const { pathname } = event.url;
|
|
12
|
+
if (pathname === '/api' || pathname.startsWith('/api/')) {
|
|
13
|
+
return event.locals.aphexCMS.apiApp.fetch(event.request, {
|
|
14
|
+
aphexCMS: event.locals.aphexCMS,
|
|
15
|
+
auth: event.locals.aphexAuth ?? null,
|
|
16
|
+
clientAddress: clientAddressOrUndefined(event.getClientAddress)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const { method } = event.request;
|
|
20
|
+
const [, id, filename] = MEDIA_PATH.exec(pathname) ?? [];
|
|
21
|
+
if (id && filename && (method === 'GET' || method === 'HEAD')) {
|
|
22
|
+
return serveMedia(event, id, filename);
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* `getClientAddress()` throws when the address can't be determined: a dev socket with
|
|
28
|
+
* no `remoteAddress`, or an adapter's `ADDRESS_HEADER` missing from this request. That
|
|
29
|
+
* shouldn't fail the request, because rate limiting reads the headers directly and the
|
|
30
|
+
* one consumer of this value has a fallback.
|
|
31
|
+
*/
|
|
32
|
+
function clientAddressOrUndefined(getClientAddress) {
|
|
33
|
+
try {
|
|
34
|
+
return getClientAddress();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function serveMedia(event, id, filename) {
|
|
41
|
+
// SvelteKit only applies `setHeaders` to a response from a route, and this isn't one.
|
|
42
|
+
const headers = new Headers();
|
|
43
|
+
const response = await serveAsset({
|
|
44
|
+
locals: event.locals,
|
|
45
|
+
request: event.request,
|
|
46
|
+
params: { id: safeDecode(id), filename: safeDecode(filename) },
|
|
47
|
+
setHeaders: (values) => {
|
|
48
|
+
for (const [name, value] of Object.entries(values))
|
|
49
|
+
headers.set(name, value);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
response.headers.forEach((value, name) => headers.set(name, value));
|
|
53
|
+
return new Response(event.request.method === 'HEAD' ? null : response.body, {
|
|
54
|
+
status: response.status,
|
|
55
|
+
statusText: response.statusText,
|
|
56
|
+
headers
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** A malformed escape can't name a real asset, so it reaches the 404 undecoded. */
|
|
60
|
+
function safeDecode(segment) {
|
|
61
|
+
try {
|
|
62
|
+
return decodeURIComponent(segment);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return segment;
|
|
66
|
+
}
|
|
67
|
+
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from '../types/index.js';
|
|
|
2
2
|
export * from '../auth/provider.js';
|
|
3
3
|
export * from '../cache/index.js';
|
|
4
4
|
export * from '../email/index.js';
|
|
5
|
+
export { authPagesBase } from '../auth/pages.js';
|
|
5
6
|
export * from '../ai/index.js';
|
|
6
7
|
export { AuthError, type AuthErrorCode } from '../auth/auth-errors.js';
|
|
7
8
|
export { isInstanceEmpty, canDetermineInstanceEmptiness } from '../auth/instance-state.js';
|
|
@@ -9,6 +10,7 @@ export * from '../auth/bootstrap.js';
|
|
|
9
10
|
export * from '../auth/sign-up-policy.js';
|
|
10
11
|
export * from '../auth/account-deletion.js';
|
|
11
12
|
export { createCMSConfig } from '../config.js';
|
|
13
|
+
export { getAphex, resolveCMSConfig, type ResolvedAphex } from '../resolve-config.js';
|
|
12
14
|
export { checkHealth, type HealthResult, type HealthOptions } from './health.js';
|
|
13
15
|
export { cmsLogger, setLogger, type Logger } from '../utils/logger.js';
|
|
14
16
|
export { DEFAULT_ALLOWED_MIME_TYPES } from '../utils/file-accept.js';
|
|
@@ -32,7 +34,9 @@ export * from '../schema-utils/index.js';
|
|
|
32
34
|
export { createHashForPublishing } from '../utils/content-hash.js';
|
|
33
35
|
export { signAssetUrl, verifyAssetSignature, DEFAULT_ASSET_URL_TTL_SECONDS, ASSET_SIGNATURE_PARAM, ASSET_EXPIRY_PARAM, type SignedAssetUrlOptions } from '../utils/asset-url-signing.js';
|
|
34
36
|
export { getPreviewPerspective, type PreviewPerspective } from '../preview/perspective.js';
|
|
37
|
+
export { createAdminLoad } from './pages/admin.js';
|
|
38
|
+
export type { AdminViewData, AdminStudioData, AdminActivityData } from '../admin/view-data.js';
|
|
35
39
|
export { createGraphQLHandler, type GraphQLConfig, type GraphQLSettings, type GraphQLHandlerResult } from '../graphql/index.js';
|
|
36
|
-
export { LocalAPI, createLocalAPI, getLocalAPI, CollectionAPI, SingletonOperationError, DocumentValidationError, PermissionChecker, PermissionError, authToContext, requireAuth, systemContext, type Collections, type SingletonCollection, type LocalAPIContext, type CreateOptions, type UpdateOptions } from '../local-api/index.js';
|
|
40
|
+
export { LocalAPI, createLocalAPI, getLocalAPI, CollectionAPI, SingletonOperationError, DocumentValidationError, PublishValidationError, PermissionChecker, PermissionError, authToContext, requireAuth, systemContext, type Collections, type SingletonCollection, type LocalAPIContext, type CreateOptions, type UpdateOptions } from '../local-api/index.js';
|
|
37
41
|
export { buildContentTools, type McpTool, type McpToolResult, type McpToolDeps } from '../mcp/tools.js';
|
|
38
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/server/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/server/index.ts"],"names":[],"mappings":"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"}
|
package/dist/server/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from '../types/index.js';
|
|
|
5
5
|
export * from '../auth/provider.js';
|
|
6
6
|
export * from '../cache/index.js';
|
|
7
7
|
export * from '../email/index.js';
|
|
8
|
+
export { authPagesBase } from '../auth/pages.js';
|
|
8
9
|
export * from '../ai/index.js';
|
|
9
10
|
// Authentication errors
|
|
10
11
|
export { AuthError } from '../auth/auth-errors.js';
|
|
@@ -14,6 +15,7 @@ export * from '../auth/sign-up-policy.js';
|
|
|
14
15
|
export * from '../auth/account-deletion.js';
|
|
15
16
|
// Configuration system
|
|
16
17
|
export { createCMSConfig } from '../config.js';
|
|
18
|
+
export { getAphex, resolveCMSConfig } from '../resolve-config.js';
|
|
17
19
|
// Adapter health, for the app's own `/healthz` probe route
|
|
18
20
|
export { checkHealth } from './health.js';
|
|
19
21
|
// Logger
|
|
@@ -60,10 +62,14 @@ export { createHashForPublishing } from '../utils/content-hash.js';
|
|
|
60
62
|
export { signAssetUrl, verifyAssetSignature, DEFAULT_ASSET_URL_TTL_SECONDS, ASSET_SIGNATURE_PARAM, ASSET_EXPIRY_PARAM } from '../utils/asset-url-signing.js';
|
|
61
63
|
// Preview utilities
|
|
62
64
|
export { getPreviewPerspective } from '../preview/perspective.js';
|
|
65
|
+
// Embedded admin — the SSR load behind the `/admin/[...path]` catch-all. A host
|
|
66
|
+
// wires it in one line and every admin view a release adds is served without a
|
|
67
|
+
// host file change. Mount the matching UI with `<AphexStudio>` from `/client`.
|
|
68
|
+
export { createAdminLoad } from './pages/admin.js';
|
|
63
69
|
// GraphQL (built-in, enabled by default)
|
|
64
70
|
export { createGraphQLHandler } from '../graphql/index.js';
|
|
65
71
|
// Local API (unified operations layer)
|
|
66
|
-
export { LocalAPI, createLocalAPI, getLocalAPI, CollectionAPI, SingletonOperationError, DocumentValidationError, PermissionChecker, PermissionError, authToContext, requireAuth, systemContext } from '../local-api/index.js';
|
|
72
|
+
export { LocalAPI, createLocalAPI, getLocalAPI, CollectionAPI, SingletonOperationError, DocumentValidationError, PublishValidationError, PermissionChecker, PermissionError, authToContext, requireAuth, systemContext } from '../local-api/index.js';
|
|
67
73
|
// MCP — transport-agnostic tool registry (the MCP route + a future AI panel
|
|
68
74
|
// both consume these). The SvelteKit route handler is at ./routes/mcp.
|
|
69
75
|
export { buildContentTools } from '../mcp/tools.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AdminPageData } from '../../admin/view-data.js';
|
|
2
|
+
/**
|
|
3
|
+
* The single SSR load behind the embedded `/admin/[...path]` catch-all. It
|
|
4
|
+
* switches on the rest param and returns the payload for the matching view,
|
|
5
|
+
* discriminated by `view` so `<AphexStudio>` knows what to mount.
|
|
6
|
+
*
|
|
7
|
+
* This is the "feed the routes" half of embedded Aphex: a host wires it in one
|
|
8
|
+
* line (`export const load = createAdminLoad()`), and every admin view a release
|
|
9
|
+
* adds is served without the host touching a file.
|
|
10
|
+
*
|
|
11
|
+
* A route the host defines under `/admin` wins over this catch-all, and gets none of
|
|
12
|
+
* the admin's chrome, because the sidebar belongs to `<AphexStudio>`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createAdminLoad(): (event: AdminLoadEvent) => Promise<AdminPageData>;
|
|
15
|
+
interface AdminLoadEvent {
|
|
16
|
+
locals: App.Locals;
|
|
17
|
+
params: {
|
|
18
|
+
path?: string;
|
|
19
|
+
};
|
|
20
|
+
url: URL;
|
|
21
|
+
request: Request;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../src/lib/server/pages/admin.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACX,aAAa,EAUb,MAAM,uBAAuB,CAAC;AAM/B;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,KACH,OAAO,cAAc,KAAG,OAAO,CAAC,aAAa,CAAC,CAezE;AAED,UAAU,cAAc;IACvB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC;IACnB,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;CACjB"}
|