@rebasepro/plugin-insights 0.2.3 → 0.2.5
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 +9 -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 +25 -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/data/useCollectionFetch.d.ts +12 -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 +216 -164
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +216 -164
- package/dist/index.umd.js.map +1 -1
- package/dist/plugin-insights/src/components/InsightWidget.d.ts +2 -2
- package/dist/plugin-insights/src/components/InsightWidgetSkeleton.d.ts +3 -1
- package/dist/plugin-insights/src/components/InsightsScorecardView.d.ts +3 -1
- package/dist/types/src/controllers/auth.d.ts +4 -26
- package/dist/types/src/controllers/client.d.ts +25 -43
- package/dist/types/src/controllers/collection_registry.d.ts +1 -1
- package/dist/types/src/controllers/data.d.ts +4 -0
- package/dist/types/src/controllers/data_driver.d.ts +23 -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 +5 -60
- package/dist/types/src/types/backend.d.ts +2 -2
- package/dist/types/src/types/backend_hooks.d.ts +2 -17
- 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 +9 -7
- package/dist/types/src/types/translations.d.ts +28 -12
- package/dist/types/src/types/user_management_delegate.d.ts +22 -57
- package/dist/types/src/users/index.d.ts +0 -1
- package/dist/types/src/users/user.d.ts +0 -1
- 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/components/InsightWidget.tsx +33 -4
- package/src/components/InsightWidgetSkeleton.tsx +7 -1
- package/src/components/InsightsScorecardView.tsx +4 -1
- 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
- package/dist/types/src/users/roles.d.ts +0 -22
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PostgresCollection } from "@rebasepro/types";
|
|
2
|
+
/**
|
|
3
|
+
* Default users collection.
|
|
4
|
+
*
|
|
5
|
+
* Prepended to the developer's collections array by the admin and server.
|
|
6
|
+
* Slug-based dedup (Map keyed by slug, last-write-wins) lets developers
|
|
7
|
+
* override by defining their own collection with `slug: "users"`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const defaultUsersCollection: PostgresCollection;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AuthController, Entity, EntityCollection, User } from "@rebasepro/types";
|
|
2
|
+
export declare function checkOperation<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authController: AuthController<USER>, entity: Entity<M> | null, targetOperation: "select" | "insert" | "update" | "delete"): boolean;
|
|
2
3
|
export declare function canReadCollection<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authController: AuthController<USER>): boolean;
|
|
3
4
|
export declare function canEditEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authController: AuthController<USER>, path: string, entity: Entity<M> | null): boolean;
|
|
4
5
|
export declare function canCreateEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authController: AuthController<USER>, path: string, entity: Entity<M> | null): boolean;
|
|
@@ -66,6 +66,22 @@ export interface LoginViewProps {
|
|
|
66
66
|
* Required when Google login is enabled via ID token flow.
|
|
67
67
|
*/
|
|
68
68
|
googleClientId?: string;
|
|
69
|
+
/**
|
|
70
|
+
* GitHub client ID for GitHub OAuth.
|
|
71
|
+
*/
|
|
72
|
+
githubClientId?: string;
|
|
73
|
+
/**
|
|
74
|
+
* LinkedIn client ID for LinkedIn OAuth.
|
|
75
|
+
*/
|
|
76
|
+
linkedinClientId?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Optional custom title shown above options
|
|
79
|
+
*/
|
|
80
|
+
title?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Optional custom subtitle shown above options
|
|
83
|
+
*/
|
|
84
|
+
subtitle?: string;
|
|
69
85
|
/**
|
|
70
86
|
* When true, shows bootstrap/setup UI (first-user creation).
|
|
71
87
|
* If not set, derived from `authController` if it exposes `needsSetup`.
|
|
@@ -76,10 +92,18 @@ export interface LoginViewProps {
|
|
|
76
92
|
* If not set, derived from `authController.capabilities.registration`.
|
|
77
93
|
*/
|
|
78
94
|
registrationEnabled?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Pre-fill the email field (e.g. for demo or testing environments).
|
|
97
|
+
*/
|
|
98
|
+
defaultEmail?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Pre-fill the password field (e.g. for demo or testing environments).
|
|
101
|
+
*/
|
|
102
|
+
defaultPassword?: string;
|
|
79
103
|
}
|
|
80
104
|
/**
|
|
81
105
|
* Generic login view component that works with any AuthControllerExtended.
|
|
82
106
|
* Feature-detects capabilities to show/hide login methods.
|
|
83
107
|
* @group Core
|
|
84
108
|
*/
|
|
85
|
-
export declare function LoginView({ logo, authController, noUserComponent, disableSignupScreen, disabled, notAllowedError, googleClientId, needsSetup, registrationEnabled }: LoginViewProps): import("react/jsx-runtime").JSX.Element;
|
|
109
|
+
export declare function LoginView({ logo, authController, noUserComponent, disableSignupScreen, disabled, notAllowedError, googleClientId, githubClientId, linkedinClientId, title, subtitle, needsSetup, registrationEnabled, additionalComponent, defaultEmail, defaultPassword }: LoginViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { Property } from "@rebasepro/types";
|
|
2
2
|
import { CollectionSize, SelectedCellProps } from "@rebasepro/types";
|
|
3
|
-
export type EntityCollectionTableController<M extends Record<string,
|
|
3
|
+
export type EntityCollectionTableController<M extends Record<string, unknown>> = {
|
|
4
4
|
/**
|
|
5
5
|
* This cell is displayed as selected
|
|
6
6
|
*/
|
|
7
|
-
selectedCell?: SelectedCellProps
|
|
7
|
+
selectedCell?: SelectedCellProps;
|
|
8
8
|
/**
|
|
9
9
|
* Store used to sync selection state across cells efficiently.
|
|
10
10
|
*/
|
|
11
|
-
selectionStore?:
|
|
11
|
+
selectionStore?: {
|
|
12
|
+
getSnapshot: () => SelectedCellProps | undefined;
|
|
13
|
+
subscribe: (cb: () => void) => () => void;
|
|
14
|
+
};
|
|
12
15
|
/**
|
|
13
16
|
* Select a table cell
|
|
14
17
|
* @param cell
|
|
@@ -23,7 +26,7 @@ export type EntityCollectionTableController<M extends Record<string, any>> = {
|
|
|
23
26
|
* Callback used when the value of a cell has changed.
|
|
24
27
|
* @param params
|
|
25
28
|
*/
|
|
26
|
-
onValueChange?: (params: OnCellValueChangeParams<
|
|
29
|
+
onValueChange?: (params: OnCellValueChangeParams<unknown, M>) => void;
|
|
27
30
|
/**
|
|
28
31
|
* Size of the elements in the collection
|
|
29
32
|
*/
|
|
@@ -33,7 +36,7 @@ export type EntityCollectionTableController<M extends Record<string, any>> = {
|
|
|
33
36
|
* Props passed in a callback when the content of a cell in a table has been edited
|
|
34
37
|
* @group Collection components
|
|
35
38
|
*/
|
|
36
|
-
export interface OnCellValueChangeParams<T =
|
|
39
|
+
export interface OnCellValueChangeParams<T = unknown, D = unknown> {
|
|
37
40
|
value: T;
|
|
38
41
|
propertyKey: string;
|
|
39
42
|
data?: D;
|
|
@@ -45,7 +48,7 @@ export interface OnCellValueChangeParams<T = any, D = any> {
|
|
|
45
48
|
*/
|
|
46
49
|
export type UniqueFieldValidator = (props: {
|
|
47
50
|
name: string;
|
|
48
|
-
value:
|
|
51
|
+
value: unknown;
|
|
49
52
|
property: Property;
|
|
50
53
|
entityId?: string | number;
|
|
51
54
|
}) => Promise<boolean>;
|
|
@@ -53,7 +56,7 @@ export type UniqueFieldValidator = (props: {
|
|
|
53
56
|
* Callback when a cell has changed in a table
|
|
54
57
|
* @group Collection components
|
|
55
58
|
*/
|
|
56
|
-
export type OnCellValueChange<T, M extends Record<string,
|
|
59
|
+
export type OnCellValueChange<T, M extends Record<string, unknown>> = (params: OnCellValueChangeParams<T, M>) => Promise<void> | void;
|
|
57
60
|
/**
|
|
58
61
|
* @group Collection components
|
|
59
62
|
*/
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Locale, User, AuthController, AnalyticsEvent, DataDriver, StorageSource, UserConfigurationPersistence, DatabaseAdmin, RebaseData, RebaseClient, RebaseContext, UserManagementDelegate, EntityLinkBuilder, RebasePlugin, SlotContribution, PropertyConfig, EntityCustomView, EntityAction } from "@rebasepro/types";
|
|
2
|
+
import { Locale, User, AuthController, AnalyticsEvent, DataDriver, StorageSource, UserConfigurationPersistence, DatabaseAdmin, RebaseData, RebaseClient, RebaseContext, UserManagementDelegate, EntityLinkBuilder, RebasePlugin, SlotContribution, PropertyConfig, EntityCustomView, EntityAction, RebaseTranslations } from "@rebasepro/types";
|
|
3
|
+
/** DeepPartial helper — allows partial overrides at any nesting level */
|
|
4
|
+
type DeepPartial<T> = T extends object ? {
|
|
5
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
6
|
+
} : T;
|
|
3
7
|
/**
|
|
4
8
|
* Controller to simulate different roles when dev mode is active.
|
|
5
9
|
* @group Models
|
|
@@ -116,7 +120,7 @@ export type RebaseProps<USER extends User> = {
|
|
|
116
120
|
/**
|
|
117
121
|
* Entity Views
|
|
118
122
|
*/
|
|
119
|
-
entityViews?: EntityCustomView
|
|
123
|
+
entityViews?: EntityCustomView[];
|
|
120
124
|
/**
|
|
121
125
|
* Entity Actions
|
|
122
126
|
*/
|
|
@@ -133,4 +137,11 @@ export type RebaseProps<USER extends User> = {
|
|
|
133
137
|
* Controller to simulate different roles when dev mode is active.
|
|
134
138
|
*/
|
|
135
139
|
effectiveRoleController?: EffectiveRoleController;
|
|
140
|
+
/**
|
|
141
|
+
* Override or extend any Rebase UI string, keyed by locale.
|
|
142
|
+
*/
|
|
143
|
+
translations?: {
|
|
144
|
+
[locale: string]: DeepPartial<RebaseTranslations>;
|
|
145
|
+
};
|
|
136
146
|
};
|
|
147
|
+
export {};
|
|
@@ -16,6 +16,14 @@ export interface CollectionFetchProps<M extends Record<string, any>> {
|
|
|
16
16
|
* Number of entities to fetch
|
|
17
17
|
*/
|
|
18
18
|
itemCount?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Number of items to skip
|
|
21
|
+
*/
|
|
22
|
+
offset?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Page number (1-indexed), alternative to offset
|
|
25
|
+
*/
|
|
26
|
+
page?: number;
|
|
19
27
|
/**
|
|
20
28
|
* Filter the fetched data by the property
|
|
21
29
|
*/
|
|
@@ -37,6 +45,7 @@ export interface CollectionFetchResult<M extends Record<string, any>> {
|
|
|
37
45
|
dataLoading: boolean;
|
|
38
46
|
noMoreToLoad: boolean;
|
|
39
47
|
dataLoadingError?: Error;
|
|
48
|
+
totalCount?: number;
|
|
40
49
|
}
|
|
41
50
|
/**
|
|
42
51
|
* This hook is used to fetch collections using a given collection
|
|
@@ -45,7 +54,9 @@ export interface CollectionFetchResult<M extends Record<string, any>> {
|
|
|
45
54
|
* @param filterValues
|
|
46
55
|
* @param sortBy
|
|
47
56
|
* @param itemCount
|
|
57
|
+
* @param offset
|
|
58
|
+
* @param page
|
|
48
59
|
* @param searchString
|
|
49
60
|
* @group Hooks and utilities
|
|
50
61
|
*/
|
|
51
|
-
export declare function useCollectionFetch<M extends Record<string, any>, USER extends User>({ path, collection, filterValues, sortBy, itemCount, searchString }: CollectionFetchProps<M>): CollectionFetchResult<M>;
|
|
62
|
+
export declare function useCollectionFetch<M extends Record<string, any>, USER extends User>({ path, collection, filterValues, sortBy, itemCount, offset, page, searchString }: CollectionFetchProps<M>): CollectionFetchResult<M>;
|
|
@@ -26,7 +26,6 @@ export * from "./useSlot";
|
|
|
26
26
|
export * from "./useCustomizationController";
|
|
27
27
|
export * from "./useBuildLocalConfigurationPersistence";
|
|
28
28
|
export * from "./useBuildModeController";
|
|
29
|
-
export * from "./useValidateAuthenticator";
|
|
30
29
|
export * from "./useRebaseRegistry";
|
|
31
30
|
export * from "./useBackendStorageSource";
|
|
32
31
|
export * from "./usePermissions";
|
|
@@ -7,7 +7,6 @@ export declare function saveEntityToCache(path: string, data: object): void;
|
|
|
7
7
|
export declare function removeEntityFromMemoryCache(path: string): void;
|
|
8
8
|
export declare function saveEntityToMemoryCache(path: string, data: object): void;
|
|
9
9
|
export declare function getEntityFromMemoryCache(path: string): object | undefined;
|
|
10
|
-
export declare function hasEntityInCache(path: string): boolean;
|
|
11
10
|
/**
|
|
12
11
|
* Retrieves an entity from the in-memory cache or `sessionStorage`.
|
|
13
12
|
* If the entity is not in the cache but exists in `sessionStorage`, it loads it into the cache.
|
|
@@ -20,8 +19,4 @@ export declare function getEntityFromCache(path: string): object | undefined;
|
|
|
20
19
|
* @param path - The unique path/key for the entity to remove.
|
|
21
20
|
*/
|
|
22
21
|
export declare function removeEntityFromCache(path: string): void;
|
|
23
|
-
/**
|
|
24
|
-
* Clears the entire in-memory cache and removes all related entities from `sessionStorage`.
|
|
25
|
-
*/
|
|
26
|
-
export declare function clearEntityCache(): void;
|
|
27
22
|
export declare function flattenKeys(obj: Record<string, unknown> | unknown[], prefix?: string, result?: string[]): string[];
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
export * from "./icon_list";
|
|
2
|
-
export * from "./icon_synonyms";
|
|
3
2
|
export * from "./icons";
|
|
4
3
|
export * from "./createFormexStub";
|
|
5
4
|
export * from "./entity_cache";
|
|
6
5
|
export * from "./useStorageUploadController";
|
|
7
|
-
export * from "./useTraceUpdate";
|
|
8
6
|
export * from "./previews";
|
|
9
7
|
export * from "./enums";
|
|
10
8
|
export * from "./constants";
|
|
@@ -12,7 +12,7 @@ export interface StorageFieldItem {
|
|
|
12
12
|
storagePathOrDownloadUrl?: string;
|
|
13
13
|
file?: File;
|
|
14
14
|
fileName?: string;
|
|
15
|
-
metadata?:
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
16
|
size: StorageFieldSize;
|
|
17
17
|
}
|
|
18
18
|
export declare function useStorageUploadController<M extends Record<string, unknown>>({ entityId, entityValues, path, value, property, propertyKey, storageSource, disabled, onChange }: {
|
|
@@ -31,7 +31,7 @@ export declare function useStorageUploadController<M extends Record<string, unkn
|
|
|
31
31
|
storage: StorageConfig;
|
|
32
32
|
fileNameBuilder: (file: File) => Promise<string>;
|
|
33
33
|
storagePathBuilder: (file: File) => string;
|
|
34
|
-
onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, metadata?:
|
|
34
|
+
onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, metadata?: Record<string, unknown>, uploadedUrl?: string) => Promise<void>;
|
|
35
35
|
onFileUploadError: (entry: StorageFieldItem) => void;
|
|
36
36
|
onFilesAdded: (acceptedFiles: File[]) => Promise<void>;
|
|
37
37
|
multipleFilesSupported: boolean;
|
|
@@ -11,6 +11,6 @@ export declare const isNaN: (obj: unknown) => boolean;
|
|
|
11
11
|
/**
|
|
12
12
|
* Deeply get a value from an object via its path.
|
|
13
13
|
*/
|
|
14
|
-
export declare function getIn(obj:
|
|
15
|
-
export declare function setIn(obj:
|
|
14
|
+
export declare function getIn(obj: unknown, key: string | string[], def?: unknown, p?: number): unknown;
|
|
15
|
+
export declare function setIn(obj: unknown, path: string, value: unknown): unknown;
|
|
16
16
|
export declare function clone(value: unknown): unknown;
|