@rebasepro/types 0.1.0 → 0.2.1

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 (88) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +178 -110
  3. package/dist/controllers/auth.d.ts +9 -8
  4. package/dist/controllers/client.d.ts +3 -0
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/types/auth_adapter.d.ts +356 -0
  8. package/dist/types/collections.d.ts +67 -2
  9. package/dist/types/database_adapter.d.ts +94 -0
  10. package/dist/types/entity_actions.d.ts +7 -1
  11. package/dist/types/entity_callbacks.d.ts +1 -1
  12. package/dist/types/entity_views.d.ts +36 -1
  13. package/dist/types/index.d.ts +2 -0
  14. package/dist/types/plugins.d.ts +1 -1
  15. package/dist/types/properties.d.ts +24 -5
  16. package/dist/types/property_config.d.ts +6 -2
  17. package/dist/types/relations.d.ts +1 -1
  18. package/dist/types/translations.d.ts +8 -0
  19. package/dist/users/user.d.ts +5 -0
  20. package/package.json +13 -10
  21. package/src/controllers/analytics_controller.d.ts +7 -0
  22. package/src/controllers/auth.d.ts +125 -0
  23. package/src/controllers/auth.tsx +2 -5
  24. package/src/controllers/client.d.ts +183 -0
  25. package/src/controllers/client.ts +3 -2
  26. package/src/controllers/collection_registry.d.ts +46 -0
  27. package/src/controllers/customization_controller.d.ts +60 -0
  28. package/src/controllers/data.d.ts +168 -0
  29. package/src/controllers/data_driver.d.ts +195 -0
  30. package/src/controllers/database_admin.d.ts +11 -0
  31. package/src/controllers/dialogs_controller.d.ts +36 -0
  32. package/src/controllers/effective_role.d.ts +4 -0
  33. package/src/controllers/email.d.ts +34 -0
  34. package/src/controllers/index.d.ts +18 -0
  35. package/src/controllers/local_config_persistence.d.ts +20 -0
  36. package/src/controllers/navigation.d.ts +225 -0
  37. package/src/controllers/registry.d.ts +62 -0
  38. package/src/controllers/side_dialogs_controller.d.ts +67 -0
  39. package/src/controllers/side_entity_controller.d.ts +97 -0
  40. package/src/controllers/snackbar.d.ts +24 -0
  41. package/src/controllers/storage.d.ts +171 -0
  42. package/src/index.d.ts +4 -0
  43. package/src/rebase_context.d.ts +122 -0
  44. package/src/types/auth_adapter.d.ts +354 -0
  45. package/src/types/auth_adapter.ts +410 -0
  46. package/src/types/backend.d.ts +536 -0
  47. package/src/types/backend_hooks.d.ts +187 -0
  48. package/src/types/builders.d.ts +15 -0
  49. package/src/types/chips.d.ts +5 -0
  50. package/src/types/collections.d.ts +920 -0
  51. package/src/types/collections.ts +77 -2
  52. package/src/types/component_ref.d.ts +47 -0
  53. package/src/types/cron.d.ts +102 -0
  54. package/src/types/data_source.d.ts +64 -0
  55. package/src/types/database_adapter.d.ts +90 -0
  56. package/src/types/database_adapter.ts +120 -0
  57. package/src/types/entities.d.ts +145 -0
  58. package/src/types/entity_actions.d.ts +98 -0
  59. package/src/types/entity_actions.tsx +8 -1
  60. package/src/types/entity_callbacks.d.ts +173 -0
  61. package/src/types/entity_callbacks.ts +1 -1
  62. package/src/types/entity_link_builder.d.ts +7 -0
  63. package/src/types/entity_overrides.d.ts +10 -0
  64. package/src/types/entity_views.d.ts +60 -0
  65. package/src/types/entity_views.tsx +39 -1
  66. package/src/types/export_import.d.ts +21 -0
  67. package/src/types/formex.d.ts +40 -0
  68. package/src/types/index.d.ts +28 -0
  69. package/src/types/index.ts +2 -0
  70. package/src/types/locales.d.ts +4 -0
  71. package/src/types/modify_collections.d.ts +5 -0
  72. package/src/types/plugins.d.ts +282 -0
  73. package/src/types/plugins.tsx +1 -1
  74. package/src/types/properties.d.ts +1160 -0
  75. package/src/types/properties.ts +34 -4
  76. package/src/types/property_config.d.ts +70 -0
  77. package/src/types/property_config.tsx +6 -3
  78. package/src/types/relations.d.ts +336 -0
  79. package/src/types/relations.ts +1 -1
  80. package/src/types/slots.d.ts +262 -0
  81. package/src/types/translations.d.ts +882 -0
  82. package/src/types/translations.ts +11 -0
  83. package/src/types/user_management_delegate.d.ts +121 -0
  84. package/src/types/websockets.d.ts +78 -0
  85. package/src/users/index.d.ts +2 -0
  86. package/src/users/roles.d.ts +22 -0
  87. package/src/users/user.d.ts +46 -0
  88. package/src/users/user.ts +6 -0
