@rebasepro/app 0.17.3 → 0.18.1

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 (185) hide show
  1. package/README.md +4 -1
  2. package/dist/components/index.d.ts +0 -3
  3. package/dist/contexts/AuthControllerContext.d.ts +2 -1
  4. package/dist/contexts/CustomizationControllerContext.d.ts +2 -1
  5. package/dist/contexts/DialogsProvider.d.ts +2 -1
  6. package/dist/contexts/RebaseDataContext.d.ts +10 -1
  7. package/dist/contexts/StorageSourceContext.d.ts +11 -1
  8. package/dist/core/RebaseProps.d.ts +2 -12
  9. package/dist/debug/index.d.ts +19 -0
  10. package/dist/debug.js +3631 -0
  11. package/dist/hooks/data/delete.d.ts +16 -7
  12. package/dist/hooks/data/save.d.ts +18 -4
  13. package/dist/hooks/index.d.ts +1 -0
  14. package/dist/hooks/useAdminModeController.d.ts +5 -4
  15. package/dist/hooks/useNavigationGroupLabel.d.ts +17 -0
  16. package/dist/hooks/useStudioBridge.d.ts +33 -0
  17. package/dist/index.es.js +2599 -6980
  18. package/dist/index.es.js.map +1 -1
  19. package/dist/vitePlugin.d.ts +22 -0
  20. package/dist/vitePlugin.js +40 -1
  21. package/package.json +42 -31
  22. package/src/auth/api.ts +0 -134
  23. package/src/auth/index.ts +0 -26
  24. package/src/auth/types.ts +0 -115
  25. package/src/auth/useRebaseAuthController.ts +0 -345
  26. package/src/collections/collection_view_config.ts +0 -76
  27. package/src/collections/entity-display-cache.ts +0 -195
  28. package/src/collections/entity-display.ts +0 -77
  29. package/src/collections/entity_image_preview.ts +0 -61
  30. package/src/collections/filter-operator-resolution.ts +0 -119
  31. package/src/collections/form-layout.ts +0 -394
  32. package/src/collections/index.ts +0 -13
  33. package/src/collections/navigation_from_path.ts +0 -123
  34. package/src/collections/navigation_utils.ts +0 -171
  35. package/src/collections/parent_references_from_path.ts +0 -59
  36. package/src/collections/property-path.ts +0 -30
  37. package/src/collections/property_presentation.ts +0 -264
  38. package/src/collections/summary-property.ts +0 -114
  39. package/src/collections/title-property.ts +0 -312
  40. package/src/components/AIIcon.tsx +0 -47
  41. package/src/components/AuthSimulationMenu.tsx +0 -0
  42. package/src/components/ConfirmationDialog.tsx +0 -48
  43. package/src/components/Debug/UIReferenceView.tsx +0 -1053
  44. package/src/components/Debug/UIStyleGuide.tsx +0 -159
  45. package/src/components/Debug/collection-views/CardViewDemo.tsx +0 -87
  46. package/src/components/Debug/collection-views/CollectionTableDemo.tsx +0 -107
  47. package/src/components/Debug/collection-views/KanbanBoardDemo.tsx +0 -89
  48. package/src/components/Debug/collection-views/index.ts +0 -3
  49. package/src/components/Debug/collection-views/sample_data.ts +0 -44
  50. package/src/components/Debug/crm-dashboard/CalendarWidget.tsx +0 -387
  51. package/src/components/Debug/crm-dashboard/CrmDashboardDemo.tsx +0 -1100
  52. package/src/components/Debug/crm-dashboard/DashboardMetrics.tsx +0 -131
  53. package/src/components/Debug/crm-dashboard/PipelineOverview.tsx +0 -288
  54. package/src/components/Debug/crm-dashboard/RecentActivity.tsx +0 -213
  55. package/src/components/Debug/crm-dashboard/TaskFilters.tsx +0 -182
  56. package/src/components/Debug/crm-dashboard/TaskTable.tsx +0 -425
  57. package/src/components/Debug/crm-dashboard/TasksView.tsx +0 -234
  58. package/src/components/ErrorTooltip.tsx +0 -12
  59. package/src/components/ErrorView.tsx +0 -94
  60. package/src/components/LanguageToggle.tsx +0 -59
  61. package/src/components/LoginView/LoginView.tsx +0 -1235
  62. package/src/components/LoginView/index.ts +0 -2
  63. package/src/components/LoginView/oauth-redirect-flow.ts +0 -184
  64. package/src/components/NotFoundPage.tsx +0 -27
  65. package/src/components/RebaseAuth.tsx +0 -27
  66. package/src/components/RebaseLogo.tsx +0 -88
  67. package/src/components/SchemaDriftBanner.tsx +0 -102
  68. package/src/components/UnsavedChangesDialog.tsx +0 -46
  69. package/src/components/UserDisplay.tsx +0 -54
  70. package/src/components/UserSelectPopover.tsx +0 -399
  71. package/src/components/UserSettingsView.tsx +0 -318
  72. package/src/components/common/index.ts +0 -6
  73. package/src/components/common/table_height.tsx +0 -21
  74. package/src/components/common/types.tsx +0 -66
  75. package/src/components/common/useColumnsIds.tsx +0 -261
  76. package/src/components/common/useDataTableController.tsx +0 -571
  77. package/src/components/common/useDebouncedData.ts +0 -49
  78. package/src/components/common/useScrollRestoration.tsx +0 -68
  79. package/src/components/index.tsx +0 -26
  80. package/src/contexts/AdminModeController.tsx +0 -11
  81. package/src/contexts/AnalyticsContext.tsx +0 -4
  82. package/src/contexts/AuthControllerContext.tsx +0 -4
  83. package/src/contexts/CollectionResolverContext.tsx +0 -24
  84. package/src/contexts/CollectionScopeContext.tsx +0 -68
  85. package/src/contexts/ComponentOverrideContext.tsx +0 -81
  86. package/src/contexts/CustomizationControllerContext.tsx +0 -4
  87. package/src/contexts/DataDriverContext.tsx +0 -4
  88. package/src/contexts/DataSourcesContext.tsx +0 -36
  89. package/src/contexts/DatabaseAdminContext.tsx +0 -4
  90. package/src/contexts/DialogsProvider.tsx +0 -56
  91. package/src/contexts/EffectiveRoleController.tsx +0 -12
  92. package/src/contexts/ModeController.tsx +0 -11
  93. package/src/contexts/RebaseClientInstanceContext.tsx +0 -7
  94. package/src/contexts/RebaseDataContext.tsx +0 -4
  95. package/src/contexts/SnackbarProvider.tsx +0 -15
  96. package/src/contexts/StorageSourceContext.tsx +0 -4
  97. package/src/contexts/StorageSourcesContext.tsx +0 -30
  98. package/src/contexts/UserConfigurationPersistenceContext.tsx +0 -4
  99. package/src/contexts/index.ts +0 -18
  100. package/src/core/PluginLifecycleManager.tsx +0 -96
  101. package/src/core/PluginProviderStack.tsx +0 -40
  102. package/src/core/Rebase.tsx +0 -488
  103. package/src/core/RebaseProps.tsx +0 -333
  104. package/src/core/RebaseRouter.tsx +0 -18
  105. package/src/core/RebaseRoutes.tsx +0 -24
  106. package/src/core/index.tsx +0 -5
  107. package/src/hooks/ApiConfigContext.tsx +0 -83
  108. package/src/hooks/data/collectionQuery.ts +0 -55
  109. package/src/hooks/data/delete.ts +0 -56
  110. package/src/hooks/data/save.ts +0 -78
  111. package/src/hooks/data/useCollection.tsx +0 -183
  112. package/src/hooks/data/useData.tsx +0 -18
  113. package/src/hooks/data/useDataOrder.ts +0 -26
  114. package/src/hooks/data/useFetch.tsx +0 -156
  115. package/src/hooks/data/useRelationSelector.tsx +0 -280
  116. package/src/hooks/index.tsx +0 -45
  117. package/src/hooks/useAdminModeController.tsx +0 -23
  118. package/src/hooks/useAnalyticsController.tsx +0 -8
  119. package/src/hooks/useAuthController.tsx +0 -15
  120. package/src/hooks/useAuthSubscription.ts +0 -130
  121. package/src/hooks/useBackendStorageSource.ts +0 -295
  122. package/src/hooks/useBridgeRegistration.tsx +0 -32
  123. package/src/hooks/useBrowserTitleAndIcon.tsx +0 -23
  124. package/src/hooks/useBuildAdminModeController.tsx +0 -29
  125. package/src/hooks/useBuildEffectiveRoleController.tsx +0 -30
  126. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +0 -83
  127. package/src/hooks/useBuildModeController.tsx +0 -73
  128. package/src/hooks/useClipboard.tsx +0 -158
  129. package/src/hooks/useCollapsedGroups.ts +0 -116
  130. package/src/hooks/useComponentOverride.tsx +0 -59
  131. package/src/hooks/useCustomizationController.tsx +0 -14
  132. package/src/hooks/useDialogsController.tsx +0 -15
  133. package/src/hooks/useEffectiveRoleController.tsx +0 -10
  134. package/src/hooks/useLargeLayout.tsx +0 -65
  135. package/src/hooks/useModeController.tsx +0 -23
  136. package/src/hooks/useNavigationBlocker.tsx +0 -108
  137. package/src/hooks/usePermissions.ts +0 -45
  138. package/src/hooks/useRebaseClient.tsx +0 -10
  139. package/src/hooks/useRebaseContext.tsx +0 -84
  140. package/src/hooks/useRebaseRegistry.tsx +0 -91
  141. package/src/hooks/useResolvedComponent.tsx +0 -195
  142. package/src/hooks/useSlot.tsx +0 -64
  143. package/src/hooks/useSnackbarController.tsx +0 -80
  144. package/src/hooks/useStorageSource.tsx +0 -11
  145. package/src/hooks/useStudioBridge.tsx +0 -258
  146. package/src/hooks/useTranslation.ts +0 -38
  147. package/src/hooks/useUnsavedChangesDialog.tsx +0 -67
  148. package/src/hooks/useUserConfigurationPersistence.tsx +0 -11
  149. package/src/i18n/RebaseI18nProvider.tsx +0 -159
  150. package/src/index.ts +0 -32
  151. package/src/internal/common.tsx +0 -28
  152. package/src/internal/useRestoreScroll.tsx +0 -69
  153. package/src/locales/de.ts +0 -941
  154. package/src/locales/en.ts +0 -1021
  155. package/src/locales/es.ts +0 -962
  156. package/src/locales/fr.ts +0 -941
  157. package/src/locales/hi.ts +0 -941
  158. package/src/locales/it.ts +0 -941
  159. package/src/locales/pt.ts +0 -949
  160. package/src/util/constants.ts +0 -7
  161. package/src/util/createFormexStub.tsx +0 -66
  162. package/src/util/entity_cache.ts +0 -242
  163. package/src/util/enums.ts +0 -34
  164. package/src/util/icon_list.ts +0 -22
  165. package/src/util/icons.tsx +0 -129
  166. package/src/util/index.ts +0 -13
  167. package/src/util/local_storage.ts +0 -66
  168. package/src/util/previews.ts +0 -127
  169. package/src/util/useStorageUploadController.tsx +0 -354
  170. package/src/vitePlugin.ts +0 -215
  171. /package/dist/{components/Debug → debug}/UIReferenceView.d.ts +0 -0
  172. /package/dist/{components/Debug → debug}/UIStyleGuide.d.ts +0 -0
  173. /package/dist/{components/Debug → debug}/collection-views/CardViewDemo.d.ts +0 -0
  174. /package/dist/{components/Debug → debug}/collection-views/CollectionTableDemo.d.ts +0 -0
  175. /package/dist/{components/Debug → debug}/collection-views/KanbanBoardDemo.d.ts +0 -0
  176. /package/dist/{components/Debug → debug}/collection-views/index.d.ts +0 -0
  177. /package/dist/{components/Debug → debug}/collection-views/sample_data.d.ts +0 -0
  178. /package/dist/{components/Debug → debug}/crm-dashboard/CalendarWidget.d.ts +0 -0
  179. /package/dist/{components/Debug → debug}/crm-dashboard/CrmDashboardDemo.d.ts +0 -0
  180. /package/dist/{components/Debug → debug}/crm-dashboard/DashboardMetrics.d.ts +0 -0
  181. /package/dist/{components/Debug → debug}/crm-dashboard/PipelineOverview.d.ts +0 -0
  182. /package/dist/{components/Debug → debug}/crm-dashboard/RecentActivity.d.ts +0 -0
  183. /package/dist/{components/Debug → debug}/crm-dashboard/TaskFilters.d.ts +0 -0
  184. /package/dist/{components/Debug → debug}/crm-dashboard/TaskTable.d.ts +0 -0
  185. /package/dist/{components/Debug → debug}/crm-dashboard/TasksView.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import { Entity, CollectionCallbacks, User } from "@rebasepro/types";
