identity-admin 1.26.5 → 1.26.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/README.md +126 -126
  2. package/lib/Dashboard.d.ts +14 -14
  3. package/lib/Dashboard.js +95 -95
  4. package/lib/container/helpers/HelperInversify.d.ts +6 -6
  5. package/lib/container/helpers/HelperInversify.js +10 -10
  6. package/lib/container/helpers/HelperTypes.d.ts +5 -5
  7. package/lib/container/helpers/HelperTypes.js +7 -7
  8. package/lib/container/index.d.ts +1 -1
  9. package/lib/container/index.js +14 -14
  10. package/lib/container/repositories/RepositoryInversify.d.ts +4 -4
  11. package/lib/container/repositories/RepositoryInversify.js +13 -13
  12. package/lib/container/repositories/RepositoryTypes.d.ts +4 -4
  13. package/lib/container/repositories/RepositoryTypes.js +6 -6
  14. package/lib/container/types.d.ts +8 -8
  15. package/lib/container/types.js +9 -9
  16. package/lib/controllers/ActionController.d.ts +8 -8
  17. package/lib/controllers/ActionController.js +91 -91
  18. package/lib/controllers/DashboardController.d.ts +43 -43
  19. package/lib/controllers/DashboardController.js +730 -730
  20. package/lib/controllers/ResourceController.d.ts +15 -15
  21. package/lib/controllers/ResourceController.js +134 -134
  22. package/lib/helpers/ActionsGenerator.d.ts +11 -11
  23. package/lib/helpers/ActionsGenerator.js +179 -179
  24. package/lib/helpers/FiltersHelper.d.ts +9 -9
  25. package/lib/helpers/FiltersHelper.js +113 -113
  26. package/lib/helpers/LocalesHelper.d.ts +4 -4
  27. package/lib/helpers/LocalesHelper.js +73 -73
  28. package/lib/helpers/LocalizedStringHelper.d.ts +9 -9
  29. package/lib/helpers/LocalizedStringHelper.js +57 -57
  30. package/lib/helpers/Permissions/PermissionFetcher.d.ts +7 -7
  31. package/lib/helpers/Permissions/PermissionFetcher.js +78 -78
  32. package/lib/helpers/Permissions/PermissionLabel.d.ts +2 -2
  33. package/lib/helpers/Permissions/PermissionLabel.js +42 -42
  34. package/lib/helpers/Permissions/PermissionMapper.d.ts +13 -13
  35. package/lib/helpers/Permissions/PermissionMapper.js +35 -35
  36. package/lib/helpers/Permissions/PermissionResource.d.ts +5 -5
  37. package/lib/helpers/Permissions/PermissionResource.js +31 -31
  38. package/lib/helpers/Permissions/PermissionSavingService.d.ts +13 -13
  39. package/lib/helpers/Permissions/PermissionSavingService.js +32 -32
  40. package/lib/helpers/Permissions/SavePermissionGroup.d.ts +6 -6
  41. package/lib/helpers/Permissions/SavePermissionGroup.js +32 -32
  42. package/lib/helpers/Permissions/UpdatePermissionGroup.d.ts +6 -6
  43. package/lib/helpers/Permissions/UpdatePermissionGroup.js +50 -50
  44. package/lib/helpers/Permissions/types.d.ts +17 -17
  45. package/lib/helpers/Permissions/types.js +2 -2
  46. package/lib/helpers/PopulationHelper.d.ts +12 -12
  47. package/lib/helpers/PopulationHelper.js +50 -50
  48. package/lib/helpers/ReportsGenerator.d.ts +11 -11
  49. package/lib/helpers/ReportsGenerator.js +57 -57
  50. package/lib/helpers/ResourceGenerator.d.ts +9 -9
  51. package/lib/helpers/ResourceGenerator.js +172 -172
  52. package/lib/helpers/ResourceHelper.d.ts +28 -28
  53. package/lib/helpers/ResourceHelper.js +395 -395
  54. package/lib/helpers/RportsGenerator.d.ts +10 -10
  55. package/lib/helpers/RportsGenerator.js +21 -21
  56. package/lib/helpers/SchemaGenerator.d.ts +5 -5
  57. package/lib/helpers/SchemaGenerator.js +97 -97
  58. package/lib/helpers/SchemaHelper.d.ts +5 -5
  59. package/lib/helpers/SchemaHelper.js +21 -21
  60. package/lib/helpers/UserActionsLog/UserActionsLogHelper.d.ts +2 -2
  61. package/lib/helpers/UserActionsLog/UserActionsLogHelper.js +49 -49
  62. package/lib/locales/en.json +53 -53
  63. package/lib/middlewares/cache/decorator.d.ts +3 -3
  64. package/lib/middlewares/cache/decorator.js +60 -60
  65. package/lib/middlewares/cache/deletionMethods.d.ts +3 -3
  66. package/lib/middlewares/cache/deletionMethods.js +23 -23
  67. package/lib/middlewares/isAuth.d.ts +13 -13
  68. package/lib/middlewares/isAuth.js +43 -43
  69. package/lib/models/ModelNames.d.ts +8 -8
  70. package/lib/models/ModelNames.js +11 -11
  71. package/lib/models/adminpermission/AdminPermission.d.ts +6 -6
  72. package/lib/models/adminpermission/AdminPermission.js +23 -23
  73. package/lib/models/adminpermission/IAdminPermission.d.ts +13 -13
  74. package/lib/models/adminpermission/IAdminPermission.js +2 -2
  75. package/lib/models/customPage/CustomPage.d.ts +2 -2
  76. package/lib/models/customPage/CustomPage.js +38 -38
  77. package/lib/models/customPage/ICustomPage.d.ts +17 -17
  78. package/lib/models/customPage/ICustomPage.js +2 -2
  79. package/lib/models/file/File.d.ts +2 -2
  80. package/lib/models/file/File.js +23 -23
  81. package/lib/models/file/IFile.d.ts +15 -15
  82. package/lib/models/file/IFile.js +2 -2
  83. package/lib/models/location/ILocation.d.ts +14 -14
  84. package/lib/models/location/ILocation.js +2 -2
  85. package/lib/models/location/Location.d.ts +2 -2
  86. package/lib/models/location/Location.js +21 -21
  87. package/lib/models/modelConfiguration/IModelConfigurations.d.ts +29 -29
  88. package/lib/models/modelConfiguration/IModelConfigurations.js +2 -2
  89. package/lib/models/modelConfiguration/ModelConfiguration.d.ts +13 -13
  90. package/lib/models/modelConfiguration/ModelConfiguration.js +95 -95
  91. package/lib/models/permission/IPermission.d.ts +14 -14
  92. package/lib/models/permission/IPermission.js +2 -2
  93. package/lib/models/permission/Permission.d.ts +2 -2
  94. package/lib/models/permission/Permission.js +21 -21
  95. package/lib/models/request-log/IRequestLog.d.ts +22 -22
  96. package/lib/models/request-log/IRequestLog.js +2 -2
  97. package/lib/models/request-log/RequestLog.d.ts +3 -3
  98. package/lib/models/request-log/RequestLog.js +51 -51
  99. package/lib/models/userActionsLog/IUserActionsLog.d.ts +26 -24
  100. package/lib/models/userActionsLog/IUserActionsLog.js +11 -9
  101. package/lib/models/userActionsLog/UserActionsLog.d.ts +3 -3
  102. package/lib/models/userActionsLog/UserActionsLog.js +41 -41
  103. package/lib/pdf/ReportTemplate.d.ts +71 -71
  104. package/lib/pdf/ReportTemplate.js +94 -94
  105. package/lib/repositories/DashboardRepository.d.ts +5 -5
  106. package/lib/repositories/DashboardRepository.js +12 -12
  107. package/lib/repositories/Repository.d.ts +68 -68
  108. package/lib/repositories/Repository.js +212 -212
  109. package/lib/repositories/RequestLogRepository.d.ts +10 -10
  110. package/lib/repositories/RequestLogRepository.js +54 -54
  111. package/lib/repositories/SaveResult.d.ts +14 -14
  112. package/lib/repositories/SaveResult.js +18 -18
  113. package/lib/router/index.d.ts +8 -8
  114. package/lib/router/index.js +104 -104
  115. package/lib/types/DashbordConfig.d.ts +21 -21
  116. package/lib/types/DashbordConfig.js +2 -2
  117. package/lib/types/IConfigurationFile.d.ts +9 -9
  118. package/lib/types/IConfigurationFile.js +2 -2
  119. package/lib/types/IResourceFile.d.ts +654 -648
  120. package/lib/types/IResourceFile.js +2 -2
  121. package/lib/types/IResourceResponse.d.ts +95 -95
  122. package/lib/types/IResourceResponse.js +2 -2
  123. package/lib/types/helpers.d.ts +65 -65
  124. package/lib/types/helpers.js +76 -76
  125. package/lib/utils/ResourceUtils.d.ts +2 -2
  126. package/lib/utils/ResourceUtils.js +7 -7
  127. package/lib/utils/ResponseUtils.d.ts +11 -11
  128. package/lib/utils/ResponseUtils.js +41 -41
  129. package/lib/utils/StringUtils.d.ts +9 -9
  130. package/lib/utils/StringUtils.js +46 -46
  131. package/lib/view/asset-manifest.json +18 -18
  132. package/lib/view/assets/icons/delete_icon.svg +3 -3
  133. package/lib/view/assets/icons/flags/ic_flag_cn.svg +9 -9
  134. package/lib/view/assets/icons/flags/ic_flag_sa.svg +9 -9
  135. package/lib/view/assets/icons/flags/ic_flag_vn.svg +9 -9
  136. package/lib/view/assets/icons/info_icon.svg +3 -3
  137. package/lib/view/assets/icons/navbar/ic_banking.svg +5 -5
  138. package/lib/view/assets/icons/navbar/ic_invoice.svg +4 -4
  139. package/lib/view/assets/icons/navbar/ic_kanban.svg +7 -7
  140. package/lib/view/assets/icons/navbar/ic_menu_item.svg +8 -8
  141. package/lib/view/assets/icons/small_info_icon.svg +3 -3
  142. package/lib/view/assets/illustrations/Group 16.svg +4 -4
  143. package/lib/view/assets/illustrations/logo.svg +5 -5
  144. package/lib/view/favicon/browserconfig.xml +9 -9
  145. package/lib/view/favicon/safari-pinned-tab.svg +182 -182
  146. package/lib/view/favicon/site.webmanifest +19 -19
  147. package/lib/view/fonts/index.css +18 -18
  148. package/lib/view/index.html +52 -52
  149. package/lib/view/manifest.json +20 -20
  150. package/lib/view/robots.txt +3 -3
  151. package/lib/view/static/css/main.54de06ef.css +1 -1
  152. package/lib/view/static/js/574.778b5963.chunk.js +1 -1
  153. package/lib/view/static/js/678.521704a3.chunk.js +1 -1
  154. package/lib/view/static/js/798.54856416.chunk.js +1 -1
  155. package/lib/view/static/js/main.4687f255.js +2 -2
  156. package/lib/view/static/js/main.4687f255.js.LICENSE.txt +214 -214
  157. package/package.json +62 -61
