@rebasepro/types 0.10.0 → 0.10.1-canary.0a881d4

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 (96) hide show
  1. package/dist/call_context.d.ts +51 -0
  2. package/dist/controllers/auth_state.d.ts +23 -0
  3. package/dist/controllers/client.d.ts +3 -1
  4. package/dist/controllers/collection_registry.d.ts +5 -1
  5. package/dist/controllers/data_driver.d.ts +31 -2
  6. package/dist/controllers/index.d.ts +1 -10
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.es.js +374 -1
  9. package/dist/index.es.js.map +1 -1
  10. package/dist/types/admin_block.d.ts +34 -0
  11. package/dist/types/backend.d.ts +30 -1
  12. package/dist/types/channel_bus.d.ts +192 -0
  13. package/dist/types/collection_contract.d.ts +43 -0
  14. package/dist/types/collections.d.ts +17 -789
  15. package/dist/types/component_ref.d.ts +39 -6
  16. package/dist/types/entity_callbacks.d.ts +1 -1
  17. package/dist/types/index.d.ts +7 -15
  18. package/dist/types/project_manifest.d.ts +336 -0
  19. package/dist/types/properties.d.ts +12 -157
  20. package/dist/types/schema_version.d.ts +18 -0
  21. package/dist/types/security_rules.d.ts +320 -0
  22. package/dist/types/storage_authorize.d.ts +74 -0
  23. package/package.json +3 -6
  24. package/src/call_context.ts +56 -0
  25. package/src/controllers/auth_state.ts +24 -0
  26. package/src/controllers/client.ts +3 -2
  27. package/src/controllers/collection_registry.ts +5 -1
  28. package/src/controllers/data_driver.ts +58 -2
  29. package/src/controllers/index.ts +1 -10
  30. package/src/index.ts +1 -1
  31. package/src/types/admin_block.ts +75 -0
  32. package/src/types/backend.ts +33 -1
  33. package/src/types/channel_bus.ts +202 -0
  34. package/src/types/collection_contract.ts +278 -0
  35. package/src/types/collections.ts +25 -848
  36. package/src/types/component_ref.ts +40 -6
  37. package/src/types/entity_callbacks.ts +1 -1
  38. package/src/types/index.ts +7 -15
  39. package/src/types/policy.ts +25 -11
  40. package/src/types/project_manifest.ts +362 -0
  41. package/src/types/properties.ts +11 -169
  42. package/src/types/schema_version.ts +112 -0
  43. package/src/types/security_rules.ts +344 -0
  44. package/src/types/storage_authorize.ts +77 -0
  45. package/dist/controllers/analytics_controller.d.ts +0 -7
  46. package/dist/controllers/auth.d.ts +0 -110
  47. package/dist/controllers/customization_controller.d.ts +0 -61
  48. package/dist/controllers/dialogs_controller.d.ts +0 -36
  49. package/dist/controllers/local_config_persistence.d.ts +0 -20
  50. package/dist/controllers/navigation.d.ts +0 -225
  51. package/dist/controllers/registry.d.ts +0 -80
  52. package/dist/controllers/side_dialogs_controller.d.ts +0 -67
  53. package/dist/controllers/side_panel_controller.d.ts +0 -97
  54. package/dist/controllers/snackbar.d.ts +0 -24
  55. package/dist/rebase_context.d.ts +0 -110
  56. package/dist/types/breadcrumbs.d.ts +0 -26
  57. package/dist/types/builders.d.ts +0 -15
  58. package/dist/types/component_overrides.d.ts +0 -196
  59. package/dist/types/entity_actions.d.ts +0 -104
  60. package/dist/types/entity_link_builder.d.ts +0 -7
  61. package/dist/types/entity_views.d.ts +0 -95
  62. package/dist/types/export_import.d.ts +0 -21
  63. package/dist/types/formex.d.ts +0 -40
  64. package/dist/types/locales.d.ts +0 -4
  65. package/dist/types/modify_collections.d.ts +0 -5
  66. package/dist/types/plugins.d.ts +0 -277
  67. package/dist/types/property_config.d.ts +0 -74
  68. package/dist/types/slots.d.ts +0 -262
  69. package/dist/types/translations.d.ts +0 -915
  70. package/dist/types/user_management_delegate.d.ts +0 -22
  71. package/src/controllers/analytics_controller.tsx +0 -57
  72. package/src/controllers/auth.tsx +0 -121
  73. package/src/controllers/customization_controller.tsx +0 -72
  74. package/src/controllers/dialogs_controller.tsx +0 -37
  75. package/src/controllers/local_config_persistence.tsx +0 -22
  76. package/src/controllers/navigation.ts +0 -267
  77. package/src/controllers/registry.ts +0 -95
  78. package/src/controllers/side_dialogs_controller.tsx +0 -82
  79. package/src/controllers/side_panel_controller.tsx +0 -112
  80. package/src/controllers/snackbar.ts +0 -29
  81. package/src/rebase_context.tsx +0 -130
  82. package/src/types/breadcrumbs.ts +0 -27
  83. package/src/types/builders.ts +0 -17
  84. package/src/types/component_overrides.ts +0 -244
  85. package/src/types/entity_actions.tsx +0 -125
  86. package/src/types/entity_link_builder.ts +0 -8
  87. package/src/types/entity_views.tsx +0 -114
  88. package/src/types/export_import.ts +0 -26
  89. package/src/types/formex.ts +0 -45
  90. package/src/types/locales.ts +0 -81
  91. package/src/types/modify_collections.tsx +0 -6
  92. package/src/types/plugins.tsx +0 -346
  93. package/src/types/property_config.tsx +0 -95
  94. package/src/types/slots.tsx +0 -307
  95. package/src/types/translations.ts +0 -1026
  96. package/src/types/user_management_delegate.ts +0 -23
