@rebasepro/types 0.2.3 → 0.2.4

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 (37) hide show
  1. package/dist/controllers/auth.d.ts +2 -24
  2. package/dist/controllers/client.d.ts +0 -3
  3. package/dist/controllers/collection_registry.d.ts +1 -1
  4. package/dist/controllers/data_driver.d.ts +18 -0
  5. package/dist/controllers/registry.d.ts +5 -4
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js.map +1 -1
  8. package/dist/rebase_context.d.ts +1 -1
  9. package/dist/types/auth_adapter.d.ts +2 -4
  10. package/dist/types/collections.d.ts +0 -4
  11. package/dist/types/component_ref.d.ts +1 -1
  12. package/dist/types/cron.d.ts +1 -1
  13. package/dist/types/entity_views.d.ts +1 -0
  14. package/dist/types/export_import.d.ts +1 -1
  15. package/dist/types/formex.d.ts +2 -2
  16. package/dist/types/properties.d.ts +2 -2
  17. package/dist/types/translations.d.ts +28 -12
  18. package/dist/types/user_management_delegate.d.ts +6 -4
  19. package/dist/users/roles.d.ts +0 -8
  20. package/package.json +1 -1
  21. package/src/controllers/auth.tsx +2 -30
  22. package/src/controllers/client.ts +2 -3
  23. package/src/controllers/collection_registry.ts +1 -1
  24. package/src/controllers/data_driver.ts +19 -0
  25. package/src/controllers/registry.ts +5 -4
  26. package/src/rebase_context.tsx +1 -1
  27. package/src/types/auth_adapter.ts +2 -4
  28. package/src/types/collections.ts +1 -4
  29. package/src/types/component_ref.ts +1 -1
  30. package/src/types/cron.ts +1 -1
  31. package/src/types/entity_views.tsx +1 -0
  32. package/src/types/export_import.ts +1 -1
  33. package/src/types/formex.ts +2 -2
  34. package/src/types/properties.ts +2 -2
  35. package/src/types/translations.ts +28 -12
  36. package/src/types/user_management_delegate.ts +8 -4
  37. package/src/users/roles.ts +0 -10
@@ -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
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/types",
3
3
  "type": "module",
4
- "version": "0.2.3",
4
+ "version": "0.2.4",
5
5
  "description": "Rebase type definitions — shared interfaces and controller types",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/rebaseco"
@@ -1,6 +1,4 @@
1
- import { StorageSource } from "./storage";
2
1
  import { Role, User } from "../users";
3
- import { RebaseData } from "./data";
4
2
 
5
3
  /**
6
4
  * Capabilities advertised by an auth provider.
@@ -100,6 +98,8 @@ export interface AuthControllerExtended<USER extends User = User, ExtraData = un
100
98
  emailPasswordLogin?(email: string, password: string): Promise<void>;
101
99
  /** Login with Google — accepts an ID token, access token, or authorization code payload */
102
100
  googleLogin?: (payload: { idToken: string } | { accessToken: string } | { code: string; redirectUri: string }) => Promise<void>;
101
+ /** Generic OAuth login — works with any provider. Posts payload to /auth/{providerId}. */
102
+ oauthLogin?: (providerId: string, payload: Record<string, unknown>) => Promise<void>;
103
103
  /** Register a new user */
104
104
  register?(email: string, password: string, displayName?: string): Promise<void>;
105
105
  /** Skip login (for anonymous access if enabled) */
@@ -113,31 +113,3 @@ export interface AuthControllerExtended<USER extends User = User, ExtraData = un
113
113
  /** Update user profile */
114
114
  updateProfile?(displayName?: string, photoURL?: string): Promise<USER>;
115
115
  }
116
-
117
- /**
118
- * Implement this function to allow access to specific users.
119
- * @group Hooks and utilities
120
- */
121
- export type Authenticator<USER extends User = User> = (props: {
122
-
123
- /**
124
- * Logged-in user or null
125
- */
126
- user: USER | null;
127
-
128
- /**
129
- * AuthController
130
- */
131
- authController: AuthController<USER>;
132
-
133
- /**
134
- * Unified data access API
135
- */
136
- data: RebaseData;
137
-
138
- /**
139
- * Used storage implementation
140
- */
141
- storageSource: StorageSource;
142
-
143
- }) => boolean | Promise<boolean>;
@@ -75,7 +75,6 @@ export interface AdminRole {
75
75
  name: string;
76
76
  isAdmin: boolean;
77
77
  defaultPermissions: Record<string, unknown> | null;
78
- config: Record<string, unknown> | null;
79
78
  }
