@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.
Files changed (86) hide show
  1. package/README.md +1 -1
  2. package/dist/controllers/analytics_controller.d.ts +2 -2
  3. package/dist/controllers/auth.d.ts +50 -6
  4. package/dist/controllers/client.d.ts +58 -0
  5. package/dist/controllers/collection_registry.d.ts +44 -0
  6. package/dist/controllers/customization_controller.d.ts +5 -1
  7. package/dist/controllers/data.d.ts +141 -0
  8. package/dist/controllers/{datasource.d.ts → data_driver.d.ts} +25 -36
  9. package/dist/controllers/database_admin.d.ts +11 -0
  10. package/dist/controllers/effective_role.d.ts +4 -0
  11. package/dist/controllers/index.d.ts +11 -5
  12. package/dist/controllers/navigation.d.ts +9 -58
  13. package/dist/controllers/registry.d.ts +51 -0
  14. package/dist/controllers/side_entity_controller.d.ts +1 -2
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.es.js +113 -12
  17. package/dist/index.es.js.map +1 -1
  18. package/dist/index.umd.js +112 -11
  19. package/dist/index.umd.js.map +1 -1
  20. package/dist/rebase_context.d.ts +35 -25
  21. package/dist/types/backend.d.ts +296 -17
  22. package/dist/types/builders.d.ts +14 -0
  23. package/dist/types/collections.d.ts +166 -241
  24. package/dist/types/data_source.d.ts +64 -0
  25. package/dist/types/entities.d.ts +29 -24
  26. package/dist/types/entity_actions.d.ts +7 -7
  27. package/dist/types/entity_callbacks.d.ts +4 -4
  28. package/dist/types/entity_overrides.d.ts +6 -2
  29. package/dist/types/entity_views.d.ts +61 -0
  30. package/dist/types/index.d.ts +8 -5
  31. package/dist/types/plugins.d.ts +170 -221
  32. package/dist/types/properties.d.ts +17 -29
  33. package/dist/types/property_config.d.ts +13 -11
  34. package/dist/types/slots.d.ts +228 -0
  35. package/dist/types/translations.d.ts +826 -0
  36. package/dist/types/user_management_delegate.d.ts +42 -0
  37. package/dist/types/websockets.d.ts +45 -0
  38. package/dist/users/user.d.ts +4 -0
  39. package/package.json +7 -39
  40. package/src/controllers/analytics_controller.tsx +2 -2
  41. package/src/controllers/auth.tsx +53 -6
  42. package/src/controllers/client.ts +74 -0
  43. package/src/controllers/collection_registry.ts +53 -0
  44. package/src/controllers/customization_controller.tsx +6 -1
  45. package/src/controllers/data.ts +153 -0
  46. package/src/controllers/{datasource.ts → data_driver.ts} +41 -37
  47. package/src/controllers/database_admin.ts +22 -0
  48. package/src/controllers/effective_role.ts +4 -0
  49. package/src/controllers/index.ts +14 -5
  50. package/src/controllers/navigation.ts +9 -73
  51. package/src/controllers/registry.ts +62 -0
  52. package/src/controllers/side_entity_controller.tsx +1 -2
  53. package/src/index.ts +0 -1
  54. package/src/rebase_context.tsx +37 -33
  55. package/src/types/backend.ts +351 -19
  56. package/src/types/builders.ts +16 -0
  57. package/src/types/collections.ts +196 -259
  58. package/src/types/data_source.ts +156 -0
  59. package/src/types/entities.ts +35 -28
  60. package/src/types/entity_actions.tsx +6 -6
  61. package/src/types/entity_callbacks.ts +4 -4
  62. package/src/types/entity_overrides.tsx +6 -2
  63. package/src/types/entity_views.tsx +77 -0
  64. package/src/types/index.ts +9 -5
  65. package/src/types/plugins.tsx +198 -256
  66. package/src/types/properties.ts +22 -31
  67. package/src/types/property_config.tsx +11 -11
  68. package/src/types/slots.tsx +271 -0
  69. package/src/types/translations.ts +923 -0
  70. package/src/types/user_management_delegate.ts +43 -0
  71. package/src/types/websockets.ts +48 -0
  72. package/src/users/user.ts +5 -0
  73. package/dist/components/EntityFormActionsProps.d.ts +0 -17
  74. package/dist/components/EntityFormProps.d.ts +0 -46
  75. package/dist/components/PropertyPreviewProps.d.ts +0 -50
  76. package/dist/components/formex.d.ts +0 -40
  77. package/dist/components/index.d.ts +0 -3
  78. package/dist/types/fields.d.ts +0 -221
  79. package/dist/types/rebase.d.ts +0 -180
  80. package/src/components/EntityFormActionsProps.tsx +0 -18
  81. package/src/components/EntityFormProps.tsx +0 -52
  82. package/src/components/PropertyPreviewProps.tsx +0 -61
  83. package/src/components/formex.tsx +0 -46
  84. package/src/components/index.ts +0 -3
  85. package/src/types/fields.tsx +0 -298
  86. package/src/types/rebase.tsx +0 -211
@@ -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
- };