UNPKG

alinea

Version:

[![npm](https://img.shields.io/npm/v/alinea.svg)](https://npmjs.org/package/alinea) [![install size](https://packagephobia.com/badge?p=alinea)](https://packagephobia.com/result?p=alinea)

52 lines (50 loc) 964 B
import { boolean, object, string } from "../chunks/chunk-7LBNER34.js"; import "../chunks/chunk-U5RRZUYZ.js"; // src/core/EntryRecord.ts var META_KEY = "@alinea"; var EntryMeta = object( class { entryId = string; i18nId = string.optional; type = string; index = string; root = string.optional; seeded = boolean.optional; } ); var EntryRecord = object( class { title = string.optional; [META_KEY] = EntryMeta; // ... fields } ); function createRecord(entry) { const { path, title = entry.title, ...data } = entry.data; const meta = { entryId: entry.entryId, type: entry.type, index: entry.index }; if (entry.seeded) meta.seeded = entry.seeded; if (entry.locale && entry.i18nId) meta.i18nId = entry.i18nId; if (!entry.parent) meta.root = entry.root; return { title, ...data, [META_KEY]: meta }; } export { EntryMeta, EntryRecord, META_KEY, createRecord };