adminforth 1.4.3-next.9 → 1.5.2

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 (143) hide show
  1. package/dist/basePlugin.d.ts.map +1 -1
  2. package/dist/basePlugin.js +2 -3
  3. package/dist/basePlugin.js.map +1 -1
  4. package/dist/dataConnectors/postgres.d.ts.map +1 -1
  5. package/dist/dataConnectors/postgres.js +29 -9
  6. package/dist/dataConnectors/postgres.js.map +1 -1
  7. package/dist/dataConnectors/sqlite.d.ts.map +1 -1
  8. package/dist/dataConnectors/sqlite.js +12 -5
  9. package/dist/dataConnectors/sqlite.js.map +1 -1
  10. package/dist/index.d.ts +4 -3
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +18 -5
  13. package/dist/index.js.map +1 -1
  14. package/dist/modules/codeInjector.d.ts +4 -2
  15. package/dist/modules/codeInjector.d.ts.map +1 -1
  16. package/dist/modules/codeInjector.js +98 -79
  17. package/dist/modules/codeInjector.js.map +1 -1
  18. package/dist/modules/configValidator.d.ts.map +1 -1
  19. package/dist/modules/configValidator.js +5 -4
  20. package/dist/modules/configValidator.js.map +1 -1
  21. package/dist/modules/operationalResource.d.ts.map +1 -1
  22. package/dist/modules/operationalResource.js.map +1 -1
  23. package/dist/modules/restApi.d.ts +8 -3
  24. package/dist/modules/restApi.d.ts.map +1 -1
  25. package/dist/modules/restApi.js +112 -39
  26. package/dist/modules/restApi.js.map +1 -1
  27. package/dist/modules/socketBroker.d.ts +16 -0
  28. package/dist/modules/socketBroker.d.ts.map +1 -0
  29. package/dist/modules/socketBroker.js +99 -0
  30. package/dist/modules/socketBroker.js.map +1 -0
  31. package/dist/modules/utils.d.ts +2 -1
  32. package/dist/modules/utils.d.ts.map +1 -1
  33. package/dist/modules/utils.js +5 -2
  34. package/dist/modules/utils.js.map +1 -1
  35. package/dist/servers/common.d.ts +21 -0
  36. package/dist/servers/common.d.ts.map +1 -0
  37. package/dist/servers/common.js +13 -0
  38. package/dist/servers/common.js.map +1 -0
  39. package/dist/servers/express.d.ts +5 -0
  40. package/dist/servers/express.d.ts.map +1 -1
  41. package/dist/servers/express.js +54 -7
  42. package/dist/servers/express.js.map +1 -1
  43. package/dist/spa/package-lock.json +59 -0
  44. package/dist/spa/package.json +1 -0
  45. package/dist/spa/src/App.vue +58 -36
  46. package/dist/spa/src/afcl/Button.vue +6 -0
  47. package/dist/spa/src/afcl/Input.vue +13 -4
  48. package/dist/spa/src/afcl/LinkButton.vue +23 -0
  49. package/dist/spa/src/afcl/Select.vue +8 -7
  50. package/dist/spa/src/afcl/VerticalTabs.vue +47 -0
  51. package/dist/spa/src/afcl/index.ts +4 -1
  52. package/dist/spa/src/components/Filters.vue +0 -1
  53. package/dist/spa/src/components/GroupsTable.vue +4 -4
  54. package/dist/spa/src/components/ResourceListTable.vue +21 -21
  55. package/dist/spa/src/components/ValueRenderer.vue +3 -1
  56. package/dist/spa/src/composables/useStores.ts +4 -1
  57. package/dist/spa/src/renderers/CompactField.vue +4 -4
  58. package/dist/spa/src/renderers/CompactUUID.vue +4 -4
  59. package/dist/spa/src/renderers/CountryFlag.vue +3 -3
  60. package/dist/spa/src/renderers/HumanNumber.vue +5 -4
  61. package/dist/spa/src/renderers/RelativeTime.vue +5 -4
  62. package/dist/spa/src/router/index.ts +2 -0
  63. package/dist/spa/src/stores/core.ts +39 -6
  64. package/dist/spa/src/types/Back.ts +102 -9
  65. package/dist/spa/src/types/Common.ts +6 -1
  66. package/dist/spa/src/types/FrontendAPI.ts +7 -0
  67. package/dist/spa/src/views/EditView.vue +1 -0
  68. package/dist/spa/src/views/ListView.vue +2 -2
  69. package/dist/spa/src/views/LoginView.vue +7 -7
  70. package/dist/spa/src/views/PageNotFound.vue +20 -0
  71. package/dist/spa/src/views/ResourceParent.vue +0 -1
  72. package/dist/spa/src/views/ShowView.vue +1 -0
  73. package/dist/spa/src/websocket.ts +84 -0
  74. package/dist/spa/vite.config.ts +16 -34
  75. package/dist/types/Back.d.ts +70 -4
  76. package/dist/types/Back.d.ts.map +1 -1
  77. package/dist/types/Back.js.map +1 -1
  78. package/dist/types/Common.d.ts +4 -0
  79. package/dist/types/Common.d.ts.map +1 -1
  80. package/dist/types/FrontendAPI.d.ts +6 -0
  81. package/dist/types/FrontendAPI.d.ts.map +1 -1
  82. package/dist/types/FrontendAPI.js.map +1 -1
  83. package/package.json +3 -3
  84. package/dist/plugins/audit-log/types.d.ts +0 -35
  85. package/dist/plugins/audit-log/types.d.ts.map +0 -1
  86. package/dist/plugins/audit-log/types.js +0 -2
  87. package/dist/plugins/audit-log/types.js.map +0 -1
  88. package/dist/plugins/chat-gpt/types.d.ts +0 -82
  89. package/dist/plugins/chat-gpt/types.d.ts.map +0 -1
  90. package/dist/plugins/chat-gpt/types.js +0 -2
  91. package/dist/plugins/chat-gpt/types.js.map +0 -1
  92. package/dist/plugins/email-password-reset/types.d.ts +0 -28
  93. package/dist/plugins/email-password-reset/types.d.ts.map +0 -1
  94. package/dist/plugins/email-password-reset/types.js +0 -2
  95. package/dist/plugins/email-password-reset/types.js.map +0 -1
  96. package/dist/plugins/foreign-inline-list/types.d.ts +0 -19
  97. package/dist/plugins/foreign-inline-list/types.d.ts.map +0 -1
  98. package/dist/plugins/foreign-inline-list/types.js +0 -2
  99. package/dist/plugins/foreign-inline-list/types.js.map +0 -1
  100. package/dist/plugins/import-export/types.d.ts +0 -3
  101. package/dist/plugins/import-export/types.d.ts.map +0 -1
  102. package/dist/plugins/import-export/types.js +0 -2
  103. package/dist/plugins/import-export/types.js.map +0 -1
  104. package/dist/plugins/rich-editor/custom/async-queue.d.ts +0 -8
  105. package/dist/plugins/rich-editor/custom/async-queue.d.ts.map +0 -1
  106. package/dist/plugins/rich-editor/custom/async-queue.js +0 -29
  107. package/dist/plugins/rich-editor/custom/async-queue.js.map +0 -1
  108. package/dist/plugins/rich-editor/dist/custom/async-queue.d.ts +0 -8
  109. package/dist/plugins/rich-editor/dist/custom/async-queue.d.ts.map +0 -1
  110. package/dist/plugins/rich-editor/dist/custom/async-queue.js +0 -29
  111. package/dist/plugins/rich-editor/dist/custom/async-queue.js.map +0 -1
  112. package/dist/plugins/rich-editor/types.d.ts +0 -153
  113. package/dist/plugins/rich-editor/types.d.ts.map +0 -1
  114. package/dist/plugins/rich-editor/types.js +0 -16
  115. package/dist/plugins/rich-editor/types.js.map +0 -1
  116. package/dist/plugins/two-factors-auth/types.d.ts +0 -18
  117. package/dist/plugins/two-factors-auth/types.d.ts.map +0 -1
  118. package/dist/plugins/two-factors-auth/types.js +0 -2
  119. package/dist/plugins/two-factors-auth/types.js.map +0 -1
  120. package/dist/plugins/upload/types.d.ts +0 -132
  121. package/dist/plugins/upload/types.d.ts.map +0 -1
  122. package/dist/plugins/upload/types.js +0 -2
  123. package/dist/plugins/upload/types.js.map +0 -1
  124. package/dist/spa/src/acl/Button.vue +0 -21
  125. package/dist/spa/src/acl/Link.vue +0 -9
  126. package/dist/spa/src/components/Dropdown.vue +0 -167
  127. package/dist/spa/src/types/AdminForthConfig.js +0 -150
  128. package/dist/spa/src/types/AdminForthConfig.ts +0 -1816
  129. package/dist/spa/src/types/Commons.ts +0 -702
  130. package/dist/spa/src/types/FrontAndBack.ts +0 -698
  131. package/dist/types/AdminForthConfig.d.ts +0 -1665
  132. package/dist/types/AdminForthConfig.d.ts.map +0 -1
  133. package/dist/types/AdminForthConfig.js +0 -146
  134. package/dist/types/AdminForthConfig.js.map +0 -1
  135. package/dist/types/Commons.d.ts +0 -616
  136. package/dist/types/Commons.d.ts.map +0 -1
  137. package/dist/types/Commons.js +0 -65
  138. package/dist/types/Commons.js.map +0 -1
  139. package/dist/types/FrontAndBack.d.ts +0 -613
  140. package/dist/types/FrontAndBack.d.ts.map +0 -1
  141. package/dist/types/FrontAndBack.js +0 -62
  142. package/dist/types/FrontAndBack.js.map +0 -1
  143. /package/dist/spa/src/{components/AfTooltip.vue → afcl/Tooltip.vue} +0 -0
