@lontar/core 0.0.0-stage → 0.1.2
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/LICENSE +21 -0
- package/README.md +31 -2
- package/dist/client/index.d.ts +13 -0
- package/dist/client/index.js +1 -0
- package/dist/index.d.ts +728 -0
- package/dist/index.js +2689 -0
- package/dist/query-XQ3OKPOy.d.ts +150 -0
- package/dist/zod-DShD3pW7.js +124 -0
- package/package.json +57 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Handiani and Lontar contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @lontar/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The core of [Lontar](https://github.com/handi7/lontar-cms), an open source, TypeScript-first headless CMS. It holds `defineConfig`, the field definitions and their Zod validation, hooks, access control, the REST API (a Hono app) and the Local API.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm add @lontar/core @lontar/db-mysql
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
// lontar.config.ts
|
|
11
|
+
import { defineConfig, collection, fields as f } from '@lontar/core'
|
|
12
|
+
import { mysqlAdapter } from '@lontar/db-mysql'
|
|
13
|
+
|
|
14
|
+
const Posts = collection({
|
|
15
|
+
slug: 'posts',
|
|
16
|
+
fields: { title: f.text({ required: true }) },
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
secret: process.env.LONTAR_SECRET!,
|
|
21
|
+
db: mysqlAdapter({ url: process.env.DATABASE_URL! }),
|
|
22
|
+
collections: [Posts],
|
|
23
|
+
})
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`createLontar(config)` returns a Hono app you can mount in any runtime. `getLontar(config)` gives you the Local API on the server.
|
|
27
|
+
|
|
28
|
+
See the [main README](https://github.com/handi7/lontar-cms#readme) for the full guide.
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { A as ClientUploadField, C as ClientRichTextField, D as ClientTextField, E as ClientSlugField, O as ClientTextareaField, S as ClientRelationshipField, T as ClientSelectOption, _ as ClientDateField, a as WhereClause, b as ClientGlobal, c as SystemFieldName, d as UploadSystemFieldName, f as UploadSystemFields, g as ClientConfig, h as ClientCollection, i as Where, k as ClientUploadConfig, l as SystemFields, m as ClientCheckboxField, n as FilterOperator, o as WhereField, p as CLIENT_CONFIG_VERSION, r as SortItem, s as SYSTEM_FIELDS, t as FieldFilter, u as UPLOAD_SYSTEM_FIELDS, v as ClientEmailField, w as ClientSelectField, x as ClientNumberField, y as ClientField } from "../query-XQ3OKPOy.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare function isRichTextEmpty(val: unknown): boolean;
|
|
4
|
+
/** Optional fields accept `null` and `undefined`, since their column is nullable. */
|
|
5
|
+
export declare function clientFieldToZod(field: ClientField): z.ZodType;
|
|
6
|
+
/**
|
|
7
|
+
* Object schema for a document's fields. Unknown keys, system fields included,
|
|
8
|
+
* are stripped, so a client cannot set `id` or the timestamps.
|
|
9
|
+
*/
|
|
10
|
+
export declare function clientFieldsToZod(fields: readonly ClientField[]): z.ZodObject<{
|
|
11
|
+
[x: string]: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export { CLIENT_CONFIG_VERSION, type ClientCheckboxField, type ClientCollection, type ClientConfig, type ClientDateField, type ClientEmailField, type ClientField, type ClientGlobal, type ClientNumberField, type ClientRelationshipField, type ClientRichTextField, type ClientSelectField, type ClientSelectOption, type ClientSlugField, type ClientTextField, type ClientTextareaField, type ClientUploadConfig, type ClientUploadField, type FieldFilter, type FilterOperator, SYSTEM_FIELDS, type SortItem, type SystemFieldName, type SystemFields, UPLOAD_SYSTEM_FIELDS, type UploadSystemFieldName, type UploadSystemFields, type Where, type WhereClause, type WhereField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { i as CLIENT_CONFIG_VERSION, a as SYSTEM_FIELDS, o as UPLOAD_SYSTEM_FIELDS, t as clientFieldToZod, n as clientFieldsToZod, r as isRichTextEmpty } from "../zod-DShD3pW7.js";
|