Skip to content
qino

Since 0.1.0

Entry metadata

CollectionEntryMeta, TreeEntryMeta, ItemEntryMeta, and AnyEntry.

View Markdown
On this page

Every entry returned by a content getter carries a _meta object. Its shape depends on the primitive.

@qino/cms
import type {
  AnyEntry,
  CollectionEntryMeta,
  ItemEntryMeta,
  TreeEntryMeta,
} from "@qino/cms";

CollectionEntryMeta

@qino/cms
type CollectionEntryMeta<
  Ext extends SupportedFileExtension = SupportedFileExtension,
> = {
  slug: string;
  fileName: `${string}${Ext}`;
  filePath: `${string}${Ext}`;
};

TreeEntryMeta

Same shape as CollectionEntryMeta. slug is the slash-joined path, such as guides/setup.

@qino/cms
type TreeEntryMeta<
  Ext extends SupportedFileExtension = SupportedFileExtension,
> = {
  slug: string;
  fileName: `${string}${Ext}`;
  filePath: `${string}${Ext}`;
};

ItemEntryMeta

No slug.

@qino/cms
type ItemEntryMeta<
  Ext extends SupportedFileExtension = SupportedFileExtension,
> = {
  fileName: `${string}${Ext}`;
  filePath: `${string}${Ext}`;
};

AnyEntry

The loosest entry type: any record with a _meta.

@qino/cms
type AnyEntry = Record<string, unknown> & {
  _meta: CollectionEntryMeta | ItemEntryMeta | TreeEntryMeta;
};

Useful for helpers that accept an entry from any primitive without caring about its schema.

Fields

Ext narrows fileName and filePath to end with the primitive's extension. Its default is the union of all four supported extensions.