80
79
 
81
80
  /**
@@ -98,8 +97,8 @@ export interface AdminAPI {
98
97
  deleteUser(userId: string): Promise<{ success: boolean }>;
99
98
  listRoles(): Promise<{ roles: AdminRole[] }>;
100
99
  getRole(roleId: string): Promise<{ role: AdminRole }>;
101
- createRole(data: { id: string; name: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown>; config?: Record<string, unknown> }): Promise<{ role: AdminRole }>;
102
- updateRole(roleId: string, data: { name?: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown>; config?: Record<string, unknown> }): Promise<{ role: AdminRole }>;
100
+ createRole(data: { id: string; name: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown> }): Promise<{ role: AdminRole }>;
101
+ updateRole(roleId: string, data: { name?: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown> }): Promise<{ role: AdminRole }>;
103
102
  deleteRole(roleId: string): Promise<{ success: boolean }>;
104
103
  bootstrap(): Promise<{ success: boolean; message: string; user: { uid: string; roles: string[] } }>;
105
104
  }
@@ -7,7 +7,7 @@ import type { EntityReference } from "../types/entities";
7
7
  */
8
8
  export type CollectionRegistryController<
9
9
  DB = Record<string, unknown>,
10
- EC extends EntityCollection = EntityCollection<any>
10
+ EC extends EntityCollection = EntityCollection
11
11
  > = {
12
12
 
13
13
  /**
@@ -24,6 +24,22 @@ export type ListenEntityProps<M extends Record<string, unknown> = Record<string,
24
24
  onError?: (error: Error) => void,
25
25
  }
26
26
 
27
+ /**
28
+ * Configuration for vector similarity search queries.
29
+ * Vector search applies an ORDER BY distance expression and optionally
30
+ * filters results by a distance threshold.
31
+ */
32
+ export interface VectorSearchParams {
33
+ /** Property name containing the vector column */
34
+ property: string;
35
+ /** Query vector to compare against */
36
+ vector: number[];
37
+ /** Distance function (default: "cosine") */
38
+ distance?: "cosine" | "l2" | "inner_product";
39
+ /** Only return results within this distance threshold */
40
+ threshold?: number;
41
+ }
42
+
27
43
  /**
28
44
  * @internal
29
45
  */
@@ -37,6 +53,8 @@ export interface FetchCollectionProps<M extends Record<string, unknown> = Record
37
53
  orderBy?: string;
38
54
  searchString?: string;
39
55
  order?: "desc" | "asc";
56
+ /** Vector similarity search configuration */
57
+ vectorSearch?: VectorSearchParams;
40
58
  }
41
59
 
42
60
  /**
@@ -240,6 +258,7 @@ export interface RestFetchService {
240
258
  startAfter?: Record<string, unknown>;
241
259
  searchString?: string;
242
260
  databaseId?: string;
261
+ vectorSearch?: VectorSearchParams;
243
262
  },
244
263
  include?: string[]
245
264
  ): Promise<Record<string, unknown>[]>;
@@ -4,6 +4,7 @@ import type { EntityCollectionsBuilder } from "../types/builders";
4
4
  import type { EntityCustomView } from "../types/entity_views";
5
5
  import type { EntityAction } from "../types/entity_actions";
6
6
  import type { AppView, NavigationGroupMapping } from "./navigation";
7
+ import type { RebasePlugin } from "../types/plugins";
7
8
 
8
9
  /**
9
10
  * Options to enable the built-in collection editor.
@@ -21,12 +22,12 @@ export interface CollectionEditorOptions {
21
22
  pathSuggestions?: string[];
22
23
  }
23
24
 
24
- export interface RebaseCMSConfig<EC extends EntityCollection = any> {
25
+ export interface RebaseCMSConfig<EC extends EntityCollection = EntityCollection> {
25
26
  collections?: EC[] | EntityCollectionsBuilder<EC>;
26
27
  homePage?: ReactNode;
27
- entityViews?: EntityCustomView<any>[];
28
+ entityViews?: EntityCustomView[];
28
29
  entityActions?: EntityAction[];
29
- plugins?: any[];
30
+ plugins?: RebasePlugin[];
30
31
 
31
32
  /**
32
33
  * Centralized configuration for how collections and views are grouped
@@ -47,7 +48,7 @@ export interface RebaseCMSConfig<EC extends EntityCollection = any> {
47
48
  }
48
49
 
49
50
  export interface RebaseStudioConfig {
50
- tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api")[];
51
+ tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api" | "logs")[];
51
52
  homePage?: ReactNode;
52
53
  devViews?: AppView[];
53
54
  }
@@ -32,7 +32,7 @@ export type RebaseCallContext<USER extends User = User> = {
32
32
  * const { client } = props.context;
33
33
  * const result = await client.functions.invoke('extract-job', { url });
34
34
  */