@@ -1,5 +1,5 @@
1
1
  import type { ComponentRef } from "./component_ref";
2
- import type { EntityReference, EntityRelation, EntityValues, GeoPoint, Entity } from "./entities";
2
+ import type { EntityReference, EntityRelation, EntityValues, GeoPoint, Entity, Vector } from "./entities";
3
3
  import type { Relation, JoinStep, OnAction } from "./relations";
4
4
  import type { EntityCollection, FilterValues } from "./collections";
5
5
  import type { ColorKey, ColorScheme } from "./chips";
@@ -31,8 +31,8 @@ export type PropertyCallbacks<T = unknown, M extends Record<string, unknown> = R
31
31
  /**
32
32
  * @group Entity properties
33
33
  */
34
- export type DataType = "string" | "number" | "boolean" | "date" | "geopoint" | "reference" | "relation" | "array" | "map";
35
- export type Property = StringProperty | NumberProperty | BooleanProperty | DateProperty | GeopointProperty | ReferenceProperty | RelationProperty | ArrayProperty | MapProperty;
34
+ export type DataType = "string" | "number" | "boolean" | "date" | "geopoint" | "reference" | "relation" | "array" | "map" | "vector" | "binary";
35
+ export type Property = StringProperty | NumberProperty | BooleanProperty | DateProperty | GeopointProperty | ReferenceProperty | RelationProperty | ArrayProperty | MapProperty | VectorProperty | BinaryProperty;
36
36
  export type Properties = {
37
37
  [key: string]: Property;
38
38
  };
@@ -48,7 +48,7 @@ export type FirebaseProperties = {
48
48
  * A helper type to infer the underlying data type from a Property definition.
49
49
  * This is the core of the type inference system.
50
50
  */
51
- export type InferPropertyType<P extends Property> = P extends StringProperty ? string : P extends NumberProperty ? number : P extends BooleanProperty ? boolean : P extends DateProperty ? Date : P extends GeopointProperty ? GeoPoint : P extends ReferenceProperty ? EntityReference : P extends RelationProperty ? EntityRelation | EntityRelation[] : P extends ArrayProperty ? (P["of"] extends Property ? InferPropertyType<P["of"]>[] : unknown[]) : P extends MapProperty ? (P["properties"] extends Properties ? InferEntityType<P["properties"]> : Record<string, unknown>) : never;
51
+ export type InferPropertyType<P extends Property> = P extends StringProperty ? string : P extends NumberProperty ? number : P extends BooleanProperty ? boolean : P extends DateProperty ? Date : P extends GeopointProperty ? GeoPoint : P extends ReferenceProperty ? EntityReference : P extends RelationProperty ? EntityRelation | EntityRelation[] : P extends ArrayProperty ? (P["of"] extends Property ? InferPropertyType<P["of"]>[] : unknown[]) : P extends MapProperty ? (P["properties"] extends Properties ? InferEntityType<P["properties"]> : Record<string, unknown>) : P extends VectorProperty ? Vector : P extends BinaryProperty ? string : never;
52
52
  /**
53
53
  * Helper type that determines whether a property is required.
54
54
  * Uses direct structural matching against `{ validation: { required: true } }`
@@ -309,6 +309,25 @@ export interface BooleanProperty extends BaseProperty {
309
309
  */
310
310
  validation?: PropertyValidationSchema;
311
311
  }
