Merge branch 'master' of git.curoverse.com:arvados-workbench2 into 14500_admin_api_tokens
[arvados-workbench2.git] / src / store / workbench / workbench-actions.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { Dispatch } from 'redux';
6 import { RootState } from "~/store/store";
7 import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
8 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
9 import { loadFavoritePanel } from '~/store/favorite-panel/favorite-panel-action';
10 import { openProjectPanel, projectPanelActions, setIsProjectPanelTrashed } from '~/store/project-panel/project-panel-action';
11 import { activateSidePanelTreeItem, initSidePanelTree, SidePanelTreeCategory, loadSidePanelTreeProjects } from '~/store/side-panel-tree/side-panel-tree-actions';
12 import { loadResource, updateResources } from '~/store/resources/resources-actions';
13 import { favoritePanelActions } from '~/store/favorite-panel/favorite-panel-action';
14 import { projectPanelColumns } from '~/views/project-panel/project-panel';
15 import { favoritePanelColumns } from '~/views/favorite-panel/favorite-panel';
16 import { matchRootRoute } from '~/routes/routes';
17 import { setSidePanelBreadcrumbs, setProcessBreadcrumbs, setSharedWithMeBreadcrumbs, setTrashBreadcrumbs, setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
18 import { navigateToProject } from '~/store/navigation/navigation-action';
19 import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
20 import { ServiceRepository } from '~/services/services';
21 import { getResource } from '~/store/resources/resources';
22 import { getProjectPanelCurrentUuid } from '~/store/project-panel/project-panel-action';
23 import * as projectCreateActions from '~/store/projects/project-create-actions';
24 import * as projectMoveActions from '~/store/projects/project-move-actions';
25 import * as projectUpdateActions from '~/store/projects/project-update-actions';
26 import * as collectionCreateActions from '~/store/collections/collection-create-actions';
27 import * as collectionCopyActions from '~/store/collections/collection-copy-actions';
28 import * as collectionUpdateActions from '~/store/collections/collection-update-actions';
29 import * as collectionMoveActions from '~/store/collections/collection-move-actions';
30 import * as processesActions from '~/store/processes/processes-actions';
31 import * as processMoveActions from '~/store/processes/process-move-actions';
32 import * as processUpdateActions from '~/store/processes/process-update-actions';
33 import * as processCopyActions from '~/store/processes/process-copy-actions';
34 import { trashPanelColumns } from "~/views/trash-panel/trash-panel";
35 import { loadTrashPanel, trashPanelActions } from "~/store/trash-panel/trash-panel-action";
36 import { initProcessLogsPanel } from '~/store/process-logs-panel/process-logs-panel-actions';
37 import { loadProcessPanel } from '~/store/process-panel/process-panel-actions';
38 import { sharedWithMePanelActions } from '~/store/shared-with-me-panel/shared-with-me-panel-actions';
39 import { loadSharedWithMePanel } from '~/store/shared-with-me-panel/shared-with-me-panel-actions';
40 import { CopyFormDialogData } from '~/store/copy-dialog/copy-dialog';
41 import { loadWorkflowPanel, workflowPanelActions } from '~/store/workflow-panel/workflow-panel-actions';
42 import { loadSshKeysPanel } from '~/store/auth/auth-action';
43 import { loadMyAccountPanel } from '~/store/my-account/my-account-panel-actions';
44 import { workflowPanelColumns } from '~/views/workflow-panel/workflow-panel-view';
45 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
46 import { getProgressIndicator } from '~/store/progress-indicator/progress-indicator-reducer';
47 import { ResourceKind, extractUuidKind } from '~/models/resource';
48 import { FilterBuilder } from '~/services/api/filter-builder';
49 import { GroupContentsResource } from '~/services/groups-service/groups-service';
50 import { unionize, ofType, UnionOf, MatchCases } from '~/common/unionize';
51 import { loadRunProcessPanel } from '~/store/run-process-panel/run-process-panel-actions';
52 import { loadCollectionFiles } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
53 import { SnackbarKind } from '~/store/snackbar/snackbar-actions';
54 import { collectionPanelActions } from "~/store/collection-panel/collection-panel-action";
55 import { CollectionResource } from "~/models/collection";
56 import { searchResultsPanelActions, loadSearchResultsPanel } from '~/store/search-results-panel/search-results-panel-actions';
57 import { searchResultsPanelColumns } from '~/views/search-results-panel/search-results-panel-view';
58 import { loadVirtualMachinesPanel } from '~/store/virtual-machines/virtual-machines-actions';
59 import { loadRepositoriesPanel } from '~/store/repositories/repositories-actions';
60 import { loadKeepServicesPanel } from '~/store/keep-services/keep-services-actions';
61 import { loadComputeNodesPanel } from '~/store/compute-nodes/compute-nodes-actions';
62 import { loadApiClientAuthorizationsPanel } from '~/store/api-client-authorizations/api-client-authorizations-actions';
63
64 export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
65
66 export const isWorkbenchLoading = (state: RootState) => {
67     const progress = getProgressIndicator(WORKBENCH_LOADING_SCREEN)(state.progressIndicator);
68     return progress ? progress.working : false;
69 };
70
71 const handleFirstTimeLoad = (action: any) =>
72     async (dispatch: Dispatch<any>, getState: () => RootState) => {
73         try {
74             await dispatch(action);
75         } finally {
76             if (isWorkbenchLoading(getState())) {
77                 dispatch(progressIndicatorActions.STOP_WORKING(WORKBENCH_LOADING_SCREEN));
78             }
79         }
80     };
81
82
83 export const loadWorkbench = () =>
84     async (dispatch: Dispatch, getState: () => RootState) => {
85         dispatch(progressIndicatorActions.START_WORKING(WORKBENCH_LOADING_SCREEN));
86         const { auth, router } = getState();
87         const { user } = auth;
88         if (user) {
89             const userResource = await dispatch<any>(loadResource(user.uuid));
90             if (userResource) {
91                 dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
92                 dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
93                 dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns }));
94                 dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
95                 dispatch(workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns }));
96                 dispatch(searchResultsPanelActions.SET_COLUMNS({ columns: searchResultsPanelColumns }));
97                 dispatch<any>(initSidePanelTree());
98                 if (router.location) {
99                     const match = matchRootRoute(router.location.pathname);
100                     if (match) {
101                         dispatch(navigateToProject(userResource.uuid));
102                     }
103                 }
104             } else {
105                 dispatch(userIsNotAuthenticated);
106             }
107         } else {
108             dispatch(userIsNotAuthenticated);
109         }
110     };
111
112 export const loadFavorites = () =>
113     handleFirstTimeLoad(
114         (dispatch: Dispatch) => {
115             dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.FAVORITES));
116             dispatch<any>(loadFavoritePanel());
117             dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.FAVORITES));
118         });
119
120 export const loadTrash = () =>
121     handleFirstTimeLoad(
122         (dispatch: Dispatch) => {
123             dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
124             dispatch<any>(loadTrashPanel());
125             dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.TRASH));
126         });
127
128 export const loadProject = (uuid: string) =>
129     handleFirstTimeLoad(
130         async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
131             const userUuid = services.authService.getUuid();
132             dispatch(setIsProjectPanelTrashed(false));
133             if (userUuid) {
134                 if (userUuid !== uuid) {
135                     const match = await loadGroupContentsResource({ uuid, userUuid, services });
136                     match({
137                         OWNED: async project => {
138                             await dispatch(activateSidePanelTreeItem(uuid));
139                             dispatch<any>(setSidePanelBreadcrumbs(uuid));
140                             dispatch(finishLoadingProject(project));
141                         },
142                         SHARED: project => {
143                             dispatch<any>(setSharedWithMeBreadcrumbs(uuid));
144                             dispatch(activateSidePanelTreeItem(uuid));
145                             dispatch(finishLoadingProject(project));
146                         },
147                         TRASHED: project => {
148                             dispatch<any>(setTrashBreadcrumbs(uuid));
149                             dispatch(setIsProjectPanelTrashed(true));
150                             dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
151                             dispatch(finishLoadingProject(project));
152                         }
153                     });
154                 } else {
155                     await dispatch(activateSidePanelTreeItem(userUuid));
156                     dispatch<any>(setSidePanelBreadcrumbs(userUuid));
157                     dispatch(finishLoadingProject(userUuid));
158                 }
159             }
160         });
161
162 export const createProject = (data: projectCreateActions.ProjectCreateFormDialogData) =>
163     async (dispatch: Dispatch) => {
164         const newProject = await dispatch<any>(projectCreateActions.createProject(data));
165         if (newProject) {
166             dispatch(snackbarActions.OPEN_SNACKBAR({
167                 message: "Project has been successfully created.",
168                 hideDuration: 2000
169             }));
170             await dispatch<any>(loadSidePanelTreeProjects(newProject.ownerUuid));
171             dispatch<any>(reloadProjectMatchingUuid([newProject.ownerUuid]));
172         }
173     };
174
175 export const moveProject = (data: MoveToFormDialogData) =>
176     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
177         try {
178             const oldProject = getResource(data.uuid)(getState().resources);
179             const oldOwnerUuid = oldProject ? oldProject.ownerUuid : '';
180             const movedProject = await dispatch<any>(projectMoveActions.moveProject(data));
181             if (movedProject) {
182                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Project has been moved', hideDuration: 2000 }));
183                 if (oldProject) {
184                     await dispatch<any>(loadSidePanelTreeProjects(oldProject.ownerUuid));
185                 }
186                 dispatch<any>(reloadProjectMatchingUuid([oldOwnerUuid, movedProject.ownerUuid, movedProject.uuid]));
187             }
188         } catch (e) {
189             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
190         }
191     };
192
193 export const updateProject = (data: projectUpdateActions.ProjectUpdateFormDialogData) =>
194     async (dispatch: Dispatch) => {
195         const updatedProject = await dispatch<any>(projectUpdateActions.updateProject(data));
196         if (updatedProject) {
197             dispatch(snackbarActions.OPEN_SNACKBAR({
198                 message: "Project has been successfully updated.",
199                 hideDuration: 2000
200             }));
201             await dispatch<any>(loadSidePanelTreeProjects(updatedProject.ownerUuid));
202             dispatch<any>(reloadProjectMatchingUuid([updatedProject.ownerUuid, updatedProject.uuid]));
203         }
204     };
205
206 export const loadCollection = (uuid: string) =>
207     handleFirstTimeLoad(
208         async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
209             const userUuid = services.authService.getUuid();
210             if (userUuid) {
211                 const match = await loadGroupContentsResource({ uuid, userUuid, services });
212                 match({
213                     OWNED: async collection => {
214                         dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
215                         dispatch(updateResources([collection]));
216                         await dispatch(activateSidePanelTreeItem(collection.ownerUuid));
217                         dispatch(setSidePanelBreadcrumbs(collection.ownerUuid));
218                         dispatch(loadCollectionFiles(collection.uuid));
219                     },
220                     SHARED: collection => {
221                         dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
222                         dispatch(updateResources([collection]));
223                         dispatch<any>(setSharedWithMeBreadcrumbs(collection.ownerUuid));
224                         dispatch(activateSidePanelTreeItem(collection.ownerUuid));
225                         dispatch(loadCollectionFiles(collection.uuid));
226                     },
227                     TRASHED: collection => {
228                         dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
229                         dispatch(updateResources([collection]));
230                         dispatch(setTrashBreadcrumbs(''));
231                         dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
232                         dispatch(loadCollectionFiles(collection.uuid));
233                     },
234
235                 });
236             }
237         });
238
239 export const createCollection = (data: collectionCreateActions.CollectionCreateFormDialogData) =>
240     async (dispatch: Dispatch) => {
241         const collection = await dispatch<any>(collectionCreateActions.createCollection(data));
242         if (collection) {
243             dispatch(snackbarActions.OPEN_SNACKBAR({
244                 message: "Collection has been successfully created.",
245                 hideDuration: 2000
246             }));
247             dispatch<any>(updateResources([collection]));
248             dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
249         }
250     };
251
252 export const updateCollection = (data: collectionUpdateActions.CollectionUpdateFormDialogData) =>
253     async (dispatch: Dispatch) => {
254         const collection = await dispatch<any>(collectionUpdateActions.updateCollection(data));
255         if (collection) {
256             dispatch(snackbarActions.OPEN_SNACKBAR({
257                 message: "Collection has been successfully updated.",
258                 hideDuration: 2000
259             }));
260             dispatch<any>(updateResources([collection]));
261             dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
262         }
263     };
264
265 export const copyCollection = (data: CopyFormDialogData) =>
266     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
267         try {
268             const copyToProject = getResource(data.ownerUuid)(getState().resources);
269             const collection = await dispatch<any>(collectionCopyActions.copyCollection(data));
270             if (copyToProject && collection) {
271                 dispatch<any>(reloadProjectMatchingUuid([copyToProject.uuid]));
272                 dispatch(snackbarActions.OPEN_SNACKBAR({
273                     message: 'Collection has been copied.',
274                     hideDuration: 3000,
275                     kind: SnackbarKind.SUCCESS,
276                     link: collection.ownerUuid
277                 }));
278             }
279         } catch (e) {
280             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000, kind: SnackbarKind.ERROR }));
281         }
282     };
283
284 export const moveCollection = (data: MoveToFormDialogData) =>
285     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
286         try {
287             const collection = await dispatch<any>(collectionMoveActions.moveCollection(data));
288             dispatch<any>(updateResources([collection]));
289             dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
290             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Collection has been moved.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
291         } catch (e) {
292             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
293         }
294     };
295
296 export const loadProcess = (uuid: string) =>
297     handleFirstTimeLoad(
298         async (dispatch: Dispatch, getState: () => RootState) => {
299             dispatch<any>(loadProcessPanel(uuid));
300             const process = await dispatch<any>(processesActions.loadProcess(uuid));
301             await dispatch<any>(activateSidePanelTreeItem(process.containerRequest.ownerUuid));
302             dispatch<any>(setProcessBreadcrumbs(uuid));
303             dispatch(loadDetailsPanel(uuid));
304         });
305
306 export const updateProcess = (data: processUpdateActions.ProcessUpdateFormDialogData) =>
307     async (dispatch: Dispatch) => {
308         try {
309             const process = await dispatch<any>(processUpdateActions.updateProcess(data));
310             if (process) {
311                 dispatch(snackbarActions.OPEN_SNACKBAR({
312                     message: "Process has been successfully updated.",
313                     hideDuration: 2000
314                 }));
315                 dispatch<any>(updateResources([process]));
316                 dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
317             }
318         } catch (e) {
319             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
320         }
321     };
322
323 export const moveProcess = (data: MoveToFormDialogData) =>
324     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
325         try {
326             const process = await dispatch<any>(processMoveActions.moveProcess(data));
327             dispatch<any>(updateResources([process]));
328             dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
329             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process has been moved.', hideDuration: 2000 }));
330         } catch (e) {
331             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
332         }
333     };
334
335 export const copyProcess = (data: CopyFormDialogData) =>
336     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
337         try {
338             const process = await dispatch<any>(processCopyActions.copyProcess(data));
339             dispatch<any>(updateResources([process]));
340             dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
341             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process has been copied.', hideDuration: 2000 }));
342         } catch (e) {
343             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
344         }
345     };
346
347 export const loadProcessLog = (uuid: string) =>
348     handleFirstTimeLoad(
349         async (dispatch: Dispatch) => {
350             const process = await dispatch<any>(processesActions.loadProcess(uuid));
351             dispatch<any>(setProcessBreadcrumbs(uuid));
352             dispatch<any>(initProcessLogsPanel(uuid));
353             await dispatch<any>(activateSidePanelTreeItem(process.containerRequest.ownerUuid));
354         });
355
356 export const resourceIsNotLoaded = (uuid: string) =>
357     snackbarActions.OPEN_SNACKBAR({
358         message: `Resource identified by ${uuid} is not loaded.`
359     });
360
361 export const userIsNotAuthenticated = snackbarActions.OPEN_SNACKBAR({
362     message: 'User is not authenticated'
363 });
364
365 export const couldNotLoadUser = snackbarActions.OPEN_SNACKBAR({
366     message: 'Could not load user'
367 });
368
369 export const reloadProjectMatchingUuid = (matchingUuids: string[]) =>
370     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
371         const currentProjectPanelUuid = getProjectPanelCurrentUuid(getState());
372         if (currentProjectPanelUuid && matchingUuids.some(uuid => uuid === currentProjectPanelUuid)) {
373             dispatch<any>(loadProject(currentProjectPanelUuid));
374         }
375     };
376
377 export const loadSharedWithMe = handleFirstTimeLoad(async (dispatch: Dispatch) => {
378     dispatch<any>(loadSharedWithMePanel());
379     await dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.SHARED_WITH_ME));
380     await dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.SHARED_WITH_ME));
381 });
382
383 export const loadRunProcess = handleFirstTimeLoad(
384     async (dispatch: Dispatch) => {
385         await dispatch<any>(loadRunProcessPanel());
386     }
387 );
388
389 export const loadWorkflow = handleFirstTimeLoad(async (dispatch: Dispatch<any>) => {
390     dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.WORKFLOWS));
391     await dispatch(loadWorkflowPanel());
392     dispatch(setSidePanelBreadcrumbs(SidePanelTreeCategory.WORKFLOWS));
393 });
394
395 export const loadSearchResults = handleFirstTimeLoad(
396     async (dispatch: Dispatch<any>) => {
397         await dispatch(loadSearchResultsPanel());
398     });
399
400 export const loadVirtualMachines = handleFirstTimeLoad(
401     async (dispatch: Dispatch<any>) => {
402         await dispatch(loadVirtualMachinesPanel());
403         dispatch(setBreadcrumbs([{ label: 'Virtual Machines' }]));
404     });
405     
406 export const loadRepositories = handleFirstTimeLoad(
407     async (dispatch: Dispatch<any>) => {
408         await dispatch(loadRepositoriesPanel());
409         dispatch(setBreadcrumbs([{ label: 'Repositories' }]));
410     });
411
412 export const loadSshKeys = handleFirstTimeLoad(
413     async (dispatch: Dispatch<any>) => {
414         await dispatch(loadSshKeysPanel());
415     });
416
417 export const loadMyAccount = handleFirstTimeLoad(
418     (dispatch: Dispatch<any>) => {
419         dispatch(loadMyAccountPanel());
420     });
421
422 export const loadKeepServices = handleFirstTimeLoad(
423     async (dispatch: Dispatch<any>) => {
424         await dispatch(loadKeepServicesPanel());
425     });
426
427 export const loadComputeNodes = handleFirstTimeLoad(
428     async (dispatch: Dispatch<any>) => {
429         await dispatch(loadComputeNodesPanel());
430     });
431
432 export const loadApiClientAuthorizations = handleFirstTimeLoad(
433     async (dispatch: Dispatch<any>) => {
434         await dispatch(loadApiClientAuthorizationsPanel());
435     });
436
437 const finishLoadingProject = (project: GroupContentsResource | string) =>
438     async (dispatch: Dispatch<any>) => {
439         const uuid = typeof project === 'string' ? project : project.uuid;
440         dispatch(openProjectPanel(uuid));
441         dispatch(loadDetailsPanel(uuid));
442         if (typeof project !== 'string') {
443             dispatch(updateResources([project]));
444         }
445     };
446
447 const loadGroupContentsResource = async (params: {
448     uuid: string,
449     userUuid: string,
450     services: ServiceRepository
451 }) => {
452     const filters = new FilterBuilder()
453         .addEqual('uuid', params.uuid)
454         .getFilters();
455     const { items } = await params.services.groupsService.contents(params.userUuid, {
456         filters,
457         recursive: true,
458         includeTrash: true,
459     });
460     const resource = items.shift();
461     let handler: GroupContentsHandler;
462     if (resource) {
463         handler = (resource.kind === ResourceKind.COLLECTION || resource.kind === ResourceKind.PROJECT) && resource.isTrashed
464             ? groupContentsHandlers.TRASHED(resource)
465             : groupContentsHandlers.OWNED(resource);
466     } else {
467         const kind = extractUuidKind(params.uuid);
468         let resource: GroupContentsResource;
469         if (kind === ResourceKind.COLLECTION) {
470             resource = await params.services.collectionService.get(params.uuid);
471         } else if (kind === ResourceKind.PROJECT) {
472             resource = await params.services.projectService.get(params.uuid);
473         } else {
474             resource = await params.services.containerRequestService.get(params.uuid);
475         }
476         handler = groupContentsHandlers.SHARED(resource);
477     }
478     return (cases: MatchCases<typeof groupContentsHandlersRecord, GroupContentsHandler, void>) =>
479         groupContentsHandlers.match(handler, cases);
480
481 };
482
483 const groupContentsHandlersRecord = {
484     TRASHED: ofType<GroupContentsResource>(),
485     SHARED: ofType<GroupContentsResource>(),
486     OWNED: ofType<GroupContentsResource>(),
487 };
488
489 const groupContentsHandlers = unionize(groupContentsHandlersRecord);
490
491 type GroupContentsHandler = UnionOf<typeof groupContentsHandlers>;