@rebasepro/client-postgresql 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +117 -163
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +121 -166
- package/dist/index.umd.js.map +1 -1
- package/package.json +12 -10
- package/test/usePostgresClientDriver.test.tsx +101 -0
- package/tsconfig.json +2 -0
- package/tsconfig.prod.json +4 -1
- package/vite.config.ts +0 -1
- package/dist/client/src/admin.d.ts +0 -61
- package/dist/client/src/auth.d.ts +0 -178
- package/dist/client/src/collection.d.ts +0 -21
- package/dist/client/src/cron.d.ts +0 -25
- package/dist/client/src/functions.d.ts +0 -49
- package/dist/client/src/index.d.ts +0 -48
- package/dist/client/src/query_builder.d.ts +0 -1
- package/dist/client/src/reviver.d.ts +0 -1
- package/dist/client/src/storage.d.ts +0 -3
- package/dist/client/src/transport.d.ts +0 -33
- package/dist/client/src/websocket.d.ts +0 -105
- package/dist/types/src/controllers/analytics_controller.d.ts +0 -7
- package/dist/types/src/controllers/auth.d.ts +0 -104
- package/dist/types/src/controllers/client.d.ts +0 -168
- package/dist/types/src/controllers/collection_registry.d.ts +0 -46
- package/dist/types/src/controllers/customization_controller.d.ts +0 -60
- package/dist/types/src/controllers/data.d.ts +0 -207
- package/dist/types/src/controllers/data_driver.d.ts +0 -218
- package/dist/types/src/controllers/database_admin.d.ts +0 -11
- package/dist/types/src/controllers/dialogs_controller.d.ts +0 -36
- package/dist/types/src/controllers/effective_role.d.ts +0 -4
- package/dist/types/src/controllers/email.d.ts +0 -36
- package/dist/types/src/controllers/index.d.ts +0 -18
- package/dist/types/src/controllers/local_config_persistence.d.ts +0 -20
- package/dist/types/src/controllers/navigation.d.ts +0 -225
- package/dist/types/src/controllers/registry.d.ts +0 -63
- package/dist/types/src/controllers/side_dialogs_controller.d.ts +0 -67
- package/dist/types/src/controllers/side_entity_controller.d.ts +0 -97
- package/dist/types/src/controllers/snackbar.d.ts +0 -24
- package/dist/types/src/controllers/storage.d.ts +0 -171
- package/dist/types/src/index.d.ts +0 -4
- package/dist/types/src/rebase_context.d.ts +0 -122
- package/dist/types/src/types/auth_adapter.d.ts +0 -301
- package/dist/types/src/types/backend.d.ts +0 -571
- package/dist/types/src/types/backend_hooks.d.ts +0 -172
- package/dist/types/src/types/builders.d.ts +0 -15
- package/dist/types/src/types/chips.d.ts +0 -5
- package/dist/types/src/types/collections.d.ts +0 -961
- package/dist/types/src/types/component_ref.d.ts +0 -47
- package/dist/types/src/types/cron.d.ts +0 -102
- package/dist/types/src/types/data_source.d.ts +0 -64
- package/dist/types/src/types/database_adapter.d.ts +0 -94
- package/dist/types/src/types/entities.d.ts +0 -145
- package/dist/types/src/types/entity_actions.d.ts +0 -104
- package/dist/types/src/types/entity_callbacks.d.ts +0 -173
- package/dist/types/src/types/entity_link_builder.d.ts +0 -7
- package/dist/types/src/types/entity_overrides.d.ts +0 -10
- package/dist/types/src/types/entity_views.d.ts +0 -87
- package/dist/types/src/types/export_import.d.ts +0 -21
- package/dist/types/src/types/formex.d.ts +0 -40
- package/dist/types/src/types/index.d.ts +0 -28
- package/dist/types/src/types/locales.d.ts +0 -4
- package/dist/types/src/types/modify_collections.d.ts +0 -5
- package/dist/types/src/types/plugins.d.ts +0 -282
- package/dist/types/src/types/properties.d.ts +0 -1173
- package/dist/types/src/types/property_config.d.ts +0 -74
- package/dist/types/src/types/relations.d.ts +0 -336
- package/dist/types/src/types/slots.d.ts +0 -262
- package/dist/types/src/types/translations.d.ts +0 -900
- package/dist/types/src/types/user_management_delegate.d.ts +0 -86
- package/dist/types/src/types/websockets.d.ts +0 -78
- package/dist/types/src/users/index.d.ts +0 -1
- package/dist/types/src/users/user.d.ts +0 -50
- /package/dist/{client-postgresql/src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{client-postgresql/src/usePostgresClientDriver.d.ts → usePostgresClientDriver.d.ts} +0 -0
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { FindParams as TypesFindParams, FindResponse as TypesFindResponse } from "@rebasepro/types";
|
|
2
|
-
export interface RebaseClientConfig {
|
|
3
|
-
baseUrl?: string;
|
|
4
|
-
token?: string;
|
|
5
|
-
apiPath?: string;
|
|
6
|
-
fetch?: typeof globalThis.fetch;
|
|
7
|
-
onUnauthorized?: () => Promise<boolean>;
|
|
8
|
-
websocketUrl?: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Re-export from `@rebasepro/types` for backward compatibility.
|
|
12
|
-
*/
|
|
13
|
-
export type FindParams = TypesFindParams;
|
|
14
|
-
export type FindResponse<T> = TypesFindResponse<T extends Record<string, unknown> ? T : Record<string, unknown>>;
|
|
15
|
-
export declare class RebaseApiError extends Error {
|
|
16
|
-
status: number;
|
|
17
|
-
code?: string;
|
|
18
|
-
details?: unknown;
|
|
19
|
-
constructor(status: number, message: string, code?: string, details?: unknown);
|
|
20
|
-
}
|
|
21
|
-
export declare function buildQueryString(params?: FindParams): string;
|
|
22
|
-
export interface Transport {
|
|
23
|
-
request: <T = unknown>(path: string, init?: RequestInit) => Promise<T>;
|
|
24
|
-
setToken: (newToken: string | null) => void;
|
|
25
|
-
setAuthTokenGetter: (getter: () => Promise<string | null>) => void;
|
|
26
|
-
setOnUnauthorized: (handler: () => Promise<boolean>) => void;
|
|
27
|
-
readonly baseUrl: string;
|
|
28
|
-
readonly apiPath: string;
|
|
29
|
-
readonly fetchFn: typeof globalThis.fetch;
|
|
30
|
-
getHeaders: (init?: RequestInit) => Record<string, string>;
|
|
31
|
-
resolveToken: () => Promise<string | null>;
|
|
32
|
-
}
|
|
33
|
-
export declare function createTransport(config: RebaseClientConfig): Transport;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { DeleteEntityProps, Entity, EntityCollection, FetchCollectionProps, FetchEntityProps, SaveEntityProps, TableMetadata, BranchInfo } from "@rebasepro/types";
|
|
2
|
-
export interface RebaseWebSocketConfig {
|
|
3
|
-
websocketUrl: string;
|
|
4
|
-
/** Optional auth token getter for WebSocket authentication */
|
|
5
|
-
getAuthToken?: () => Promise<string>;
|
|
6
|
-
/** Optional WebSocket constructor to override globalThis.WebSocket (e.g. for Node environments) */
|
|
7
|
-
WebSocket?: typeof WebSocket;
|
|
8
|
-
/** Callback to handle unauthorized requests or token expiration (refreshes auth session) */
|
|
9
|
-
onUnauthorized?: () => Promise<boolean>;
|
|
10
|
-
}
|
|
11
|
-
export declare class ApiError extends Error {
|
|
12
|
-
code?: string;
|
|
13
|
-
error?: string;
|
|
14
|
-
constructor(message: string, error?: string, code?: string);
|
|
15
|
-
}
|
|
16
|
-
export declare class RebaseWebSocketClient {
|
|
17
|
-
private websocketUrl;
|
|
18
|
-
private ws;
|
|
19
|
-
getAuthToken?: () => Promise<string>;
|
|
20
|
-
private subscriptions;
|
|
21
|
-
private listeners;
|
|
22
|
-
on(event: "connect" | "disconnect" | "reconnect" | "error", cb: (...args: unknown[]) => void): () => boolean;
|
|
23
|
-
private emit;
|
|
24
|
-
private collectionSubscriptions;
|
|
25
|
-
private entitySubscriptions;
|
|
26
|
-
private backendToCollectionKey;
|
|
27
|
-
private backendToEntityKey;
|
|
28
|
-
private pendingRequests;
|
|
29
|
-
private reconnectAttempts;
|
|
30
|
-
private maxReconnectAttempts;
|
|
31
|
-
private isConnected;
|
|
32
|
-
private messageQueue;
|
|
33
|
-
private reconnectTimeout;
|
|
34
|
-
private isAuthenticated;
|
|
35
|
-
private authPromise;
|
|
36
|
-
private WebSocketConstructor;
|
|
37
|
-
onUnauthorized?: () => Promise<boolean>;
|
|
38
|
-
private refreshInProgress;
|
|
39
|
-
constructor(config: RebaseWebSocketConfig);
|
|
40
|
-
/**
|
|
41
|
-
* Authenticate the WebSocket connection
|
|
42
|
-
*/
|
|
43
|
-
authenticate(token: string): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Set the auth token getter function
|
|
46
|
-
*/
|
|
47
|
-
setAuthTokenGetter(getAuthToken: () => Promise<string>): void;
|
|
48
|
-
disconnect(): void;
|
|
49
|
-
private initWebSocket;
|
|
50
|
-
private processMessageQueue;
|
|
51
|
-
private attemptReconnect;
|
|
52
|
-
private isAuthError;
|
|
53
|
-
private handleAuthFailure;
|
|
54
|
-
private handleWebSocketMessage;
|
|
55
|
-
private ensureAuthenticated;
|
|
56
|
-
/**
|
|
57
|
-
* Force re-authentication (call after token refresh)
|
|
58
|
-
*/
|
|
59
|
-
reauthenticate(): Promise<void>;
|
|
60
|
-
private sendMessage;
|
|
61
|
-
private doSendMessage;
|
|
62
|
-
fetchCollection<M extends Record<string, unknown>>(props: FetchCollectionProps<M>): Promise<Entity<M>[]>;
|
|
63
|
-
fetchEntity<M extends Record<string, unknown>>(props: FetchEntityProps<M>): Promise<Entity<M> | undefined>;
|
|
64
|
-
saveEntity<M extends Record<string, unknown>>(props: SaveEntityProps<M>): Promise<Entity<M>>;
|
|
65
|
-
deleteEntity<M extends Record<string, unknown>>(props: DeleteEntityProps<M>): Promise<void>;
|
|
66
|
-
executeSql(sql: string, options?: {
|
|
67
|
-
database?: string;
|
|
68
|
-
role?: string;
|
|
69
|
-
}): Promise<Record<string, unknown>[]>;
|
|
70
|
-
fetchAvailableDatabases(): Promise<string[]>;
|
|
71
|
-
fetchAvailableRoles(): Promise<string[]>;
|
|
72
|
-
fetchCurrentDatabase(): Promise<string | undefined>;
|
|
73
|
-
checkUniqueField(path: string, name: string, value: unknown, entityId?: string, collection?: EntityCollection): Promise<boolean>;
|
|
74
|
-
countEntities<M extends Record<string, unknown>>(props: FetchCollectionProps<M>): Promise<number>;
|
|
75
|
-
fetchUnmappedTables(mappedPaths?: string[]): Promise<string[]>;
|
|
76
|
-
fetchTableMetadata(tableName: string): Promise<TableMetadata>;
|
|
77
|
-
createBranch(name: string, options?: {
|
|
78
|
-
source?: string;
|
|
79
|
-
}): Promise<BranchInfo>;
|
|
80
|
-
deleteBranch(name: string): Promise<void>;
|
|
81
|
-
listBranches(): Promise<BranchInfo[]>;
|
|
82
|
-
/**
|
|
83
|
-
* Recursively compare two values for structural equality.
|
|
84
|
-
* Handles primitives, null, undefined, Date, RegExp, arrays, and plain objects.
|
|
85
|
-
*/
|
|
86
|
-
private deepEqual;
|
|
87
|
-
private normalizeForComparison;
|
|
88
|
-
/**
|
|
89
|
-
* Merge incoming entities with cached data, preserving cached references
|
|
90
|
-
* for entities whose values haven't changed. This avoids unnecessary
|
|
91
|
-
* React re-renders when the server refetches all entities but most
|
|
92
|
-
* haven't actually changed.
|
|
93
|
-
*/
|
|
94
|
-
private mergeEntities;
|
|
95
|
-
listenCollection<M extends Record<string, unknown>>(props: FetchCollectionProps<M>, onUpdate: (entities: Entity[]) => void, onError?: (error: Error) => void): () => void;
|
|
96
|
-
listenEntity<M extends Record<string, unknown>>(props: FetchEntityProps<M>, onUpdate: (entity: Entity | null) => void, onError?: (error: Error) => void): () => void;
|
|
97
|
-
/**
|
|
98
|
-
* Re-send all active subscriptions to the backend after a reconnect.
|
|
99
|
-
* The server wipes subscription state when a client disconnects, so
|
|
100
|
-
* we need to re-register everything to resume receiving updates.
|
|
101
|
-
*/
|
|
102
|
-
private resubscribeAll;
|
|
103
|
-
private createCollectionSubscriptionKey;
|
|
104
|
-
private createEntitySubscriptionKey;
|
|
105
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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";
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { User } from "../users";
|
|
2
|
-
/**
|
|
3
|
-
* Capabilities advertised by an auth provider.
|
|
4
|
-
* UI components use this to show/hide features dynamically
|
|
5
|
-
* (e.g. password reset, registration, session management).
|
|
6
|
-
* @group Hooks and utilities
|
|
7
|
-
*/
|
|
8
|
-
export interface AuthCapabilities {
|
|
9
|
-
emailPasswordLogin?: boolean;
|
|
10
|
-
googleLogin?: boolean;
|
|
11
|
-
registration?: boolean;
|
|
12
|
-
passwordReset?: boolean;
|
|
13
|
-
sessionManagement?: boolean;
|
|
14
|
-
profileUpdate?: boolean;
|
|
15
|
-
emailVerification?: boolean;
|
|
16
|
-
/** List of enabled OAuth provider IDs (e.g. ["google", "github", "discord"]) */
|
|
17
|
-
enabledProviders?: string[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Controller for retrieving the logged user or performing auth related operations.
|
|
21
|
-
* Note that if you are implementing your AuthController, you probably will want
|
|
22
|
-
* to do it as the result of a hook.
|
|
23
|
-
* @group Hooks and utilities
|
|
24
|
-
*/
|
|
25
|
-
export type AuthController<USER extends User = User, ExtraData = unknown> = {
|
|
26
|
-
/**
|
|
27
|
-
* The user currently logged in
|
|
28
|
-
* The values can be: the user object, null if they skipped login
|
|
29
|
-
*/
|
|
30
|
-
user: USER | null;
|
|
31
|
-
/**
|
|
32
|
-
* Initial loading flag. It is used not to display the login screen
|
|
33
|
-
* when the app first loads, and it has not been checked whether the user
|
|
34
|
-
* is logged in or not.
|
|
35
|
-
*/
|
|
36
|
-
initialLoading?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Loading flag. It is used to display a loading screen when the user is
|
|
39
|
-
* logging in or out.
|
|
40
|
-
*/
|
|
41
|
-
authLoading: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Sign out
|
|
44
|
-
*/
|
|
45
|
-
signOut: () => Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Error initializing the authentication
|
|
48
|
-
*/
|
|
49
|
-
authError?: unknown;
|
|
50
|
-
/**
|
|
51
|
-
* Error dispatched by the auth provider
|
|
52
|
-
*/
|
|
53
|
-
authProviderError?: unknown;
|
|
54
|
-
/**
|
|
55
|
-
* You can use this method to retrieve the auth token for the current user.
|
|
56
|
-
*/
|
|
57
|
-
getAuthToken: () => Promise<string>;
|
|
58
|
-
/**
|
|
59
|
-
* Has the user skipped the login process
|
|
60
|
-
*/
|
|
61
|
-
loginSkipped: boolean;
|
|
62
|
-
extra: ExtraData;
|
|
63
|
-
setExtra: (extra: ExtraData) => void;
|
|
64
|
-
setUser?(user: USER | null): void;
|
|
65
|
-
setUserRoles?(roles: string[]): void;
|
|
66
|
-
/**
|
|
67
|
-
* Capabilities advertised by the auth provider.
|
|
68
|
-
* UI components use this to feature-detect what the backend supports.
|
|
69
|
-
*/
|
|
70
|
-
capabilities?: AuthCapabilities;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Extended auth controller with common optional auth methods.
|
|
74
|
-
* Backend implementations (Rebase backend, Firebase, Supabase, etc.)
|
|
75
|
-
* extend this with their own backend-specific extras.
|
|
76
|
-
* @group Hooks and utilities
|
|
77
|
-
*/
|
|
78
|
-
export interface AuthControllerExtended<USER extends User = User, ExtraData = unknown> extends AuthController<USER, ExtraData> {
|
|
79
|
-
/** Login with email and password */
|
|
80
|
-
emailPasswordLogin?(email: string, password: string): Promise<void>;
|
|
81
|
-
/** Login with Google — accepts an ID token, access token, or authorization code payload */
|
|
82
|
-
googleLogin?: (payload: {
|
|
83
|
-
idToken: string;
|
|
84
|
-
} | {
|
|
85
|
-
accessToken: string;
|
|
86
|
-
} | {
|
|
87
|
-
code: string;
|
|
88
|
-
redirectUri: string;
|
|
89
|
-
}) => Promise<void>;
|
|
90
|
-
/** Generic OAuth login — works with any provider. Posts payload to /auth/{providerId}. */
|
|
91
|
-
oauthLogin?: (providerId: string, payload: Record<string, unknown>) => Promise<void>;
|
|
92
|
-
/** Register a new user */
|
|
93
|
-
register?(email: string, password: string, displayName?: string): Promise<void>;
|
|
94
|
-
/** Skip login (for anonymous access if enabled) */
|
|
95
|
-
skipLogin?(): void;
|
|
96
|
-
/** Request password reset email */
|
|
97
|
-
forgotPassword?(email: string): Promise<void>;
|
|
98
|
-
/** Reset password using a token */
|
|
99
|
-
resetPassword?(token: string, password: string): Promise<void>;
|
|
100
|
-
/** Change password for the authenticated user */
|
|
101
|
-
changePassword?(oldPassword: string, newPassword: string): Promise<void>;
|
|
102
|
-
/** Update user profile */
|
|
103
|
-
updateProfile?(displayName?: string, photoURL?: string): Promise<USER>;
|
|
104
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import type { User } from "../users";
|
|
2
|
-
import type { RebaseData } from "./data";
|
|
3
|
-
import type { 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 type { 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
|
-
metadata?: Record<string, any>;
|
|
56
|
-
createdAt: string;
|
|
57
|
-
updatedAt: string;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Client-side Admin API interface.
|
|
61
|
-
* Provides user management operations.
|
|
62
|
-
* @group Admin
|
|
63
|
-
*/
|
|
64
|
-
export interface AdminAPI {
|
|
65
|
-
listUsers(): Promise<{
|
|
66
|
-
users: AdminUser[];
|
|
67
|
-
}>;
|
|
68
|
-
listUsersPaginated(options?: {
|
|
69
|
-
search?: string;
|
|
70
|
-
limit?: number;
|
|
71
|
-
offset?: number;
|
|
72
|
-
orderBy?: string;
|
|
73
|
-
orderDir?: "asc" | "desc";
|
|
74
|
-
}): Promise<{
|
|
75
|
-
users: AdminUser[];
|
|
76
|
-
total: number;
|
|
77
|
-
limit: number;
|
|
78
|
-
offset: number;
|
|
79
|
-
}>;
|
|
80
|
-
getUser(userId: string): Promise<{
|
|
81
|
-
user: AdminUser;
|
|
82
|
-
}>;
|
|
83
|
-
createUser(data: {
|
|
84
|
-
email: string;
|
|
85
|
-
displayName?: string;
|
|
86
|
-
password?: string;
|
|
87
|
-
roles?: string[];
|
|
88
|
-
metadata?: Record<string, any>;
|
|
89
|
-
}): Promise<{
|
|
90
|
-
user: AdminUser;
|
|
91
|
-
}>;
|
|
92
|
-
updateUser(userId: string, data: {
|
|
93
|
-
email?: string;
|
|
94
|
-
displayName?: string;
|
|
95
|
-
password?: string;
|
|
96
|
-
roles?: string[];
|
|
97
|
-
metadata?: Record<string, any>;
|
|
98
|
-
}): Promise<{
|
|
99
|
-
user: AdminUser;
|
|
100
|
-
}>;
|
|
101
|
-
deleteUser(userId: string): Promise<{
|
|
102
|
-
success: boolean;
|
|
103
|
-
}>;
|
|
104
|
-
bootstrap(): Promise<{
|
|
105
|
-
success: boolean;
|
|
106
|
-
message: string;
|
|
107
|
-
user: {
|
|
108
|
-
uid: string;
|
|
109
|
-
roles: string[];
|
|
110
|
-
};
|
|
111
|
-
}>;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Overarching abstraction that unites Data, Auth, Storage, and Email.
|
|
115
|
-
* Adapters for Supabase or Firebase simply need to implement this interface.
|
|
116
|
-
*/
|
|
117
|
-
export interface RebaseClient<DB = unknown> {
|
|
118
|
-
/** Unified Data access layer */
|
|
119
|
-
data: RebaseData;
|
|
120
|
-
/** Unified Authentication layer */
|
|
121
|
-
auth: AuthClient;
|
|
122
|
-
/** Unified Storage layer */
|
|
123
|
-
storage?: StorageSource;
|
|
124
|
-
/**
|
|
125
|
-
* Server-side email service.
|
|
126
|
-
*
|
|
127
|
-
* Available when SMTP (or a custom `sendEmail` function) is configured
|
|
128
|
-
* in the backend auth config. `undefined` when email is not configured.
|
|
129
|
-
*
|
|
130
|
-
* > **Note:** This is only available on the server-side `rebase` singleton.
|
|
131
|
-
* > The client-side SDK does not include an email service.
|
|
132
|
-
*/
|
|
133
|
-
email?: EmailService;
|
|
134
|
-
/** Admin API for user management */
|
|
135
|
-
admin?: AdminAPI;
|
|
136
|
-
/**
|
|
137
|
-
* The base HTTP URL of the backend server.
|
|
138
|
-
* Exposed by the SDK client (`@rebasepro/client`) and used to auto-derive
|
|
139
|
-
* the `ApiConfigProvider` URL.
|
|
140
|
-
*/
|
|
141
|
-
baseUrl?: string;
|
|
142
|
-
/**
|
|
143
|
-
* WebSocket client for realtime subscriptions and admin capabilities.
|
|
144
|
-
* Exposed by the SDK client (`@rebasepro/client`). The shape is intentionally
|
|
145
|
-
* left as `unknown` in the base interface — callers should narrow via feature
|
|
146
|
-
* detection (e.g. `typeof ws.executeSql === "function"`).
|
|
147
|
-
*/
|
|
148
|
-
ws?: unknown;
|
|
149
|
-
/**
|
|
150
|
-
* Execute raw SQL against the database.
|
|
151
|
-
*
|
|
152
|
-
* Only available server-side when the backend uses a SQL database
|
|
153
|
-
* (PostgreSQL, MySQL, etc.). `undefined` for document databases
|
|
154
|
-
* (MongoDB, Firestore) and on the client-side SDK.
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* ```typescript
|
|
158
|
-
* // In a cron job or custom function:
|
|
159
|
-
* if (ctx.client.sql) {
|
|
160
|
-
* const rows = await ctx.client.sql("SELECT count(*) FROM orders");
|
|
161
|
-
* }
|
|
162
|
-
* ```
|
|
163
|
-
*/
|
|
164
|
-
sql?(query: string, options?: {
|
|
165
|
-
database?: string;
|
|
166
|
-
role?: string;
|
|
167
|
-
}): Promise<Record<string, unknown>[]>;
|
|
168
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
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> = {
|
|
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
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
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
|
-
};
|