File size: 1,356 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { ErrorTypeEnum } from '../../utils/error-type.enum.js'
import { ParamsType, RecordError } from '../../backend/index.js'
import { ActionJSON } from './action/action-json.interface.js'

/**
 * @memberof {RecordJSON}
 * @alias ErrorMessage
 */
export type ErrorMessage = {
  /** Human readable message */
  message: string;
  /** Error type */
  type?: ErrorTypeEnum | 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>;
  /**
   * Any base/overall validation error for the record
   */
  baseError: RecordError | null;
  /**
   * 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