@rebasepro/types 0.0.1-canary.2 → 0.0.1-canary.4d4fb3e
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/README.md +1 -1
- package/dist/controllers/analytics_controller.d.ts +2 -2
- package/dist/controllers/auth.d.ts +50 -6
- package/dist/controllers/client.d.ts +58 -0
- package/dist/controllers/collection_registry.d.ts +44 -0
- package/dist/controllers/customization_controller.d.ts +5 -1
- package/dist/controllers/data.d.ts +141 -0
- package/dist/controllers/{datasource.d.ts → data_driver.d.ts} +25 -36
- package/dist/controllers/database_admin.d.ts +11 -0
- package/dist/controllers/effective_role.d.ts +4 -0
- package/dist/controllers/index.d.ts +11 -5
- package/dist/controllers/navigation.d.ts +9 -58
- package/dist/controllers/registry.d.ts +51 -0
- package/dist/controllers/side_entity_controller.d.ts +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +113 -12
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +112 -11
- package/dist/index.umd.js.map +1 -1
- package/dist/rebase_context.d.ts +35 -25
- package/dist/types/backend.d.ts +296 -17
- package/dist/types/builders.d.ts +14 -0
- package/dist/types/collections.d.ts +166 -241
- package/dist/types/data_source.d.ts +64 -0
- package/dist/types/entities.d.ts +29 -24
- package/dist/types/entity_actions.d.ts +7 -7
- package/dist/types/entity_callbacks.d.ts +4 -4
- package/dist/types/entity_overrides.d.ts +6 -2
- package/dist/types/entity_views.d.ts +61 -0
- package/dist/types/index.d.ts +8 -5
- package/dist/types/plugins.d.ts +170 -221
- package/dist/types/properties.d.ts +17 -29
- package/dist/types/property_config.d.ts +13 -11
- package/dist/types/slots.d.ts +228 -0
- package/dist/types/translations.d.ts +826 -0
- package/dist/types/user_management_delegate.d.ts +42 -0
- package/dist/types/websockets.d.ts +45 -0
- package/dist/users/user.d.ts +4 -0
- package/package.json +7 -39
- package/src/controllers/analytics_controller.tsx +2 -2
- package/src/controllers/auth.tsx +53 -6
- package/src/controllers/client.ts +74 -0
- package/src/controllers/collection_registry.ts +53 -0
- package/src/controllers/customization_controller.tsx +6 -1
- package/src/controllers/data.ts +153 -0
- package/src/controllers/{datasource.ts → data_driver.ts} +41 -37
- package/src/controllers/database_admin.ts +22 -0
- package/src/controllers/effective_role.ts +4 -0
- package/src/controllers/index.ts +14 -5
- package/src/controllers/navigation.ts +9 -73
- package/src/controllers/registry.ts +62 -0
- package/src/controllers/side_entity_controller.tsx +1 -2
- package/src/index.ts +0 -1
- package/src/rebase_context.tsx +37 -33
- package/src/types/backend.ts +351 -19
- package/src/types/builders.ts +16 -0
- package/src/types/collections.ts +196 -259
- package/src/types/data_source.ts +156 -0
- package/src/types/entities.ts +35 -28
- package/src/types/entity_actions.tsx +6 -6
- package/src/types/entity_callbacks.ts +4 -4
- package/src/types/entity_overrides.tsx +6 -2
- package/src/types/entity_views.tsx +77 -0
- package/src/types/index.ts +9 -5
- package/src/types/plugins.tsx +198 -256
- package/src/types/properties.ts +22 -31
- package/src/types/property_config.tsx +11 -11
- package/src/types/slots.tsx +271 -0
- package/src/types/translations.ts +923 -0
- package/src/types/user_management_delegate.ts +43 -0
- package/src/types/websockets.ts +48 -0
- package/src/users/user.ts +5 -0
- package/dist/components/EntityFormActionsProps.d.ts +0 -17
- package/dist/components/EntityFormProps.d.ts +0 -46
- package/dist/components/PropertyPreviewProps.d.ts +0 -50
- package/dist/components/formex.d.ts +0 -40
- package/dist/components/index.d.ts +0 -3
- package/dist/types/fields.d.ts +0 -221
- package/dist/types/rebase.d.ts +0 -180
- package/src/components/EntityFormActionsProps.tsx +0 -18
- package/src/components/EntityFormProps.tsx +0 -52
- package/src/components/PropertyPreviewProps.tsx +0 -61
- package/src/components/formex.tsx +0 -46
- package/src/components/index.ts +0 -3
- package/src/types/fields.tsx +0 -298
- package/src/types/rebase.tsx +0 -211
package/src/types/rebase.tsx
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { EntityCollection, EntityCustomView } from "./collections";
|
|
3
|
-
import { PropertyConfig } from "./property_config";
|
|
4
|
-
import { Locale } from "./locales";
|
|
5
|
-
import { EntityLinkBuilder } from "./entity_link_builder";
|
|
6
|
-
import { RebasePlugin } from "./plugins";
|
|
7
|
-
import { EntityAction } from "./entity_actions";
|
|
8
|
-
import { User } from "../users";
|
|
9
|
-
import {
|
|
10
|
-
AuthController, CMSAnalyticsEvent, CMSView, DataSource, StorageSource,
|
|
11
|
-
UserConfigurationPersistence, CollectionRegistryController, CMSUrlController, NavigationStateController
|
|
12
|
-
} from "../controllers";
|
|
13
|
-
import { RebaseContext } from "../rebase_context";
|
|
14
|
-
import { UserManagementDelegate } from "./user_management_delegate";
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Controller to simulate different roles when dev mode is active.
|
|
18
|
-
* @group Models
|
|
19
|
-
*/
|
|
20
|
-
export interface EffectiveRoleController {
|
|
21
|
-
effectiveRole: string | null;
|
|
22
|
-
setEffectiveRole: (role: string | null) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Use this callback to build entity collections dynamically.
|
|
27
|
-
* You can use the user to decide which collections to show.
|
|
28
|
-
* You can also use the data source to fetch additional data to build the
|
|
29
|
-
* collections.
|
|
30
|
-
* Note: you can use any type of synchronous or asynchronous code here,
|
|
31
|
-
* including fetching data from external sources, like using the Firestore
|
|
32
|
-
* APIs directly, or a REST API.
|
|
33
|
-
* @group Models
|
|
34
|
-
*/
|
|
35
|
-
export type EntityCollectionsBuilder<EC extends EntityCollection = EntityCollection> = (params: {
|
|
36
|
-
user: User | null,
|
|
37
|
-
authController: AuthController,
|
|
38
|
-
dataSource: DataSource
|
|
39
|
-
}) => EC[] | Promise<EC[]>;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Use this callback to build custom views dynamically.
|
|
43
|
-
* You can use the user to decide which views to show.
|
|
44
|
-
* You can also use the data source to fetch additional data to build the
|
|
45
|
-
* views. Note: you can use any type of synchronous or asynchronous code here,
|
|
46
|
-
* including fetching data from external sources, like using the Firestore
|
|
47
|
-
* APIs directly, or a REST API.
|
|
48
|
-
* @group Models
|
|
49
|
-
*/
|
|
50
|
-
export type CMSViewsBuilder = (params: {
|
|
51
|
-
user: User | null,
|
|
52
|
-
authController: AuthController,
|
|
53
|
-
dataSource: DataSource
|
|
54
|
-
}) => CMSView[] | Promise<CMSView[]>;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @group Models
|
|
58
|
-
*/
|
|
59
|
-
export type RebaseProps<USER extends User> = {
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Use this function to return the components you want to render under
|
|
63
|
-
* Rebase
|
|
64
|
-
* @param props
|
|
65
|
-
*/
|
|
66
|
-
children: (props: {
|
|
67
|
-
/**
|
|
68
|
-
* Context of the app
|
|
69
|
-
*/
|
|
70
|
-
context: RebaseContext;
|
|
71
|
-
/**
|
|
72
|
-
* Is one of the main processes, auth and navigation resolving, currently
|
|
73
|
-
* loading. If you are building your custom implementation, you probably
|
|
74
|
-
* want to show a loading indicator if this flag is `true`
|
|
75
|
-
*/
|
|
76
|
-
loading: boolean;
|
|
77
|
-
}) => React.ReactNode;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* If you have a custom API key, you can use it here.
|
|
81
|
-
*/
|
|
82
|
-
apiKey?: string;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Base URL for the backend API (e.g. "http://localhost:3001").
|
|
86
|
-
* When provided, this is available via `useApiConfig()` to any hook
|
|
87
|
-
* in the tree, reducing repetitive `apiUrl` threading.
|
|
88
|
-
*/
|
|
89
|
-
apiUrl?: string;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Record of custom form fields to be used in the CMS.
|
|
93
|
-
* You can use the key to reference the custom field in
|
|
94
|
-
* the `propertyConfig` prop of a property in a collection.
|
|
95
|
-
*/
|
|
96
|
-
propertyConfigs?: Record<string, PropertyConfig>;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* This controller is in charge of resolving the collection and entity paths.
|
|
100
|
-
*/
|
|
101
|
-
collectionRegistryController: CollectionRegistryController;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* This controller is in charge of resolving the URL configurations map and building paths
|
|
105
|
-
*/
|
|
106
|
-
cmsUrlController: CMSUrlController;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* This controller is in charge of resolving the navigation views and state
|
|
110
|
-
*/
|
|
111
|
-
navigationStateController: NavigationStateController;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* List of additional custom views for entities.
|
|
115
|
-
* You can use the key to reference the custom view in
|
|
116
|
-
* the `entityViews` prop of a collection.
|
|
117
|
-
*
|
|
118
|
-
* You can also define an entity view from the UI.
|
|
119
|
-
*/
|
|
120
|
-
entityViews?: EntityCustomView[];
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* List of actions that can be performed on entities.
|
|
124
|
-
* These actions are displayed in the entity view and in the collection view.
|
|
125
|
-
* You can later reuse these actions in the `entityActions` prop of a collection,
|
|
126
|
-
* by specifying the `key` of the action.
|
|
127
|
-
*/
|
|
128
|
-
entityActions?: EntityAction[];
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Format of the dates in the CMS.
|
|
132
|
-
* Defaults to 'MMMM dd, yyyy, HH:mm:ss'
|
|
133
|
-
*/
|
|
134
|
-
dateTimeFormat?: string;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Locale of the CMS, currently only affecting dates
|
|
138
|
-
*/
|
|
139
|
-
locale?: Locale;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Connector to your database
|
|
143
|
-
*/
|
|
144
|
-
dataSource: DataSource;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Connector to your file upload/fetch implementation
|
|
148
|
-
*/
|
|
149
|
-
storageSource: StorageSource;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Delegate for implementing your auth operations.
|
|
153
|
-
*/
|
|
154
|
-
authController: AuthController<USER>;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Use this controller to access the configuration that is stored locally,
|
|
158
|
-
* and not defined in code
|
|
159
|
-
*/
|
|
160
|
-
userConfigPersistence?: UserConfigurationPersistence;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Use plugins to modify the behaviour of the CMS.
|
|
164
|
-
* DEPRECATED: use the `plugins` prop in the `useBuildNavigationController` instead.
|
|
165
|
-
* This prop will work as a fallback for the `plugins` prop in the `useBuildNavigationController`.
|
|
166
|
-
* @deprecated
|
|
167
|
-
*/
|
|
168
|
-
plugins?: RebasePlugin<any, any, any>[];
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Callback used to get analytics events from the CMS
|
|
172
|
-
*/
|
|
173
|
-
onAnalyticsEvent?: (event: CMSAnalyticsEvent, data?: object) => void;
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Optional link builder you can add to generate a button in your entity forms.
|
|
177
|
-
* The function must return a URL that gets opened when the button is clicked
|
|
178
|
-
*/
|
|
179
|
-
entityLinkBuilder?: EntityLinkBuilder;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* You can use this props to provide your own user management implementation.
|
|
183
|
-
* Note that this will not affect the UI, but it will be used to show user information
|
|
184
|
-
* in various places of the CMS, for example, to show who created or modified an entity,
|
|
185
|
-
* or to assign ownership of an entity.
|
|
186
|
-
*
|
|
187
|
-
* You can also use this data to be retrieved in your custom properties,
|
|
188
|
-
* for example, to show a list of users in a dropdown.
|
|
189
|
-
*
|
|
190
|
-
* If you are using the Rebase user management plugin, this
|
|
191
|
-
* prop will be implemented automatically.
|
|
192
|
-
*/
|
|
193
|
-
userManagement?: UserManagementDelegate;
|
|
194
|
-
|
|
195
|
-
components?: {
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Component to render when a reference is missing
|
|
199
|
-
*/
|
|
200
|
-
missingReference?: React.ComponentType<{
|
|
201
|
-
path: string,
|
|
202
|
-
}>;
|
|
203
|
-
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Controller to simulate different roles when dev mode is active.
|
|
208
|
-
*/
|
|
209
|
-
effectiveRoleController?: EffectiveRoleController;
|
|
210
|
-
|
|
211
|
-
};
|