includio-cms 0.6.1 → 0.7.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 (36) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/ROADMAP.md +10 -2
  3. package/dist/admin/api/accept-invite.js +2 -2
  4. package/dist/admin/auth-client.d.ts +2122 -2122
  5. package/dist/admin/client/admin/admin-layout.svelte +18 -4
  6. package/dist/admin/components/fields/blocks-field.svelte +3 -3
  7. package/dist/admin/components/fields/image-field.svelte +2 -2
  8. package/dist/admin/components/fields/media-field.svelte +4 -4
  9. package/dist/admin/components/media/file/file-miniature.svelte +6 -6
  10. package/dist/admin/context/remotes.d.ts +1 -1
  11. package/dist/admin/context/remotes.js +0 -1
  12. package/dist/admin/styles/admin.css +1 -1
  13. package/dist/components/ui/command/command.svelte.d.ts +1 -1
  14. package/dist/components/ui/input/input.svelte +2 -2
  15. package/dist/components/ui/input-group/input-group-input.svelte.d.ts +1 -1
  16. package/dist/components/ui/input-group/input-group.svelte +1 -1
  17. package/dist/components/ui/select/select-trigger.svelte +1 -1
  18. package/dist/components/ui/sidebar/sidebar-input.svelte.d.ts +1 -1
  19. package/dist/components/ui/textarea/textarea.svelte +1 -1
  20. package/dist/core/cms.d.ts +5 -3
  21. package/dist/core/cms.js +41 -2
  22. package/dist/db-postgres/index.d.ts +6 -1
  23. package/dist/db-postgres/index.js +1 -0
  24. package/dist/server/auth.d.ts +1 -1358
  25. package/dist/server/auth.js +3 -23
  26. package/dist/sveltekit/server/handle.js +21 -2
  27. package/dist/types/cms.d.ts +6 -2
  28. package/dist/types/index.d.ts +1 -1
  29. package/dist/updates/0.6.1/index.d.ts +2 -0
  30. package/dist/updates/0.6.1/index.js +9 -0
  31. package/dist/updates/0.6.2/index.d.ts +2 -0
  32. package/dist/updates/0.6.2/index.js +8 -0
  33. package/dist/updates/0.7.0/index.d.ts +2 -0
  34. package/dist/updates/0.7.0/index.js +16 -0
  35. package/dist/updates/index.js +4 -1
  36. package/package.json +5 -1
@@ -1,24 +1,4 @@
1
- import { betterAuth } from 'better-auth';
2
- import { drizzleAdapter } from 'better-auth/adapters/drizzle';
3
- import { db } from './db/index.js';
4
- import { admin } from 'better-auth/plugins';
5
1
  import { getCMS } from '../core/cms.js';
6
- import { resetPasswordEmailTemplate } from '../admin/email/reset-password-template.js';
7
- export const auth = betterAuth({
8
- database: drizzleAdapter(db, {
9
- provider: 'pg'
10
- }),
11
- emailAndPassword: {
12
- enabled: true,
13
- async sendResetPassword({ user, url }, request) {
14
- const emailAdapter = getCMS().emailAdapter;
15
- if (!emailAdapter) {
16
- throw new Error('Email adapter not configured');
17
- }
18
- const lang = request?.headers.get('Accept-Language')?.startsWith('pl') ? 'pl' : 'en';
19
- const { subject, html } = resetPasswordEmailTemplate({ resetUrl: url, lang });
20
- await emailAdapter.sendMail({ to: [user.email], subject, html });
21
- }
22
- },
23
- plugins: [admin()]
24
- });
2
+ export function getAuth() {
3
+ return getCMS().auth;
4
+ }
@@ -1,7 +1,9 @@
1
1
  import {} from '@sveltejs/kit';
2
2
  import { setFlash } from 'sveltekit-flash-message/server';
3
- import { initCMS } from '../../core/cms.js';
3
+ import { getCMS, initCMS } from '../../core/cms.js';
4
4
  import { generateRuntime } from '../../core/server/generator/generator.js';
5
+ import { svelteKitHandler } from 'better-auth/svelte-kit';
6
+ import { building } from '$app/environment';
5
7
  const adminGuard = async ({ event, resolve }) => {
6
8
  const { user, session } = event.locals;
7
9
  // Secure the admin routes
@@ -43,8 +45,25 @@ const adminGuard = async ({ event, resolve }) => {
43
45
  }
44
46
  return resolve(event);
45
47
  };
48
+ const handleAuth = async ({ event, resolve }) => {
49
+ const cms = getCMS();
50
+ const auth = cms.auth;
51
+ const session = await auth.api.getSession({
52
+ headers: event.request.headers
53
+ });
54
+ if (session) {
55
+ event.locals.session = session.session;
56
+ event.locals.user = session.user;
57
+ }
58
+ return svelteKitHandler({ event, resolve, auth, building });
59
+ };
46
60
  export function includioCMS(cmsConfig) {
47
61
  generateRuntime(cmsConfig); // Generate runtime code based on the CMS config
48
62
  initCMS(cmsConfig);
49
- return [adminGuard];
63
+ const handles = [];
64
+ if (cmsConfig.auth) {
65
+ handles.push(handleAuth);
66
+ }
67
+ handles.push(adminGuard);
68
+ return handles;
50
69
  }
@@ -27,6 +27,10 @@ export interface AuthAdapter {
27
27
  } | null>;
28
28
  };
29
29
  }
