@rebasepro/types 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/controllers/auth.d.ts +4 -26
- package/dist/controllers/client.d.ts +25 -43
- package/dist/controllers/collection_registry.d.ts +1 -1
- package/dist/controllers/data.d.ts +4 -0
- package/dist/controllers/data_driver.d.ts +23 -0
- package/dist/controllers/registry.d.ts +5 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/rebase_context.d.ts +1 -1
- package/dist/types/auth_adapter.d.ts +5 -60
- package/dist/types/backend.d.ts +2 -2
- package/dist/types/backend_hooks.d.ts +2 -17
- package/dist/types/collections.d.ts +0 -4
- package/dist/types/component_ref.d.ts +1 -1
- package/dist/types/cron.d.ts +1 -1
- package/dist/types/entity_views.d.ts +1 -0
- package/dist/types/export_import.d.ts +1 -1
- package/dist/types/formex.d.ts +2 -2
- package/dist/types/properties.d.ts +9 -7
- package/dist/types/translations.d.ts +28 -12
- package/dist/types/user_management_delegate.d.ts +22 -57
- package/dist/users/index.d.ts +0 -1
- package/dist/users/user.d.ts +0 -1
- package/package.json +1 -1
- package/src/controllers/auth.tsx +4 -32
- package/src/controllers/client.ts +23 -23
- package/src/controllers/collection_registry.ts +1 -1
- package/src/controllers/data.ts +5 -0
- package/src/controllers/data_driver.ts +25 -0
- package/src/controllers/registry.ts +5 -4
- package/src/rebase_context.tsx +1 -1
- package/src/types/auth_adapter.ts +7 -67
- package/src/types/backend.ts +2 -2
- package/src/types/backend_hooks.ts +2 -18
- package/src/types/collections.ts +1 -4
- package/src/types/component_ref.ts +1 -1
- package/src/types/cron.ts +1 -1
- package/src/types/entity_views.tsx +1 -0
- package/src/types/export_import.ts +1 -1
- package/src/types/formex.ts +2 -2
- package/src/types/properties.ts +20 -31
- package/src/types/translations.ts +28 -12
- package/src/types/user_management_delegate.ts +22 -69
- package/src/users/index.ts +1 -1
- package/src/users/user.ts +0 -1
- package/dist/users/roles.d.ts +0 -22
- package/src/users/roles.ts +0 -32
|
@@ -50,6 +50,7 @@ export interface FormContext<M extends Record<string, unknown> = Record<string,
|
|
|
50
50
|
export type EntityCustomView<M extends Record<string, unknown> = Record<string, unknown>> = {
|
|
51
51
|
key: string;
|
|
52
52
|
name: string;
|
|
53
|
+
icon?: string | React.ReactNode;
|
|
53
54
|
tabComponent?: React.ReactNode;
|
|
54
55
|
includeActions?: boolean | "bottom";
|
|
55
56
|
Builder?: ComponentRef<EntityCustomViewParams<M>>;
|
|
@@ -15,7 +15,7 @@ export interface ExportConfig<USER extends User = User> {
|
|
|
15
15
|
export interface ExportMappingFunction<USER extends User = User> {
|
|
16
16
|
key: string;
|
|
17
17
|
builder: ({ entity, context }: {
|
|
18
|
-
entity: Entity
|
|
18
|
+
entity: Entity;
|
|
19
19
|
context: RebaseContext<USER>;
|
|
20
20
|
}) => Promise<string> | string;
|
|
21
21
|
}
|
package/dist/types/formex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FormEvent } from "react";
|
|
2
|
-
export type FormexController<T =
|
|
2
|
+
export type FormexController<T = unknown> = {
|
|
3
3
|
values: T;
|
|
4
4
|
initialValues: T;
|
|
5
5
|
setValues: (values: T) => void;
|
|
@@ -32,7 +32,7 @@ export type FormexController<T = any> = {
|
|
|
32
32
|
canUndo: boolean;
|
|
33
33
|
canRedo: boolean;
|
|
34
34
|
};
|
|
35
|
-
export type FormexResetProps<T =
|
|
35
|
+
export type FormexResetProps<T = unknown> = {
|
|
36
36
|
values?: T;
|
|
37
37
|
submitCount?: number;
|
|
38
38
|
errors?: Record<string, string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentRef } from "./component_ref";
|
|
2
|
-
import type { EntityReference, EntityRelation, EntityValues, GeoPoint,
|
|
3
|
-
import type {
|
|
2
|
+
import type { Entity, EntityReference, EntityRelation, EntityValues, GeoPoint, Vector } from "./entities";
|
|
3
|
+
import type { JoinStep, OnAction, Relation } from "./relations";
|
|
4
4
|
import type { EntityCollection, FilterValues } from "./collections";
|
|
5
5
|
import type { ColorKey, ColorScheme } from "./chips";
|
|
6
6
|
import type { AuthController } from "../controllers/auth";
|
|
@@ -104,8 +104,8 @@ export interface BaseUIConfig<CustomProps = unknown> {
|
|
|
104
104
|
disabled?: boolean | PropertyDisabledConfig;
|
|
105
105
|
widthPercentage?: number;
|
|
106
106
|
customProps?: CustomProps;
|
|
107
|
-
Field?: ComponentRef
|
|
108
|
-
Preview?: ComponentRef
|
|
107
|
+
Field?: ComponentRef;
|
|
108
|
+
Preview?: ComponentRef;
|
|
109
109
|
}
|
|
110
110
|
export interface BaseProperty<CustomProps = unknown> {
|
|
111
111
|
ui?: BaseUIConfig<CustomProps>;
|
|
@@ -185,7 +185,7 @@ export interface StringProperty extends BaseProperty {
|
|
|
185
185
|
* Optional database column type. If not set, it defaults to `varchar` or `uuid` depending on `isId` configuration.
|
|
186
186
|
* Use `text` for strings with unbound length, `char` for fixed-length strings, or `varchar` for variable-length strings with a limit.
|
|
187
187
|
*/
|
|
188
|
-
columnType?: "varchar" | "text" | "char";
|
|
188
|
+
columnType?: "varchar" | "text" | "char" | "uuid";
|
|
189
189
|
/**
|
|
190
190
|
* Rules for validating this property
|
|
191
191
|
*/
|
|
@@ -541,9 +541,11 @@ export interface ArrayProperty extends BaseProperty {
|
|
|
541
541
|
ui?: ArrayUIConfig;
|
|
542
542
|
type: "array";
|
|
543
543
|
/**
|
|
544
|
-
* Optional database column type.
|
|
544
|
+
* Optional database column type. By default, maps to a native Postgres array
|
|
545
|
+
* (e.g. `text[]`, `integer[]`/`numeric[]`, `boolean[]`) if the element type
|
|
546
|
+
* is a primitive, otherwise defaults to `jsonb`.
|
|
545
547
|
*/
|
|
546
|
-
columnType?: "json" | "jsonb";
|
|
548
|
+
columnType?: "json" | "jsonb" | "text[]" | "integer[]" | "boolean[]" | "numeric[]";
|
|
547
549
|
/**
|
|
548
550
|
* The property of this array.
|
|
549
551
|
* You can specify any property (except another Array property)
|
|
@@ -105,6 +105,12 @@ export interface RebaseTranslations {
|
|
|
105
105
|
navigation_drawer: string;
|
|
106
106
|
collapse: string;
|
|
107
107
|
expand: string;
|
|
108
|
+
/** Tooltip for the language switcher in the drawer footer */
|
|
109
|
+
change_language?: string;
|
|
110
|
+
/** Tooltip for the theme toggle in the drawer footer */
|
|
111
|
+
toggle_theme?: string;
|
|
112
|
+
/** Aria label for the user menu trigger in the drawer footer */
|
|
113
|
+
user_menu?: string;
|
|
108
114
|
error: string;
|
|
109
115
|
error_uploading_file: string;
|
|
110
116
|
error_deleting: string;
|
|
@@ -426,18 +432,28 @@ export interface RebaseTranslations {
|
|
|
426
432
|
deleted: string;
|
|
427
433
|
select_reference: string;
|
|
428
434
|
select_references: string;
|
|
429
|
-
account_settings
|
|
430
|
-
profile
|
|
431
|
-
sessions
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
435
|
+
account_settings?: string;
|
|
436
|
+
profile?: string;
|
|
437
|
+
sessions?: string;
|
|
438
|
+
security?: string;
|
|
439
|
+
change_password?: string;
|
|
440
|
+
current_password?: string;
|
|
441
|
+
new_password?: string;
|
|
442
|
+
confirm_password?: string;
|
|
443
|
+
password_changed?: string;
|
|
444
|
+
passwords_dont_match?: string;
|
|
445
|
+
password_too_short?: string;
|
|
446
|
+
password_change_not_available?: string;
|
|
447
|
+
changing_password?: string;
|
|
448
|
+
display_name?: string;
|
|
449
|
+
photo_url?: string;
|
|
450
|
+
save_profile?: string;
|
|
451
|
+
saving?: string;
|
|
452
|
+
no_active_sessions?: string;
|
|
453
|
+
revoking?: string;
|
|
454
|
+
revoke_all_sessions?: string;
|
|
455
|
+
unknown_device?: string;
|
|
456
|
+
current?: string;
|
|
441
457
|
role_id: string;
|
|
442
458
|
role_name: string;
|
|
443
459
|
add_reference: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { User } from "../users";
|
|
2
2
|
/**
|
|
3
3
|
* Result of creating a new user via admin flow.
|
|
4
4
|
* Contains the created user plus information about how credentials were delivered.
|
|
@@ -15,56 +15,46 @@ export interface UserCreationResult<USER extends User = User> {
|
|
|
15
15
|
temporaryPassword?: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Delegate to manage
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Delegate to manage auth-specific user operations.
|
|
19
|
+
*
|
|
20
|
+
* This interface allows the CMS to be agnostic of the underlying
|
|
21
|
+
* authentication provider or backend. User/role CRUD is now handled
|
|
22
|
+
* by the collection system; this delegate only exposes auth-specific
|
|
23
|
+
* operations (password hashing, invitations, bootstrap).
|
|
21
24
|
*
|
|
22
25
|
* @group Models
|
|
23
26
|
*/
|
|
24
27
|
export interface UserManagementDelegate<USER extends User = User> {
|
|
25
28
|
/**
|
|
26
|
-
* Are
|
|
29
|
+
* Are auth-related operations currently loading?
|
|
27
30
|
*/
|
|
28
31
|
loading: boolean;
|
|
29
32
|
/**
|
|
30
|
-
*
|
|
33
|
+
* In-memory list of users (used for client-side filtering fallback).
|
|
31
34
|
*/
|
|
32
|
-
users
|
|
35
|
+
users?: USER[];
|
|
33
36
|
/**
|
|
34
|
-
*
|
|
37
|
+
* Error from fetching the users list, if any.
|
|
35
38
|
*/
|
|
36
39
|
usersError?: Error;
|
|
37
40
|
/**
|
|
38
|
-
*
|
|
39
|
-
* user information when assigning ownership of an entity.
|
|
40
|
-
* @param uid
|
|
41
|
+
* Look up a single user by UID from the in-memory cache.
|
|
41
42
|
*/
|
|
42
|
-
getUser
|
|
43
|
+
getUser?: (uid: string) => USER | null;
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
-
* When provided, the CMS will use this for the users table
|
|
46
|
-
* instead of loading all users into memory.
|
|
45
|
+
* Server-side user search with pagination.
|
|
47
46
|
*/
|
|
48
|
-
searchUsers?: (
|
|
47
|
+
searchUsers?: (params: {
|
|
49
48
|
search?: string;
|
|
50
49
|
limit?: number;
|
|
51
50
|
offset?: number;
|
|
52
|
-
orderBy?: string;
|
|
53
|
-
orderDir?: "asc" | "desc";
|
|
54
|
-
roleId?: string;
|
|
55
51
|
}) => Promise<{
|
|
56
52
|
users: USER[];
|
|
57
53
|
total: number;
|
|
58
54
|
}>;
|
|
59
|
-
/**
|
|
60
|
-
* Save a user (create or update)
|
|
61
|
-
* @param user
|
|
62
|
-
*/
|
|
63
|
-
saveUser?: (user: USER) => Promise<USER>;
|
|
64
55
|
/**
|
|
65
56
|
* Create a new user with invitation/password generation support.
|
|
66
57
|
* Returns additional info about how the credentials were delivered.
|
|
67
|
-
* Falls back to saveUser if not provided.
|
|
68
58
|
*/
|
|
69
59
|
createUser?: (user: USER) => Promise<UserCreationResult<USER>>;
|
|
70
60
|
/**
|
|
@@ -73,46 +63,21 @@ export interface UserManagementDelegate<USER extends User = User> {
|
|
|
73
63
|
* or a flag indicating an email invitation was sent.
|
|
74
64
|
*/
|
|
75
65
|
resetPassword?: (user: USER) => Promise<UserCreationResult<USER>>;
|
|
76
|
-
/**
|
|
77
|
-
* Delete a user
|
|
78
|
-
* @param user
|
|
79
|
-
*/
|
|
80
|
-
deleteUser?: (user: USER) => Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* List of roles defined in the CMS.
|
|
83
|
-
*/
|
|
84
|
-
roles?: Role[];
|
|
85
|
-
/**
|
|
86
|
-
* Optional error if roles failed to load.
|
|
87
|
-
*/
|
|
88
|
-
rolesError?: Error;
|
|
89
|
-
/**
|
|
90
|
-
* Save a role (create or update)
|
|
91
|
-
* @param role
|
|
92
|
-
*/
|
|
93
|
-
saveRole?: (role: Role) => Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* Delete a role
|
|
96
|
-
* @param role
|
|
97
|
-
*/
|
|
98
|
-
deleteRole?: (role: Role) => Promise<void>;
|
|
99
66
|
/**
|
|
100
67
|
* Is the currently logged in user an admin?
|
|
101
68
|
*/
|
|
102
69
|
isAdmin?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* If true, the UI will allow the user to create the default roles (admin, editor, viewer).
|
|
105
|
-
*/
|
|
106
|
-
allowDefaultRolesCreation?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Should collection config permissions be included?
|
|
109
|
-
*/
|
|
110
|
-
includeCollectionConfigPermissions?: boolean;
|
|
111
70
|
/**
|
|
112
71
|
* Optionally define roles for a given user. This is useful when the roles
|
|
113
72
|
* are coming from a separate provider than the one issuing the tokens.
|
|
114
73
|
*/
|
|
115
|
-
defineRolesFor?: (user: USER) => Promise<
|
|
74
|
+
defineRolesFor?: (user: USER) => Promise<string[] | undefined> | string[] | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Whether any admin users exist. Used by the bootstrap banner to decide
|
|
77
|
+
* whether to prompt. Populated via a lightweight check (e.g. `limit=1`
|
|
78
|
+
* query) instead of loading all users.
|
|
79
|
+
*/
|
|
80
|
+
hasAdminUsers?: boolean;
|
|
116
81
|
/**
|
|
117
82
|
* Optional function to bootstrap an admin user.
|
|
118
83
|
* Often used when the database is empty.
|
package/dist/users/index.d.ts
CHANGED
package/dist/users/user.d.ts
CHANGED
package/package.json
CHANGED
package/src/controllers/auth.tsx
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Role, User } from "../users";
|
|
3
|
-
import { RebaseData } from "./data";
|
|
1
|
+
import type { User } from "../users";
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Capabilities advertised by an auth provider.
|
|
@@ -79,7 +77,7 @@ export type AuthController<USER extends User = User, ExtraData = unknown> = {
|
|
|
79
77
|
|
|
80
78
|
setUser?(user: USER | null): void;
|
|
81
79
|
|
|
82
|
-
setUserRoles?(roles:
|
|
80
|
+
setUserRoles?(roles: string[]): void;
|
|
83
81
|
|
|
84
82
|
/**
|
|
85
83
|
* Capabilities advertised by the 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>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { User } from "../users";
|
|
2
|
-
import { RebaseData } from "./data";
|
|
3
|
-
import { EmailService } from "./email";
|
|
1
|
+
import type { User } from "../users";
|
|
2
|
+
import type { RebaseData } from "./data";
|
|
3
|
+
import type { EmailService } from "./email";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Event type for authentication state changes
|
|
@@ -17,7 +17,7 @@ export interface RebaseSession {
|
|
|
17
17
|
user: User;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
import { StorageSource } from "./storage";
|
|
20
|
+
import type { StorageSource } from "./storage";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Unified Authentication Client Interface
|
|
@@ -66,21 +66,9 @@ export interface AdminUser {
|
|
|
66
66
|
updatedAt: string;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
* Role record as returned by the Admin API.
|
|
71
|
-
* @group Admin
|
|
72
|
-
*/
|
|
73
|
-
export interface AdminRole {
|
|
74
|
-
id: string;
|
|
75
|
-
name: string;
|
|
76
|
-
isAdmin: boolean;
|
|
77
|
-
defaultPermissions: Record<string, unknown> | null;
|
|
78
|
-
config: Record<string, unknown> | null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
69
|
/**
|
|
82
70
|
* Client-side Admin API interface.
|
|
83
|
-
* Provides user
|
|
71
|
+
* Provides user management operations.
|
|
84
72
|
* @group Admin
|
|
85
73
|
*/
|
|
86
74
|
export interface AdminAPI {
|
|
@@ -96,11 +84,6 @@ export interface AdminAPI {
|
|
|
96
84
|
createUser(data: { email: string; displayName?: string; password?: string; roles?: string[]; metadata?: Record<string, any> }): Promise<{ user: AdminUser }>;
|
|
97
85
|
updateUser(userId: string, data: { email?: string; displayName?: string; password?: string; roles?: string[]; metadata?: Record<string, any> }): Promise<{ user: AdminUser }>;
|
|
98
86
|
deleteUser(userId: string): Promise<{ success: boolean }>;
|
|
99
|
-
listRoles(): Promise<{ roles: AdminRole[] }>;
|
|
100
|
-
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 }>;
|
|
103
|
-
deleteRole(roleId: string): Promise<{ success: boolean }>;
|
|
104
87
|
bootstrap(): Promise<{ success: boolean; message: string; user: { uid: string; roles: string[] } }>;
|
|
105
88
|
}
|
|
106
89
|
|
|
@@ -129,7 +112,7 @@ export interface RebaseClient<DB = unknown> {
|
|
|
129
112
|
*/
|
|
130
113
|
email?: EmailService;
|
|
131
114
|
|
|
132
|
-
/** Admin API for user
|
|
115
|
+
/** Admin API for user management */
|
|
133
116
|
admin?: AdminAPI;
|
|
134
117
|
|
|
135
118
|
/**
|
|
@@ -146,4 +129,21 @@ export interface RebaseClient<DB = unknown> {
|
|
|
146
129
|
* detection (e.g. `typeof ws.executeSql === "function"`).
|
|
147
130
|
*/
|
|
148
131
|
ws?: unknown;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Execute raw SQL against the database.
|
|
135
|
+
*
|
|
136
|
+
* Only available server-side when the backend uses a SQL database
|
|
137
|
+
* (PostgreSQL, MySQL, etc.). `undefined` for document databases
|
|
138
|
+
* (MongoDB, Firestore) and on the client-side SDK.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* // In a cron job or custom function:
|
|
143
|
+
* if (ctx.client.sql) {
|
|
144
|
+
* const rows = await ctx.client.sql("SELECT count(*) FROM orders");
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
sql?(query: string, options?: { database?: string; role?: string }): Promise<Record<string, unknown>[]>;
|
|
149
149
|
}
|
package/src/controllers/data.ts
CHANGED
|
@@ -146,6 +146,11 @@ export interface CollectionAccessor<M extends Record<string, unknown> = Record<s
|
|
|
146
146
|
*/
|
|
147
147
|
delete(id: string | number): Promise<void>;
|
|
148
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Delete all records in this collection.
|
|
151
|
+
*/
|
|
152
|
+
deleteAll?(): Promise<void>;
|
|
153
|
+
|
|
149
154
|
/**
|
|
150
155
|
* Subscribe to a collection for real-time updates.
|
|
151
156
|
* Optional method, may not be supported by all implementations (like stateless HTTP clients).
|
|
@@ -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
|
/**
|
|
@@ -135,6 +153,12 @@ export interface DataDriver {
|
|
|
135
153
|
*/
|
|
136
154
|
deleteEntity<M extends Record<string, unknown> = Record<string, unknown>>(props: DeleteEntityProps<M>): Promise<void>;
|
|
137
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Delete all entities from a collection.
|
|
158
|
+
* @param path Collection path
|
|
159
|
+
*/
|
|
160
|
+
deleteAll?(path: string): Promise<void>;
|
|
161
|
+
|
|
138
162
|
/**
|
|
139
163
|
* Check if the given property is unique in the given collection
|
|
140
164
|
* @param path Collection path
|
|
@@ -240,6 +264,7 @@ export interface RestFetchService {
|
|
|
240
264
|
startAfter?: Record<string, unknown>;
|
|
241
265
|
searchString?: string;
|
|
242
266
|
databaseId?: string;
|
|
267
|
+
vectorSearch?: VectorSearchParams;
|
|
243
268
|
},
|
|
244
269
|
include?: string[]
|
|
245
270
|
): 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 =
|
|
25
|
+
export interface RebaseCMSConfig<EC extends EntityCollection = EntityCollection> {
|
|
25
26
|
collections?: EC[] | EntityCollectionsBuilder<EC>;
|
|
26
27
|
homePage?: ReactNode;
|
|
27
|
-
entityViews?: EntityCustomView
|
|
28
|
+
entityViews?: EntityCustomView[];
|
|
28
29
|
entityActions?: EntityAction[];
|
|
29
|
-
plugins?:
|
|
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
|
}
|
package/src/rebase_context.tsx
CHANGED
|
@@ -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
|
|
35
|
+
client: RebaseClient;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Unified data access — `context.data.products.create(...)`.
|