includio-cms 0.21.0 → 0.23.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 +20 -20
- package/CHANGELOG.md +111 -0
- package/DOCS.md +1169 -146
- package/README.md +138 -32
- package/ROADMAP.md +8 -330
- package/dist/admin/api/rest/handler.d.ts +13 -1
- package/dist/admin/api/rest/handler.js +13 -1
- package/dist/admin/api/rest/middleware/generateApiKey.d.ts +9 -0
- package/dist/admin/api/rest/middleware/generateApiKey.js +9 -0
- package/dist/admin/client/collection/collection-entries.svelte +1 -1
- package/dist/admin/client/collection/empty-state.svelte +1 -1
- package/dist/admin/client/collection/row-actions.svelte +3 -3
- package/dist/admin/client/collection/table-toolbar.svelte +3 -1
- package/dist/admin/client/entry/entry-header.svelte +3 -1
- package/dist/admin/client/users/create-user-dialog.svelte +4 -4
- package/dist/admin/client/users/delete-user-dialog.svelte +2 -0
- package/dist/admin/client/users/users-page.svelte +3 -2
- package/dist/admin/components/media/file-upload.svelte +2 -0
- package/dist/ai-claude/index.d.ts +9 -1
- package/dist/ai-claude/index.js +9 -1
- package/dist/ai-openai/index.d.ts +9 -1
- package/dist/ai-openai/index.js +9 -1
- package/dist/cli/index.js +115 -13
- package/dist/cms/runtime/schema.d.ts +2 -0
- package/dist/cms/runtime/schema.js +4 -0
- package/dist/cms/runtime/types.d.ts +1 -1
- package/dist/core/cms.d.ts +13 -1
- package/dist/core/cms.js +13 -1
- package/dist/core/errors.d.ts +71 -0
- package/dist/core/errors.js +179 -0
- package/dist/core/server/consentLogs/operations/create.d.ts +13 -1
- package/dist/core/server/consentLogs/operations/create.js +13 -1
- package/dist/core/server/entries/operations/create.js +6 -1
- package/dist/core/server/entries/operations/get.js +14 -3
- package/dist/core/server/entries/operations/resolveEntry.d.ts +32 -1
- package/dist/core/server/entries/operations/resolveEntry.js +36 -4
- package/dist/core/server/entries/operations/update.js +5 -1
- package/dist/core/server/fields/utils/resolveMedia.d.ts +18 -1
- package/dist/core/server/fields/utils/resolveMedia.js +13 -1
- package/dist/core/server/forms/submissions/operations/create.d.ts +21 -1
- package/dist/core/server/forms/submissions/operations/create.js +18 -2
- package/dist/core/server/forms/submissions/utils/parseMultipart.d.ts +15 -1
- package/dist/core/server/forms/submissions/utils/parseMultipart.js +15 -1
- package/dist/db-postgres/index.d.ts +10 -0
- package/dist/db-postgres/index.js +10 -0
- package/dist/email-nodemailer/index.d.ts +13 -1
- package/dist/email-nodemailer/index.js +13 -1
- package/dist/entity/index.d.ts +16 -1
- package/dist/entity/index.js +16 -1
- package/dist/files-local/index.d.ts +12 -1
- package/dist/files-local/index.js +12 -1
- package/dist/paraglide/messages/_index.d.ts +3 -36
- package/dist/paraglide/messages/_index.js +3 -71
- package/dist/paraglide/messages/hello_world.d.ts +5 -0
- package/dist/paraglide/messages/hello_world.js +33 -0
- package/dist/paraglide/messages/login_hello.d.ts +16 -0
- package/dist/paraglide/messages/login_hello.js +34 -0
- package/dist/paraglide/messages/login_please_login.d.ts +16 -0
- package/dist/paraglide/messages/login_please_login.js +34 -0
- package/dist/server/auth.d.ts +11 -0
- package/dist/server/auth.js +11 -0
- package/dist/sveltekit/config.d.ts +67 -4
- package/dist/sveltekit/config.js +73 -4
- package/dist/sveltekit/server/handle.d.ts +15 -1
- package/dist/sveltekit/server/handle.js +15 -1
- package/dist/sveltekit/server/layout.d.ts +12 -1
- package/dist/sveltekit/server/layout.js +12 -1
- package/dist/sveltekit/server/preview.d.ts +21 -1
- package/dist/sveltekit/server/preview.js +21 -1
- package/dist/types/cms.schema.d.ts +452 -0
- package/dist/types/cms.schema.js +629 -0
- package/dist/updates/0.22.0/index.d.ts +2 -0
- package/dist/updates/0.22.0/index.js +75 -0
- package/dist/updates/0.23.0/index.d.ts +2 -0
- package/dist/updates/0.23.0/index.js +21 -0
- package/dist/updates/index.js +3 -1
- package/package.json +4 -1
- package/dist/paraglide/messages/en.d.ts +0 -5
- package/dist/paraglide/messages/en.js +0 -14
- package/dist/paraglide/messages/pl.d.ts +0 -5
- package/dist/paraglide/messages/pl.js +0 -14
|
@@ -10,9 +10,21 @@ interface Options {
|
|
|
10
10
|
*
|
|
11
11
|
* `nodemailer` is an **optional peer dependency** — install it in your project
|
|
12
12
|
* (`pnpm add nodemailer`) when using this adapter. The SDK loads lazily on first
|
|
13
|
-
* `sendMail()`; missing peer throws a clear error.
|
|
13
|
+
* `sendMail()`; a missing peer throws a clear error.
|
|
14
14
|
*
|
|
15
|
+
* @param options - SMTP transport options + default From address/name.
|
|
16
|
+
* @returns An `EmailAdapter` ready to use in `defineConfig({ email })`.
|
|
15
17
|
* @public
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { nodemailerAdapter } from 'includio-cms/email-nodemailer';
|
|
21
|
+
*
|
|
22
|
+
* const email = nodemailerAdapter({
|
|
23
|
+
* defaultFromAddress: 'no-reply@example.com',
|
|
24
|
+
* defaultFromName: 'Example',
|
|
25
|
+
* transportOptions: { host: 'smtp.example.com', port: 587 }
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
16
28
|
*/
|
|
17
29
|
export declare function nodemailerAdapter(options: Options): EmailAdapter;
|
|
18
30
|
export {};
|
|
@@ -3,9 +3,21 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `nodemailer` is an **optional peer dependency** — install it in your project
|
|
5
5
|
* (`pnpm add nodemailer`) when using this adapter. The SDK loads lazily on first
|
|
6
|
-
* `sendMail()`; missing peer throws a clear error.
|
|
6
|
+
* `sendMail()`; a missing peer throws a clear error.
|
|
7
7
|
*
|
|
8
|
+
* @param options - SMTP transport options + default From address/name.
|
|
9
|
+
* @returns An `EmailAdapter` ready to use in `defineConfig({ email })`.
|
|
8
10
|
* @public
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { nodemailerAdapter } from 'includio-cms/email-nodemailer';
|
|
14
|
+
*
|
|
15
|
+
* const email = nodemailerAdapter({
|
|
16
|
+
* defaultFromAddress: 'no-reply@example.com',
|
|
17
|
+
* defaultFromName: 'Example',
|
|
18
|
+
* transportOptions: { host: 'smtp.example.com', port: 587 }
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
9
21
|
*/
|
|
10
22
|
export function nodemailerAdapter(options) {
|
|
11
23
|
let transporter = null;
|
package/dist/entity/index.d.ts
CHANGED
|
@@ -8,8 +8,23 @@ interface CreateOptions {
|
|
|
8
8
|
sortOrder?: number;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Creates a high-level Entity API (CRUD + publish/archive) bound to a CMS
|
|
11
|
+
* Creates a high-level Entity API (CRUD + publish/archive) bound to a CMS
|
|
12
|
+
* instance and a user. Use it from scripts, migrations, webhooks, or anywhere
|
|
13
|
+
* server-side that needs programmatic content access.
|
|
14
|
+
*
|
|
15
|
+
* @param cms - The CMS instance (typically from `getCMS()`).
|
|
16
|
+
* @param opts - Optional. `userId` is recorded as the `createdBy` for every
|
|
17
|
+
* write (default: `'system'`).
|
|
18
|
+
* @returns An object with `create`, `update`, `publish`, `unpublish`,
|
|
19
|
+
* `archive`, `unarchive`, `delete`, `list`, and `createAndPublish` methods.
|
|
12
20
|
* @public
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { getCMS, createEntityAPI } from 'includio-cms';
|
|
24
|
+
*
|
|
25
|
+
* const api = createEntityAPI(getCMS(), { userId: 'migration-script' });
|
|
26
|
+
* await api.createAndPublish('posts', { title: { en: 'Hello' } });
|
|
27
|
+
* ```
|
|
13
28
|
*/
|
|
14
29
|
export declare function createEntityAPI(cms: CMS, opts?: EntityAPIOptions): {
|
|
15
30
|
create(slug: string, data?: EntryData, options?: CreateOptions & {
|
package/dist/entity/index.js
CHANGED
|
@@ -2,8 +2,23 @@ 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
4
|
/**
|
|
5
|
-
* Creates a high-level Entity API (CRUD + publish/archive) bound to a CMS
|
|
5
|
+
* Creates a high-level Entity API (CRUD + publish/archive) bound to a CMS
|
|
6
|
+
* instance and a user. Use it from scripts, migrations, webhooks, or anywhere
|
|
7
|
+
* server-side that needs programmatic content access.
|
|
8
|
+
*
|
|
9
|
+
* @param cms - The CMS instance (typically from `getCMS()`).
|
|
10
|
+
* @param opts - Optional. `userId` is recorded as the `createdBy` for every
|
|
11
|
+
* write (default: `'system'`).
|
|
12
|
+
* @returns An object with `create`, `update`, `publish`, `unpublish`,
|
|
13
|
+
* `archive`, `unarchive`, `delete`, `list`, and `createAndPublish` methods.
|
|
6
14
|
* @public
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { getCMS, createEntityAPI } from 'includio-cms';
|
|
18
|
+
*
|
|
19
|
+
* const api = createEntityAPI(getCMS(), { userId: 'migration-script' });
|
|
20
|
+
* await api.createAndPublish('posts', { title: { en: 'Hello' } });
|
|
21
|
+
* ```
|
|
7
22
|
*/
|
|
8
23
|
export function createEntityAPI(cms, opts) {
|
|
9
24
|
const db = cms.databaseAdapter;
|
|
@@ -6,7 +6,18 @@ export interface LocalFilesConfig {
|
|
|
6
6
|
ffprobePath?: string;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Local-disk files adapter. Stores uploads under `./static/uploads` (dev) or
|
|
9
|
+
* Local-disk files adapter. Stores uploads under `./static/uploads` (dev) or
|
|
10
|
+
* `/data/uploads` (prod, switched on `NODE_ENV`).
|
|
11
|
+
*
|
|
12
|
+
* @param config - Optional. Override `ffmpegPath` / `ffprobePath` if the
|
|
13
|
+
* binaries are not on `PATH`.
|
|
14
|
+
* @returns A `FilesAdapter` for local filesystem uploads.
|
|
10
15
|
* @public
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { local } from 'includio-cms/files-local';
|
|
19
|
+
*
|
|
20
|
+
* const files = local();
|
|
21
|
+
* ```
|
|
11
22
|
*/
|
|
12
23
|
export declare function local(config?: LocalFilesConfig): FilesAdapter;
|
|
@@ -21,8 +21,19 @@ async function ensureDir(dir) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Local-disk files adapter. Stores uploads under `./static/uploads` (dev) or
|
|
24
|
+
* Local-disk files adapter. Stores uploads under `./static/uploads` (dev) or
|
|
25
|
+
* `/data/uploads` (prod, switched on `NODE_ENV`).
|
|
26
|
+
*
|
|
27
|
+
* @param config - Optional. Override `ffmpegPath` / `ffprobePath` if the
|
|
28
|
+
* binaries are not on `PATH`.
|
|
29
|
+
* @returns A `FilesAdapter` for local filesystem uploads.
|
|
25
30
|
* @public
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { local } from 'includio-cms/files-local';
|
|
34
|
+
*
|
|
35
|
+
* const files = local();
|
|
36
|
+
* ```
|
|
26
37
|
*/
|
|
27
38
|
export function local(config) {
|
|
28
39
|
if (config?.ffmpegPath || config?.ffprobePath) {
|
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
locale?: "en" | "pl";
|
|
5
|
-
}): string;
|
|
6
|
-
/**
|
|
7
|
-
* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
|
|
8
|
-
*
|
|
9
|
-
* - Changing this function will be over-written by the next build.
|
|
10
|
-
*
|
|
11
|
-
* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
|
|
12
|
-
* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
|
|
13
|
-
*
|
|
14
|
-
* @param {{}} inputs
|
|
15
|
-
* @param {{ locale?: "en" | "pl" }} options
|
|
16
|
-
* @returns {string}
|
|
17
|
-
*/
|
|
18
|
-
declare function login_hello(inputs?: {}, options?: {
|
|
19
|
-
locale?: "en" | "pl";
|
|
20
|
-
}): string;
|
|
21
|
-
/**
|
|
22
|
-
* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
|
|
23
|
-
*
|
|
24
|
-
* - Changing this function will be over-written by the next build.
|
|
25
|
-
*
|
|
26
|
-
* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
|
|
27
|
-
* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
|
|
28
|
-
*
|
|
29
|
-
* @param {{}} inputs
|
|
30
|
-
* @param {{ locale?: "en" | "pl" }} options
|
|
31
|
-
* @returns {string}
|
|
32
|
-
*/
|
|
33
|
-
declare function login_please_login(inputs?: {}, options?: {
|
|
34
|
-
locale?: "en" | "pl";
|
|
35
|
-
}): string;
|
|
36
|
-
export { login_hello as login.hello, login_please_login as login.please_login };
|
|
1
|
+
export * from "./hello_world.js";
|
|
2
|
+
export * from "./login_hello.js";
|
|
3
|
+
export * from "./login_please_login.js";
|
|
@@ -1,72 +1,4 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
|
|
7
|
-
*
|
|
8
|
-
* - Changing this function will be over-written by the next build.
|
|
9
|
-
*
|
|
10
|
-
* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
|
|
11
|
-
* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
|
|
12
|
-
*
|
|
13
|
-
* @param {{ name: NonNullable<unknown> }} inputs
|
|
14
|
-
* @param {{ locale?: "en" | "pl" }} options
|
|
15
|
-
* @returns {string}
|
|
16
|
-
*/
|
|
17
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
18
|
-
export const hello_world = (inputs, options = {}) => {
|
|
19
|
-
if (experimentalMiddlewareLocaleSplitting && isServer === false) {
|
|
20
|
-
return /** @type {any} */ (globalThis).__paraglide_ssr.hello_world(inputs)
|
|
21
|
-
}
|
|
22
|
-
const locale = options.locale ?? getLocale()
|
|
23
|
-
trackMessageCall("hello_world", locale)
|
|
24
|
-
if (locale === "en") return en.hello_world(inputs)
|
|
25
|
-
return pl.hello_world(inputs)
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
|
|
29
|
-
*
|
|
30
|
-
* - Changing this function will be over-written by the next build.
|
|
31
|
-
*
|
|
32
|
-
* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
|
|
33
|
-
* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
|
|
34
|
-
*
|
|
35
|
-
* @param {{}} inputs
|
|
36
|
-
* @param {{ locale?: "en" | "pl" }} options
|
|
37
|
-
* @returns {string}
|
|
38
|
-
*/
|
|
39
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
40
|
-
const login_hello = (inputs = {}, options = {}) => {
|
|
41
|
-
if (experimentalMiddlewareLocaleSplitting && isServer === false) {
|
|
42
|
-
return /** @type {any} */ (globalThis).__paraglide_ssr.login_hello(inputs)
|
|
43
|
-
}
|
|
44
|
-
const locale = options.locale ?? getLocale()
|
|
45
|
-
trackMessageCall("login_hello", locale)
|
|
46
|
-
if (locale === "en") return en.login_hello(inputs)
|
|
47
|
-
return pl.login_hello(inputs)
|
|
48
|
-
};
|
|
49
|
-
export { login_hello as "login.hello" }
|
|
50
|
-
/**
|
|
51
|
-
* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
|
|
52
|
-
*
|
|
53
|
-
* - Changing this function will be over-written by the next build.
|
|
54
|
-
*
|
|
55
|
-
* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
|
|
56
|
-
* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
|
|
57
|
-
*
|
|
58
|
-
* @param {{}} inputs
|
|
59
|
-
* @param {{ locale?: "en" | "pl" }} options
|
|
60
|
-
* @returns {string}
|
|
61
|
-
*/
|
|
62
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
63
|
-
const login_please_login = (inputs = {}, options = {}) => {
|
|
64
|
-
if (experimentalMiddlewareLocaleSplitting && isServer === false) {
|
|
65
|
-
return /** @type {any} */ (globalThis).__paraglide_ssr.login_please_login(inputs)
|
|
66
|
-
}
|
|
67
|
-
const locale = options.locale ?? getLocale()
|
|
68
|
-
trackMessageCall("login_please_login", locale)
|
|
69
|
-
if (locale === "en") return en.login_please_login(inputs)
|
|
70
|
-
return pl.login_please_login(inputs)
|
|
71
|
-
};
|
|
72
|
-
export { login_please_login as "login.please_login" }
|
|
2
|
+
export * from './hello_world.js'
|
|
3
|
+
export * from './login_hello.js'
|
|
4
|
+
export * from './login_please_login.js'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';
|
|
3
|
+
|
|
4
|
+
const en_hello_world = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {
|
|
5
|
+
return `Hello, ${i.name} from en!`
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const pl_hello_world = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {
|
|
9
|
+
return `Hello, ${i.name} from pl!`
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
|
|
14
|
+
*
|
|
15
|
+
* - Changing this function will be over-written by the next build.
|
|
16
|
+
*
|
|
17
|
+
* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
|
|
18
|
+
* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
|
|
19
|
+
*
|
|
20
|
+
* @param {{ name: NonNullable<unknown> }} inputs
|
|
21
|
+
* @param {{ locale?: "en" | "pl" }} options
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
25
|
+
export const hello_world = (inputs, options = {}) => {
|
|
26
|
+
if (experimentalMiddlewareLocaleSplitting && isServer === false) {
|
|
27
|
+
return /** @type {any} */ (globalThis).__paraglide_ssr.hello_world(inputs)
|
|
28
|
+
}
|
|
29
|
+
const locale = options.locale ?? getLocale()
|
|
30
|
+
trackMessageCall("hello_world", locale)
|
|
31
|
+
if (locale === "en") return en_hello_world(inputs)
|
|
32
|
+
return pl_hello_world(inputs)
|
|
33
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { login_hello as login.hello };
|
|
2
|
+
/**
|
|
3
|
+
* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
|
|
4
|
+
*
|
|
5
|
+
* - Changing this function will be over-written by the next build.
|
|
6
|
+
*
|
|
7
|
+
* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
|
|
8
|
+
* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
|
|
9
|
+
*
|
|
10
|
+
* @param {{}} inputs
|
|
11
|
+
* @param {{ locale?: "en" | "pl" }} options
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
14
|
+
declare function login_hello(inputs?: {}, options?: {
|
|
15
|
+
locale?: "en" | "pl";
|
|
16
|
+
}): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';
|
|
3
|
+
|
|
4
|
+
const en_login_hello = /** @type {(inputs: {}) => string} */ () => {
|
|
5
|
+
return `Welcome back`
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const pl_login_hello = /** @type {(inputs: {}) => string} */ () => {
|
|
9
|
+
return `Witaj ponownie`
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
|
|
14
|
+
*
|
|
15
|
+
* - Changing this function will be over-written by the next build.
|
|
16
|
+
*
|
|
17
|
+
* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
|
|
18
|
+
* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
|
|
19
|
+
*
|
|
20
|
+
* @param {{}} inputs
|
|
21
|
+
* @param {{ locale?: "en" | "pl" }} options
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
25
|
+
const login_hello = (inputs = {}, options = {}) => {
|
|
26
|
+
if (experimentalMiddlewareLocaleSplitting && isServer === false) {
|
|
27
|
+
return /** @type {any} */ (globalThis).__paraglide_ssr.login_hello(inputs)
|
|
28
|
+
}
|
|
29
|
+
const locale = options.locale ?? getLocale()
|
|
30
|
+
trackMessageCall("login_hello", locale)
|
|
31
|
+
if (locale === "en") return en_login_hello(inputs)
|
|
32
|
+
return pl_login_hello(inputs)
|
|
33
|
+
};
|
|
34
|
+
export { login_hello as "login.hello" }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { login_please_login as login.please_login };
|
|
2
|
+
/**
|
|
3
|
+
* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
|
|
4
|
+
*
|
|
5
|
+
* - Changing this function will be over-written by the next build.
|
|
6
|
+
*
|
|
7
|
+
* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
|
|
8
|
+
* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
|
|
9
|
+
*
|
|
10
|
+
* @param {{}} inputs
|
|
11
|
+
* @param {{ locale?: "en" | "pl" }} options
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
14
|
+
declare function login_please_login(inputs?: {}, options?: {
|
|
15
|
+
locale?: "en" | "pl";
|
|
16
|
+
}): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';
|
|
3
|
+
|
|
4
|
+
const en_login_please_login = /** @type {(inputs: {}) => string} */ () => {
|
|
5
|
+
return `Login to your account`
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const pl_login_please_login = /** @type {(inputs: {}) => string} */ () => {
|
|
9
|
+
return `Zaloguj się na swoje konto`
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
|
|
14
|
+
*
|
|
15
|
+
* - Changing this function will be over-written by the next build.
|
|
16
|
+
*
|
|
17
|
+
* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
|
|
18
|
+
* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
|
|
19
|
+
*
|
|
20
|
+
* @param {{}} inputs
|
|
21
|
+
* @param {{ locale?: "en" | "pl" }} options
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
25
|
+
const login_please_login = (inputs = {}, options = {}) => {
|
|
26
|
+
if (experimentalMiddlewareLocaleSplitting && isServer === false) {
|
|
27
|
+
return /** @type {any} */ (globalThis).__paraglide_ssr.login_please_login(inputs)
|
|
28
|
+
}
|
|
29
|
+
const locale = options.locale ?? getLocale()
|
|
30
|
+
trackMessageCall("login_please_login", locale)
|
|
31
|
+
if (locale === "en") return en_login_please_login(inputs)
|
|
32
|
+
return pl_login_please_login(inputs)
|
|
33
|
+
};
|
|
34
|
+
export { login_please_login as "login.please_login" }
|
package/dist/server/auth.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns the underlying `better-auth` instance from the initialized CMS.
|
|
3
|
+
* Use it to integrate with custom auth flows or read session data.
|
|
4
|
+
*
|
|
5
|
+
* @returns The `better-auth` instance configured by the CMS.
|
|
6
|
+
* @throws {Error} when the CMS was started without `auth` config.
|
|
3
7
|
* @public
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { getAuth } from 'includio-cms/sveltekit/server';
|
|
11
|
+
*
|
|
12
|
+
* const auth = getAuth();
|
|
13
|
+
* const session = await auth.api.getSession({ headers: request.headers });
|
|
14
|
+
* ```
|
|
4
15
|
*/
|
|
5
16
|
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
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { getCMS } from '../core/cms.js';
|
|
2
2
|
/**
|
|
3
3
|
* Returns the underlying `better-auth` instance from the initialized CMS.
|
|
4
|
+
* Use it to integrate with custom auth flows or read session data.
|
|
5
|
+
*
|
|
6
|
+
* @returns The `better-auth` instance configured by the CMS.
|
|
7
|
+
* @throws {Error} when the CMS was started without `auth` config.
|
|
4
8
|
* @public
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { getAuth } from 'includio-cms/sveltekit/server';
|
|
12
|
+
*
|
|
13
|
+
* const auth = getAuth();
|
|
14
|
+
* const session = await auth.api.getSession({ headers: request.headers });
|
|
15
|
+
* ```
|
|
5
16
|
*/
|
|
6
17
|
export function getAuth() {
|
|
7
18
|
return getCMS().auth;
|
|
@@ -14,27 +14,90 @@ type SingleInput = Omit<SingleConfig, 'fields'> & {
|
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* Defines the root CMS configuration. Pass to `includioCMS()` in `hooks.server.ts`.
|
|
17
|
+
*
|
|
18
|
+
* Runs strict runtime validation: invalid configs throw a `ConfigValidationError`
|
|
19
|
+
* (extends `CmsError`) listing every issue with a path and a fix hint, e.g.
|
|
20
|
+
* `languages[0].code: must be a 2-letter ISO code (e.g. 'en')`
|
|
21
|
+
*
|
|
22
|
+
* @param config - The CMSConfig (collections, singles, forms, adapters, languages, ...).
|
|
23
|
+
* @returns The same config, parsed and frozen against typos.
|
|
24
|
+
* @throws {ConfigValidationError} when validation fails — message aggregates all issues.
|
|
17
25
|
* @public
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { defineConfig } from 'includio-cms';
|
|
29
|
+
* export default defineConfig({
|
|
30
|
+
* languages: [{ code: 'en', default: true }],
|
|
31
|
+
* db, files,
|
|
32
|
+
* collections: [postsCollection]
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
18
35
|
*/
|
|
19
36
|
export declare function defineConfig(config: CMSConfig): CMSConfig;
|
|
20
37
|
/**
|
|
21
|
-
* Defines a collection (multi-entry content type).
|
|
38
|
+
* Defines a collection (multi-entry content type, e.g. blog posts, products).
|
|
39
|
+
*
|
|
40
|
+
* @param config - Collection config with slug, fields, and optional layout/labels/icon.
|
|
41
|
+
* @returns A typed `CollectionConfig` ready to drop into `defineConfig({ collections: [...] })`.
|
|
22
42
|
* @public
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* export const posts = defineCollection({
|
|
46
|
+
* slug: 'posts',
|
|
47
|
+
* labels: { singular: 'Post', plural: 'Posts' },
|
|
48
|
+
* fields: [{ slug: 'title', type: 'text', required: true }]
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
23
51
|
*/
|
|
24
52
|
export declare function defineCollection(config: CollectionInput): CollectionConfig;
|
|
25
53
|
/**
|
|
26
|
-
* Defines a singleton (single-entry content type, e.g. site settings).
|
|
54
|
+
* Defines a singleton (single-entry content type, e.g. site settings, homepage).
|
|
55
|
+
*
|
|
56
|
+
* @param config - Single config with slug, fields, and optional label/layout.
|
|
57
|
+
* @returns A typed `SingleConfig` ready to drop into `defineConfig({ singles: [...] })`.
|
|
27
58
|
* @public
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* export const settings = defineSingle({
|
|
62
|
+
* slug: 'settings',
|
|
63
|
+
* fields: [{ slug: 'siteName', type: 'text' }]
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
28
66
|
*/
|
|
29
67
|
export declare function defineSingle(config: SingleInput): SingleConfig;
|
|
30
68
|
/**
|
|
31
|
-
* Defines a public form (submitted via
|
|
69
|
+
* Defines a public form (submitted via `POST /api/forms/[slug]/submit`).
|
|
70
|
+
*
|
|
71
|
+
* @param config - Form config with slug, label, fields, and optional notification emails.
|
|
72
|
+
* @returns The `FormConfig` ready to drop into `defineConfig({ forms: [...] })`.
|
|
32
73
|
* @public
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* export const contact = defineForm({
|
|
77
|
+
* slug: 'contact',
|
|
78
|
+
* label: 'Contact us',
|
|
79
|
+
* fields: [{ slug: 'email', type: 'email', required: true }]
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
33
82
|
*/
|
|
34
83
|
export declare function defineForm(config: FormConfig): FormConfig;
|
|
35
84
|
/**
|
|
36
|
-
* Defines a reusable object field (nested record). Use inside `fields[]
|
|
85
|
+
* Defines a reusable object field (nested record). Use inline inside `fields[]`
|
|
86
|
+
* or as an entry in a `blocks` field.
|
|
87
|
+
*
|
|
88
|
+
* @param config - Object field shape sans the `type` discriminator.
|
|
89
|
+
* @returns The full `ObjectField` (with `type: 'object'` injected).
|
|
37
90
|
* @public
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const cta = defineObject({
|
|
94
|
+
* slug: 'cta',
|
|
95
|
+
* fields: [
|
|
96
|
+
* { slug: 'label', type: 'text' },
|
|
97
|
+
* { slug: 'href', type: 'url' }
|
|
98
|
+
* ]
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
38
101
|
*/
|
|
39
102
|
export declare function defineObject(config: Omit<ObjectField, 'type'>): ObjectField;
|
|
40
103
|
export {};
|
package/dist/sveltekit/config.js
CHANGED
|
@@ -1,34 +1,103 @@
|
|
|
1
|
+
import { cmsConfigSchema } from '../types/cms.schema.js';
|
|
2
|
+
import { formatConfigError } from '../core/errors.js';
|
|
1
3
|
/**
|
|
2
4
|
* Defines the root CMS configuration. Pass to `includioCMS()` in `hooks.server.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Runs strict runtime validation: invalid configs throw a `ConfigValidationError`
|
|
7
|
+
* (extends `CmsError`) listing every issue with a path and a fix hint, e.g.
|
|
8
|
+
* `languages[0].code: must be a 2-letter ISO code (e.g. 'en')`
|
|
9
|
+
*
|
|
10
|
+
* @param config - The CMSConfig (collections, singles, forms, adapters, languages, ...).
|
|
11
|
+
* @returns The same config, parsed and frozen against typos.
|
|
12
|
+
* @throws {ConfigValidationError} when validation fails — message aggregates all issues.
|
|
3
13
|
* @public
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { defineConfig } from 'includio-cms';
|
|
17
|
+
* export default defineConfig({
|
|
18
|
+
* languages: [{ code: 'en', default: true }],
|
|
19
|
+
* db, files,
|
|
20
|
+
* collections: [postsCollection]
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
4
23
|
*/
|
|
5
24
|
export function defineConfig(config) {
|
|
25
|
+
const result = cmsConfigSchema.safeParse(config);
|
|
26
|
+
if (!result.success) {
|
|
27
|
+
throw formatConfigError(result.error);
|
|
28
|
+
}
|
|
6
29
|
return config;
|
|
7
30
|
}
|
|
8
31
|
/**
|
|
9
|
-
* Defines a collection (multi-entry content type).
|
|
32
|
+
* Defines a collection (multi-entry content type, e.g. blog posts, products).
|
|
33
|
+
*
|
|
34
|
+
* @param config - Collection config with slug, fields, and optional layout/labels/icon.
|
|
35
|
+
* @returns A typed `CollectionConfig` ready to drop into `defineConfig({ collections: [...] })`.
|
|
10
36
|
* @public
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* export const posts = defineCollection({
|
|
40
|
+
* slug: 'posts',
|
|
41
|
+
* labels: { singular: 'Post', plural: 'Posts' },
|
|
42
|
+
* fields: [{ slug: 'title', type: 'text', required: true }]
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
11
45
|
*/
|
|
12
46
|
export function defineCollection(config) {
|
|
13
47
|
return config;
|
|
14
48
|
}
|
|
15
49
|
/**
|
|
16
|
-
* Defines a singleton (single-entry content type, e.g. site settings).
|
|
50
|
+
* Defines a singleton (single-entry content type, e.g. site settings, homepage).
|
|
51
|
+
*
|
|
52
|
+
* @param config - Single config with slug, fields, and optional label/layout.
|
|
53
|
+
* @returns A typed `SingleConfig` ready to drop into `defineConfig({ singles: [...] })`.
|
|
17
54
|
* @public
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* export const settings = defineSingle({
|
|
58
|
+
* slug: 'settings',
|
|
59
|
+
* fields: [{ slug: 'siteName', type: 'text' }]
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
18
62
|
*/
|
|
19
63
|
export function defineSingle(config) {
|
|
20
64
|
return config;
|
|
21
65
|
}
|
|
22
66
|
/**
|
|
23
|
-
* Defines a public form (submitted via
|
|
67
|
+
* Defines a public form (submitted via `POST /api/forms/[slug]/submit`).
|
|
68
|
+
*
|
|
69
|
+
* @param config - Form config with slug, label, fields, and optional notification emails.
|
|
70
|
+
* @returns The `FormConfig` ready to drop into `defineConfig({ forms: [...] })`.
|
|
24
71
|
* @public
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* export const contact = defineForm({
|
|
75
|
+
* slug: 'contact',
|
|
76
|
+
* label: 'Contact us',
|
|
77
|
+
* fields: [{ slug: 'email', type: 'email', required: true }]
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
25
80
|
*/
|
|
26
81
|
export function defineForm(config) {
|
|
27
82
|
return config;
|
|
28
83
|
}
|
|
29
84
|
/**
|
|
30
|
-
* Defines a reusable object field (nested record). Use inside `fields[]
|
|
85
|
+
* Defines a reusable object field (nested record). Use inline inside `fields[]`
|
|
86
|
+
* or as an entry in a `blocks` field.
|
|
87
|
+
*
|
|
88
|
+
* @param config - Object field shape sans the `type` discriminator.
|
|
89
|
+
* @returns The full `ObjectField` (with `type: 'object'` injected).
|
|
31
90
|
* @public
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const cta = defineObject({
|
|
94
|
+
* slug: 'cta',
|
|
95
|
+
* fields: [
|
|
96
|
+
* { slug: 'label', type: 'text' },
|
|
97
|
+
* { slug: 'href', type: 'url' }
|
|
98
|
+
* ]
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
32
101
|
*/
|
|
33
102
|
export function defineObject(config) {
|
|
34
103
|
return { ...config, type: 'object' };
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { type Handle } from '@sveltejs/kit';
|
|
2
2
|
import type { CMSConfig } from '../../types/cms.js';
|
|
3
3
|
/**
|
|
4
|
-
* SvelteKit `Handle[]` array that initializes the CMS, generates runtime
|
|
4
|
+
* SvelteKit `Handle[]` array that initializes the CMS, generates runtime
|
|
5
|
+
* artifacts, wires auth/admin guards, and exposes `event.locals.cmsContext`.
|
|
6
|
+
* Compose with `sequence()` in `hooks.server.ts`.
|
|
7
|
+
*
|
|
8
|
+
* @param cmsConfig - The output of `defineConfig({ ... })`.
|
|
9
|
+
* @returns An array of `Handle` middlewares. Pass to `sequence()`.
|
|
5
10
|
* @public
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* // src/hooks.server.ts
|
|
14
|
+
* import { sequence } from '@sveltejs/kit/hooks';
|
|
15
|
+
* import { includioCMS } from 'includio-cms/sveltekit/server';
|
|
16
|
+
* import cmsConfig from '../../cms/cms.config';
|
|
17
|
+
*
|
|
18
|
+
* export const handle = sequence(...includioCMS(cmsConfig));
|
|
19
|
+
* ```
|
|
6
20
|
*/
|
|
7
21
|
export declare function includioCMS(cmsConfig: CMSConfig): Handle[];
|