1
+ import { Entity, User } from "@rebasepro/types";
2
2
  import { RebaseContext, AdminCollection } from "@rebasepro/cms-types";
3
3
  import { RebaseData } from "@rebasepro/types";
4
4
  /**
@@ -7,26 +7,35 @@ import { RebaseData } from "@rebasepro/types";
7
7
  export type DeleteEntityWithCallbacksProps<M extends Record<string, any>, USER extends User = User> = {
8
8
  entity: Entity<M>;
9
9
  collection?: AdminCollection<M>;
10
- callbacks?: CollectionCallbacks<M, USER>;
11
10
  onDeleteSuccess?: (entity: Entity<M>) => void;
12
11
  onDeleteFailure?: (entity: Entity<M>, e: Error) => void;
13
12
  };
14
13
  /**
15
14
  * This function is in charge of deleting a entity.
16
- * It will run all the delete callbacks specified in the collection.
17
- * It is also possible to attach callbacks on save success or error, and callback
18
- * errors.
15
+ *
16
+ * It runs the collection's **`admin.browserCallbacks`** around the delete
17
+ * `beforeDelete`, then `afterDelete`. Not `callbacks`: that block belongs to
18
+ * the server, which runs it inside the delete it serves, and its bodies are
19
+ * stripped from this bundle entirely.
20
+ *
21
+ * Which matters most for a collection on a `direct`/`custom` transport, where
22
+ * the panel talks to the store itself and no server sees the delete at all —
23
+ * before this ran them, such a collection had no delete callbacks anywhere.
24
+ * This function has been named `deleteEntityWithCallbacks` since it was written
25
+ * and did not run any; it even took a `callbacks` prop and ignored it.
26
+ *
27
+ * A `beforeDelete` that throws blocks the delete, exactly as the server's does:
28
+ * nothing is sent, and `onDeleteFailure` hears about it.
19
29
  *
20
30
  * @param data
21
31
  * @param entity
22
32
  * @param collection
23
- * @param callbacks
24
33
  * @param onDeleteSuccess
25
34
  * @param onDeleteFailure
26
35
  * @param context
27
36
  * @group Hooks and utilities
28
37
  */
