@rebasepro/plugin-insights 0.3.0 → 0.4.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.
Files changed (34) hide show
  1. package/dist/common/src/collections/default-collections.d.ts +5 -8
  2. package/dist/common/src/data/query_builder.d.ts +6 -2
  3. package/dist/core/src/components/LoginView/LoginView.d.ts +9 -1
  4. package/dist/core/src/components/common/types.d.ts +3 -3
  5. package/dist/core/src/hooks/data/useCollectionFetch.d.ts +12 -1
  6. package/dist/index.es.js +215 -164
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/index.umd.js +215 -164
  9. package/dist/index.umd.js.map +1 -1
  10. package/dist/plugin-insights/src/components/InsightWidget.d.ts +2 -2
  11. package/dist/plugin-insights/src/components/InsightWidgetSkeleton.d.ts +3 -1
  12. package/dist/plugin-insights/src/components/InsightsScorecardView.d.ts +3 -1
  13. package/dist/types/src/controllers/auth.d.ts +2 -2
  14. package/dist/types/src/controllers/client.d.ts +25 -40
  15. package/dist/types/src/controllers/data.d.ts +21 -3
  16. package/dist/types/src/controllers/data_driver.d.ts +5 -0
  17. package/dist/types/src/controllers/email.d.ts +2 -0
  18. package/dist/types/src/types/auth_adapter.d.ts +3 -56
  19. package/dist/types/src/types/backend.d.ts +2 -2
  20. package/dist/types/src/types/backend_hooks.d.ts +2 -17
  21. package/dist/types/src/types/collections.d.ts +9 -5
  22. package/dist/types/src/types/entity_views.d.ts +19 -28
  23. package/dist/types/src/types/properties.d.ts +9 -7
  24. package/dist/types/src/types/user_management_delegate.d.ts +16 -53
  25. package/dist/types/src/users/index.d.ts +0 -1
  26. package/dist/types/src/users/user.d.ts +0 -1
  27. package/dist/ui/src/components/Card.d.ts +2 -3
  28. package/dist/ui/src/components/FilterChip.d.ts +2 -10
  29. package/dist/ui/src/components/VirtualTable/VirtualTableProps.d.ts +8 -2
  30. package/package.json +4 -4
  31. package/src/components/InsightWidget.tsx +33 -4
  32. package/src/components/InsightWidgetSkeleton.tsx +7 -1
  33. package/src/components/InsightsScorecardView.tsx +4 -1
  34. package/dist/types/src/users/roles.d.ts +0 -14
@@ -1,12 +1,9 @@
1
- import { PostgresCollection } from "@rebasepro/types";
1
+ import type { PostgresCollection } from "@rebasepro/types";
2
2
  /**
3
- * Default users collection definition.
3
+ * Default users collection.
4
4
  *
5
- * Shared between the admin UI (for navigation/display) and the backend
6
- * (for schema generation). Both consumers prepend this to the developer's
7
- * collections array and rely on generic slug-based deduplication
8
- * (Map keyed by slug, last-write-wins) so that developer-defined
9
- * collections with the same slug override this default — no hardcoded
10
- * string checks required.
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"`.
11
8
  */
12
9
  export declare const defaultUsersCollection: PostgresCollection;
@@ -1,4 +1,7 @@
1
- import { FindResponse, CollectionAccessor, QueryBuilderInterface, FilterOperator } from "@rebasepro/types";
1
+ import { FindResponse, CollectionAccessor, QueryBuilderInterface, FilterOperator, LogicalCondition, WhereValue, FilterCondition } from "@rebasepro/types";
2
+ export declare function or(...conditions: (FilterCondition | LogicalCondition)[]): LogicalCondition;
3
+ export declare function and(...conditions: (FilterCondition | LogicalCondition)[]): LogicalCondition;
4
+ export declare function cond(column: string, operator: FilterOperator, value: unknown): FilterCondition;
2
5
  export declare class QueryBuilder<M extends Record<string, unknown> = Record<string, unknown>> implements QueryBuilderInterface<M> {
3
6
  private collection;
4
7
  private params;
@@ -8,7 +11,8 @@ export declare class QueryBuilder<M extends Record<string, unknown> = Record<str
8
11
  * @example
9
12
  * client.collection('users').where('age', '>=', 18).find()
10
13
  */
11
- where(column: keyof M & string, operator: FilterOperator, value: unknown): this;
14
+ where<K extends keyof M & string>(column: K, operator: FilterOperator, value: WhereValue<M[K]>): this;
15
+ where(logicalCondition: LogicalCondition): this;
12
16
  /**
13
17
  * Order the results by a specific column.
14
18
  * @example
@@ -92,10 +92,18 @@ export interface LoginViewProps {
92
92
  * If not set, derived from `authController.capabilities.registration`.
93
93
  */
94
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;
95
103
  }
96
104
  /**
97
105
  * Generic login view component that works with any AuthControllerExtended.
98
106
  * Feature-detects capabilities to show/hide login methods.
99
107
  * @group Core
100
108
  */
101
- export declare function LoginView({ logo, authController, noUserComponent, disableSignupScreen, disabled, notAllowedError, googleClientId, githubClientId, linkedinClientId, title, subtitle, needsSetup, registrationEnabled, additionalComponent }: 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,4 +1,4 @@
1
- import type { Property } from "@rebasepro/types";
1
+ import type { Property, Entity } from "@rebasepro/types";
2
2
  import { CollectionSize, SelectedCellProps } from "@rebasepro/types";
3
3
  export type EntityCollectionTableController<M extends Record<string, unknown>> = {
4
4
  /**
@@ -26,7 +26,7 @@ export type EntityCollectionTableController<M extends Record<string, unknown>> =
26
26
  * Callback used when the value of a cell has changed.
27
27
  * @param params
28
28
  */
29
- onValueChange?: (params: OnCellValueChangeParams<unknown, M>) => void;
29
+ onValueChange?: (params: OnCellValueChangeParams<unknown, Entity<M>>) => void;
30
30
  /**
31
31
  * Size of the elements in the collection
32
32
  */
@@ -56,7 +56,7 @@ export type UniqueFieldValidator = (props: {
56
56
  * Callback when a cell has changed in a table
57
57
  * @group Collection components
58
58
  */
59
- export type OnCellValueChange<T, M extends Record<string, unknown>> = (params: OnCellValueChangeParams<T, M>) => Promise<void> | void;
59
+ export type OnCellValueChange<T, M extends Record<string, unknown>> = (params: OnCellValueChangeParams<T, Entity<M>>) => Promise<void> | void;
60
60
  /**
61
61
  * @group Collection components
62
62
  */
@@ -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>;