@@ -1,196 +0,0 @@
1
- import type React from "react";
2
- import type { Property } from "./properties";
3
- import type { WhereFilterOp } from "./filter-operators";
4
- /**
5
- * Components that can only be overridden at the **app level** via the
6
- * `components` prop on `<Rebase>`.
7
- *
8
- * These are shell-level / global components that exist outside of any
9
- * specific collection context.
10
- *
11
- * @group Component Overrides
12
- */
13
- export type AppComponentName = "Shell.AppBar" | "Shell.Drawer" | "Shell.DrawerNavigationItem" | "Shell.DrawerNavigationGroup" | "HomePage" | "HomePage.CollectionCard" | "Auth.LoginView";
14
- /**
15
- * Components that can be overridden at the **collection level**
16
- * (on an individual collection definition) or at the **app level**
17
- * (as a default for all collections).
18
- *
19
- * When set at the app level, these act as defaults. When set on a
20
- * specific collection, they override the app-level default for that
21
- * collection only.
22
- *
23
- * @group Component Overrides
24
- */
25
- export type CollectionComponentName = "Collection.View" | "Collection.Table" | "Collection.Card" | "Collection.EmptyState" | "Collection.Actions" | "Collection.FilterField" | "Entity.Form" | "EditView.FormActions" | "DetailView" | "Entity.SidePanel" | "EntityPreview" | "Entity.MissingReference";
26
- /**
27
- * All overridable component names across all scopes.
28
- * @group Component Overrides
29
- */
30
- export type OverridableComponentName = AppComponentName | CollectionComponentName;
31
- /**
32
- * Props received by a filter field component — whether it is a built-in
33
- * per-type field, a property-level replacement (`property.ui.Filter`), or a
34
- * `"Collection.FilterField"` override.
35
- *
36
- * The `operators` list is **already resolved**: it is the intersection of the
37
- * engine's {@link DataSourceCapabilities.filterOperators}, the property-type
38
- * defaults, and any `property.ui.filterOperators` narrowing. A custom field
39
- * should only offer operators from this list — anything else may throw at
40
- * query time on engines that cannot execute it.
41
- *
42
- * @example
43
- * ```tsx
44
- * function MyStatusFilter({ value, setValue, operators }: FilterFieldBindingProps) {
45
- * return (
46
- * <select
47
- * value={value?.[1] as string ?? ""}
48
- * onChange={e => setValue(e.target.value ? ["==", e.target.value] : undefined)}>
49
- * <option value="">Any</option>
50
- * <option value="active">Active</option>
51
- * <option value="archived">Archived</option>
52
- * </select>
53
- * );
54
- * }
55
- * ```
56
- *
57
- * @group Component Overrides
58
- */
59
- export interface FilterFieldBindingProps {
60
- /** Key of the property being filtered (the column id). */
61
- propertyKey: string;
62
- /**
63
- * The resolved property. For array properties this is the **item**
64
- * property (`property.of`), with `isArray` set to true.
65
- */
66
- property: Property;
67
- /** True when the underlying property is an array of `property`. */
68
- isArray: boolean;
69
- /**
70
- * Operators this field may offer, already narrowed by engine
71
- * capabilities, property-type defaults, and `property.ui.filterOperators`.
72
- */
73
- operators: readonly WhereFilterOp[];
74
- /** Current filter condition for this property, if any. */
75
- value?: [WhereFilterOp, unknown];
76
- /** Set (or clear, with `undefined`) the filter condition. */
77
- setValue: (value?: [WhereFilterOp, unknown]) => void;
78
- /** Display title for the field (usually the property name). */
79
- title?: string;
80
- /**
81
- * Coordination flags used by fields that open their own dialogs
82
- * (e.g. the reference picker hides the parent filters dialog).
83
- */
84
- hidden?: boolean;
85
- setHidden?: (hidden: boolean) => void;
86
- }
87
- /**
88
- * A single component override entry.
89
- *
90
- * - **Eject mode** (default): Your component fully replaces the built-in one.
91
- * It receives the same props as the original.
92
- *
93
- * - **Wrap mode** (`wrap: true`): Your component wraps the original. The
94
- * built-in component is passed as `OriginalComponent` in props, so you can
95
- * render it inside your custom layout/logic.
96
- *
97
- * @example
98
- * ```tsx
99
- * // Eject — full replacement
100
- * { Component: MyCustomAppBar }
101
- *
102
- * // Wrap — augment the original
103
- * {
104
- * Component: ({ OriginalComponent, ...props }) => (
105
- * <div>
106
- * <MyBanner />
107
- * <OriginalComponent {...props} />
108
- * </div>
109
- * ),
110
- * wrap: true
111
- * }
112
- * ```
113
- *
114
- * @group Component Overrides
115
- */
116
- export interface ComponentOverride<P = Record<string, unknown>> {
117
- /**
118
- * The replacement component. Receives the same props as the built-in
119
- * component it replaces.
120
- *
121
- * When `wrap` is true, an additional `OriginalComponent` prop is injected
122
- * containing the default component, allowing you to render it within
123
- * your custom wrapper.
124
- */
125
- Component: React.ComponentType<P>;
126
- /**
127
- * When true, the original default component is injected as the
128
- * `OriginalComponent` prop into your Component, enabling the
129
- * wrapping pattern (similar to Docusaurus's `--wrap` swizzle mode).
130
- *
131
- * When false or omitted, your component fully replaces the default
132
- * (similar to Docusaurus's `--eject` swizzle mode).
133
- *
134
- * @default false
135
- */
136
- wrap?: boolean;
137
- }
138
- /**
139
- * Collection-scoped overrides. Only collection-level components
140
- * can be overridden here.
141
- *
142
- * Set on a collection's `components` field to customize
143
- * components for that specific collection.
144
- *
145
- * @example
146
- * ```tsx
147
- * const productsCollection = {
148
- * name: "Products",
149
- * slug: "products",
150
- * components: {
151
- * "Entity.Form": { Component: ProductForm },
152
- * "Collection.EmptyState": { Component: ProductsEmptyState },
153
- * "Collection.Card": { Component: ProductCard },
154
- * }
155
- * };
156
- * ```
157
- *
158
- * @group Component Overrides
159
- */
160
- export type CollectionComponentOverrideMap = {
161
- [K in CollectionComponentName]?: ComponentOverride;
162
- };
163
- /**
164
- * App-level overrides. Includes both app-only components (Shell, HomePage, Auth)
165
- * and collection-level components (as defaults for all collections).
166
- *
167
- * Pass this to the `components` prop on `<Rebase>`.
168
- *
169
- * Collection-level components set here act as **defaults** — they apply to all
170
- * collections unless a specific collection overrides them in its own
171
- * `components`.
172
- *
173
- * @example
174
- * ```tsx
175
- * <Rebase
176
- * client={client}
177
- * components={{
178
- * // App-level: only available here
179
- * "Shell.AppBar": { Component: MyAppBar },
180
- * "HomePage": { Component: MyDashboard },
181
- *
182
- * // Collection defaults: apply to ALL collections
183
- * "EditView.FormActions": {
184
- * Component: MyFormActions,
185
- * wrap: true
186
- * },
187
- * "Collection.EmptyState": { Component: MyEmptyState },
188
- * }}
189
- * />
190
- * ```
191
- *
192
- * @group Component Overrides
193
- */
194
- export type ComponentOverrideMap = {
195
- [K in OverridableComponentName]?: ComponentOverride;
196
- };
@@ -1,104 +0,0 @@
1
- import React from "react";
2
- import type { Entity } from "./entities";
3
- import type { CollectionConfig, SelectionController } from "./collections";
4
- import type { FormContext } from "./entity_views";
5
- import type { User } from "../users";
6
- import type { RebaseContext } from "../rebase_context";
7
- import type { SidePanelController } from "../controllers/side_panel_controller";
8
- /**
9
- * A entity action is a custom action that can be performed on a entity.
10
- * They are displayed in the entity view and in the collection view.
11
- */
12
- export interface EntityAction<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> {
13
- /**
14
- * Title of the action
15
- */
16
- name: string;
17
- /**
18
- * Key of the action. You only need to provide this if you want to
19
- * override the default actions, or if you are not passing the action
20
- * directly to the `entityActions` prop of a collection.
21
- * You can define your actions at the app level, in which case you
22
- * must provide a key.
23
- * The default actions are:
24
- * - edit
25
- * - delete
26
- * - copy
27
- */
28
- key?: string;
29
- /**
30
- * Icon of the action
31
- */
32
- icon?: React.ReactElement;
33
- /**
34
- * Callback when the action is clicked
35
- * @param props
36
- */
37
- onClick(props: EntityActionClickProps<M, USER>): Promise<void> | void;
38
- /**
39
- * Optional callback in case you want to disable the action
40
- * @param props
41
- */
42
- isEnabled?(props: EntityActionClickProps<M, USER>): boolean;
43
- /**
44
- * When true, this action is rendered inline on each row in the list view.
45
- * By default, entity actions only appear in the table view and entity form.
46
- * Use this for actions that should be easily accessible regardless of view mode.
47
- */
48
- showActionsInListView?: boolean;
49
- /**
50
- * Show this action collapsed in the menu of the collection view.
51
- * Defaults to true
52
- * If false, the action will be shown in the menu
53
- */
54
- collapsed?: boolean;
55
- /**
56
- * Show this action in the form, defaults to true
57
- */
58
- includeInForm?: boolean;
59
- }
60
- export type EntityActionClickProps<M extends Record<string, unknown>, USER extends User = User> = {
61
- entity?: Entity<M>;
62
- context?: RebaseContext<USER>;
63
- path?: string;
64
- collection?: CollectionConfig<M>;
65
- /**
66
- * Optional form context, present if the action is being called from a form.
67
- * This allows you to access the form state and methods, including modifying the form values.
68
- */
69
- formContext?: FormContext;
70
- /**
71
- * Present if this actions is being called from a side dialog only
72
- */
73
- sidePanelController?: SidePanelController;
74
- /**
75
- * Is the action being called from the collection view or from the entity form view?
76
- */
77
- view: "collection" | "form";
78
- /**
79
- * If the action is rendered in the form, is it open in a side panel or full screen?
80
- */
81
- openEntityMode?: "side_panel" | "full_screen" | "split" | "dialog";
82
- /**
83
- * Optional selection controller, present if the action is being called from a collection view
84
- */
85
- selectionController?: SelectionController;
86
- /**
87
- * Optional highlight function to highlight the entity in the collection view
88
- * @param entity
89
- */
90
- highlightEntity?: (entity: Entity<Record<string, unknown>>) => void;
91
- /**
92
- * Optional unhighlight function to remove the highlight from the entity in the collection view
93
- * @param entity
94
- */
95
- unhighlightEntity?: (entity: Entity<Record<string, unknown>>) => void;
96
- /**
97
- * Optional function to navigate back (e.g. when deleting a entity or navigating from a form)
98
- */
99
- navigateBack?: () => void;
100
- /**
101
- * Callback to be called when the collection changes, e.g. after a entity is deleted or created.
102
- */
103
- onCollectionChange?: () => void;
104
- };
@@ -1,7 +0,0 @@
1
- import { Entity } from "./entities";
2
- /**
3
- * @group Models
4
- */
5
- export type EntityLinkBuilder<M extends Record<string, unknown> = Record<string, unknown>> = ({ entity }: {
6
- entity: Entity<M>;
7
- }) => string;
@@ -1,95 +0,0 @@
1
- import React from "react";
2
- import type { Entity, EntityValues } from "./entities";
3
- import type { CollectionConfig } from "./collections";
4
- import type { FormexController } from "./formex";
5
- import type { ComponentRef } from "./component_ref";
6
- /**
7
- * Context passed to custom fields and entity views.
8
- * @group Form custom fields
9
- */
10
- export interface FormContext<M extends Record<string, unknown> = Record<string, unknown>> {
11
- /**
12
- * Current values of the entity
13
- */
14
- values: M;
15
- /**
16
- * Update the value of a field
17
- */
18
- setFieldValue: (key: string, value: unknown, shouldValidate?: boolean) => void;
19
- /**
20
- * Quietly persist the entity to the database without any UI feedback
21
- * (no validation, no snackbar, no form reset).
22
- * Use this for programmatic/background saves from custom views.
23
- */
24
- save: (values: M) => void;
25
- /**
26
- * Submit the form — validates, saves, resets the form, and shows
27
- * a success snackbar. This is what the Save button calls.
28
- * Use this from custom views when you want the full "user saved" experience.
29
- */
30
- submit: () => void;
31
- /**
32
- * Collection of the entity being modified
33
- */
34
- collection?: CollectionConfig<M>;
35
- /**
36
- * Entity id, it can be undefined if it's a new entity
37
- */
38
- entityId?: string | number;
39
- /**
40
- * Path this entity is located at
41
- */
42
- path?: string;
43
- status: "new" | "existing" | "copy";
44
- entity?: Entity<M>;
45
- savingError?: Error;
46
- openEntityMode?: "side_panel" | "full_screen" | "split" | "dialog";
47
- /**
48
- * The underlying formex controller that powers the form.
49
- */
50
- formex: FormexController<M>;
51
- disabled: boolean;
52
- /**
53
- * Whether the form context is in read-only detail view mode.
54
- * Custom entity views can use this to adjust their rendering.
55
- */
56
- readOnly?: boolean;
57
- }
58
- export type EntityCustomView<M extends Record<string, unknown> = Record<string, unknown>> = {
59
- key: string;
60
- name: string;
61
- icon?: string | React.ReactNode;
62
- tabComponent?: React.ReactNode;
63
- includeActions?: boolean | "bottom";
64
- Builder?: ComponentRef<EntityCustomViewParams<M>>;
65
- position?: "start" | "end";
66
- };
67
- /**
68
- * Configuration to replace the default entity form with a custom component.
69
- * The Builder receives the same props as entity view tabs (entity, formContext, etc.)
70
- * and has full control over the UI.
71
- *
72
- * The form tab still appears in the tab bar but renders your Builder
73
- * instead of the auto-generated field form.
74
- *
75
- * @group Models
76
- */
77
- export type FormViewConfig<M extends Record<string, unknown> = Record<string, unknown>> = {
78
- /**
79
- * Custom component that replaces the default form.
80
- */
81
- Builder: ComponentRef<EntityCustomViewParams<M>>;
82
- /**
83
- * If true, the save/delete action bar is rendered alongside the custom view.
84
- * Defaults to true.
85
- */
86
- includeActions?: boolean;
87
- };
88
- export interface EntityCustomViewParams<M extends Record<string, unknown> = Record<string, unknown>> {
89
- collection: CollectionConfig<M>;
90
- entity?: Entity<M>;
91
- modifiedValues?: EntityValues<M>;
92
- formContext: FormContext<M>;
93
- parentCollectionSlugs?: string[];
94
- parentEntityIds?: string[];
95
- }
@@ -1,21 +0,0 @@
1
- import type { Entity } from "./entities";
2
- import type { User } from "../users";
3
- import type { RebaseContext } from "../rebase_context";
4
- /**
5
- * You can use this configuration to add additional fields to the data
6
- * exports
7
- * @group Models
8
- */
9
- export interface ExportConfig<USER extends User = User> {
10
- additionalFields: ExportMappingFunction<USER>[];
11
- }
12
- /**
13
- * @group Models
14
- */
15
- export interface ExportMappingFunction<USER extends User = User> {
16
- key: string;
17
- builder: ({ entity, context }: {
18
- entity: Entity;
19
- context: RebaseContext<USER>;
20
- }) => Promise<string> | string;
21
- }
@@ -1,40 +0,0 @@
1
- import React, { FormEvent } from "react";
2
- export type FormexController<T = unknown> = {
3
- values: T;
4
- initialValues: T;
5
- setValues: (values: T) => void;
6
- setFieldValue: (key: string, value: unknown, shouldValidate?: boolean) => void;
7
- touched: Record<string, boolean>;
8
- setFieldTouched: (key: string, touched: boolean, shouldValidate?: boolean) => void;
9
- setTouched: (touched: Record<string, boolean>) => void;
10
- dirty: boolean;
11
- setDirty: (dirty: boolean) => void;
12
- setSubmitCount: (submitCount: number) => void;
13
- errors: Record<string, string>;
14
- setFieldError: (key: string, error?: string) => void;
15
- handleChange: (event: React.SyntheticEvent) => void;
16
- handleBlur: (event: React.FocusEvent) => void;
17
- handleSubmit: (event?: FormEvent<HTMLFormElement>) => void;
18
- validate: () => void;
19
- resetForm: (props?: FormexResetProps<T>) => void;
20
- submitCount: number;
21
- isSubmitting: boolean;
22
- setSubmitting: (isSubmitting: boolean) => void;
23
- isValidating: boolean;
24
- /**
25
- * The version of the form. This is incremented every time the form is reset
26
- * or the form is submitted.
27
- */
28
- version: number;
29
- debugId?: string;
30
- undo: () => void;
31
- redo: () => void;
32
- canUndo: boolean;
33
- canRedo: boolean;
34
- };
35
- export type FormexResetProps<T = unknown> = {
36
- values?: T;
37
- submitCount?: number;
38
- errors?: Record<string, string>;
39
- touched?: Record<string, boolean>;
40
- };
@@ -1,4 +0,0 @@
1
- /**
2
- * @group Models
3
- */
4
- export type Locale = "af" | "ar" | "arDZ" | "arMA" | "arSA" | "az" | "be" | "bg" | "bn" | "ca" | "cs" | "cy" | "da" | "de" | "el" | "enAU" | "enCA" | "enGB" | "enIN" | "enNZ" | "enUS" | "eo" | "es" | "et" | "eu" | "faIR" | "fi" | "fil" | "fr" | "frCA" | "frCH" | "gd" | "gl" | "gu" | "he" | "hi" | "hr" | "hu" | "hy" | "id" | "is" | "it" | "ja" | "ka" | "kk" | "kn" | "ko" | "lb" | "lt" | "lv" | "mk" | "ms" | "mt" | "nb" | "nl" | "nlBE" | "nn" | "pl" | "pt" | "ptBR" | "ro" | "ru" | "sk" | "sl" | "sr" | "srLatn" | "sv" | "ta" | "te" | "th" | "tr" | "ug" | "uk" | "uz" | "vi" | "zhCN" | "zhTW";
@@ -1,5 +0,0 @@
1
- import { CollectionConfig } from "./collections";
2
- export type ModifyCollectionProps = {
3
- collection: CollectionConfig;
4
- parentPaths: string[];
5
- };