29
- export declare function deleteEntityWithCallbacks<M extends Record<string, any>, USER extends User>({ data, entity, collection, callbacks, onDeleteSuccess, onDeleteFailure, context }: DeleteEntityWithCallbacksProps<M> & {
38
+ export declare function deleteEntityWithCallbacks<M extends Record<string, any>, USER extends User>({ data, entity, collection, onDeleteSuccess, onDeleteFailure, context }: DeleteEntityWithCallbacksProps<M> & {
30
39
  collection: AdminCollection<M>;
31
40
  data: RebaseData;
32
41
  context: RebaseContext<USER>;
@@ -16,14 +16,28 @@ export type SaveEntityWithCallbacksProps<M extends Record<string, unknown>> = {
16
16
  };
17
17
  /**
18
18
  * This function is in charge of saving a entity.
19
- * It will run all the save callbacks specified in the collection.
20
- * It is also possible to attach callbacks on save success or error, and callback
21
- * errors.
19
+ *
20
+ * It runs the collection's **`admin.browserCallbacks`** around the write
21
+ * `beforeSave`, then `afterSave` or `afterSaveError`. Not `callbacks`: that
22
+ * block belongs to the server, which runs it inside the write it serves, and
23
+ * its bodies are stripped from this bundle entirely.
24
+ *
25
+ * Which matters most for a collection on a `direct`/`custom` transport, where
26
+ * the panel talks to the store itself and no server sees the write at all —
27
+ * before this ran them, such a collection had no write callbacks anywhere. This
28
+ * function has been named `saveEntityWithCallbacks` since it was written and
29
+ * did not run any.
30
+ *
31
+ * A `beforeSave` that throws blocks the write, exactly as the server's does:
32
+ * nothing is sent, and the error reaches `afterSaveError` and the caller.
33
+ *
34
+ * `afterSave`/`afterSaveError` below are the *caller's* UI callbacks — the
35
+ * form's "close the dialog", the table's "clear the editing state" — and are
36
+ * unrelated to the collection's. Both run: the collection's first.
22
37
  *
23
38
  * @param collection
24
39
  * @param path
25
40
  * @param entityId
26
- * @param callbacks
27
41
  * @param values
28
42
  * @param previousValues
29
43
  * @param status
@@ -29,6 +29,7 @@ export * from "./useBackendStorageSource.js";
29
29
  export * from "./usePermissions.js";
30
30
  export * from "./ApiConfigContext.js";
31
31
  export * from "./useTranslation.js";
32
+ export * from "./useNavigationGroupLabel.js";
32
33
  export * from "./useRebaseClient.js";
33
34
  export * from "./useAnalyticsController.js";
34
35
  export * from "./useUserConfigurationPersistence.js";
@@ -1,13 +1,14 @@
1
1
  /**
2
- * Use this controller to change the admin mode (developer vs editor)
2
+ * Use this controller to change the admin mode: `"cms"` for editing data,
3
+ * `"studio"` for the developer tools.
3
4
  * @group Hooks and utilities
4
5
  */
5
6
  export interface AdminModeController {
6
- mode: "cms" | "studio" | "settings";
7
- setMode: (mode: "cms" | "studio" | "settings") => void;
7
+ mode: "cms" | "studio";
8
+ setMode: (mode: "cms" | "studio") => void;
8
9
  }
9
10
  /**
10
- * Hook to retrieve the current admin mode ("developer" | "editor"), and `setMode`
11
+ * Hook to retrieve the current admin mode (`"cms"` | `"studio"`), and `setMode`
11
12
  * to change it.
12
13
  *
13
14
  * Consider that in order to use this hook you need to have a parent
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The display label for a navigation group.
3
+ *
4
+ * A group *name* is an identifier: `StudioHomePage` orders the built-in groups
5
+ * by comparing against `["Database", "Compute", …]`, `navigationGroupMappings`
6
+ * keys its icons off it, and `AppView.group` sorts views into one by string
7
+ * equality. Translating the name at the point it is declared therefore breaks
8
+ * the ordering and drops the icons in every locale but English — which is
9
+ * exactly what happened the first time the Studio tool list was translated.
10
+ *
11
+ * So the name stays English and the *label* is translated here, at the one
12
+ * place it is drawn. A group Rebase does not ship — anything an app declares
13
+ * itself — has no key and is rendered as written.
14
+ *
15
+ * @group Hooks and utilities
16
+ */
17
+ export declare function useNavigationGroupLabel(): (group: string) => string;
@@ -7,8 +7,36 @@ export type { BreadcrumbEntry, BreadcrumbsController };
7
7
  * When the admin is present, a bridge provider injects real implementations.
8
8
  * When the admin is absent, noop defaults ensure Studio works standalone.
9
9
  */
10
+ /**
11
+ * Editing a collection's source through the admin's plan/apply flow.
12
+ *
13
+ * Studio has its own writers — the RLS editor saves a policy, the collection
14
+ * editor saves a property — and until this existed they did not go to the same
15
+ * place. Saving a policy on a mapped table POSTed the rules straight to
16
+ * `/schema-editor/collection/save`: no plan, no dialog, no record of what SQL
17
+ * the change would produce, while the identical edit made two tabs away in the
18
+ * collection editor showed all three.
19
+ *
20
+ * `available` is false when there is no collection editor above this Studio —
21
+ * the hosted console against somebody else's container, or a panel that never
22
+ * enabled it — and the caller falls back to whatever it did before.
23
+ */
24
+ export interface StudioSchemaEditing {
25
+ available: boolean;
26
+ /**
27
+ * Merge `patch` into the collection and take it through plan → confirm →
28
+ * apply: the same dialog `useLiveSchemaEditing` shows the collection
29
+ * editor.
30
+ *
31
+ * Resolves once the change has been applied, or written source-only if
32
+ * that is what was chosen. Rejects with `SchemaChangeCancelled` when the
33
+ * dialog was closed — which is not an error to report, it is an answer.
34
+ */
35
+ updateCollection: (collectionId: string, patch: Record<string, unknown>) => Promise<void>;
36
+ }
10
37
  export interface StudioBridge {
11
38
  collectionRegistry: CollectionRegistryController;
39
+ schemaEditing: StudioSchemaEditing;
12
40
  sidePanelController: SidePanelController;
13
41
  urlController: UrlController;
14
42
  navigationState: NavigationStateController;
@@ -61,6 +89,11 @@ export declare function StudioBridgeProvider({ value, children }: {
61
89
  value: Partial<StudioBridge>;
62
90
  children: React.ReactNode;
63
91
  }): React.JSX.Element;
92
+ /**
93
+ * Source editing through the admin's plan/apply dialog. `available` is false
94
+ * when no collection editor is mounted.
95
+ */
96
+ export declare function useStudioSchemaEditing(): StudioSchemaEditing;
64
97
  /** Collection registry — returns noop if the admin is not present. */
65
98
  export declare function useStudioCollectionRegistry(): CollectionRegistryController;
66
99
  /** Side panel controller — returns noop if the admin is not present. */