35
- client: RebaseClient<any>;
35
+ client: RebaseClient;
36
36
 
37
37
  /**
38
38
  * Unified data access — `context.data.products.create(...)`.
@@ -149,7 +149,7 @@ export interface AuthUserData {
149
149
  displayName?: string | null;
150
150
  photoUrl?: string | null;
151
151
  emailVerified?: boolean;
152
- metadata?: Record<string, any>;
152
+ metadata?: Record<string, unknown>;
153
153
  createdAt?: Date;
154
154
  updatedAt?: Date;
155
155
  }
@@ -163,7 +163,7 @@ export interface AuthCreateUserData {
163
163
  password?: string;
164
164
  displayName?: string;
165
165
  photoUrl?: string;
166
- metadata?: Record<string, any>;
166
+ metadata?: Record<string, unknown>;
167
167
  }
168
168
 
169
169
  /**
@@ -186,7 +186,6 @@ export interface AuthRoleData {
186
186
  edit?: boolean;
187
187
  delete?: boolean;
188
188
  }> | null;
189
- config?: Record<string, unknown> | null;
190
189
  }
191
190
 
192
191
  /**
@@ -199,7 +198,6 @@ export interface AuthCreateRoleData {
199
198
  isAdmin?: boolean;
200
199
  defaultPermissions?: AuthRoleData["defaultPermissions"];
201
200
  collectionPermissions?: AuthRoleData["collectionPermissions"];
202
- config?: AuthRoleData["config"];
203
201
  }
204
202
 
205
203
  /**
@@ -716,10 +716,7 @@ export interface FilterPreset<Key extends string = string> {
716
716
  sort?: [Key, "asc" | "desc"];
717
717
  }
718
718
 
719
- /**
720
- * @deprecated Use {@link FilterPreset} instead.
721
- */
722
- export type QuickFilter<Key extends string = string> = FilterPreset<Key>;
719
+
723
720
 
724
721
  /**
725
722
  * Used to indicate valid filter combinations (e.g. created in Firestore)
@@ -37,7 +37,7 @@ export interface LazyComponentRef<P = unknown> {
37
37
  *
38
38
  * @group Types
39
39
  */
40
- export type ComponentRef<P = unknown> =
40
+ export type ComponentRef<P = any> =
41
41
  | React.ComponentType<P>
42
42
  | LazyComponentRef<P>
43
43
  | (() => Promise<{ default: React.ComponentType<P> }>)
package/src/types/cron.ts CHANGED
@@ -61,7 +61,7 @@ export interface CronJobContext {
61
61
  log: (...args: unknown[]) => void;
62
62
 
63
63
  /** The RebaseClient instance to interact with the database. */
64
- client: RebaseClient<any>;
64
+ client: RebaseClient;
65
65
  }
66
66
 
67
67
  // =============================================================================
@@ -66,6 +66,7 @@ export interface FormContext<M extends Record<string, unknown> = Record<string,
66
66
  export type EntityCustomView<M extends Record<string, unknown> = Record<string, unknown>> = {
67
67
  key: string;
68
68
  name: string;
69
+ icon?: string | React.ReactNode;
69
70
  tabComponent?: React.ReactNode;
70
71
  includeActions?: boolean | "bottom";
71
72
  Builder?: ComponentRef<EntityCustomViewParams<M>>;
@@ -20,7 +20,7 @@ export interface ExportMappingFunction<USER extends User = User> {
20
20
  entity,
21
21
  context
22
22
  }: {
23
- entity: Entity<any>,
23
+ entity: Entity,
24
24
  context: RebaseContext<USER>
25
25
  }) => Promise<string> | string;
26
26
  }
@@ -1,6 +1,6 @@
1
1
  import React, { FormEvent } from "react";
2
2
 
