UNPKG

payload-plugin-scheduler

Version:
31 lines (30 loc) 1.63 kB
import type { CollectionConfig, Field, GlobalConfig } from 'payload'; import db from 'debug'; import type { NormalizedScheduledPostConfig } from './types.js'; export declare const debug: db.Debugger; export declare const flattenFields: (fields: Field[]) => Field[]; export declare const isPluginPublishDateField: (field: Field) => boolean; export declare const getPublishDateFieldNameFromFields: (fields: Field[]) => string | undefined; export declare const fieldHasName: (field: Field, name: string) => boolean; /** * Manual publishDate() fields only mark placement. During config decoration, * replace them with the normalized global field config plus any manual display * overrides stored by publishDate(). */ export declare const applyManualPublishDateFieldOverrides: (field: Field, scheduleConfig: NormalizedScheduledPostConfig) => Field; /**For each configured collection/global, validate any manually placed * publishDate() field, prevent name collisions, and auto-inject the field when * the entity is opted in but has not placed it manually. */ export declare const resolvePublishDateFieldsForEntity: ({ enabled, entityType, fields, fieldName, scheduleConfig, slug, }: { enabled: boolean; entityType: "collection" | "global"; fields: Field[]; fieldName: string; scheduleConfig: NormalizedScheduledPostConfig; slug: string; }) => Field[]; /** * Merge the plugin's schedulePublish settings into the entity's versions.drafts.schedulePublish settings. */ export declare const withScheduledPublishVersions: <T extends CollectionConfig | GlobalConfig>(entity: T, timeIntervals: number) => T;