@rebasepro/plugin-data-enhancement 0.0.1-canary.000dc36

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 (318) hide show
  1. package/LICENSE +114 -0
  2. package/README.md +89 -0
  3. package/dist/common/src/collections/CollectionRegistry.d.ts +56 -0
  4. package/dist/common/src/collections/index.d.ts +1 -0
  5. package/dist/common/src/data/buildRebaseData.d.ts +14 -0
  6. package/dist/common/src/index.d.ts +3 -0
  7. package/dist/common/src/util/builders.d.ts +57 -0
  8. package/dist/common/src/util/callbacks.d.ts +6 -0
  9. package/dist/common/src/util/collections.d.ts +11 -0
  10. package/dist/common/src/util/common.d.ts +2 -0
  11. package/dist/common/src/util/conditions.d.ts +26 -0
  12. package/dist/common/src/util/entities.d.ts +58 -0
  13. package/dist/common/src/util/enums.d.ts +3 -0
  14. package/dist/common/src/util/index.d.ts +16 -0
  15. package/dist/common/src/util/navigation_from_path.d.ts +34 -0
  16. package/dist/common/src/util/navigation_utils.d.ts +20 -0
  17. package/dist/common/src/util/parent_references_from_path.d.ts +6 -0
  18. package/dist/common/src/util/paths.d.ts +14 -0
  19. package/dist/common/src/util/permissions.d.ts +5 -0
  20. package/dist/common/src/util/references.d.ts +2 -0
  21. package/dist/common/src/util/relations.d.ts +22 -0
  22. package/dist/common/src/util/resolutions.d.ts +72 -0
  23. package/dist/common/src/util/storage.d.ts +24 -0
  24. package/dist/core/src/components/AIIcon.d.ts +16 -0
  25. package/dist/core/src/components/ConfirmationDialog.d.ts +9 -0
  26. package/dist/core/src/components/Debug/UIReferenceView.d.ts +1 -0
  27. package/dist/core/src/components/Debug/UIStyleGuide.d.ts +1 -0
  28. package/dist/core/src/components/ErrorTooltip.d.ts +2 -0
  29. package/dist/core/src/components/ErrorView.d.ts +21 -0
  30. package/dist/core/src/components/LanguageToggle.d.ts +1 -0
  31. package/dist/core/src/components/LoginView/LoginView.d.ts +68 -0
  32. package/dist/core/src/components/LoginView/index.d.ts +2 -0
  33. package/dist/core/src/components/NotFoundPage.d.ts +1 -0
  34. package/dist/core/src/components/RebaseAuth.d.ts +10 -0
  35. package/dist/core/src/components/RebaseLogo.d.ts +7 -0
  36. package/dist/core/src/components/UnsavedChangesDialog.d.ts +9 -0
  37. package/dist/core/src/components/UserDisplay.d.ts +7 -0
  38. package/dist/core/src/components/UserSelectPopover.d.ts +62 -0
  39. package/dist/core/src/components/UserSettingsView.d.ts +1 -0
  40. package/dist/core/src/components/common/index.d.ts +6 -0
  41. package/dist/core/src/components/common/table_height.d.ts +5 -0
  42. package/dist/core/src/components/common/types.d.ts +63 -0
  43. package/dist/core/src/components/common/useColumnsIds.d.ts +9 -0
  44. package/dist/core/src/components/common/useDataTableController.d.ts +45 -0
  45. package/dist/core/src/components/common/useDebouncedData.d.ts +9 -0
  46. package/dist/core/src/components/common/useScrollRestoration.d.ts +14 -0
  47. package/dist/core/src/components/index.d.ts +16 -0
  48. package/dist/core/src/contexts/AdminModeController.d.ts +4 -0
  49. package/dist/core/src/contexts/AnalyticsContext.d.ts +3 -0
  50. package/dist/core/src/contexts/AuthControllerContext.d.ts +3 -0
  51. package/dist/core/src/contexts/CustomizationControllerContext.d.ts +3 -0
  52. package/dist/core/src/contexts/DataDriverContext.d.ts +3 -0
  53. package/dist/core/src/contexts/DatabaseAdminContext.d.ts +3 -0
  54. package/dist/core/src/contexts/DialogsProvider.d.ts +4 -0
  55. package/dist/core/src/contexts/EffectiveRoleController.d.ts +4 -0
  56. package/dist/core/src/contexts/InternalUserManagementContext.d.ts +3 -0
  57. package/dist/core/src/contexts/ModeController.d.ts +4 -0
  58. package/dist/core/src/contexts/RebaseClientInstanceContext.d.ts +6 -0
  59. package/dist/core/src/contexts/RebaseDataContext.d.ts +3 -0
  60. package/dist/core/src/contexts/SnackbarProvider.d.ts +2 -0
  61. package/dist/core/src/contexts/StorageSourceContext.d.ts +3 -0
  62. package/dist/core/src/contexts/UserConfigurationPersistenceContext.d.ts +3 -0
  63. package/dist/core/src/contexts/index.d.ts +13 -0
  64. package/dist/core/src/core/PluginLifecycleManager.d.ts +17 -0
  65. package/dist/core/src/core/PluginProviderStack.d.ts +21 -0
  66. package/dist/core/src/core/Rebase.d.ts +14 -0
  67. package/dist/core/src/core/RebaseProps.d.ts +136 -0
  68. package/dist/core/src/core/RebaseRouter.d.ts +4 -0
  69. package/dist/core/src/core/RebaseRoutes.d.ts +17 -0
  70. package/dist/core/src/core/index.d.ts +4 -0
  71. package/dist/core/src/hooks/ApiConfigContext.d.ts +24 -0
  72. package/dist/core/src/hooks/data/delete.d.ts +31 -0
  73. package/dist/core/src/hooks/data/save.d.ts +34 -0
  74. package/dist/core/src/hooks/data/useCollectionFetch.d.ts +51 -0
  75. package/dist/core/src/hooks/data/useData.d.ts +13 -0
  76. package/dist/core/src/hooks/data/useDataOrder.d.ts +12 -0
  77. package/dist/core/src/hooks/data/useEntityFetch.d.ts +38 -0
  78. package/dist/core/src/hooks/data/useRelationSelector.d.ts +52 -0
  79. package/dist/core/src/hooks/data/useUserSelector.d.ts +31 -0
  80. package/dist/core/src/hooks/index.d.ts +37 -0
  81. package/dist/core/src/hooks/useAdminModeController.d.ts +19 -0
  82. package/dist/core/src/hooks/useAnalyticsController.d.ts +5 -0
  83. package/dist/core/src/hooks/useAuthController.d.ts +11 -0
  84. package/dist/core/src/hooks/useAuthSubscription.d.ts +2 -0
  85. package/dist/core/src/hooks/useBackendStorageSource.d.ts +30 -0
  86. package/dist/core/src/hooks/useBridgeRegistration.d.ts +18 -0
  87. package/dist/core/src/hooks/useBrowserTitleAndIcon.d.ts +6 -0
  88. package/dist/core/src/hooks/useBuildAdminModeController.d.ts +6 -0
  89. package/dist/core/src/hooks/useBuildEffectiveRoleController.d.ts +8 -0
  90. package/dist/core/src/hooks/useBuildLocalConfigurationPersistence.d.ts +2 -0
  91. package/dist/core/src/hooks/useBuildModeController.d.ts +6 -0
  92. package/dist/core/src/hooks/useClipboard.d.ts +57 -0
  93. package/dist/core/src/hooks/useCollapsedGroups.d.ts +12 -0
  94. package/dist/core/src/hooks/useCustomizationController.d.ts +11 -0
  95. package/dist/core/src/hooks/useDialogsController.d.ts +11 -0
  96. package/dist/core/src/hooks/useEffectiveRoleController.d.ts +7 -0
  97. package/dist/core/src/hooks/useInternalUserManagementController.d.ts +12 -0
  98. package/dist/core/src/hooks/useLargeLayout.d.ts +1 -0
  99. package/dist/core/src/hooks/useModeController.d.ts +19 -0
  100. package/dist/core/src/hooks/usePermissions.d.ts +12 -0
  101. package/dist/core/src/hooks/useRebaseClient.d.ts +5 -0
  102. package/dist/core/src/hooks/useRebaseContext.d.ts +11 -0
  103. package/dist/core/src/hooks/useRebaseRegistry.d.ts +34 -0
  104. package/dist/core/src/hooks/useSlot.d.ts +18 -0
  105. package/dist/core/src/hooks/useSnackbarController.d.ts +20 -0
  106. package/dist/core/src/hooks/useStorageSource.d.ts +7 -0
  107. package/dist/core/src/hooks/useStudioBridge.d.ts +91 -0
  108. package/dist/core/src/hooks/useTranslation.d.ts +17 -0
  109. package/dist/core/src/hooks/useUnsavedChangesDialog.d.ts +12 -0
  110. package/dist/core/src/hooks/useUserConfigurationPersistence.d.ts +8 -0
  111. package/dist/core/src/hooks/useValidateAuthenticator.d.ts +21 -0
  112. package/dist/core/src/i18n/RebaseI18nProvider.d.ts +33 -0
  113. package/dist/core/src/index.d.ts +15 -0
  114. package/dist/core/src/internal/common.d.ts +3 -0
  115. package/dist/core/src/internal/useRestoreScroll.d.ts +6 -0
  116. package/dist/core/src/locales/de.d.ts +2 -0
  117. package/dist/core/src/locales/en.d.ts +10 -0
  118. package/dist/core/src/locales/es.d.ts +10 -0
  119. package/dist/core/src/locales/fr.d.ts +2 -0
  120. package/dist/core/src/locales/hi.d.ts +2 -0
  121. package/dist/core/src/locales/it.d.ts +2 -0
  122. package/dist/core/src/locales/pt.d.ts +7 -0
  123. package/dist/core/src/util/constants.d.ts +1 -0
  124. package/dist/core/src/util/createFormexStub.d.ts +2 -0
  125. package/dist/core/src/util/entity_cache.d.ts +27 -0
  126. package/dist/core/src/util/enums.d.ts +5 -0
  127. package/dist/core/src/util/icon_list.d.ts +5 -0
  128. package/dist/core/src/util/icon_synonyms.d.ts +1 -0
  129. package/dist/core/src/util/icons.d.ts +20 -0
  130. package/dist/core/src/util/index.d.ts +10 -0
  131. package/dist/core/src/util/previews.d.ts +4 -0
  132. package/dist/core/src/util/useStorageUploadController.d.ts +38 -0
  133. package/dist/core/src/util/useTraceUpdate.d.ts +2 -0
  134. package/dist/formex/src/Field.d.ts +52 -0
  135. package/dist/formex/src/Formex.d.ts +7 -0
  136. package/dist/formex/src/index.d.ts +5 -0
  137. package/dist/formex/src/types.d.ts +40 -0
  138. package/dist/formex/src/useCreateFormex.d.ts +14 -0
  139. package/dist/formex/src/utils.d.ts +16 -0
  140. package/dist/index.es.js +751 -0
  141. package/dist/index.es.js.map +1 -0
  142. package/dist/index.umd.js +746 -0
  143. package/dist/index.umd.js.map +1 -0
  144. package/dist/plugin-data-enhancement/src/api.d.ts +34 -0
  145. package/dist/plugin-data-enhancement/src/components/DataEnhancementControllerProvider.d.ts +14 -0
  146. package/dist/plugin-data-enhancement/src/components/FormEnhanceAction.d.ts +10 -0
  147. package/dist/plugin-data-enhancement/src/editor/useEditorAIController.d.ts +4 -0
  148. package/dist/plugin-data-enhancement/src/index.d.ts +4 -0
  149. package/dist/plugin-data-enhancement/src/locales/de.d.ts +21 -0
  150. package/dist/plugin-data-enhancement/src/locales/en.d.ts +21 -0
  151. package/dist/plugin-data-enhancement/src/locales/es.d.ts +21 -0
  152. package/dist/plugin-data-enhancement/src/locales/fr.d.ts +21 -0
  153. package/dist/plugin-data-enhancement/src/locales/hi.d.ts +21 -0
  154. package/dist/plugin-data-enhancement/src/locales/it.d.ts +21 -0
  155. package/dist/plugin-data-enhancement/src/locales/pt.d.ts +21 -0
  156. package/dist/plugin-data-enhancement/src/types/data_enhancement_controller.d.ts +71 -0
  157. package/dist/plugin-data-enhancement/src/types/subscriptions_message_props.d.ts +3 -0
  158. package/dist/plugin-data-enhancement/src/useDataEnhancementPlugin.d.ts +29 -0
  159. package/dist/plugin-data-enhancement/src/utils/diffStrings.d.ts +7 -0
  160. package/dist/plugin-data-enhancement/src/utils/properties.d.ts +3 -0
  161. package/dist/plugin-data-enhancement/src/utils/strings_counter.d.ts +2 -0
  162. package/dist/plugin-data-enhancement/src/utils/suggestions.d.ts +1 -0
  163. package/dist/plugin-data-enhancement/src/utils/values.d.ts +1 -0
  164. package/dist/types/src/controllers/analytics_controller.d.ts +7 -0
  165. package/dist/types/src/controllers/auth.d.ts +119 -0
  166. package/dist/types/src/controllers/client.d.ts +170 -0
  167. package/dist/types/src/controllers/collection_registry.d.ts +46 -0
  168. package/dist/types/src/controllers/customization_controller.d.ts +60 -0
  169. package/dist/types/src/controllers/data.d.ts +168 -0
  170. package/dist/types/src/controllers/data_driver.d.ts +195 -0
  171. package/dist/types/src/controllers/database_admin.d.ts +11 -0
  172. package/dist/types/src/controllers/dialogs_controller.d.ts +36 -0
  173. package/dist/types/src/controllers/effective_role.d.ts +4 -0
  174. package/dist/types/src/controllers/email.d.ts +34 -0
  175. package/dist/types/src/controllers/index.d.ts +18 -0
  176. package/dist/types/src/controllers/local_config_persistence.d.ts +20 -0
  177. package/dist/types/src/controllers/navigation.d.ts +213 -0
  178. package/dist/types/src/controllers/registry.d.ts +54 -0
  179. package/dist/types/src/controllers/side_dialogs_controller.d.ts +67 -0
  180. package/dist/types/src/controllers/side_entity_controller.d.ts +90 -0
  181. package/dist/types/src/controllers/snackbar.d.ts +24 -0
  182. package/dist/types/src/controllers/storage.d.ts +171 -0
  183. package/dist/types/src/index.d.ts +4 -0
  184. package/dist/types/src/rebase_context.d.ts +105 -0
  185. package/dist/types/src/types/backend.d.ts +536 -0
  186. package/dist/types/src/types/backend_hooks.d.ts +187 -0
  187. package/dist/types/src/types/builders.d.ts +15 -0
  188. package/dist/types/src/types/chips.d.ts +5 -0
  189. package/dist/types/src/types/collections.d.ts +857 -0
  190. package/dist/types/src/types/cron.d.ts +102 -0
  191. package/dist/types/src/types/data_source.d.ts +64 -0
  192. package/dist/types/src/types/entities.d.ts +145 -0
  193. package/dist/types/src/types/entity_actions.d.ts +98 -0
  194. package/dist/types/src/types/entity_callbacks.d.ts +173 -0
  195. package/dist/types/src/types/entity_link_builder.d.ts +7 -0
  196. package/dist/types/src/types/entity_overrides.d.ts +10 -0
  197. package/dist/types/src/types/entity_views.d.ts +59 -0
  198. package/dist/types/src/types/export_import.d.ts +21 -0
  199. package/dist/types/src/types/formex.d.ts +40 -0
  200. package/dist/types/src/types/index.d.ts +25 -0
  201. package/dist/types/src/types/locales.d.ts +4 -0
  202. package/dist/types/src/types/modify_collections.d.ts +5 -0
  203. package/dist/types/src/types/plugins.d.ts +282 -0
  204. package/dist/types/src/types/properties.d.ts +1148 -0
  205. package/dist/types/src/types/property_config.d.ts +70 -0
  206. package/dist/types/src/types/relations.d.ts +336 -0
  207. package/dist/types/src/types/slots.d.ts +262 -0
  208. package/dist/types/src/types/translations.d.ts +874 -0
  209. package/dist/types/src/types/user_management_delegate.d.ts +121 -0
  210. package/dist/types/src/types/websockets.d.ts +78 -0
  211. package/dist/types/src/users/index.d.ts +2 -0
  212. package/dist/types/src/users/roles.d.ts +22 -0
  213. package/dist/types/src/users/user.d.ts +46 -0
  214. package/dist/ui/src/components/Alert.d.ts +12 -0
  215. package/dist/ui/src/components/Autocomplete.d.ts +21 -0
  216. package/dist/ui/src/components/Avatar.d.ts +11 -0
  217. package/dist/ui/src/components/Badge.d.ts +8 -0
  218. package/dist/ui/src/components/BooleanSwitch.d.ts +14 -0
  219. package/dist/ui/src/components/BooleanSwitchWithLabel.d.ts +17 -0
  220. package/dist/ui/src/components/Button.d.ts +14 -0
  221. package/dist/ui/src/components/Card.d.ts +9 -0
  222. package/dist/ui/src/components/CenteredView.d.ts +9 -0
  223. package/dist/ui/src/components/Checkbox.d.ts +13 -0
  224. package/dist/ui/src/components/Chip.d.ts +26 -0
  225. package/dist/ui/src/components/CircularProgress.d.ts +5 -0
  226. package/dist/ui/src/components/CircularProgressCenter.d.ts +11 -0
  227. package/dist/ui/src/components/Collapse.d.ts +9 -0
  228. package/dist/ui/src/components/ColorPicker.d.ts +30 -0
  229. package/dist/ui/src/components/Container.d.ts +8 -0
  230. package/dist/ui/src/components/DateTimeField.d.ts +24 -0
  231. package/dist/ui/src/components/DebouncedTextField.d.ts +2 -0
  232. package/dist/ui/src/components/Dialog.d.ts +39 -0
  233. package/dist/ui/src/components/DialogActions.d.ts +7 -0
  234. package/dist/ui/src/components/DialogContent.d.ts +7 -0
  235. package/dist/ui/src/components/DialogTitle.d.ts +10 -0
  236. package/dist/ui/src/components/ErrorBoundary.d.ts +11 -0
  237. package/dist/ui/src/components/ExpandablePanel.d.ts +12 -0
  238. package/dist/ui/src/components/FileUpload.d.ts +23 -0
  239. package/dist/ui/src/components/IconButton.d.ts +12 -0
  240. package/dist/ui/src/components/InfoLabel.d.ts +5 -0
  241. package/dist/ui/src/components/InputLabel.d.ts +11 -0
  242. package/dist/ui/src/components/Label.d.ts +7 -0
  243. package/dist/ui/src/components/LoadingButton.d.ts +7 -0
  244. package/dist/ui/src/components/Markdown.d.ts +10 -0
  245. package/dist/ui/src/components/Menu.d.ts +23 -0
  246. package/dist/ui/src/components/Menubar.d.ts +80 -0
  247. package/dist/ui/src/components/MultiSelect.d.ts +48 -0
  248. package/dist/ui/src/components/Paper.d.ts +6 -0
  249. package/dist/ui/src/components/Popover.d.ts +24 -0
  250. package/dist/ui/src/components/RadioGroup.d.ts +28 -0
  251. package/dist/ui/src/components/ResizablePanels.d.ts +18 -0
  252. package/dist/ui/src/components/SearchBar.d.ts +22 -0
  253. package/dist/ui/src/components/Select.d.ts +43 -0
  254. package/dist/ui/src/components/Separator.d.ts +5 -0
  255. package/dist/ui/src/components/Sheet.d.ts +22 -0
  256. package/dist/ui/src/components/Skeleton.d.ts +6 -0
  257. package/dist/ui/src/components/Slider.d.ts +21 -0
  258. package/dist/ui/src/components/Table.d.ts +34 -0
  259. package/dist/ui/src/components/Tabs.d.ts +19 -0
  260. package/dist/ui/src/components/TextField.d.ts +58 -0
  261. package/dist/ui/src/components/TextareaAutosize.d.ts +43 -0
  262. package/dist/ui/src/components/ToggleButtonGroup.d.ts +30 -0
  263. package/dist/ui/src/components/Tooltip.d.ts +19 -0
  264. package/dist/ui/src/components/Typography.d.ts +36 -0
  265. package/dist/ui/src/components/VirtualTable/VirtualTable.d.ts +11 -0
  266. package/dist/ui/src/components/VirtualTable/VirtualTableCell.d.ts +21 -0
  267. package/dist/ui/src/components/VirtualTable/VirtualTableHeader.d.ts +29 -0
  268. package/dist/ui/src/components/VirtualTable/VirtualTableHeaderRow.d.ts +2 -0
  269. package/dist/ui/src/components/VirtualTable/VirtualTableProps.d.ts +243 -0
  270. package/dist/ui/src/components/VirtualTable/VirtualTableRow.d.ts +3 -0
  271. package/dist/ui/src/components/VirtualTable/index.d.ts +3 -0
  272. package/dist/ui/src/components/VirtualTable/types.d.ts +38 -0
  273. package/dist/ui/src/components/common/SelectInputLabel.d.ts +5 -0
  274. package/dist/ui/src/components/index.d.ts +53 -0
  275. package/dist/ui/src/hooks/PortalContainerContext.d.ts +31 -0
  276. package/dist/ui/src/hooks/index.d.ts +6 -0
  277. package/dist/ui/src/hooks/useDebounceCallback.d.ts +1 -0
  278. package/dist/ui/src/hooks/useDebounceValue.d.ts +1 -0
  279. package/dist/ui/src/hooks/useDebouncedCallback.d.ts +1 -0
  280. package/dist/ui/src/hooks/useInjectStyles.d.ts +7 -0
  281. package/dist/ui/src/hooks/useOutsideAlerter.d.ts +5 -0
  282. package/dist/ui/src/icons/GitHubIcon.d.ts +2 -0
  283. package/dist/ui/src/icons/HandleIcon.d.ts +1 -0
  284. package/dist/ui/src/icons/Icon.d.ts +20 -0
  285. package/dist/ui/src/icons/cool_icon_keys.d.ts +1 -0
  286. package/dist/ui/src/icons/icon_keys.d.ts +1 -0
  287. package/dist/ui/src/icons/index.d.ts +6 -0
  288. package/dist/ui/src/index.d.ts +5 -0
  289. package/dist/ui/src/styles.d.ts +12 -0
  290. package/dist/ui/src/util/chip_colors.d.ts +4 -0
  291. package/dist/ui/src/util/cls.d.ts +2 -0
  292. package/dist/ui/src/util/debounce.d.ts +10 -0
  293. package/dist/ui/src/util/hash.d.ts +1 -0
  294. package/dist/ui/src/util/index.d.ts +4 -0
  295. package/dist/ui/src/util/key_to_icon_component.d.ts +1 -0
  296. package/package.json +86 -0
  297. package/src/api.ts +198 -0
  298. package/src/components/DataEnhancementControllerProvider.tsx +339 -0
  299. package/src/components/FormEnhanceAction.tsx +273 -0
  300. package/src/editor/useEditorAIController.tsx +37 -0
  301. package/src/index.ts +10 -0
  302. package/src/locales/de.ts +21 -0
  303. package/src/locales/en.ts +21 -0
  304. package/src/locales/es.ts +21 -0
  305. package/src/locales/fr.ts +21 -0
  306. package/src/locales/hi.ts +21 -0
  307. package/src/locales/it.ts +21 -0
  308. package/src/locales/pt.ts +21 -0
  309. package/src/tests/diffStrings.test.ts +128 -0
  310. package/src/types/data_enhancement_controller.tsx +75 -0
  311. package/src/types/subscriptions_message_props.tsx +1 -0
  312. package/src/useDataEnhancementPlugin.tsx +66 -0
  313. package/src/utils/diffStrings.ts +70 -0
  314. package/src/utils/properties.ts +168 -0
  315. package/src/utils/strings_counter.ts +22 -0
  316. package/src/utils/suggestions.ts +6 -0
  317. package/src/utils/values.ts +12 -0
  318. package/src/vite-env.d.ts +1 -0