312
+ /**
313
+ * @group Entity properties
314
+ */
315
+ export interface VectorUIConfig extends BaseUIConfig {
316
+ clearable?: boolean;
317
+ }
318
+ export interface VectorProperty extends BaseProperty {
319
+ ui?: VectorUIConfig;
320
+ type: "vector";
321
+ dimensions: number;
322
+ validation?: PropertyValidationSchema;
323
+ }
324
+ /**
325
+ * @group Entity properties
326
+ */
327
+ export interface BinaryProperty extends BaseProperty {
328
+ type: "binary";
329
+ validation?: PropertyValidationSchema;
330
+ }
312
331
  /**
313
332
  * @group Entity properties
314
333
  */
@@ -421,7 +440,7 @@ export interface RelationProperty extends BaseProperty {
421
440
  * When set, the framework treats this property as a self-contained relation
422
441
  * definition and no separate `relations[]` entry is needed.
423
442
  */
424
- target?: () => EntityCollection;
443
+ target?: string | (() => EntityCollection | string);
425
444
  /**
426
445
  * Whether this property references one or many records.
427
446
  * Defaults to `"one"`.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { ArrayProperty, MapProperty, StringProperty, NumberProperty, BooleanProperty, DateProperty, GeopointProperty, ReferenceProperty, RelationProperty } from "./properties";
2
+ import { ArrayProperty, MapProperty, StringProperty, NumberProperty, BooleanProperty, DateProperty, GeopointProperty, ReferenceProperty, RelationProperty, VectorProperty, BinaryProperty } from "./properties";
3
3
  import { BaseProperty } from "./properties";
4
4
  type CMSBasePropertyNoName = Omit<BaseProperty, "name">;
5
5
  export type ConfigProperty = (Omit<StringProperty, "name"> & {
@@ -28,6 +28,10 @@ export type ConfigProperty = (Omit<StringProperty, "name"> & {
28
28
  } & CMSBasePropertyNoName) | (Omit<MapProperty, "name" | "properties"> & {
29
29
  name?: string;
30
30
  properties?: Record<string, ConfigProperty>;
31
+ } & CMSBasePropertyNoName) | (Omit<VectorProperty, "name"> & {
32
+ name?: string;
33
+ } & CMSBasePropertyNoName) | (Omit<BinaryProperty, "name"> & {
34
+ name?: string;
31
35
  } & CMSBasePropertyNoName);
32
36
  /**
33
37
  * This is the configuration object for a property.
@@ -66,5 +70,5 @@ export type PropertyConfig = {
66
70
  */
67
71
  description?: string;
68
72
  };
69
- export type PropertyConfigId = "text_field" | "multiline" | "markdown" | "url" | "email" | "user_select" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "reference" | "reference_as_string" | "multi_references" | "relation" | "switch" | "date_time" | "repeat" | "custom_array" | "block";
73
+ export type PropertyConfigId = "text_field" | "multiline" | "markdown" | "url" | "email" | "user_select" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "reference" | "reference_as_string" | "multi_references" | "relation" | "switch" | "date_time" | "repeat" | "custom_array" | "block" | "vector_input";
70
74
  export {};
