@rebasepro/plugin-insights 0.5.0 → 0.6.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 (303) hide show
  1. package/dist/{plugin-insights/src/components → components}/CollectionInsightsInline.d.ts +2 -1
  2. package/dist/{plugin-insights/src/components → components}/HomeCardInsightSlot.d.ts +3 -2
  3. package/dist/{plugin-insights/src/components → components}/HomeInsightsSlot.d.ts +3 -2
  4. package/dist/{plugin-insights/src/components → components}/InsightWidget.d.ts +3 -2
  5. package/dist/{plugin-insights/src/components → components}/InsightWidgetSkeleton.d.ts +3 -2
  6. package/dist/{plugin-insights/src/components → components}/InsightsScorecardView.d.ts +3 -2
  7. package/dist/{plugin-insights/src/engine → engine}/InsightsProvider.d.ts +2 -2
  8. package/dist/{plugin-insights/src/index.d.ts → index.d.ts} +1 -1
  9. package/dist/index.es.js +583 -1072
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/index.umd.js +645 -1096
  12. package/dist/index.umd.js.map +1 -1
  13. package/package.json +19 -14
  14. package/src/components/CollectionInsightsInline.tsx +3 -3
  15. package/src/components/HomeCardInsightSlot.tsx +1 -1
  16. package/src/components/HomeInsightsSlot.tsx +1 -1
  17. package/src/components/InsightWidget.tsx +4 -2
  18. package/src/components/InsightWidgetSkeleton.tsx +21 -13
  19. package/src/components/InsightsScorecardView.tsx +2 -2
  20. package/src/engine/InsightsCache.test.ts +5 -3
  21. package/src/engine/InsightsCache.ts +3 -2
  22. package/src/engine/useInsightsData.ts +3 -1
  23. package/src/index.ts +1 -1
  24. package/src/useInsightsPlugin.tsx +68 -65
  25. package/dist/common/src/collections/CollectionRegistry.d.ts +0 -56
  26. package/dist/common/src/collections/default-collections.d.ts +0 -9
  27. package/dist/common/src/collections/index.d.ts +0 -2
  28. package/dist/common/src/data/buildRebaseData.d.ts +0 -14
  29. package/dist/common/src/data/query_builder.d.ts +0 -55
  30. package/dist/common/src/index.d.ts +0 -4
  31. package/dist/common/src/util/builders.d.ts +0 -57
  32. package/dist/common/src/util/callbacks.d.ts +0 -6
  33. package/dist/common/src/util/collections.d.ts +0 -11
  34. package/dist/common/src/util/common.d.ts +0 -2
  35. package/dist/common/src/util/conditions.d.ts +0 -26
  36. package/dist/common/src/util/entities.d.ts +0 -58
  37. package/dist/common/src/util/enums.d.ts +0 -3
  38. package/dist/common/src/util/index.d.ts +0 -16
  39. package/dist/common/src/util/navigation_from_path.d.ts +0 -34
  40. package/dist/common/src/util/navigation_utils.d.ts +0 -20
  41. package/dist/common/src/util/parent_references_from_path.d.ts +0 -6
  42. package/dist/common/src/util/paths.d.ts +0 -14
  43. package/dist/common/src/util/permissions.d.ts +0 -14
  44. package/dist/common/src/util/references.d.ts +0 -2
  45. package/dist/common/src/util/relations.d.ts +0 -22
  46. package/dist/common/src/util/resolutions.d.ts +0 -72
  47. package/dist/common/src/util/storage.d.ts +0 -24
  48. package/dist/core/src/components/AIIcon.d.ts +0 -16
  49. package/dist/core/src/components/BootstrapAdminBanner.d.ts +0 -4
  50. package/dist/core/src/components/ConfirmationDialog.d.ts +0 -9
  51. package/dist/core/src/components/Debug/UIReferenceView.d.ts +0 -1
  52. package/dist/core/src/components/Debug/UIStyleGuide.d.ts +0 -1
  53. package/dist/core/src/components/ErrorTooltip.d.ts +0 -2
  54. package/dist/core/src/components/ErrorView.d.ts +0 -21
  55. package/dist/core/src/components/LanguageToggle.d.ts +0 -1
  56. package/dist/core/src/components/LoginView/LoginView.d.ts +0 -109
  57. package/dist/core/src/components/LoginView/index.d.ts +0 -2
  58. package/dist/core/src/components/NotFoundPage.d.ts +0 -1
  59. package/dist/core/src/components/RebaseAuth.d.ts +0 -10
  60. package/dist/core/src/components/RebaseLogo.d.ts +0 -7
  61. package/dist/core/src/components/UnsavedChangesDialog.d.ts +0 -9
  62. package/dist/core/src/components/UserDisplay.d.ts +0 -7
  63. package/dist/core/src/components/UserSelectPopover.d.ts +0 -62
  64. package/dist/core/src/components/UserSettingsView.d.ts +0 -1
  65. package/dist/core/src/components/common/index.d.ts +0 -6
  66. package/dist/core/src/components/common/table_height.d.ts +0 -5
  67. package/dist/core/src/components/common/types.d.ts +0 -66
  68. package/dist/core/src/components/common/useColumnsIds.d.ts +0 -9
  69. package/dist/core/src/components/common/useDataTableController.d.ts +0 -45
  70. package/dist/core/src/components/common/useDebouncedData.d.ts +0 -9
  71. package/dist/core/src/components/common/useScrollRestoration.d.ts +0 -14
  72. package/dist/core/src/components/index.d.ts +0 -17
  73. package/dist/core/src/contexts/AdminModeController.d.ts +0 -4
  74. package/dist/core/src/contexts/AnalyticsContext.d.ts +0 -3
  75. package/dist/core/src/contexts/AuthControllerContext.d.ts +0 -3
  76. package/dist/core/src/contexts/CustomizationControllerContext.d.ts +0 -3
  77. package/dist/core/src/contexts/DataDriverContext.d.ts +0 -3
  78. package/dist/core/src/contexts/DatabaseAdminContext.d.ts +0 -3
  79. package/dist/core/src/contexts/DialogsProvider.d.ts +0 -4
  80. package/dist/core/src/contexts/EffectiveRoleController.d.ts +0 -4
  81. package/dist/core/src/contexts/InternalUserManagementContext.d.ts +0 -3
  82. package/dist/core/src/contexts/ModeController.d.ts +0 -4
  83. package/dist/core/src/contexts/RebaseClientInstanceContext.d.ts +0 -6
  84. package/dist/core/src/contexts/RebaseDataContext.d.ts +0 -3
  85. package/dist/core/src/contexts/SnackbarProvider.d.ts +0 -2
  86. package/dist/core/src/contexts/StorageSourceContext.d.ts +0 -3
  87. package/dist/core/src/contexts/UserConfigurationPersistenceContext.d.ts +0 -3
  88. package/dist/core/src/contexts/index.d.ts +0 -13
  89. package/dist/core/src/core/PluginLifecycleManager.d.ts +0 -17
  90. package/dist/core/src/core/PluginProviderStack.d.ts +0 -21
  91. package/dist/core/src/core/Rebase.d.ts +0 -14
  92. package/dist/core/src/core/RebaseProps.d.ts +0 -147
  93. package/dist/core/src/core/RebaseRouter.d.ts +0 -4
  94. package/dist/core/src/core/RebaseRoutes.d.ts +0 -17
  95. package/dist/core/src/core/index.d.ts +0 -4
  96. package/dist/core/src/hooks/ApiConfigContext.d.ts +0 -24
  97. package/dist/core/src/hooks/data/delete.d.ts +0 -31
  98. package/dist/core/src/hooks/data/save.d.ts +0 -34
  99. package/dist/core/src/hooks/data/useCollectionFetch.d.ts +0 -62
  100. package/dist/core/src/hooks/data/useData.d.ts +0 -13
  101. package/dist/core/src/hooks/data/useDataOrder.d.ts +0 -12
  102. package/dist/core/src/hooks/data/useEntityFetch.d.ts +0 -43
  103. package/dist/core/src/hooks/data/useRelationSelector.d.ts +0 -52
  104. package/dist/core/src/hooks/data/useUserSelector.d.ts +0 -31
  105. package/dist/core/src/hooks/index.d.ts +0 -37
  106. package/dist/core/src/hooks/useAdminModeController.d.ts +0 -19
  107. package/dist/core/src/hooks/useAnalyticsController.d.ts +0 -5
  108. package/dist/core/src/hooks/useAuthController.d.ts +0 -11
  109. package/dist/core/src/hooks/useAuthSubscription.d.ts +0 -2
  110. package/dist/core/src/hooks/useBackendStorageSource.d.ts +0 -30
  111. package/dist/core/src/hooks/useBridgeRegistration.d.ts +0 -18
  112. package/dist/core/src/hooks/useBrowserTitleAndIcon.d.ts +0 -6
  113. package/dist/core/src/hooks/useBuildAdminModeController.d.ts +0 -6
  114. package/dist/core/src/hooks/useBuildEffectiveRoleController.d.ts +0 -8
  115. package/dist/core/src/hooks/useBuildLocalConfigurationPersistence.d.ts +0 -2
  116. package/dist/core/src/hooks/useBuildModeController.d.ts +0 -6
  117. package/dist/core/src/hooks/useClipboard.d.ts +0 -57
  118. package/dist/core/src/hooks/useCollapsedGroups.d.ts +0 -27
  119. package/dist/core/src/hooks/useCustomizationController.d.ts +0 -11
  120. package/dist/core/src/hooks/useDialogsController.d.ts +0 -11
  121. package/dist/core/src/hooks/useEffectiveRoleController.d.ts +0 -7
  122. package/dist/core/src/hooks/useInternalUserManagementController.d.ts +0 -12
  123. package/dist/core/src/hooks/useLargeLayout.d.ts +0 -1
  124. package/dist/core/src/hooks/useModeController.d.ts +0 -19
  125. package/dist/core/src/hooks/usePermissions.d.ts +0 -12
  126. package/dist/core/src/hooks/useRebaseClient.d.ts +0 -5
  127. package/dist/core/src/hooks/useRebaseContext.d.ts +0 -11
  128. package/dist/core/src/hooks/useRebaseRegistry.d.ts +0 -34
  129. package/dist/core/src/hooks/useResolvedComponent.d.ts +0 -47
  130. package/dist/core/src/hooks/useSlot.d.ts +0 -18
  131. package/dist/core/src/hooks/useSnackbarController.d.ts +0 -20
  132. package/dist/core/src/hooks/useStorageSource.d.ts +0 -7
  133. package/dist/core/src/hooks/useStudioBridge.d.ts +0 -91
  134. package/dist/core/src/hooks/useTranslation.d.ts +0 -17
  135. package/dist/core/src/hooks/useUnsavedChangesDialog.d.ts +0 -12
  136. package/dist/core/src/hooks/useUserConfigurationPersistence.d.ts +0 -8
  137. package/dist/core/src/i18n/RebaseI18nProvider.d.ts +0 -33
  138. package/dist/core/src/index.d.ts +0 -15
  139. package/dist/core/src/internal/common.d.ts +0 -3
  140. package/dist/core/src/internal/useRestoreScroll.d.ts +0 -6
  141. package/dist/core/src/locales/de.d.ts +0 -2
  142. package/dist/core/src/locales/en.d.ts +0 -10
  143. package/dist/core/src/locales/es.d.ts +0 -10
  144. package/dist/core/src/locales/fr.d.ts +0 -2
  145. package/dist/core/src/locales/hi.d.ts +0 -2
  146. package/dist/core/src/locales/it.d.ts +0 -2
  147. package/dist/core/src/locales/pt.d.ts +0 -7
  148. package/dist/core/src/util/constants.d.ts +0 -1
  149. package/dist/core/src/util/createFormexStub.d.ts +0 -2
  150. package/dist/core/src/util/entity_cache.d.ts +0 -22
  151. package/dist/core/src/util/enums.d.ts +0 -5
  152. package/dist/core/src/util/icon_list.d.ts +0 -5
  153. package/dist/core/src/util/icons.d.ts +0 -20
  154. package/dist/core/src/util/index.d.ts +0 -8
  155. package/dist/core/src/util/previews.d.ts +0 -4
  156. package/dist/core/src/util/useStorageUploadController.d.ts +0 -38
  157. package/dist/formex/src/Field.d.ts +0 -52
  158. package/dist/formex/src/Formex.d.ts +0 -7
  159. package/dist/formex/src/index.d.ts +0 -5
  160. package/dist/formex/src/types.d.ts +0 -40
  161. package/dist/formex/src/useCreateFormex.d.ts +0 -14
  162. package/dist/formex/src/utils.d.ts +0 -16
  163. package/dist/types/src/controllers/analytics_controller.d.ts +0 -7
  164. package/dist/types/src/controllers/auth.d.ts +0 -104
  165. package/dist/types/src/controllers/client.d.ts +0 -168
  166. package/dist/types/src/controllers/collection_registry.d.ts +0 -46
  167. package/dist/types/src/controllers/customization_controller.d.ts +0 -60
  168. package/dist/types/src/controllers/data.d.ts +0 -207
  169. package/dist/types/src/controllers/data_driver.d.ts +0 -218
  170. package/dist/types/src/controllers/database_admin.d.ts +0 -11
  171. package/dist/types/src/controllers/dialogs_controller.d.ts +0 -36
  172. package/dist/types/src/controllers/effective_role.d.ts +0 -4
  173. package/dist/types/src/controllers/email.d.ts +0 -36
  174. package/dist/types/src/controllers/index.d.ts +0 -18
  175. package/dist/types/src/controllers/local_config_persistence.d.ts +0 -20
  176. package/dist/types/src/controllers/navigation.d.ts +0 -225
  177. package/dist/types/src/controllers/registry.d.ts +0 -63
  178. package/dist/types/src/controllers/side_dialogs_controller.d.ts +0 -67
  179. package/dist/types/src/controllers/side_entity_controller.d.ts +0 -97
  180. package/dist/types/src/controllers/snackbar.d.ts +0 -24
  181. package/dist/types/src/controllers/storage.d.ts +0 -171
  182. package/dist/types/src/index.d.ts +0 -4
  183. package/dist/types/src/rebase_context.d.ts +0 -122
  184. package/dist/types/src/types/auth_adapter.d.ts +0 -301
  185. package/dist/types/src/types/backend.d.ts +0 -571
  186. package/dist/types/src/types/backend_hooks.d.ts +0 -172
  187. package/dist/types/src/types/builders.d.ts +0 -15
  188. package/dist/types/src/types/chips.d.ts +0 -5
  189. package/dist/types/src/types/collections.d.ts +0 -961
  190. package/dist/types/src/types/component_ref.d.ts +0 -47
  191. package/dist/types/src/types/cron.d.ts +0 -102
  192. package/dist/types/src/types/data_source.d.ts +0 -64
  193. package/dist/types/src/types/database_adapter.d.ts +0 -94
  194. package/dist/types/src/types/entities.d.ts +0 -145
  195. package/dist/types/src/types/entity_actions.d.ts +0 -104
  196. package/dist/types/src/types/entity_callbacks.d.ts +0 -173
  197. package/dist/types/src/types/entity_link_builder.d.ts +0 -7
  198. package/dist/types/src/types/entity_overrides.d.ts +0 -10
  199. package/dist/types/src/types/entity_views.d.ts +0 -87
  200. package/dist/types/src/types/export_import.d.ts +0 -21
  201. package/dist/types/src/types/formex.d.ts +0 -40
  202. package/dist/types/src/types/index.d.ts +0 -28
  203. package/dist/types/src/types/locales.d.ts +0 -4
  204. package/dist/types/src/types/modify_collections.d.ts +0 -5
  205. package/dist/types/src/types/plugins.d.ts +0 -282
  206. package/dist/types/src/types/properties.d.ts +0 -1173
  207. package/dist/types/src/types/property_config.d.ts +0 -74
  208. package/dist/types/src/types/relations.d.ts +0 -336
  209. package/dist/types/src/types/slots.d.ts +0 -262
  210. package/dist/types/src/types/translations.d.ts +0 -900
  211. package/dist/types/src/types/user_management_delegate.d.ts +0 -86
  212. package/dist/types/src/types/websockets.d.ts +0 -78
  213. package/dist/types/src/users/index.d.ts +0 -1
  214. package/dist/types/src/users/user.d.ts +0 -50
  215. package/dist/ui/src/components/Alert.d.ts +0 -12
  216. package/dist/ui/src/components/Autocomplete.d.ts +0 -21
  217. package/dist/ui/src/components/Avatar.d.ts +0 -11
  218. package/dist/ui/src/components/Badge.d.ts +0 -8
  219. package/dist/ui/src/components/BooleanSwitch.d.ts +0 -14
  220. package/dist/ui/src/components/BooleanSwitchWithLabel.d.ts +0 -17
  221. package/dist/ui/src/components/Button.d.ts +0 -14
  222. package/dist/ui/src/components/Card.d.ts +0 -8
  223. package/dist/ui/src/components/CenteredView.d.ts +0 -9
  224. package/dist/ui/src/components/Checkbox.d.ts +0 -13
  225. package/dist/ui/src/components/Chip.d.ts +0 -26
  226. package/dist/ui/src/components/CircularProgress.d.ts +0 -5
  227. package/dist/ui/src/components/CircularProgressCenter.d.ts +0 -11
  228. package/dist/ui/src/components/Collapse.d.ts +0 -9
  229. package/dist/ui/src/components/ColorPicker.d.ts +0 -30
  230. package/dist/ui/src/components/Container.d.ts +0 -8
  231. package/dist/ui/src/components/DateTimeField.d.ts +0 -24
  232. package/dist/ui/src/components/DebouncedTextField.d.ts +0 -2
  233. package/dist/ui/src/components/Dialog.d.ts +0 -39
  234. package/dist/ui/src/components/DialogActions.d.ts +0 -7
  235. package/dist/ui/src/components/DialogContent.d.ts +0 -7
  236. package/dist/ui/src/components/DialogTitle.d.ts +0 -10
  237. package/dist/ui/src/components/ErrorBoundary.d.ts +0 -33
  238. package/dist/ui/src/components/ExpandablePanel.d.ts +0 -12
  239. package/dist/ui/src/components/FileUpload.d.ts +0 -23
  240. package/dist/ui/src/components/FilterChip.d.ts +0 -34
  241. package/dist/ui/src/components/IconButton.d.ts +0 -12
  242. package/dist/ui/src/components/InfoLabel.d.ts +0 -5
  243. package/dist/ui/src/components/InputLabel.d.ts +0 -11
  244. package/dist/ui/src/components/Label.d.ts +0 -7
  245. package/dist/ui/src/components/LoadingButton.d.ts +0 -7
  246. package/dist/ui/src/components/Markdown.d.ts +0 -10
  247. package/dist/ui/src/components/Menu.d.ts +0 -23
  248. package/dist/ui/src/components/Menubar.d.ts +0 -80
  249. package/dist/ui/src/components/MultiSelect.d.ts +0 -48
  250. package/dist/ui/src/components/Paper.d.ts +0 -6
  251. package/dist/ui/src/components/Popover.d.ts +0 -24
  252. package/dist/ui/src/components/RadioGroup.d.ts +0 -28
  253. package/dist/ui/src/components/ResizablePanels.d.ts +0 -18
  254. package/dist/ui/src/components/SearchBar.d.ts +0 -26
  255. package/dist/ui/src/components/Select.d.ts +0 -43
  256. package/dist/ui/src/components/Separator.d.ts +0 -5
  257. package/dist/ui/src/components/Sheet.d.ts +0 -22
  258. package/dist/ui/src/components/Skeleton.d.ts +0 -6
  259. package/dist/ui/src/components/Slider.d.ts +0 -21
  260. package/dist/ui/src/components/Table.d.ts +0 -34
  261. package/dist/ui/src/components/Tabs.d.ts +0 -19
  262. package/dist/ui/src/components/TextField.d.ts +0 -58
  263. package/dist/ui/src/components/TextareaAutosize.d.ts +0 -43
  264. package/dist/ui/src/components/ToggleButtonGroup.d.ts +0 -30
  265. package/dist/ui/src/components/Tooltip.d.ts +0 -19
  266. package/dist/ui/src/components/Typography.d.ts +0 -36
  267. package/dist/ui/src/components/VirtualTable/VirtualTable.d.ts +0 -11
  268. package/dist/ui/src/components/VirtualTable/VirtualTableCell.d.ts +0 -21
  269. package/dist/ui/src/components/VirtualTable/VirtualTableHeader.d.ts +0 -29
  270. package/dist/ui/src/components/VirtualTable/VirtualTableHeaderRow.d.ts +0 -2
  271. package/dist/ui/src/components/VirtualTable/VirtualTableProps.d.ts +0 -249
  272. package/dist/ui/src/components/VirtualTable/VirtualTableRow.d.ts +0 -3
  273. package/dist/ui/src/components/VirtualTable/index.d.ts +0 -3
  274. package/dist/ui/src/components/VirtualTable/types.d.ts +0 -38
  275. package/dist/ui/src/components/common/SelectInputLabel.d.ts +0 -5
  276. package/dist/ui/src/components/index.d.ts +0 -58
  277. package/dist/ui/src/hooks/PortalContainerContext.d.ts +0 -31
  278. package/dist/ui/src/hooks/index.d.ts +0 -6
  279. package/dist/ui/src/hooks/useDebounceCallback.d.ts +0 -1
  280. package/dist/ui/src/hooks/useDebounceValue.d.ts +0 -1
  281. package/dist/ui/src/hooks/useDebouncedCallback.d.ts +0 -1
  282. package/dist/ui/src/hooks/useInjectStyles.d.ts +0 -7
  283. package/dist/ui/src/hooks/useOutsideAlerter.d.ts +0 -5
  284. package/dist/ui/src/icons/GitHubIcon.d.ts +0 -2
  285. package/dist/ui/src/icons/HandleIcon.d.ts +0 -1
  286. package/dist/ui/src/icons/Icon.d.ts +0 -20
  287. package/dist/ui/src/icons/cool_icon_keys.d.ts +0 -1
  288. package/dist/ui/src/icons/icon_keys.d.ts +0 -1
  289. package/dist/ui/src/icons/index.d.ts +0 -8
  290. package/dist/ui/src/index.d.ts +0 -5
  291. package/dist/ui/src/styles.d.ts +0 -12
  292. package/dist/ui/src/util/chip_colors.d.ts +0 -4
  293. package/dist/ui/src/util/cls.d.ts +0 -2
  294. package/dist/ui/src/util/debounce.d.ts +0 -10
  295. package/dist/ui/src/util/hash.d.ts +0 -1
  296. package/dist/ui/src/util/index.d.ts +0 -4
  297. package/dist/ui/src/util/key_to_icon_component.d.ts +0 -1
  298. /package/dist/{plugin-insights/src/engine → engine}/InsightsCache.d.ts +0 -0
  299. /package/dist/{plugin-insights/src/engine → engine}/useInsightsData.d.ts +0 -0
  300. /package/dist/{plugin-insights/src/types → types}/engine.d.ts +0 -0
  301. /package/dist/{plugin-insights/src/types → types}/index.d.ts +0 -0
  302. /package/dist/{plugin-insights/src/types → types}/widgets.d.ts +0 -0
  303. /package/dist/{plugin-insights/src/useInsightsPlugin.d.ts → useInsightsPlugin.d.ts} +0 -0