@@ -0,0 +1,857 @@
1
+ import React from "react";
2
+ import type { Entity, EntityStatus } from "./entities";
3
+ import type { EntityCallbacks } from "./entity_callbacks";
4
+ import type { Properties } from "./properties";
5
+ import type { ExportConfig } from "./export_import";
6
+ import type { EntityOverrides } from "./entity_overrides";
7
+ import type { User } from "../users";
8
+ import type { RebaseContext } from "../rebase_context";
9
+ import type { Relation } from "./relations";
10
+ import type { EntityCustomView } from "./entity_views";
11
+ import type { EntityAction } from "./entity_actions";
12
+ /**
13
+ * Base interface containing all driver-agnostic collection properties.
14
+ * Use {@link PostgresCollection} or {@link FirebaseCollection} for
15
+ * driver-specific type safety, or {@link EntityCollection} when you
16
+ * need to handle any collection regardless of backend.
17
+ *
18
+ * @group Models
19
+ */
20
+ export interface BaseEntityCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> {
21
+ /**
22
+ * You can set an alias that will be used internally instead of the collection name.
23
+ * The `slug` value will be used to determine the URL of the collection.
24
+ * Note that you can use this value in reference properties too.
25
+ */
26
+ slug: string;
27
+ /**
28
+ * Name of the collection, typically plural.
29
+ * E.g. `Products`, `Blog`
30
+ */
31
+ name: string;
32
+ /**
33
+ * Singular name of an entry in this collection
34
+ * E.g. `Product`, `Blog entry`
35
+ */
36
+ singularName?: string;
37
+ /**
38
+ * Optional description of this view. You can use Markdown.
39
+ */
40
+ description?: string;
41
+ /**
42
+ * Child collections nested under entities of this collection.
43
+ * Populated automatically during normalization from driver-specific fields
44
+ * (e.g. Firebase `subcollections`, Postgres `relations` with many-cardinality).
45
+ *
46
+ * Custom drivers can set this directly to expose child collections to the UI.
47
+ */
48
+ childCollections?: () => EntityCollection<Record<string, unknown>>[];
49
+ /**
50
+ * Which driver handles this collection.
51
+ * Use this to route collections to different backends:
52
+ * - `"postgres"` - Route to PostgreSQL backend
53
+ * - `"firestore"` - Route to Firestore (client-side)
54
+ * - `"mongodb"` - Route to MongoDB backend
55
+ * - Custom IDs for your own driver implementations
56
+ *
57
+ * If not specified, the default driver `"(default)"` is used.
58
+ *
59
+ * @example
60
+ * // Simple - no driver needed for default
61
+ * { slug: "products" }
62
+ *
63
+ * // Firestore collection (client-side real-time)
64
+ * { slug: "analytics", driver: "firestore" }
65
+ *
66
+ * // Multiple databases within a driver
67
+ * { slug: "orders", driver: "postgres", databaseId: "orders_db" }
68
+ */
69
+ driver?: string;
70
+ /**
71
+ * Which database within the driver.
72
+ * - For Firestore: The Firestore database ID (e.g., for multi-database projects)
73
+ * - For PostgreSQL: Schema or database name
74
+ * - For MongoDB: Database name
75
+ *
76
+ * If not specified, the default database of the driver is used.
77
+ */
78
+ databaseId?: string;
79
+ /**
80
+ * Set of properties that compose an entity
81
+ */
82
+ properties: Properties;
83
+ /**
84
+ * Icon for the navigation sidebar or cards.
85
+ */
86
+ icon?: string | React.ReactNode;
87
+ /**
88
+ * Navigation group for this collection.
89
+ */
90
+ group?: string;
91
+ /**
92
+ * Array of entity views that this collection has.
93
+ * Can be an array of `EntityCustomView` or a string representing the key of a global `EntityCustomView`.
94
+ */
95
+ entityViews?: (string | EntityCustomView<Record<string, unknown>>)[];
96
+ /**
97
+ * Default preview properties displayed when this collection is referenced to.
98
+ */
99
+ previewProperties?: string[];
100
+ /**
101
+ * Properties to display as columns in the list view.
102
+ * If not specified, the list view uses a smart default (Title, Status, Date).
103
+ */
104
+ listProperties?: string[];
105
+ /**
106
+ * Title property of the entity. This is the property that will be used
107
+ * as the title in entity related views and references.
108
+ * If not specified, the first property simple text property will be used.
109
+ */
110
+ readonly titleProperty?: Extract<keyof M, string> | (string & {});
111
+ /**
112
+ * When editing an entity, you can choose to open the entity in a side dialog
113
+ * or in a full screen dialog. Defaults to `full_screen`.
114
+ */
115
+ openEntityMode?: "side_panel" | "full_screen" | "split";
116
+ /**
117
+ * Order in which the properties are displayed.
118
+ * If you are specifying your collection as code, the order is the same as the
119
+ * one you define in `properties`. Additional columns are added at the
120
+ * end of the list, if the order is not specified.
121
+ * You can use this prop to hide some properties from the table view.
122
+ * Note that if you set this prop, other ways to hide fields, like
123
+ * `hidden` in the property definition, will be ignored.
124
+ * `propertiesOrder` has precedence over `hidden`.
125
+ * - For properties use the property key.
126
+ * - For additional fields use the field key.
127
+ * - If you have subcollections, you get a column for each subcollection,
128
+ * with the path (or alias) as the subcollection, prefixed with
129
+ * `subcollection:`. e.g. `subcollection:orders`.
130
+ * You can use this prop to hide some properties from the table view.
131
+ * Note that if you set this prop, other ways to hide fields, like
132
+ * `hidden` in the property definition,will be ignored.
133
+ * `propertiesOrder` has precedence over `hidden`.
134
+ */
135
+ propertiesOrder?: (Extract<keyof M, string> | (string & {}) | string | `subcollection:${string}`)[];
136
+ /**
137
+ * If enabled, content is loaded in batches. If `false` all entities in the
138
+ * collection are loaded. This means that when reaching the end of the
139
+ * collection, the CMS will load more entities.
140
+ * You can specify a number to specify the pagination size (50 by default)
141
+ * Defaults to `true`
142
+ */
143
+ pagination?: boolean | number;
144
+ selectionEnabled?: boolean;
145
+ /**
146
+ * This interface defines all the callbacks that can be used when an entity
147
+ * is being created, updated or deleted.
148
+ * Useful for adding your own logic or blocking the execution of the operation.
149
+ */
150
+ readonly callbacks?: EntityCallbacks<M, USER>;
151
+ /**
152
+ * Pass your own selection controller if you want to control selected
153
+ * entities externally.
154
+ * @see useSelectionController
155
+ */
156
+ selectionController?: SelectionController<M>;
157
+ /**
158
+ * Force a filter in this view. If applied, the rest of the filters will
159
+ * be disabled. Filters applied with this prop cannot be changed.
160
+ * e.g. `fixedFilter: { age: [">", 18] }`
161
+ * e.g. `fixedFilter: { related_user: ["==", new EntityReference("sdc43dsw2", "users")] }`
162
+ */
163
+ readonly fixedFilter?: FilterValues<Extract<keyof M, string> | (string & {})>;
164
+ /**
165
+ * Initial filters applied to the collection this collection is related to.
166
+ * Defaults to none. Filters applied with this prop can be changed.
167
+ * e.g. `defaultFilter: { age: [">", 18] }`
168
+ * e.g. `defaultFilter: { related_user: ["==", new EntityReference("sdc43dsw2", "users")] }`
169
+ */
170
+ readonly defaultFilter?: FilterValues<Extract<keyof M, string> | (string & {})>;
171
+ /**
172
+ * Default sort applied to this collection.
173
+ * When setting this prop, entities will have a default order
174
+ * applied in the collection.
175
+ * e.g. `sort: ["order", "asc"]`
176
+ */
177
+ readonly sort?: [Extract<keyof M, string> | (string & {}), "asc" | "desc"];
178
+ /**
179
+ * You can add additional fields to the collection view by implementing
180
+ * an additional field delegate.
181
+ */
182
+ readonly additionalFields?: AdditionalFieldDelegate<M, USER>[];
183
+ /**
184
+ * Default size of the rendered collection
185
+ */
186
+ defaultSize?: CollectionSize;
187
+ /**
188
+ * Can the elements in this collection be edited inline in the collection
189
+ * view. If this flag is set to false but `permissions.edit` is `true`, entities
190
+ * can still be edited in the side panel
191
+ */
192
+ inlineEditing?: boolean;
193
+ /**
194
+ * Should this collection be hidden from the main navigation panel, if
195
+ * it is at the root level, or in the entity side panel if it's a
196
+ * subcollection.
197
+ * It will still be accessible if you reach the specified path.
198
+ * You can also use this collection as a reference target.
199
+ */
200
+ hideFromNavigation?: boolean;
201
+ /**
202
+ * If you want to open custom views or subcollections by default when opening the edit
203
+ * view of an entity, you can specify the path to the view here.
204
+ * The path is relative to the current collection. For example if you have a collection
205
+ * that has a custom view as well as a subcollection that refers to another entity, you can
206
+ * either specify the path to the custom view or the path to the subcollection.
207
+ */
208
+ defaultSelectedView?: string | DefaultSelectedViewBuilder;
209
+ /**
210
+ * Should the ID of this collection be hidden from the form view.
211
+ */
212
+ hideIdFromForm?: boolean;
213
+ /**
214
+ * Should the ID of this collection be hidden from the grid view.
215
+ */
216
+ hideIdFromCollection?: boolean;
217
+ /**
218
+ * If set to true, the form will be auto-saved when the user changes
219
+ * the value of a field.
220
+ * Defaults to false.
221
+ * When a new entity is created, this property can be updated to generated a new ID
222
+ */
223
+ formAutoSave?: boolean;
224
+ /**
225
+ *
226
+ */
227
+ exportable?: boolean | ExportConfig<USER>;
228
+ /**
229
+ * User id of the owner of this collection. This is used only by plugins, or if you
230
+ * are writing custom code
231
+ */
232
+ ownerId?: string;
233
+ /**
234
+ * Overrides for the entity view, like the data source or the storage source.
235
+ */
236
+ overrides?: EntityOverrides;
237
+ /**
238
+ * Width of the side dialog (in pixels) when opening an entity in this collection.
239
+ */
240
+ sideDialogWidth?: number | string;
241
+ /**
242
+ * If set to true, the default values of the properties will be applied
243
+ * to the entity every time the entity is updated (not only when created).
244
+ * Defaults to false.
245
+ */
246
+ alwaysApplyDefaultValues?: boolean;
247
+ /**
248
+ * If set to true, a tab including the JSON representation of the entity will be included.
249
+ */
250
+ includeJsonView?: boolean;
251
+ /**
252
+ * If set to true, changes to the entity will be saved in a subcollection.
253
+ * This prop has no effect if the history plugin is not enabled
254
+ */
255
+ history?: boolean;
256
+ /**
257
+ * Should local changes be backed up in local storage, to prevent data loss on
258
+ * accidental navigations.
259
+ * - `manual_apply`: When the user navigates back to an entity with local changes,
260
+ * they will be prompted to restore the changes.
261
+ * - `auto_apply`: When the user navigates back to an entity with local changes,
262
+ * the changes will be automatically applied.
263
+ * - `false`: Local changes will not be backed up.
264
+ * Defaults to `manual_apply`.
265
+ */
266
+ localChangesBackup?: "manual_apply" | "auto_apply" | false;
267
+ /**
268
+ * Default view mode for displaying this collection.
269
+ * - "table": Display entities in a table with inline editing (default)
270
+ * - "cards": Display entities as a grid of cards with thumbnails
271
+ * - "kanban": Display entities in a Kanban board grouped by a property
272
+ * Defaults to "table".
273
+ */
274
+ defaultViewMode?: ViewMode;
275
+ /**
276
+ * Which view modes are available for this collection.
277
+ * Possible values: "table", "cards", "kanban".
278
+ * Defaults to all three: ["table", "cards", "kanban"].
279
+ * Note: "kanban" will only be available if the collection has at least
280
+ * one string property with enumValues defined, regardless of this setting.
281
+ */
282
+ enabledViews?: ViewMode[];
283
+ /**
284
+ * Configuration for Kanban board view mode.
285
+ * When set, the Kanban view mode becomes available.
286
+ */
287
+ kanban?: KanbanConfig<M>;
288
+ /**
289
+ * Property key to use for ordering items.
290
+ * Must reference a string/text property. When items are reordered,
291
+ * this property will be updated with lexicographic sort keys
292
+ * (e.g. "a0", "a1", "a0V") using string-based fractional indexing.
293
+ * Used by Kanban view for ordering within columns
294
+ * and can be used for general ordering purposes.
295
+ */
296
+ readonly orderProperty?: Extract<keyof M, string> | (string & {});
297
+ /**
298
+ * Actions that can be performed on the entities in this collection.
299
+ */
300
+ entityActions?: EntityAction<M, USER>[];
301
+ /**
302
+ * Builder for the collection actions rendered in the toolbar
303
+ */
304
+ Actions?: React.ComponentType<any>[];
305
+ }
306
+ /**
307
+ * A collection backed by PostgreSQL (or any SQL database).
308
+ * Adds support for SQL-style relations (JOINs) and Row Level Security.
309
+ *
310
+ * Use this type instead of {@link EntityCollection} when you want
311
+ * compile-time safety that only SQL-relevant fields appear.
312
+ *
313
+ * @group Models
314
+ */
315
+ export interface PostgresCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> extends BaseEntityCollection<M, USER> {
316
+ properties: Properties;
317
+ /**
318
+ * The driver for this collection. For Postgres collections this
319
+ * can be omitted (Postgres is the default) or set to `"postgres"`.
320
+ */
321
+ driver?: "postgres" | undefined;
322
+ /**
323
+ * The PostgreSQL table name for this collection.
324
+ */
325
+ table: string;
326
+ /**
327
+ * For SQL databases, you can define the relations between collections here.
328
+ * Relations describe JOINs, foreign keys, and junction tables.
329
+ */
330
+ relations?: Relation[];
331
+ /**
332
+ * Security rules for this collection (Supabase-style Row Level Security).
333
+ * When defined, the schema generator will enable RLS on the table and
334
+ * create the corresponding PostgreSQL policies.
335
+ *
336
+ * Supports three levels of expressiveness:
337
+ * 1. **Convenience shortcuts** — `ownerField`, `access`, `roles`
338
+ * 2. **Raw SQL** — `using` and `withCheck` for full PostgreSQL power
339
+ * 3. **Combined** — mix shortcuts with `roles` for common patterns
340
+ *
341
+ * The authenticated user context is available in raw SQL via:
342
+ * - `auth.uid()` — the current user's ID
343
+ * - `auth.roles()` — comma-separated app role IDs
344
+ * - `auth.jwt()` — full JWT claims as JSONB
345
+ */
346
+ securityRules?: SecurityRule[];
347
+ }
348
+ /**
349
+ * A collection backed by Firebase / Firestore.
350
+ * Adds support for subcollections (nested document collections).
351
+ *
352
+ * Use this type instead of {@link EntityCollection} when you want
353
+ * compile-time safety that only Firestore-relevant fields appear.
354
+ *
355
+ * @group Models
356
+ */
357
+ export interface FirebaseCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> extends BaseEntityCollection<M, USER> {
358
+ /**
359
+ * The driver for this collection. Must be set to `"firestore"`.
360
+ */
361
+ driver: "firestore";
362
+ /**
363
+ * You can add subcollections to your entity in the same way you define the root
364
+ * collections. The collections added here will be displayed when opening
365
+ * the side dialog of an entity.
366
+ */
367
+ subcollections?: () => EntityCollection<Record<string, unknown>>[];
368
+ }
369
+ /**
370
+ * A collection backed by MongoDB.
371
+ *
372
+ * Use this type instead of {@link EntityCollection} when you want
373
+ * compile-time safety that only MongoDB-relevant fields appear.
374
+ *
375
+ * @group Models
376
+ */
377
+ export interface MongoDBCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> extends BaseEntityCollection<M, USER> {
378
+ /**
379
+ * The driver for this collection. Must be set to `"mongodb"`.
380
+ */
381
+ driver: "mongodb";
382
+ }
383
+ /**
384
+ * A collection backed by any data source.
385
+ * This is a discriminated union — use {@link PostgresCollection},
386
+ * {@link FirebaseCollection}, or {@link MongoDBCollection} for
387
+ * driver-specific type safety.
388
+ *
389
+ * @group Models
390
+ */
391
+ export type EntityCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> = PostgresCollection<M, USER> | FirebaseCollection<M, USER> | MongoDBCollection<M, USER>;
392
+ /** An EntityCollection that supports SQL-style relations (e.g. Postgres). */
393
+ export type CollectionWithRelations<M extends Record<string, unknown> = Record<string, unknown>> = EntityCollection<M> & {
394
+ table?: string;
395
+ relations?: Relation[];
396
+ securityRules?: SecurityRule[];
397
+ };
398
+ /** An EntityCollection that supports subcollections (e.g. Firestore). */
399
+ export type CollectionWithSubcollections<M extends Record<string, unknown> = Record<string, unknown>> = EntityCollection<M> & {
400
+ subcollections?: () => EntityCollection<Record<string, unknown>>[];
401
+ };
402
+ /**
403
+ * Type guard for PostgreSQL collections.
404
+ * Returns true if the collection uses the Postgres driver (or the default driver).
405
+ * @group Models
406
+ */
407
+ export declare function isPostgresCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User>(collection: EntityCollection<M, USER>): collection is PostgresCollection<M, USER>;
408
+ /**
409
+ * Type guard for Firebase / Firestore collections.
410
+ * @group Models
411
+ */
412
+ export declare function isFirebaseCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User>(collection: EntityCollection<M, USER>): collection is FirebaseCollection<M, USER>;
413
+ /**
414
+ * Type guard for MongoDB collections.
415
+ * @group Models
416
+ */
417
+ export declare function isMongoDBCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User>(collection: EntityCollection<M, USER>): collection is MongoDBCollection<M, USER>;
418
+ /**
419
+ * Configuration for Kanban board view mode.
420
+ * @group Collections
421
+ */
422
+ export interface KanbanConfig<M extends Record<string, unknown> = Record<string, unknown>> {
423
+ /**
424
+ * Property key to use for Kanban board columns.
425
+ * Must reference a string property with enumValues defined.
426
+ * Entities will be grouped into columns based on this property's value.
427
+ * The column order is determined by the order of enumValues in the property.
428
+ */
429
+ columnProperty: Extract<keyof M, string> | (string & {});
430
+ }
431
+ /**
432
+ * View mode for displaying a collection.
433
+ * - "list": Simple, clean list view — the classic CMS default
434
+ * - "table": Table with inline editing
435
+ * - "cards": Grid of visual cards with thumbnails
436
+ * - "kanban": Board view grouped by a property
437
+ * @group Collections
438
+ */
439
+ export type ViewMode = "list" | "table" | "cards" | "kanban";
440
+ /**
441
+ * Parameter passed to the `Actions` prop in the collection configuration.
442
+ * The component will receive this prop when it is rendered in the collection
443
+ * toolbar.
444
+ *
445
+ * @group Models
446
+ */
447
+ export interface CollectionActionsProps<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User, EC extends EntityCollection<M> = EntityCollection<M>> {
448
+ /**
449
+ * Full collection path of this entity. This is the full path, like
450
+ * `users/1234/addresses`
451
+ */
452
+ path: string;
453
+ /**
454
+ * Path of the last collection, like `addresses`
455
+ */
456
+ relativePath: string;
457
+ /**
458
+ * Array of the parent path segments like `['users']`
459
+ */
460
+ parentCollectionSlugs: string[];
461
+ parentEntityIds: string[];
462
+ /**
463
+ * The collection configuration
464
+ */
465
+ collection: EC;
466
+ /**
467
+ * Use this controller to get the selected entities and to update the
468
+ * selected entities state.
469
+ */
470
+ selectionController: SelectionController<M>;
471
+ /**
472
+ * Use this controller to get the table controller and to update the
473
+ * table controller state.
474
+ */
475
+ tableController: EntityTableController<M>;
476
+ /**
477
+ * Context of the app status
478
+ */
479
+ context: RebaseContext<USER>;
480
+ /**
481
+ * Count of the entities in this collection.
482
+ * undefined means the count is still loading.
483
+ */
484
+ collectionEntitiesCount?: number;
485
+ }
486
+ /**
487
+ * Use this controller to retrieve the selected entities or modify them in
488
+ * an {@link EntityCollection}
489
+ * @group Models
490
+ */
491
+ export interface SelectionController<M extends Record<string, unknown> = Record<string, unknown>> {
492
+ selectedEntities: Entity<M>[];
493
+ setSelectedEntities(entities: Entity<M>[]): void;
494
+ setSelectedEntities(action: (prev: Entity<M>[]) => Entity<M>[]): void;
495
+ isEntitySelected(entity: Entity<M>): boolean;
496
+ toggleEntitySelection(entity: Entity<M>, newSelectedState?: boolean): void;
497
+ }
498
+ /**
499
+ * Filter conditions in a `Query.where()` clause are specified using the
500
+ * strings `<`, `<=`, `==`, `>=`, `>`, `array-contains`, `in`, and `array-contains-any`.
501
+ * @group Models
502
+ */
503
+ export type WhereFilterOp = "<" | "<=" | "==" | "!=" | ">=" | ">" | "array-contains" | "in" | "not-in" | "array-contains-any";
504
+ /**
505
+ * Used to define filters applied in collections
506
+ *
507
+ * e.g. `{ age: [">=", 18] }`
508
+ *
509
+ * @group Models
510
+ */
511
+ export type FilterValues<Key extends string> = Partial<Record<Key, [WhereFilterOp, unknown]>>;
512
+ /**
513
+ * Used to indicate valid filter combinations (e.g. created in Firestore)
514
+ * If the user selects a specific filter/sort combination, the CMS checks if it's
515
+ * valid, otherwise it reverts to the simpler valid case
516
+ * @group Models
517
+ */
518
+ export type FilterCombination<Key extends string> = Partial<Record<Key, "asc" | "desc">>;
519
+ /**
520
+ * Sizes in which a collection can be rendered
521
+ * @group Models
522
+ */
523
+ export type CollectionSize = "xs" | "s" | "m" | "l" | "xl";
524
+ export type AdditionalFieldDelegateProps<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> = {
525
+ entity: Entity<M>;
526
+ context: RebaseContext<USER>;
527
+ };
528
+ /**
529
+ * Use this interface for adding additional fields to entity collection views and forms.
530
+ * @group Models
531
+ */
532
+ export interface AdditionalFieldDelegate<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> {
533
+ /**
534
+ * ID of this column. You can use this id in the `properties` field of the
535
+ * collection in any order you want
536
+ */
537
+ key: string;
538
+ /**
539
+ * Header of this column
540
+ */
541
+ name: string;
542
+ /**
543
+ * Width of the generated column in pixels
544
+ */
545
+ width?: number;
546
+ /**
547
+ * Builder for the custom field
548
+ */
549
+ Builder?(props: {
550
+ entity: Entity<M>;
551
+ context: RebaseContext<USER>;
552
+ }): React.ReactNode;
553
+ /**
554
+ * If this column needs to update dynamically based on other properties,
555
+ * you can define an array of keys as strings with the
556
+ * `dependencies` prop.
557
+ * e.g. ["name", "surname"]
558
+ * This is a performance optimization, if you don't define dependencies
559
+ * it will be updated in every render.
560
+ */
561
+ dependencies?: NoInfer<Extract<keyof M, string>> | NoInfer<Extract<keyof M, string>>[] | (string & {}) | (string & {})[];
562
+ /**
563
+ * Use this prop to define the value of the column as a string or number.
564
+ * This is the value that will be used for exporting the collection.
565
+ * If `Builder` is defined, this prop will be ignored in the collection
566
+ * view.
567
+ * @param entity
568
+ */
569
+ value?(props: {
570
+ entity: Entity<M>;
571
+ context: RebaseContext;
572
+ }): string | number | Promise<string | number> | undefined;
573
+ }
574
+ export type InferCollectionType<S extends EntityCollection> = S extends EntityCollection<infer M> ? M : never;
575
+ /**
576
+ * Used in the {@link EntityCollection#defaultSelectedView} to define the default
577
+ * @group Models
578
+ */
579
+ export type DefaultSelectedViewBuilder = (params: DefaultSelectedViewParams) => string | undefined;
580
+ /**
581
+ * Used in the {@link EntityCollection#defaultSelectedView} to define the default
582
+ * @group Models
583
+ */
584
+ export type DefaultSelectedViewParams = {
585
+ status?: EntityStatus;
586
+ entityId?: string | number;
587
+ };
588
+ /**
589
+ * You can use this controller to control the table view of a collection.
590
+ */
591
+ export type EntityTableController<M extends Record<string, unknown> = Record<string, unknown>> = {
592
+ data: Entity<M>[];
593
+ dataLoading: boolean;
594
+ noMoreToLoad: boolean;
595
+ dataLoadingError?: Error;
596
+ filterValues?: FilterValues<Extract<keyof M, string> | (string & {})>;
597
+ setFilterValues?: (filterValues: FilterValues<Extract<keyof M, string> | (string & {})>) => void;
598
+ sortBy?: [Extract<keyof M, string> | (string & {}), "asc" | "desc"];
599
+ setSortBy?: (sortBy?: [Extract<keyof M, string> | (string & {}), "asc" | "desc"]) => void;
600
+ searchString?: string;
601
+ setSearchString?: (searchString?: string) => void;
602
+ clearFilter?: () => void;
603
+ itemCount?: number;
604
+ setItemCount?: (itemCount: number) => void;
605
+ initialScroll?: number;
606
+ onScroll?: (props: {
607
+ scrollDirection: "forward" | "backward";
608
+ scrollOffset: number;
609
+ scrollUpdateWasRequested: boolean;
610
+ }) => void;
611
+ paginationEnabled?: boolean;
612
+ pageSize?: number;
613
+ checkFilterCombination?: (filterValues: FilterValues<string>, sortBy?: [string, "asc" | "desc"]) => boolean;
614
+ popupCell?: SelectedCellProps<M>;
615
+ setPopupCell?: (popupCell?: SelectedCellProps<M>) => void;
616
+ onAddColumn?: (column: string) => void;
617
+ };
618
+ export type SelectedCellProps<M extends Record<string, unknown> = Record<string, unknown>> = {
619
+ propertyKey: Extract<keyof M, string> | (string & {});
620
+ cellRect: DOMRect;
621
+ width: number;
622
+ height: number;
623
+ entityPath: string;
624
+ entityId: string | number;
625
+ };
626
+ /**
627
+ * SQL operation that a policy applies to.
628
+ * @group Models
629
+ */
630
+ export type SecurityOperation = "select" | "insert" | "update" | "delete" | "all";
631
+ /**
632
+ * Flexible Row Level Security rule for a collection.
633
+ *
634
+ * Inspired by Supabase's approach to PostgreSQL RLS. Rules can range from
635
+ * simple convenience shortcuts to fully custom SQL expressions, giving you the
636
+ * full power of PostgreSQL Row Level Security.
637
+ *
638
+ * The authenticated user's identity is available in raw SQL via:
639
+ * - `auth.uid()` — the user's ID
640
+ * - `auth.roles()` — comma-separated app role IDs
641
+ * - `auth.jwt()` — full JWT claims as JSONB
642
+ *
643
+ * These are set automatically per-transaction by the backend.
644
+ *
645
+ * **How rules combine:** PostgreSQL evaluates all matching policies for an
646
+ * operation. Permissive rules are OR'd together (any one passing is enough).
647
+ * Restrictive rules are AND'd (all must pass). This mirrors Supabase behavior.
648
+ *
649
+ * **Mutual exclusivity:** `ownerField`, `access`, and raw SQL (`using`/`withCheck`)
650
+ * cannot be combined. The type system enforces this — attempting to set
651
+ * conflicting fields will produce a compile-time error.
652
+ *
653
+ * @group Models
654
+ */
655
+ export type SecurityRule = OwnerSecurityRule | PublicSecurityRule | RawSQLSecurityRule | RolesOnlySecurityRule;
656
+ /**
657
+ * Shared fields for all SecurityRule variants.
658
+ * @group Models
659
+ */
660
+ export interface SecurityRuleBase {
661
+ /**
662
+ * Optional human-readable name for the policy.
663
+ * If not provided, one will be auto-generated from the table name and operation.
664
+ * Must be unique per table.
665
+ *
666
+ * When using `operations` (array), each generated policy will have the
667
+ * operation name appended, e.g. `"owner_access_select"`, `"owner_access_update"`.
668
+ */
669
+ name?: string;
670
+ /**
671
+ * Which SQL operation this policy applies to.
672
+ * Use this when the policy targets a single operation or all operations.
673
+ *
674
+ * For multiple specific operations, use `operations` (array) instead.
675
+ * If neither is specified, defaults to `"all"`.
676
+ *
677
+ * @default "all"
678
+ */
679
+ operation?: SecurityOperation;
680
+ /**
681
+ * Array of SQL operations this policy applies to.
682
+ * The compiler will generate one PostgreSQL policy per operation, sharing
683
+ * the same configuration.
684
+ *
685
+ * This reduces boilerplate when the same rule applies to multiple (but not all)
686
+ * operations.
687
+ *
688
+ * Takes precedence over `operation` (singular) if both are specified.
689
+ *
690
+ * @example
691
+ * // Same rule for select and update
692
+ * { operations: ["select", "update"], ownerField: "user_id" }
693
+ *
694
+ * @example
695
+ * // Equivalent to operation: "all"
696
+ * { operations: ["all"], ownerField: "user_id" }
697
+ */
698
+ operations?: SecurityOperation[];
699
+ /**
700
+ * Whether this policy is `"permissive"` (default) or `"restrictive"`.
701
+ *
702
+ * - **permissive**: Multiple permissive policies for the same operation are
703
+ * OR'd together — if *any* passes, access is granted.
704
+ * - **restrictive**: Restrictive policies are AND'd with all permissive
705
+ * policies — they act as additional gates that *must* also pass.
706
+ *
707
+ * This is the same model as PostgreSQL / Supabase.
708
+ *
709
+ * @default "permissive"
710
+ */
711
+ mode?: "permissive" | "restrictive";
712
+ /**
713
+ * **Shortcut.** Restrict this rule to users that have one of these
714
+ * application-level roles.
715
+ *
716
+ * **Important:** These are NOT native PostgreSQL database roles. They are
717
+ * application roles managed by Rebase, stored in the `rebase.user_roles`
718
+ * table, and injected into each transaction via `auth.roles()`.
719
+ *
720
+ * Generates a condition like:
721
+ * `auth.roles() ~ '<role1>|<role2>'`
722
+ *
723
+ * Can be combined with `ownerField`, `access`, or raw `using`/`withCheck`.
724
+ * When combined, the role check is AND'd with the other condition.
725
+ *
726
+ * @example
727
+ * // Only admins can delete
728
+ * { operation: "delete", roles: ["admin"] }
729
+ *
730
+ * @example
731
+ * // Admins have unfiltered read access to all rows
732
+ * { operation: "select", roles: ["admin"], using: "true" }
733
+ */
734
+ roles?: string[];
735
+ /**
736
+ * **Advanced.** Native PostgreSQL database roles the policy applies to.
737
+ *
738
+ * By default, all generated policies target the `public` role (i.e.
739
+ * every database connection). This is correct for most setups where
740
+ * a single database role is used for all connections.
741
+ *
742
+ * **Important:** These are NOT the same as the application-level `roles`
743
+ * (admin, editor, viewer, etc.) — those are enforced in the USING/WITH
744
+ * CHECK clauses via `auth.roles()`. This field controls the PostgreSQL
745
+ * `TO` clause in `CREATE POLICY ... TO role_name`.
746
+ *
747
+ * Use this if you have dedicated PostgreSQL roles (e.g. `app_read`,
748
+ * `app_write`) and want policies to target specific ones.
749
+ *
750
+ * @default ["public"]
751
+ *
752
+ * @example
753
+ * // Only apply this policy when connected as `app_role`
754
+ * { operation: "select", access: "public", pgRoles: ["app_role"] }
755
+ */
756
+ pgRoles?: string[];
757
+ }
758
+ /**
759
+ * Security rule that grants access based on row ownership.
760
+ * Generates a USING/WITH CHECK clause like: `<column> = auth.uid()`
761
+ *
762
+ * Cannot be combined with `using`, `withCheck`, or `access`.
763
+ *
764
+ * @example
765
+ * { operation: "all", ownerField: "user_id" }
766
+ *
767
+ * @group Models
768
+ */
769
+ export interface OwnerSecurityRule extends SecurityRuleBase {
770
+ /** The property (column) that stores the owner's user ID. */
771
+ ownerField: string;
772
+ access?: never;
773
+ using?: never;
774
+ withCheck?: never;
775
+ }
776
+ /**
777
+ * Security rule that grants unrestricted row access (no row filtering).
778
+ * Generates `USING (true)`.
779
+ *
780
+ * This means "no row-level filter", NOT "anonymous/unauthenticated access".
781
+ * Authentication is still enforced at the API layer — this only controls which
782
+ * *rows* authenticated users can see.
783
+ *
784
+ * Cannot be combined with `using`, `withCheck`, or `ownerField`.
785
+ *
786
+ * @example
787
+ * // Public read (any authenticated user sees all rows)
788
+ * { operation: "select", access: "public" }
789
+ *
790
+ * @group Models
791
+ */
792
+ export interface PublicSecurityRule extends SecurityRuleBase {
793
+ /** Grant unrestricted row access for this operation. */
794
+ access: "public";
795
+ ownerField?: never;
796
+ using?: never;
797
+ withCheck?: never;
798
+ }
799
+ /**
800
+ * Security rule using raw SQL expressions for full PostgreSQL RLS power.
801
+ *
802
+ * Cannot be combined with `ownerField` or `access`.
803
+ *
804
+ * You can reference columns via `{column_name}` which will be resolved to
805
+ * `table.column_name` in the generated Drizzle code.
806
+ *
807
+ * @example
808
+ * // Rows published in the last 30 days are visible
809
+ * { operation: "select", using: "{published_at} > now() - interval '30 days'" }
810
+ *
811
+ * @example
812
+ * // Only the owner, or users with 'moderator' role
813
+ * {
814
+ * operation: "select",
815
+ * using: "{user_id} = auth.uid() OR auth.roles() ~ 'moderator'"
816
+ * }
817
+ *
818
+ * @group Models
819
+ */
820
+ export interface RawSQLSecurityRule extends SecurityRuleBase {
821
+ /**
822
+ * Raw SQL expression for the `USING` clause.
823
+ * This controls which *existing* rows are visible / can be modified / deleted.
824
+ * Applied to SELECT, UPDATE, and DELETE.
825
+ */
826
+ using: string;
827
+ /**
828
+ * Raw SQL expression for the `WITH CHECK` clause.
829
+ * This controls which *new/updated* row values are allowed.
830
+ * Applied to INSERT and UPDATE.
831
+ *
832
+ * If not provided on INSERT/UPDATE policies, falls back to `using`
833
+ * (which matches PostgreSQL's own default behavior).
834
+ */
835
+ withCheck?: string;
836
+ ownerField?: never;
837
+ access?: never;
838
+ }
839
+ /**
840
+ * Security rule that only filters by application roles, without any
841
+ * row-level condition (USING/WITH CHECK).
842
+ *
843
+ * Useful for simple "only admins can access this table" rules where
844
+ * no per-row filtering is needed.
845
+ *
846
+ * @example
847
+ * // Only admins can delete
848
+ * { operation: "delete", roles: ["admin"] }
849
+ *
850
+ * @group Models
851
+ */
852
+ export interface RolesOnlySecurityRule extends SecurityRuleBase {
853
+ ownerField?: never;
854
+ access?: never;
855
+ using?: never;
856
+ withCheck?: never;
857
+ }