@@ -1,648 +1,654 @@
1
- import { ValidationChain } from 'express-validator';
2
- import { Document, Model } from 'mongoose';
3
- import { IRequest } from '../middlewares/isAuth';
4
- import { IRepository, PageInfo, PaginateParams } from '../repositories/Repository';
5
- import SaveResult from '../repositories/SaveResult';
6
- import { ActionNames, ActionTypes, FieldTypes, FileTypes, HandlerStrategy, ImageOptimizingCategories, NeighborTypes, Virtuals } from './helpers';
7
- declare type orderTypes = 'asc' | 'desc';
8
- declare type VirtualFieldTypes = 'password' | 'ref' | 'Array';
9
- declare type Severity = 'success' | 'info' | 'warning' | 'error';
10
- declare type ButtonColors = 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
11
- declare type ButtonVariants = 'text' | 'outlined' | 'contained';
12
- declare type ButtonSizes = 'small' | 'medium' | 'large';
13
- declare type PopulateFunction = (populatedString: any) => Promise<any>;
14
- interface Parent {
15
- /**
16
- * Name of the parent
17
- */
18
- name: string;
19
- /**
20
- * Icon of the parent. You can get the icons from
21
- * {@link https://mui.com/material-ui/material-icons/}
22
- */
23
- icon: string;
24
- }
25
- interface IPopulate {
26
- /**
27
- * This function is called for all the endpoints to have an access over the populated string
28
- */
29
- all?: PopulateFunction;
30
- /**
31
- * This function is called for the list endpoint to have an access over the populated string
32
- */
33
- list?: PopulateFunction;
34
- /**
35
- * This function is called for the get one endpoint either in show or form an access over the populated string
36
- */
37
- show?: PopulateFunction;
38
- }
39
- interface Action {
40
- /**
41
- * Specify if this action is accessible or not.
42
- * @default True for show, edit, delete, and new.
43
- * @default false for bulk delete.
44
- * You can ovveride any of these values here.
45
- */
46
- isAccessible?: boolean;
47
- /**
48
- * Specify if the page requires to be reloaded after executing the action
49
- * @default Fale for show, edit, delete, and new.
50
- */
51
- reloadAfterAction?: boolean;
52
- /**
53
- * The property that manages which admin role can use this action.
54
- * This function's result alters the isAccessible value. So no need to use both properties.
55
- * If both are used then isAccessible has the higher priority.
56
- * @default 'Same as isAccessible'
57
- */
58
- isAllowed?: (currentUser: Document) => boolean;
59
- /**
60
- * The property that manages which action will be extracted from action menu in list.
61
- * @default true for edit and show false for others
62
- */
63
- isMainAction?: boolean;
64
- }
65
- interface ICrudOperations {
66
- index?: {
67
- /**
68
- * Before handler that gives you the access to the filter object.
69
- * You can add to the filter object any key and value that will be used in the filter query before getting the records for list.
70
- * @returns the filter object
71
- */
72
- before?: (req: IRequest, filter: {
73
- [key: string]: any;
74
- }, currentUser: Document) => Promise<{
75
- [key: string]: any;
76
- }>;
77
- /**
78
- * After handler that gives you the access to the array of documents.
79
- * @returns the array of documents
80
- */
81
- after?: (req: IRequest, documents: Document[], currentUser: Document) => Promise<Document[]>;
82
- /**
83
- * index handler that gives you the access to the run custom index method with custom query.
84
- * @returns result list of records
85
- */
86
- index?: (req: IRequest, filter: {
87
- [key: string]: any;
88
- }, sortQuery: {
89
- [key: string]: any;
90
- }, paginateParams: PaginateParams | undefined, populate: any, currentUser: Document) => Promise<{
91
- records: Document[];
92
- pageInfo?: PageInfo;
93
- }>;
94
- };
95
- create?: {
96
- /**
97
- * Before handler that is called before creating a new record.
98
- * This function gives you the access to the record params before saving it, you can perform any update to the params before saving it.
99
- * @returns the params
100
- */
101
- before?: (req: IRequest, params: any, currentUser: Document) => Promise<any>;
102
- /**
103
- * After handler that gives you the access to the saved document.
104
- * @returns the saved document
105
- */
106
- after?: (req: IRequest, document: Document, currentUser: Document, params: any) => Promise<Document>;
107
- /**
108
- * Validators consist of an array of Express ValidationChain, each comprising validation functions that are executed before triggering the save query.
109
- */
110
- validators?: ValidationChain[];
111
- };
112
- update?: {
113
- /**
114
- * Before handler that is called before updating a record.
115
- * This function gives you the access to the record params before saving it, you can perform any update to the params before saving it.
116
- * @returns the params
117
- */
118
- before?: (req: IRequest, params: any, currentUser: Document) => Promise<any>;
119
- /**
120
- * After handler that gives you the access to the updated document.
121
- * @returns the updated document
122
- */
123
- after?: (req: IRequest, document: Document, params: any, currentUser: Document) => Promise<Document>;
124
- /**
125
- * update handler that gives you the access to the run custom update method with custom query.
126
- * @returns saved result with updated document
127
- */
128
- update?: (req: IRequest, record: Document, recordParams: any, currentUser: Document) => Promise<SaveResult<any>>;
129
- /**
130
- * Validators consist of an array of Express ValidationChain, each comprising validation functions that are executed before triggering the update query.
131
- */
132
- validators?: ValidationChain[];
133
- };
134
- show?: {
135
- after?: (req: IRequest, record: Document) => Promise<{
136
- record: Document;
137
- [key: string]: any;
138
- }>;
139
- /**
140
- * A function that is called before getting the next or the previous record. It gives you the access to the filter object.
141
- * @returns The filter object
142
- */
143
- nextPreviousButtonHandler?: (req: IRequest, filter: {
144
- [key: string]: any;
145
- }, currentUser: Document, direction: NeighborTypes) => Promise<{
146
- [key: string]: any;
147
- }>;
148
- };
149
- }
150
- export interface ActionData {
151
- /**
152
- * Record document
153
- */
154
- record: any;
155
- /**
156
- * Current user data
157
- */
158
- currentUser: Document;
159
- /**
160
- * Resource data to which this record belongs
161
- */
162
- resource: {
163
- /**
164
- * Model name of this table.
165
- */
166
- name: string;
167
- /**
168
- * Path of the resource to which you can redirect.
169
- */
170
- path: string;
171
- /**
172
- * Repository of this resource.
173
- */
174
- repository: IRepository<Document>;
175
- };
176
- }
177
- interface IFilters {
178
- /**
179
- * Scope filter props.
180
- * Can be either auto or manual. It cannot be both.
181
- * This filter is not accessible by default
182
- */
183
- scopes?: {
184
- /**
185
- * Specify if this filter is accessible or not
186
- * @default false
187
- */
188
- isAccessible: boolean;
189
- /**
190
- * Show All tab
191
- * @default true
192
- */
193
- showAll?: boolean;
194
- /**
195
- * Automatic scope that filters by the specified key with one of the given options
196
- * This filter works automatically by mentioning the key as saved in the database along with the values that this key can has.
197
- * It doesn't need a handler
198
- */
199
- auto?: IAutoScope;
200
- /**
201
- * Manual scope by using a handler.
202
- * In this case you can put the options you like with specifying in the handler what to do with each option.
203
- */
204
- manual?: IManualScope;
205
- };
206
- /**
207
- * Search bar filter props
208
- */
209
- searchBar?: {
210
- /**
211
- * Specify if this filter is accessible or not
212
- * @default true
213
- */
214
- isAccessible: boolean;
215
- };
216
- }
217
- interface IAutoScope {
218
- /**
219
- * Key of property as specified in the database
220
- */
221
- key: string;
222
- /**
223
- * Array of values that this key can have
224
- */
225
- options: string[];
226
- }
227
- interface IManualScope {
228
- /**
229
- * Array of values that will be appeared in the scope
230
- */
231
- options: string[];
232
- /**
233
- * A handler that will be called when scope filter is used.
234
- * This handler should perform a switch case on the specified options values, each case set the filter on its way.
235
- */
236
- handler: (filter: {
237
- [key: string]: any;
238
- }, scope: string, currentUser: Document) => Promise<{
239
- [key: string]: any;
240
- }>;
241
- }
242
- export interface IFieldValue {
243
- /**
244
- * If the field is required in the schema and you don't want it to be required in the form, you can override this here.
245
- * @default 'same as schema'
246
- */
247
- required?: boolean;
248
- /**
249
- * Specify either this field can be edited or not.
250
- * @default true
251
- */
252
- isEditable?: boolean;
253
- /**
254
- * Specify the type of the field. Can be used for specifying localized string, image,... etc.
255
- * @default 'Same as schema''
256
- */
257
- type?: FieldTypes;
258
- /**
259
- * Specify the enum values if the field type is an enum.
260
- * You can give custom labels with custom background color of the chib as color and label color as labelColor
261
- * @default 'Same as schema''
262
- */
263
- enumValues?: string[] | {
264
- [key: string]: {
265
- label: string;
266
- color: string;
267
- labelColor: string;
268
- };
269
- };
270
- /**
271
- * Specify the allowed country codes.
272
- * @required if the type is phone number
273
- * ex: ["sa", "eg", ...]
274
- */
275
- countryCodes?: string[];
276
- /**
277
- * Specify the array type if the field is of type array.
278
- * @default 'Same as schema''
279
- */
280
- arrayType?: FieldTypes;
281
- /**
282
- * Specify if the array is draggable. Only used when the field type is an array.
283
- * @default 'true''
284
- */
285
- isDraggable?: boolean;
286
- /**
287
- * Can be used only if this field is a reference to the Image collection
288
- */
289
- mediaUploader?: boolean;
290
- /**
291
- * Used only if this field is of type image. It specifies what is the optimizing level of an image before upload
292
- * @default NORMAL
293
- */
294
- imageOptimizingCategory?: ImageOptimizingCategories;
295
- /**
296
- * Specify the type of the file to be uploaded. Only required if the media uploader is true.
297
- * @default image
298
- */
299
- fileType?: FileTypes;
300
- /**
301
- * Specify if the date is shown with time or not. Only used if the field type is Date
302
- * @default false
303
- */
304
- withTime?: boolean;
305
- /**
306
- * Specify the api route that to be called for getting the referenced values
307
- * @default undefined
308
- */
309
- apiRoute?: string;
310
- /**
311
- * Path of the value inside the model schema
312
- * @default undefined
313
- */
314
- valuePath?: string;
315
- /**
316
- * Specify if this property is clickable or not in the list view.
317
- * @default undefined
318
- */
319
- isClickable?: boolean;
320
- /**
321
- * Specify the keys that will be shown in the nested schema. Only used when the type is nested schema
322
- * @default undefined
323
- */
324
- keys?: string[];
325
- /**
326
- * Specify the nested schema. Only used if the type is nested schema.
327
- * @default undefined
328
- */
329
- schema?: IModel | {
330
- [key: string]: IFieldValue;
331
- };
332
- /**
333
- * Specify if this field is filtered by multiple values not only one value. Only used if this value is one of the quick filters.
334
- * @default undefined
335
- */
336
- multipleInFilter?: boolean;
337
- }
338
- export interface IVirtualValue {
339
- /**
340
- * For now we have some virtual fields that can be added
341
- * 1) Password: If you want to add password field in the creation form for example
342
- * 2) ref: If it is a one to many realtion. For example, if you want to get all subCatogeries that belong to a category when you show the category record
343
- * 3) array: If this field is an array
344
- */
345
- type: VirtualFieldTypes;
346
- /**
347
- * Specify the key that should be filtered by in case of 1 to many realtionship
348
- */
349
- filterBy?: string;
350
- /**
351
- * Array type exists only if the type is array
352
- */
353
- arrayType?: string;
354
- /**
355
- * Defines where this virtaul field need to be appeared
356
- */
357
- showIn: Virtuals;
358
- required: boolean;
359
- /**
360
- * Define Virtual field's resource in case of ref type or array of ref type
361
- */
362
- resource?: Model<any, any>;
363
- /**
364
- * Define Filter query creator required in case of showIn Filter
365
- */
366
- handler?: (filterQuery: {
367
- [key: string]: any;
368
- }, value: any | any[]) => Promise<{
369
- [key: string]: any;
370
- }>;
371
- }
372
- export interface IModel {
373
- /**
374
- * virtual data props
375
- */
376
- virtuals?: {
377
- [key: string]: IVirtualValue;
378
- };
379
- }
380
- interface ActionOptions {
381
- show?: Action;
382
- new?: Action;
383
- edit?: Action;
384
- delete?: Action;
385
- bulkDelete?: Action;
386
- /**
387
- * Any extra action to be added.
388
- */
389
- extras?: ExtraAction[];
390
- }
391
- export interface ExtraAction {
392
- /**
393
- * Key of this action.
394
- * Should be unique in the same resource file
395
- */
396
- key: string;
397
- /**
398
- * Name of this action
399
- */
400
- name: string;
401
- /**
402
- * Icon of this action.
403
- * {@link https://mui.com/material-ui/material-icons/}
404
- */
405
- icon: string;
406
- /**
407
- * Color of the action button
408
- * In case of bulk actions it is one of the button colors. @default inherit
409
- * In case of record actions it is any color like red, green, ... @default black
410
- */
411
- color?: string | ButtonColors;
412
- /**
413
- * Size of the action button. Only used in case of bulk actions
414
- * @default small
415
- */
416
- size?: ButtonSizes;
417
- /**
418
- * Variant of the action button. Only used in case of bulk actions
419
- * @default contained
420
- */
421
- variant?: ButtonVariants;
422
- /**
423
- * Action type if it is record action or resource action.
424
- */
425
- actionType: ActionTypes;
426
- /**
427
- * Guard message title that appears before executing the action to confirm execution.
428
- * @default 'No guard message'
429
- */
430
- guardTitle?: string;
431
- /**
432
- * Guard message body that appears before executing the action to confirm execution.
433
- * @default 'No guard message'
434
- */
435
- guard?: string;
436
- /**
437
- * Alert message appear after executing this action.
438
- * @default 'Action was executed successfully'
439
- */
440
- message?: string;
441
- /**
442
- * The severity of the alert. This defines the color and icon used.
443
- * @default 'success'
444
- */
445
- severity?: Severity;
446
- /**
447
- * Specify if you need the dialog to be in full screen or not. Used only in case of custom component strategy
448
- * @default 'false'
449
- */
450
- fullScreen?: boolean;
451
- /**
452
- * @returns boolean value.
453
- * This value Specifies to which records should this action appears.
454
- * @default 'Action is shown to all records'
455
- */
456
- isVisible?: (data: ActionData) => Promise<boolean>;
457
- /**
458
- * Handler function that is executed after clicking the action.
459
- */
460
- handler: (req: IRequest, res: any, data: ActionData) => Promise<IActionHandlerResponse>;
461
- /**
462
- * Icon of this action.
463
- * {@link https://mui.com/material-ui/material-icons/}
464
- */
465
- handlerStrategy?: HandlerStrategy;
466
- /**
467
- * The property that manages which action will be extracted from action menu in list.
468
- * @default true for edit and show false for others
469
- */
470
- isMainAction?: boolean;
471
- }
472
- export interface IActionHandlerResponse {
473
- /**
474
- * The action taken after executing the action.
475
- * For example, if you would like to go to list after executing the action, just set this value by list
476
- */
477
- action: ActionNames;
478
- /**
479
- * Path of the resource that is intended to redirect.
480
- * Is set to resource.path if you would like to be in the same table
481
- */
482
- path: string;
483
- /**
484
- * Id of the record that is used in actions that needs record id like show or edit
485
- */
486
- recordId?: string;
487
- /**
488
- * Path of the uploaded file in case of file download handling strategy
489
- */
490
- filePath?: string;
491
- }
492
- export interface IResourceFile {
493
- properties: {
494
- /**
495
- * The model
496
- */
497
- resource: Model<any, any>;
498
- /**
499
- * Model name as saved in the data base.
500
- */
501
- modelName: string;
502
- /**
503
- * Name of this model appeared on the nav bar.
504
- * @default 'Model name'
505
- */
506
- name?: string;
507
- /**
508
- * Property of this table that is shown as the link for the record.
509
- * Used to be searched by in the search bar.
510
- * If not mentioned explicitly, a search is done on the schema to check for property title, name, or email.
511
- * If these properties are not found, _id is taken.
512
- */
513
- title?: string;
514
- /**
515
- * The property to be sorted by the documents.
516
- * @default 'The schema title'
517
- */
518
- defaultOrderBy?: string;
519
- /**
520
- * The property that controls the permission of this model according to the current user role.
521
- * Specify either this user is allowed to see this model or not.
522
- * @default true
523
- */
524
- isAllowed?: (currentUser: Document) => Promise<boolean>;
525
- /**
526
- * The property that controls the visibility of this resource in the nav bar
527
- * @default true
528
- */
529
- isVisible?: (currentUser: Document) => Promise<boolean>;
530
- /**
531
- * The property that controls the ability of logging changes of this resource.
532
- * @default false
533
- */
534
- enableLog?: (currentUser: Document) => Promise<boolean>;
535
- /**
536
- * The default order
537
- * @default asc
538
- */
539
- defaultOrder?: orderTypes;
540
- /**
541
- * Number of rows per page
542
- * @default 10
543
- */
544
- defaultrowsPerPage?: number;
545
- /**
546
- * The parent that this model is belong to in the nav bar.
547
- * @default 'Set up parent'
548
- */
549
- parent?: Parent;
550
- /**
551
- * Array of fields that are completely hidden from all pages
552
- */
553
- hiddenProperties?: string[];
554
- /**
555
- * Action options for overriding existing actions accessibility or adding custom actions
556
- */
557
- actions?: ActionOptions;
558
- /**
559
- * Filters options
560
- */
561
- filters?: IFilters;
562
- /**
563
- * Using before or after handlers of any crud operation
564
- */
565
- crudOperations?: ICrudOperations;
566
- /**
567
- * Translation object of the fields' names.
568
- */
569
- keysTranslations?: {
570
- [key: string]: any;
571
- };
572
- /**
573
- * Translation object of the actions' names.
574
- */
575
- actionsTranslations?: {
576
- [key: string]: any;
577
- };
578
- /**
579
- * Override some props of a field's schema structure
580
- * Add a new virtual property
581
- */
582
- model?: {
583
- [key: string]: IFieldValue;
584
- } | IModel;
585
- /**
586
- * Override the populated object
587
- */
588
- populate?: IPopulate;
589
- /**
590
- * Disable the display of next and previous buttons in the show page
591
- * @default false
592
- */
593
- disableNextPreviousButtonsInShowPage?: boolean;
594
- /**
595
- * Disable the display of next and previous buttons in the edit page
596
- * @default false
597
- */
598
- disableNextPreviousButtonsInEditPage?: boolean;
599
- /**
600
- * The option to display the edit page instead of the show page
601
- * @default false
602
- */
603
- displayEditPageInShowPage?: boolean;
604
- /**
605
- * Specify the path of image to be shown beside the name in the reference options
606
- * @default undefined
607
- */
608
- imageOnReferencePath?: string;
609
- /**
610
- * The option to disable displaying the image beside the name in the reference options
611
- * @default false
612
- */
613
- disableImageOnReference?: boolean;
614
- /**
615
- * An object for any extra data need to be sent with the resource file
616
- * @default undefined
617
- */
618
- extras?: {
619
- [key: string]: any;
620
- };
621
- };
622
- /**
623
- * Array of properties that should be appeared in the list action.
624
- * @default 'The whole fields'
625
- */
626
- listProperties?: string[];
627
- /**
628
- * Arrays of properties that should be appeared in the show action.
629
- * @default 'The whole fields'
630
- */
631
- showProperties?: string[];
632
- /**
633
- * Array of properties that should be appeared in the create/edit form.
634
- * @default 'The whole fields'
635
- */
636
- formProperties?: string[];
637
- /**
638
- * Array of properties that should be appeared in the filter.
639
- * @default 'The whole fields'
640
- */
641
- filterProperties?: string[];
642
- /**
643
- * Array of properties that should be appeared in the quick filters.
644
- * @default 'Empty array'
645
- */
646
- quickFilterProperties?: string[];
647
- }
648
- export {};
1
+ import { ValidationChain } from 'express-validator';
2
+ import { Document, Model } from 'mongoose';
3
+ import { IRequest } from '../middlewares/isAuth';
4
+ import { IRepository, PageInfo, PaginateParams } from '../repositories/Repository';
5
+ import SaveResult from '../repositories/SaveResult';
6
+ import { ActionNames, ActionTypes, FieldTypes, FileTypes, HandlerStrategy, ImageOptimizingCategories, NeighborTypes, Virtuals } from './helpers';
7
+ import * as Yup from 'yup';
8
+ declare type orderTypes = 'asc' | 'desc';
9
+ declare type VirtualFieldTypes = 'password' | 'ref' | 'Array';
10
+ declare type Severity = 'success' | 'info' | 'warning' | 'error';
11
+ declare type ButtonColors = 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
12
+ declare type ButtonVariants = 'text' | 'outlined' | 'contained';
13
+ declare type ButtonSizes = 'small' | 'medium' | 'large';
14
+ declare type PopulateFunction = (populatedString: any) => Promise<any>;
15
+ interface Parent {
16
+ /**
17
+ * Name of the parent
18
+ */
19
+ name: string;
20
+ /**
21
+ * Icon of the parent. You can get the icons from
22
+ * {@link https://mui.com/material-ui/material-icons/}
23
+ */
24
+ icon: string;
25
+ }
26
+ interface IPopulate {
27
+ /**
28
+ * This function is called for all the endpoints to have an access over the populated string
29
+ */
30
+ all?: PopulateFunction;
31
+ /**
32
+ * This function is called for the list endpoint to have an access over the populated string
33
+ */
34
+ list?: PopulateFunction;
35
+ /**
36
+ * This function is called for the get one endpoint either in show or form an access over the populated string
37
+ */
38
+ show?: PopulateFunction;
39
+ }
40
+ interface Action {
41
+ /**
42
+ * Specify if this action is accessible or not.
43
+ * @default True for show, edit, delete, and new.
44
+ * @default false for bulk delete.
45
+ * You can ovveride any of these values here.
46
+ */
47
+ isAccessible?: boolean;
48
+ /**
49
+ * Specify if the page requires to be reloaded after executing the action
50
+ * @default Fale for show, edit, delete, and new.
51
+ */
52
+ reloadAfterAction?: boolean;
53
+ /**
54
+ * The property that manages which admin role can use this action.
55
+ * This function's result alters the isAccessible value. So no need to use both properties.
56
+ * If both are used then isAccessible has the higher priority.
57
+ * @default 'Same as isAccessible'
58
+ */
59
+ isAllowed?: (currentUser: Document) => boolean;
60
+ /**
61
+ * The property that manages which action will be extracted from action menu in list.
62
+ * @default true for edit and show false for others
63
+ */
64
+ isMainAction?: boolean;
65
+ }
66
+ interface ICrudOperations {
67
+ index?: {
68
+ /**
69
+ * Before handler that gives you the access to the filter object.
70
+ * You can add to the filter object any key and value that will be used in the filter query before getting the records for list.
71
+ * @returns the filter object
72
+ */
73
+ before?: (req: IRequest, filter: {
74
+ [key: string]: any;
75
+ }, currentUser: Document) => Promise<{
76
+ [key: string]: any;
77
+ }>;
78
+ /**
79
+ * After handler that gives you the access to the array of documents.
80
+ * @returns the array of documents
81
+ */
82
+ after?: (req: IRequest, documents: Document[], currentUser: Document) => Promise<Document[]>;
83
+ /**
84
+ * index handler that gives you the access to the run custom index method with custom query.
85
+ * @returns result list of records
86
+ */
87
+ index?: (req: IRequest, filter: {
88
+ [key: string]: any;
89
+ }, sortQuery: {
90
+ [key: string]: any;
91
+ }, paginateParams: PaginateParams | undefined, populate: any, currentUser: Document) => Promise<{
92
+ records: Document[];
93
+ pageInfo?: PageInfo;
94
+ }>;
95
+ };
96
+ create?: {
97
+ /**
98
+ * Before handler that is called before creating a new record.
99
+ * This function gives you the access to the record params before saving it, you can perform any update to the params before saving it.
100
+ * @returns the params
101
+ */
102
+ before?: (req: IRequest, params: any, currentUser: Document) => Promise<any>;
103
+ /**
104
+ * After handler that gives you the access to the saved document.
105
+ * @returns the saved document
106
+ */
107
+ after?: (req: IRequest, document: Document, currentUser: Document, params: any) => Promise<Document>;
108
+ /**
109
+ * Validators consist of an array of Express ValidationChain, each comprising validation functions that are executed before triggering the save query.
110
+ */
111
+ validators?: ValidationChain[];
112
+ };
113
+ update?: {
114
+ /**
115
+ * Before handler that is called before updating a record.
116
+ * This function gives you the access to the record params before saving it, you can perform any update to the params before saving it.
117
+ * @returns the params
118
+ */
119
+ before?: (req: IRequest, params: any, currentUser: Document) => Promise<any>;
120
+ /**
121
+ * After handler that gives you the access to the updated document.
122
+ * @returns the updated document
123
+ */
124
+ after?: (req: IRequest, document: Document, params: any, currentUser: Document) => Promise<Document>;
125
+ /**
126
+ * update handler that gives you the access to the run custom update method with custom query.
127
+ * @returns saved result with updated document
128
+ */
129
+ update?: (req: IRequest, record: Document, recordParams: any, currentUser: Document) => Promise<SaveResult<any>>;
130
+ /**
131
+ * Validators consist of an array of Express ValidationChain, each comprising validation functions that are executed before triggering the update query.
132
+ */
133
+ validators?: ValidationChain[];
134
+ };
135
+ show?: {
136
+ after?: (req: IRequest, record: Document) => Promise<{
137
+ record: Document;
138
+ [key: string]: any;
139
+ }>;
140
+ /**
141
+ * A function that is called before getting the next or the previous record. It gives you the access to the filter object.
142
+ * @returns The filter object
143
+ */
144
+ nextPreviousButtonHandler?: (req: IRequest, filter: {
145
+ [key: string]: any;
146
+ }, currentUser: Document, direction: NeighborTypes) => Promise<{
147
+ [key: string]: any;
148
+ }>;
149
+ };
150
+ }
151
+ export interface ActionData {
152
+ /**
153
+ * Record document
154
+ */
155
+ record: any;
156
+ /**
157
+ * Current user data
158
+ */
159
+ currentUser: Document;
160
+ /**
161
+ * Resource data to which this record belongs
162
+ */
163
+ resource: {
164
+ /**
165
+ * Model name of this table.
166
+ */
167
+ name: string;
168
+ /**
169
+ * Path of the resource to which you can redirect.
170
+ */
171
+ path: string;
172
+ /**
173
+ * Repository of this resource.
174
+ */
175
+ repository: IRepository<Document>;
176
+ };
177
+ }
178
+ interface IFilters {
179
+ /**
180
+ * Scope filter props.
181
+ * Can be either auto or manual. It cannot be both.
182
+ * This filter is not accessible by default
183
+ */
184
+ scopes?: {
185
+ /**
186
+ * Specify if this filter is accessible or not
187
+ * @default false
188
+ */
189
+ isAccessible: boolean;
190
+ /**
191
+ * Show All tab
192
+ * @default true
193
+ */
194
+ showAll?: boolean;
195
+ /**
196
+ * Automatic scope that filters by the specified key with one of the given options
197
+ * This filter works automatically by mentioning the key as saved in the database along with the values that this key can has.
198
+ * It doesn't need a handler
199
+ */
200
+ auto?: IAutoScope;
201
+ /**
202
+ * Manual scope by using a handler.
203
+ * In this case you can put the options you like with specifying in the handler what to do with each option.
204
+ */
205
+ manual?: IManualScope;
206
+ };
207
+ /**
208
+ * Search bar filter props
209
+ */
210
+ searchBar?: {
211
+ /**
212
+ * Specify if this filter is accessible or not
213
+ * @default true
214
+ */
215
+ isAccessible: boolean;
216
+ };
217
+ }
218
+ interface IAutoScope {
219
+ /**
220
+ * Key of property as specified in the database
221
+ */
222
+ key: string;
223
+ /**
224
+ * Array of values that this key can have
225
+ */
226
+ options: string[];
227
+ }
228
+ interface IManualScope {
229
+ /**
230
+ * Array of values that will be appeared in the scope
231
+ */
232
+ options: string[];
233
+ /**
234
+ * A handler that will be called when scope filter is used.
235
+ * This handler should perform a switch case on the specified options values, each case set the filter on its way.
236
+ */
237
+ handler: (filter: {
238
+ [key: string]: any;
239
+ }, scope: string, currentUser: Document) => Promise<{
240
+ [key: string]: any;
241
+ }>;
242
+ }
243
+ export interface IFieldValue {
244
+ /**
245
+ * If the field is required in the schema and you don't want it to be required in the form, you can override this here.
246
+ * @default 'same as schema'
247
+ */
248
+ required?: boolean;
249
+ /**
250
+ * Specify either this field can be edited or not.
251
+ * @default true
252
+ */
253
+ isEditable?: boolean;
254
+ /**
255
+ * Specify the type of the field. Can be used for specifying localized string, image,... etc.
256
+ * @default 'Same as schema''
257
+ */
258
+ type?: FieldTypes;
259
+ /**
260
+ * Specify the enum values if the field type is an enum.
261
+ * You can give custom labels with custom background color of the chib as color and label color as labelColor
262
+ * @default 'Same as schema''
263
+ */
264
+ enumValues?: string[] | {
265
+ [key: string]: {
266
+ label: string;
267
+ color: string;
268
+ labelColor: string;
269
+ };
270
+ };
271
+ /**
272
+ * Specify the allowed country codes.
273
+ * @required if the type is phone number
274
+ * ex: ["sa", "eg", ...]
275
+ */
276
+ countryCodes?: string[];
277
+ /**
278
+ * Specify the array type if the field is of type array.
279
+ * @default 'Same as schema''
280
+ */
281
+ arrayType?: FieldTypes;
282
+ /**
283
+ * Specify if the array is draggable. Only used when the field type is an array.
284
+ * @default 'true''
285
+ */
286
+ isDraggable?: boolean;
287
+ /**
288
+ * Can be used only if this field is a reference to the Image collection
289
+ */
290
+ mediaUploader?: boolean;
291
+ /**
292
+ * Used only if this field is of type image. It specifies what is the optimizing level of an image before upload
293
+ * @default NORMAL
294
+ */
295
+ imageOptimizingCategory?: ImageOptimizingCategories;
296
+ /**
297
+ * Specify the type of the file to be uploaded. Only required if the media uploader is true.
298
+ * @default image
299
+ */
300
+ fileType?: FileTypes;
301
+ /**
302
+ * Specify if the date is shown with time or not. Only used if the field type is Date
303
+ * @default false
304
+ */
305
+ withTime?: boolean;
306
+ /**
307
+ * Specify the api route that to be called for getting the referenced values
308
+ * @default undefined
309
+ */
310
+ apiRoute?: string;
311
+ /**
312
+ * Path of the value inside the model schema
313
+ * @default undefined
314
+ */
315
+ valuePath?: string;
316
+ /**
317
+ * Specify if this property is clickable or not in the list view.
318
+ * @default undefined
319
+ */
320
+ isClickable?: boolean;
321
+ /**
322
+ * Specify the keys that will be shown in the nested schema. Only used when the type is nested schema
323
+ * @default undefined
324
+ */
325
+ keys?: string[];
326
+ /**
327
+ * Specify the nested schema. Only used if the type is nested schema.
328
+ * @default undefined
329
+ */
330
+ schema?: IModel | {
331
+ [key: string]: IFieldValue;
332
+ };
333
+ /**
334
+ * Specify if this field is filtered by multiple values not only one value. Only used if this value is one of the quick filters.
335
+ * @default undefined
336
+ */
337
+ multipleInFilter?: boolean;
338
+ /**
339
+ * Used if you want to override the validation of the original field. For example if you want to add your customized condition for password validations.
340
+ * @default 'Same as schema'
341
+ */
342
+ yupValidationSchema?: Yup.Schema;
343
+ }
344
+ export interface IVirtualValue {
345
+ /**
346
+ * For now we have some virtual fields that can be added
347
+ * 1) Password: If you want to add password field in the creation form for example
348
+ * 2) ref: If it is a one to many realtion. For example, if you want to get all subCatogeries that belong to a category when you show the category record
349
+ * 3) array: If this field is an array
350
+ */
351
+ type: VirtualFieldTypes;
352
+ /**
353
+ * Specify the key that should be filtered by in case of 1 to many realtionship
354
+ */
355
+ filterBy?: string;
356
+ /**
357
+ * Array type exists only if the type is array
358
+ */
359
+ arrayType?: string;
360
+ /**
361
+ * Defines where this virtaul field need to be appeared
362
+ */
363
+ showIn: Virtuals;
364
+ required: boolean;
365
+ /**
366
+ * Define Virtual field's resource in case of ref type or array of ref type
367
+ */
368
+ resource?: Model<any, any>;
369
+ /**
370
+ * Define Filter query creator required in case of showIn Filter
371
+ */
372
+ handler?: (filterQuery: {
373
+ [key: string]: any;
374
+ }, value: any | any[]) => Promise<{
375
+ [key: string]: any;
376
+ }>;
377
+ }
378
+ export interface IModel {
379
+ /**
380
+ * virtual data props
381
+ */
382
+ virtuals?: {
383
+ [key: string]: IVirtualValue;
384
+ };
385
+ }
386
+ interface ActionOptions {
387
+ show?: Action;
388
+ new?: Action;
389
+ edit?: Action;
390
+ delete?: Action;
391
+ bulkDelete?: Action;
392
+ /**
393
+ * Any extra action to be added.
394
+ */
395
+ extras?: ExtraAction[];
396
+ }
397
+ export interface ExtraAction {
398
+ /**
399
+ * Key of this action.
400
+ * Should be unique in the same resource file
401
+ */
402
+ key: string;
403
+ /**
404
+ * Name of this action
405
+ */
406
+ name: string;
407
+ /**
408
+ * Icon of this action.
409
+ * {@link https://mui.com/material-ui/material-icons/}
410
+ */
411
+ icon: string;
412
+ /**
413
+ * Color of the action button
414
+ * In case of bulk actions it is one of the button colors. @default inherit
415
+ * In case of record actions it is any color like red, green, ... @default black
416
+ */
417
+ color?: string | ButtonColors;
418
+ /**
419
+ * Size of the action button. Only used in case of bulk actions
420
+ * @default small
421
+ */
422
+ size?: ButtonSizes;
423
+ /**
424
+ * Variant of the action button. Only used in case of bulk actions
425
+ * @default contained
426
+ */
427
+ variant?: ButtonVariants;
428
+ /**
429
+ * Action type if it is record action or resource action.
430
+ */
431
+ actionType: ActionTypes;
432
+ /**
433
+ * Guard message title that appears before executing the action to confirm execution.
434
+ * @default 'No guard message'
435
+ */
436
+ guardTitle?: string;
437
+ /**
438
+ * Guard message body that appears before executing the action to confirm execution.
439
+ * @default 'No guard message'
440
+ */
441
+ guard?: string;
442
+ /**
443
+ * Alert message appear after executing this action.
444
+ * @default 'Action was executed successfully'
445
+ */
446
+ message?: string;
447
+ /**
448
+ * The severity of the alert. This defines the color and icon used.
449
+ * @default 'success'
450
+ */
451
+ severity?: Severity;
452
+ /**
453
+ * Specify if you need the dialog to be in full screen or not. Used only in case of custom component strategy
454
+ * @default 'false'
455
+ */
456
+ fullScreen?: boolean;
457
+ /**
458
+ * @returns boolean value.
459
+ * This value Specifies to which records should this action appears.
460
+ * @default 'Action is shown to all records'
461
+ */
462
+ isVisible?: (data: ActionData) => Promise<boolean>;
463
+ /**
464
+ * Handler function that is executed after clicking the action.
465
+ */
466
+ handler: (req: IRequest, res: any, data: ActionData) => Promise<IActionHandlerResponse>;
467
+ /**
468
+ * Icon of this action.
469
+ * {@link https://mui.com/material-ui/material-icons/}
470
+ */
471
+ handlerStrategy?: HandlerStrategy;
472
+ /**
473
+ * The property that manages which action will be extracted from action menu in list.
474
+ * @default true for edit and show false for others
475
+ */
476
+ isMainAction?: boolean;
477
+ }
478
+ export interface IActionHandlerResponse {
479
+ /**
480
+ * The action taken after executing the action.
481
+ * For example, if you would like to go to list after executing the action, just set this value by list
482
+ */
483
+ action: ActionNames;
484
+ /**
485
+ * Path of the resource that is intended to redirect.
486
+ * Is set to resource.path if you would like to be in the same table
487
+ */
488
+ path: string;
489
+ /**
490
+ * Id of the record that is used in actions that needs record id like show or edit
491
+ */
492
+ recordId?: string;
493
+ /**
494
+ * Path of the uploaded file in case of file download handling strategy
495
+ */
496
+ filePath?: string;
497
+ }
498
+ export interface IResourceFile {
499
+ properties: {
500
+ /**
501
+ * The model
502
+ */
503
+ resource: Model<any, any>;
504
+ /**
505
+ * Model name as saved in the data base.
506
+ */
507
+ modelName: string;
508
+ /**
509
+ * Name of this model appeared on the nav bar.
510
+ * @default 'Model name'
511
+ */
512
+ name?: string;
513
+ /**
514
+ * Property of this table that is shown as the link for the record.
515
+ * Used to be searched by in the search bar.
516
+ * If not mentioned explicitly, a search is done on the schema to check for property title, name, or email.
517
+ * If these properties are not found, _id is taken.
518
+ */
519
+ title?: string;
520
+ /**
521
+ * The property to be sorted by the documents.
522
+ * @default 'The schema title'
523
+ */
524
+ defaultOrderBy?: string;
525
+ /**
526
+ * The property that controls the permission of this model according to the current user role.
527
+ * Specify either this user is allowed to see this model or not.
528
+ * @default true
529
+ */
530
+ isAllowed?: (currentUser: Document) => Promise<boolean>;
531
+ /**
532
+ * The property that controls the visibility of this resource in the nav bar
533
+ * @default true
534
+ */
535
+ isVisible?: (currentUser: Document) => Promise<boolean>;
536
+ /**
537
+ * The property that controls the ability of logging changes of this resource.
538
+ * @default false
539
+ */
540
+ enableLog?: (currentUser: Document) => Promise<boolean>;
541
+ /**
542
+ * The default order
543
+ * @default asc
544
+ */
545
+ defaultOrder?: orderTypes;
546
+ /**
547
+ * Number of rows per page
548
+ * @default 10
549
+ */
550
+ defaultrowsPerPage?: number;
551
+ /**
552
+ * The parent that this model is belong to in the nav bar.
553
+ * @default 'Set up parent'
554
+ */
555
+ parent?: Parent;
556
+ /**
557
+ * Array of fields that are completely hidden from all pages
558
+ */
559
+ hiddenProperties?: string[];
560
+ /**
561
+ * Action options for overriding existing actions accessibility or adding custom actions
562
+ */
563
+ actions?: ActionOptions;
564
+ /**
565
+ * Filters options
566
+ */
567
+ filters?: IFilters;
568
+ /**
569
+ * Using before or after handlers of any crud operation
570
+ */
571
+ crudOperations?: ICrudOperations;
572
+ /**
573
+ * Translation object of the fields' names.
574
+ */
575
+ keysTranslations?: {
576
+ [key: string]: any;
577
+ };
578
+ /**
579
+ * Translation object of the actions' names.
580
+ */
581
+ actionsTranslations?: {
582
+ [key: string]: any;
583
+ };
584
+ /**
585
+ * Override some props of a field's schema structure
586
+ * Add a new virtual property
587
+ */
588
+ model?: {
589
+ [key: string]: IFieldValue;
590
+ } | IModel;
591
+ /**
592
+ * Override the populated object
593
+ */
594
+ populate?: IPopulate;
595
+ /**
596
+ * Disable the display of next and previous buttons in the show page
597
+ * @default false
598
+ */
599
+ disableNextPreviousButtonsInShowPage?: boolean;
600
+ /**
601
+ * Disable the display of next and previous buttons in the edit page
602
+ * @default false
603
+ */
604
+ disableNextPreviousButtonsInEditPage?: boolean;
605
+ /**
606
+ * The option to display the edit page instead of the show page
607
+ * @default false
608
+ */
609
+ displayEditPageInShowPage?: boolean;
610
+ /**
611
+ * Specify the path of image to be shown beside the name in the reference options
612
+ * @default undefined
613
+ */
614
+ imageOnReferencePath?: string;
615
+ /**
616
+ * The option to disable displaying the image beside the name in the reference options
617
+ * @default false
618
+ */
619
+ disableImageOnReference?: boolean;
620
+ /**
621
+ * An object for any extra data need to be sent with the resource file
622
+ * @default undefined
623
+ */
624
+ extras?: {
625
+ [key: string]: any;
626
+ };
627
+ };
628
+ /**
629
+ * Array of properties that should be appeared in the list action.
630
+ * @default 'The whole fields'
631
+ */
632
+ listProperties?: string[];
633
+ /**
634
+ * Arrays of properties that should be appeared in the show action.
635
+ * @default 'The whole fields'
636
+ */
637
+ showProperties?: string[];
638
+ /**
639
+ * Array of properties that should be appeared in the create/edit form.
640
+ * @default 'The whole fields'
641
+ */
642
+ formProperties?: string[];
643
+ /**
644
+ * Array of properties that should be appeared in the filter.
645
+ * @default 'The whole fields'
646
+ */
647
+ filterProperties?: string[];
648
+ /**
649
+ * Array of properties that should be appeared in the quick filters.
650
+ * @default 'Empty array'
651
+ */
652
+ quickFilterProperties?: string[];
653
+ }
654
+ export {};