@firecms/core 3.0.0-canary.143 → 3.0.0-canary.145

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 (96) hide show
  1. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  2. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +2 -2
  3. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +1 -1
  4. package/dist/core/EntityEditView.d.ts +1 -1
  5. package/dist/core/FireCMS.d.ts +1 -1
  6. package/dist/hooks/data/delete.d.ts +4 -4
  7. package/dist/hooks/data/save.d.ts +3 -3
  8. package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
  9. package/dist/hooks/data/useEntityFetch.d.ts +3 -3
  10. package/dist/hooks/useAuthController.d.ts +1 -1
  11. package/dist/hooks/useBuildNavigationController.d.ts +3 -3
  12. package/dist/hooks/useFireCMSContext.d.ts +1 -1
  13. package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
  14. package/dist/hooks/useValidateAuthenticator.d.ts +3 -3
  15. package/dist/index.es.js +7893 -7903
  16. package/dist/index.es.js.map +1 -1
  17. package/dist/index.umd.js +7891 -7901
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/types/auth.d.ts +8 -6
  20. package/dist/types/collections.d.ts +12 -12
  21. package/dist/types/datasource.d.ts +0 -4
  22. package/dist/types/entity_actions.d.ts +4 -4
  23. package/dist/types/entity_callbacks.d.ts +16 -16
  24. package/dist/types/export_import.d.ts +4 -4
  25. package/dist/types/firecms.d.ts +2 -2
  26. package/dist/types/firecms_context.d.ts +1 -1
  27. package/dist/types/permissions.d.ts +4 -4
  28. package/dist/types/plugins.d.ts +8 -8
  29. package/dist/types/user.d.ts +1 -0
  30. package/dist/util/builders.d.ts +2 -2
  31. package/dist/util/permissions.d.ts +4 -4
  32. package/package.json +5 -5
  33. package/src/app/Scaffold.tsx +2 -2
  34. package/src/components/ArrayContainer.tsx +3 -2
  35. package/src/components/CircularProgressCenter.tsx +1 -1
  36. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +1 -1
  37. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +5 -5
  38. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +2 -2
  39. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +3 -3
  40. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
  41. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +1 -1
  42. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +4 -4
  43. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +10 -8
  44. package/src/components/EntityCollectionView/EntityCollectionView.tsx +3 -3
  45. package/src/components/EntityPreview.tsx +2 -2
  46. package/src/components/EntityView.tsx +4 -4
  47. package/src/components/HomePage/FavouritesView.tsx +1 -1
  48. package/src/components/HomePage/NavigationCard.tsx +1 -1
  49. package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
  50. package/src/components/HomePage/NavigationGroup.tsx +1 -1
  51. package/src/components/PropertyConfigBadge.tsx +1 -1
  52. package/src/components/PropertyIdCopyTooltip.tsx +1 -1
  53. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -1
  54. package/src/components/SelectableTable/SelectableTable.tsx +2 -2
  55. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +1 -1
  56. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +1 -1
  57. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +1 -1
  58. package/src/components/VirtualTable/VirtualTableHeader.tsx +8 -8
  59. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
  60. package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
  61. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +2 -2
  62. package/src/core/DefaultAppBar.tsx +10 -8
  63. package/src/core/DefaultDrawer.tsx +2 -2
  64. package/src/core/DrawerNavigationItem.tsx +3 -3
  65. package/src/core/EntityEditView.tsx +8 -8
  66. package/src/core/FireCMS.tsx +1 -1
  67. package/src/core/SideDialogs.tsx +1 -1
  68. package/src/core/field_configs.tsx +1 -1
  69. package/src/form/components/StorageItemPreview.tsx +2 -2
  70. package/src/form/field_bindings/MapFieldBinding.tsx +1 -1
  71. package/src/form/field_bindings/ReferenceFieldBinding.tsx +3 -3
  72. package/src/hooks/data/delete.ts +4 -4
  73. package/src/hooks/data/save.ts +3 -3
  74. package/src/hooks/data/useCollectionFetch.tsx +2 -2
  75. package/src/hooks/data/useEntityFetch.tsx +5 -5
  76. package/src/hooks/useAuthController.tsx +1 -1
  77. package/src/hooks/useBuildNavigationController.tsx +7 -6
  78. package/src/hooks/useFireCMSContext.tsx +5 -5
  79. package/src/hooks/useResolvedNavigationFrom.tsx +5 -5
  80. package/src/hooks/useValidateAuthenticator.tsx +3 -3
  81. package/src/preview/components/EmptyValue.tsx +1 -1
  82. package/src/preview/components/ImagePreview.tsx +2 -2
  83. package/src/preview/components/UrlComponentPreview.tsx +1 -1
  84. package/src/types/auth.tsx +8 -8
  85. package/src/types/collections.ts +12 -12
  86. package/src/types/datasource.ts +0 -5
  87. package/src/types/entity_actions.tsx +4 -4
  88. package/src/types/entity_callbacks.ts +18 -18
  89. package/src/types/export_import.ts +4 -4
  90. package/src/types/firecms.tsx +2 -2
  91. package/src/types/firecms_context.tsx +1 -1
  92. package/src/types/permissions.ts +5 -5
  93. package/src/types/plugins.tsx +8 -8
  94. package/src/types/user.ts +2 -0
  95. package/src/util/builders.ts +6 -6
  96. package/src/util/permissions.ts +8 -8
