@rebasepro/plugin-insights 0.2.3 → 0.3.0
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.
- package/dist/common/src/collections/default-collections.d.ts +12 -0
- package/dist/common/src/collections/index.d.ts +1 -0
- package/dist/common/src/util/permissions.d.ts +1 -0
- package/dist/core/src/components/LoginView/LoginView.d.ts +17 -1
- package/dist/core/src/components/common/types.d.ts +10 -7
- package/dist/core/src/components/common/useDebouncedData.d.ts +1 -1
- package/dist/core/src/core/RebaseProps.d.ts +13 -2
- package/dist/core/src/core/RebaseRouter.d.ts +1 -1
- package/dist/core/src/hooks/index.d.ts +0 -1
- package/dist/core/src/util/entity_cache.d.ts +0 -5
- package/dist/core/src/util/index.d.ts +0 -2
- package/dist/core/src/util/useStorageUploadController.d.ts +2 -2
- package/dist/formex/src/utils.d.ts +2 -2
- package/dist/index.es.js +1 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -0
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/controllers/auth.d.ts +2 -24
- package/dist/types/src/controllers/client.d.ts +0 -3
- package/dist/types/src/controllers/collection_registry.d.ts +1 -1
- package/dist/types/src/controllers/data_driver.d.ts +18 -0
- package/dist/types/src/controllers/registry.d.ts +5 -4
- package/dist/types/src/rebase_context.d.ts +1 -1
- package/dist/types/src/types/auth_adapter.d.ts +2 -4
- package/dist/types/src/types/collections.d.ts +0 -4
- package/dist/types/src/types/component_ref.d.ts +1 -1
- package/dist/types/src/types/cron.d.ts +1 -1
- package/dist/types/src/types/entity_views.d.ts +1 -0
- package/dist/types/src/types/export_import.d.ts +1 -1
- package/dist/types/src/types/formex.d.ts +2 -2
- package/dist/types/src/types/properties.d.ts +2 -2
- package/dist/types/src/types/translations.d.ts +28 -12
- package/dist/types/src/types/user_management_delegate.d.ts +6 -4
- package/dist/types/src/users/roles.d.ts +0 -8
- package/dist/ui/src/components/Button.d.ts +2 -2
- package/dist/ui/src/components/ErrorBoundary.d.ts +25 -3
- package/dist/ui/src/components/VirtualTable/VirtualTable.d.ts +1 -1
- package/dist/ui/src/components/VirtualTable/VirtualTableCell.d.ts +6 -6
- package/dist/ui/src/components/VirtualTable/VirtualTableHeader.d.ts +8 -8
- package/dist/ui/src/components/VirtualTable/VirtualTableHeaderRow.d.ts +1 -1
- package/dist/ui/src/components/VirtualTable/VirtualTableProps.d.ts +11 -11
- package/dist/ui/src/components/VirtualTable/VirtualTableRow.d.ts +1 -1
- package/dist/ui/src/components/VirtualTable/types.d.ts +9 -9
- package/dist/ui/src/hooks/useDebounceCallback.d.ts +1 -1
- package/dist/ui/src/util/debounce.d.ts +1 -1
- package/package.json +4 -3
- package/src/engine/InsightsCache.test.ts +56 -0
- package/src/engine/useInsightsData.ts +1 -0
- package/dist/core/src/hooks/useValidateAuthenticator.d.ts +0 -21
- package/dist/core/src/util/icon_synonyms.d.ts +0 -1
- package/dist/core/src/util/useTraceUpdate.d.ts +0 -2
|
@@ -104,15 +104,17 @@ export interface UserManagementDelegate<USER extends User = User> {
|
|
|
104
104
|
* If true, the UI will allow the user to create the default roles (admin, editor, viewer).
|
|
105
105
|
*/
|
|
106
106
|
allowDefaultRolesCreation?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Should collection config permissions be included?
|
|
109
|
-
*/
|
|
110
|
-
includeCollectionConfigPermissions?: boolean;
|
|
111
107
|
/**
|
|
112
108
|
* Optionally define roles for a given user. This is useful when the roles
|
|
113
109
|
* are coming from a separate provider than the one issuing the tokens.
|
|
114
110
|
*/
|
|
115
111
|
defineRolesFor?: (user: USER) => Promise<Role[] | undefined> | Role[] | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Whether any admin users exist. Used by the bootstrap banner to decide
|
|
114
|
+
* whether to prompt. Populated via a lightweight check (e.g. `limit=1`
|
|
115
|
+
* query) instead of loading all users.
|
|
116
|
+
*/
|
|
117
|
+
hasAdminUsers?: boolean;
|
|
116
118
|
/**
|
|
117
119
|
* Optional function to bootstrap an admin user.
|
|
118
120
|
* Often used when the database is empty.
|
|
@@ -11,12 +11,4 @@ export type Role = {
|
|
|
11
11
|
* If this flag is true, the user can perform any action
|
|
12
12
|
*/
|
|
13
13
|
isAdmin?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Permissions related to editing the collections
|
|
16
|
-
*/
|
|
17
|
-
config?: {
|
|
18
|
-
createCollections?: boolean;
|
|
19
|
-
editCollections?: boolean | "own";
|
|
20
|
-
deleteCollections?: boolean | "own";
|
|
21
|
-
};
|
|
22
14
|
};
|
|
@@ -9,6 +9,6 @@ export type ButtonProps<C extends React.ElementType = "button"> = {
|
|
|
9
9
|
fullWidth?: boolean;
|
|
10
10
|
className?: string;
|
|
11
11
|
component?: C;
|
|
12
|
-
onClick?: React.MouseEventHandler<
|
|
12
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
13
13
|
} & React.ComponentPropsWithoutRef<C>;
|
|
14
|
-
export declare const Button: React.FC<ButtonProps<
|
|
14
|
+
export declare const Button: React.FC<ButtonProps<React.ElementType>>;
|
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
import React, { ErrorInfo, PropsWithChildren } from "react";
|
|
2
|
-
export
|
|
2
|
+
export interface ErrorBoundaryProps {
|
|
3
|
+
/**
|
|
4
|
+
* When true, renders a full-page centered error screen instead of the
|
|
5
|
+
* compact inline error. Intended for wrapping top-level app roots or
|
|
6
|
+
* major route sections.
|
|
7
|
+
*/
|
|
8
|
+
fullPage?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Optional callback invoked when the user clicks "Try again". If provided,
|
|
11
|
+
* the boundary resets its error state and calls this handler. If omitted,
|
|
12
|
+
* the "Try again" button resets the boundary state, re-mounting children.
|
|
13
|
+
*/
|
|
14
|
+
onReset?: () => void;
|
|
15
|
+
}
|
|
16
|
+
interface ErrorBoundaryState {
|
|
3
17
|
error: Error | null;
|
|
4
|
-
|
|
5
|
-
|
|
18
|
+
showDetails: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class ErrorBoundary extends React.Component<PropsWithChildren<ErrorBoundaryProps>, ErrorBoundaryState> {
|
|
21
|
+
constructor(props: PropsWithChildren<ErrorBoundaryProps>);
|
|
6
22
|
static getDerivedStateFromError(error: Error): {
|
|
7
23
|
error: Error;
|
|
8
24
|
};
|
|
9
25
|
componentDidCatch(error: Error, _errorInfo: ErrorInfo): void;
|
|
26
|
+
private handleReset;
|
|
27
|
+
private handleReload;
|
|
28
|
+
private toggleDetails;
|
|
10
29
|
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
30
|
+
private renderInline;
|
|
31
|
+
private renderFullPage;
|
|
11
32
|
}
|
|
33
|
+
export {};
|
|
@@ -8,4 +8,4 @@ import { VirtualTableProps } from "./VirtualTableProps";
|
|
|
8
8
|
*
|
|
9
9
|
* @group Components
|
|
10
10
|
*/
|
|
11
|
-
export declare const VirtualTable: React.NamedExoticComponent<VirtualTableProps<
|
|
11
|
+
export declare const VirtualTable: React.NamedExoticComponent<VirtualTableProps<Record<string, unknown>>>;
|
|
@@ -4,18 +4,18 @@ type VirtualTableCellProps<T> = {
|
|
|
4
4
|
dataKey: string;
|
|
5
5
|
column: VirtualTableColumn;
|
|
6
6
|
columns: VirtualTableColumn[];
|
|
7
|
-
rowData:
|
|
8
|
-
cellData:
|
|
9
|
-
rowIndex:
|
|
7
|
+
rowData: T;
|
|
8
|
+
cellData: unknown;
|
|
9
|
+
rowIndex: number;
|
|
10
10
|
columnIndex: number;
|
|
11
11
|
cellRenderer: (props: CellRendererParams<T>) => React.ReactNode;
|
|
12
12
|
sortableNodeRef?: (node: HTMLElement | null) => void;
|
|
13
13
|
sortableStyle?: React.CSSProperties;
|
|
14
|
-
sortableAttributes?: Record<string,
|
|
14
|
+
sortableAttributes?: Record<string, unknown>;
|
|
15
15
|
isDragging?: boolean;
|
|
16
16
|
isDraggable?: boolean;
|
|
17
17
|
frozen?: boolean;
|
|
18
|
-
extraData?:
|
|
18
|
+
extraData?: unknown;
|
|
19
19
|
};
|
|
20
|
-
export declare const VirtualTableCell: React.NamedExoticComponent<VirtualTableCellProps<
|
|
20
|
+
export declare const VirtualTableCell: React.NamedExoticComponent<VirtualTableCellProps<unknown>>;
|
|
21
21
|
export {};
|
|
@@ -2,28 +2,28 @@ import React from "react";
|
|
|
2
2
|
import { VirtualTableColumn, VirtualTableSort, VirtualTableWhereFilterOp } from "./VirtualTableProps";
|
|
3
3
|
export type FilterFormFieldProps<CustomProps> = {
|
|
4
4
|
id: React.Key;
|
|
5
|
-
filterValue: [VirtualTableWhereFilterOp,
|
|
6
|
-
setFilterValue: (filterValue?: [VirtualTableWhereFilterOp,
|
|
5
|
+
filterValue: [VirtualTableWhereFilterOp, unknown] | undefined;
|
|
6
|
+
setFilterValue: (filterValue?: [VirtualTableWhereFilterOp, unknown]) => void;
|
|
7
7
|
column: VirtualTableColumn<CustomProps>;
|
|
8
8
|
hidden: boolean;
|
|
9
9
|
setHidden: (hidden: boolean) => void;
|
|
10
10
|
};
|
|
11
|
-
type VirtualTableHeaderProps<M extends Record<string,
|
|
11
|
+
type VirtualTableHeaderProps<M extends Record<string, unknown>> = {
|
|
12
12
|
resizeHandleRef: React.Ref<HTMLDivElement>;
|
|
13
13
|
columnIndex: number;
|
|
14
14
|
isResizingIndex: number;
|
|
15
|
-
column: VirtualTableColumn<
|
|
15
|
+
column: VirtualTableColumn<unknown>;
|
|
16
16
|
onColumnSort: (key: Extract<keyof M, string>) => void;
|
|
17
|
-
filter?: [VirtualTableWhereFilterOp,
|
|
17
|
+
filter?: [VirtualTableWhereFilterOp, unknown];
|
|
18
18
|
sort: VirtualTableSort;
|
|
19
|
-
onFilterUpdate: (column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp,
|
|
19
|
+
onFilterUpdate: (column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp, unknown]) => void;
|
|
20
20
|
onClickResizeColumn?: (columnIndex: number, column: VirtualTableColumn) => void;
|
|
21
|
-
createFilterField?: (props: FilterFormFieldProps<
|
|
21
|
+
createFilterField?: (props: FilterFormFieldProps<unknown>) => React.ReactNode;
|
|
22
22
|
AdditionalHeaderWidget?: (props: {
|
|
23
23
|
onHover: boolean;
|
|
24
24
|
}) => React.ReactNode;
|
|
25
25
|
isDragging?: boolean;
|
|
26
26
|
isDraggable?: boolean;
|
|
27
27
|
};
|
|
28
|
-
export declare const VirtualTableHeader: React.FunctionComponent<VirtualTableHeaderProps<
|
|
28
|
+
export declare const VirtualTableHeader: React.FunctionComponent<VirtualTableHeaderProps<Record<string, unknown>>>;
|
|
29
29
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { VirtualTableContextProps } from "./types";
|
|
2
|
-
export declare const VirtualTableHeaderRow: ({ columns, currentSort, onColumnSort, onFilterUpdate, sortByProperty, filter, onColumnResize, onColumnResizeEnd, createFilterField, AddColumnComponent, onColumnsOrderChange, data, cellRenderer: CellRenderer, rowHeight, draggingColumnId, headerHeight }: VirtualTableContextProps<
|
|
2
|
+
export declare const VirtualTableHeaderRow: ({ columns, currentSort, onColumnSort, onFilterUpdate, sortByProperty, filter, onColumnResize, onColumnResizeEnd, createFilterField, AddColumnComponent, onColumnsOrderChange, data, cellRenderer: CellRenderer, rowHeight, draggingColumnId, headerHeight }: VirtualTableContextProps<Record<string, unknown>>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FilterFormFieldProps } from "./VirtualTableHeader";
|
|
3
|
-
export type OnRowClickParams<T extends Record<string,
|
|
3
|
+
export type OnRowClickParams<T extends Record<string, unknown>> = {
|
|
4
4
|
rowData: T;
|
|
5
5
|
rowIndex: number;
|
|
6
6
|
event: React.SyntheticEvent;
|
|
@@ -9,7 +9,7 @@ export type OnRowClickParams<T extends Record<string, any>> = {
|
|
|
9
9
|
* @see Table
|
|
10
10
|
* @group Components
|
|
11
11
|
*/
|
|
12
|
-
export interface VirtualTableProps<T extends Record<string,
|
|
12
|
+
export interface VirtualTableProps<T extends Record<string, unknown>> {
|
|
13
13
|
/**
|
|
14
14
|
* Array of arbitrary data
|
|
15
15
|
*/
|
|
@@ -61,12 +61,12 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
61
61
|
/**
|
|
62
62
|
* In case this table should have some filters set by default
|
|
63
63
|
*/
|
|
64
|
-
filter?: VirtualTableFilterValues<
|
|
64
|
+
filter?: VirtualTableFilterValues<string>;
|
|
65
65
|
/**
|
|
66
66
|
* Callback used when filters are updated
|
|
67
67
|
* @param filter
|
|
68
68
|
*/
|
|
69
|
-
onFilterUpdate?: (filter?: VirtualTableFilterValues<
|
|
69
|
+
onFilterUpdate?: (filter?: VirtualTableFilterValues<string> | undefined) => void;
|
|
70
70
|
/**
|
|
71
71
|
* Callback when the table is scrolled
|
|
72
72
|
* @param props
|
|
@@ -111,7 +111,7 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
111
111
|
* Callback to create a filter field, displayed in the header as a dropdown
|
|
112
112
|
* @param props
|
|
113
113
|
*/
|
|
114
|
-
createFilterField?: (props: FilterFormFieldProps<
|
|
114
|
+
createFilterField?: (props: FilterFormFieldProps<unknown>) => React.ReactNode;
|
|
115
115
|
/**
|
|
116
116
|
* Class name applied to the table
|
|
117
117
|
*/
|
|
@@ -141,9 +141,9 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
141
141
|
/**
|
|
142
142
|
* Extra data passed to the cell renderer
|
|
143
143
|
*/
|
|
144
|
-
extraData?:
|
|
144
|
+
extraData?: unknown;
|
|
145
145
|
}
|
|
146
|
-
export type CellRendererParams<T =
|
|
146
|
+
export type CellRendererParams<T = unknown> = {
|
|
147
147
|
column: VirtualTableColumn;
|
|
148
148
|
columns: VirtualTableColumn[];
|
|
149
149
|
columnIndex: number;
|
|
@@ -153,17 +153,17 @@ export type CellRendererParams<T = any> = {
|
|
|
153
153
|
isScrolling?: boolean;
|
|
154
154
|
sortableNodeRef?: (node: HTMLElement | null) => void;
|
|
155
155
|
sortableStyle?: React.CSSProperties;
|
|
156
|
-
sortableAttributes?: Record<string,
|
|
156
|
+
sortableAttributes?: Record<string, unknown>;
|
|
157
157
|
isDragging?: boolean;
|
|
158
158
|
isDraggable?: boolean;
|
|
159
159
|
frozen?: boolean;
|
|
160
|
-
extraData?:
|
|
160
|
+
extraData?: unknown;
|
|
161
161
|
};
|
|
162
162
|
/**
|
|
163
163
|
* @see Table
|
|
164
164
|
* @group Components
|
|
165
165
|
*/
|
|
166
|
-
export interface VirtualTableColumn<CustomProps =
|
|
166
|
+
export interface VirtualTableColumn<CustomProps = unknown> {
|
|
167
167
|
/**
|
|
168
168
|
* Data key for the cell value, could be "a.b.c"
|
|
169
169
|
*/
|
|
@@ -233,7 +233,7 @@ export type VirtualTableSort = "asc" | "desc" | undefined;
|
|
|
233
233
|
* @see Table
|
|
234
234
|
* @group Components
|
|
235
235
|
*/
|
|
236
|
-
export type VirtualTableFilterValues<Key extends string> = Partial<Record<Key, [VirtualTableWhereFilterOp,
|
|
236
|
+
export type VirtualTableFilterValues<Key extends string> = Partial<Record<Key, [VirtualTableWhereFilterOp, unknown]>>;
|
|
237
237
|
/**
|
|
238
238
|
* Filter conditions in a `Query.where()` clause are specified using the
|
|
239
239
|
* strings `<`, `<=`, `==`, `>=`, `>`, `array-contains`, `in`, and `array-contains-any`.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { VirtualTableRowProps } from "./types";
|
|
3
|
-
export declare const VirtualTableRow: React.NamedExoticComponent<VirtualTableRowProps<
|
|
3
|
+
export declare const VirtualTableRow: React.NamedExoticComponent<VirtualTableRowProps<Record<string, unknown>>>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CellRendererParams, OnRowClickParams, OnVirtualTableColumnResizeParams, VirtualTableColumn, VirtualTableFilterValues, VirtualTableWhereFilterOp } from "./VirtualTableProps";
|
|
3
3
|
import { FilterFormFieldProps } from "./VirtualTableHeader";
|
|
4
|
-
export type VirtualTableRowProps<T
|
|
5
|
-
style:
|
|
4
|
+
export type VirtualTableRowProps<T extends Record<string, unknown>> = {
|
|
5
|
+
style: React.CSSProperties;
|
|
6
6
|
rowHeight: number;
|
|
7
7
|
rowData: T;
|
|
8
8
|
rowIndex: number;
|
|
9
|
-
onRowClick?: (props: OnRowClickParams<
|
|
9
|
+
onRowClick?: (props: OnRowClickParams<Record<string, unknown>>) => void;
|
|
10
10
|
children: React.ReactNode[];
|
|
11
11
|
columns: VirtualTableColumn[];
|
|
12
12
|
hoverRow?: boolean;
|
|
@@ -19,20 +19,20 @@ export type VirtualTableContextProps<T> = {
|
|
|
19
19
|
columns: VirtualTableColumn[];
|
|
20
20
|
cellRenderer: React.ComponentType<CellRendererParams<T>>;
|
|
21
21
|
currentSort: "asc" | "desc" | undefined;
|
|
22
|
-
filter?: VirtualTableFilterValues<
|
|
23
|
-
onRowClick?: (props: OnRowClickParams<
|
|
24
|
-
onColumnSort: (key: string) =>
|
|
22
|
+
filter?: VirtualTableFilterValues<string>;
|
|
23
|
+
onRowClick?: (props: OnRowClickParams<Record<string, unknown>>) => void;
|
|
24
|
+
onColumnSort: (key: string) => void;
|
|
25
25
|
onColumnResize: (params: OnVirtualTableColumnResizeParams) => void;
|
|
26
26
|
onColumnResizeEnd: (params: OnVirtualTableColumnResizeParams) => void;
|
|
27
|
-
onFilterUpdate: (column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp,
|
|
27
|
+
onFilterUpdate: (column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp, unknown]) => void;
|
|
28
28
|
sortByProperty?: string;
|
|
29
29
|
customView?: React.ReactNode;
|
|
30
30
|
hoverRow: boolean;
|
|
31
|
-
createFilterField?: (props: FilterFormFieldProps<
|
|
31
|
+
createFilterField?: (props: FilterFormFieldProps<unknown>) => React.ReactNode;
|
|
32
32
|
rowClassName?: (rowData: T) => string | undefined;
|
|
33
33
|
endAdornment?: React.ReactNode;
|
|
34
34
|
AddColumnComponent?: React.ComponentType;
|
|
35
35
|
onColumnsOrderChange?: (columns: VirtualTableColumn[]) => void;
|
|
36
36
|
draggingColumnId?: string | null;
|
|
37
|
-
extraData?:
|
|
37
|
+
extraData?: unknown;
|
|
38
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useDebounceCallback<T extends (...args: any[]) =>
|
|
1
|
+
export declare function useDebounceCallback<T extends (...args: any[]) => unknown>(callback?: T, delay?: number): T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @ignore
|
|
3
3
|
*/
|
|
4
|
-
export declare function debounce<T extends (...args: any[]) =>
|
|
4
|
+
export declare function debounce<T extends (...args: any[]) => unknown>(func: T, wait?: number): T & Cancelable;
|
|
5
5
|
/**
|
|
6
6
|
* @ignore
|
|
7
7
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/plugin-insights",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
"./package.json": "./package.json"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@rebasepro/core": "0.
|
|
20
|
-
"@rebasepro/
|
|
19
|
+
"@rebasepro/core": "0.3.0",
|
|
20
|
+
"@rebasepro/ui": "0.3.0",
|
|
21
|
+
"@rebasepro/types": "0.3.0"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
23
24
|
"react": ">=19.0.0",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { InsightsCache } from "./InsightsCache";
|
|
2
|
+
import type { InsightDataResult } from "../types";
|
|
3
|
+
|
|
4
|
+
describe("InsightsCache", () => {
|
|
5
|
+
it("should set and get values from cache", () => {
|
|
6
|
+
const cache = new InsightsCache();
|
|
7
|
+
const data: InsightDataResult = {
|
|
8
|
+
data: [{ count: 10 }],
|
|
9
|
+
columns: ["count"]
|
|
10
|
+
};
|
|
11
|
+
cache.set("query_key", data);
|
|
12
|
+
expect(cache.get("query_key")).toEqual(data);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("should return null for expired keys", () => {
|
|
16
|
+
const cache = new InsightsCache(-1); // -1ms TTL to force immediate expiry
|
|
17
|
+
const data: InsightDataResult = {
|
|
18
|
+
data: [{ count: 10 }],
|
|
19
|
+
columns: ["count"]
|
|
20
|
+
};
|
|
21
|
+
cache.set("query_key", data);
|
|
22
|
+
// Expired immediately
|
|
23
|
+
expect(cache.get("query_key")).toBeNull();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("should manage inflight requests", () => {
|
|
27
|
+
const cache = new InsightsCache();
|
|
28
|
+
const promise = Promise.resolve({
|
|
29
|
+
data: [],
|
|
30
|
+
columns: []
|
|
31
|
+
});
|
|
32
|
+
expect(cache.getInflight("query_key")).toBeNull();
|
|
33
|
+
|
|
34
|
+
cache.setInflight("query_key", promise);
|
|
35
|
+
expect(cache.getInflight("query_key")).toBe(promise);
|
|
36
|
+
|
|
37
|
+
// Setting a result should remove the inflight reference
|
|
38
|
+
const data: InsightDataResult = { data: [], columns: [] };
|
|
39
|
+
cache.set("query_key", data);
|
|
40
|
+
expect(cache.getInflight("query_key")).toBeNull();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("should invalidate entries", () => {
|
|
44
|
+
const cache = new InsightsCache();
|
|
45
|
+
const data: InsightDataResult = { data: [], columns: [] };
|
|
46
|
+
cache.set("key_1", data);
|
|
47
|
+
cache.set("key_2", data);
|
|
48
|
+
|
|
49
|
+
cache.invalidate("key_1");
|
|
50
|
+
expect(cache.get("key_1")).toBeNull();
|
|
51
|
+
expect(cache.get("key_2")).toEqual(data);
|
|
52
|
+
|
|
53
|
+
cache.invalidate();
|
|
54
|
+
expect(cache.get("key_2")).toBeNull();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AuthController, Authenticator, RebaseData, StorageSource, User } from "@rebasepro/types";
|
|
2
|
-
/**
|
|
3
|
-
* This hook is used internally for validating an authenticator.
|
|
4
|
-
*
|
|
5
|
-
* @param authController
|
|
6
|
-
* @param authentication
|
|
7
|
-
* @param storageSource
|
|
8
|
-
* @param data
|
|
9
|
-
*/
|
|
10
|
-
export declare function useValidateAuthenticator<USER extends User = any>({ disabled, authController, authenticator, storageSource, data }: {
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
authController: AuthController<USER>;
|
|
13
|
-
authenticator?: boolean | Authenticator<USER>;
|
|
14
|
-
data: RebaseData;
|
|
15
|
-
storageSource: StorageSource;
|
|
16
|
-
}): {
|
|
17
|
-
canAccessMainView: boolean;
|
|
18
|
-
authLoading: boolean;
|
|
19
|
-
notAllowedError: any;
|
|
20
|
-
authVerified: boolean;
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const iconSynonyms: Record<string, string>;
|