@@ -42,76 +42,79 @@ import { CollectionInsightsInline } from "./components/CollectionInsightsInline"
42
42
  */
43
43
  export function useInsightsPlugin(config: InsightsPluginConfig): RebasePlugin {
44
44
  const { insights, cacheTTL } = config;
45
- const slots: SlotContribution[] = [];
46
45
 
47
- // ── Home page insights ────────────────────────────────────────────
48
- if (insights.home && insights.home.length > 0) {
49
- const homeInsights = insights.home;
50
- slots.push({
51
- slot: "home.children.start" as const,
52
- Component: (props: Record<string, unknown>) => (
53
- <HomeInsightsSlot
54
- {...props}
55
- insights={homeInsights}
56
- />
57
- ),
58
- order: 10,
59
- });
60
- }
46
+ return React.useMemo(() => {
47
+ const slots: SlotContribution[] = [];
61
48
 
62
- // ── Per-collection insights ───────────────────────────────────────
63
- // A single `collections.<slug>` definition serves two slots:
64
- // 1. collection.insights → inline scorecards in the list view
65
- // 2. home.card.insight → compact scorecards on the home card
66
- if (insights.collections) {
67
- for (const [slug, defs] of Object.entries(insights.collections)) {
68
- if (defs.length === 0) continue;
69
- const collectionInsights = defs;
70
-
71
- // 1. Inline in collection list view
49
+ // ── Home page insights ────────────────────────────────────────────
50
+ if (insights.home && insights.home.length > 0) {
51
+ const homeInsights = insights.home;
72
52
  slots.push({
73
- slot: "collection.insights" as const,
74
- Component: (props: Record<string, unknown>) => {
75
- const path = props.path as string;
76
- const collectionSlug = path?.split("/").filter(Boolean).pop() ?? "";
77
- if (collectionSlug !== slug) return null;
78
- return (
79
- <CollectionInsightsInline
80
- {...props as { path: string; collection: unknown; parentCollectionSlugs: string[], parentEntityIds: string[] }}
81
- insights={collectionInsights}
82
- />
83
- );
84
- },
85
- order: 10,
53
+ slot: "home.children.start" as const,
54
+ Component: (props: Record<string, unknown>) => (
55
+ <HomeInsightsSlot
56
+ {...props}
57
+ insights={homeInsights}
58
+ />
59
+ ),
60
+ order: 10
86
61
  });
62
+ }
87
63
 
88
- // 2. Auto-extract scorecards for home page card
89
- slots.push({
90
- slot: "home.card.insight" as const,
91
- Component: (props: Record<string, unknown>) => {
92
- const cardSlug = props.slug as string;
93
- if (cardSlug !== slug) return null;
94
- return (
95
- <HomeCardInsightSlot
96
- {...props as { slug: string; collection: unknown; context: unknown }}
97
- insights={collectionInsights}
98
- />
99
- );
100
- },
101
- order: 10,
102
- });
64
+ // ── Per-collection insights ───────────────────────────────────────
65
+ // A single `collections.<slug>` definition serves two slots:
66
+ // 1. collection.insights → inline scorecards in the list view
67
+ // 2. home.card.insight → compact scorecards on the home card
68
+ if (insights.collections) {
69
+ for (const [slug, defs] of Object.entries(insights.collections)) {
70
+ if (defs.length === 0) continue;
71
+ const collectionInsights = defs;
72
+
73
+ // 1. Inline in collection list view
74
+ slots.push({
75
+ slot: "collection.insights" as const,
76
+ Component: (props: Record<string, unknown>) => {
77
+ const path = props.path as string;
78
+ const collectionSlug = path?.split("/").filter(Boolean).pop() ?? "";
79
+ if (collectionSlug !== slug) return null;
80
+ return (
81
+ <CollectionInsightsInline
82
+ {...props as { path: string; collection: unknown; parentCollectionSlugs: string[], parentEntityIds: string[] }}
83
+ insights={collectionInsights}
84
+ />
85
+ );
86
+ },
87
+ order: 10
88
+ });
89
+
90
+ // 2. Auto-extract scorecards for home page card
91
+ slots.push({
92
+ slot: "home.card.insight" as const,
93
+ Component: (props: Record<string, unknown>) => {
94
+ const cardSlug = props.slug as string;
95
+ if (cardSlug !== slug) return null;
96
+ return (
97
+ <HomeCardInsightSlot
98
+ {...props as { slug: string; collection: unknown; context: unknown }}
99
+ insights={collectionInsights}
100
+ />
101
+ );
102
+ },
103
+ order: 10
104
+ });
105
+ }
103
106
  }
104
- }
105
107
 
106
- return {
107
- key: "plugin-insights",
108
- slots,
109
- providers: [
110
- {
111
- scope: "root" as const,
112
- Component: InsightsProvider as React.ComponentType<React.PropsWithChildren<Record<string, unknown>>>,
113
- props: { cacheTTL },
114
- },
115
- ],
116
- };
108
+ return {
109
+ key: "plugin-insights",
110
+ slots,
111
+ providers: [
112
+ {
113
+ scope: "root" as const,
114
+ Component: InsightsProvider as React.ComponentType<React.PropsWithChildren<Record<string, unknown>>>,
115
+ props: { cacheTTL }
116
+ }
117
+ ]
118
+ };
119
+ }, [insights, cacheTTL]);
117
120
  }
@@ -1,56 +0,0 @@
1
- import { EntityCollection } from "@rebasepro/types";
2
- export declare class CollectionRegistry {
3
- private collectionsByTableName;
4
- private collectionsBySlug;
5
- private rootCollections;
6
- private cachedCollectionsList;
7
- private rawCollectionsByTableName;
8
- private rawCollectionsBySlug;
9
- private rawRootCollections;
10
- private cachedRawCollectionsList;
11
- private lastRawInputSnapshot;
12
- constructor(collections?: EntityCollection[]);
13
- reset(): void;
14
- /**
15
- * Registers a collection and its subcollections recursively.
16
- * Returns true if the collections have changed, false otherwise.
17
- *
18
- * Idempotent: compares the raw input (before normalization) against a stored
19
- * snapshot. Only re-normalizes and re-registers when the raw input actually changed.
20
- * @param collections
21
- */
22
- registerMultiple(collections: EntityCollection[]): boolean;
23
- register(collection: EntityCollection, rawCollection?: EntityCollection): void;
24
- private _registerRecursively;
25
- normalizeCollection(collection: EntityCollection): EntityCollection;
26
- /**
27
- * Extract Relation[] from properties that have inline relation config (i.e. `target` is set).
28
- * This allows developers to define relations directly on properties without a separate
29
- * `relations[]` entry on the collection.
30
- */
31
- private extractRelationsFromProperties;
32
- private normalizeProperties;
33
- private normalizeProperty;
34
- get(path: string): EntityCollection | undefined;
35
- /**
36
- * Gets the pristine, un-normalized collection exactly as it was provided.
37
- * Useful for the AST editor so it doesn't accidentally serialize injected metadata back to disk.
38
- */
39
- getRaw(path: string): EntityCollection | undefined;
40
- /**
41
- * Get collection by resolving multi-segment paths through relations
42
- * e.g., "authors/70/posts" resolves to the posts collection
43
- */
44
- getCollectionByPath(collectionPath: string): EntityCollection | undefined;
45
- getCollections(): EntityCollection[];
46
- getRawCollections(): EntityCollection[];
47
- /**
48
- * Resolves a multi-segment path like "products/123/locales" and returns
49
- * information about the collections and entity IDs along the path
50
- */
51
- resolvePathToCollections(path: string): {
52
- collections: EntityCollection[];
53
- entityIds: (string | number)[];
54
- finalCollection: EntityCollection;
55
- };
56
- }
@@ -1,9 +0,0 @@
1
- import type { PostgresCollection } from "@rebasepro/types";
2
- /**
3
- * Default users collection.
4
- *
5
- * Prepended to the developer's collections array by the admin and server.
6
- * Slug-based dedup (Map keyed by slug, last-write-wins) lets developers
7
- * override by defining their own collection with `slug: "users"`.
8
- */
9
- export declare const defaultUsersCollection: PostgresCollection;
@@ -1,2 +0,0 @@
1
- export * from "./CollectionRegistry";
2
- export * from "./default-collections";
@@ -1,14 +0,0 @@
1
- import { DataDriver, RebaseData } from "@rebasepro/types";
2
- /**
3
- * Build a `RebaseData` object from a `DataDriver` using JavaScript Proxy.
4
- *
5
- * This is the key bridge: any property access like `data.products` returns
6
- * a `CollectionAccessor` backed by the underlying DataDriver, without
7
- * needing per-collection code generation.
8
- *
9
- * @example
10
- * const data = buildRebaseData(driver);
11
- * await data.products.create({ name: "Camera", price: 299 });
12
- * const { data: items } = await data.products.find({ where: { status: "eq.published" } });
13
- */
14
- export declare function buildRebaseData(driver: DataDriver): RebaseData;
@@ -1,55 +0,0 @@
1
- import { FindResponse, CollectionAccessor, QueryBuilderInterface, FilterOperator, LogicalCondition, WhereValue, FilterCondition } from "@rebasepro/types";
2
- export declare function or(...conditions: (FilterCondition | LogicalCondition)[]): LogicalCondition;
3
- export declare function and(...conditions: (FilterCondition | LogicalCondition)[]): LogicalCondition;
4
- export declare function cond(column: string, operator: FilterOperator, value: unknown): FilterCondition;
5
- export declare class QueryBuilder<M extends Record<string, unknown> = Record<string, unknown>> implements QueryBuilderInterface<M> {
6
- private collection;
7
- private params;
8
- constructor(collection: CollectionAccessor<M>);
9
- /**
10
- * Add a filter condition to your query.
11
- * @example
12
- * client.collection('users').where('age', '>=', 18).find()
13
- */
14
- where<K extends keyof M & string>(column: K, operator: FilterOperator, value: WhereValue<M[K]>): this;
15
- where(logicalCondition: LogicalCondition): this;
16
- /**
17
- * Order the results by a specific column.
18
- * @example
19
- * client.collection('users').orderBy('createdAt', 'desc').find()
20
- */
21
- orderBy(column: keyof M & string, ascending?: "asc" | "desc"): this;
22
- /**
23
- * Limit the number of results returned.
24
- */
25
- limit(count: number): this;
26
- /**
27
- * Skip the first N results.
28
- */
29
- offset(count: number): this;
30
- /**
31
- * Set a free-text search string if supported by the backend.
32
- */
33
- search(searchString: string): this;
34
- /**
35
- * Include related entities in the response.
36
- * Relations will be populated with full entity data instead of just IDs.
37
- *
38
- * @param relations - Relation names to include, or "*" for all.
39
- * @example
40
- * // Include specific relations
41
- * client.data.posts.include("tags", "author").find()
42
- *
43
- * // Include all relations
44
- * client.data.posts.include("*").find()
45
- */
46
- include(...relations: string[]): this;
47
- /**
48
- * Execute the find query and return the results.
49
- */
50
- find(): Promise<FindResponse<M>>;
51
- /**
52
- * Listen to realtime updates matching this query.
53
- */
54
- listen(onUpdate: (data: FindResponse<M>) => void, onError?: (error: Error) => void): () => void;
55
- }
@@ -1,4 +0,0 @@
1
- export * from "./util";
2
- export * from "./collections";
3
- export * from "./data/buildRebaseData";
4
- export * from "./data/query_builder";
@@ -1,57 +0,0 @@
1
- import { AdditionalFieldDelegate, ArrayProperty, BooleanProperty, DateProperty, EntityCallbacks, EntityCollection, EnumValueConfig, EnumValues, GeopointProperty, MapProperty, NumberProperty, Properties, Property, ReferenceProperty, StringProperty, User } from "@rebasepro/types";
2
- /**
3
- * Identity function we use to defeat the type system of Typescript and build
4
- * collection views with all its properties
5
- * @param collection
6
- * @group Builder
7
- */
8
- export declare function buildCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User>(collection: EntityCollection<M, USER>): EntityCollection<M, USER>;
9
- /**
10
- * Identity function we use to defeat the type system of Typescript and preserve
11
- * the property keys.
12
- * @param property
13
- * @group Builder
14
- */
15
- export declare function buildProperty<T, P extends Property = Property>(property: P): P extends StringProperty ? StringProperty : P extends NumberProperty ? NumberProperty : P extends BooleanProperty ? BooleanProperty : P extends DateProperty ? DateProperty : P extends GeopointProperty ? GeopointProperty : P extends ReferenceProperty ? ReferenceProperty : P extends ArrayProperty ? ArrayProperty : P extends MapProperty ? MapProperty : never;
16
- /**
17
- * Identity function we use to defeat the type system of Typescript and preserve
18
- * the properties keys.
19
- * @param properties
20
- * @group Builder
21
- */
22
- export declare function buildProperties<M extends Record<string, unknown>>(properties: Properties): Properties;
23
- /**
24
- * Identity function we use to defeat the type system of Typescript and preserve
25
- * the properties keys.
26
- * @param propertiesOrBuilder
27
- * @group Builder
28
- */
29
- export declare function buildPropertiesOrBuilder<M extends Record<string, unknown>>(propertiesOrBuilder: Properties): Properties;
30
- /**
31
- * Identity function we use to defeat the type system of Typescript and preserve
32
- * the properties keys.
33
- * @param enumValues
34
- * @group Builder
35
- */
36
- export declare function buildEnum(enumValues: EnumValues): EnumValues;
37
- /**
38
- * Identity function we use to defeat the type system of Typescript and preserve
39
- * the properties keys.
40
- * @param enumValueConfig
41
- * @group Builder
42
- */
43
- export declare function buildEnumValueConfig(enumValueConfig: EnumValueConfig): EnumValueConfig;
44
- /**
45
- * Identity function we use to defeat the type system of Typescript and preserve
46
- * the properties keys.
47
- * @param callbacks
48
- * @group Builder
49
- */
50
- export declare function buildEntityCallbacks<M extends Record<string, unknown> = Record<string, unknown>>(callbacks: EntityCallbacks<M>): EntityCallbacks<M>;
51
- /**
52
- * Identity function we use to defeat the type system of Typescript and build
53
- * additional field delegates views with all its properties
54
- * @param additionalFieldDelegate
55
- * @group Builder
56
- */
57
- export declare function buildAdditionalFieldDelegate<M extends Record<string, unknown>, USER extends User = User>(additionalFieldDelegate: AdditionalFieldDelegate<M, USER>): AdditionalFieldDelegate<M, USER>;
@@ -1,6 +0,0 @@
1
- import { EntityCallbacks, Properties } from "@rebasepro/types";
2
- /**
3
- * Helper function to extract field-level PropertyCallbacks from a properties schema
4
- * and wrap them into an EntityCallbacks object recursively.
5
- */
6
- export declare const buildPropertyCallbacks: (properties: Properties) => EntityCallbacks | undefined;
@@ -1,11 +0,0 @@
1
- import { DefaultSelectedViewBuilder, DefaultSelectedViewParams, EntityCollection, Properties } from "@rebasepro/types";
2
- export declare function sortProperties<M extends Record<string, unknown>>(properties: Properties, propertiesOrder?: string[]): Properties;
3
- export declare function resolveDefaultSelectedView(defaultSelectedView: string | DefaultSelectedViewBuilder | undefined, params: DefaultSelectedViewParams): string | undefined;
4
- export declare function getLocalChangesBackup(collection: EntityCollection): "manual_apply" | "auto_apply";
5
- /**
6
- * Returns the primary keys for an entity collection by inspecting the properties
7
- * and finding any properties with `isId`.
8
- * Fallbacks to `["id"]` if no properties are marked as `isId: true`.
9
- * @param collection
10
- */
11
- export declare function getPrimaryKeys<M extends Record<string, unknown>>(collection: EntityCollection<M>): Extract<keyof M, string>[];
@@ -1,2 +0,0 @@
1
- export declare const DEFAULT_ONE_OF_TYPE = "type";
2
- export declare const DEFAULT_ONE_OF_VALUE = "value";
@@ -1,26 +0,0 @@
1
- import { AuthController, ConditionContext, JsonLogicRule, Property } from "@rebasepro/types";
2
- /**
3
- * Register custom JSON Logic operations for Rebase.
4
- * Call this once at app initialization.
5
- */
6
- export declare function registerConditionOperations(): void;
7
- /**
8
- * Evaluate a JSON Logic rule against the given context.
9
- */
10
- export declare function evaluateCondition(rule: JsonLogicRule, context: ConditionContext): unknown;
11
- /**
12
- * Build a ConditionContext from the current property resolution context.
13
- */
14
- export declare function buildConditionContext(params: {
15
- propertyKey?: string;
16
- values?: Record<string, unknown>;
17
- previousValues?: Record<string, unknown>;
18
- path: string;
19
- entityId?: string;
20
- index?: number;
21
- authController: AuthController;
22
- }): ConditionContext;
23
- /**
24
- * Apply PropertyConditions to a resolved property, evaluating all JSON Logic rules.
25
- */
26
- export declare function applyPropertyConditions(property: Property, context: ConditionContext): Property;
@@ -1,58 +0,0 @@
1
- import { DataType, Entity, EntityReference, EntityRelation, EntityStatus, EntityValues, Properties, Property } from "@rebasepro/types";
2
- export declare function isReadOnly(property: Property): boolean;
3
- export declare function isHidden(property: Property): boolean;
4
- export declare function isPropertyBuilder(property?: Property): boolean;
5
- export declare function getDefaultValuesFor<M extends Record<string, unknown>>(properties: Properties): Partial<EntityValues<M>>;
6
- export declare function getDefaultValueFor(property?: Property): unknown;
7
- export declare function getDefaultValueFortype(type: DataType): unknown;
8
- /**
9
- * Update the automatic values in an entity before save
10
- * @group Driver
11
- */
12
- export declare function updateDateAutoValues<M extends Record<string, unknown>>({ inputValues, properties, status, timestampNowValue }: {
13
- inputValues: Partial<EntityValues<M>>;
14
- properties: Properties;
15
- status: EntityStatus;
16
- timestampNowValue: unknown;
17
- }): EntityValues<M>;
18
- /**
19
- * Add missing required fields, expected in the collection, to the values of an entity
20
- * @param values
21
- * @param properties
22
- * @group Driver
23
- */
24
- export declare function sanitizeData<M extends Record<string, unknown>>(values: EntityValues<M>, properties: Properties): Record<string, unknown>;
25
- export declare function getReferenceFrom<M extends Record<string, unknown>>(entity: Entity<M>): EntityReference;
26
- export declare function getRelationFrom<M extends Record<string, unknown>>(entity: Entity<M>): EntityRelation;
27
- /**
28
- * Normalize a value into a proper EntityRelation instance.
29
- * Handles EntityRelation class instances, and plain objects
30
- * with `__type === "relation"` or an `isEntityRelation()` method.
31
- *
32
- * Returns null if the value cannot be coerced.
33
- */
34
- export declare function normalizeToEntityRelation(value: unknown): EntityRelation | null;
35
- export declare function traverseValuesProperties<M extends Record<string, unknown>>(inputValues: Partial<EntityValues<M>>, properties: Properties, operation: (value: unknown, property: Property) => unknown): EntityValues<M> | undefined;
36
- export declare function traverseValueProperty(inputValue: unknown, property: Property, operation: (value: unknown, property: Property) => unknown): unknown;
37
- /**
38
- * Relation reference types used throughout the server layer.
39
- * These replace the 50+ manual `{ id, path, __type: "relation" }` constructions.
40
- */
41
- export interface RelationRef {
42
- readonly id: string | number;
43
- readonly path: string;
44
- readonly __type: "relation";
45
- }
46
- export interface RelationRefWithData extends RelationRef {
47
- readonly data: Entity;
48
- }
49
- /**
50
- * Create a lightweight relation stub for CMS views.
51
- * Replaces inline `{ id, path, __type: "relation" }` object literals.
52
- */
53
- export declare function createRelationRef(id: string | number, path: string): RelationRef;
54
- /**
55
- * Create a hydrated relation reference that includes the full entity data.
56
- * Used when entity data has been pre-fetched (e.g., via batch loading or JOINs).
57
- */
58
- export declare function createRelationRefWithData(id: string | number, path: string, data: Entity): RelationRefWithData;
@@ -1,3 +0,0 @@
1
- import { EnumValueConfig, EnumValues } from "@rebasepro/types";
2
- export declare function enumToObjectEntries(enumValues: EnumValues): EnumValueConfig[];
3
- export declare function getLabelOrConfigFrom(enumValues: EnumValueConfig[], key?: string | number): EnumValueConfig | undefined;
@@ -1,16 +0,0 @@
1
- export * from "./collections";
2
- export * from "./common";
3
- export * from "./entities";
4
- export * from "./enums";
5
- export * from "./paths";
6
- export * from "./resolutions";
7
- export * from "./permissions";
8
- export * from "./references";
9
- export * from "./navigation_from_path";
10
- export * from "./parent_references_from_path";
11
- export * from "./builders";
12
- export * from "./storage";
13
- export * from "./callbacks";
14
- export * from "./relations";
15
- export * from "./conditions";
16
- export * from "./navigation_utils";
@@ -1,34 +0,0 @@
1
- import { EntityCollection } from "@rebasepro/types";
2
- type EntityCustomView<M extends Record<string, unknown> = Record<string, unknown>> = {
3
- key: string;
4
- [key: string]: unknown;
5
- };
6
- export type NavigationViewInternal<M extends Record<string, unknown> = Record<string, unknown>> = NavigationViewEntityInternal<M> | NavigationViewCollectionInternal<M> | NavigationViewEntityCustomInternal<M>;
7
- export interface NavigationViewEntityInternal<M extends Record<string, unknown>> {
8
- type: "entity";
9
- entityId: string | number;
10
- slug: string;
11
- path: string;
12
- parentCollection: EntityCollection<M>;
13
- }
14
- export interface NavigationViewCollectionInternal<M extends Record<string, unknown>> {
15
- type: "collection";
16
- id: string;
17
- slug: string;
18
- path: string;
19
- collection: EntityCollection<M>;
20
- }
21
- export interface NavigationViewEntityCustomInternal<M extends Record<string, unknown>> {
22
- type: "custom_view";
23
- slug: string;
24
- path: string;
25
- entityId: string | number;
26
- view: EntityCustomView<M>;
27
- }
28
- export declare function getNavigationEntriesFromPath(props: {
29
- path: string;
30
- collections: EntityCollection[] | undefined;
31
- currentFullPath?: string;
32
- contextEntityViews?: EntityCustomView[];
33
- }): NavigationViewInternal[];
34
- export {};
@@ -1,20 +0,0 @@
1
- import { EntityCollection } from "@rebasepro/types";
2
- export declare function removeInitialAndTrailingSlashes(s: string): string;
3
- export declare function removeInitialSlash(s: string): string;
4
- export declare function removeTrailingSlash(s: string): string;
5
- export declare function addInitialSlash(s: string): string;
6
- export declare function getLastSegment(path: string): string;
7
- export declare function resolveCollectionPathIds(path: string, allCollections: EntityCollection[]): string;
8
- /**
9
- * Find the corresponding view at any depth for a given path.
10
- * Note that path or segments of the paths can be collection aliases.
11
- * @param slugOrPath
12
- * @param collections
13
- */
14
- export declare function getCollectionBySlugWithin(slugOrPath: string, collections: EntityCollection[]): EntityCollection | undefined;
15
- /**
16
- * Get the subcollection combinations from a path:
17
- * "sites/es/locales" => ["sites/es/locales", "sites"]
18
- * @param subpaths
19
- */
20
- export declare function getCollectionPathsCombinations(subpaths: string[]): string[];
@@ -1,6 +0,0 @@
1
- import { EntityCollection, EntityReference } from "@rebasepro/types";
2
- export declare function getParentReferencesFromPath(props: {
3
- path: string;
4
- collections: EntityCollection[] | undefined;
5
- currentFullPath?: string;
6
- }): EntityReference[];
@@ -1,14 +0,0 @@
1
- export declare const COLLECTION_PATH_SEPARATOR = "::";
2
- /**
3
- * Remove the entity ids from a given path
4
- * `products/B44RG6APH/locales` => `products::locales`
5
- * @param path
6
- */
7
- export declare function stripCollectionPath(path: string): string;
8
- export declare function segmentsToStrippedPath(paths: string[]): string;
9
- /**
10
- * Extract the collection path routes
11
- * `products/B44RG6APH/locales` => [`products`, `locales`]
12
- * @param path
13
- */
14
- export declare function fullPathToCollectionSegments(path: string): string[];
@@ -1,14 +0,0 @@
1
- import { Entity, EntityCollection, User } from "@rebasepro/types";
2
- /**
3
- * Minimal auth context for permission checking.
4
- * Only requires the user object — avoids forcing callers to construct
5
- * a full AuthController just to check permissions.
6
- */
7
- export interface AuthContext<USER extends User = User> {
8
- user: USER | null;
9
- }
10
- export declare function checkOperation<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authContext: AuthContext<USER>, entity: Entity<M> | null, targetOperation: "select" | "insert" | "update" | "delete"): boolean;
11
- export declare function canReadCollection<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authContext: AuthContext<USER>): boolean;
12
- export declare function canEditEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authContext: AuthContext<USER>, path: string, entity: Entity<M> | null): boolean;
13
- export declare function canCreateEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authContext: AuthContext<USER>, path: string, entity: Entity<M> | null): boolean;
14
- export declare function canDeleteEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authContext: AuthContext<USER>, path: string, entity: Entity<M> | null): boolean;
@@ -1,2 +0,0 @@
1
- import { EntityCollection } from "@rebasepro/types";
2
- export declare function getEntityImagePreviewPropertyKey<M extends Record<string, unknown>>(collection: EntityCollection<M>): string | undefined;
@@ -1,22 +0,0 @@
1
- import { EntityCollection, Property, Relation } from "@rebasepro/types";
2
- export declare function sanitizeRelation(relation: Partial<Relation>, sourceCollection: EntityCollection, resolveCollection?: (slugOrTable: string) => EntityCollection | undefined): Relation;
3
- export declare function resolveCollectionRelations(collection: EntityCollection): Record<string, Relation>;
4
- export declare function resolvePropertyRelation({ propertyKey, property, sourceCollection }: {
5
- propertyKey: string;
6
- property: Property;
7
- sourceCollection: EntityCollection;
8
- }): Relation | undefined;
9
- export declare function getTableName(collection: EntityCollection): string;
10
- export declare function getTableVarName(tableName: string): string;
11
- export declare function getEnumVarName(tableName: string, propName: string): string;
12
- export declare function getColumnName(fullColumn: string): string;
13
- /**
14
- * Look up a relation by key with forgiving normalization.
15
- *
16
- * `resolveCollectionRelations` stores each relation under a single canonical
17
- * key (no aliases). This helper tries the given key as-is, then falls back to
18
- * slug form (underscores → hyphens) and snake_case form (hyphens → underscores)
19
- * so that callers that receive a key from external input (URL path segments,
20
- * user-provided config, etc.) can still find the right entry.
21
- */
22
- export declare function findRelation(resolvedRelations: Record<string, Relation>, key: string): Relation | undefined;