30
+ export interface AuthConfig {
31
+ secret: string;
32
+ baseURL?: string;
33
+ }
30
34
  export interface ApiKeyConfig {
31
35
  key: string;
32
36
  name?: string;
@@ -40,7 +44,7 @@ export interface CMSConfig {
40
44
  db: DatabaseAdapter;
41
45
  files: FilesAdapter;
42
46
  email?: EmailAdapter;
43
- auth?: AuthAdapter;
47
+ auth?: AuthConfig;
44
48
  plugins?: PluginConfig[];
45
49
  ai?: AIAdapter;
46
50
  media?: MediaConfig;
@@ -54,7 +58,7 @@ export interface ICMS {
54
58
  databaseAdapter: DatabaseAdapter;
55
59
  filesAdapter: FilesAdapter;
56
60
  emailAdapter: EmailAdapter | null;
57
- auth: AuthAdapter | null;
61
+ authConfig: AuthConfig | null;
58
62
  plugins: PluginConfig[];
59
63
  aiAdapter: AIAdapter | null;
60
64
  mediaConfig: MediaConfig;
@@ -9,6 +9,6 @@ export { type CollectionConfig } from './collections.js';
9
9
  export { type SingleConfig } from './singles.js';
10
10
  export { type FormConfig, type FormSubmission } from './forms.js';
11
11
  export { type FormField, type FormFieldType, type FormBaseField, type FormTextField, type FormEmailField, type FormTextareaField, type FormCheckboxField, type FormSelectField } from './formFields.js';
12
- export { type CMSConfig, type ApiKeyConfig } from './cms.js';
12
+ export { type CMSConfig, type ApiKeyConfig, type AuthConfig } from './cms.js';
13
13
  export { type Language, type Localized } from './languages.js';
14
14
  export { type Layout, type LayoutNode, type LayoutPreset, type LayoutNodeType, type ColumnRatio, type SectionNode, type ColumnsNode, type CardNode, type AccordionNode, type StackNode } from './layout.js';
@@ -0,0 +1,2 @@
1
+ import type { CmsUpdate } from '../index.js';
2
+ export declare const update: CmsUpdate;
@@ -0,0 +1,9 @@
1
+ export const update = {
2
+ version: '0.6.1',
3
+ date: '2026-03-10',
4
+ description: 'Maintenance release — update definitions, changelog, roadmap',
5
+ features: [],
6
+ fixes: [],
7
+ breakingChanges: [],
8
+ notes: 'No functional changes'
9
+ };
@@ -0,0 +1,2 @@
1
+ import type { CmsUpdate } from '../index.js';
2
+ export declare const update: CmsUpdate;
@@ -0,0 +1,8 @@
1
+ export const update = {
2
+ version: '0.6.2',
3
+ date: '2026-03-11',
4
+ description: 'Admin hydration fix',
5
+ features: [],
6
+ fixes: ['Admin hydration — replace boundary pending with onMount preloader, type-only remotes import'],
7
+ breakingChanges: []
8
+ };
@@ -0,0 +1,2 @@
1
+ import type { CmsUpdate } from '../index.js';
2
+ export declare const update: CmsUpdate;
@@ -0,0 +1,16 @@
1
+ export const update = {
2
+ version: '0.7.0',
3
+ date: '2026-03-11',
4
+ description: 'Auth core refactor & design system alignment',
5
+ features: [],
6
+ fixes: [
7
+ 'Auth moved into CMS core — lazy betterAuth init from config, simplified AuthConfig interface',
8
+ 'Media checkered bg & overlay gradient aligned with design system palette',
9
+ 'Form inputs use consistent bg-card background',
10
+ 'Blocks field accordion: rounded borders, card background',
11
+ 'Media file miniature: reset img/svg margins'
12
+ ],
13
+ breakingChanges: [
14
+ 'Auth config: AuthAdapter replaced with AuthConfig (secret + baseURL), auth init moved to CMS class'
15
+ ]
16
+ };
@@ -21,7 +21,10 @@ import { update as update056 } from './0.5.6/index.js';
21
21
  import { update as update057 } from './0.5.7/index.js';
22
22
  import { update as update058 } from './0.5.8/index.js';
23
23
  import { update as update060 } from './0.6.0/index.js';
24
- export const updates = [update0065, update0066, update0067, update0068, update0069, update010, update011, update012, update013, update014, update015, update020, update022, update050, update051, update052, update053, update054, update055, update056, update057, update058, update060];
24
+ import { update as update061 } from './0.6.1/index.js';
25
+ import { update as update062 } from './0.6.2/index.js';
26
+ import { update as update070 } from './0.7.0/index.js';
27
+ export const updates = [update0065, update0066, update0067, update0068, update0069, update010, update011, update012, update013, update014, update015, update020, update022, update050, update051, update052, update053, update054, update055, update056, update057, update058, update060, update061, update062, update070];
25
28
  export const getUpdatesFrom = (fromVersion) => {
26
29
  const fromParts = fromVersion.split('.').map(Number);
27
30
  return updates.filter((update) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "includio-cms",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -122,6 +122,10 @@
122
122
  "types": "./dist/ai-openai/index.d.ts",
123
123
  "node": "./dist/ai-openai/index.js"
124
124
  },
125
+ "./auth": {
126
+ "types": "./dist/server/auth.d.ts",
127
+ "node": "./dist/server/auth.js"
128
+ },
125
129
  "./ai-claude": {
126
130
  "types": "./dist/ai-claude/index.d.ts",
127
131
  "node": "./dist/ai-claude/index.js"