// --- UPDATE --- export interface UpdateFieldValues { [fieldName: string]: UpdateFieldValue | undefined; } export type UpdateFieldValue = | string | number | boolean | UpdateLabelingFieldValue | JsonFieldValue | null; export interface UpdateLabelingFieldValue { /** * The node identifiers of the terms. */ t: string[]; } // --- COMMON --- export interface JsonFieldValue { j: unknown; } // --- READ --- export interface ReadFieldValues { [fieldName: string]: ReadFieldValue | undefined; } export type ReadFieldValue = | string | number | boolean | ReadLabelingFieldValue | JsonFieldValue | MediaHandleValue | ReadPartFieldValue; export interface ReadLabelingFieldValue { /** * Taxonomy terms. */ t: ReadTermFieldValue[]; } export interface ReadTermFieldValue { nodeId: string; typeName: string; title: { [language: string]: string | undefined; }; } export interface MediaHandleValue { /** media handle */ h: string; } export interface ReadPartFieldValue { /** part */ p: { nodeId: string; }; } // --- READ WITH ATTACHED --- export interface ReadFieldValuesOrWAttached { [fieldName: string]: ReadFieldValueOrWAttached | undefined; } export type ReadFieldValueOrWAttached = ReadFieldValue | ReadFieldValueWithAttached; /** * The first element is the field value, and the other elements are attached values. * It is a jsonifiable array so the first element must be defined or `null`. */ export type ReadFieldValueWithAttached = [ T | null, ...ReadFieldAttachedValue[], ]; export type ReadFieldAttachedValue = GalleryAttachedValue | TextAttachedValue; export interface GalleryAttachedValue { attached: "gallery"; /** media handle */ h: string; } export interface TextAttachedValue { attached: "text"; excerpt?: string; }