@@ -1,1816 +0,0 @@
1
- import type { Express } from 'express';
2
- import type { Writable } from 'stream';
3
-
4
- export interface ICodeInjector {
5
- srcFoldersToSync: Object;
6
- allComponentNames: Object;
7
-
8
- getServeDir(): string;
9
- }
10
-
11
- export interface IConfigValidator {
12
- validateConfig()
13
- postProcessAfterDiscover(resource: AdminForthResource): void;
14
- }
15
-
16
- export interface IAdminForthHttpResponse {
17
- setHeader: (key: string, value: string) => void,
18
- setStatus: (code: number, message: string) => void,
19
- blobStream: () => Writable,
20
- };
21
-
22
- /**
23
- * Implement this interface to create custom HTTP server adapter for AdminForth.
24
- */
25
- export interface IHttpServer {
26
-
27
- // constructor(adminforth: IAdminForth): void;
28
-
29
- /**
30
- * Sets up HTTP server to serve AdminForth SPA.
31
- * if hotReload is true, it should proxy all requests and headers to Vite dev server at `http://localhost:5173$\{req.url\}`
32
- * otherwise it should serve AdminForth SPA from dist folder. See Express for example.
33
- */
34
- setupSpaServer(): void;
35
-
36
- /**
37
- * Method which should register endpoint in HTTP server.
38
- *
39
- * @param options : Object with method, path and handler properties.
40
- */
41
- endpoint(options: {
42
- method: string,
43
- noAuth?: boolean,
44
- path: string,
45
- handler: (
46
- body: any,
47
- adminUser: any,
48
- query: {[key: string]: string},
49
- headers: {[key: string]: string},
50
- cookies: {[key: string]: string},
51
- response: IAdminForthHttpResponse,
52
- ) => void,
53
- }): void;
54
-
55
- }
56
-
57
- export type AdminUser = {
58
- /**
59
- * primaryKey field value of user in table which is defined by {@link AdminForthConfig.auth.usersResourceId}
60
- */
61
- pk: string | null,
62
-
63
- /**
64
- * Username which taken from {@link AdminForthConfig.auth.usernameField} field in user resource {@link AdminForthConfig.auth.usersResourceId}
65
- */
66
- username: string,
67
-
68
- /**
69
- * User record fetched from database, from resource defined in {@link AdminForthConfig.auth.usersResourceId}
70
- */
71
- dbUser: any,
72
- }
73
-
74
- export interface IExpressHttpServer extends IHttpServer {
75
-
76
- /**
77
- * Call this method to serve AdminForth SPA from Express instance.
78
- * @param app : Express instance
79
- */
80
- serve(app: Express): void;
81
-
82
- /**
83
- * Method (middleware) to wrap express endpoints with authorization check.
84
- * Adds adminUser to request object if user is authorized. Drops request with 401 status if user is not authorized.
85
- * @param callable : Function which will be called if user is authorized.
86
- *
87
- * Example:
88
- *
89
- * ```ts
90
- * expressApp.get('/myApi', authorize((req, res) => \{
91
- * console.log('User is authorized', req.adminUser);
92
- * res.json(\{ message: 'Hello World' \});
93
- * \}));
94
- * ``
95
- *
96
- */
97
- authorize(callable: Function): void;
98
- }
99
-
100
- export interface IAdminForthFilter {
101
- field: string;
102
- operator: AdminForthFilterOperators;
103
- value: any;
104
- }
105
-
106
- export interface IAdminForthSort {
107
- field: string,
108
- direction: AdminForthSortDirections
109
- }
110
-
111
- export interface IAdminForthDataSourceConnector {
112
-
113
- /**
114
- * Optional.
115
- * You an redefine this function to define how one record should be fetched from database.
116
- * You you will not redefine it, AdminForth will use {@link IAdminForthDataSourceConnector.getData} with limit 1 and offset 0 and
117
- * filter by primary key.
118
- */
119
- getRecordByPrimaryKeyWithOriginalTypes(resource: AdminForthResource, recordId: string): Promise<any>;
120
-
121
-
122
- /**
123
- * Function should go over all columns of table defined in resource.table and try to guess
124
- * data and constraints for each columns.
125
- * Type should be saved to:
126
- * - {@link AdminForthResourceColumn.type}
127
- * Constraints:
128
- * - {@link AdminForthResourceColumn.required}
129
- * - {@link AdminForthResourceColumn.primaryKey}
130
- * For string fields:
131
- * - {@link AdminForthResourceColumn.maxLength}
132
- * For numbers:
133
- * - {@link AdminForthResourceColumn.min}
134
- * - {@link AdminForthResourceColumn.max}
135
- * - {@link AdminForthResourceColumn.minValue}, {@link AdminForthResourceColumn.maxValue}, {@link AdminForthResourceColumn.enum}, {@link AdminForthResourceColumn.foreignResource}, {@link AdminForthResourceColumn.sortable}, {@link AdminForthResourceColumn.backendOnly}, {@link AdminForthResourceColumn.masked}, {@link AdminForthResourceColumn.virtual}, {@link AdminForthResourceColumn.components}, {@link AdminForthResourceColumn.allowMinMaxQuery}, {@link AdminForthResourceColumn.editingNote}, {@link AdminForthResourceColumn.showIn}, {@link AdminForthResourceColumn.isUnique}, {@link AdminForthResourceColumn.validation})
136
- * Also you can additionally save original column type to {@link AdminForthResourceColumn._underlineType}. This might be later used
137
- * in {@link IAdminForthDataSourceConnector.getFieldValue} and {@link IAdminForthDataSourceConnector.setFieldValue} methods.
138
- *
139
- *
140
- * @param resource
141
- */
142
- discoverFields(resource: AdminForthResource): Promise<{[key: string]: AdminForthResourceColumn}>;
143
-
144
-
145
- /**
146
- * Used to transform record after fetching from database.
147
- * According to AdminForth convention, if {@link AdminForthResourceColumn.type} is set to {@link AdminForthDataTypes.DATETIME} then it should be transformed to ISO string.
148
- * @param field
149
- * @param value
150
- */
151
- getFieldValue(field: AdminForthResourceColumn, value: any): any;
152
-
153
- /**
154
- * Used to transform record before saving to database. Should perform operation inverse to {@link IAdminForthDataSourceConnector.getFieldValue}
155
- * @param field
156
- * @param value
157
- */
158
- setFieldValue(field: AdminForthResourceColumn, value: any): any;
159
-
160
- /**
161
- * Used to fetch data from database.
162
- * This method is reused both to list records and show one record (by passing limit 1 and offset 0) .
163
- *
164
- * Fields are returned from db "as is" then {@link AdminForthBaseConnector.getData} will transform each field using {@link IAdminForthDataSourceConnector.getFieldValue}
165
- */
166
- getDataWithOriginalTypes({ resource, limit, offset, sort, filters }: {
167
- resource: AdminForthResource,
168
- limit: number,
169
- offset: number,
170
- sort: IAdminForthSort[],
171
- filters: IAdminForthFilter[],
172
- }): Promise<Array<any>>;
173
-
174
- /**
175
- * Used to get count of records in database.
176
- */
177
- getCount({ resource, filters }: {
178
- resource: AdminForthResource,
179
- filters: IAdminForthFilter[],
180
- }): Promise<number>;
181
-
182
- /**
183
- * Optional method which used to get min and max values for columns in resource.
184
- * Called only for columns which have {@link AdminForthResourceColumn.allowMinMaxQuery} set to true.
185
- *
186
- * Internally should call {@link IAdminForthDataSourceConnector.getFieldValue} for both min and max values.
187
- */
188
- getMinMaxForColumnsWithOriginalTypes({ resource, columns }: { resource: AdminForthResource, columns: AdminForthResourceColumn[] }): Promise<{ [key: string]: { min: any, max: any } }>;
189
-
190
-
191
- /**
192
- * Used to create record in database.
193
- */
194
- createRecordOriginalValues({ resource, record }: { resource: AdminForthResource, record: any }): Promise<void>;
195
-
196
- /**
197
- * Update record in database. newValues might have not all fields in record, but only changed ones.
198
- * recordId is value of field which is marked as {@link AdminForthResourceColumn.primaryKey}
199
- */
200
- updateRecordOriginalValues({ resource, recordId, newValues }: { resource: AdminForthResource; recordId: string; newValues: any; }): Promise<void>;
201
-
202
-
203
- /**
204
- * Used to delete record in database.
205
- */
206
- deleteRecord({ resource, recordId }: { resource: AdminForthResource, recordId: any }): Promise<boolean>;
207
- }
208
-
209
-
210
- /**
211
- * Interface that exposes methods to interact with AdminForth in standard way
212
- */
213
- export interface IAdminForthDataSourceConnectorBase extends IAdminForthDataSourceConnector {
214
-
215
- getPrimaryKey(resource: AdminForthResource): string;
216
-
217
- getData({ resource, limit, offset, sort, filters }: {
218
- resource: AdminForthResource,
219
- limit: number,
220
- offset: number,
221
- sort: IAdminForthSort[],
222
- filters: IAdminForthFilter[],
223
- getTotals?: boolean,
224
- }): Promise<{ data: Array<any>, total: number }>;
225
-
226
- getRecordByPrimaryKey(resource: AdminForthResource, recordId: string): Promise<any>;
227
-
228
- createRecord({ resource, record, adminUser }: {
229
- resource: AdminForthResource,
230
- record: any
231
- adminUser: AdminUser
232
- }): Promise<{ok: boolean, error?: string, createdRecord?: any}>;
233
-
234
- updateRecord({ resource, recordId, newValues }: {
235
- resource: AdminForthResource,
236
- recordId: string,
237
- newValues: any,
238
- }): Promise<{ok: boolean, error?: string}>;
239
-
240
- getMinMaxForColumns({ resource, columns }: { resource: AdminForthResource, columns: AdminForthResourceColumn[] }): Promise<{ [key: string]: { min: any, max: any } }>;
241
- }
242
-
243
-
244
- export interface IAdminForthDataSourceConnectorConstructor {
245
- new ({ url }: { url: string }): IAdminForthDataSourceConnectorBase;
246
- }
247
-
248
- export interface IAdminForthAuth {
249
- verify(jwt : string, mustHaveType: string, decodeUser?: boolean): Promise<any>;
250
- issueJWT(payload: Object, type: string, expiresIn?: string): string;
251
-
252
- removeCustomCookie({response, name}: {response: any, name: string}): void;
253
-
254
- setAuthCookie({expireInDays, response, username, pk,}: {expireInDays?: number, response: any, username: string, pk: string}): void;
255
-
256
- removeAuthCookie(response: any): void;
257
- }
258
-
259
- export interface IAdminForth {
260
- config: AdminForthConfig;
261
- codeInjector: ICodeInjector;
262
- express: IHttpServer;
263
-
264
- activatedPlugins: Array<IAdminForthPlugin>;
265
-
266
- baseUrlSlashed: string;
267
-
268
- statuses: {
269
- dbDiscover: 'running' | 'done',
270
- };
271
-
272
- connectors: {
273
- [key: string]: IAdminForthDataSourceConnectorBase;
274
- };
275
-
276
- createResourceRecord(
277
- params: { resource: AdminForthResource, record: any, adminUser: AdminUser }
278
- ): Promise<{ error?: string, createdRecord?: any }>;
279
-
280
- updateResourceRecord(
281
- params: { resource: AdminForthResource, recordId: any, record: any, oldRecord: any, adminUser: AdminUser }
282
- ): Promise<{ error?: string }>;
283
-
284
- deleteResourceRecord(
285
- params: { resource: AdminForthResource, recordId: string, adminUser: AdminUser, record: any }
286
- ): Promise<{ error?: string }>;
287
-
288
- auth: IAdminForthAuth;
289
-
290
- /**
291
- * Internal flag which indicates if AdminForth is running in hot reload mode.
292
- */
293
- runningHotReload: boolean;
294
-
295
- /**
296
- * Connects to databases defined in datasources and fetches described resource columns to find out data types and constraints.
297
- * You must call this method as soon as possible after AdminForth class is instantiated.
298
- */
299
- discoverDatabases(): Promise<void>;
300
-
301
- /**
302
- * Bundles AdminForth SPA by injecting custom components into internal pre-made SPA source code. It generates internally dist which then will be
303
- * served by AdminForth HTTP adapter.
304
- * Bundle is generated in /tmp folder so if you have ramfs or tmpfs this operation will be faster.
305
- *
306
- * We recommend calling this method from dedicated script which will be run by CI/CD pipeline in build time. This ensures lowest downtime for your users.
307
- * However for simple setup you can call it from your main script, and users will see some "AdminForth is bundling" message in the admin panel while app is bundling.
308
- */
309
- bundleNow({ hotReload, verbose }: { hotReload: boolean, verbose: boolean }): Promise<void>;
310
-
311
- /**
312
- * Resource to get access to operational resources for data api fetching and manipulation.
313
- */
314
- resource(resourceId: string): IOperationalResource;
315
-
316
- /**
317
- * This method will be automatically called from AdminForth HTTP adapter to serve AdminForth SPA.
318
- */
319
- setupEndpoints(server: IHttpServer): void;
320
- }
321
-
322
-
323
- export interface IAdminForthPlugin {
324
- adminforth: IAdminForth;
325
- pluginDir: string;
326
- customFolderName: string;
327
- pluginInstanceId: string;
328
- customFolderPath: string;
329
- pluginOptions: any;
330
- resourceConfig: AdminForthResource;
331
- className: string;
332
-
333
- /**
334
- * Before activating all plugins are sorted by this number and then activated in order.
335
- * If you want to make sure that your plugin is activated after some other plugin, set this number to higher value. (default is 0)
336
- */
337
- activationOrder: number;
338
-
339
-
340
- /**
341
- * AdminForth plugins concept is based on modification of full AdminForth configuration
342
- * to add some custom functionality. For example plugin might simply add custom field to resource by reusing
343
- * {@link AdminForthResourceColumn.components} object, then add some hook which will modify record before getting or saving it to database.
344
- *
345
- * So this method is core of AdminForth plugins. It allows to modify full resource configuration.
346
- * @param adminforth Instance of IAdminForth
347
- * @param resourceConfig Resource configuration object which will be modified by plugin
348
- */
349
- modifyResourceConfig(adminforth: IAdminForth, resourceConfig: AdminForthResource): void;
350
- componentPath(componentFile: string): string;
351
-
352
- /**
353
- * If plugin should support multiple installations per one resource, this function that should return unique string for each instance of plugin.
354
- * For example if plugin is installed for one column and this column defined as
355
- * `targetColumn` in plugin options, then this method should return `${pluginOptions.targetColumn}`.
356
- *
357
- * If plugin should support only one installation per resource, option can return 'single'
358
- * @param pluginOptions - options of plugin
359
- */
360
- instanceUniqueRepresentation(pluginOptions: any) : string;
361
-
362
-
363
- /**
364
- * Optional method which will be called after AdminForth discovers all resources and their columns.
365
- * Can be used to validate types of columns, check if some columns are missing, etc.
366
- */
367
- validateConfigAfterDiscover?(adminforth: IAdminForth, resourceConfig: AdminForthResource): void;
368
-
369
- /**
370
- * Here you can register custom endpoints for your plugin.
371
- *
372
- * @param server
373
- */
374
- setupEndpoints(server: IHttpServer): void;
375
- }
376
-
377
- export enum AdminForthMenuTypes {
378
- /**
379
- * HEADING is just a label in the menu.
380
- * Respect `label` and `icon` property in {@link AdminForthConfigMenuItem}
381
- */
382
- heading = 'heading',
383
-
384
- /**
385
- * GROUP is a group of menu items.
386
- * Respects `label`, `icon` and `children` properties in {@link AdminForthConfigMenuItem}
387
- * use @AdminForthMenuTypes.open to set if group is open by default
388
- */
389
- group = 'group',
390
-
391
- /**
392
- * RESOURCE is a link to a resource.
393
- * Respects `label`, `icon`, `resourceId`, `homepage`, `isStaticRoute` properties in {@link AdminForthConfigMenuItem}
394
- */
395
- resource = 'resource',
396
-
397
- /**
398
- * PAGE is a link to a custom page.
399
- * Respects `label`, `icon`, `path`, `component`, `homepage`, `isStaticRoute`, properties in {@link AdminForthConfigMenuItem}
400
- *
401
- * Example:
402
- *
403
- * ```ts
404
- * \{
405
- * type: AdminForthMenuTypes.PAGE,
406
- * label: 'Custom Page',
407
- * icon: 'home',
408
- * path: '/dash',
409
- * component: '@@/Dashboard.vue',
410
- * homepage: true,
411
- * \}
412
- * ```
413
- *
414
- */
415
- page = 'page',
416
-
417
- /**
418
- * GAP ads some space between menu items.
419
- */
420
- gap = 'gap',
421
-
422
- /**
423
- * DIVIDER is a divider between menu items.
424
- */
425
- divider = 'divider',
426
- }
427
-
428
- export enum AdminForthResourcePages {
429
- list = 'list',
430
- show = 'show',
431
- edit = 'edit',
432
- create = 'create',
433
- filter = 'filter',
434
-
435
- }
436
-
437
-
438
- /**
439
- * Menu item which displayed in the left sidebar of the admin panel.
440
- */
441
- export type AdminForthConfigMenuItem = {
442
- type?: AdminForthMenuTypes | keyof typeof AdminForthMenuTypes,
443
-
444
- /**
445
- * Label for menu item which will be displayed in the admin panel.
446
- */
447
- label?: string,
448
-
449
- /**
450
- * Icon for menu item which will be displayed in the admin panel.
451
- * Supports iconify icons in format `<icon set name>:<icon name>`
452
- * Browse available icons here: https://icon-sets.iconify.design/
453
- *
454
- * Example:
455
- *
456
- * ```ts
457
- * icon: 'flowbite:brain-solid',
458
- * ```
459
- *
460
- */
461
- icon?: string,
462
-
463
- /**
464
- * Path to custom component which will be displayed in the admin panel.
465
- *
466
- */
467
- path?: string,
468
-
469
- /**
470
- * Component to be used for this menu item. Component should be placed in custom folder and referenced with `@@/` prefix.
471
- * Supported for AdminForthMenuTypes.PAGE only!
472
- * Example:
473
- *
474
- * ```ts
475
- * component: '@@/Dashboard.vue',
476
- * ```
477
- *
478
- */
479
- component?: string,
480
-
481
- /**
482
- * Resource ID which will be used to fetch data from.
483
- * Supported for AdminForthMenuTypes.RESOURCE only!
484
- *
485
- */
486
- resourceId?: string,
487
-
488
- /**
489
- * If true, group will be open by default after user login to the admin panel.
490
- * Also will be used to redirect from root path.
491
- */
492
- homepage?: boolean,
493
-
494
- /**
495
- * Where Group is open by default
496
- * Supported for AdminForthMenuTypes.GROUP only!
497
- *
498
- */
499
- open?: boolean,
500
-
501
- /**
502
- * Children menu items which will be displayed in this group.
503
- * Supported for AdminForthMenuTypes.GROUP only!
504
- */
505
- children?: Array<AdminForthConfigMenuItem>,
506
-
507
- /**
508
- * By default all pages are imported dynamically with lazy import().
509
- * If you wish to import page statically, set this option to true.
510
- * Homepage will be imported statically by default. but you can override it with this option.
511
- */
512
- isStaticRoute?: boolean,
513
-
514
- meta?: {
515
- title?: string,
516
- },
517
-
518
- /**
519
- * Optional callback which will be called before rendering the menu for each item.
520
- * You can use it to hide menu items depending on some user
521
- */
522
- visible?: (user: AdminUser) => boolean,
523
-
524
- /**
525
- * Optional callback which will be called before rendering the menu for each item.
526
- * Result of callback if not null will be used as a small badge near the menu item.
527
- */
528
- badge?: string | ((user: AdminUser) => Promise<string>),
529
- }
530
-
531
-
532
- /**
533
- * Column describes one field in the table or collection in database.
534
- */
535
- export type AdminForthResourceColumn = {
536
- /**
537
- * Column name in database.
538
- */
539
- name: string,
540
-
541
- /**
542
- * How column can be labled in the admin panel.
543
- * Use it for renaming columns. Defaulted to column name with Uppercased first letter.
544
- */
545
- label?: string,
546
-
547
- /**
548
- * Type of data in column.
549
- * AdminForth will use this information to render proper input fields in the admin panel.
550
- * AdminForth tries to guess type of data from database column type automatically for typed databases like SQL-based.
551
- * However you can explicitly set it to any value. E.g. set AdminForthDataTypes.DATETIME for your string column in SQLite, which stores ISO date strings.
552
- */
553
- type?: AdminForthDataTypes,
554
-
555
- /**
556
- * An optional configuration object for extra settings.
557
- */
558
- extra?: {
559
-
560
- /**
561
- * How many levels of JSON should be collapsed.
562
- * `0` means - root level will be already collapsed e.g. `{a:1}` will show `{...}` where `'...'` is clickable
563
- * `1` means - root level will be shown, but next sub-level will be collapsed e.g. `{a: {b: 1}}` will show `{a: ...}` where `'...'` is clickable
564
- *
565
- * Default is 1.
566
- */
567
- jsonCollapsedLevel?: number
568
- }
569
-
570
- /**
571
- * Whether to use this column as record identifier.
572
- * Only one column can be primary key.
573
- * AdminForth tries to guess primary key automatically first.
574
- */
575
- primaryKey?: boolean,
576
-
577
- /**
578
- * Whether AdminForth will require this field to be filled in create and edit forms.
579
- * Can be set to boolean or object with create and edit properties.
580
- * If boolean, it will be used for both create and edit forms.
581
- */
582
- required?: boolean | { create?: boolean, edit?: boolean },
583
-
584
- /**
585
- * Whether AdminForth will show editing note near the field in edit/create form.
586
- */
587
- editingNote?: string | { create?: string, edit?: string },
588
-
589
- /**
590
- * On which AdminForth pages this field will be shown. By default all.
591
- * Example: if you want to show field only in create and edit pages, set it to
592
- *
593
- * ```ts
594
- * showIn: [AdminForthResourcePages.CREATE, AdminForthResourcePages.EDIT]
595
- * ```
596
- *
597
- */
598
- showIn?: Array<AdminForthResourcePages | keyof typeof AdminForthResourcePages>,
599
-
600
- /**
601
- * Whether AdminForth will show this field in show view.
602
- */
603
- fillOnCreate?: Function,
604
-
605
- /**
606
- * Whether AdminForth will request user to enter unique value during creating or editing record.
607
- * This option causes AdminForth to make a request to database to check if value is unique.
608
- * (Constraints are not used, so for large-tables performance make sure you have unique index in database if you set this option to true)
609
- */
610
- isUnique?: boolean,
611
-
612
- /**
613
- * Will automatically convert any capital letters to lowercase in input during editing
614
- */
615
- enforceLowerCase?: boolean,
616
-
617
- /**
618
- * Runtime validation Regexp rules for this field.
619
- */
620
- validation?: Array<ValidationObject>,
621
-
622
- /**
623
- * Allows to make the field which does not exist in database table.
624
- * Examples: add custom show field with user country flag:
625
- *
626
- * ```ts
627
- * {
628
- * label: 'Country Flag',
629
- * type: AdminForthDataTypes.STRING,
630
- * virtual: true,
631
- * showIn: [AdminForthResourcePages.SHOW, AdminForthResourcePages.LIST],
632
- * components: {
633
- * show: '@@/CountryFlag.vue',
634
- * list: '@@/CountryFlag.vue',
635
- * },
636
- * }
637
- * ```
638
- *
639
- * This field will be displayed in show and list views with custom component `CountryFlag.vue`. CountryFlag.vue should be placed in custom folder and can be next:
640
- *
641
- * ```html
642
- * <template>
643
- * {{ getFlagEmojiFromIso(record.ipCountry) }}
644
- * </template>
645
- *
646
- * <script setup>
647
- * const props = defineProps(['record']);
648
- *
649
- * function getFlagEmojiFromIso(iso) {
650
- * return iso.toUpperCase().replace(/./g, (char) => String.fromCodePoint(char.charCodeAt(0) + 127397));
651
- * }
652
- * </script>
653
- * ```
654
- *
655
- */
656
- virtual?: boolean,
657
-
658
- /**
659
- * Whether AdminForth will show this field in list view.
660
- */
661
- allowMinMaxQuery?: boolean,
662
-
663
- /**
664
- * Custom components which will be used to render this field in the admin panel.
665
- */
666
- components?: AdminForthFieldComponents
667
-
668
- /**
669
- * Maximum length of string that can be entered in this field.
670
- */
671
- maxLength?: number,
672
-
673
- /**
674
- * Minimum length of string that can be entered in this field.
675
- */
676
- minLength?: number,
677
-
678
- min?: number,
679
- max?: number,
680
-
681
- /**
682
- * Minimum value that can be entered in this field.
683
- */
684
- minValue?: number,
685
-
686
- /**
687
- * Maximum value that can be entered in this field.
688
- */
689
- maxValue?: number,
690
-
691
- /**
692
- * Enum of possible values for this field.
693
- */
694
- enum?: Array<AdminForthColumnEnumItem>,
695
-
696
- /**
697
- * Foreign resource which has pk column with values same that written in this column.
698
- */
699
- foreignResource?:AdminForthForeignResource,
700
-
701
- sortable?: boolean,
702
-
703
- /**
704
- * if true field will !not be passed to UI under no circumstances, but will be presented in hooks
705
- */
706
- backendOnly?: boolean,
707
-
708
- /**
709
- * Masked fields will be displayed as `*****` on Edit and Create pages.
710
- */
711
- masked?: boolean,
712
-
713
-
714
- /**
715
- * Internal type which indicates original type of column in database.
716
- */
717
- _underlineType?: string,
718
- }
719
-
720
-
721
- /**
722
- * Modify query to change how data is fetched from database.
723
- * Return ok: false and error: string to stop execution and show error message to user. Return ok: true to continue execution.
724
- */
725
- export type BeforeDataSourceRequestFunction = (params: {resource: AdminForthResource, adminUser: AdminUser, query: any,
726
- extra: {
727
- body: any,
728
- query: Record<string, string>,
729
- headers: Record<string, string>,
730
- cookies: Record<string, string>,
731
- }
732
- }) => Promise<{ok: boolean, error?: string}>;
733
-
734
- /**
735
- * Modify response to change how data is returned after fetching from database.
736
- * Return ok: false and error: string to stop execution and show error message to user. Return ok: true to continue execution.
737
- */
738
- export type AfterDataSourceResponseFunction = (params: {
739
- resource: AdminForthResource,
740
- adminUser: AdminUser,
741
- response: any,
742
- extra: {
743
- body: any,
744
- query: Record<string, string>,
745
- headers: Record<string, string>,
746
- cookies: { key: string, value: string }[],
747
- }
748
- }) => Promise<{ok: boolean, error?: string}>;
749
-
750
- /**
751
- * Modify record to change how data is saved to database.
752
- * Return ok: false and error: string to stop execution and show error message to user. Return ok: true to continue execution.
753
- */
754
- export type BeforeSaveFunction = (params: {resource: AdminForthResource, recordId: any, adminUser: AdminUser, record: any, oldRecord?: any}) => Promise<{ok: boolean, error?: string}>;
755
-
756
- /**
757
- * Modify record to change how data is saved to database.
758
- * Return ok: false and error: string to stop execution and show error message to user. Return ok: true to continue execution.
759
- */
760
- export type AfterSaveFunction = (params: {resource: AdminForthResource, recordId: any, adminUser: AdminUser, record: any, oldRecord?: any}) => Promise<{ok: boolean, error?: string}>;
761
-
762
- /**
763
- * Allow to get user data before login confirmation, will triger when user try to login.
764
- */
765
- export type BeforeLoginConfirmationFunction = (params?: {
766
- adminUser: AdminUser,
767
- response: IAdminForthHttpResponse,
768
- }) => Promise<{
769
- ok:boolean,
770
- error?:string,
771
- body: {
772
- redirectTo?: string,
773
- allowedLogin?: boolean,
774
- }
775
- }>;
776
-
777
-
778
- export type AdminForthBulkAction = {
779
- id?: string,
780
-
781
- /**
782
- * Label for action button which will be displayed in the list view
783
- */
784
- label: string,
785
- state: string,
786
-
787
- /**
788
- * Icon for action button which will be displayed in the list view
789
- */
790
- icon?: string,
791
-
792
- /**
793
- * Callback which will be called on backend when user clicks on action button.
794
- * It should return Promise which will be resolved when action is done.
795
- */
796
- action: ({ resource, selectedIds, adminUser }: { resource: AdminForthResource, selectedIds: Array<any>, adminUser: AdminUser }) => Promise<{ ok: boolean, error?: string, successMessage?: string }>,
797
-
798
- /**
799
- * Confirmation message which will be displayed to user before action is executed.
800
- */
801
- confirm?: string,
802
-
803
- /**
804
- * Success message which will be displayed to user after action is executed.
805
- */
806
- successMessage?: string,
807
- /**
808
- * Allowed callback called to check whether action is allowed for user.
809
- * 1. It called first time when user goes to list view. If callback returns false, action button will be hidden on list view.
810
- * 2. This same callback called second time when user clicks an action button. If callback returns false, action will not be executed.
811
- * In second time selectedIds will be passed to callback (because checkbox for items are selected), so you can use this to make additional
812
- * checks ( for example to check if user has permission for certain records ).
813
- *
814
- * Example:
815
- *
816
- * ```ts
817
- * allowed: async ({ resource, adminUser, selectedIds }) => {
818
- * if (adminUser.dbUser.role !== 'superadmin') {
819
- * return false;
820
- * }
821
- * return true;
822
- * }
823
- * ```
824
- *
825
- */
826
- allowed?: ({ resource, adminUser, selectedIds, allowedActions }: {
827
-
828
- /**
829
- * recordIds will be passed only once user tries to perform bulk action by clicking on button
830
- */
831
- selectedIds?: Array<any>,
832
- resource: AdminForthResource,
833
-
834
- /**
835
- * Admin user object
836
- */
837
- adminUser: AdminUser,
838
-
839
- /**
840
- * Allowed standard actions for current user resolved by calling allowedActions callbacks if they are passed.
841
- * You can use this variable to rely on standard actions permissions. E.g. if you have custom actions "Mark as read", you
842
- * might want to allow it only for users who have "edit" action allowed:
843
- *
844
- * Example:
845
- *
846
- * ```ts
847
- *
848
- * options: \{
849
- * bulkActions: [
850
- * \{
851
- * label: 'Mark as read',
852
- * action: async (\{ resource, recordIds \}) => \{
853
- * await markAsRead(recordIds);
854
- * \},
855
- * allowed: (\{ allowedActions \}) => allowedActions.edit,
856
- * \}
857
- * ],
858
- * allowedActions: \{
859
- * edit: (\{ resource, adminUser, recordIds \}) => \{
860
- * return adminUser.dbUser.role === 'superadmin';
861
- * \}
862
- * \}
863
- * \}
864
- * ```
865
- *
866
- */
867
- allowedActions: AllowedActionsResolved,
868
- }) => Promise<boolean>,
869
- }
870
-
871
-
872
- /**
873
- * Resource describes one table or collection in database.
874
- * AdminForth generates set of pages for 'list', 'show', 'edit', 'create', 'filter' operations for each resource.
875
- */
876
- export type AdminForthResource = {
877
- /**
878
- * Unique identifier of resource. By default it equals to table name in database.
879
- * If you wish you can explicitly set it to any string.
880
- * We added to support cases when 2 datasources have tables with the same name.
881
- */
882
- resourceId?: string,
883
-
884
- /**
885
- * Label for resource which will be displayed in the admin panel.
886
- * By default it equals to table name in database.
887
- */
888
- label?: string,
889
-
890
- /**
891
- * Table name in database which will be used to fetch data from. Might be case sensitive.
892
- */
893
- table: string,
894
-
895
- /**
896
- * ID of datasource which will be used to fetch data from.
897
- */
898
- dataSource: string,
899
-
900
- /**
901
- * Array of columns which will be displayed in the admin panel.
902
- * Each column has its own configuration.
903
- */
904
- columns: Array<AdminForthResourceColumn>,
905
-
906
- /**
907
- * Internal array of columns which are not virtual. You should not edit it.
908
- */
909
- dataSourceColumns?: Array<AdminForthResourceColumn>, // TODO, mark as private
910
-
911
- /**
912
- * Hook which allow you to modify record label
913
- *
914
- * Example:
915
- *
916
- * ```ts
917
- * recordLabel: (record) => `${record.name} - ${record.id}`,
918
- * ```
919
- *
920
- */
921
- recordLabel?: Function,
922
-
923
- /**
924
- * Array of plugins which will be used to modify resource configuration.
925
- *
926
- */
927
- plugins?: Array<IAdminForthPlugin>,
928
-
929
- /**
930
- * Hooks allow you to change the data on different stages of resource lifecycle.
931
- * Hooks are functions which will be called on backend side (only backend side).
932
- */
933
- hooks?: {
934
- show?: {
935
- /**
936
- * Typical use-cases:
937
- * - request additional data from database before returning to frontend for soft-join
938
- */
939
- beforeDatasourceRequest?: BeforeDataSourceRequestFunction | Array<BeforeDataSourceRequestFunction>,
940
-
941
- /**
942
- * Typical use-cases:
943
- * - Transform value for some field for record returned from database before returning to frontend (minimize, sanitize, etc)
944
- * - If some-why you can't use `backendOnly` you can cleanup sensitive fields here
945
- * - Attach additional data to record before returning to frontend
946
- */
947
- afterDatasourceResponse?: AfterDataSourceResponseFunction | Array<AfterDataSourceResponseFunction>,
948
- },
949
- list?: {
950
- /**
951
- * Typical use-cases:
952
- * - add additional filters in addition to what user selected before fetching data from database.
953
- * - same as hooks.show.beforeDatasourceRequest
954
- */
955
- beforeDatasourceRequest?: BeforeDataSourceRequestFunction | Array<BeforeDataSourceRequestFunction>,
956
-
957
- /**
958
- * Typical use-cases:
959
- * - Same as hooks.show.afterDatasourceResponse but applied for all records returned from database for
960
- * showing in list view, e.g. add new field to each record in list view
961
- */
962
- afterDatasourceResponse?: AfterDataSourceResponseFunction | Array<AfterDataSourceResponseFunction>,
963
- },
964
- create?: {
965
- /**
966
- * Typical use-cases:
967
- * - Validate record before saving to database and interrupt execution if validation failed (`allowedActions.create` should be preferred in most cases)
968
- * - fill-in adminUser as creator of record
969
- * - Attach additional data to record before saving to database (mostly fillOnCreate should be used instead)
970
- */
971
- beforeSave?: BeforeSaveFunction | Array<BeforeSaveFunction>,
972
-
973
- /**
974
- * Typical use-cases:
975
- * - Initiate some trigger after record saved to database (e.g sync to another datasource)
976
- */
977
- afterSave?: AfterSaveFunction | Array<AfterSaveFunction>,
978
- },
979
- edit?: {
980
- /**
981
- * Typical use-cases:
982
- * - Same as hooks.create.beforeSave but for edit page
983
- */
984
- beforeSave?: BeforeSaveFunction | Array<BeforeSaveFunction>,
985
-
986
- /**
987
- * Typical use-cases:
988
- * - Same as hooks.create.afterSave but for edit page
989
- */
990
- afterSave?: AfterSaveFunction | Array<AfterSaveFunction>,
991
- },
992
- delete?: {
993
- /**
994
- * Typical use-cases:
995
- * - Validate that record can be deleted and interrupt execution if validation failed (`allowedActions.delete` should be preferred in most cases)
996
- */
997
- beforeSave?: BeforeSaveFunction | Array<BeforeSaveFunction>,
998
- /**
999
- * Typical use-cases:
1000
- * - Initiate some trigger after record deleted from database (e.g sync to another datasource)
1001
- */
1002
- afterSave?: BeforeSaveFunction | Array<BeforeSaveFunction>,
1003
- },
1004
- },
1005
-
1006
- /**
1007
- * General options for resource.
1008
- */
1009
- options?: {
1010
-
1011
- /**
1012
- * Default sort for list view.
1013
- * Example:
1014
- *
1015
- * ```ts
1016
- * import { AdminForthSortDirections } from 'adminforth';
1017
- *
1018
- * ...
1019
- *
1020
- * defaultSort: {
1021
- * columnName: 'created_at',
1022
- * direction: AdminForthSortDirections.ASC,
1023
- * }
1024
- * ```
1025
- *
1026
- */
1027
- defaultSort?: {
1028
-
1029
- /**
1030
- * Column name which will be used to sort records.
1031
- */
1032
- columnName: string,
1033
-
1034
- /**
1035
- * Direction of sorting. Can be 'asc' or 'desc'.
1036
- */
1037
- direction: AdminForthSortDirections | string,
1038
- }
1039
-
1040
- /**
1041
- * Custom bulk actions list. Bulk actions available in list view when user selects multiple records by
1042
- * using checkboxes.
1043
- */
1044
- bulkActions?: AdminForthBulkAction[],
1045
-
1046
- /**
1047
- * Allowed actions for resource.
1048
- *
1049
- * Example:
1050
- *
1051
- * ```ts
1052
- * allowedActions: {
1053
- * create: ({ resource, adminUser }) => {
1054
- * // Allow only superadmin to create records
1055
- * return adminUser.dbUser.role === 'superadmin';
1056
- * },
1057
- * delete: false, // disable delete action for all users
1058
- * }
1059
- * ```
1060
- *
1061
- */
1062
- allowedActions?: AllowedActions,
1063
-
1064
- /**
1065
- * Allows to make groups of columns in create/edit resource pages.
1066
- */
1067
- createEditGroups?: {
1068
- groupName: string;
1069
- columns: string[];
1070
- }[];
1071
-
1072
- /**
1073
- * Page size for list view
1074
- */
1075
- listPageSize?: number,
1076
-
1077
- /**
1078
- * Callback to define what happens when user clicks on record in list view.
1079
- * By default show view will be opened.
1080
- * If you wish to open custom page, return URL to the custom page (can start with https://, or relative adminforth path)
1081
- * If you wish to open page in new tab, add `target=_blank` get param to returned URL, example:
1082
- *
1083
- * ```ts
1084
- * listTableClickUrl: async (record, adminUser) => {
1085
- * return `https://google.com/search?q=${record.name}&target=_blank`;
1086
- * }
1087
- * ```
1088
- *
1089
- * If you wish to do nothing on click, return null.
1090
- *
1091
- * Example:
1092
- *
1093
- * ```ts
1094
- * listTableClickUrl: async (record, adminUser) => {
1095
- * return null;
1096
- * }
1097
- * ```
1098
- *
1099
- * @param record - record which was clicked
1100
- * @param adminUser - user who clicked
1101
- * @returns
1102
- */
1103
- listTableClickUrl?: (record: any, adminUser: AdminUser) => Promise<string | null>,
1104
-
1105
- /**
1106
- * Whether to refresh existing list rows automatically every N seconds.
1107
- */
1108
- listRowsAutoRefreshSeconds?: number,
1109
-
1110
- /**
1111
- * Custom components which can be injected into AdminForth CRUD pages.
1112
- * Each injection is a path to a custom component which will be displayed in the admin panel.
1113
- * Can be also array to render multiple injections one after another.
1114
- *
1115
- * Example:
1116
- *
1117
- * ```ts
1118
- * pageInjections: {
1119
- * list: {
1120
- * beforeBreadcrumbs: '@@/Announcement.vue',
1121
- * }
1122
- * }
1123
- * ```
1124
- *
1125
- *
1126
- */
1127
- pageInjections?: {
1128
-
1129
-
1130
- /**
1131
- * Custom components which can be injected into resource list page.
1132
- *
1133
- * Component accepts next props: [resource, adminUser, meta]
1134
- */
1135
- list?: {
1136
- beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1137
- afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1138
- bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1139
- threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1140
- customActionIcons?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1141
- },
1142
-
1143
- /**
1144
- * Custom components which can be injected into resource show page.
1145
- *
1146
- * Component accepts next props: [record, resource, adminUser, meta]
1147
- */
1148
- show?: {
1149
- beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1150
- afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1151
- bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1152
- threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1153
- },
1154
-
1155
- /**
1156
- * Custom components which can be injected into resource edit page.
1157
- *
1158
- * Component accepts next props: [record, resource, adminUser, meta]
1159
- */
1160
- edit?: {
1161
- beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1162
- afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1163
- bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1164
- threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1165
- },
1166
-
1167
- /**
1168
- * Custom components which can be injected into resource create page.
1169
- *
1170
- * Component accepts next props: [resource, adminUser, meta]
1171
- */
1172
- create?: {
1173
- beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1174
- afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1175
- bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1176
- threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1177
- },
1178
- }
1179
- },
1180
- }
1181
-
1182
- /**
1183
- * Data source describes database connection which will be used to fetch data for resources.
1184
- * Each resource should use one data source.
1185
- */
1186
- export type AdminForthDataSource = {
1187
- /**
1188
- * ID of datasource which you will use in resources to specify from which database to fetch data from
1189
- */
1190
- id: string,
1191
-
1192
- /**
1193
- * URL to database. Examples:
1194
- *
1195
- * - MongoDB: `mongodb://<user>:<password>@<host>:<port>/<database>`
1196
- * - PostgreSQL: `postgresql://<user>:<password>@<host>:<port>/<database>`
1197
- * - SQLite: `sqlite://<path>`
1198
- */
1199
- url: string,
1200
- }
1201
-
1202
-
1203
- /**
1204
- * Main configuration object for AdminForth
1205
- */
1206
- export type AdminForthConfig = {
1207
-
1208
- /**
1209
- * Authorization module configuration
1210
- */
1211
- auth?: {
1212
- /**
1213
- * Resource ID for resource which stores user table.
1214
- * Resource is a table in database where users will be stored and fetched from. Resources and their ids are defined in resources section of the config.
1215
- * In other words this setting is a reference to a table in database where users will be fetched from on login.
1216
- */
1217
- usersResourceId?: string,
1218
-
1219
- /**
1220
- * Legacy field left for backward compatibility. Use usersResourceId instead.
1221
- */
1222
- resourceId?: string,
1223
-
1224
- /**
1225
- * Field name (column name) in user resource which will be used as username for searching user in database during login.
1226
- * Can be e.g. 'email' or 'username'
1227
- */
1228
- usernameField: string,
1229
-
1230
- /**
1231
- * Field name (column name) in user resource which will be used to get hash of password.
1232
- * Can be e.g. 'passwordHash'
1233
- */
1234
- passwordHashField: string,
1235
-
1236
- /**
1237
- * File path to custom background image for login page
1238
- * Example:
1239
- * Place file `login-background.jpg` to `./custom` folder and set this option:
1240
- *
1241
- * ```ts
1242
- * loginBackgroundImage: '@@/login-background.jpg',
1243
- * ```
1244
- */
1245
- loginBackgroundImage?: string,
1246
-
1247
-
1248
- /**
1249
- * Position of background image on login page
1250
- * 'over' - image will be displayed over full login page under login form
1251
- * '1/2' - image will be displayed on left 1/2 of login page
1252
- *
1253
- * Default: '1/2'
1254
- */
1255
- loginBackgroundPosition?: 'over' | '1/2' | '1/3' | '2/3' | '3/4' | '2/5' | '3/5',
1256
-
1257
- /**
1258
- * Function or functions which will be called before user try to login.
1259
- * Each function will resive User object as an argument
1260
- */
1261
- beforeLoginConfirmation?: BeforeLoginConfirmationFunction | Array<BeforeLoginConfirmationFunction>,
1262
-
1263
- /**
1264
- * Optionally if your users table has a field(column) with full name, you can set it here.
1265
- * This field will be used to display user name in the top right corner of the admin panel.
1266
- */
1267
- userFullNameField?: string,
1268
-
1269
- /**
1270
- * Pair of login and pass substitution for demo mode. Split by ':'
1271
- * ! This option is for demo purposes only, never use it for your projects
1272
- */
1273
- demoCredentials?: string,
1274
-
1275
- /**
1276
- * Any prompt to show users on login. Supports HTML.
1277
- */
1278
- loginPromptHTML?: string,
1279
-
1280
- /**
1281
- * Remember me days for "Remember Me" checkbox on login page.
1282
- * If not set or set to null/0/undefined, "Remember Me" checkbox will not be displayed.
1283
- * If rememberMeDays is set, then users who check "Remember Me" will be staying logged in for this amount of days.
1284
- */
1285
- rememberMeDays?: number,
1286
- },
1287
- /**
1288
- * Array of resources which will be displayed in the admin panel.
1289
- * Resource represents one table or collection in database.
1290
- * Each resource has its own configuration.
1291
- */
1292
- resources: Array<AdminForthResource>,
1293
-
1294
- /**
1295
- * Array of left sidebar menu items which will be displayed in the admin panel.
1296
- * Menu items can be links to resources or custom pages.
1297
- * Menu items can be grouped.
1298
- *
1299
- */
1300
- menu: Array<AdminForthConfigMenuItem>,
1301
-
1302
- /**
1303
- * If you want use custom DataSource which is not supported by AdminForth yet, you can define it's class here
1304
- *
1305
- */
1306
- databaseConnectors?: {
1307
- [key: string]: IAdminForthDataSourceConnectorConstructor,
1308
- },
1309
-
1310
- /**
1311
- * List of data sources which will be used to fetch data for resources.
1312
- * Datasource is one database connection
1313
- *
1314
- */
1315
- dataSources: Array<AdminForthDataSource>,
1316
-
1317
- /**
1318
- * Settings which allow you to customize AdminForth
1319
- *
1320
- */
1321
- customization?: {
1322
- /**
1323
- * Your app name
1324
- */
1325
- brandName?: string,
1326
-
1327
- /**
1328
- * Slug which will be used on tech side e.g. to store cookies separately.
1329
- * Created automatically from brandName if not set.
1330
- */
1331
- _brandNameSlug?: string,
1332
-
1333
- /**
1334
- * Whether to show brand name in sidebar
1335
- * default is true
1336
- */
1337
- showBrandNameInSidebar?: boolean,
1338
-
1339
- /**
1340
- * Path to your app logo
1341
- *
1342
- * Example:
1343
- * Place file `logo.svg` to `./custom` folder and set this option:
1344
- *
1345
- * ```ts
1346
- * brandLogo: '@@/logo.svg',
1347
- * ```
1348
- *
1349
- */
1350
- brandLogo?: string,
1351
-
1352
- /**
1353
- * Path to your app favicon
1354
- *
1355
- * Example:
1356
- * Place file `favicon.png` to `./custom` folder and set this option:
1357
- *
1358
- * ```ts
1359
- * favicon: '@@/favicon.png',
1360
- * ```
1361
- */
1362
- favicon?: string,
1363
-
1364
- /**
1365
- * DayJS format string for all dates in the app.
1366
- * Defaulted to 'MMM D, YYYY'
1367
- */
1368
- datesFormat?: string,
1369
-
1370
- /**
1371
- * DayJS format string for all datetimes in the app.
1372
- * Defaulted to 'HH:mm:ss'
1373
- */
1374
- timeFormat?: string,
1375
-
1376
- /**
1377
- * HTML title tag value, defaults to brandName
1378
- */
1379
- title?: string,
1380
-
1381
- /**
1382
- * Placeholder for empty fields in lists and show views, by default empty string ''
1383
- */
1384
- emptyFieldPlaceholder?: {
1385
- show?: string,
1386
- list?: string,
1387
-
1388
- } | string,
1389
-
1390
- /**
1391
- * Relative or absolute path to custom components directory
1392
- * By default equals `./custom`.
1393
- *
1394
- * Custom .vue files, images, and any other assets placed in this directory can be accessed in AdminForth components and configs with `@@/`.
1395
- *
1396
- * For example if file path is `./custom/comp/my.vue`, you can use it in AdminForth config like this:
1397
- *
1398
- * ```ts
1399
- * components: {
1400
- * show: '@@/comp/my.vue',
1401
- * }
1402
- * ```
1403
- *
1404
- */
1405
- customComponentsDir?: string,
1406
-
1407
- /**
1408
- * Path to custom .ts file which allows to inject custom Vue uses in SPA or add custom imports.
1409
- *
1410
- * Example: Create file: `./custom/vue-uses.ts` with next content:
1411
- *
1412
- * ```ts
1413
- * import HighchartsVue from 'highcharts-vue';
1414
- * // import '@@/custom.scss'; // here is how you can import custom styles
1415
- *
1416
- * export default function (app) {
1417
- * app.use(HighchartsVue);
1418
- * }
1419
- * ```
1420
- *
1421
- * Install HighCharts into custom folder:
1422
- *
1423
- * ```bashcreating rec
1424
- * cd custom
1425
- * npm init -y
1426
- * npm install highcharts highcharts-vue
1427
- * ```
1428
- *
1429
- * And specify vueUsesFile in AdminForth config:
1430
- *
1431
- * ```ts
1432
- * vueUsesFile: '@@/vue-uses.ts',
1433
- * ```
1434
- *
1435
- */
1436
- vueUsesFile?: string,
1437
- /**
1438
- * Object to redefine default styles for AdminForth components. Use this file as reference for all possible adjustments https://github.com/devforth/adminforth/blob/main/adminforth/modules/styles.ts
1439
- */
1440
- styles?: Object,
1441
-
1442
- /**
1443
- * Description of custom pages which will let register custom pages for custom routes in AdminForth.
1444
- */
1445
- customPages?: Array<{
1446
- path: string,
1447
- component: AdminForthComponentDeclaration,
1448
- }>,
1449
-
1450
- /**
1451
- * Function to return custom badge in side bar for users. Can return text or html
1452
- * If function is not passed or returns null, badge will not be shown.
1453
- * Execution is done on admin app load.
1454
- */
1455
- announcementBadge?: (user: AdminUser) => { text?: string, html?: string, closable?: boolean, title?: string } | null,
1456
-
1457
- /**
1458
- * Custom panel components or array of components which will be displayed in the login form
1459
- * right after the inputs. Use it to add custom authorization methods like social login or other custom fields e.g. 'reset'
1460
- * password link.
1461
- */
1462
- loginPageInjections?: {
1463
- underInputs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1464
- }
1465
-
1466
- /**
1467
- * Custom panel components or array of components which will be displayed in different parts of the admin panel.
1468
- */
1469
- globalInjections?: {
1470
- userMenu?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1471
- header?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1472
- sidebar?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
1473
- }
1474
- }
1475
-
1476
- /**
1477
- * If you want to Serve AdminForth from a subdirectory, e.g. on example.com/backoffice, you can specify it like:
1478
- *
1479
- * ```ts
1480
- * baseUrl: '/backoffice',
1481
- * ```
1482
- *
1483
- */
1484
- baseUrl?: string,
1485
-
1486
-
1487
- /**
1488
- * Whether to show delete confirmation dialog before deleting record.
1489
- * By default it is true.
1490
- */
1491
- deleteConfirmation?: boolean,
1492
-
1493
-
1494
- }
1495
-
1496
- // define typescript objects which I can instantiate as Filters.EQ(field, value) and they woudl
1497
- // return { field: field, operator: 'eq', value: value }. They should be exported with Filters namespace so I can import Filters from this file
1498
- // and use Filters.EQ(field, value) in my code
1499
-
1500
- export type FDataFilter = (field: string, value: any) => IAdminForthFilter;
1501
-
1502
- export class Filters {
1503
- static EQ(field: string, value: any): IAdminForthFilter {
1504
- return { field, operator: AdminForthFilterOperators.EQ, value };
1505
- }
1506
- static NEQ(field: string, value: any): IAdminForthFilter {
1507
- return { field, operator: AdminForthFilterOperators.NE, value };
1508
- }
1509
- static GT(field: string, value: any): IAdminForthFilter {
1510
- return { field, operator: AdminForthFilterOperators.GT, value };
1511
- }
1512
- static GTE(field: string, value: any): IAdminForthFilter {
1513
- return { field, operator: AdminForthFilterOperators.GTE, value };
1514
- }
1515
- static LT(field: string, value: any): IAdminForthFilter {
1516
- return { field, operator: AdminForthFilterOperators.LT, value };
1517
- }
1518
- static LTE(field: string, value: any): IAdminForthFilter {
1519
- return { field, operator: AdminForthFilterOperators.LTE, value };
1520
- }
1521
- static IN(field: string, value: any): IAdminForthFilter {
1522
- return { field, operator: AdminForthFilterOperators.IN, value };
1523
- }
1524
- static NOT_IN(field: string, value: any): IAdminForthFilter {
1525
- return { field, operator: AdminForthFilterOperators.NIN, value };
1526
- }
1527
- static LIKE(field: string, value: any): IAdminForthFilter {
1528
- return { field, operator: AdminForthFilterOperators.LIKE, value };
1529
- }
1530
- }
1531
-
1532
- export type FDataSort = (field: string, direction: AdminForthSortDirections) => IAdminForthSort;
1533
-
1534
- export class Sorts {
1535
- static ASC(field: string): IAdminForthSort {
1536
- return { field, direction: AdminForthSortDirections.asc };
1537
- }
1538
- static DESC(field: string): IAdminForthSort {
1539
- return { field, direction: AdminForthSortDirections.desc };
1540
- }
1541
- }
1542
-
1543
- export interface IOperationalResource {
1544
- get: (filter: IAdminForthFilter | IAdminForthFilter[]) => Promise<any | null>;
1545
-
1546
- list: (filter: IAdminForthFilter | IAdminForthFilter[], limit?: number, offset?: number, sort?: IAdminForthSort | IAdminForthSort[]) => Promise<any[]>;
1547
-
1548
- count: (filter: IAdminForthFilter | IAdminForthFilter[] | undefined) => Promise<number>;
1549
-
1550
- create: (record: any) => Promise<{ ok: boolean; createdRecord: any; error?: string; }>;
1551
-
1552
- update: (primaryKey: any, record: any) => Promise<any>;
1553
-
1554
- delete: (primaryKey: any) => Promise<boolean>;
1555
- }
1556
-
1557
-
1558
- export enum AllowedActionsEnum {
1559
- show = 'show',
1560
- list = 'list',
1561
- edit = 'edit',
1562
- create = 'create',
1563
- delete = 'delete',
1564
- filter = 'filter',
1565
- }
1566
-
1567
- /**
1568
- * Defines whether user has access to an action, can statically be Boolean
1569
- * or function which returns Boolean or string with error message
1570
- *
1571
- */
1572
- export type AllowedActionValue = boolean | (({adminUser, resource, meta, source}: {
1573
- adminUser: AdminUser,
1574
- resource: AdminForthResource,
1575
-
1576
- /**
1577
- * Meta object which will pass request information just in case
1578
- */
1579
- meta: any,
1580
-
1581
- /**
1582
- * Source of the check
1583
- */
1584
- source: ActionCheckSource,
1585
- }) => Promise<boolean | string>);
1586
-
1587
- export enum ActionCheckSource {
1588
- DisplayButtons = 'displayButtons',
1589
- ListRequest = 'listRequest',
1590
- ShowRequest = 'showRequest',
1591
- EditRequest = 'editRequest',
1592
- CreateRequest = 'createRequest',
1593
- DeleteRequest = 'deleteRequest',
1594
- BulkActionRequest = 'bulkActionRequest',
1595
- }
1596
-
1597
- /**
1598
- * Object which describes allowed actions for user.
1599
- */
1600
- export type AllowedActions = {
1601
- [key in AllowedActionsEnum]?: AllowedActionValue
1602
- } & {
1603
- all?: AllowedActionValue;
1604
- }
1605
-
1606
- export type AllowedActionsResolved = {
1607
- [key in AllowedActionsEnum]?: boolean
1608
- }
1609
-
1610
- export type ValidationObject = {
1611
- /**
1612
- * Should be pure string (not RegExp string)
1613
- *
1614
- * Example:
1615
- *
1616
- * ```ts
1617
- * // regex for email
1618
- * regExp: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
1619
- * ```
1620
- *
1621
- */
1622
- regExp: string,
1623
-
1624
- /**
1625
- * Error message shown to user if validation fails
1626
- *
1627
- * Example: "Invalid email format"
1628
- */
1629
- message: string,
1630
-
1631
- /**
1632
- * Whether to check case sensitivity (i flag)
1633
- */
1634
- caseSensitive?: boolean,
1635
-
1636
- /**
1637
- * Whether to check Multiline strings (m flag)
1638
- */
1639
- multiline?: boolean,
1640
-
1641
- /**
1642
- * Whether to check global strings (g flag)
1643
- */
1644
- global?: boolean
1645
- }
1646
-
1647
- export type AdminForthComponentDeclarationFull = {
1648
- /**
1649
- * Path to custom component which will be used to render field in the admin panel.
1650
- * e.g. `@@/MyCustomComponent.vue`
1651
- */
1652
- file : string,
1653
-
1654
- /**
1655
- * Optional Meta object which will be passed to custom component as props. For example used by plugins
1656
- * to pass plugin options to custom components.
1657
- *
1658
- * Example:
1659
- *
1660
- * ```ts
1661
- * {
1662
- * name: 'Country Flag',
1663
- * virtual: true,
1664
- * showIn: [AdminForthResourcePages.SHOW],
1665
- * components: {
1666
- * show: {
1667
- * file: '@@/Flag.vue',
1668
- * meta: {
1669
- * flagType: 'country',
1670
- * },
1671
- * },
1672
- * },
1673
- * },
1674
- * {
1675
- * name: 'Team Flag',
1676
- * virtual: true,
1677
- * showIn: [AdminForthResourcePages.SHOW],
1678
- * components: {
1679
- * show: {
1680
- * file: '@@/Flag.vue',
1681
- * meta: {
1682
- * flagType: 'team',
1683
- * },
1684
- * },
1685
- * },
1686
- * }
1687
- * ```
1688
- *
1689
- * In Flag.vue you can access this meta object like this:
1690
- *
1691
- * ```html
1692
- * <template>
1693
- * <img :src="loadFile(`@@/flags/${meta.flagType}/${meta.flagType === 'country' ? record.countryIso : record.teamCode}.png`)" />
1694
- * </template>
1695
- *
1696
- * <script setup>
1697
- * import { loadFile } from '@/utils';
1698
- * defineProps(['meta', 'record']);
1699
- * </script>
1700
- *
1701
- */
1702
- meta?: any,
1703
- }
1704
-
1705
-
1706
- export type AdminForthComponentDeclaration = AdminForthComponentDeclarationFull | string;
1707
-
1708
- export type AdminForthFieldComponents = {
1709
- /**
1710
- * Show component is used to redefine cell which renders field value in show view.
1711
- * Component accepts next properties: [record, column, resource, adminUser, meta].
1712
- *
1713
- * Example: `FullName.vue`
1714
- *
1715
- * ```html
1716
- * <template>
1717
- * {{ record.firstName }} {{ record.lastName }}
1718
- * </template>
1719
- *
1720
- * <script setup>
1721
- * defineProps(['record']);
1722
- * </script>
1723
- *
1724
- * ```ts
1725
- * {
1726
- * label: 'Full Name',
1727
- * virtual: true,
1728
- * showIn: [AdminForthResourcePages.SHOW, AdminForthResourcePages.LIST],
1729
- * components: {
1730
- * show: '@@/FullName.vue',
1731
- * list: '@@/FullName.vue',
1732
- * },
1733
- * }
1734
- * ```
1735
- *
1736
- */
1737
- show?: AdminForthComponentDeclaration,
1738
-
1739
- /**
1740
- * showRow component is similar to {@link AdminForthFieldComponent.show} but rewrites full table row (both \<td\> tags)
1741
- * Accepts next properties: [record, column, resource, adminUser]
1742
- */
1743
- showRow?: AdminForthComponentDeclaration,
1744
-
1745
- /**
1746
- * Create component is used to redefine input field in create view.
1747
- * Component accepts next properties: [record, column, resource, adminUser].
1748
- */
1749
- create?: AdminForthComponentDeclaration,
1750
-
1751
- /**
1752
- * Edit component is used to redefine input field in edit view.
1753
- * Component accepts next properties: [record, column, resource, adminUser].
1754
- */
1755
- edit?: AdminForthComponentDeclaration,
1756
-
1757
- /**
1758
- * List component is used to redefine cell which renders field value in list view.
1759
- * Component accepts next properties: [record, column, resource, adminUser].
1760
- * Component can emit events:
1761
- * - `update:value` - to update record value.
1762
- * - `update:inValidity` - emit true once entered value became not valid (e.g. emit('update:inValidity', true) ). Emit false once entered value became valid. Emit default value in mounted hook.
1763
- * - `update:emptiness` - emit true once entered value became empty (e.g. emit('update:emptiness', true) ). Emit false once entered value became not empty. Emit default value in mounted hook.
1764
- * emptiness emit is optional and required for complex cases. For example for virtual columns where initial value is not set.
1765
- */
1766
- list?: AdminForthComponentDeclaration,
1767
- }
1768
-
1769
- export enum AdminForthDataTypes {
1770
- STRING = 'string',
1771
- INTEGER = 'integer',
1772
- FLOAT = 'float',
1773
- DECIMAL = 'decimal',
1774
- BOOLEAN = 'boolean',
1775
- DATE = 'date',
1776
- DATETIME = 'datetime',
1777
- TIME = 'time',
1778
- TEXT = 'text',
1779
- JSON = 'json',
1780
- RICHTEXT = 'richtext',
1781
- }
1782
-
1783
- export enum AdminForthFilterOperators {
1784
- EQ = 'eq',
1785
- NE = 'ne',
1786
- GT = 'gt',
1787
- LT = 'lt',
1788
- GTE = 'gte',
1789
- LTE = 'lte',
1790
- LIKE = 'like',
1791
- ILIKE = 'ilike',
1792
- IN = 'in',
1793
- NIN = 'nin',
1794
- };
1795
-
1796
- export enum AdminForthSortDirections {
1797
- asc = 'asc',
1798
- desc = 'desc',
1799
- };
1800
-
1801
-
1802
- export type AdminForthColumnEnumItem = {
1803
- value: any | null,
1804
- label: string,
1805
- }
1806
-
1807
- export type AdminForthForeignResource = {
1808
- resourceId: string,
1809
- hooks?: {
1810
- dropdownList?: {
1811
- beforeDatasourceRequest?: BeforeDataSourceRequestFunction | Array<BeforeDataSourceRequestFunction>,
1812
- afterDatasourceResponse?: AfterDataSourceResponseFunction | Array<AfterDataSourceResponseFunction>,
1813
- },
1814
- },
1815
- }
1816
-