@rebasepro/types 0.0.1-canary.f81da60 → 0.0.1-canary.fc811d7
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/LICENSE +1 -1
- package/README.md +93 -174
- package/dist/controllers/auth.d.ts +20 -29
- package/dist/controllers/client.d.ts +364 -53
- package/dist/controllers/collection_registry.d.ts +3 -3
- package/dist/controllers/customization_controller.d.ts +11 -10
- package/dist/controllers/data.d.ts +304 -61
- package/dist/controllers/data_driver.d.ts +73 -37
- package/dist/controllers/email.d.ts +4 -2
- package/dist/controllers/index.d.ts +1 -1
- package/dist/controllers/local_config_persistence.d.ts +4 -4
- package/dist/controllers/navigation.d.ts +33 -21
- package/dist/controllers/registry.d.ts +37 -11
- package/dist/controllers/{side_entity_controller.d.ts → side_panel_controller.d.ts} +14 -7
- package/dist/controllers/storage.d.ts +39 -0
- package/dist/errors.d.ts +64 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +533 -196
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +589 -220
- package/dist/index.umd.js.map +1 -1
- package/dist/rebase_context.d.ts +25 -20
- package/dist/types/api_keys.d.ts +57 -0
- package/dist/types/auth_adapter.d.ts +443 -0
- package/dist/types/backend.d.ts +76 -29
- package/dist/types/backup.d.ts +20 -0
- package/dist/types/breadcrumbs.d.ts +26 -0
- package/dist/types/builders.d.ts +2 -2
- package/dist/types/collections.d.ts +471 -118
- package/dist/types/component_overrides.d.ts +196 -0
- package/dist/types/component_ref.d.ts +47 -0
- package/dist/types/cron.d.ts +12 -3
- package/dist/types/data_source.d.ts +92 -3
- package/dist/types/database_adapter.d.ts +111 -0
- package/dist/types/entities.d.ts +7 -7
- package/dist/types/entity_actions.d.ts +15 -9
- package/dist/types/entity_callbacks.d.ts +55 -43
- package/dist/types/entity_views.d.ts +42 -6
- package/dist/types/export_import.d.ts +1 -1
- package/dist/types/filter-operators.d.ts +153 -0
- package/dist/types/formex.d.ts +2 -2
- package/dist/types/index.d.ts +10 -2
- package/dist/types/modify_collections.d.ts +2 -2
- package/dist/types/plugins.d.ts +10 -15
- package/dist/types/policy.d.ts +191 -0
- package/dist/types/properties.d.ts +204 -62
- package/dist/types/property_config.d.ts +6 -2
- package/dist/types/relations.d.ts +3 -3
- package/dist/types/slots.d.ts +14 -14
- package/dist/types/storage_source.d.ts +83 -0
- package/dist/types/translations.d.ts +54 -13
- package/dist/types/user_management_delegate.d.ts +7 -106
- package/dist/types/websockets.d.ts +12 -13
- package/dist/users/index.d.ts +0 -1
- package/dist/users/user.d.ts +26 -10
- package/package.json +15 -12
- package/src/controllers/auth.tsx +13 -35
- package/src/controllers/client.ts +402 -38
- package/src/controllers/collection_registry.ts +3 -3
- package/src/controllers/customization_controller.tsx +12 -12
- package/src/controllers/data.ts +335 -75
- package/src/controllers/data_driver.ts +74 -40
- package/src/controllers/email.ts +4 -2
- package/src/controllers/index.ts +1 -1
- package/src/controllers/local_config_persistence.tsx +4 -4
- package/src/controllers/navigation.ts +36 -23
- package/src/controllers/registry.ts +41 -11
- package/src/controllers/{side_entity_controller.tsx → side_panel_controller.tsx} +15 -7
- package/src/controllers/storage.ts +60 -1
- package/src/errors.ts +80 -0
- package/src/index.ts +1 -0
- package/src/rebase_context.tsx +26 -20
- package/src/types/api_keys.ts +52 -0
- package/src/types/auth_adapter.ts +517 -0
- package/src/types/backend.ts +91 -40
- package/src/types/backup.ts +26 -0
- package/src/types/breadcrumbs.ts +27 -0
- package/src/types/builders.ts +2 -2
- package/src/types/collections.ts +535 -149
- package/src/types/component_overrides.ts +244 -0
- package/src/types/component_ref.ts +57 -0
- package/src/types/cron.ts +12 -3
- package/src/types/data_source.ts +111 -5
- package/src/types/database_adapter.ts +135 -0
- package/src/types/entities.ts +7 -7
- package/src/types/entity_actions.tsx +16 -9
- package/src/types/entity_callbacks.ts +58 -47
- package/src/types/entity_views.tsx +45 -6
- package/src/types/export_import.ts +1 -1
- package/src/types/filter-operators.ts +240 -0
- package/src/types/formex.ts +2 -2
- package/src/types/index.ts +11 -2
- package/src/types/modify_collections.tsx +2 -2
- package/src/types/plugins.tsx +11 -15
- package/src/types/policy.ts +229 -0
- package/src/types/properties.ts +233 -80
- package/src/types/property_config.tsx +6 -4
- package/src/types/relations.ts +3 -3
- package/src/types/slots.tsx +14 -14
- package/src/types/storage_source.ts +90 -0
- package/src/types/translations.ts +57 -13
- package/src/types/user_management_delegate.ts +7 -125
- package/src/types/websockets.ts +12 -14
- package/src/users/index.ts +1 -1
- package/src/users/user.ts +28 -10
- package/dist/types/backend_hooks.d.ts +0 -187
- package/dist/types/entity_overrides.d.ts +0 -10
- package/dist/users/roles.d.ts +0 -22
- package/src/types/backend_hooks.ts +0 -185
- package/src/types/entity_overrides.tsx +0 -11
- package/src/users/roles.ts +0 -32
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,174 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
outstanding user experience, including advanced features like **references** to
|
|
95
|
-
other collections, **markdown**, and **array reordering**.
|
|
96
|
-
|
|
97
|
-
For unsupported use cases, create your own **custom field** as a React
|
|
98
|
-
component.
|
|
99
|
-
|
|
100
|
-
Rebase also supports **conditional fields** in forms, allowing you to define
|
|
101
|
-
rules for active fields based on your logic.
|
|
102
|
-
|
|
103
|
-
### 👮 Authentication, Permissions, and Role System
|
|
104
|
-
|
|
105
|
-
Define which navigation views users can see and the operations (create, edit,
|
|
106
|
-
delete) they can perform based on your role system. You can even configure this
|
|
107
|
-
on a per-entity or collection level.
|
|
108
|
-
|
|
109
|
-
By default, Rebase supports all Firebase authorization mechanisms, but you can
|
|
110
|
-
implement your own.
|
|
111
|
-
|
|
112
|
-
### 🏹 Relational Support
|
|
113
|
-
|
|
114
|
-
Define references to entities in other collections and benefit from the
|
|
115
|
-
integrated reference fields and shortcuts.
|
|
116
|
-
|
|
117
|
-
You can also define subcollections at the entity level for nesting data in a
|
|
118
|
-
collection/document/collection model.
|
|
119
|
-
|
|
120
|
-
### 🆒 Real-Time Data
|
|
121
|
-
|
|
122
|
-
Every view in the CMS supports real-time data, making it suitable for displaying
|
|
123
|
-
constantly updated information.
|
|
124
|
-
|
|
125
|
-
Forms also support this feature, with any modified value in the database being
|
|
126
|
-
updated in any open form view as long as it hasn't been touched by the user.
|
|
127
|
-
This enables advanced cases where a Cloud Function is triggered after saving an
|
|
128
|
-
entity, modifying some values, and requiring real-time updates.
|
|
129
|
-
|
|
130
|
-
### 🗂️ File Storage
|
|
131
|
-
|
|
132
|
-
Rebase supports uploading files to Firebase Storage out of the box and provides
|
|
133
|
-
specific fields for handling single and multiple file uploads, as well as
|
|
134
|
-
reordering.
|
|
135
|
-
|
|
136
|
-
You can replace the Firebase Storage implementation with your own.
|
|
137
|
-
|
|
138
|
-
## Included example
|
|
139
|
-
|
|
140
|
-
You can access the code for the demo project under
|
|
141
|
-
[`example`](https://github.com/rebasepro/rebase/tree/master/example). It includes
|
|
142
|
-
every feature provided by this CMS.
|
|
143
|
-
|
|
144
|
-
Keep in mind you need to update the dependencies in that project if you want to
|
|
145
|
-
use it as it is, without linking it to the library source code. More details in
|
|
146
|
-
its README
|
|
147
|
-
|
|
148
|
-
## Contact and support
|
|
149
|
-
|
|
150
|
-
If you need general support, you can open a GitHub issue.
|
|
151
|
-
|
|
152
|
-
Do you need consulting setting up your Firestore-based CMS in no time? We are
|
|
153
|
-
happy to help!
|
|
154
|
-
`hello@rebase.pro`
|
|
155
|
-
|
|
156
|
-
## Development
|
|
157
|
-
|
|
158
|
-
If you would like to make changes to the source, feel free to submit a PR!
|
|
159
|
-
|
|
160
|
-
When developing, the core library can be found under `lib`.
|
|
161
|
-
There is an example project in the folder `example`.
|
|
162
|
-
|
|
163
|
-
In order to run the project, you need to create a file
|
|
164
|
-
called `firebase_config.ts`
|
|
165
|
-
in `example/src`.
|
|
166
|
-
|
|
167
|
-
That file needs to export a valid Firebase config, that you can get
|
|
168
|
-
from your Firebase console when creating a webapp for your project.
|
|
169
|
-
|
|
170
|
-
Then simply run `yarn` and `yarn dev`
|
|
171
|
-
|
|
172
|
-
## License
|
|
173
|
-
|
|
174
|
-
MIT © [Rebase](https://github.com/Rebaseco)
|
|
1
|
+
# @rebasepro/types
|
|
2
|
+
|
|
3
|
+
Shared TypeScript type definitions and interfaces for the Rebase ecosystem.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @rebasepro/types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What This Package Does
|
|
12
|
+
|
|
13
|
+
Provides the canonical type definitions used across all Rebase packages — both client-side and server-side. This is a **types-only** package with no runtime dependencies. Every other `@rebasepro/*` package depends on it.
|
|
14
|
+
|
|
15
|
+
## Key Exports
|
|
16
|
+
|
|
17
|
+
### Collection & Snapshot Types
|
|
18
|
+
|
|
19
|
+
| Export | Description |
|
|
20
|
+
|--------|-------------|
|
|
21
|
+
| `CollectionConfig` | Full collection definition (name, slug, properties, callbacks, security rules, views) |
|
|
22
|
+
| `Property` | Union type for all property configurations (text, number, date, reference, array, map, etc.) |
|
|
23
|
+
| `Snapshot` | Generic snapshot record type |
|
|
24
|
+
| `CollectionCallbacks` | Lifecycle hooks (`onPreSave`, `onSaveSuccess`, `onDelete`, etc.) |
|
|
25
|
+
| `SnapshotValues` | Record of property values for a snapshot |
|
|
26
|
+
| `SecurityRule` | RLS-style access control rule for a collection |
|
|
27
|
+
|
|
28
|
+
### Backend & Driver Interfaces
|
|
29
|
+
|
|
30
|
+
| Export | Description |
|
|
31
|
+
|--------|-------------|
|
|
32
|
+
| `DataDriver` | Abstract interface for database drivers (`fetchCollection`, `saveSnapshot`, `deleteSnapshot`, etc.) |
|
|
33
|
+
| `DatabaseAdapter` | Pluggable database adapter interface (used by `server`) |
|
|
34
|
+
| `BackendBootstrapper` | Lifecycle interface for initializing database drivers, auth, history, and realtime |
|
|
35
|
+
| `DatabaseAdmin` | Admin operations interface (SQL execution, collection stats, table metadata) |
|
|
36
|
+
| `RealtimeProvider` | Interface for realtime subscription providers |
|
|
37
|
+
| `BackendConfig` / `BackendInstance` | Abstract backend configuration and instance types |
|
|
38
|
+
| `HealthCheckResult` | Return type for health check operations |
|
|
39
|
+
| `InitializedDriver` | Result of driver initialization (driver, realtime, registry, internals) |
|
|
40
|
+
| `BootstrappedAuth` | Result of auth initialization (user service, role service, email service) |
|
|
41
|
+
|
|
42
|
+
### Auth & User Types
|
|
43
|
+
|
|
44
|
+
| Export | Description |
|
|
45
|
+
|--------|-------------|
|
|
46
|
+
| `AuthAdapter` | Pluggable auth adapter interface (for Clerk, Auth0, custom auth) |
|
|
47
|
+
| `AuthController` | Client-side auth controller interface |
|
|
48
|
+
| `RebaseUser` | User record type |
|
|
49
|
+
| `Role` | Role definition type |
|
|
50
|
+
|
|
51
|
+
### Controller Interfaces
|
|
52
|
+
|
|
53
|
+
| Export | Description |
|
|
54
|
+
|--------|-------------|
|
|
55
|
+
| `RebaseClient` | Top-level client interface (data, auth, storage, email) |
|
|
56
|
+
| `DataSourceDelegate` | Data operations interface for client-side data sources |
|
|
57
|
+
| `StorageSource` | File storage interface |
|
|
58
|
+
| `CollectionRegistryInterface` | Collection lookup and registration |
|
|
59
|
+
| `NavigationController` | App navigation interface |
|
|
60
|
+
|
|
61
|
+
### Other
|
|
62
|
+
|
|
63
|
+
| Export | Description |
|
|
64
|
+
|--------|-------------|
|
|
65
|
+
| `CronJobDefinition` | Cron job configuration type |
|
|
66
|
+
| `CollectionCallbacks` | Lifecycle callbacks for snapshot CRUD operations |
|
|
67
|
+
| `PluginConfig` | Plugin system types |
|
|
68
|
+
| `WebSocketMessage` | WebSocket protocol message types |
|
|
69
|
+
| `Locale` | Localization types |
|
|
70
|
+
|
|
71
|
+
## Quick Start
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import type {
|
|
75
|
+
CollectionConfig,
|
|
76
|
+
DataDriver,
|
|
77
|
+
DatabaseAdapter,
|
|
78
|
+
RebaseUser,
|
|
79
|
+
Property,
|
|
80
|
+
} from "@rebasepro/types";
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Related Packages
|
|
84
|
+
|
|
85
|
+
Every `@rebasepro/*` package depends on this one. Key consumers:
|
|
86
|
+
|
|
87
|
+
| Package | Uses |
|
|
88
|
+
|---------|------|
|
|
89
|
+
| `@rebasepro/server` | `DataDriver`, `DatabaseAdapter`, `BackendBootstrapper`, `AuthAdapter` |
|
|
90
|
+
| `@rebasepro/server-postgres` | `BackendBootstrapper`, `InitializedDriver`, `RealtimeProvider` |
|
|
91
|
+
| `@rebasepro/server-mongo` | `BackendBootstrapper`, `DataDriver`, `CollectionConfig` |
|
|
92
|
+
| `@rebasepro/client` | `RebaseClient`, `DataSourceDelegate`, `StorageSource` |
|
|
93
|
+
| `@rebasepro/admin` | `CollectionConfig`, `Property`, `PluginConfig`, controller interfaces |
|
|
@@ -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
|
* Capabilities advertised by an auth provider.
|
|
6
4
|
* UI components use this to show/hide features dynamically
|
|
@@ -11,7 +9,13 @@ export interface AuthCapabilities {
|
|
|
11
9
|
emailPasswordLogin?: boolean;
|
|
12
10
|
googleLogin?: boolean;
|
|
13
11
|
registration?: boolean;
|
|
12
|
+
/** Self-service password reset (emailing a reset link) is available. */
|
|
14
13
|
passwordReset?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* An admin can reset another user's password. Gates the "Reset Password"
|
|
16
|
+
* entity action in the admin UI. See `AuthAdapterCapabilities`.
|
|
17
|
+
*/
|
|
18
|
+
adminPasswordReset?: boolean;
|
|
15
19
|
sessionManagement?: boolean;
|
|
16
20
|
profileUpdate?: boolean;
|
|
17
21
|
emailVerification?: boolean;
|
|
@@ -64,7 +68,7 @@ export type AuthController<USER extends User = User, ExtraData = unknown> = {
|
|
|
64
68
|
extra: ExtraData;
|
|
65
69
|
setExtra: (extra: ExtraData) => void;
|
|
66
70
|
setUser?(user: USER | null): void;
|
|
67
|
-
setUserRoles?(roles:
|
|
71
|
+
setUserRoles?(roles: string[]): void;
|
|
68
72
|
/**
|
|
69
73
|
* Capabilities advertised by the auth provider.
|
|
70
74
|
* UI components use this to feature-detect what the backend supports.
|
|
@@ -73,15 +77,24 @@ export type AuthController<USER extends User = User, ExtraData = unknown> = {
|
|
|
73
77
|
};
|
|
74
78
|
/**
|
|
75
79
|
* Extended auth controller with common optional auth methods.
|
|
76
|
-
* Backend implementations (Rebase backend, Firebase,
|
|
80
|
+
* Backend implementations (Rebase backend, Firebase, etc.)
|
|
77
81
|
* extend this with their own backend-specific extras.
|
|
78
82
|
* @group Hooks and utilities
|
|
79
83
|
*/
|
|
80
84
|
export interface AuthControllerExtended<USER extends User = User, ExtraData = unknown> extends AuthController<USER, ExtraData> {
|
|
81
85
|
/** Login with email and password */
|
|
82
86
|
emailPasswordLogin?(email: string, password: string): Promise<void>;
|
|
83
|
-
/** Login with
|
|
84
|
-
googleLogin
|
|
87
|
+
/** Login with Google — accepts an ID token, access token, or authorization code payload */
|
|
88
|
+
googleLogin?: (payload: {
|
|
89
|
+
idToken: string;
|
|
90
|
+
} | {
|
|
91
|
+
accessToken: string;
|
|
92
|
+
} | {
|
|
93
|
+
code: string;
|
|
94
|
+
redirectUri: string;
|
|
95
|
+
}) => Promise<void>;
|
|
96
|
+
/** Generic OAuth login — works with any provider. Posts payload to /auth/{providerId}. */
|
|
97
|
+
oauthLogin?: (providerId: string, payload: Record<string, unknown>) => Promise<void>;
|
|
85
98
|
/** Register a new user */
|
|
86
99
|
register?(email: string, password: string, displayName?: string): Promise<void>;
|
|
87
100
|
/** Skip login (for anonymous access if enabled) */
|
|
@@ -95,25 +108,3 @@ export interface AuthControllerExtended<USER extends User = User, ExtraData = un
|
|
|
95
108
|
/** Update user profile */
|
|
96
109
|
updateProfile?(displayName?: string, photoURL?: string): Promise<USER>;
|
|
97
110
|
}
|
|
98
|
-
/**
|
|
99
|
-
* Implement this function to allow access to specific users.
|
|
100
|
-
* @group Hooks and utilities
|
|
101
|
-
*/
|
|
102
|
-
export type Authenticator<USER extends User = User> = (props: {
|
|
103
|
-
/**
|
|
104
|
-
* Logged-in user or null
|
|
105
|
-
*/
|
|
106
|
-
user: USER | null;
|
|
107
|
-
/**
|
|
108
|
-
* AuthController
|
|
109
|
-
*/
|
|
110
|
-
authController: AuthController<USER>;
|
|
111
|
-
/**
|
|
112
|
-
* Unified data access API
|
|
113
|
-
*/
|
|
114
|
-
data: RebaseData;
|
|
115
|
-
/**
|
|
116
|
-
* Used storage implementation
|
|
117
|
-
*/
|
|
118
|
-
storageSource: StorageSource;
|
|
119
|
-
}) => boolean | Promise<boolean>;
|