KO
베타 번역

@core / contracts

1.0.0 ▾
인증됨MIT
GitHub

GenPM 모듈 공용 타입: 콘텐츠, 사이트맵, 검색, 관리 리소스, 결제, 추적 이벤트

코드파일 10개컨텍스트약 532토큰검사 통과

.genpmignore 적용 후 주입될 정확한 트리입니다. 고정 대상:

src/lib/contracts/content.ts읽기 전용 · 7266529
// Fuente de contenido: lo implementan @core/content y los adaptadores (Payload, Keystatic); lo consumen blog,
// blocks, site y los kits sin saber de dónde viene el contenido.

export type ContentStatus = 'draft' | 'scheduled' | 'published' | 'archived';

export type ContentEntry<D = Record<string, unknown>> = {
  id: string;
  collection: string;
  slug: string;
  locale: string;
  status: ContentStatus;
  data: D;
  publishedAt: Date | null;
  updatedAt: Date;
};

export type ContentReadOptions = {
  /** Idioma pedido; sin entrada en ese idioma, la fuente devuelve la del idioma por defecto. */
  locale?: string;
  /** Incluir borradores (solo con un token de vista previa válido). */
  draft?: boolean;
};

export type ContentListQuery = ContentReadOptions & {
  limit?: number;
  offset?: number;
  /** Campo de orden: `publishedAt`, `updatedAt`, `slug` o un campo de `data`. Prefijo `-` = descendente. */
  orderBy?: string;
  /** Igualdad sobre campos de `data` (p. ej. `{ category: 'news' }`). */
  where?: Record<string, string | number | boolean | null>;
  /** El campo de `data` es una lista que contiene este valor (p. ej. `{ tags: 'news' }`). */
  contains?: Record<string, string>;
};

export interface ContentSource {
  getEntry<D = Record<string, unknown>>(
    collection: string,
    slug: string,
    opts?: ContentReadOptions,
  ): Promise<ContentEntry<D> | null>;
  listEntries<D = Record<string, unknown>>(collection: string, query?: ContentListQuery): Promise<ContentEntry<D>[]>;
}

@core/contracts 신고

패키지를 신고하려면 GitHub로 로그인하세요.