@@ -12,10 +12,10 @@ import {
12
12
  /**
13
13
  * @group Hooks and utilities
14
14
  */
15
- export type DeleteEntityWithCallbacksProps<M extends Record<string, any>, UserType extends User = User> =
15
+ export type DeleteEntityWithCallbacksProps<M extends Record<string, any>, USER extends User = User> =
16
16
  DeleteEntityProps<M>
17
17
  & {
18
- callbacks?: EntityCallbacks<M, UserType>;
18
+ callbacks?: EntityCallbacks<M, USER>;
19
19
  onDeleteSuccess?: (entity: Entity<M>) => void;
20
20
  onDeleteFailure?: (entity: Entity<M>, e: Error) => void;
21
21
  onPreDeleteHookError?: (entity: Entity<M>, e: Error) => void;
@@ -43,7 +43,7 @@ export type DeleteEntityWithCallbacksProps<M extends Record<string, any>, UserTy
43
43
  * @param context
44
44
  * @group Hooks and utilities
45
45
  */
46
- export async function deleteEntityWithCallbacks<M extends Record<string, any>, UserType extends User>({
46
+ export async function deleteEntityWithCallbacks<M extends Record<string, any>, USER extends User>({
47
47
  dataSource,
48
48
  entity,
49
49
  collection,
@@ -56,7 +56,7 @@ export async function deleteEntityWithCallbacks<M extends Record<string, any>, U
56
56
  }: DeleteEntityWithCallbacksProps<M> & {
57
57
  collection: ResolvedEntityCollection<M>,
58
58
  dataSource: DataSource,
59
- context: FireCMSContext<UserType>
59
+ context: FireCMSContext<USER>
60
60
  }
61
61
  ): Promise<boolean> {
62
62
 
@@ -48,7 +48,7 @@ export type SaveEntityWithCallbacksProps<M extends Record<string, any>> =
48
48
  * @see useDataSource
49
49
  * @group Hooks and utilities
50
50
  */
51
- export async function saveEntityWithCallbacks<M extends Record<string, any>, UserType extends User>({
51
+ export async function saveEntityWithCallbacks<M extends Record<string, any>, USER extends User>({
52
52
  collection,
53
53
  path,
54
54
  entityId,
@@ -62,9 +62,9 @@ export async function saveEntityWithCallbacks<M extends Record<string, any>, Use
62
62
  onPreSaveHookError,
63
63
  onSaveSuccessHookError
64
64
  }: SaveEntityWithCallbacksProps<M> & {
65
- collection: EntityCollection<M, UserType>,
65
+ collection: EntityCollection<M, USER>,
66
66
  dataSource: DataSource,
67
- context: FireCMSContext<UserType>,
67
+ context: FireCMSContext<USER>,
68
68
  }
69
69
  ): Promise<void> {
70
70
 
@@ -60,7 +60,7 @@ export interface CollectionFetchResult<M extends Record<string, any>> {
60
60
  * @param searchString
61
61
  * @group Hooks and utilities
62
62
  */
63
- export function useCollectionFetch<M extends Record<string, any>, UserType extends User>(
63
+ export function useCollectionFetch<M extends Record<string, any>, USER extends User>(
64
64
  {
65
65
  path: inputPath,
66
66
  collection,
@@ -78,7 +78,7 @@ export function useCollectionFetch<M extends Record<string, any>, UserType exten
78
78
  const sortByProperty = sortBy ? sortBy[0] : undefined;
79
79
  const currentSort = sortBy ? sortBy[1] : undefined;
80
80
 
81
- const context: FireCMSContext<UserType> = useFireCMSContext();
81
+ const context: FireCMSContext<USER> = useFireCMSContext();
82
82
 
83
83
  const [data, setData] = useState<Entity<M>[]>([]);
84
84
 
@@ -7,10 +7,10 @@ import { useFireCMSContext } from "../useFireCMSContext";
7
7
  /**
8
8
  * @group Hooks and utilities
9
9
  */
10
- export interface EntityFetchProps<M extends Record<string, any>, UserType extends User = User> {
10
+ export interface EntityFetchProps<M extends Record<string, any>, USER extends User = User> {
11
11
  path: string;
12
12
  entityId?: string;
13
- collection: EntityCollection<M, UserType>;
13
+ collection: EntityCollection<M, USER>;
14
14
  useCache?: boolean;
15
15
  }
16
16
 
@@ -35,20 +35,20 @@ const CACHE: Record<string, Entity<any> | undefined> = {};
35
35
  * @group Hooks and utilities
36
36
  */
37
37
 
38
- export function useEntityFetch<M extends Record<string, any>, UserType extends User>(
38
+ export function useEntityFetch<M extends Record<string, any>, USER extends User>(
39
39
  {
40
40
  path: inputPath,
41
41
  entityId,
42
42
  collection,
43
43
  useCache = false
44
- }: EntityFetchProps<M, UserType>): EntityFetchResult<M> {
44
+ }: EntityFetchProps<M, USER>): EntityFetchResult<M> {
45
45
 
46
46
  const dataSource = useDataSource(collection);
47
47
  const navigationController = useNavigationController();
48
48
 
49
49
  const path = navigationController.resolveAliasesFrom(inputPath);
50
50
 
51
- const context: FireCMSContext<UserType> = useFireCMSContext();
51
+ const context: FireCMSContext<USER> = useFireCMSContext();
52
52
 
53
53
  const [entity, setEntity] = useState<Entity<M> | undefined>();
54
54
  const [dataLoading, setDataLoading] = useState<boolean>(true);
@@ -11,4 +11,4 @@ import { AuthControllerContext } from "../contexts/AuthControllerContext";
11
11
  * @see AuthController
12
12
  * @group Hooks and utilities
13
13
  */
14
- export const useAuthController = <UserType extends User = User, AuthControllerType extends AuthController<UserType> = AuthController<UserType>>(): AuthControllerType => useContext(AuthControllerContext) as AuthControllerType;
14
+ export const useAuthController = <USER extends User = User, AuthControllerType extends AuthController<USER> = AuthController<USER>>(): AuthControllerType => useContext(AuthControllerContext) as AuthControllerType;
@@ -30,10 +30,10 @@ import { getParentReferencesFromPath } from "../util/parent_references_from_path
30
30
  const DEFAULT_BASE_PATH = "/";
31
31
  const DEFAULT_COLLECTION_PATH = "/c";
32
32
 
33
- export type BuildNavigationContextProps<EC extends EntityCollection, UserType extends User> = {
33
+ export type BuildNavigationContextProps<EC extends EntityCollection, USER extends User> = {
34
34
  basePath?: string,
35
35
  baseCollectionPath?: string,
36
- authController: AuthController<UserType>;
36
+ authController: AuthController<USER>;
37
37
  collections?: EC[] | EntityCollectionsBuilder<EC>;
38
38
  collectionPermissions?: PermissionsBuilder;
39
39
  views?: CMSView[] | CMSViewsBuilder;
@@ -51,7 +51,7 @@ export type BuildNavigationContextProps<EC extends EntityCollection, UserType ex
51
51
  injectCollections?: (collections: EntityCollection[]) => EntityCollection[];
52
52
  };
53
53
 
54
- export function useBuildNavigationController<EC extends EntityCollection, UserType extends User>(props: BuildNavigationContextProps<EC, UserType>): NavigationController {
54
+ export function useBuildNavigationController<EC extends EntityCollection, USER extends User>(props: BuildNavigationContextProps<EC, USER>): NavigationController {
55
55
  const {
56
56
  basePath = DEFAULT_BASE_PATH,
57
57
  baseCollectionPath = DEFAULT_COLLECTION_PATH,
@@ -188,6 +188,7 @@ export function useBuildNavigationController<EC extends EntityCollection, UserTy
188
188
  if (authController.initialLoading)
189
189
  return;
190
190
 
191
+ console.log("refresh", authController)
191
192
  console.debug("Refreshing navigation");
192
193
 
193
194
  try {
@@ -428,7 +429,7 @@ function filterOutNotAllowedCollections(resolvedCollections: EntityCollection[],
428
429
  return resolvedCollections
429
430
  .filter((c) => {
430
431
  if (!c.permissions) return true;
431
- const resolvedPermissions = resolvePermissions(c, authController, c.path, null)
432
+ const resolvedPermissions = resolvePermissions(c, authController, c.path, null);
432
433
  return resolvedPermissions?.read !== false;
433
434
  })
434
435
  .map((c) => {
@@ -461,9 +462,9 @@ async function resolveCollections(collections: undefined | EntityCollection[] |
461
462
  }
462
463
 
463
464
  resolvedCollections = applyPermissionsFunctionIfEmpty(resolvedCollections, collectionPermissions);
464
-
465
+ console.log("resolvedCollections 2", resolvedCollections, collectionPermissions);
465
466
  resolvedCollections = filterOutNotAllowedCollections(resolvedCollections, authController);
466
-
467
+ console.log("resolvedCollections 3", resolvedCollections, authController);
467
468
  return resolvedCollections;
468
469
  }
469
470
 
@@ -21,9 +21,9 @@ import React, { useEffect } from "react";
21
21
  * @see FireCMSContext
22
22
  * @group Hooks and utilities
23
23
  */
24
- export const useFireCMSContext = <UserType extends User = User, AuthControllerType extends AuthController<UserType> = AuthController<UserType>>(): FireCMSContext<UserType, AuthControllerType> => {
24
+ export const useFireCMSContext = <USER extends User = User, AuthControllerType extends AuthController<USER> = AuthController<USER>>(): FireCMSContext<USER, AuthControllerType> => {
25
25
 
26
- const authController = useAuthController<UserType, AuthControllerType>();
26
+ const authController = useAuthController<USER, AuthControllerType>();
27
27
  const sideDialogsController = useSideDialogsController();
28
28
  const sideEntityController = useSideEntityController();
29
29
  const navigation = useNavigationController();
@@ -35,7 +35,7 @@ export const useFireCMSContext = <UserType extends User = User, AuthControllerTy
35
35
  const customizationController = useCustomizationController();
36
36
  const analyticsController = useAnalyticsController();
37
37
 
38
- const fireCMSContextRef = React.useRef<FireCMSContext<UserType, AuthControllerType>>({
38
+ const fireCMSContextRef = React.useRef<FireCMSContext<USER, AuthControllerType>>({
39
39
  authController,
40
40
  sideDialogsController,
41
41
  sideEntityController,
@@ -68,9 +68,9 @@ export const useFireCMSContext = <UserType extends User = User, AuthControllerTy
68
68
  return fireCMSContextRef.current;
69
69
  }
70
70
 
71
- // export const useFireCMSContext = <UserType extends User = User, AuthControllerType extends AuthController<UserType> = AuthController<UserType>>(): FireCMSContext<UserType, AuthControllerType> => {
71
+ // export const useFireCMSContext = <USER extends User = User, AuthControllerType extends AuthController<USER> = AuthController<USER>>(): FireCMSContext<USER, AuthControllerType> => {
72
72
  //
73
- // const authController = useAuthController<UserType, AuthControllerType>();
73
+ // const authController = useAuthController<USER, AuthControllerType>();
74
74
  // const sideDialogsController = useSideDialogsController();
75
75
  // const sideEntityController = useSideEntityController();
76
76
  // const navigation = useNavigationController();
@@ -55,12 +55,12 @@ interface ResolvedNavigationEntityCustom<M extends Record<string, any>> {
55
55
  * @param context
56
56
  * @group Hooks and utilities
57
57
  */
58
- export function resolveNavigationFrom<M extends Record<string, any>, UserType extends User>({
58
+ export function resolveNavigationFrom<M extends Record<string, any>, USER extends User>({
59
59
  path,
60
60
  context
61
61
  }: {
62
62
  path: string,
63
- context: FireCMSContext<UserType>
63
+ context: FireCMSContext<USER>
64
64
  }): Promise<ResolvedNavigationEntry<M>[]> {
65
65
 
66
66
  const dataSource = context.dataSource;
@@ -126,12 +126,12 @@ export interface NavigationFrom<M extends Record<string, any>> {
126
126
  * in any React component that lives under `FireCMS`
127
127
  * @group Hooks and utilities
128
128
  */
129
- export function useResolvedNavigationFrom<M extends Record<string, any>, UserType extends User>(
129
+ export function useResolvedNavigationFrom<M extends Record<string, any>, USER extends User>(
130
130
  {
131
131
  path
132
132
  }: NavigationFromProps): NavigationFrom<M> {
133
133
 
134
- const context: FireCMSContext<UserType> = useFireCMSContext();
134
+ const context: FireCMSContext<USER> = useFireCMSContext();
135
135
 
136
136
  const [data, setData] = useState<ResolvedNavigationEntry<M>[] | undefined>();
137
137
  const [dataLoading, setDataLoading] = useState<boolean>(false);
@@ -142,7 +142,7 @@ export function useResolvedNavigationFrom<M extends Record<string, any>, UserTyp
142
142
  if (navigation) {
143
143
  setDataLoading(true);
144
144
  setDataLoadingError(undefined);
145
- resolveNavigationFrom<M, UserType>({ path, context })
145
+ resolveNavigationFrom<M, USER>({ path, context })
146
146
  .then((res) => {
147
147
  setData(res);
148
148
  })
@@ -11,7 +11,7 @@ import { AuthController, Authenticator, DataSourceDelegate, StorageSource, User
11
11
  * @param storageSource
12
12
  * @param dataSourceDelegate
13
13
  */
14
- export function useValidateAuthenticator<UserType extends User = User, Controller extends AuthController<UserType> = AuthController<UserType>>
14
+ export function useValidateAuthenticator<USER extends User = any>
15
15
  ({
16
16
  disabled,
17
17
  authController,
@@ -21,8 +21,8 @@ export function useValidateAuthenticator<UserType extends User = User, Controlle
21
21
  }:
22
22
  {
23
23
  disabled?: boolean,
24
- authController: Controller,
25
- authenticator?: boolean | Authenticator<UserType, Controller>,
24
+ authController: AuthController<USER>,
25
+ authenticator?: boolean | Authenticator<USER>,
26
26
  dataSourceDelegate: DataSourceDelegate;
27
27
  storageSource: StorageSource;
28
28
  }): {
@@ -6,5 +6,5 @@ import React from "react";
6
6
  export function EmptyValue() {
7
7
 
8
8
  return <div
9
- className="rounded-full bg-gray-200 bg-opacity-30 dark:bg-opacity-20 w-5 h-2 inline-block"/>;
9
+ className="rounded-full bg-surface-200 bg-opacity-30 dark:bg-opacity-20 w-5 h-2 inline-block"/>;
10
10
  }
@@ -69,7 +69,7 @@ export function ImagePreview({
69
69
  e.preventDefault();
70
70
  return navigator.clipboard.writeText(url);
71
71
  }}>
72
- <ContentCopyIcon className={"text-gray-700 dark:text-gray-300"}
72
+ <ContentCopyIcon className={"text-surface-700 dark:text-surface-300"}
73
73
  size={"smallest"}/>
74
74
  </IconButton>
75
75
  </Tooltip>}
@@ -85,7 +85,7 @@ export function ImagePreview({
85
85
  size={"small"}
86
86
  onClick={(e: any) => e.stopPropagation()}
87
87
  >
88
- <OpenInNewIcon className={"text-gray-700 dark:text-gray-300"}
88
+ <OpenInNewIcon className={"text-surface-700 dark:text-surface-300"}
89
89
  size={"smallest"}/>
90
90
  </IconButton>
91
91
  </Tooltip>
@@ -65,7 +65,7 @@ export function UrlComponentPreview({
65
65
  width: getThumbnailMeasure(size),
66
66
  height: getThumbnailMeasure(size)
67
67
  }}>
68
- <DescriptionIcon className="text-gray-700 dark:text-gray-300"/>
68
+ <DescriptionIcon className="text-surface-700 dark:text-surface-300"/>
69
69
  {hint &&
70
70
  <Tooltip title={hint}>
71
71
  <Typography
@@ -9,18 +9,18 @@ import { StorageSource } from "./storage";
9
9
  * to do it as the result of a hook.
10
10
  * @group Hooks and utilities
11
11
  */
12
- export type AuthController<UserType extends User = any, ExtraData = any> = {
12
+ export type AuthController<USER extends User = any, ExtraData = any> = {
13
13
 
14
14
  /**
15
15
  * The user currently logged in
16
16
  * The values can be: the user object, null if they skipped login
17
17
  */
18
- user: UserType | null;
18
+ user: USER | null;
19
19
 
20
20
  /**
21
21
  * Roles related to the logged user
22
22
  */
23
- roles?: Role[];
23
+ userRoles?: Role[];
24
24
 
25
25
  /**
26
26
  * Initial loading flag. It is used not to display the login screen
@@ -64,26 +64,26 @@ export type AuthController<UserType extends User = any, ExtraData = any> = {
64
64
 
65
65
  setExtra: (extra: ExtraData) => void;
66
66
 
67
- // setUser?: (user: UserType | null) => void;
67
+ setUser?: (user: USER | null) => void;
68
68
 
69
- // setRoles?: (roles: Role[]) => void;
69
+ setUserRoles?: (roles: Role[]) => void;
70
70
  };
71
71
 
72
72
  /**
73
73
  * Implement this function to allow access to specific users.
74
74
  * @group Hooks and utilities
75
75
  */
76
- export type Authenticator<UserType extends User = User, Controller extends AuthController<UserType> = AuthController<UserType>> = (props: {
76
+ export type Authenticator<USER extends User = User> = (props: {
77
77
 
78
78
  /**
79
79
  * Logged-in user or null
80
80
  */
81
- user: UserType | null;
81
+ user: USER | null;
82
82
 
83
83
  /**
84
84
  * AuthController
85
85
  */
86
- authController: Controller;
86
+ authController: AuthController<USER>;
87
87
 
88
88
  /**
89
89
  * Connector to your database, e.g. your Firestore database
@@ -17,7 +17,7 @@ import { EntityOverrides } from "./entity_overrides";
17
17
  *
18
18
  * @group Models
19
19
  */
20
- export interface EntityCollection<M extends Record<string, any> = any, UserType extends User = any> {
20
+ export interface EntityCollection<M extends Record<string, any> = any, USER extends User = any> {
21
21
 
22
22
  /**
23
23
  * You can set an alias that will be used internally instead of the `path`.
@@ -139,7 +139,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
139
139
  * Permissions the logged-in user can perform on this collection.
140
140
  * If not specified everything defaults to `true`.
141
141
  */
142
- permissions?: Permissions | PermissionsBuilder<EntityCollection, UserType, M>;
142
+ permissions?: Permissions | PermissionsBuilder<EntityCollection, USER, M>;
143
143
 
144
144
  /**
145
145
  * Are the entities in this collection selectable. Defaults to `true`
@@ -158,7 +158,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
158
158
  * is being created, updated or deleted.
159
159
  * Useful for adding your own logic or blocking the execution of the operation.
160
160
  */
161
- callbacks?: EntityCallbacks<M, UserType>;
161
+ callbacks?: EntityCallbacks<M, USER>;
162
162
 
163
163
  /**
164
164
  * Builder for rendering additional components such as buttons in the
@@ -189,7 +189,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
189
189
  * }
190
190
  * ```
191
191
  */
192
- entityActions?: EntityAction<M, UserType>[];
192
+ entityActions?: EntityAction<M, USER>[];
193
193
 
194
194
  /**
195
195
  * Pass your own selection controller if you want to control selected
@@ -241,7 +241,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
241
241
  * You can add additional fields to the collection view by implementing
242
242
  * an additional field delegate.
243
243
  */
244
- additionalFields?: AdditionalFieldDelegate<M, UserType>[];
244
+ additionalFields?: AdditionalFieldDelegate<M, USER>[];
245
245
 
246
246
  /**
247
247
  * Default size of the rendered collection
@@ -294,7 +294,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
294
294
  /**
295
295
  *
296
296
  */
297
- exportable?: boolean | ExportConfig<UserType>;
297
+ exportable?: boolean | ExportConfig<USER>;
298
298
 
299
299
  /**
300
300
  * User id of the owner of this collection. This is used only by plugins, or if you
@@ -325,7 +325,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
325
325
  *
326
326
  * @group Models
327
327
  */
328
- export interface CollectionActionsProps<M extends Record<string, any> = any, UserType extends User = User, EC extends EntityCollection<M> = EntityCollection<M>> {
328
+ export interface CollectionActionsProps<M extends Record<string, any> = any, USER extends User = User, EC extends EntityCollection<M> = EntityCollection<M>> {
329
329
  /**
330
330
  * Full collection path of this entity. This is the full path, like
331
331
  * `users/1234/addresses`
@@ -362,7 +362,7 @@ export interface CollectionActionsProps<M extends Record<string, any> = any, Use
362
362
  /**
363
363
  * Context of the app status
364
364
  */
365
- context: FireCMSContext<UserType>;
365
+ context: FireCMSContext<USER>;
366
366
 
367
367
  /**
368
368
  * Count of the entities in this collection
@@ -424,9 +424,9 @@ export type FilterCombination<Key extends string> = Partial<Record<Key, "asc" |
424
424
  */
425
425
  export type CollectionSize = "xs" | "s" | "m" | "l" | "xl";
426
426
 
427
- export type AdditionalFieldDelegateProps<M extends Record<string, any> = any, UserType extends User = User> = {
427
+ export type AdditionalFieldDelegateProps<M extends Record<string, any> = any, USER extends User = User> = {
428
428
  entity: Entity<M>,
429
- context: FireCMSContext<UserType>
429
+ context: FireCMSContext<USER>
430
430
  };
431
431
 
432
432
  /**
@@ -435,7 +435,7 @@ export type AdditionalFieldDelegateProps<M extends Record<string, any> = any, Us
435
435
  * @group Models
436
436
  */
437
437
  export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
438
- UserType extends User = User> {
438
+ USER extends User = User> {
439
439
 
440
440
  /**
441
441
  * ID of this column. You can use this id in the `properties` field of the
@@ -456,7 +456,7 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
456
456
  /**
457
457
  * Builder for the content of the cell for this column
458
458
  */
459
- Builder?: React.ComponentType<AdditionalFieldDelegateProps<M, UserType>>;
459
+ Builder?: React.ComponentType<AdditionalFieldDelegateProps<M, USER>>;
460
460
 
461
461
  /**
462
462
  * If this column needs to update dynamically based on other properties,
@@ -260,11 +260,6 @@ export interface DataSourceDelegate {
260
260
  */
261
261
  initialised?: boolean;
262
262
 
263
- /**
264
- * If the user is authenticated to use the data source
265
- */
266
- authenticated?: boolean;
267
-
268
263
  /**
269
264
  * Fetch data from a collection
270
265
  * @param path
@@ -9,7 +9,7 @@ import { SideEntityController } from "./side_entity_controller";
9
9
  * An entity action is a custom action that can be performed on an entity.
10
10
  * They are displayed in the entity view and in the collection view.
11
11
  */
12
- export type EntityAction<M extends object = any, UserType extends User = User> = {
12
+ export type EntityAction<M extends object = any, USER extends User = User> = {
13
13
  /**
14
14
  * Title of the action
15
15
  */
@@ -24,7 +24,7 @@ export type EntityAction<M extends object = any, UserType extends User = User> =
24
24
  * Callback when the action is clicked
25
25
  * @param props
26
26
  */
27
- onClick: (props: EntityActionClickProps<M, UserType>) => Promise<void> | void;
27
+ onClick: (props: EntityActionClickProps<M, USER>) => Promise<void> | void;
28
28
 
29
29
  /**
30
30
  * Show this action collapsed in the menu of the collection view.
@@ -40,9 +40,9 @@ export type EntityAction<M extends object = any, UserType extends User = User> =
40
40
 
41
41
  }
42
42
 
43
- export type EntityActionClickProps<M extends object, UserType extends User = User> = {
43
+ export type EntityActionClickProps<M extends object, USER extends User = User> = {
44
44
  entity: Entity<M>;
45
- context: FireCMSContext<UserType>;
45
+ context: FireCMSContext<USER>;
46
46
  fullPath?: string;
47
47
  collection?: EntityCollection<M>;
48
48
  selectionController?: SelectionController;
@@ -10,27 +10,27 @@ import { User } from "./user";
10
10
  * Useful for adding your own logic or blocking the execution of the operation.
11
11
  * @group Models
12
12
  */
13
- export type EntityCallbacks<M extends Record<string, any> = any, UserType extends User = User> = {
13
+ export type EntityCallbacks<M extends Record<string, any> = any, USER extends User = User> = {
14
14
 
15
15
  /**
16
16
  * Callback used after fetching data
17
17
  * @param entityFetchProps
18
18
  */
19
- onFetch?(entityFetchProps: EntityOnFetchProps<M, UserType>)
19
+ onFetch?(entityFetchProps: EntityOnFetchProps<M, USER>)
20
20
  : Promise<Entity<M>> | Entity<M>;
21
21
 
22
22
  /**
23
23
  * Callback used when save is successful
24
24
  * @param entitySaveProps
25
25
  */
26
- onSaveSuccess?(entitySaveProps: EntityOnSaveProps<M, UserType>)
26
+ onSaveSuccess?(entitySaveProps: EntityOnSaveProps<M, USER>)
27
27
  : Promise<void> | void;
28
28
 
29
29
  /**
30
30
  * Callback used when saving fails
31
31
  * @param entitySaveProps
32
32
  */
33
- onSaveFailure?(entitySaveProps: EntityOnSaveFailureProps<M, UserType>)
33
+ onSaveFailure?(entitySaveProps: EntityOnSaveFailureProps<M, USER>)
34
34
  : Promise<void> | void;
35
35
 
36
36
  /**
@@ -39,7 +39,7 @@ export type EntityCallbacks<M extends Record<string, any> = any, UserType extend
39
39
  * error snackbar gets displayed.
40
40
  * @param entitySaveProps
41
41
  */
42
- onPreSave?(entitySaveProps: EntityOnPreSaveProps<M, UserType>)
42
+ onPreSave?(entitySaveProps: EntityOnPreSaveProps<M, USER>)
43
43
  : Promise<Partial<EntityValues<M>>> | Partial<EntityValues<M>>;
44
44
 
45
45
  /**
@@ -49,14 +49,14 @@ export type EntityCallbacks<M extends Record<string, any> = any, UserType extend
49
49
  *
50
50
  * @param entityDeleteProps
51
51
  */
52
- onPreDelete?(entityDeleteProps: EntityOnDeleteProps<M, UserType>): void;
52
+ onPreDelete?(entityDeleteProps: EntityOnDeleteProps<M, USER>): void;
53
53
 
54
54
  /**
55
55
  * Callback used after the entity is deleted.
56
56
  *
57
57
  * @param entityDeleteProps
58
58
  */
59
- onDelete?(entityDeleteProps: EntityOnDeleteProps<M, UserType>): void;
59
+ onDelete?(entityDeleteProps: EntityOnDeleteProps<M, USER>): void;
60
60
 
61
61
  /**
62
62
  * Callback fired when any value in the form changes. You can use it
@@ -73,12 +73,12 @@ export type EntityCallbacks<M extends Record<string, any> = any, UserType extend
73
73
  * Parameters passed to hooks when an entity is fetched
74
74
  * @group Models
75
75
  */
76
- export interface EntityOnFetchProps<M extends Record<string, any> = any, UserType extends User = User> {
76
+ export interface EntityOnFetchProps<M extends Record<string, any> = any, USER extends User = User> {
77
77
 
78
78
  /**
79
79
  * Collection of the entity
80
80
  */
81
- collection: EntityCollection<M, UserType>;
81
+ collection: EntityCollection<M, USER>;
82
82
 
83
83
  /**
84
84
  * Full path of the CMS where this collection is being fetched.
@@ -94,15 +94,15 @@ export interface EntityOnFetchProps<M extends Record<string, any> = any, UserTyp
94
94
  /**
95
95
  * Context of the app status
96
96
  */
97
- context: FireCMSContext<UserType>;
97
+ context: FireCMSContext<USER>;
98
98
  }
99
99
 
100
100
  /**
101
101
  * Parameters passed to hooks before an entity is saved
102
102
  * @group Models
103
103
  */
104
- export type EntityOnPreSaveProps<M extends Record<string, any> = any, UserType extends User = User> =
105
- Omit<EntityOnSaveProps<M, UserType>, "entityId">
104
+ export type EntityOnPreSaveProps<M extends Record<string, any> = any, USER extends User = User> =
105
+ Omit<EntityOnSaveProps<M, USER>, "entityId">
106
106
  & {
107
107
  entityId?: string;
108
108
  }
@@ -110,8 +110,8 @@ export type EntityOnPreSaveProps<M extends Record<string, any> = any, UserType e
110
110
  * Parameters passed to hooks before an entity is saved
111
111
  * @group Models
112
112
  */
113
- export type EntityOnSaveFailureProps<M extends Record<string, any> = any, UserType extends User = User> =
114
- Omit<EntityOnSaveProps<M, UserType>, "entityId">
113
+ export type EntityOnSaveFailureProps<M extends Record<string, any> = any, USER extends User = User> =
114
+ Omit<EntityOnSaveProps<M, USER>, "entityId">
115
115
  & {
116
116
  entityId?: string;
117
117
  }
@@ -120,7 +120,7 @@ export type EntityOnSaveFailureProps<M extends Record<string, any> = any, UserTy
120
120
  * Parameters passed to hooks when an entity is saved
121
121
  * @group Models
122
122
  */
123
- export interface EntityOnSaveProps<M extends Record<string, any> = any, UserType extends User = User> {
123
+ export interface EntityOnSaveProps<M extends Record<string, any> = any, USER extends User = User> {
124
124
 
125
125
  /**
126
126
  * Resolved collection of the entity
@@ -161,14 +161,14 @@ export interface EntityOnSaveProps<M extends Record<string, any> = any, UserType
161
161
  /**
162
162
  * Context of the app status
163
163
  */
164
- context: FireCMSContext<UserType>;
164
+ context: FireCMSContext<USER>;
165
165
  }
166
166
 
167
167
  /**
168
168
  * Parameters passed to hooks when an entity is deleted
169
169
  * @group Models
170
170
  */
171
- export interface EntityOnDeleteProps<M extends Record<string, any> = any, UserType extends User = User> {
171
+ export interface EntityOnDeleteProps<M extends Record<string, any> = any, USER extends User = User> {
172
172
 
173
173
  /**
174
174
  * collection of the entity being deleted
@@ -193,7 +193,7 @@ export interface EntityOnDeleteProps<M extends Record<string, any> = any, UserTy
193
193
  /**
194
194
  * Context of the app status
195
195
  */
196
- context: FireCMSContext<UserType>;
196
+ context: FireCMSContext<USER>;
197
197
  }
198
198
 
199
199
  /**