@rebasepro/types 0.0.1-canary.0 → 0.0.1-canary.0e2f892

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 (104) hide show
  1. package/README.md +1 -1
  2. package/dist/controllers/analytics_controller.d.ts +2 -2
  3. package/dist/controllers/auth.d.ts +52 -6
  4. package/dist/controllers/client.d.ts +170 -0
  5. package/dist/controllers/collection_registry.d.ts +45 -0
  6. package/dist/controllers/customization_controller.d.ts +11 -1
  7. package/dist/controllers/data.d.ts +168 -0
  8. package/dist/controllers/data_driver.d.ts +160 -0
  9. package/dist/controllers/database_admin.d.ts +11 -0
  10. package/dist/controllers/effective_role.d.ts +4 -0
  11. package/dist/controllers/email.d.ts +34 -0
  12. package/dist/controllers/index.d.ts +12 -5
  13. package/dist/controllers/local_config_persistence.d.ts +4 -4
  14. package/dist/controllers/navigation.d.ts +12 -61
  15. package/dist/controllers/registry.d.ts +54 -0
  16. package/dist/controllers/side_entity_controller.d.ts +7 -7
  17. package/dist/controllers/storage.d.ts +24 -26
  18. package/dist/index.d.ts +0 -1
  19. package/dist/index.es.js +119 -14
  20. package/dist/index.es.js.map +1 -1
  21. package/dist/index.umd.js +118 -13
  22. package/dist/index.umd.js.map +1 -1
  23. package/dist/rebase_context.d.ts +40 -26
  24. package/dist/types/backend.d.ts +300 -18
  25. package/dist/types/builders.d.ts +15 -0
  26. package/dist/types/chips.d.ts +1 -1
  27. package/dist/types/collections.d.ts +324 -355
  28. package/dist/types/cron.d.ts +102 -0
  29. package/dist/types/data_source.d.ts +64 -0
  30. package/dist/types/entities.d.ts +29 -24
  31. package/dist/types/entity_actions.d.ts +12 -12
  32. package/dist/types/entity_callbacks.d.ts +12 -12
  33. package/dist/types/entity_link_builder.d.ts +1 -1
  34. package/dist/types/entity_overrides.d.ts +7 -2
  35. package/dist/types/entity_views.d.ts +61 -0
  36. package/dist/types/export_import.d.ts +3 -3
  37. package/dist/types/index.d.ts +9 -5
  38. package/dist/types/plugins.d.ts +228 -225
  39. package/dist/types/properties.d.ts +135 -62
  40. package/dist/types/property_config.d.ts +13 -11
  41. package/dist/types/relations.d.ts +1 -1
  42. package/dist/types/slots.d.ts +252 -0
  43. package/dist/types/translations.d.ts +870 -0
  44. package/dist/types/user_management_delegate.d.ts +43 -0
  45. package/dist/types/websockets.d.ts +45 -0
  46. package/dist/users/user.d.ts +4 -0
  47. package/package.json +99 -131
  48. package/src/controllers/analytics_controller.tsx +2 -2
  49. package/src/controllers/auth.tsx +55 -6
  50. package/src/controllers/client.ts +133 -0
  51. package/src/controllers/collection_registry.ts +57 -0
  52. package/src/controllers/customization_controller.tsx +12 -1
  53. package/src/controllers/data.ts +191 -0
  54. package/src/controllers/{datasource.ts → data_driver.ts} +50 -61
  55. package/src/controllers/database_admin.ts +22 -0
  56. package/src/controllers/effective_role.ts +4 -0
  57. package/src/controllers/email.ts +36 -0
  58. package/src/controllers/index.ts +15 -5
  59. package/src/controllers/local_config_persistence.tsx +4 -4
  60. package/src/controllers/navigation.ts +13 -76
  61. package/src/controllers/registry.ts +65 -0
  62. package/src/controllers/side_entity_controller.tsx +7 -7
  63. package/src/controllers/storage.ts +25 -28
  64. package/src/index.ts +0 -1
  65. package/src/rebase_context.tsx +41 -39
  66. package/src/types/backend.ts +359 -24
  67. package/src/types/builders.ts +17 -0
  68. package/src/types/chips.ts +15 -40
  69. package/src/types/collections.ts +375 -383
  70. package/src/types/cron.ts +149 -0
  71. package/src/types/data_source.ts +145 -0
  72. package/src/types/entities.ts +40 -33
  73. package/src/types/entity_actions.tsx +11 -11
  74. package/src/types/entity_callbacks.ts +12 -12
  75. package/src/types/entity_link_builder.ts +1 -1
  76. package/src/types/entity_overrides.tsx +7 -2
  77. package/src/types/entity_views.tsx +77 -0
  78. package/src/types/export_import.ts +3 -3
  79. package/src/types/index.ts +10 -5
  80. package/src/types/plugins.tsx +280 -261
  81. package/src/types/properties.ts +163 -61
  82. package/src/types/property_config.tsx +11 -11
  83. package/src/types/relations.ts +1 -1
  84. package/src/types/slots.tsx +297 -0
  85. package/src/types/translations.ts +977 -0
  86. package/src/types/user_management_delegate.ts +50 -7
  87. package/src/types/websockets.ts +48 -0
  88. package/src/users/roles.ts +0 -1
  89. package/src/users/user.ts +5 -0
  90. package/dist/components/EntityFormActionsProps.d.ts +0 -17
  91. package/dist/components/EntityFormProps.d.ts +0 -46
  92. package/dist/components/PropertyPreviewProps.d.ts +0 -50
  93. package/dist/components/formex.d.ts +0 -40
  94. package/dist/components/index.d.ts +0 -3
  95. package/dist/controllers/datasource.d.ts +0 -179
  96. package/dist/types/fields.d.ts +0 -221
  97. package/dist/types/rebase.d.ts +0 -180
  98. package/src/components/EntityFormActionsProps.tsx +0 -18
  99. package/src/components/EntityFormProps.tsx +0 -52
  100. package/src/components/PropertyPreviewProps.tsx +0 -61
  101. package/src/components/formex.tsx +0 -46
  102. package/src/components/index.ts +0 -3
  103. package/src/types/fields.tsx +0 -298
  104. package/src/types/rebase.tsx +0 -211
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Cron Job type definitions for Rebase.
3
+ *
4
+ * These types define the shape of cron job definitions, their runtime
5
+ * status, and execution log entries — used across server-core, client,
6
+ * and studio packages.
7
+ */
8
+ /**
9
+ * A cron job definition file exports this shape as its default export.
10
+ * See the example cron files in `app/backend/crons/` for usage.
11
+ */
12
+ export interface CronJobDefinition {
13
+ schedule: string;
14
+ /** Human-readable name shown in the Studio UI. */
15
+ name: string;
16
+ /** Optional description shown in the Studio UI. */
17
+ description?: string;
18
+ /**
19
+ * Whether the job is enabled at startup. Defaults to `true`.
20
+ * Can be toggled at runtime via the Admin API.
21
+ */
22
+ enabled?: boolean;
23
+ /**
24
+ * Maximum number of seconds the handler may run before being
25
+ * considered timed-out. Default: 300 (5 min).
26
+ */
27
+ timeoutSeconds?: number;
28
+ /**
29
+ * The handler function executed on each tick.
30
+ * Receives a context object with the data driver and logger.
31
+ * May return arbitrary JSON-serialisable data stored in the log.
32
+ */
33
+ handler: (ctx: CronJobContext) => Promise<unknown> | unknown;
34
+ }
35
+ import type { RebaseClient } from "../controllers/client";
36
+ /**
37
+ * Context passed to each cron handler invocation.
38
+ */
39
+ export interface CronJobContext {
40
+ /** The job's unique ID (derived from filename). */
41
+ jobId: string;
42
+ /** The current scheduled tick timestamp. */
43
+ scheduledAt: Date;
44
+ /** A simple logger scoped to this job run. */
45
+ log: (...args: unknown[]) => void;
46
+ /** The RebaseClient instance to interact with the database. */
47
+ client: RebaseClient<any>;
48
+ }
49
+ export type CronJobRunState = "idle" | "running" | "success" | "error" | "disabled";
50
+ /**
51
+ * Full runtime information about a registered cron job.
52
+ */
53
+ export interface CronJobStatus {
54
+ /** Unique identifier (derived from filename, e.g. "cleanup-sessions"). */
55
+ id: string;
56
+ /** Human-readable name from the definition. */
57
+ name: string;
58
+ /** Description from the definition. */
59
+ description?: string;
60
+ /** The cron schedule expression. */
61
+ schedule: string;
62
+ /** Whether the job is currently enabled. */
63
+ enabled: boolean;
64
+ /** Current run state. */
65
+ state: CronJobRunState;
66
+ /** ISO timestamp of the last execution start. */
67
+ lastRunAt?: string;
68
+ /** ISO timestamp of the next scheduled execution. */
69
+ nextRunAt?: string;
70
+ /** Duration of the last run in milliseconds. */
71
+ lastDurationMs?: number;
72
+ /** Error message from the last failed run. */
73
+ lastError?: string;
74
+ /** Total number of executions since server start. */
75
+ totalRuns: number;
76
+ /** Total number of failed executions since server start. */
77
+ totalFailures: number;
78
+ }
79
+ export type CronLogLevel = "info" | "error" | "warn";
80
+ /**
81
+ * A single execution log entry stored in the in-memory ring buffer.
82
+ */
83
+ export interface CronJobLogEntry {
84
+ /** The job ID this log belongs to. */
85
+ jobId: string;
86
+ /** ISO timestamp when execution started. */
87
+ startedAt: string;
88
+ /** ISO timestamp when execution finished. */
89
+ finishedAt: string;
90
+ /** Duration in milliseconds. */
91
+ durationMs: number;
92
+ /** Whether this run succeeded. */
93
+ success: boolean;
94
+ /** Error message if the run failed. */
95
+ error?: string;
96
+ /** Arbitrary result data returned by the handler. */
97
+ result?: unknown;
98
+ /** Captured log lines. */
99
+ logs: string[];
100
+ /** Whether this was a manual trigger. */
101
+ manual?: boolean;
102
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Describes the capabilities and features supported by a data source (driver).
3
+ *
4
+ * Each driver (Postgres, Firebase, MongoDB, etc.) declares which features it
5
+ * supports. The CMS uses this descriptor to:
6
+ * - Show/hide editor tabs (e.g. Relations for SQL, Subcollections for Firebase)
7
+ * - Filter the property type picker (e.g. `relation` for SQL, `reference` for Firebase)
8
+ * - Toggle driver-specific form controls (e.g. `columnType` for SQL)
9
+ *
10
+ * @group Models
11
+ */
12
+ export interface DataSourceCapabilities {
13
+ /** Unique driver key (e.g. "postgres", "firestore", "mongodb") */
14
+ key: string;
15
+ /** Human-readable label for the UI (e.g. "PostgreSQL", "Firebase / Firestore") */
16
+ label: string;
17
+ /** Does this source support SQL-style relations (JOINs)? */
18
+ supportsRelations: boolean;
19
+ /** Does this source support nested subcollections? */
20
+ supportsSubcollections: boolean;
21
+ /** Does this source support Row Level Security policies? */
22
+ supportsRLS: boolean;
23
+ /** Does this source support document references (Firebase-style)? */
24
+ supportsReferences: boolean;
25
+ /** Does this source support SQL column type annotations? */
26
+ supportsColumnTypes: boolean;
27
+ /** Does this source support real-time listeners? */
28
+ supportsRealtime: boolean;
29
+ /** Does this source support SQL admin operations (SQL editor, EXPLAIN, etc.)? */
30
+ supportsSQLAdmin: boolean;
31
+ /** Does this source support document admin operations (aggregation, stats)? */
32
+ supportsDocumentAdmin: boolean;
33
+ /** Does this source support schema admin (unmapped tables, table metadata)? */
34
+ supportsSchemaAdmin: boolean;
35
+ }
36
+ /**
37
+ * Subset of DataSourceCapabilities containing only feature flags.
38
+ * Useful when you only need to check capabilities without UI metadata.
39
+ * @group Models
40
+ */
41
+ export type DataSourceFeatures = Omit<DataSourceCapabilities, "key" | "label">;
42
+ /** @group Models */
43
+ export declare const POSTGRES_CAPABILITIES: DataSourceCapabilities;
44
+ /** @group Models */
45
+ export declare const FIREBASE_CAPABILITIES: DataSourceCapabilities;
46
+ /** @group Models */
47
+ export declare const MONGODB_CAPABILITIES: DataSourceCapabilities;
48
+ /**
49
+ * Fallback capabilities when the driver is unknown.
50
+ * Enables everything so nothing is hidden unexpectedly.
51
+ * @group Models
52
+ */
53
+ export declare const DEFAULT_CAPABILITIES: DataSourceCapabilities;
54
+ /**
55
+ * Look up capabilities for a given driver key.
56
+ * If `driver` is undefined or not found, returns `DEFAULT_CAPABILITIES`.
57
+ * @group Models
58
+ */
59
+ export declare function getDataSourceCapabilities(driver?: string): DataSourceCapabilities;
60
+ /**
61
+ * Register custom capabilities for a third-party driver.
62
+ * @group Models
63
+ */
64
+ export declare function registerDataSourceCapabilities(capabilities: DataSourceCapabilities): void;
@@ -4,10 +4,10 @@
4
4
  */
5
5
  export type EntityStatus = "new" | "existing" | "copy";
6
6
  /**
7
- * Representation of an entity fetched from the datasource
7
+ * Representation of an entity fetched from the driver
8
8
  * @group Models
9
9
  */
10
- export interface Entity<M extends object = object> {
10
+ export interface Entity<M extends Record<string, unknown> = Record<string, unknown>> {
11
11
  /**
12
12
  * ID of the entity
13
13
  */
@@ -22,13 +22,13 @@ export interface Entity<M extends object = object> {
22
22
  */
23
23
  values: EntityValues<M>;
24
24
  /**
25
- * Which datasource this entity belongs to (e.g., 'postgres', 'firestore').
26
- * If not specified, the default datasource is assumed.
25
+ * Which driver this entity belongs to (e.g., 'postgres', 'firestore').
26
+ * If not specified, the default driver is assumed.
27
27
  */
28
- datasource?: string;
28
+ driver?: string;
29
29
  /**
30
- * Which database within the datasource (e.g., for Firestore multi-database).
31
- * If not specified, the default database of the datasource is used.
30
+ * Which database within the driver (e.g., for Firestore multi-database).
31
+ * If not specified, the default database of the driver is used.
32
32
  */
33
33
  databaseId?: string;
34
34
  }
@@ -37,7 +37,7 @@ export interface Entity<M extends object = object> {
37
37
  * entity collection.
38
38
  * @group Models
39
39
  */
40
- export type EntityValues<M extends object> = M;
40
+ export type EntityValues<M extends Record<string, unknown>> = M;
41
41
  /**
42
42
  * Props for creating an EntityReference
43
43
  */
@@ -46,23 +46,23 @@ export interface EntityReferenceProps {
46
46
  id: string;
47
47
  /** Path of the collection (relative to the root of the database) */
48
48
  path: string;
49
- /** Which datasource (e.g., 'postgres', 'firestore'). Defaults to "(default)" */
50
- datasource?: string;
51
- /** Which database within the datasource. Defaults to "(default)" */
49
+ /** Which driver (e.g., 'postgres', 'firestore'). Defaults to "(default)" */
50
+ driver?: string;
51
+ /** Which database within the driver. Defaults to "(default)" */
52
52
  databaseId?: string;
53
53
  }
54
54
  /**
55
55
  * Class used to create a reference to an entity in a different path.
56
56
  *
57
57
  * @example
58
- * // Simple reference (most common case - single datasource, single db)
58
+ * // Simple reference (most common case - single driver, single db)
59
59
  * new EntityReference({ id: "123", path: "users" })
60
60
  *
61
- * // Reference to a different datasource (e.g., Firestore)
62
- * new EntityReference({ id: "123", path: "analytics", datasource: "firestore" })
61
+ * // Reference to a different driver (e.g., Firestore)
62
+ * new EntityReference({ id: "123", path: "analytics", driver: "firestore" })
63
63
  *
64
- * // Reference to a specific database within a datasource
65
- * new EntityReference({ id: "123", path: "orders", datasource: "postgres", databaseId: "orders_db" })
64
+ * // Reference to a specific database within a driver
65
+ * new EntityReference({ id: "123", path: "orders", driver: "postgres", databaseId: "orders_db" })
66
66
  */
67
67
  export declare class EntityReference {
68
68
  readonly __type = "reference";
@@ -76,12 +76,12 @@ export declare class EntityReference {
76
76
  */
77
77
  readonly path: string;
78
78
  /**
79
- * Which datasource (e.g., 'postgres', 'firestore').
79
+ * Which driver (e.g., 'postgres', 'firestore').
80
80
  * Defaults to "(default)" if not specified.
81
81
  */
82
- readonly datasource?: string;
82
+ readonly driver?: string;
83
83
  /**
84
- * Which database within the datasource.
84
+ * Which database within the driver.
85
85
  * Defaults to "(default)" if not specified.
86
86
  */
87
87
  readonly databaseId?: string;
@@ -92,14 +92,14 @@ export declare class EntityReference {
92
92
  * // Simple reference (most common case)
93
93
  * new EntityReference({ id: "123", path: "users" })
94
94
  *
95
- * // With datasource
96
- * new EntityReference({ id: "123", path: "analytics", datasource: "firestore" })
95
+ * // With driver
96
+ * new EntityReference({ id: "123", path: "analytics", driver: "firestore" })
97
97
  */
98
98
  constructor(props: EntityReferenceProps);
99
99
  get pathWithId(): string;
100
100
  /**
101
- * Get the full path including datasource and database prefixes if specified.
102
- * For the common case (single datasource, single db), this just returns pathWithId.
101
+ * Get the full path including driver and database prefixes if specified.
102
+ * For the common case (single driver, single db), this just returns pathWithId.
103
103
  */
104
104
  get fullPath(): string;
105
105
  isEntityReference(): boolean;
@@ -118,7 +118,12 @@ export declare class EntityRelation {
118
118
  * to the root of the database).
119
119
  */
120
120
  readonly path: string;
121
- constructor(id: string | number, path: string);
121
+ /**
122
+ * Pre-fetched data payload to eliminate N+1 queries.
123
+ * When present, clients can use this directly instead of fetching.
124
+ */
125
+ readonly data?: Entity;
126
+ constructor(id: string | number, path: string, data?: Entity);
122
127
  get pathWithId(): string;
123
128
  isEntityReference(): boolean;
124
129
  isEntityRelation(): boolean;
@@ -1,15 +1,15 @@
1
1
  import React from "react";
2
- import { Entity } from "./entities";
3
- import { EntityCollection, SelectionController } from "./collections";
4
- import { FormContext } from "./fields";
5
- import { User } from "../users";
6
- import { RebaseContext } from "../rebase_context";
7
- import { SideEntityController } from "../controllers";
2
+ import type { Entity } from "./entities";
3
+ import type { EntityCollection, SelectionController } from "./collections";
4
+ import type { FormContext } from "./entity_views";
5
+ import type { User } from "../users";
6
+ import type { RebaseContext } from "../rebase_context";
7
+ import type { SideEntityController } from "../controllers/side_entity_controller";
8
8
  /**
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, USER extends User = User> = {
12
+ export interface EntityAction<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> {
13
13
  /**
14
14
  * Title of the action
15
15
  */
@@ -34,12 +34,12 @@ export type EntityAction<M extends object = any, USER extends User = User> = {
34
34
  * Callback when the action is clicked
35
35
  * @param props
36
36
  */
37
- onClick: (props: EntityActionClickProps<M, USER>) => Promise<void> | void;
37
+ onClick(props: EntityActionClickProps<M, USER>): Promise<void> | void;
38
38
  /**
39
39
  * Optional callback in case you want to disable the action
40
40
  * @param props
41
41
  */
42
- isEnabled?: (props: EntityActionClickProps<M, USER>) => boolean;
42
+ isEnabled?(props: EntityActionClickProps<M, USER>): boolean;
43
43
  /**
44
44
  * Show this action collapsed in the menu of the collection view.
45
45
  * Defaults to true
@@ -50,8 +50,8 @@ export type EntityAction<M extends object = any, USER extends User = User> = {
50
50
  * Show this action in the form, defaults to true
51
51
  */
52
52
  includeInForm?: boolean;
53
- };
54
- export type EntityActionClickProps<M extends object, USER extends User = User> = {
53
+ }
54
+ export type EntityActionClickProps<M extends Record<string, unknown>, USER extends User = User> = {
55
55
  entity?: Entity<M>;
56
56
  context: RebaseContext<USER>;
57
57
  path?: string;
@@ -72,7 +72,7 @@ export type EntityActionClickProps<M extends object, USER extends User = User> =
72
72
  /**
73
73
  * If the action is rendered in the form, is it open in a side panel or full screen?
74
74
  */
75
- openEntityMode: "side_panel" | "full_screen";
75
+ openEntityMode: "side_panel" | "full_screen" | "split";
76
76
  /**
77
77
  * Optional selection controller, present if the action is being called from a collection view
78
78
  */
@@ -1,14 +1,14 @@
1
- import { EntityCollection } from "./collections";
2
- import { Entity, EntityStatus, EntityValues } from "./entities";
3
- import { User } from "../users";
4
- import { RebaseCallContext } from "../rebase_context";
1
+ import type { EntityCollection } from "./collections";
2
+ import type { Entity, EntityStatus, EntityValues } from "./entities";
3
+ import type { User } from "../users";
4
+ import type { RebaseCallContext } from "../rebase_context";
5
5
  /**
6
6
  * This interface defines all the callbacks that can be used when an entity
7
7
  * is being created, updated or deleted.
8
8
  * Useful for adding your own logic or blocking the execution of the operation.
9
9
  * @group Models
10
10
  */
11
- export type EntityCallbacks<M extends Record<string, any> = any, USER extends User = User> = {
11
+ export type EntityCallbacks<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> = {
12
12
  /**
13
13
  * Callback used after fetching data
14
14
  * @param props
@@ -51,11 +51,11 @@ export type EntityCallbacks<M extends Record<string, any> = any, USER extends Us
51
51
  * Parameters passed to hooks when an entity is fetched
52
52
  * @group Models
53
53
  */
54
- export interface EntityAfterReadProps<M extends Record<string, any> = any, USER extends User = User> {
54
+ export interface EntityAfterReadProps<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> {
55
55
  /**
56
56
  * Collection of the entity
57
57
  */
58
- collection: EntityCollection<M, USER>;
58
+ collection: EntityCollection<M>;
59
59
  /**
60
60
  * Full path of the CMS where this collection is being fetched.
61
61
  * Might contain unresolved aliases.
@@ -74,21 +74,21 @@ export interface EntityAfterReadProps<M extends Record<string, any> = any, USER
74
74
  * Parameters passed to hooks before an entity is saved
75
75
  * @group Models
76
76
  */
77
- export type EntityBeforeSaveProps<M extends Record<string, any> = any, USER extends User = User> = Omit<EntityAfterSaveProps<M, USER>, "entityId"> & {
77
+ export type EntityBeforeSaveProps<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> = Omit<EntityAfterSaveProps<M, USER>, "entityId"> & {
78
78
  entityId?: string | number;
79
79
  };
80
80
  /**
81
81
  * Parameters passed to hooks before an entity is saved
82
82
  * @group Models
83
83
  */
84
- export type EntityAfterSaveErrorProps<M extends Record<string, any> = any, USER extends User = User> = Omit<EntityAfterSaveProps<M, USER>, "entityId"> & {
84
+ export type EntityAfterSaveErrorProps<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> = Omit<EntityAfterSaveProps<M, USER>, "entityId"> & {
85
85
  entityId?: string | number;
86
86
  };
87
87
  /**
88
88
  * Parameters passed to hooks when an entity is saved
89
89
  * @group Models
90
90
  */
91
- export interface EntityAfterSaveProps<M extends Record<string, any> = any, USER extends User = User> {
91
+ export interface EntityAfterSaveProps<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> {
92
92
  /**
93
93
  * Resolved collection of the entity
94
94
  */
@@ -123,7 +123,7 @@ export interface EntityAfterSaveProps<M extends Record<string, any> = any, USER
123
123
  * Parameters passed to hooks when an entity is deleted
124
124
  * @group Models
125
125
  */
126
- export interface EntityBeforeDeleteProps<M extends Record<string, any> = any, USER extends User = User> {
126
+ export interface EntityBeforeDeleteProps<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> {
127
127
  /**
128
128
  * collection of the entity being deleted
129
129
  */
@@ -149,7 +149,7 @@ export interface EntityBeforeDeleteProps<M extends Record<string, any> = any, US
149
149
  * Parameters passed to hooks after an entity is deleted
150
150
  * @group Models
151
151
  */
152
- export interface EntityAfterDeleteProps<M extends Record<string, any> = any, USER extends User = User> {
152
+ export interface EntityAfterDeleteProps<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> {
153
153
  /**
154
154
  * collection of the entity being deleted
155
155
  */
@@ -2,6 +2,6 @@ import { Entity } from "./entities";
2
2
  /**
3
3
  * @group Models
4
4
  */
5
- export type EntityLinkBuilder<M extends Record<string, any> = any> = ({ entity }: {
5
+ export type EntityLinkBuilder<M extends Record<string, unknown> = Record<string, unknown>> = ({ entity }: {
6
6
  entity: Entity<M>;
7
7
  }) => string;
@@ -1,5 +1,10 @@
1
- import { DataSource, StorageSource } from "../controllers";
1
+ import type { DataDriver } from "../controllers/data_driver";
2
+ import type { StorageSource } from "../controllers/storage";
2
3
  export type EntityOverrides = {
3
- dataSource?: DataSource;
4
+ /**
5
+ * Internal driver override for this collection.
6
+ * Used by the CMS engine to route data operations.
7
+ */
8
+ driver?: DataDriver;
4
9
  storageSource?: StorageSource;
5
10
  };
@@ -0,0 +1,61 @@
1
+ import React from "react";
2
+ import type { Entity, EntityValues } from "./entities";
3
+ import type { EntityCollection } from "./collections";
4
+ /**
5
+ * Context passed to custom fields and entity views.
6
+ * This is the base definition — `@rebasepro/admin` re-exports a
7
+ * fully-typed version that narrows the `formex` field.
8
+ * @group Form custom fields
9
+ */
10
+ export interface FormContext<M extends Record<string, unknown> = Record<string, unknown>> {
11
+ /**
12
+ * Current values of the entity
13
+ */
14
+ values: M;
15
+ /**
16
+ * Update the value of a field
17
+ */
18
+ setFieldValue: (key: string, value: unknown, shouldValidate?: boolean) => void;
19
+ /**
20
+ * Save the entity.
21
+ */
22
+ save: (values: M) => void;
23
+ /**
24
+ * Collection of the entity being modified
25
+ */
26
+ collection?: EntityCollection<M>;
27
+ /**
28
+ * Entity id, it can be undefined if it's a new entity
29
+ */
30
+ entityId?: string | number;
31
+ /**
32
+ * Path this entity is located at
33
+ */
34
+ path?: string;
35
+ status: "new" | "existing" | "copy";
36
+ entity?: Entity<M>;
37
+ savingError?: Error;
38
+ openEntityMode: "side_panel" | "full_screen" | "split";
39
+ /**
40
+ * The underlying formex controller that powers the form.
41
+ * Prefer importing `FormContext` from `@rebasepro/admin` for the
42
+ * fully-typed `FormexController<M>` version.
43
+ */
44
+ formex: Record<string, unknown>;
45
+ disabled: boolean;
46
+ }
47
+ export type EntityCustomView<M extends Record<string, unknown> = Record<string, unknown>> = {
48
+ key: string;
49
+ name: string;
50
+ tabComponent?: React.ReactNode;
51
+ includeActions?: boolean | "bottom";
52
+ Builder?: React.ComponentType<EntityCustomViewParams<M>>;
53
+ position?: "start" | "end";
54
+ };
55
+ export interface EntityCustomViewParams<M extends Record<string, unknown> = Record<string, unknown>> {
56
+ collection: EntityCollection<M>;
57
+ entity?: Entity<M>;
58
+ modifiedValues?: EntityValues<M>;
59
+ formContext: FormContext<M>;
60
+ parentCollectionIds?: string[];
61
+ }
@@ -1,6 +1,6 @@
1
- import { Entity } from "./entities";
2
- import { User } from "../users";
3
- import { RebaseContext } from "../rebase_context";
1
+ import type { Entity } from "./entities";
2
+ import type { User } from "../users";
3
+ import type { RebaseContext } from "../rebase_context";
4
4
  /**
5
5
  * You can use this configuration to add additional fields to the data
6
6
  * exports
@@ -1,19 +1,23 @@
1
1
  export * from "./entities";
2
2
  export * from "./chips";
3
- export * from "./entity_actions";
4
3
  export * from "./properties";
5
4
  export * from "./collections";
6
5
  export * from "./relations";
7
6
  export * from "./locales";
8
- export * from "./fields";
9
- export * from "./property_config";
10
7
  export * from "./entity_link_builder";
11
8
  export * from "./user_management_delegate";
12
9
  export * from "./entity_callbacks";
13
10
  export * from "./entity_overrides";
14
- export * from "./plugins";
15
- export * from "./rebase";
16
11
  export * from "./export_import";
17
12
  export * from "./modify_collections";
18
13
  export * from "./websockets";
19
14
  export * from "./backend";
15
+ export * from "./translations";
16
+ export * from "./plugins";
17
+ export * from "./builders";
18
+ export * from "./slots";
19
+ export * from "./entity_actions";
20
+ export * from "./property_config";
21
+ export * from "./entity_views";
22
+ export * from "./data_source";
23
+ export * from "./cron";