@rebasepro/app 0.0.1-canary.4829d6e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/auth/api.d.ts +66 -0
- package/dist/auth/index.d.ts +13 -0
- package/dist/auth/types.d.ts +127 -0
- package/dist/auth/useRebaseAuthController.d.ts +13 -0
- package/dist/components/AIIcon.d.ts +17 -0
- package/dist/components/AuthSimulationMenu.d.ts +0 -0
- package/dist/components/ConfirmationDialog.d.ts +9 -0
- package/dist/components/Debug/UIReferenceView.d.ts +13 -0
- package/dist/components/Debug/UIStyleGuide.d.ts +2 -0
- package/dist/components/Debug/collection-views/CardViewDemo.d.ts +2 -0
- package/dist/components/Debug/collection-views/CollectionTableDemo.d.ts +2 -0
- package/dist/components/Debug/collection-views/KanbanBoardDemo.d.ts +2 -0
- package/dist/components/Debug/collection-views/index.d.ts +3 -0
- package/dist/components/Debug/collection-views/sample_data.d.ts +23 -0
- package/dist/components/Debug/crm-dashboard/CalendarWidget.d.ts +22 -0
- package/dist/components/Debug/crm-dashboard/CrmDashboardDemo.d.ts +2 -0
- package/dist/components/Debug/crm-dashboard/DashboardMetrics.d.ts +15 -0
- package/dist/components/Debug/crm-dashboard/PipelineOverview.d.ts +34 -0
- package/dist/components/Debug/crm-dashboard/RecentActivity.d.ts +19 -0
- package/dist/components/Debug/crm-dashboard/TaskFilters.d.ts +30 -0
- package/dist/components/Debug/crm-dashboard/TaskTable.d.ts +50 -0
- package/dist/components/Debug/crm-dashboard/TasksView.d.ts +41 -0
- package/dist/components/ErrorTooltip.d.ts +3 -0
- package/dist/components/ErrorView.d.ts +21 -0
- package/dist/components/LanguageToggle.d.ts +2 -0
- package/dist/components/LoginView/LoginView.d.ts +113 -0
- package/dist/components/LoginView/index.d.ts +2 -0
- package/dist/components/NotFoundPage.d.ts +2 -0
- package/dist/components/RebaseAuth.d.ts +10 -0
- package/dist/components/RebaseLogo.d.ts +7 -0
- package/dist/components/SchemaDriftBanner.d.ts +27 -0
- package/dist/components/UnsavedChangesDialog.d.ts +9 -0
- package/dist/components/UserDisplay.d.ts +7 -0
- package/dist/components/UserSelectPopover.d.ts +63 -0
- package/dist/components/UserSettingsView.d.ts +2 -0
- package/dist/components/common/index.d.ts +6 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/common/types.d.ts +66 -0
- package/dist/components/common/useColumnsIds.d.ts +9 -0
- package/dist/components/common/useDataTableController.d.ts +45 -0
- package/dist/components/common/useDebouncedData.d.ts +9 -0
- package/dist/components/common/useScrollRestoration.d.ts +14 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/contexts/AdminModeController.d.ts +4 -0
- package/dist/contexts/AnalyticsContext.d.ts +3 -0
- package/dist/contexts/AuthControllerContext.d.ts +3 -0
- package/dist/contexts/CollectionScopeContext.d.ts +50 -0
- package/dist/contexts/ComponentOverrideContext.d.ts +42 -0
- package/dist/contexts/CustomizationControllerContext.d.ts +3 -0
- package/dist/contexts/DataDriverContext.d.ts +3 -0
- package/dist/contexts/DataSourcesContext.d.ts +31 -0
- package/dist/contexts/DatabaseAdminContext.d.ts +3 -0
- package/dist/contexts/DialogsProvider.d.ts +4 -0
- package/dist/contexts/EffectiveRoleController.d.ts +4 -0
- package/dist/contexts/ModeController.d.ts +4 -0
- package/dist/contexts/RebaseClientInstanceContext.d.ts +6 -0
- package/dist/contexts/RebaseDataContext.d.ts +3 -0
- package/dist/contexts/SnackbarProvider.d.ts +2 -0
- package/dist/contexts/StorageSourceContext.d.ts +3 -0
- package/dist/contexts/StorageSourcesContext.d.ts +25 -0
- package/dist/contexts/UserConfigurationPersistenceContext.d.ts +3 -0
- package/dist/contexts/index.d.ts +17 -0
- package/dist/core/PluginLifecycleManager.d.ts +17 -0
- package/dist/core/PluginProviderStack.d.ts +21 -0
- package/dist/core/Rebase.d.ts +15 -0
- package/dist/core/RebaseProps.d.ts +291 -0
- package/dist/core/RebaseRouter.d.ts +4 -0
- package/dist/core/RebaseRoutes.d.ts +17 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/hooks/ApiConfigContext.d.ts +24 -0
- package/dist/hooks/data/delete.d.ts +33 -0
- package/dist/hooks/data/save.d.ts +40 -0
- package/dist/hooks/data/useCollection.d.ts +62 -0
- package/dist/hooks/data/useData.d.ts +13 -0
- package/dist/hooks/data/useDataOrder.d.ts +12 -0
- package/dist/hooks/data/useFetch.d.ts +43 -0
- package/dist/hooks/data/useRelationSelector.d.ts +52 -0
- package/dist/hooks/index.d.ts +36 -0
- package/dist/hooks/useAdminModeController.d.ts +19 -0
- package/dist/hooks/useAnalyticsController.d.ts +5 -0
- package/dist/hooks/useAuthController.d.ts +11 -0
- package/dist/hooks/useAuthSubscription.d.ts +2 -0
- package/dist/hooks/useBackendStorageSource.d.ts +30 -0
- package/dist/hooks/useBridgeRegistration.d.ts +18 -0
- package/dist/hooks/useBrowserTitleAndIcon.d.ts +6 -0
- package/dist/hooks/useBuildAdminModeController.d.ts +6 -0
- package/dist/hooks/useBuildEffectiveRoleController.d.ts +8 -0
- package/dist/hooks/useBuildLocalConfigurationPersistence.d.ts +2 -0
- package/dist/hooks/useBuildModeController.d.ts +6 -0
- package/dist/hooks/useClipboard.d.ts +57 -0
- package/dist/hooks/useCollapsedGroups.d.ts +27 -0
- package/dist/hooks/useComponentOverride.d.ts +32 -0
- package/dist/hooks/useCustomizationController.d.ts +11 -0
- package/dist/hooks/useDialogsController.d.ts +11 -0
- package/dist/hooks/useEffectiveRoleController.d.ts +7 -0
- package/dist/hooks/useLargeLayout.d.ts +1 -0
- package/dist/hooks/useModeController.d.ts +19 -0
- package/dist/hooks/usePermissions.d.ts +12 -0
- package/dist/hooks/useRebaseClient.d.ts +5 -0
- package/dist/hooks/useRebaseContext.d.ts +11 -0
- package/dist/hooks/useRebaseRegistry.d.ts +34 -0
- package/dist/hooks/useResolvedComponent.d.ts +47 -0
- package/dist/hooks/useSlot.d.ts +18 -0
- package/dist/hooks/useSnackbarController.d.ts +20 -0
- package/dist/hooks/useStorageSource.d.ts +6 -0
- package/dist/hooks/useStudioBridge.d.ts +79 -0
- package/dist/hooks/useTranslation.d.ts +17 -0
- package/dist/hooks/useUnsavedChangesDialog.d.ts +12 -0
- package/dist/hooks/useUserConfigurationPersistence.d.ts +8 -0
- package/dist/i18n/RebaseI18nProvider.d.ts +33 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.es.js +16843 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +17021 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/internal/common.d.ts +14 -0
- package/dist/internal/useRestoreScroll.d.ts +15 -0
- package/dist/locales/de.d.ts +2 -0
- package/dist/locales/en.d.ts +10 -0
- package/dist/locales/es.d.ts +10 -0
- package/dist/locales/fr.d.ts +2 -0
- package/dist/locales/hi.d.ts +2 -0
- package/dist/locales/it.d.ts +2 -0
- package/dist/locales/pt.d.ts +7 -0
- package/dist/util/constants.d.ts +1 -0
- package/dist/util/createFormexStub.d.ts +2 -0
- package/dist/util/entity_cache.d.ts +22 -0
- package/dist/util/enums.d.ts +5 -0
- package/dist/util/icon_list.d.ts +5 -0
- package/dist/util/icons.d.ts +20 -0
- package/dist/util/index.d.ts +8 -0
- package/dist/util/previews.d.ts +4 -0
- package/dist/util/useStorageUploadController.d.ts +44 -0
- package/dist/vitePlugin.d.ts +60 -0
- package/dist/vitePlugin.js +113 -0
- package/package.json +145 -0
- package/src/auth/api.ts +148 -0
- package/src/auth/index.ts +25 -0
- package/src/auth/types.ts +115 -0
- package/src/auth/useRebaseAuthController.ts +328 -0
- package/src/components/AIIcon.tsx +47 -0
- package/src/components/AuthSimulationMenu.tsx +0 -0
- package/src/components/ConfirmationDialog.tsx +48 -0
- package/src/components/Debug/UIReferenceView.tsx +958 -0
- package/src/components/Debug/UIStyleGuide.tsx +156 -0
- package/src/components/Debug/collection-views/CardViewDemo.tsx +85 -0
- package/src/components/Debug/collection-views/CollectionTableDemo.tsx +107 -0
- package/src/components/Debug/collection-views/KanbanBoardDemo.tsx +90 -0
- package/src/components/Debug/collection-views/index.ts +3 -0
- package/src/components/Debug/collection-views/sample_data.ts +42 -0
- package/src/components/Debug/crm-dashboard/CalendarWidget.tsx +389 -0
- package/src/components/Debug/crm-dashboard/CrmDashboardDemo.tsx +1102 -0
- package/src/components/Debug/crm-dashboard/DashboardMetrics.tsx +133 -0
- package/src/components/Debug/crm-dashboard/PipelineOverview.tsx +290 -0
- package/src/components/Debug/crm-dashboard/RecentActivity.tsx +215 -0
- package/src/components/Debug/crm-dashboard/TaskFilters.tsx +184 -0
- package/src/components/Debug/crm-dashboard/TaskTable.tsx +427 -0
- package/src/components/Debug/crm-dashboard/TasksView.tsx +234 -0
- package/src/components/ErrorTooltip.tsx +12 -0
- package/src/components/ErrorView.tsx +94 -0
- package/src/components/LanguageToggle.tsx +59 -0
- package/src/components/LoginView/LoginView.tsx +932 -0
- package/src/components/LoginView/index.ts +2 -0
- package/src/components/NotFoundPage.tsx +27 -0
- package/src/components/RebaseAuth.tsx +27 -0
- package/src/components/RebaseLogo.tsx +29 -0
- package/src/components/SchemaDriftBanner.tsx +102 -0
- package/src/components/UnsavedChangesDialog.tsx +46 -0
- package/src/components/UserDisplay.tsx +54 -0
- package/src/components/UserSelectPopover.tsx +399 -0
- package/src/components/UserSettingsView.tsx +318 -0
- package/src/components/common/index.ts +6 -0
- package/src/components/common/table_height.tsx +21 -0
- package/src/components/common/types.tsx +66 -0
- package/src/components/common/useColumnsIds.tsx +222 -0
- package/src/components/common/useDataTableController.tsx +514 -0
- package/src/components/common/useDebouncedData.ts +49 -0
- package/src/components/common/useScrollRestoration.tsx +68 -0
- package/src/components/index.tsx +26 -0
- package/src/contexts/AdminModeController.tsx +11 -0
- package/src/contexts/AnalyticsContext.tsx +4 -0
- package/src/contexts/AuthControllerContext.tsx +4 -0
- package/src/contexts/CollectionScopeContext.tsx +67 -0
- package/src/contexts/ComponentOverrideContext.tsx +81 -0
- package/src/contexts/CustomizationControllerContext.tsx +4 -0
- package/src/contexts/DataDriverContext.tsx +4 -0
- package/src/contexts/DataSourcesContext.tsx +36 -0
- package/src/contexts/DatabaseAdminContext.tsx +4 -0
- package/src/contexts/DialogsProvider.tsx +56 -0
- package/src/contexts/EffectiveRoleController.tsx +12 -0
- package/src/contexts/ModeController.tsx +11 -0
- package/src/contexts/RebaseClientInstanceContext.tsx +7 -0
- package/src/contexts/RebaseDataContext.tsx +4 -0
- package/src/contexts/SnackbarProvider.tsx +15 -0
- package/src/contexts/StorageSourceContext.tsx +4 -0
- package/src/contexts/StorageSourcesContext.tsx +30 -0
- package/src/contexts/UserConfigurationPersistenceContext.tsx +4 -0
- package/src/contexts/index.ts +17 -0
- package/src/core/PluginLifecycleManager.tsx +95 -0
- package/src/core/PluginProviderStack.tsx +40 -0
- package/src/core/Rebase.tsx +439 -0
- package/src/core/RebaseProps.tsx +320 -0
- package/src/core/RebaseRouter.tsx +17 -0
- package/src/core/RebaseRoutes.tsx +24 -0
- package/src/core/index.tsx +5 -0
- package/src/hooks/ApiConfigContext.tsx +41 -0
- package/src/hooks/data/delete.ts +55 -0
- package/src/hooks/data/save.ts +77 -0
- package/src/hooks/data/useCollection.tsx +176 -0
- package/src/hooks/data/useData.tsx +18 -0
- package/src/hooks/data/useDataOrder.ts +26 -0
- package/src/hooks/data/useFetch.tsx +140 -0
- package/src/hooks/data/useRelationSelector.tsx +234 -0
- package/src/hooks/index.tsx +45 -0
- package/src/hooks/useAdminModeController.tsx +23 -0
- package/src/hooks/useAnalyticsController.tsx +8 -0
- package/src/hooks/useAuthController.tsx +14 -0
- package/src/hooks/useAuthSubscription.ts +87 -0
- package/src/hooks/useBackendStorageSource.ts +288 -0
- package/src/hooks/useBridgeRegistration.tsx +32 -0
- package/src/hooks/useBrowserTitleAndIcon.tsx +23 -0
- package/src/hooks/useBuildAdminModeController.tsx +24 -0
- package/src/hooks/useBuildEffectiveRoleController.tsx +31 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +75 -0
- package/src/hooks/useBuildModeController.tsx +71 -0
- package/src/hooks/useClipboard.tsx +158 -0
- package/src/hooks/useCollapsedGroups.ts +116 -0
- package/src/hooks/useComponentOverride.tsx +59 -0
- package/src/hooks/useCustomizationController.tsx +14 -0
- package/src/hooks/useDialogsController.tsx +15 -0
- package/src/hooks/useEffectiveRoleController.tsx +10 -0
- package/src/hooks/useLargeLayout.tsx +65 -0
- package/src/hooks/useModeController.tsx +23 -0
- package/src/hooks/usePermissions.ts +44 -0
- package/src/hooks/useRebaseClient.tsx +10 -0
- package/src/hooks/useRebaseContext.tsx +83 -0
- package/src/hooks/useRebaseRegistry.tsx +91 -0
- package/src/hooks/useResolvedComponent.tsx +159 -0
- package/src/hooks/useSlot.tsx +64 -0
- package/src/hooks/useSnackbarController.tsx +52 -0
- package/src/hooks/useStorageSource.tsx +11 -0
- package/src/hooks/useStudioBridge.tsx +209 -0
- package/src/hooks/useTranslation.ts +33 -0
- package/src/hooks/useUnsavedChangesDialog.tsx +64 -0
- package/src/hooks/useUserConfigurationPersistence.tsx +11 -0
- package/src/i18n/RebaseI18nProvider.tsx +160 -0
- package/src/index.ts +25 -0
- package/src/internal/common.tsx +16 -0
- package/src/internal/useRestoreScroll.tsx +69 -0
- package/src/locales/de.ts +902 -0
- package/src/locales/en.ts +980 -0
- package/src/locales/es.ts +922 -0
- package/src/locales/fr.ts +901 -0
- package/src/locales/hi.ts +901 -0
- package/src/locales/it.ts +901 -0
- package/src/locales/pt.ts +909 -0
- package/src/util/constants.ts +7 -0
- package/src/util/createFormexStub.tsx +66 -0
- package/src/util/entity_cache.ts +239 -0
- package/src/util/enums.ts +32 -0
- package/src/util/icon_list.ts +22 -0
- package/src/util/icons.tsx +149 -0
- package/src/util/index.ts +12 -0
- package/src/util/previews.ts +105 -0
- package/src/util/useStorageUploadController.tsx +350 -0
- package/src/vitePlugin.ts +196 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ComponentOverrideMap } from "@rebasepro/types";
|
|
3
|
+
/**
|
|
4
|
+
* Internal state for the component override resolution chain.
|
|
5
|
+
* Holds both global overrides (set on `<Rebase>`) and collection-scoped
|
|
6
|
+
* overrides (set on individual collections).
|
|
7
|
+
*
|
|
8
|
+
* Resolution priority: collection > global > default.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
interface ComponentOverrideState {
|
|
13
|
+
globalOverrides: ComponentOverrideMap;
|
|
14
|
+
collectionOverrides: ComponentOverrideMap;
|
|
15
|
+
}
|
|
16
|
+
export declare const ComponentOverrideContext: React.Context<ComponentOverrideState>;
|
|
17
|
+
/**
|
|
18
|
+
* Provider set at the `<Rebase>` root level to supply global component overrides.
|
|
19
|
+
*
|
|
20
|
+
* @internal — Used by the Rebase component. End users set overrides via
|
|
21
|
+
* the `components` prop on `<Rebase>`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function GlobalComponentOverrideProvider({ overrides, children }: {
|
|
24
|
+
overrides?: ComponentOverrideMap;
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Provider set at the collection level to layer collection-scoped overrides
|
|
29
|
+
* on top of global overrides.
|
|
30
|
+
*
|
|
31
|
+
* When a collection defines `components`, this provider is mounted
|
|
32
|
+
* around the collection's view subtree. Components within the subtree
|
|
33
|
+
* will resolve overrides in order: collection → global → default.
|
|
34
|
+
*
|
|
35
|
+
* @internal — Used by DataCollectionView when a collection has
|
|
36
|
+
* `components` defined.
|
|
37
|
+
*/
|
|
38
|
+
export declare function CollectionComponentOverrideProvider({ overrides, children }: {
|
|
39
|
+
overrides?: ComponentOverrideMap;
|
|
40
|
+
children: React.ReactNode;
|
|
41
|
+
}): React.JSX.Element;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DataSourceDefinition, RebaseData } from "@rebasepro/types";
|
|
3
|
+
/**
|
|
4
|
+
* The data-source configuration provided to `<Rebase>`: the declared
|
|
5
|
+
* definitions plus the built {@link RebaseData} instances for direct/custom
|
|
6
|
+
* transports.
|
|
7
|
+
*
|
|
8
|
+
* The actual path-based routing is assembled by the navigation layer (which
|
|
9
|
+
* has the collection registry) via `resolveDataSource` + `buildRoutedRebaseData`
|
|
10
|
+
* and re-provided through `RebaseDataContext`.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export interface DataSourcesContextValue {
|
|
15
|
+
/** All declared data sources, keyed by data-source key. */
|
|
16
|
+
registry: Record<string, DataSourceDefinition>;
|
|
17
|
+
/**
|
|
18
|
+
* Built {@link RebaseData} for direct/custom data sources, keyed by
|
|
19
|
+
* data-source key. Server-mediated sources are absent (they ride the
|
|
20
|
+
* default client).
|
|
21
|
+
*/
|
|
22
|
+
sources: Record<string, RebaseData>;
|
|
23
|
+
}
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare const DataSourcesContext: React.Context<DataSourcesContextValue>;
|
|
26
|
+
/**
|
|
27
|
+
* Access the data-source configuration provided to `<Rebase>` via the
|
|
28
|
+
* `dataSources` prop.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare const useDataSources: () => DataSourcesContextValue;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EffectiveRoleController } from "@rebasepro/types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare const EffectiveRoleControllerContext: React.Context<EffectiveRoleController>;
|
|
4
|
+
export declare const EffectiveRoleControllerProvider: React.Provider<EffectiveRoleController>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { StorageSource, StorageSourceDefinition } from "@rebasepro/types";
|
|
3
|
+
/**
|
|
4
|
+
* The storage-source configuration provided to `<Rebase>`: the declared
|
|
5
|
+
* definitions and the built {@link StorageSource} instances, wrapped in a
|
|
6
|
+
* {@link StorageSourceRegistry} for fast key-based lookup.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors the {@link DataSourcesContext} pattern used for databases.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export interface StorageSourcesContextValue {
|
|
13
|
+
/** All declared storage sources, keyed by storage-source key. */
|
|
14
|
+
registry: Record<string, StorageSourceDefinition>;
|
|
15
|
+
/** Built {@link StorageSource} for direct sources, keyed by key. */
|
|
16
|
+
sources: Record<string, StorageSource>;
|
|
17
|
+
}
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const StorageSourcesContext: React.Context<StorageSourcesContextValue>;
|
|
20
|
+
/**
|
|
21
|
+
* Access the storage-source configuration provided to `<Rebase>` via the
|
|
22
|
+
* `storageSources` prop.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare const useStorageSources: () => StorageSourcesContextValue;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./SnackbarProvider";
|
|
2
|
+
export * from "./ModeController";
|
|
3
|
+
export * from "./AdminModeController";
|
|
4
|
+
export * from "./EffectiveRoleController";
|
|
5
|
+
export * from "./AuthControllerContext";
|
|
6
|
+
export * from "./DataDriverContext";
|
|
7
|
+
export * from "./DataSourcesContext";
|
|
8
|
+
export * from "./RebaseDataContext";
|
|
9
|
+
export * from "./AnalyticsContext";
|
|
10
|
+
export * from "./StorageSourceContext";
|
|
11
|
+
export * from "./StorageSourcesContext";
|
|
12
|
+
export * from "./UserConfigurationPersistenceContext";
|
|
13
|
+
export * from "./DialogsProvider";
|
|
14
|
+
export * from "./RebaseClientInstanceContext";
|
|
15
|
+
export * from "./CustomizationControllerContext";
|
|
16
|
+
export * from "./ComponentOverrideContext";
|
|
17
|
+
export * from "./CollectionScopeContext";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RebasePlugin, RebaseContext } from "@rebasepro/types";
|
|
2
|
+
/**
|
|
3
|
+
* Render-less component that manages plugin lifecycle hooks.
|
|
4
|
+
*
|
|
5
|
+
* - Calls `lifecycle.onMount(context)` when plugins mount.
|
|
6
|
+
* - Calls `lifecycle.onUnmount()` when plugins unmount.
|
|
7
|
+
* - Subscribes to auth state changes and calls `lifecycle.onAuthStateChange`.
|
|
8
|
+
*
|
|
9
|
+
* Mount this component inside the Rebase tree, below PluginProviderStack,
|
|
10
|
+
* so that the RebaseContext is fully available.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function PluginLifecycleManager({ plugins, context }: {
|
|
15
|
+
plugins: RebasePlugin[];
|
|
16
|
+
context: RebaseContext;
|
|
17
|
+
}): null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RebasePlugin } from "@rebasepro/types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Wraps children with all provider components from plugins that match the given scope.
|
|
5
|
+
*
|
|
6
|
+
* Replaces the 3 copy-pasted `plugins.forEach(plugin => { if (plugin.form?.provider) ... })` patterns
|
|
7
|
+
* in Rebase.tsx, EditViewBinding.tsx, and PopupFormField.tsx.
|
|
8
|
+
*
|
|
9
|
+
* @param plugins - Array of plugins to extract providers from.
|
|
10
|
+
* @param scope - `"root"` or `"form"` — which providers to apply.
|
|
11
|
+
* @param scopeProps - Additional props passed to each provider component.
|
|
12
|
+
* @param children - The content to wrap.
|
|
13
|
+
*
|
|
14
|
+
* @group Core
|
|
15
|
+
*/
|
|
16
|
+
export declare function PluginProviderStack({ plugins, scope, scopeProps, children }: {
|
|
17
|
+
plugins: RebasePlugin[];
|
|
18
|
+
scope: "root" | "form";
|
|
19
|
+
scopeProps?: Record<string, unknown>;
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}): React.ReactNode;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RebaseProps } from "./RebaseProps";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { User } from "@rebasepro/types";
|
|
4
|
+
/**
|
|
5
|
+
* If you are using independent components of the CMS
|
|
6
|
+
* you need to wrap them with this main component, so the internal hooks work.
|
|
7
|
+
*
|
|
8
|
+
* This is the main component of Rebase. It acts as the provider of all the
|
|
9
|
+
* internal contexts and hooks.
|
|
10
|
+
*
|
|
11
|
+
* You only need to use this component if you are building a custom app.
|
|
12
|
+
*
|
|
13
|
+
* @group Core
|
|
14
|
+
*/
|
|
15
|
+
export declare function Rebase<USER extends User>(props: RebaseProps<USER>): React.JSX.Element;
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Locale, User, AuthController, AnalyticsEvent, DataDriver, DataSourceDefinition, StorageSource, StorageSourceDefinition, UserConfigurationPersistence, DatabaseAdmin, RebaseClient, RebaseContext, EntityLinkBuilder, RebasePlugin, SlotContribution, PropertyConfig, EntityCustomView, EntityAction, RebaseTranslations, ComponentOverrideMap } from "@rebasepro/types";
|
|
3
|
+
/**
|
|
4
|
+
* A data source registered on `<Rebase>`. Extends the shared
|
|
5
|
+
* {@link DataSourceDefinition} with the frontend {@link DataDriver} used for
|
|
6
|
+
* `direct`/`custom` transports. Server-mediated sources omit `driver` — they
|
|
7
|
+
* are reached through the `client`.
|
|
8
|
+
*
|
|
9
|
+
* @group Models
|
|
10
|
+
*/
|
|
11
|
+
export type RebaseDataSource = DataSourceDefinition & {
|
|
12
|
+
/**
|
|
13
|
+
* The client-side driver for this source. Required for `direct`/`custom`
|
|
14
|
+
* transports; omit for `server` transport (handled by the `client`).
|
|
15
|
+
*
|
|
16
|
+
* When `transport` is not stated it is inferred from this field:
|
|
17
|
+
* driver present → `"direct"`, absent → `"server"`.
|
|
18
|
+
*/
|
|
19
|
+
driver?: DataDriver;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A storage source registered on `<Rebase>`. Extends the shared
|
|
23
|
+
* {@link StorageSourceDefinition} with an optional frontend
|
|
24
|
+
* {@link StorageSource} for `direct` transports. Server-mediated sources
|
|
25
|
+
* omit `source` — they are reached through the `client`.
|
|
26
|
+
*
|
|
27
|
+
* @group Models
|
|
28
|
+
*/
|
|
29
|
+
export type RebaseStorageSource = StorageSourceDefinition & {
|
|
30
|
+
/**
|
|
31
|
+
* The client-side StorageSource for this backend. Required for `direct`
|
|
32
|
+
* transport (e.g. Firebase Storage via `@firebase/storage`); omit for
|
|
33
|
+
* `server` transport (proxied by the Rebase backend).
|
|
34
|
+
*/
|
|
35
|
+
source?: StorageSource;
|
|
36
|
+
};
|
|
37
|
+
/** DeepPartial helper — allows partial overrides at any nesting level */
|
|
38
|
+
type DeepPartial<T> = T extends object ? {
|
|
39
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
40
|
+
} : T;
|
|
41
|
+
/**
|
|
42
|
+
* Controller to simulate different roles when dev mode is active.
|
|
43
|
+
* @group Models
|
|
44
|
+
*/
|
|
45
|
+
export interface EffectiveRoleController {
|
|
46
|
+
effectiveRole: string | null;
|
|
47
|
+
setEffectiveRole: (role: string | null) => void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Props for the main {@link Rebase} component.
|
|
51
|
+
*
|
|
52
|
+
* ## Data
|
|
53
|
+
*
|
|
54
|
+
* Everything is a data source, and there is one list: {@link dataSources}.
|
|
55
|
+
* The **default** source (serving every collection without a `dataSource`
|
|
56
|
+
* key) resolves with three rules:
|
|
57
|
+
*
|
|
58
|
+
* 1. A `dataSources` entry keyed `"(default)"` (`DEFAULT_DATA_SOURCE_KEY`)
|
|
59
|
+
* *with a driver* is the default source.
|
|
60
|
+
* 2. Otherwise `client.data` is the default.
|
|
61
|
+
* 3. Otherwise, if exactly one source is registered, it is the default.
|
|
62
|
+
* Zero sources, or several without a `"(default)"` key, **throw**.
|
|
63
|
+
*
|
|
64
|
+
* A `"(default)"` entry *without* a driver never provides data — it only
|
|
65
|
+
* declares the default source's `engine`/`label` (capabilities) when the
|
|
66
|
+
* client is the default.
|
|
67
|
+
*
|
|
68
|
+
* All other `dataSources` entries are routed non-default sources:
|
|
69
|
+
* collections opt in via `collection.dataSource`.
|
|
70
|
+
*
|
|
71
|
+
* ### Auth
|
|
72
|
+
*
|
|
73
|
+
* - `authController` prop → completely disables the `client.auth`
|
|
74
|
+
* subscription (an override, not a merge). The recommended pattern is to
|
|
75
|
+
* pass both `client` and an `authController` built from that client via
|
|
76
|
+
* `useRebaseAuthController({ client })`.
|
|
77
|
+
* - Otherwise, `client.auth` is subscribed to via `useAuthSubscription`.
|
|
78
|
+
*
|
|
79
|
+
* ### Storage (default source)
|
|
80
|
+
*
|
|
81
|
+
* Default: `storageSource` prop ?? `client.storage`.
|
|
82
|
+
*
|
|
83
|
+
* Named sources are merged in priority order (later entries with the same
|
|
84
|
+
* key overwrite earlier ones):
|
|
85
|
+
* 1. Backend-discovered remote definitions (`client.fetchStorageSources()`,
|
|
86
|
+
* fetched after auth/login-skip).
|
|
87
|
+
* 2. Client `storageRegistry` entries.
|
|
88
|
+
* 3. `storageSources` prop entries (live `direct` instances; `server`-
|
|
89
|
+
* transport keys are materialized via `client.createStorageSource`).
|
|
90
|
+
* 4. Default storage (keyed `DEFAULT_STORAGE_SOURCE_KEY`) as fallback.
|
|
91
|
+
*
|
|
92
|
+
* ## Decision Ladder
|
|
93
|
+
*
|
|
94
|
+
* | Scenario | Props to use |
|
|
95
|
+
* |---|---|
|
|
96
|
+
* | Standard app | `client` (+ `authController` built from it) |
|
|
97
|
+
* | Multi-backend data | add `dataSources` |
|
|
98
|
+
* | Multi-backend storage | add `storageSources` |
|
|
99
|
+
* | Fully headless / custom | `dataSources` with a `"(default)"`-keyed driver entry + `storageSource` |
|
|
100
|
+
*
|
|
101
|
+
* @group Models
|
|
102
|
+
*/
|
|
103
|
+
export type RebaseProps<USER extends User> = {
|
|
104
|
+
/**
|
|
105
|
+
* The root components of your application. Use RebaseAdmin, RebaseStudio, and RebaseShell.
|
|
106
|
+
* Alternatively, pass a render function that receives { context, loading }.
|
|
107
|
+
*/
|
|
108
|
+
children: React.ReactNode | ((props: {
|
|
109
|
+
context: RebaseContext;
|
|
110
|
+
loading: boolean;
|
|
111
|
+
}) => React.ReactNode);
|
|
112
|
+
/**
|
|
113
|
+
* Optional base path for the entire Rebase app.
|
|
114
|
+
* Defaults to "/"
|
|
115
|
+
*/
|
|
116
|
+
basePath?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Optional base path for the CMS collections.
|
|
119
|
+
* Defaults to "/c"
|
|
120
|
+
*/
|
|
121
|
+
baseCollectionPath?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Base URL for the backend API (e.g. "http://localhost:3001").
|
|
124
|
+
* When provided, this is available via `useApiConfig()` to any hook
|
|
125
|
+
* in the tree, reducing repetitive `apiUrl` threading.
|
|
126
|
+
*/
|
|
127
|
+
apiUrl?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Format of the dates in the CMS.
|
|
130
|
+
* Defaults to 'MMMM dd, yyyy, HH:mm:ss'
|
|
131
|
+
*/
|
|
132
|
+
dateTimeFormat?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Locale of the CMS, currently only affecting dates
|
|
135
|
+
*/
|
|
136
|
+
locale?: Locale;
|
|
137
|
+
/**
|
|
138
|
+
* Unified RebaseClient for data, auth, and storage.
|
|
139
|
+
*
|
|
140
|
+
* `client.data` is the default data source unless a {@link dataSources}
|
|
141
|
+
* entry keyed `"(default)"` carries a driver.
|
|
142
|
+
* `client.auth` is subscribed unless `authController` is provided.
|
|
143
|
+
* `client.storage` is used unless `storageSource` is provided.
|
|
144
|
+
*/
|
|
145
|
+
client?: RebaseClient;
|
|
146
|
+
/**
|
|
147
|
+
* The data sources of the app. Each entry pairs a
|
|
148
|
+
* {@link DataSourceDefinition} (key, engine, transport) with an optional
|
|
149
|
+
* client-side {@link DataDriver}.
|
|
150
|
+
*
|
|
151
|
+
* Register the **direct** (e.g. Firestore, talking straight to its backend)
|
|
152
|
+
* and **custom** sources here. Server-mediated sources (Postgres, MongoDB,
|
|
153
|
+
* …) do *not* need an entry — they ride the `client` and are routed by the
|
|
154
|
+
* Rebase backend.
|
|
155
|
+
*
|
|
156
|
+
* An entry keyed `"(default)"` with a driver **replaces** `client.data`
|
|
157
|
+
* as the default data source (this is how a fully client-side app, e.g.
|
|
158
|
+
* Firestore-only, is wired). Without a driver, a `"(default)"` entry just
|
|
159
|
+
* declares the default source's engine/capabilities.
|
|
160
|
+
*
|
|
161
|
+
* Collections are routed automatically by their `dataSource` key (resolved
|
|
162
|
+
* by collection path against the registry), so routing works transparently
|
|
163
|
+
* for list/entity views, references, the board view, import/export, and
|
|
164
|
+
* programmatic `context.data` access — no per-collection wiring.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```tsx
|
|
168
|
+
* // Postgres via the Rebase client (default) + a direct Firestore source.
|
|
169
|
+
* <Rebase
|
|
170
|
+
* client={rebaseClient}
|
|
171
|
+
* dataSources={[
|
|
172
|
+
* { key: "analytics", engine: "firestore", driver: firestoreDriver }
|
|
173
|
+
* ]}
|
|
174
|
+
* >
|
|
175
|
+
* // Collections opt in with `{ ..., dataSource: "analytics" }`.
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
dataSources?: RebaseDataSource[];
|
|
179
|
+
/**
|
|
180
|
+
* Custom auth controller. When provided, the `client.auth` subscription
|
|
181
|
+
* is **completely disabled** (not merged).
|
|
182
|
+
*
|
|
183
|
+
* The recommended pattern is to pass both `client` and an
|
|
184
|
+
* `authController` built from that client:
|
|
185
|
+
* ```tsx
|
|
186
|
+
* const authController = useRebaseAuthController({ client });
|
|
187
|
+
* <Rebase client={client} authController={authController} />
|
|
188
|
+
* ```
|
|
189
|
+
* This lets the `authController` own the auth lifecycle while `client`
|
|
190
|
+
* still provides data and storage.
|
|
191
|
+
*/
|
|
192
|
+
authController?: AuthController<USER>;
|
|
193
|
+
/**
|
|
194
|
+
* Default storage source. Overrides `client.storage` when provided.
|
|
195
|
+
* Named sources in {@link storageSources} are unaffected.
|
|
196
|
+
*/
|
|
197
|
+
storageSource?: StorageSource;
|
|
198
|
+
/**
|
|
199
|
+
* Additional storage sources beyond the default `client.storage`.
|
|
200
|
+
*
|
|
201
|
+
* Register **direct** (e.g. Firebase Storage, talking straight to the
|
|
202
|
+
* cloud) sources here. Server-mediated sources (S3, GCS proxied by the
|
|
203
|
+
* Rebase backend) do *not* need an entry — they are routed by
|
|
204
|
+
* `storageId` query parameter on the REST API.
|
|
205
|
+
*
|
|
206
|
+
* Collection properties opt in via `storage.storageSource: "key"`.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```tsx
|
|
210
|
+
* <Rebase
|
|
211
|
+
* client={rebaseClient}
|
|
212
|
+
* storageSources={[
|
|
213
|
+
* { key: "firebase", engine: "firebase", transport: "direct", source: firebaseStorageSource }
|
|
214
|
+
* ]}
|
|
215
|
+
* >
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
storageSources?: RebaseStorageSource[];
|
|
219
|
+
/**
|
|
220
|
+
* Administrative database operations (SQL, schema discovery).
|
|
221
|
+
* Only needed when the studio/admin features are enabled.
|
|
222
|
+
*/
|
|
223
|
+
databaseAdmin?: DatabaseAdmin;
|
|
224
|
+
/**
|
|
225
|
+
* Use this controller to access the configuration that is stored locally,
|
|
226
|
+
* and not defined in code
|
|
227
|
+
*/
|
|
228
|
+
userConfigPersistence?: UserConfigurationPersistence;
|
|
229
|
+
/**
|
|
230
|
+
* Callback used to get analytics events from the CMS
|
|
231
|
+
*/
|
|
232
|
+
onAnalyticsEvent?: (event: AnalyticsEvent, data?: object) => void;
|
|
233
|
+
/**
|
|
234
|
+
* Optional link builder you can add to generate a button in your entity forms.
|
|
235
|
+
* The function must return a URL that gets opened when the button is clicked
|
|
236
|
+
*/
|
|
237
|
+
entityLinkBuilder?: EntityLinkBuilder;
|
|
238
|
+
/**
|
|
239
|
+
* Plugins loaded in the CMS
|
|
240
|
+
*/
|
|
241
|
+
plugins?: RebasePlugin[];
|
|
242
|
+
/**
|
|
243
|
+
* Extra slots for the CMS
|
|
244
|
+
*/
|
|
245
|
+
slots?: SlotContribution[];
|
|
246
|
+
/**
|
|
247
|
+
* Property configs (widgets)
|
|
248
|
+
*/
|
|
249
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
250
|
+
/**
|
|
251
|
+
* Entity Views
|
|
252
|
+
*/
|
|
253
|
+
entityViews?: EntityCustomView[];
|
|
254
|
+
/**
|
|
255
|
+
* Entity Actions
|
|
256
|
+
*/
|
|
257
|
+
entityActions?: EntityAction[];
|
|
258
|
+
/**
|
|
259
|
+
* Controller to simulate different roles when dev mode is active.
|
|
260
|
+
*/
|
|
261
|
+
effectiveRoleController?: EffectiveRoleController;
|
|
262
|
+
/**
|
|
263
|
+
* Override or extend any Rebase UI string, keyed by locale.
|
|
264
|
+
*/
|
|
265
|
+
translations?: {
|
|
266
|
+
[locale: string]: DeepPartial<RebaseTranslations>;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Override built-in UI components with custom implementations.
|
|
270
|
+
*
|
|
271
|
+
* Keys are component names from {@link OverridableComponentName}.
|
|
272
|
+
* Values specify the replacement component and an optional `wrap`
|
|
273
|
+
* flag for the wrapping pattern.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```tsx
|
|
277
|
+
* <Rebase
|
|
278
|
+
* client={client}
|
|
279
|
+
* components={{
|
|
280
|
+
* "Shell.AppBar": { Component: MyCustomAppBar },
|
|
281
|
+
* "EditView.FormActions": {
|
|
282
|
+
* Component: MyFormActions,
|
|
283
|
+
* wrap: true
|
|
284
|
+
* }
|
|
285
|
+
* }}
|
|
286
|
+
* >
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
components?: ComponentOverrideMap;
|
|
290
|
+
};
|
|
291
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A drop-in replacement for react-router's `<Routes>` that preserves the
|
|
4
|
+
* underlying view when a side dialog navigates the URL to a different path.
|
|
5
|
+
*
|
|
6
|
+
* When opening a side dialog from e.g. `/posts` to `authors/123#side`,
|
|
7
|
+
* the `base_location` stored in router state is used so the route tree
|
|
8
|
+
* keeps rendering the original `/posts` view underneath the dialog overlay.
|
|
9
|
+
*
|
|
10
|
+
* Additionally, registered views from `useNavigationStateController()` are
|
|
11
|
+
* automatically routed — no need to manually map them to `<Route>` elements.
|
|
12
|
+
* Views with `nestedRoutes: true` get a wildcard route (slug/*) as well.
|
|
13
|
+
* Explicitly declared `children` routes take priority.
|
|
14
|
+
*/
|
|
15
|
+
export declare function RebaseRoutes({ children }: {
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for API connectivity. Passed once at the top level
|
|
4
|
+
* and available to any hook that needs `apiUrl` or `getAuthToken`.
|
|
5
|
+
*
|
|
6
|
+
* Individual hooks can still accept explicit overrides — this context
|
|
7
|
+
* serves as a fallback to eliminate repetitive threading.
|
|
8
|
+
*/
|
|
9
|
+
export interface ApiConfig {
|
|
10
|
+
apiUrl: string;
|
|
11
|
+
getAuthToken?: () => Promise<string | null>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Read the API config from context. Returns `undefined` if no provider is present,
|
|
15
|
+
* allowing hooks to fall back to their own props.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useApiConfig(): ApiConfig | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Provide API configuration (apiUrl, getAuthToken) to the entire subtree.
|
|
20
|
+
* Typically rendered inside `<Rebase>` or at the app root.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ApiConfigProvider({ apiUrl, getAuthToken, children }: ApiConfig & {
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
2
|
+
import { Entity, CollectionCallbacks, RebaseContext, User } from "@rebasepro/types";
|
|
3
|
+
import { RebaseData } from "@rebasepro/types";
|
|
4
|
+
/**
|
|
5
|
+
* @group Hooks and utilities
|
|
6
|
+
*/
|
|
7
|
+
export type DeleteEntityWithCallbacksProps<M extends Record<string, any>, USER extends User = User> = {
|
|
8
|
+
entity: Entity<M>;
|
|
9
|
+
collection?: CollectionConfig<M>;
|
|
10
|
+
callbacks?: CollectionCallbacks<M, USER>;
|
|
11
|
+
onDeleteSuccess?: (entity: Entity<M>) => void;
|
|
12
|
+
onDeleteFailure?: (entity: Entity<M>, e: Error) => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* This function is in charge of deleting a entity.
|
|
16
|
+
* It will run all the delete callbacks specified in the collection.
|
|
17
|
+
* It is also possible to attach callbacks on save success or error, and callback
|
|
18
|
+
* errors.
|
|
19
|
+
*
|
|
20
|
+
* @param data
|
|
21
|
+
* @param entity
|
|
22
|
+
* @param collection
|
|
23
|
+
* @param callbacks
|
|
24
|
+
* @param onDeleteSuccess
|
|
25
|
+
* @param onDeleteFailure
|
|
26
|
+
* @param context
|
|
27
|
+
* @group Hooks and utilities
|
|
28
|
+
*/
|
|
29
|
+
export declare function deleteEntityWithCallbacks<M extends Record<string, any>, USER extends User>({ data, entity, collection, callbacks, onDeleteSuccess, onDeleteFailure, context }: DeleteEntityWithCallbacksProps<M> & {
|
|
30
|
+
collection: CollectionConfig<M>;
|
|
31
|
+
data: RebaseData;
|
|
32
|
+
context: RebaseContext<USER>;
|
|
33
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
2
|
+
import { Entity, EntityStatus, EntityValues, RebaseContext } from "@rebasepro/types";
|
|
3
|
+
import { RebaseData } from "@rebasepro/types";
|
|
4
|
+
/**
|
|
5
|
+
* @group Hooks and utilities
|
|
6
|
+
*/
|
|
7
|
+
export type SaveEntityWithCallbacksProps<M extends Record<string, unknown>> = {
|
|
8
|
+
path: string;
|
|
9
|
+
values: Partial<EntityValues<M>>;
|
|
10
|
+
entityId?: string | number;
|
|
11
|
+
previousValues?: Partial<EntityValues<M>>;
|
|
12
|
+
collection?: CollectionConfig<M>;
|
|
13
|
+
status: EntityStatus;
|
|
14
|
+
afterSave?: (updatedEntity: Entity<M>) => void;
|
|
15
|
+
afterSaveError?: (e: Error) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* This function is in charge of saving a entity.
|
|
19
|
+
* It will run all the save callbacks specified in the collection.
|
|
20
|
+
* It is also possible to attach callbacks on save success or error, and callback
|
|
21
|
+
* errors.
|
|
22
|
+
*
|
|
23
|
+
* @param collection
|
|
24
|
+
* @param path
|
|
25
|
+
* @param entityId
|
|
26
|
+
* @param callbacks
|
|
27
|
+
* @param values
|
|
28
|
+
* @param previousValues
|
|
29
|
+
* @param status
|
|
30
|
+
* @param data
|
|
31
|
+
* @param context
|
|
32
|
+
* @param afterSave
|
|
33
|
+
* @param afterSaveError
|
|
34
|
+
* @group Hooks and utilities
|
|
35
|
+
*/
|
|
36
|
+
export declare function saveEntityWithCallbacks<M extends Record<string, unknown>>({ collection, path, entityId, values, previousValues, status, data, context, afterSave, afterSaveError }: SaveEntityWithCallbacksProps<M> & {
|
|
37
|
+
collection: CollectionConfig;
|
|
38
|
+
data: RebaseData;
|
|
39
|
+
context: RebaseContext;
|
|
40
|
+
}): Promise<Entity<M>>;
|