@rebasepro/types 0.0.1-canary.e259309 → 0.0.1-canary.eb08332

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 (109) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +93 -174
  3. package/dist/controllers/auth.d.ts +20 -29
  4. package/dist/controllers/client.d.ts +364 -53
  5. package/dist/controllers/collection_registry.d.ts +5 -4
  6. package/dist/controllers/customization_controller.d.ts +11 -10
  7. package/dist/controllers/data.d.ts +304 -61
  8. package/dist/controllers/data_driver.d.ts +105 -34
  9. package/dist/controllers/email.d.ts +4 -2
  10. package/dist/controllers/index.d.ts +1 -1
  11. package/dist/controllers/local_config_persistence.d.ts +4 -4
  12. package/dist/controllers/navigation.d.ts +33 -21
  13. package/dist/controllers/registry.d.ts +37 -11
  14. package/dist/controllers/{side_entity_controller.d.ts → side_panel_controller.d.ts} +14 -7
  15. package/dist/controllers/storage.d.ts +39 -0
  16. package/dist/errors.d.ts +64 -0
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.es.js +533 -196
  19. package/dist/index.es.js.map +1 -1
  20. package/dist/index.umd.js +589 -220
  21. package/dist/index.umd.js.map +1 -1
  22. package/dist/rebase_context.d.ts +25 -20
  23. package/dist/types/api_keys.d.ts +57 -0
  24. package/dist/types/auth_adapter.d.ts +443 -0
  25. package/dist/types/backend.d.ts +76 -29
  26. package/dist/types/backup.d.ts +20 -0
  27. package/dist/types/breadcrumbs.d.ts +26 -0
  28. package/dist/types/builders.d.ts +2 -2
  29. package/dist/types/collections.d.ts +481 -127
  30. package/dist/types/component_overrides.d.ts +196 -0
  31. package/dist/types/component_ref.d.ts +47 -0
  32. package/dist/types/cron.d.ts +13 -4
  33. package/dist/types/data_source.d.ts +92 -3
  34. package/dist/types/database_adapter.d.ts +111 -0
  35. package/dist/types/entities.d.ts +7 -7
  36. package/dist/types/entity_actions.d.ts +15 -9
  37. package/dist/types/entity_callbacks.d.ts +55 -43
  38. package/dist/types/entity_views.d.ts +46 -12
  39. package/dist/types/export_import.d.ts +1 -1
  40. package/dist/types/filter-operators.d.ts +153 -0
  41. package/dist/types/formex.d.ts +40 -0
  42. package/dist/types/index.d.ts +11 -1
  43. package/dist/types/modify_collections.d.ts +2 -2
  44. package/dist/types/plugins.d.ts +16 -18
  45. package/dist/types/policy.d.ts +191 -0
  46. package/dist/types/properties.d.ts +259 -145
  47. package/dist/types/property_config.d.ts +6 -2
  48. package/dist/types/relations.d.ts +3 -3
  49. package/dist/types/slots.d.ts +34 -24
  50. package/dist/types/storage_source.d.ts +83 -0
  51. package/dist/types/translations.d.ts +58 -13
  52. package/dist/types/user_management_delegate.d.ts +7 -106
  53. package/dist/types/websockets.d.ts +12 -13
  54. package/dist/users/index.d.ts +0 -1
  55. package/dist/users/user.d.ts +26 -10
  56. package/package.json +15 -20
  57. package/src/controllers/auth.tsx +13 -35
  58. package/src/controllers/client.ts +402 -38
  59. package/src/controllers/collection_registry.ts +5 -4
  60. package/src/controllers/customization_controller.tsx +12 -12
  61. package/src/controllers/data.ts +335 -75
  62. package/src/controllers/data_driver.ts +119 -36
  63. package/src/controllers/email.ts +4 -2
  64. package/src/controllers/index.ts +1 -1
  65. package/src/controllers/local_config_persistence.tsx +4 -4
  66. package/src/controllers/navigation.ts +36 -23
  67. package/src/controllers/registry.ts +41 -11
  68. package/src/controllers/{side_entity_controller.tsx → side_panel_controller.tsx} +15 -7
  69. package/src/controllers/storage.ts +60 -1
  70. package/src/errors.ts +80 -0
  71. package/src/index.ts +1 -0
  72. package/src/rebase_context.tsx +26 -20
  73. package/src/types/api_keys.ts +52 -0
  74. package/src/types/auth_adapter.ts +517 -0
  75. package/src/types/backend.ts +91 -40
  76. package/src/types/backup.ts +26 -0
  77. package/src/types/breadcrumbs.ts +27 -0
  78. package/src/types/builders.ts +2 -2
  79. package/src/types/collections.ts +544 -158
  80. package/src/types/component_overrides.ts +244 -0
  81. package/src/types/component_ref.ts +57 -0
  82. package/src/types/cron.ts +14 -4
  83. package/src/types/data_source.ts +111 -5
  84. package/src/types/database_adapter.ts +135 -0
  85. package/src/types/entities.ts +7 -7
  86. package/src/types/entity_actions.tsx +16 -9
  87. package/src/types/entity_callbacks.ts +58 -47
  88. package/src/types/entity_views.tsx +49 -12
  89. package/src/types/export_import.ts +1 -1
  90. package/src/types/filter-operators.ts +240 -0
  91. package/src/types/formex.ts +45 -0
  92. package/src/types/index.ts +12 -1
  93. package/src/types/modify_collections.tsx +2 -2
  94. package/src/types/plugins.tsx +17 -18
  95. package/src/types/policy.ts +229 -0
  96. package/src/types/properties.ts +302 -163
  97. package/src/types/property_config.tsx +6 -4
  98. package/src/types/relations.ts +3 -3
  99. package/src/types/slots.tsx +34 -24
  100. package/src/types/storage_source.ts +90 -0
  101. package/src/types/translations.ts +62 -13
  102. package/src/types/user_management_delegate.ts +7 -125
  103. package/src/types/websockets.ts +12 -14
  104. package/src/users/index.ts +1 -1
  105. package/src/users/user.ts +28 -10
  106. package/dist/types/entity_overrides.d.ts +0 -10
  107. package/dist/users/roles.d.ts +0 -22
  108. package/src/types/entity_overrides.tsx +0 -11
  109. package/src/users/roles.ts +0 -32
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Rebase
3
+ Copyright (c) 2026 Rebase
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,174 +1,93 @@
1
- <p align="center">
2
- <img src="https://rebase.pro/img/dark_mode.webp" alt="Intro video" style="max-width: 100%;"/>
3
- </p>
4
-
5
- <p align="center">
6
- <a href="https://rebase.pro">
7
- <img src="https://rebase.pro/img/logo_small.png" width="240px" alt="Rebase logo" />
8
- </a>
9
- </p>
10
-
11
- <h1 align="center">Rebase</h1>
12
- <h3 align="center">Awesome Firebase/MongoDB-based headless CMS</h3>
13
- <p align="center"><a href="https://demo.rebase.pro">Live demo</a></p>
14
-
15
- <br />
16
-
17
-
18
- [![NPM](https://img.shields.io/npm/v/rebase.svg)](https://www.npmjs.com/package/rebase) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
19
-
20
- Designed by developers for developers, Rebase is a headless CMS and admin panel
21
- that seamlessly integrates with **Firebase and Firestore** by default, but is
22
- also
23
- compatible with any backend.
24
-
25
- Effortlessly generate **CRUD views** based on your configuration. Rebase is
26
- simple
27
- to set up for standard cases and easy to extend and customize for more specific
28
- needs.
29
-
30
- Built to produce collection and form views that naturally align with the
31
- collection/document model, Rebase covers a wide range of basic and advanced use
32
- cases. With extensibility in mind, it's easy to create your own views or modify
33
- existing ones.
34
-
35
- Rebase does **not impose any data structure** restrictions, ensuring a smooth,
36
- out-of-the-box experience for any project.
37
-
38
- ### Core technologies
39
-
40
- Rebase is based on this great technologies:
41
-
42
- - Typescript
43
- - Tailwind CSS
44
- - Firebase SDK 10
45
- - React + React Router 6
46
-
47
- ### Quickstart
48
-
49
- The easiest way to get going is to check our quickstart guide! You will just
50
- need to follow some quick steps:
51
-
52
- https://rebase.pro/docs
53
-
54
- ### Demo
55
-
56
- Check the demo with all the core functionalities.
57
-
58
- https://demo.rebase.pro
59
-
60
- > You can modify the data, but it gets periodically restored.
61
-
62
- ### Changelog
63
-
64
- https://rebase.pro/docs/changelog
65
-
66
- ## Features
67
-
68
- Rebase has been meticulously crafted to make it incredibly easy for developers
69
- to build a CMS/admin tool while offering an excellent data editing experience
70
- and a user-friendly interface for marketers and content managers.
71
-
72
- ### 🏓 Exceptional Spreadsheet View
73
-
74
- We've developed a highly efficient windowed **spreadsheet view** for
75
- collections, allowing inline editing for most common fields, as well as popup
76
- views for other cases and your custom field implementations.
77
-
78
- Featuring **real-time** support, Rebase is perfect for apps that require
79
- constant updates. It also supports **text search** (through an external provider
80
- like Algolia, if using Firestore), **filtering and sorting**, and **exporting**
81
- data.
82
-
83
- ### Robust Forms
84
-
85
- ![fields](https://rebase.pro/img/form_editing.webp)
86
-
87
- When editing an entity, Rebase offers a nested system of side dialogs for
88
- navigating through **subcollections** and accessing custom views (such as custom
89
- forms or blog previews). This functionality can also be accessed
90
- programmatically using the `useSideEntityController` hook.
91
-
92
- Rebase includes **over 20 built-in fields** with numerous customization and
93
- validation options. The components have been carefully designed for an
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 { StorageSource } from "./storage";
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: Role[]): void;
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, Supabase, etc.)
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 a Google ID token or trigger Google popup */
84
- googleLogin?(idToken: string): Promise<void>;
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>;