Source

adminjs/src/frontend/interfaces/record-json.interface.ts

import { ParamsType } from '../../backend'
import { ActionJSON } from './action/action-json.interface'

/**
 * @memberof {RecordJSON}
 * @alias ErrorMessage
 */
export type ErrorMessage = {
  /** Human readable message */
  message: string;
}

/**
 * JSON representation of an record
 * @subcategory Frontend
 */
export interface RecordJSON {
  /**
   * all flatten params of given record
   */
  params: ParamsType;
  /**
   * If the record has properties which are references - here there will be populated records
   */
  populated: Record<string, RecordJSON | null | undefined>;
  /**
   * List of all validation errors
   */
  errors: Record<string, ErrorMessage>;
  /**
   * Uniq Id of a record. Not present if the record is new (in NewAction)
   */
  id: string;
  /**
   * Title of an record. Not present if the record is new (in NewAction)
   */
  title: string;
  /**
   * Actions which can be performed on this record.
   */
  recordActions: Array<ActionJSON>;
  /**
   * Actions which can be performed on this record in a bulk.
   */
  bulkActions: Array<ActionJSON>;
}

// TODO: describe flatten params