includio-cms 0.6.2 → 0.7.1
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/CHANGELOG.md +28 -0
- package/ROADMAP.md +18 -2
- package/dist/admin/api/accept-invite.js +2 -2
- package/dist/admin/auth-client.d.ts +2122 -2122
- package/dist/admin/client/admin/admin-layout.svelte +5 -1
- package/dist/admin/client/admin/admin-layout.svelte.d.ts +2 -0
- package/dist/admin/client/index.d.ts +1 -0
- package/dist/admin/client/index.js +1 -0
- package/dist/admin/components/fields/blocks-field.svelte +3 -3
- package/dist/admin/components/fields/field-renderer.svelte +9 -0
- package/dist/admin/components/fields/image-field.svelte +2 -2
- package/dist/admin/components/fields/media-field.svelte +4 -4
- package/dist/admin/components/media/file/file-miniature.svelte +6 -6
- package/dist/admin/helpers/build-custom-fields-map.d.ts +7 -0
- package/dist/admin/helpers/build-custom-fields-map.js +13 -0
- package/dist/admin/helpers/index.d.ts +7 -0
- package/dist/admin/helpers/index.js +7 -0
- package/dist/admin/helpers/use-field.d.ts +26 -0
- package/dist/admin/helpers/use-field.js +9 -0
- package/dist/admin/state/custom-fields.svelte.d.ts +3 -0
- package/dist/admin/state/custom-fields.svelte.js +10 -0
- package/dist/admin/styles/admin.css +1 -1
- package/dist/admin/ui/index.d.ts +12 -0
- package/dist/admin/ui/index.js +14 -0
- package/dist/components/ui/accordion/accordion.svelte.d.ts +1 -1
- package/dist/components/ui/calendar/calendar.svelte.d.ts +1 -1
- package/dist/components/ui/command/command-dialog.svelte.d.ts +1 -1
- package/dist/components/ui/command/command-input.svelte.d.ts +1 -1
- package/dist/components/ui/command/command.svelte.d.ts +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +1 -1
- package/dist/components/ui/input/input.svelte +2 -2
- package/dist/components/ui/input/input.svelte.d.ts +1 -1
- package/dist/components/ui/input-group/input-group-input.svelte.d.ts +2 -2
- package/dist/components/ui/input-group/input-group-textarea.svelte.d.ts +1 -1
- package/dist/components/ui/input-group/input-group.svelte +1 -1
- package/dist/components/ui/radio-group/radio-group.svelte.d.ts +1 -1
- package/dist/components/ui/select/select-trigger.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-input.svelte.d.ts +2 -2
- package/dist/components/ui/tabs/tabs.svelte.d.ts +1 -1
- package/dist/components/ui/textarea/textarea.svelte +1 -1
- package/dist/components/ui/textarea/textarea.svelte.d.ts +1 -1
- package/dist/components/ui/toggle-group/toggle-group-item.svelte.d.ts +1 -1
- package/dist/components/ui/toggle-group/toggle-group.svelte.d.ts +1 -1
- package/dist/core/cms.d.ts +7 -4
- package/dist/core/cms.js +52 -2
- package/dist/core/fields/fieldSchemaToTs.d.ts +11 -0
- package/dist/core/fields/fieldSchemaToTs.js +30 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/server/fields/populateEntry.js +50 -0
- package/dist/core/server/fields/resolveRichtextLinks.js +3 -2
- package/dist/core/server/fields/resolveUrlFields.js +2 -2
- package/dist/core/server/fields/slugResolver.d.ts +5 -0
- package/dist/core/server/fields/slugResolver.js +16 -0
- package/dist/core/server/fields/utils/resolveMedia.d.ts +12 -0
- package/dist/core/server/fields/utils/resolveMedia.js +23 -0
- package/dist/core/server/generator/fields.d.ts +2 -0
- package/dist/core/server/generator/fields.js +8 -0
- package/dist/core/server/generator/generator.js +9 -1
- package/dist/db-postgres/index.d.ts +6 -1
- package/dist/db-postgres/index.js +1 -0
- package/dist/server/auth.d.ts +1 -1358
- package/dist/server/auth.js +3 -23
- package/dist/sveltekit/index.d.ts +1 -0
- package/dist/sveltekit/index.js +1 -0
- package/dist/sveltekit/server/handle.js +21 -2
- package/dist/types/cms.d.ts +8 -3
- package/dist/types/config.d.ts +1 -0
- package/dist/types/fields.d.ts +9 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +1 -0
- package/dist/types/plugins.d.ts +19 -1
- package/dist/updates/0.7.0/index.d.ts +2 -0
- package/dist/updates/0.7.0/index.js +16 -0
- package/dist/updates/0.7.1/index.d.ts +2 -0
- package/dist/updates/0.7.1/index.js +16 -0
- package/dist/updates/index.js +3 -1
- package/package.json +14 -1
package/dist/server/auth.js
CHANGED
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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,5 +1,6 @@
|
|
|
1
1
|
export * from './config.js';
|
|
2
2
|
export { setRemotes, getRemotes } from '../admin/context/remotes.js';
|
|
3
|
+
export { setCustomFields, getCustomFields } from '../admin/state/custom-fields.svelte.js';
|
|
3
4
|
export { default as Preview } from './components/preview.svelte';
|
|
4
5
|
export { default as HybridTarget } from './components/hybrid-target.svelte';
|
|
5
6
|
export { default as Image } from './components/image.svelte';
|
package/dist/sveltekit/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './config.js';
|
|
2
2
|
export { setRemotes, getRemotes } from '../admin/context/remotes.js';
|
|
3
|
+
export { setCustomFields, getCustomFields } from '../admin/state/custom-fields.svelte.js';
|
|
3
4
|
export { default as Preview } from './components/preview.svelte';
|
|
4
5
|
export { default as HybridTarget } from './components/hybrid-target.svelte';
|
|
5
6
|
export { default as Image } from './components/image.svelte';
|
|
@@ -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
|
-
|
|
63
|
+
const handles = [];
|
|
64
|
+
if (cmsConfig.auth) {
|
|
65
|
+
handles.push(handleAuth);
|
|
66
|
+
}
|
|
67
|
+
handles.push(adminGuard);
|
|
68
|
+
return handles;
|
|
50
69
|
}
|
package/dist/types/cms.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { FilesAdapter } from './adapters/files.js';
|
|
|
3
3
|
import type { CollectionConfig, CollectionConfigWithType } from './collections.js';
|
|
4
4
|
import type { Language } from './languages.js';
|
|
5
5
|
import type { SingleConfig, SingleConfigWithType } from './singles.js';
|
|
6
|
-
import type { PluginConfig } from './plugins.js';
|
|
6
|
+
import type { CustomFieldDefinition, PluginConfig } from './plugins.js';
|
|
7
7
|
import type { FormConfig } from './forms.js';
|
|
8
8
|
import type { AIAdapter } from './adapters/ai.js';
|
|
9
9
|
import type { EmailAdapter } from './adapters/email.js';
|
|
@@ -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?:
|
|
47
|
+
auth?: AuthConfig;
|
|
44
48
|
plugins?: PluginConfig[];
|
|
45
49
|
ai?: AIAdapter;
|
|
46
50
|
media?: MediaConfig;
|
|
@@ -54,8 +58,9 @@ export interface ICMS {
|
|
|
54
58
|
databaseAdapter: DatabaseAdapter;
|
|
55
59
|
filesAdapter: FilesAdapter;
|
|
56
60
|
emailAdapter: EmailAdapter | null;
|
|
57
|
-
|
|
61
|
+
authConfig: AuthConfig | null;
|
|
58
62
|
plugins: PluginConfig[];
|
|
63
|
+
customFields: Map<string, CustomFieldDefinition>;
|
|
59
64
|
aiAdapter: AIAdapter | null;
|
|
60
65
|
mediaConfig: MediaConfig;
|
|
61
66
|
apiKeys: ApiKeyConfig[];
|
package/dist/types/config.d.ts
CHANGED
package/dist/types/fields.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { FormatEnum } from 'sharp';
|
|
|
2
2
|
import type { ImageStyle, MediaFile } from './media.js';
|
|
3
3
|
import type { Localized } from './languages.js';
|
|
4
4
|
import type { StructuredContentDoc } from './structured-content.js';
|
|
5
|
-
export type FieldType = 'text' | 'richtext' | 'content' | 'number' | 'boolean' | 'date' | 'datetime' | 'file' | 'image' | 'media' | 'select' | 'radio' | 'checkboxes' | 'relation' | 'object' | 'array' | 'blocks' | 'slug' | 'seo' | 'url';
|
|
5
|
+
export type FieldType = 'text' | 'richtext' | 'content' | 'number' | 'boolean' | 'date' | 'datetime' | 'file' | 'image' | 'media' | 'select' | 'radio' | 'checkboxes' | 'relation' | 'object' | 'array' | 'blocks' | 'slug' | 'seo' | 'url' | 'custom';
|
|
6
6
|
export interface FieldCondition {
|
|
7
7
|
field: string;
|
|
8
8
|
equals?: string | string[];
|
|
@@ -204,4 +204,11 @@ export type UrlFieldData = {
|
|
|
204
204
|
newTab?: boolean;
|
|
205
205
|
rel?: string;
|
|
206
206
|
};
|
|
207
|
-
export
|
|
207
|
+
export interface CustomField extends BaseField {
|
|
208
|
+
type: 'custom';
|
|
209
|
+
/** Matches CustomFieldDefinition.fieldType from a plugin */
|
|
210
|
+
fieldType: string;
|
|
211
|
+
/** Plugin-specific configuration, opaque to core */
|
|
212
|
+
config?: Record<string, unknown>;
|
|
213
|
+
}
|
|
214
|
+
export type Field = TextField | RichtextField | ContentField | NumberField | BooleanField | DateField | DateTimeField | FileField | ImageField | MediaField | SelectField | RadioField | CheckboxesField | RelationField | ObjectField | ArrayField | BlocksField | SlugField | SeoField | UrlField | CustomField;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ 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
|
+
export { type PluginConfig, type CustomFieldDefinition } from './plugins.js';
|
|
13
14
|
export { type Language, type Localized } from './languages.js';
|
|
14
15
|
export { type Layout, type LayoutNode, type LayoutPreset, type LayoutNodeType, type ColumnRatio, type SectionNode, type ColumnsNode, type CardNode, type AccordionNode, type StackNode } from './layout.js';
|
package/dist/types/index.js
CHANGED
package/dist/types/plugins.d.ts
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
import type { z } from 'zod';
|
|
1
3
|
import type { RawEntry } from './entries.js';
|
|
4
|
+
import type { CustomField } from './fields.js';
|
|
5
|
+
export interface CustomFieldDefinition {
|
|
6
|
+
/** Unique field type slug, e.g. 'photo-grid' */
|
|
7
|
+
fieldType: string;
|
|
8
|
+
/** Lazy-loaded Svelte component for admin UI */
|
|
9
|
+
component: () => Promise<{
|
|
10
|
+
default: Component<any>;
|
|
11
|
+
}>;
|
|
12
|
+
/** Zod schema factory — called with (field, languages) */
|
|
13
|
+
zodSchema: (field: CustomField, languages: string[]) => z.ZodType;
|
|
14
|
+
/** TypeScript type string for codegen */
|
|
15
|
+
tsType?: string;
|
|
16
|
+
/** Populate/resolve step for API output */
|
|
17
|
+
populateResolver?: (value: unknown, field: CustomField) => Promise<unknown>;
|
|
18
|
+
}
|
|
2
19
|
export interface PluginConfig {
|
|
3
20
|
slug: string;
|
|
4
|
-
|
|
21
|
+
fields?: CustomFieldDefinition[];
|
|
22
|
+
hooks?: {
|
|
5
23
|
beforeCreate?: (data: Record<string, unknown>) => Promise<void>;
|
|
6
24
|
afterCreate?: (entry: RawEntry) => Promise<void>;
|
|
7
25
|
beforeUpdate?: (id: string, data: Record<string, unknown>) => Promise<void>;
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const update = {
|
|
2
|
+
version: '0.7.1',
|
|
3
|
+
date: '2026-03-13',
|
|
4
|
+
description: 'Custom fields plugin system, pathTemplate, admin public API',
|
|
5
|
+
features: [
|
|
6
|
+
'Custom fields plugin system — type definition, zod/TS codegen, field renderer, populate resolver',
|
|
7
|
+
'pathTemplate support — configurable URL paths for collections/singles',
|
|
8
|
+
'Admin public exports: admin/helpers (useField, contexts) & admin/ui (shadcn primitives, MediaSelector)',
|
|
9
|
+
'resolveMediaWithStyles utility — resolve media files with image styles'
|
|
10
|
+
],
|
|
11
|
+
fixes: [
|
|
12
|
+
'Schema serialization type cast fix (stricter TS)',
|
|
13
|
+
'Core svelte export condition added to package.json'
|
|
14
|
+
],
|
|
15
|
+
breakingChanges: []
|
|
16
|
+
};
|
package/dist/updates/index.js
CHANGED
|
@@ -23,7 +23,9 @@ import { update as update058 } from './0.5.8/index.js';
|
|
|
23
23
|
import { update as update060 } from './0.6.0/index.js';
|
|
24
24
|
import { update as update061 } from './0.6.1/index.js';
|
|
25
25
|
import { update as update062 } from './0.6.2/index.js';
|
|
26
|
-
|
|
26
|
+
import { update as update070 } from './0.7.0/index.js';
|
|
27
|
+
import { update as update071 } from './0.7.1/index.js';
|
|
28
|
+
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, update071];
|
|
27
29
|
export const getUpdatesFrom = (fromVersion) => {
|
|
28
30
|
const fromParts = fromVersion.split('.').map(Number);
|
|
29
31
|
return updates.filter((update) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "includio-cms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run prepack",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"exports": {
|
|
48
48
|
"./core": {
|
|
49
49
|
"types": "./dist/core/index.d.ts",
|
|
50
|
+
"svelte": "./dist/core/index.js",
|
|
50
51
|
"node": "./dist/core/index.js"
|
|
51
52
|
},
|
|
52
53
|
"./entity": {
|
|
@@ -58,6 +59,14 @@
|
|
|
58
59
|
"svelte": "./dist/types/index.js",
|
|
59
60
|
"node": "./dist/types/index.js"
|
|
60
61
|
},
|
|
62
|
+
"./admin/helpers": {
|
|
63
|
+
"types": "./dist/admin/helpers/index.d.ts",
|
|
64
|
+
"svelte": "./dist/admin/helpers/index.js"
|
|
65
|
+
},
|
|
66
|
+
"./admin/ui": {
|
|
67
|
+
"types": "./dist/admin/ui/index.d.ts",
|
|
68
|
+
"svelte": "./dist/admin/ui/index.js"
|
|
69
|
+
},
|
|
61
70
|
"./admin": {
|
|
62
71
|
"types": "./dist/admin/index.d.ts",
|
|
63
72
|
"svelte": "./dist/admin/index.js"
|
|
@@ -122,6 +131,10 @@
|
|
|
122
131
|
"types": "./dist/ai-openai/index.d.ts",
|
|
123
132
|
"node": "./dist/ai-openai/index.js"
|
|
124
133
|
},
|
|
134
|
+
"./auth": {
|
|
135
|
+
"types": "./dist/server/auth.d.ts",
|
|
136
|
+
"node": "./dist/server/auth.js"
|
|
137
|
+
},
|
|
125
138
|
"./ai-claude": {
|
|
126
139
|
"types": "./dist/ai-claude/index.d.ts",
|
|
127
140
|
"node": "./dist/ai-claude/index.js"
|