includio-cms 0.18.0 → 0.20.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.
- package/API.md +409 -0
- package/CHANGELOG.md +98 -1
- package/DOCS.md +1 -1
- package/README.md +62 -0
- package/ROADMAP.md +1 -0
- package/dist/admin/api/rest/handler.d.ts +4 -0
- package/dist/admin/api/rest/handler.js +4 -0
- package/dist/admin/client/index.d.ts +2 -0
- package/dist/admin/client/index.js +4 -0
- package/dist/ai-claude/index.d.ts +9 -0
- package/dist/ai-claude/index.js +23 -7
- package/dist/ai-openai/index.d.ts +9 -0
- package/dist/ai-openai/index.js +28 -9
- package/dist/components/ui/input-group/input-group-input.svelte.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-input.svelte.d.ts +1 -1
- package/dist/core/cms.d.ts +4 -0
- package/dist/core/cms.js +4 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +2 -0
- package/dist/core/server/consentLogs/operations/create.d.ts +4 -0
- package/dist/core/server/consentLogs/operations/create.js +4 -0
- package/dist/core/server/fields/utils/resolveMedia.d.ts +5 -2
- package/dist/core/server/fields/utils/resolveMedia.js +2 -2
- package/dist/core/server/forms/submissions/operations/create.d.ts +7 -0
- package/dist/core/server/forms/submissions/operations/create.js +4 -0
- package/dist/core/server/forms/submissions/utils/parseMultipart.d.ts +4 -0
- package/dist/core/server/forms/submissions/utils/parseMultipart.js +4 -0
- package/dist/db-postgres/index.d.ts +6 -0
- package/dist/db-postgres/index.js +7 -0
- package/dist/email-nodemailer/index.d.ts +9 -0
- package/dist/email-nodemailer/index.js +28 -6
- package/dist/entity/index.d.ts +4 -0
- package/dist/entity/index.js +4 -0
- package/dist/files-local/index.d.ts +5 -0
- package/dist/files-local/index.js +5 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -1
- package/dist/server/auth.d.ts +4 -0
- package/dist/server/auth.js +4 -0
- package/dist/shop/client/index.d.ts +4 -0
- package/dist/shop/client/index.js +4 -0
- package/dist/sveltekit/config.d.ts +20 -0
- package/dist/sveltekit/config.js +20 -0
- package/dist/sveltekit/server/handle.d.ts +4 -0
- package/dist/sveltekit/server/handle.js +4 -0
- package/dist/sveltekit/server/index.d.ts +1 -0
- package/dist/sveltekit/server/index.js +2 -0
- package/dist/sveltekit/server/layout.d.ts +4 -0
- package/dist/sveltekit/server/layout.js +4 -0
- package/dist/sveltekit/server/preview.d.ts +4 -0
- package/dist/sveltekit/server/preview.js +4 -0
- package/dist/types/adapters/ai.d.ts +8 -0
- package/dist/types/adapters/db.d.ts +9 -0
- package/dist/types/adapters/email.d.ts +6 -0
- package/dist/types/adapters/files.d.ts +5 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/plugins.d.ts +8 -0
- package/dist/updates/{0.17.0 → 0.18.0}/index.js +1 -1
- package/dist/updates/0.19.0/index.d.ts +2 -0
- package/dist/updates/0.19.0/index.js +40 -0
- package/dist/updates/0.20.0/index.d.ts +2 -0
- package/dist/updates/0.20.0/index.js +54 -0
- package/dist/updates/index.js +4 -2
- package/package.json +20 -71
- /package/dist/updates/{0.17.0 → 0.18.0}/index.d.ts +0 -0
package/dist/ai-claude/index.js
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { getCMS } from '../core/cms.js';
|
|
2
|
-
import Anthropic from '@anthropic-ai/sdk';
|
|
3
2
|
import sharp from 'sharp';
|
|
3
|
+
/**
|
|
4
|
+
* Anthropic Claude AI adapter for `generateAltText`.
|
|
5
|
+
*
|
|
6
|
+
* `@anthropic-ai/sdk` is an **optional peer dependency** — install it in your
|
|
7
|
+
* project (`pnpm add @anthropic-ai/sdk`) when using this adapter. SDK loads
|
|
8
|
+
* lazily on first call; missing peer throws a clear error.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
4
12
|
export function claudeAdapter(config) {
|
|
5
13
|
let client = null;
|
|
6
|
-
function getClient() {
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
async function getClient() {
|
|
15
|
+
if (client)
|
|
16
|
+
return client;
|
|
17
|
+
if (!config.apiKey)
|
|
18
|
+
throw new Error('AI_CLAUDE_API_KEY is not set');
|
|
19
|
+
let Anthropic;
|
|
20
|
+
try {
|
|
21
|
+
Anthropic = (await import('@anthropic-ai/sdk')).default;
|
|
11
22
|
}
|
|
23
|
+
catch {
|
|
24
|
+
throw new Error('@anthropic-ai/sdk is required for claudeAdapter — install it with `pnpm add @anthropic-ai/sdk`');
|
|
25
|
+
}
|
|
26
|
+
client = new Anthropic({ apiKey: config.apiKey });
|
|
12
27
|
return client;
|
|
13
28
|
}
|
|
14
29
|
return {
|
|
@@ -29,7 +44,8 @@ export function claudeAdapter(config) {
|
|
|
29
44
|
const pngBuffer = await sharp(fileBuffer).png().toBuffer();
|
|
30
45
|
const imageBase64 = pngBuffer.toString('base64');
|
|
31
46
|
const prompt = `Generate a concise and descriptive alt text for the following image file in polish language. The alt text should accurately describe the content and context of the image, be no longer than 125 characters, and avoid using phrases like "image of" or "picture of". Return only the alt text, nothing else.`;
|
|
32
|
-
const
|
|
47
|
+
const anthropic = await getClient();
|
|
48
|
+
const message = await anthropic.messages.create({
|
|
33
49
|
model: 'claude-haiku-4-5-20251001',
|
|
34
50
|
max_tokens: 256,
|
|
35
51
|
messages: [
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import type { AIAdapter, AIConfig } from '../types/adapters/ai.js';
|
|
2
|
+
/**
|
|
3
|
+
* OpenAI AI adapter for `generateAltText`.
|
|
4
|
+
*
|
|
5
|
+
* `openai` is an **optional peer dependency** — install it in your project
|
|
6
|
+
* (`pnpm add openai`) when using this adapter. SDK loads lazily on first call;
|
|
7
|
+
* missing peer throws a clear error.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
2
11
|
export declare function openAIAdapter(config: AIConfig): AIAdapter;
|
package/dist/ai-openai/index.js
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import { getCMS } from '../core/cms.js';
|
|
2
|
-
import OpenAI from 'openai';
|
|
3
|
-
import { zodResponseFormat } from 'openai/helpers/zod.mjs';
|
|
4
2
|
import z from 'zod';
|
|
5
3
|
import sharp from 'sharp';
|
|
4
|
+
/**
|
|
5
|
+
* OpenAI AI adapter for `generateAltText`.
|
|
6
|
+
*
|
|
7
|
+
* `openai` is an **optional peer dependency** — install it in your project
|
|
8
|
+
* (`pnpm add openai`) when using this adapter. SDK loads lazily on first call;
|
|
9
|
+
* missing peer throws a clear error.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
6
13
|
export function openAIAdapter(config) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
let openai = null;
|
|
15
|
+
let zodResponseFormat = null;
|
|
16
|
+
async function getClient() {
|
|
17
|
+
if (openai && zodResponseFormat)
|
|
18
|
+
return { client: openai, zodResponseFormat };
|
|
19
|
+
let OpenAI;
|
|
20
|
+
try {
|
|
21
|
+
OpenAI = (await import('openai')).default;
|
|
22
|
+
zodResponseFormat = (await import('openai/helpers/zod.mjs')).zodResponseFormat;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
throw new Error('openai is required for openAIAdapter — install it with `pnpm add openai`');
|
|
26
|
+
}
|
|
27
|
+
openai = new OpenAI({ apiKey: config.apiKey });
|
|
28
|
+
return { client: openai, zodResponseFormat };
|
|
29
|
+
}
|
|
10
30
|
return {
|
|
11
31
|
generateAltText: async (fileId) => {
|
|
12
32
|
const altTextSchema = z.object({
|
|
@@ -24,13 +44,12 @@ export function openAIAdapter(config) {
|
|
|
24
44
|
if (!file) {
|
|
25
45
|
throw new Error('File not found');
|
|
26
46
|
}
|
|
27
|
-
// Konwertuj plik na PNG używając Sharp i przekonwertuj na base64
|
|
28
47
|
const fileBuffer = Buffer.from(await file.arrayBuffer());
|
|
29
48
|
const pngBuffer = await sharp(fileBuffer).png().toBuffer();
|
|
30
49
|
const imageBase64 = pngBuffer.toString('base64');
|
|
31
50
|
const prompt = `Generate a concise and descriptive alt text for the following image file in polish language. The alt text should accurately describe the content and context of the image, be no longer than 125 characters, and avoid using phrases like "image of" or "picture of".`;
|
|
32
|
-
const
|
|
33
|
-
|
|
51
|
+
const { client, zodResponseFormat: zrf } = await getClient();
|
|
52
|
+
const completion = await client.chat.completions.parse({
|
|
34
53
|
model: 'gpt-4o',
|
|
35
54
|
messages: [
|
|
36
55
|
{
|
|
@@ -49,7 +68,7 @@ export function openAIAdapter(config) {
|
|
|
49
68
|
]
|
|
50
69
|
}
|
|
51
70
|
],
|
|
52
|
-
response_format:
|
|
71
|
+
response_format: zrf(altTextSchema, 'response')
|
|
53
72
|
});
|
|
54
73
|
const response = completion.choices[0].message;
|
|
55
74
|
if (!response.parsed) {
|
|
@@ -2,7 +2,7 @@ declare const InputGroupInput: import("svelte").Component<(Omit<import("svelte/e
|
|
|
2
2
|
type: "file";
|
|
3
3
|
files?: FileList;
|
|
4
4
|
} | {
|
|
5
|
-
type?: "number" | "image" | "url" | "text" | "date" | "radio" | "color" | "button" | "checkbox" | "search" | (string & {}) | "email" | "
|
|
5
|
+
type?: "number" | "image" | "url" | "text" | "date" | "radio" | "color" | "button" | "checkbox" | "search" | (string & {}) | "email" | "password" | "time" | "hidden" | "reset" | "submit" | "tel" | "datetime-local" | "month" | "range" | "week";
|
|
6
6
|
files?: undefined;
|
|
7
7
|
})) & {
|
|
8
8
|
ref?: HTMLElement | null | undefined;
|
|
@@ -2,7 +2,7 @@ declare const SidebarInput: import("svelte").Component<(Omit<import("svelte/elem
|
|
|
2
2
|
type: "file";
|
|
3
3
|
files?: FileList;
|
|
4
4
|
} | {
|
|
5
|
-
type?: "number" | "image" | "url" | "text" | "date" | "radio" | "color" | "button" | "checkbox" | "search" | (string & {}) | "email" | "
|
|
5
|
+
type?: "number" | "image" | "url" | "text" | "date" | "radio" | "color" | "button" | "checkbox" | "search" | (string & {}) | "email" | "password" | "time" | "hidden" | "reset" | "submit" | "tel" | "datetime-local" | "month" | "range" | "week";
|
|
6
6
|
files?: undefined;
|
|
7
7
|
})) & {
|
|
8
8
|
ref?: HTMLElement | null | undefined;
|
package/dist/core/cms.d.ts
CHANGED
|
@@ -38,4 +38,8 @@ export declare class CMS implements ICMS {
|
|
|
38
38
|
getFormBySlug(slug: string): FormConfig;
|
|
39
39
|
}
|
|
40
40
|
export declare function initCMS(config: CMSConfig): CMS;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the singleton CMS instance. Must be called after `includioCMS()` initializes the CMS in `hooks.server.ts`.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
41
45
|
export declare function getCMS(): CMS;
|
package/dist/core/cms.js
CHANGED
|
@@ -159,6 +159,10 @@ export function initCMS(config) {
|
|
|
159
159
|
.catch((e) => console.warn('[cms] Failed to start background maintenance:', e));
|
|
160
160
|
return cms;
|
|
161
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Returns the singleton CMS instance. Must be called after `includioCMS()` initializes the CMS in `hooks.server.ts`.
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
162
166
|
export function getCMS() {
|
|
163
167
|
if (!cms) {
|
|
164
168
|
throw new Error('CMS not initialized. Call initCMS() first with your CMS config.');
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { ImageFieldStyle } from '../../../../types/fields.js';
|
|
2
2
|
import type { ImageStyle, MediaFile } from '../../../../types/media.js';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
3
6
|
export interface ResolvedMedia {
|
|
4
7
|
data: MediaFile;
|
|
5
8
|
styles: Record<string, ImageStyle>;
|
|
6
9
|
blurDataUrl: string | null;
|
|
7
10
|
}
|
|
8
11
|
/**
|
|
9
|
-
* Resolve media files by IDs and generate image styles.
|
|
10
|
-
*
|
|
12
|
+
* Resolve media files by IDs and generate image styles. Useful for plugins resolving media references (e.g. photo-grid).
|
|
13
|
+
* @public
|
|
11
14
|
*/
|
|
12
15
|
export declare function resolveMediaWithStyles(mediaIds: string[], styles?: ImageFieldStyle[]): Promise<Record<string, ResolvedMedia>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getCMS } from '../../../cms.js';
|
|
2
2
|
import { getImageStyles } from './imageStyles.js';
|
|
3
3
|
/**
|
|
4
|
-
* Resolve media files by IDs and generate image styles.
|
|
5
|
-
*
|
|
4
|
+
* Resolve media files by IDs and generate image styles. Useful for plugins resolving media references (e.g. photo-grid).
|
|
5
|
+
* @public
|
|
6
6
|
*/
|
|
7
7
|
export async function resolveMediaWithStyles(mediaIds, styles) {
|
|
8
8
|
if (!mediaIds.length)
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
1
4
|
export interface CreateFormSubmissionOptions {
|
|
2
5
|
slug: string;
|
|
3
6
|
data: Record<string, unknown>;
|
|
4
7
|
ip?: string;
|
|
5
8
|
userAgent?: string;
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Persists a form submission and triggers best-effort notification email. Returns `true` if the row was written (email failures are logged, do not affect return).
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
7
14
|
export declare const createFormSubmission: (options: CreateFormSubmissionOptions) => Promise<boolean>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { getLocalizedLabel } from '../../../../../admin/utils/collectionLabel.js';
|
|
2
2
|
import { getCMS } from '../../../../cms.js';
|
|
3
3
|
import { generateZodSchemaFromFormFields } from '../../../../fields/formFieldSchemaToTs.js';
|
|
4
|
+
/**
|
|
5
|
+
* Persists a form submission and triggers best-effort notification email. Returns `true` if the row was written (email failures are logged, do not affect return).
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
4
8
|
export const createFormSubmission = async (options) => {
|
|
5
9
|
const { slug, data, ip, userAgent } = options;
|
|
6
10
|
const config = getCMS().getFormBySlug(slug);
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { FormField } from '../../../../../types/formFields.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parses multipart `FormData` into a typed record of field values, handling file uploads via the configured files adapter.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
2
6
|
export declare function parseFormDataForSubmission(formData: FormData, fields: FormField[]): Promise<Record<string, unknown>>;
|
|
@@ -25,6 +25,10 @@ function validateMagicBytes(buffer, declaredMime) {
|
|
|
25
25
|
}
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Parses multipart `FormData` into a typed record of field values, handling file uploads via the configured files adapter.
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
28
32
|
export async function parseFormDataForSubmission(formData, fields) {
|
|
29
33
|
const result = {};
|
|
30
34
|
const fileFields = new Map(fields.filter((f) => f.type === 'file').map((f) => [f.slug, f]));
|
|
@@ -2,7 +2,13 @@ import { drizzle } from 'drizzle-orm/postgres-js';
|
|
|
2
2
|
import type { Config } from './types.js';
|
|
3
3
|
import * as schema from './schema/index.js';
|
|
4
4
|
import type { DatabaseAdapter } from '../types/adapters/db.js';
|
|
5
|
+
export * from './schema/index.js';
|
|
6
|
+
export * from '../server/db/schema/auth-schema.js';
|
|
5
7
|
export type DatabaseAdapterWithDrizzle = DatabaseAdapter & {
|
|
6
8
|
_drizzle: ReturnType<typeof drizzle<typeof schema>>;
|
|
7
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Postgres database adapter (drizzle + `postgres`).
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
8
14
|
export declare function pg(config: Config): DatabaseAdapterWithDrizzle;
|
|
@@ -262,6 +262,13 @@ function buildMediaFileConditions(db, options) {
|
|
|
262
262
|
}
|
|
263
263
|
return conditions;
|
|
264
264
|
}
|
|
265
|
+
// Schema re-exports (folded from `./db-postgres/schema-core`, `./db-postgres/schema-shop`, `./auth-schema` in 0.20.0)
|
|
266
|
+
export * from './schema/index.js';
|
|
267
|
+
export * from '../server/db/schema/auth-schema.js';
|
|
268
|
+
/**
|
|
269
|
+
* Postgres database adapter (drizzle + `postgres`).
|
|
270
|
+
* @public
|
|
271
|
+
*/
|
|
265
272
|
export function pg(config) {
|
|
266
273
|
const client = postgres(config.databaseUrl);
|
|
267
274
|
const db = drizzle(client, { schema });
|
|
@@ -5,5 +5,14 @@ interface Options {
|
|
|
5
5
|
defaultFromName: string;
|
|
6
6
|
transportOptions: SMTPTransport.Options;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* SMTP email adapter built on `nodemailer`.
|
|
10
|
+
*
|
|
11
|
+
* `nodemailer` is an **optional peer dependency** — install it in your project
|
|
12
|
+
* (`pnpm add nodemailer`) when using this adapter. The SDK loads lazily on first
|
|
13
|
+
* `sendMail()`; missing peer throws a clear error.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
8
17
|
export declare function nodemailerAdapter(options: Options): EmailAdapter;
|
|
9
18
|
export {};
|
|
@@ -1,14 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* SMTP email adapter built on `nodemailer`.
|
|
3
|
+
*
|
|
4
|
+
* `nodemailer` is an **optional peer dependency** — install it in your project
|
|
5
|
+
* (`pnpm add nodemailer`) when using this adapter. The SDK loads lazily on first
|
|
6
|
+
* `sendMail()`; missing peer throws a clear error.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
2
10
|
export function nodemailerAdapter(options) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
let transporter = null;
|
|
12
|
+
async function getTransporter() {
|
|
13
|
+
if (transporter)
|
|
14
|
+
return transporter;
|
|
15
|
+
let createTransport;
|
|
16
|
+
try {
|
|
17
|
+
({ createTransport } = await import('nodemailer'));
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
throw new Error('nodemailer is required for nodemailerAdapter — install it with `pnpm add nodemailer`');
|
|
21
|
+
}
|
|
22
|
+
transporter = createTransport({
|
|
23
|
+
...options.transportOptions,
|
|
24
|
+
from: `"${options.defaultFromName}" <${options.defaultFromAddress}>`
|
|
25
|
+
});
|
|
26
|
+
return transporter;
|
|
27
|
+
}
|
|
7
28
|
return {
|
|
8
29
|
defaultFromAddress: options.defaultFromAddress,
|
|
9
30
|
defaultFromName: options.defaultFromName,
|
|
10
31
|
sendMail: async (sendMailOptions) => {
|
|
11
|
-
await
|
|
32
|
+
const t = await getTransporter();
|
|
33
|
+
await t.sendMail({
|
|
12
34
|
...sendMailOptions,
|
|
13
35
|
from: `"${options.defaultFromName}" <${options.defaultFromAddress}>`
|
|
14
36
|
});
|
package/dist/entity/index.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ interface CreateOptions {
|
|
|
7
7
|
skipValidation?: boolean;
|
|
8
8
|
sortOrder?: number;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Creates a high-level Entity API (CRUD + publish/archive) bound to a CMS instance and a user.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
10
14
|
export declare function createEntityAPI(cms: CMS, opts?: EntityAPIOptions): {
|
|
11
15
|
create(slug: string, data?: EntryData, options?: CreateOptions & {
|
|
12
16
|
lang?: string;
|
package/dist/entity/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { generateZodSchemaFromFields } from '../core/fields/fieldSchemaToTs.js';
|
|
2
2
|
import { getFieldsFromConfig } from '../core/fields/layoutUtils.js';
|
|
3
3
|
import { _getRawEntries as getRawEntries } from '../core/server/entries/operations/get.js';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a high-level Entity API (CRUD + publish/archive) bound to a CMS instance and a user.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
4
8
|
export function createEntityAPI(cms, opts) {
|
|
5
9
|
const db = cms.databaseAdapter;
|
|
6
10
|
const userId = opts?.userId ?? 'system';
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { FilesAdapter } from '../types/adapters/files.js';
|
|
2
|
+
/** @internal */
|
|
2
3
|
export declare const fullDir: string;
|
|
3
4
|
export interface LocalFilesConfig {
|
|
4
5
|
ffmpegPath?: string;
|
|
5
6
|
ffprobePath?: string;
|
|
6
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Local-disk files adapter. Stores uploads under `./static/uploads` (dev) or `/data/uploads` (prod).
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
7
12
|
export declare function local(config?: LocalFilesConfig): FilesAdapter;
|
|
@@ -9,6 +9,7 @@ import { processVideo, setFfmpegPaths } from './video.js';
|
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
10
|
const __dirname = dirname(__filename);
|
|
11
11
|
global.__dirname = __dirname ?? '';
|
|
12
|
+
/** @internal */
|
|
12
13
|
export const fullDir = process.env.NODE_ENV === 'production' ? `/data/uploads` : `./static/uploads`;
|
|
13
14
|
const privateDir = process.env.NODE_ENV === 'production' ? `/data/private-uploads` : `./data/private-uploads`;
|
|
14
15
|
async function ensureDir(dir) {
|
|
@@ -19,6 +20,10 @@ async function ensureDir(dir) {
|
|
|
19
20
|
// Already exists
|
|
20
21
|
}
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Local-disk files adapter. Stores uploads under `./static/uploads` (dev) or `/data/uploads` (prod).
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
22
27
|
export function local(config) {
|
|
23
28
|
if (config?.ffmpegPath || config?.ffprobePath) {
|
|
24
29
|
setFfmpegPaths(config.ffmpegPath, config.ffprobePath);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/server/auth.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the underlying `better-auth` instance from the initialized CMS.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
1
5
|
export declare function getAuth(): import("better-auth", { with: { "resolution-mode": "require" } }).Auth<import("better-auth", { with: { "resolution-mode": "require" } }).BetterAuthOptions>;
|
package/dist/server/auth.js
CHANGED
|
@@ -125,3 +125,7 @@ export declare function createShopClient(options?: ShopClientOptions): ShopClien
|
|
|
125
125
|
export type { CartSnapshot, CartLine, CartItemRef } from '../cart/types.js';
|
|
126
126
|
export { createOrderState } from './use-order.svelte.js';
|
|
127
127
|
export type { OrderState, CreateOrderStateOptions, OrderPaymentPhase } from './use-order.svelte.js';
|
|
128
|
+
export { default as OrderStatus } from '../svelte/OrderStatus.svelte';
|
|
129
|
+
export { default as InpostPicker } from '../svelte/InpostPicker.svelte';
|
|
130
|
+
export { DEFAULT_LABELS_PL } from '../svelte/labels.js';
|
|
131
|
+
export type { OrderStatusLabels } from '../svelte/labels.js';
|
|
@@ -47,3 +47,7 @@ function tokenQuery(token) {
|
|
|
47
47
|
return token ? `?token=${encodeURIComponent(token)}` : '';
|
|
48
48
|
}
|
|
49
49
|
export { createOrderState } from './use-order.svelte.js';
|
|
50
|
+
// Folded from `./shop/svelte` (dropped as separate export in 0.20.0)
|
|
51
|
+
export { default as OrderStatus } from '../svelte/OrderStatus.svelte';
|
|
52
|
+
export { default as InpostPicker } from '../svelte/InpostPicker.svelte';
|
|
53
|
+
export { DEFAULT_LABELS_PL } from '../svelte/labels.js';
|
|
@@ -12,9 +12,29 @@ type SingleInput = Omit<SingleConfig, 'fields'> & {
|
|
|
12
12
|
fields: Field[];
|
|
13
13
|
layout?: Layout;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Defines the root CMS configuration. Pass to `includioCMS()` in `hooks.server.ts`.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
15
19
|
export declare function defineConfig(config: CMSConfig): CMSConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Defines a collection (multi-entry content type).
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
16
24
|
export declare function defineCollection(config: CollectionInput): CollectionConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Defines a singleton (single-entry content type, e.g. site settings).
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
17
29
|
export declare function defineSingle(config: SingleInput): SingleConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Defines a public form (submitted via `/api/forms/[slug]/submit`).
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
18
34
|
export declare function defineForm(config: FormConfig): FormConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Defines a reusable object field (nested record). Use inside `fields[]`.
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
19
39
|
export declare function defineObject(config: Omit<ObjectField, 'type'>): ObjectField;
|
|
20
40
|
export {};
|
package/dist/sveltekit/config.js
CHANGED
|
@@ -1,15 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the root CMS configuration. Pass to `includioCMS()` in `hooks.server.ts`.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
1
5
|
export function defineConfig(config) {
|
|
2
6
|
return config;
|
|
3
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Defines a collection (multi-entry content type).
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
4
12
|
export function defineCollection(config) {
|
|
5
13
|
return config;
|
|
6
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Defines a singleton (single-entry content type, e.g. site settings).
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
7
19
|
export function defineSingle(config) {
|
|
8
20
|
return config;
|
|
9
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Defines a public form (submitted via `/api/forms/[slug]/submit`).
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
10
26
|
export function defineForm(config) {
|
|
11
27
|
return config;
|
|
12
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Defines a reusable object field (nested record). Use inside `fields[]`.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
13
33
|
export function defineObject(config) {
|
|
14
34
|
return { ...config, type: 'object' };
|
|
15
35
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { type Handle } from '@sveltejs/kit';
|
|
2
2
|
import type { CMSConfig } from '../../types/cms.js';
|
|
3
|
+
/**
|
|
4
|
+
* SvelteKit `Handle[]` array that initializes the CMS, generates runtime artifacts, wires auth/admin guards, and exposes `event.locals.cmsContext`. Compose with `sequence()` in `hooks.server.ts`.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
3
7
|
export declare function includioCMS(cmsConfig: CMSConfig): Handle[];
|
|
@@ -65,6 +65,10 @@ const detectBrowserContext = async ({ event, resolve }) => {
|
|
|
65
65
|
};
|
|
66
66
|
return resolve(event);
|
|
67
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* SvelteKit `Handle[]` array that initializes the CMS, generates runtime artifacts, wires auth/admin guards, and exposes `event.locals.cmsContext`. Compose with `sequence()` in `hooks.server.ts`.
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
68
72
|
export function includioCMS(cmsConfig) {
|
|
69
73
|
generateRuntime(cmsConfig); // Generate runtime code based on the CMS config
|
|
70
74
|
initCMS(cmsConfig);
|
|
@@ -5,3 +5,4 @@ export { createFormSubmission } from '../../core/server/forms/submissions/operat
|
|
|
5
5
|
export { parseFormDataForSubmission } from '../../core/server/forms/submissions/utils/parseMultipart.js';
|
|
6
6
|
export { createConsentLog } from '../../core/server/consentLogs/operations/create.js';
|
|
7
7
|
export { getPreviewEntry } from './preview.js';
|
|
8
|
+
export { createRestApiHandler } from '../../admin/api/rest/handler.js';
|
|
@@ -5,3 +5,5 @@ export { createFormSubmission } from '../../core/server/forms/submissions/operat
|
|
|
5
5
|
export { parseFormDataForSubmission } from '../../core/server/forms/submissions/utils/parseMultipart.js';
|
|
6
6
|
export { createConsentLog } from '../../core/server/consentLogs/operations/create.js';
|
|
7
7
|
export { getPreviewEntry } from './preview.js';
|
|
8
|
+
// Folded from `./admin/api/rest/handler` (dropped as separate export in 0.20.0)
|
|
9
|
+
export { createRestApiHandler } from '../../admin/api/rest/handler.js';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { RequestEvent } from '@sveltejs/kit';
|
|
2
|
+
/**
|
|
3
|
+
* Returns `cmsContext` from `event.locals` for use in a SvelteKit layout `load`. Drop into your `+layout.server.ts`.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
2
6
|
export declare function cmsLayoutLoad(event: RequestEvent): {
|
|
3
7
|
cmsContext: any;
|
|
4
8
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Entry } from '../../types/entries.js';
|
|
2
2
|
import { type RequestEvent } from '@sveltejs/kit';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the preview entry from a `?preview=<versionId>` query param. Requires an authenticated session — throws `Unauthorized` otherwise.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
3
7
|
export declare function getPreviewEntry(event: RequestEvent, options: {
|
|
4
8
|
language: string;
|
|
5
9
|
}): Promise<Entry | null>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { getEntryVersion } from '../../core/server/entries/operations/get.js';
|
|
2
2
|
import {} from '@sveltejs/kit';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the preview entry from a `?preview=<versionId>` query param. Requires an authenticated session — throws `Unauthorized` otherwise.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
3
7
|
export async function getPreviewEntry(event, options) {
|
|
4
8
|
const preview = event.url.searchParams.get('preview');
|
|
5
9
|
if (!preview) {
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
/** @public */
|
|
1
2
|
export interface AIConfig {
|
|
2
3
|
apiKey: string;
|
|
3
4
|
}
|
|
5
|
+
/** @public */
|
|
4
6
|
export type AIAdapterConfig = {
|
|
5
7
|
config: AIConfig;
|
|
6
8
|
adapter: (config: AIConfig, db: AIAdapter) => AIAdapter;
|
|
7
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Contract for AI adapters. Currently powers `generateAltText` (admin media UI).
|
|
12
|
+
* Default implementations: `includio-cms/ai-openai`, `includio-cms/ai-claude`.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
8
15
|
export interface AIAdapter {
|
|
9
16
|
generateAltText: GenerateAltText;
|
|
10
17
|
}
|
|
18
|
+
/** @public */
|
|
11
19
|
export type GenerateAltText = (fileId: string) => Promise<string>;
|