3
- export type FormexController<T = any> = {
3
+ export type FormexController<T = unknown> = {
4
4
  values: T;
5
5
  initialValues: T;
6
6
  setValues: (values: T) => void;
@@ -37,7 +37,7 @@ export type FormexController<T = any> = {
37
37
  canRedo: boolean;
38
38
  }
39
39
 
40
- export type FormexResetProps<T = any> = {
40
+ export type FormexResetProps<T = unknown> = {
41
41
  values?: T;
42
42
  submitCount?: number;
43
43
  errors?: Record<string, string>;
@@ -152,8 +152,8 @@ export interface BaseUIConfig<CustomProps = unknown> {
152
152
  disabled?: boolean | PropertyDisabledConfig;
153
153
  widthPercentage?: number;
154
154
  customProps?: CustomProps;
155
- Field?: ComponentRef<any>;
156
- Preview?: ComponentRef<any>;
155
+ Field?: ComponentRef;
156
+ Preview?: ComponentRef;
157
157
  }
158
158
 
159
159
  export interface BaseProperty<CustomProps = unknown> {
@@ -121,6 +121,12 @@ export interface RebaseTranslations {
121
121
  navigation_drawer: string;
122
122
  collapse: string;
123
123
  expand: string;
124
+ /** Tooltip for the language switcher in the drawer footer */
125
+ change_language?: string;
126
+ /** Tooltip for the theme toggle in the drawer footer */
127
+ toggle_theme?: string;
128
+ /** Aria label for the user menu trigger in the drawer footer */
129
+ user_menu?: string;
124
130
 
125
131
  // ─── Error states ─────────────────────────────────────────────
126
132
  error: string;
@@ -486,18 +492,28 @@ export interface RebaseTranslations {
486
492
 
487
493
  select_reference: string;
488
494
  select_references: string;
489
- account_settings: string;
490
- profile: string;
491
- sessions: string;
492
- display_name: string;
493
- photo_url: string;
494
- save_profile: string;
495
- saving: string;
496
- no_active_sessions: string;
497
- revoking: string;
498
- revoke_all_sessions: string;
499
- unknown_device: string;
500
- current: string;
495
+ account_settings?: string;
496
+ profile?: string;
497
+ sessions?: string;
498
+ security?: string;
499
+ change_password?: string;
500
+ current_password?: string;
501
+ new_password?: string;
502
+ confirm_password?: string;
503
+ password_changed?: string;
504
+ passwords_dont_match?: string;
505
+ password_too_short?: string;
506
+ password_change_not_available?: string;
507
+ changing_password?: string;
508
+ display_name?: string;
509
+ photo_url?: string;
510
+ save_profile?: string;
511
+ saving?: string;
512
+ no_active_sessions?: string;
513
+ revoking?: string;
514
+ revoke_all_sessions?: string;
515
+ unknown_device?: string;
516
+ current?: string;
501
517
  role_id: string;
502
518
  role_name: string;
503
519
  add_reference: string;
@@ -120,10 +120,7 @@ export interface UserManagementDelegate<USER extends User = User> {
120
120
  */
121
121
  allowDefaultRolesCreation?: boolean;
122
122
 
123
- /**
124
- * Should collection config permissions be included?
125
- */
126
- includeCollectionConfigPermissions?: boolean;
123
+
127
124
 
128
125
 
129
126
  /**
@@ -132,6 +129,13 @@ export interface UserManagementDelegate<USER extends User = User> {
132
129
  */
133
130
  defineRolesFor?: (user: USER) => Promise<Role[] | undefined> | Role[] | undefined;
134
131
 
132
+ /**
133
+ * Whether any admin users exist. Used by the bootstrap banner to decide
134
+ * whether to prompt. Populated via a lightweight check (e.g. `limit=1`
135
+ * query) instead of loading all users.
136
+ */
137
+ hasAdminUsers?: boolean;
138
+
135
139
  /**
136
140
  * Optional function to bootstrap an admin user.
137
141
  * Often used when the database is empty.
@@ -18,15 +18,5 @@ export type Role = {
18
18
  isAdmin?: boolean;
19
19
 
20
20
 
21
- /**
22
- * Permissions related to editing the collections
23
- */
24
- config?: {
25
-
26
- createCollections?: boolean;
27
-
28
- editCollections?: boolean | "own";
29
21
 
30
- deleteCollections?: boolean | "own";
31
- }
32
22
  }