@@ -17,7 +17,7 @@ export interface Relation {
17
17
  /**
18
18
  * The final collection you want to retrieve records from.
19
19
  */
20
- target: () => EntityCollection;
20
+ target: (() => EntityCollection) | any;
21
21
  /**
22
22
  * The nature of the relationship, determining if one or many records are returned.
23
23
  */
@@ -30,6 +30,8 @@ export interface RebaseTranslations {
30
30
  copy: string;
31
31
  delete: string;
32
32
  delete_not_allowed: string;
33
+ edit_entity?: string;
34
+ back_to_detail?: string;
33
35
  delete_confirmation_title: string;
34
36
  delete_confirmation_body: string;
35
37
  delete_multiple_confirmation_body: string;
@@ -392,6 +394,12 @@ export interface RebaseTranslations {
392
394
  submit: string;
393
395
  no_filterable_properties: string;
394
396
  apply_filters: string;
397
+ /** Label shown on the filter presets dropdown trigger */
398
+ filter_presets?: string;
399
+ /** Tooltip shown when hovering over a preset entry */
400
+ filter_preset_apply?: string;
401
+ /** Shown when a preset is active, with {{label}} interpolation */
402
+ filter_preset_active?: string;
395
403
  list: string;
396
404
  table_view_mode: string;
397
405
  cards: string;
@@ -42,5 +42,10 @@ export type User = {
42
42
  * The date and time when the user was created.
43
43
  */
44
44
  createdAt?: Date | string | null;
45
+ /**
46
+ * Additional metadata/custom claims associated with the user.
47
+ * Accessible by the frontend, but only writable by the backend.
48
+ */
49
+ readonly metadata?: Record<string, any>;
45
50
  getIdToken?: (forceRefresh?: boolean) => Promise<string>;
46
51
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/types",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.2.1",
5
5
  "description": "Rebase type definitions — shared interfaces and controller types",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/rebaseco"
@@ -32,7 +32,7 @@
32
32
  "exports": {
33
33
  ".": {
34
34
  "types": "./dist/index.d.ts",
35
- "development": "./src/index.ts",
35
+ "development": "./dist/index.es.js",
36
36
  "import": "./dist/index.es.js",
37
37
  "require": "./dist/index.umd.js"
38
38
  },
@@ -40,17 +40,20 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/jest": "^29.5.14",
43
- "@types/node": "^20.17.14",
43
+ "@types/node": "^20.19.41",
44
44
  "@types/object-hash": "^3.0.6",
45
- "@types/react": "^19.0.8",
46
- "@types/react-dom": "^19.0.3",
45
+ "@types/react": "^19.2.15",
46
+ "@types/react-dom": "^19.2.3",
47
47
  "@types/react-measure": "^2.0.12",
48
- "@vitejs/plugin-react": "^4.3.4",
49
- "eslint-plugin-react-compiler": "beta",
48
+ "@vitejs/plugin-react": "^4.7.0",
49
+ "hono": "^4.12.21",
50
50
  "jest": "^29.7.0",
51
- "ts-jest": "^29.3.1",
52
- "typescript": "^5.8.3",
53
- "vite": "^5.4.17"
51
+ "ts-jest": "^29.4.10",
52
+ "typescript": "^5.9.3",
53
+ "vite": "^5.4.21"
54
+ },
55
+ "peerDependencies": {
56
+ "hono": "^4.12.21"
54
57
  },
55
58
  "files": [
56
59
  "dist",
@@ -0,0 +1,7 @@
1
+ export type AnalyticsController = {
2
+ /**
3
+ * Callback used to get analytics events from the CMS
4
+ */
5
+ onAnalyticsEvent?: (event: AnalyticsEvent, data?: object) => void;
6
+ };
7
+ export type AnalyticsEvent = "entity_click" | "entity_click_from_reference" | "reference_selection_clear" | "reference_selection_toggle" | "reference_selected_single" | "reference_selection_new_entity" | "edit_entity_clicked" | "entity_edited" | "new_entity_click" | "new_entity_saved" | "copy_entity_click" | "entity_copied" | "single_delete_dialog_open" | "multiple_delete_dialog_open" | "single_entity_deleted" | "multiple_entities_deleted" | "drawer_navigate_to_home" | "drawer_navigate_to_collection" | "drawer_navigate_to_view" | "home_navigate_to_collection" | "home_favorite_navigate_to_collection" | "home_navigate_to_view" | "home_navigate_to_admin_view" | "home_favorite_navigate_to_view" | "home_move_card" | "home_move_group" | "home_drop_new_group" | "collection_inline_editing" | "view_mode_changed" | "kanban_card_moved" | "kanban_column_reorder" | "kanban_property_changed" | "kanban_new_entity_in_column" | "kanban_backfill_order" | "card_view_entity_click" | "unmapped_event";
@@ -0,0 +1,125 @@
1
+ import { StorageSource } from "./storage";
2
+ import { Role, User } from "../users";
3
+ import { RebaseData } from "./data";
4
+ /**
5
+ * Capabilities advertised by an auth provider.
6
+ * UI components use this to show/hide features dynamically
7
+ * (e.g. password reset, registration, session management).
8
+ * @group Hooks and utilities
9
+ */
10
+ export interface AuthCapabilities {
11
+ emailPasswordLogin?: boolean;
12
+ googleLogin?: boolean;
13
+ registration?: boolean;
14
+ passwordReset?: boolean;
15
+ sessionManagement?: boolean;
16
+ profileUpdate?: boolean;
17
+ emailVerification?: boolean;
18
+ /** List of enabled OAuth provider IDs (e.g. ["google", "github", "discord"]) */
19
+ enabledProviders?: string[];
20
+ }
21
+ /**
22
+ * Controller for retrieving the logged user or performing auth related operations.
23
+ * Note that if you are implementing your AuthController, you probably will want
24
+ * to do it as the result of a hook.
25
+ * @group Hooks and utilities
26
+ */
27
+ export type AuthController<USER extends User = User, ExtraData = unknown> = {
28
+ /**
29
+ * The user currently logged in
30
+ * The values can be: the user object, null if they skipped login
31
+ */
32
+ user: USER | null;
33
+ /**
34
+ * Initial loading flag. It is used not to display the login screen
35
+ * when the app first loads, and it has not been checked whether the user
36
+ * is logged in or not.
37
+ */
38
+ initialLoading?: boolean;
39
+ /**
40
+ * Loading flag. It is used to display a loading screen when the user is
41
+ * logging in or out.
42
+ */
43
+ authLoading: boolean;
44
+ /**
45
+ * Sign out
46
+ */
47
+ signOut: () => Promise<void>;
48
+ /**
49
+ * Error initializing the authentication
50
+ */
51
+ authError?: unknown;
52
+ /**
53
+ * Error dispatched by the auth provider
54
+ */
55
+ authProviderError?: unknown;
56
+ /**
57
+ * You can use this method to retrieve the auth token for the current user.
58
+ */
59
+ getAuthToken: () => Promise<string>;
60
+ /**
61
+ * Has the user skipped the login process
62
+ */
63
+ loginSkipped: boolean;
64
+ extra: ExtraData;
65
+ setExtra: (extra: ExtraData) => void;
66
+ setUser?(user: USER | null): void;
67
+ setUserRoles?(roles: Role[]): void;
68
+ /**
69
+ * Capabilities advertised by the auth provider.
70
+ * UI components use this to feature-detect what the backend supports.
71
+ */
72
+ capabilities?: AuthCapabilities;
73
+ };
74
+ /**
75
+ * Extended auth controller with common optional auth methods.
76
+ * Backend implementations (Rebase backend, Firebase, Supabase, etc.)
77
+ * extend this with their own backend-specific extras.
78
+ * @group Hooks and utilities
79
+ */
80
+ export interface AuthControllerExtended<USER extends User = User, ExtraData = unknown> extends AuthController<USER, ExtraData> {
81
+ /** Login with email and password */
82
+ emailPasswordLogin?(email: string, password: string): Promise<void>;
83
+ /** Login with a Google token or authorization code */
84
+ googleLogin?: {
85
+ (token: string, tokenType?: "idToken" | "accessToken"): Promise<void>;
86
+ (payload: {
87
+ code: string;
88
+ redirectUri: string;
89
+ }): Promise<void>;
90
+ };
91
+ /** Register a new user */
92
+ register?(email: string, password: string, displayName?: string): Promise<void>;
93
+ /** Skip login (for anonymous access if enabled) */
94
+ skipLogin?(): void;
95
+ /** Request password reset email */
96
+ forgotPassword?(email: string): Promise<void>;
97
+ /** Reset password using a token */
98
+ resetPassword?(token: string, password: string): Promise<void>;
99
+ /** Change password for the authenticated user */
100
+ changePassword?(oldPassword: string, newPassword: string): Promise<void>;
101
+ /** Update user profile */
102
+ updateProfile?(displayName?: string, photoURL?: string): Promise<USER>;
103
+ }
104
+ /**
105
+ * Implement this function to allow access to specific users.
106
+ * @group Hooks and utilities
107
+ */
108
+ export type Authenticator<USER extends User = User> = (props: {
109
+ /**
110
+ * Logged-in user or null
111
+ */
112
+ user: USER | null;
113
+ /**
114
+ * AuthController
115
+ */
116
+ authController: AuthController<USER>;
117
+ /**
118
+ * Unified data access API
119
+ */
120
+ data: RebaseData;
121
+ /**
122
+ * Used storage implementation
123
+ */
124
+ storageSource: StorageSource;
125
+ }) => boolean | Promise<boolean>;
@@ -98,11 +98,8 @@ export type AuthController<USER extends User = User, ExtraData = unknown> = {
98
98
  export interface AuthControllerExtended<USER extends User = User, ExtraData = unknown> extends AuthController<USER, ExtraData> {
99
99
  /** Login with email and password */
100
100
  emailPasswordLogin?(email: string, password: string): Promise<void>;
101
- /** Login with a Google token or authorization code */
102
- googleLogin?: {
103
- (token: string, tokenType?: "idToken" | "accessToken"): Promise<void>;
104
- (payload: { code: string; redirectUri: string }): Promise<void>;
105
- };
101
+ /** Login with Google — accepts an ID token, access token, or authorization code payload */
102
+ googleLogin?: (payload: { idToken: string } | { accessToken: string } | { code: string; redirectUri: string }) => Promise<void>;
106
103
  /** Register a new user */
107
104
  register?(email: string, password: string, displayName?: string): Promise<void>;
108
105
  /** Skip login (for anonymous access if enabled) */
@@ -0,0 +1,183 @@
1
+ import { User } from "../users";
2
+ import { RebaseData } from "./data";
3
+ import { EmailService } from "./email";
4
+ /**
5
+ * Event type for authentication state changes
6
+ */
7
+ export type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "USER_UPDATED";
8
+ /**
9
+ * Standard session interface representing an authenticated state
10
+ */
11
+ export interface RebaseSession {
12
+ accessToken: string;
13
+ refreshToken: string;
14
+ expiresAt: number;
15
+ user: User;
16
+ }
17
+ import { StorageSource } from "./storage";
18
+ /**
19
+ * Unified Authentication Client Interface
20
+ * Pure functional SDK interface, decoupled from UI and React hooks
21
+ */
22
+ export interface AuthClient {
23
+ /**
24
+ * Get the current user from the server or cache
25
+ */
26
+ getUser(): Promise<User | null>;
27
+ /**
28
+ * Get the currently active session
29
+ */
30
+ getSession(): RebaseSession | null;
31
+ /**
32
+ * Sign out the current user and clear local session
33
+ */
34
+ signOut(): Promise<void>;
35
+ /**
36
+ * Subscribe to authentication state changes
37
+ */
38
+ onAuthStateChange(callback: (event: AuthChangeEvent, session: RebaseSession | null) => void): () => void;
39
+ /**
40
+ * Manually refresh the session token
41
+ */
42
+ refreshSession(): Promise<RebaseSession>;
43
+ }
44
+ /**
45
+ * User record as returned by the Admin API.
46
+ * @group Admin
47
+ */
48
+ export interface AdminUser {
49
+ uid: string;
50
+ email: string;
51
+ displayName: string | null;
52
+ photoURL: string | null;
53
+ provider: string;
54
+ roles: string[];
55
+ createdAt: string;
56
+ updatedAt: string;
57
+ }
58
+ /**
59
+ * Role record as returned by the Admin API.
60
+ * @group Admin
61
+ */
62
+ export interface AdminRole {
63
+ id: string;
64
+ name: string;
65
+ isAdmin: boolean;
66
+ defaultPermissions: Record<string, unknown> | null;
67
+ config: Record<string, unknown> | null;
68
+ }
69
+ /**
70
+ * Client-side Admin API interface.
71
+ * Provides user and role management operations.
72
+ * @group Admin
73
+ */
74
+ export interface AdminAPI {
75
+ listUsers(): Promise<{
76
+ users: AdminUser[];
77
+ }>;
78
+ listUsersPaginated(options?: {
79
+ search?: string;
80
+ limit?: number;
81
+ offset?: number;
82
+ orderBy?: string;
83
+ orderDir?: "asc" | "desc";
84
+ }): Promise<{
85
+ users: AdminUser[];
86
+ total: number;
87
+ limit: number;
88
+ offset: number;
89
+ }>;
90
+ getUser(userId: string): Promise<{
91
+ user: AdminUser;
92
+ }>;
93
+ createUser(data: {
94
+ email: string;
95
+ displayName?: string;
96
+ password?: string;
97
+ roles?: string[];
98
+ }): Promise<{
99
+ user: AdminUser;
100
+ }>;
101
+ updateUser(userId: string, data: {
102
+ email?: string;
103
+ displayName?: string;
104
+ password?: string;
105
+ roles?: string[];
106
+ }): Promise<{
107
+ user: AdminUser;
108
+ }>;
109
+ deleteUser(userId: string): Promise<{
110
+ success: boolean;
111
+ }>;
112
+ listRoles(): Promise<{
113
+ roles: AdminRole[];
114
+ }>;
115
+ getRole(roleId: string): Promise<{
116
+ role: AdminRole;
117
+ }>;
118
+ createRole(data: {
119
+ id: string;
120
+ name: string;
121
+ isAdmin?: boolean;
122
+ defaultPermissions?: Record<string, unknown>;
123
+ config?: Record<string, unknown>;
124
+ }): Promise<{
125
+ role: AdminRole;
126
+ }>;
127
+ updateRole(roleId: string, data: {
128
+ name?: string;
129
+ isAdmin?: boolean;
130
+ defaultPermissions?: Record<string, unknown>;
131
+ config?: Record<string, unknown>;
132
+ }): Promise<{
133
+ role: AdminRole;
134
+ }>;
135
+ deleteRole(roleId: string): Promise<{
136
+ success: boolean;
137
+ }>;
138
+ bootstrap(): Promise<{
139
+ success: boolean;
140
+ message: string;
141
+ user: {
142
+ uid: string;
143
+ roles: string[];
144
+ };
145
+ }>;
146
+ }
147
+ /**
148
+ * Overarching abstraction that unites Data, Auth, Storage, and Email.
149
+ * Adapters for Supabase or Firebase simply need to implement this interface.
150
+ */
151
+ export interface RebaseClient<DB = unknown> {
152
+ /** Unified Data access layer */
153
+ data: RebaseData;
154
+ /** Unified Authentication layer */
155
+ auth: AuthClient;
156
+ /** Unified Storage layer */
157
+ storage?: StorageSource;
158
+ /**
159
+ * Server-side email service.
160
+ *
161
+ * Available when SMTP (or a custom `sendEmail` function) is configured
162
+ * in the backend auth config. `undefined` when email is not configured.
163
+ *
164
+ * > **Note:** This is only available on the server-side `rebase` singleton.
165
+ * > The client-side SDK does not include an email service.
166
+ */
167
+ email?: EmailService;
168
+ /** Admin API for user and role management */
169
+ admin?: AdminAPI;
170
+ /**
171
+ * The base HTTP URL of the backend server.
172
+ * Exposed by the SDK client (`@rebasepro/client`) and used to auto-derive
173
+ * the `ApiConfigProvider` URL.
174
+ */
175
+ baseUrl?: string;
176
+ /**
177
+ * WebSocket client for realtime subscriptions and admin capabilities.
178
+ * Exposed by the SDK client (`@rebasepro/client`). The shape is intentionally
179
+ * left as `unknown` in the base interface — callers should narrow via feature
180
+ * detection (e.g. `typeof ws.executeSql === "function"`).
181
+ */
182
+ ws?: unknown;
183
+ }
@@ -61,6 +61,7 @@ export interface AdminUser {
61
61
  photoURL: string | null;
62
62
  provider: string;
63
63
  roles: string[];
64
+ metadata?: Record<string, any>;
64
65
  createdAt: string;
65
66
  updatedAt: string;
66
67
  }
@@ -92,8 +93,8 @@ export interface AdminAPI {
92
93
  orderDir?: "asc" | "desc";
93
94
  }): Promise<{ users: AdminUser[]; total: number; limit: number; offset: number }>;
94
95
  getUser(userId: string): Promise<{ user: AdminUser }>;
95
- createUser(data: { email: string; displayName?: string; password?: string; roles?: string[] }): Promise<{ user: AdminUser }>;
96
- updateUser(userId: string, data: { email?: string; displayName?: string; password?: string; roles?: string[] }): Promise<{ user: AdminUser }>;
96
+ createUser(data: { email: string; displayName?: string; password?: string; roles?: string[]; metadata?: Record<string, any> }): Promise<{ user: AdminUser }>;
97
+ updateUser(userId: string, data: { email?: string; displayName?: string; password?: string; roles?: string[]; metadata?: Record<string, any> }): Promise<{ user: AdminUser }>;
97
98
  deleteUser(userId: string): Promise<{ success: boolean }>;
98
99
  listRoles(): Promise<{ roles: AdminRole[] }>;
99
100
  getRole(roleId: string): Promise<{ role: AdminRole }>;
@@ -0,0 +1,46 @@
1
+ import type { EntityCollection } from "../types/collections";
2
+ import type { EntityReference } from "../types/entities";
3
+ /**
4
+ * Controller that provides access to the registered entity collections.
5
+ * @group Models
6
+ */
7
+ export type CollectionRegistryController<DB = Record<string, unknown>, EC extends EntityCollection = EntityCollection<any>> = {
8
+ /**
9
+ * List of the mapped collections in the CMS.
10
+ * Each entry relates to a collection in the root database.
11
+ * Each of the navigation entries in this field
12
+ * generates an entry in the main menu.
13
+ */
14
+ collections?: EntityCollection[];
15
+ /**
16
+ * Is the registry ready to be used
17
+ */
18
+ initialised: boolean;
19
+ /**
20
+ * Get the collection configuration for a given path.
21
+ * The collection is resolved from the given path or alias.
22
+ */
23
+ getCollection: <K extends keyof DB>(slugOrPath: Extract<K, string>, includeUserOverride?: boolean) => EC | undefined;
24
+ /**
25
+ * Get the raw, un-normalized collection configuration.
26
+ * This bypasses the `CollectionRegistry` normalization (such as injecting `relation` instances).
27
+ * This is strictly for the Visual Editor to manipulate AST code without persisting runtime state.
28
+ */
29
+ getRawCollection: (slugOrPath: string) => EC | undefined;
30
+ /**
31
+ * Retrieve all the related parent references for a given path
32
+ * @param path
33
+ */
34
+ getParentReferencesFromPath: (path: string) => EntityReference[];
35
+ /**
36
+ * Retrieve all the related parent collection ids for a given path
37
+ * @param path
38
+ */
39
+ getParentCollectionSlugs: (path: string) => string[];
40
+ getParentEntityIds: (path: string) => string[];
41
+ /**
42
+ * Resolve paths from a list of ids
43
+ * @param ids
44
+ */
45
+ convertIdsToPaths: (ids: string[]) => string[];
46
+ };
@@ -0,0 +1,60 @@
1
+ import React from "react";
2
+ import type { EntityLinkBuilder } from "../types/entity_link_builder";
3
+ import type { Locale } from "../types/locales";
4
+ import type { EntityAction } from "../types/entity_actions";
5
+ import type { EntityCustomView } from "../types/entity_views";
6
+ import type { RebasePlugin } from "../types/plugins";
7
+ import type { PropertyConfig } from "../types/property_config";
8
+ import type { SlotContribution } from "../types/slots";
9
+ export type CustomizationController = {
10
+ /**
11
+ * Builder for generating utility links for entities
12
+ */
13
+ entityLinkBuilder?: EntityLinkBuilder;
14
+ /**
15
+ * Use plugins to modify the behaviour of the CMS.
16
+ */
17
+ plugins?: RebasePlugin[];
18
+ /**
19
+ * Pre-merged slots from plugins + direct slot contributions.
20
+ */
21
+ resolvedSlots: SlotContribution[];
22
+ /**
23
+ * List of additional custom views for entities.
24
+ * You can use the key to reference the custom view in
25
+ * the `entityViews` prop of a collection.
26
+ *
27
+ * You can also define an entity view from the UI.
28
+ */
29
+ entityViews?: EntityCustomView[];
30
+ /**
31
+ * List of actions that can be performed on entities.
32
+ * These actions are displayed in the entity view and in the collection view.
33
+ * You can later reuse these actions in the `entityActions` prop of a collection,
34
+ * by specifying the `key` of the action.
35
+ */
36
+ entityActions?: EntityAction[];
37
+ /**
38
+ * Format of the dates in the CMS.
39
+ * Defaults to 'MMMM dd, yyyy, HH:mm:ss'
40
+ */
41
+ dateTimeFormat?: string;
42
+ /**
43
+ * Locale of the CMS, currently only affecting dates
44
+ */
45
+ locale?: Locale;
46
+ /**
47
+ * Record of custom form fields to be used in the CMS.
48
+ * You can use the key to reference the custom field in
49
+ * the `propertyConfig` prop of a property in a collection.
50
+ */
51
+ propertyConfigs: Record<string, PropertyConfig>;
52
+ components?: {
53
+ /**
54
+ * Component to render when a reference is missing
55
+ */
56
+ missingReference?: React.ComponentType<{
57
+ path: string;
58
+ }>;
59
+ };
60
+ };