@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,125 +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
- /**
10
- * A entity action is a custom action that can be performed on a entity.
11
- * They are displayed in the entity view and in the collection view.
12
- */
13
- export interface EntityAction<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> {
14
- /**
15
- * Title of the action
16
- */
17
- name: string;
18
-
19
- /**
20
- * Key of the action. You only need to provide this if you want to
21
- * override the default actions, or if you are not passing the action
22
- * directly to the `entityActions` prop of a collection.
23
- * You can define your actions at the app level, in which case you
24
- * must provide a key.
25
- * The default actions are:
26
- * - edit
27
- * - delete
28
- * - copy
29
- */
30
- key?: string;
31
-
32
- /**
33
- * Icon of the action
34
- */
35
- icon?: React.ReactElement;
36
-
37
- /**
38
- * Callback when the action is clicked
39
- * @param props
40
- */
41
- onClick(props: EntityActionClickProps<M, USER>): Promise<void> | void;
42
-
43
- /**
44
- * Optional callback in case you want to disable the action
45
- * @param props
46
- */
47
- isEnabled?(props: EntityActionClickProps<M, USER>): boolean;
48
-
49
- /**
50
- * When true, this action is rendered inline on each row in the list view.
51
- * By default, entity actions only appear in the table view and entity form.
52
- * Use this for actions that should be easily accessible regardless of view mode.
53
- */
54
- showActionsInListView?: boolean;
55
-
56
- /**
57
- * Show this action collapsed in the menu of the collection view.
58
- * Defaults to true
59
- * If false, the action will be shown in the menu
60
- */
61
- collapsed?: boolean;
62
-
63
- /**
64
- * Show this action in the form, defaults to true
65
- */
66
- includeInForm?: boolean;
67
-
68
- }
69
-
70
- export type EntityActionClickProps<M extends Record<string, unknown>, USER extends User = User> = {
71
- entity?: Entity<M>;
72
- context?: RebaseContext<USER>;
73
-
74
- path?: string;
75
- collection?: CollectionConfig<M>;
76
-
77
- /**
78
- * Optional form context, present if the action is being called from a form.
79
- * This allows you to access the form state and methods, including modifying the form values.
80
- */
81
- formContext?: FormContext;
82
-
83
- /**
84
- * Present if this actions is being called from a side dialog only
85
- */
86
- sidePanelController?: SidePanelController;
87
-
88
- /**
89
- * Is the action being called from the collection view or from the entity form view?
90
- */
91
- view: "collection" | "form";
92
-
93
- /**
94
- * If the action is rendered in the form, is it open in a side panel or full screen?
95
- */
96
- openEntityMode?: "side_panel" | "full_screen" | "split" | "dialog";
97
-
98
- /**
99
- * Optional selection controller, present if the action is being called from a collection view
100
- */
101
- selectionController?: SelectionController;
102
-
103
- /**
104
- * Optional highlight function to highlight the entity in the collection view
105
- * @param entity
106
- */
107
- highlightEntity?: (entity: Entity<Record<string, unknown>>) => void;
108
-
109
- /**
110
- * Optional unhighlight function to remove the highlight from the entity in the collection view
111
- * @param entity
112
- */
113
- unhighlightEntity?: (entity: Entity<Record<string, unknown>>) => void;
114
-
115
- /**
116
- * Optional function to navigate back (e.g. when deleting a entity or navigating from a form)
117
- */
118
- navigateBack?: () => void;
119
-
120
- /**
121
- * Callback to be called when the collection changes, e.g. after a entity is deleted or created.
122
- */
123
- onCollectionChange?: () => void;
124
-
125
- };
@@ -1,8 +0,0 @@
1
- import { Entity } from "./entities";
2
-
3
- /**
4
- * @group Models
5
- */
6
- export type EntityLinkBuilder<M extends Record<string, unknown> = Record<string, unknown>> = ({ entity }: {
7
- entity: Entity<M>
8
- }) => string;
@@ -1,114 +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
- /**
8
- * Context passed to custom fields and entity views.
9
- * @group Form custom fields
10
- */
11
- export interface FormContext<M extends Record<string, unknown> = Record<string, unknown>> {
12
-
13
- /**
14
- * Current values of the entity
15
- */
16
- values: M;
17
-
18
- /**
19
- * Update the value of a field
20
- */
21
- setFieldValue: (key: string, value: unknown, shouldValidate?: boolean) => void;
22
-
23
- /**
24
- * Quietly persist the entity to the database without any UI feedback
25
- * (no validation, no snackbar, no form reset).
26
- * Use this for programmatic/background saves from custom views.
27
- */
28
- save: (values: M) => void;
29
-
30
- /**
31
- * Submit the form — validates, saves, resets the form, and shows
32
- * a success snackbar. This is what the Save button calls.
33
- * Use this from custom views when you want the full "user saved" experience.
34
- */
35
- submit: () => void;
36
-
37
- /**
38
- * Collection of the entity being modified
39
- */
40
- collection?: CollectionConfig<M>;
41
-
42
- /**
43
- * Entity id, it can be undefined if it's a new entity
44
- */
45
- entityId?: string | number;
46
-
47
- /**
48
- * Path this entity is located at
49
- */
50
- path?: string;
51
-
52
- status: "new" | "existing" | "copy";
53
-
54
- entity?: Entity<M>;
55
-
56
- savingError?: Error;
57
-
58
- openEntityMode?: "side_panel" | "full_screen" | "split" | "dialog";
59
-
60
- /**
61
- * The underlying formex controller that powers the form.
62
- */
63
- formex: FormexController<M>;
64
-
65
- disabled: boolean;
66
-
67
- /**
68
- * Whether the form context is in read-only detail view mode.
69
- * Custom entity views can use this to adjust their rendering.
70
- */
71
- readOnly?: boolean;
72
- }
73
-
74
-
75
- export type EntityCustomView<M extends Record<string, unknown> = Record<string, unknown>> = {
76
- key: string;
77
- name: string;
78
- icon?: string | React.ReactNode;
79
- tabComponent?: React.ReactNode;
80
- includeActions?: boolean | "bottom";
81
- Builder?: ComponentRef<EntityCustomViewParams<M>>;
82
- position?: "start" | "end";
83
- };
84
-
85
- /**
86
- * Configuration to replace the default entity form with a custom component.
87
- * The Builder receives the same props as entity view tabs (entity, formContext, etc.)
88
- * and has full control over the UI.
89
- *
90
- * The form tab still appears in the tab bar but renders your Builder
91
- * instead of the auto-generated field form.
92
- *
93
- * @group Models
94
- */
95
- export type FormViewConfig<M extends Record<string, unknown> = Record<string, unknown>> = {
96
- /**
97
- * Custom component that replaces the default form.
98
- */
99
- Builder: ComponentRef<EntityCustomViewParams<M>>;
100
- /**
101
- * If true, the save/delete action bar is rendered alongside the custom view.
102
- * Defaults to true.
103
- */
104
- includeActions?: boolean;
105
- };
106
-
107
- export interface EntityCustomViewParams<M extends Record<string, unknown> = Record<string, unknown>> {
108
- collection: CollectionConfig<M>;
109
- entity?: Entity<M>;
110
- modifiedValues?: EntityValues<M>;
111
- formContext: FormContext<M>;
112
- parentCollectionSlugs?: string[];
113
- parentEntityIds?: string[];
114
- }
@@ -1,26 +0,0 @@
1
- import type { Entity } from "./entities";
2
- import type { User } from "../users";
3
- import type { RebaseContext } from "../rebase_context";
4
-
5
- /**
6
- * You can use this configuration to add additional fields to the data
7
- * exports
8
- * @group Models
9
- */
10
- export interface ExportConfig<USER extends User = User> {
11
- additionalFields: ExportMappingFunction<USER>[];
12
- }
13
-
14
- /**
15
- * @group Models
16
- */
17
- export interface ExportMappingFunction<USER extends User = User> {
18
- key: string;
19
- builder: ({
20
- entity,
21
- context
22
- }: {
23
- entity: Entity,
24
- context: RebaseContext<USER>
25
- }) => Promise<string> | string;
26
- }
@@ -1,45 +0,0 @@
1
- import React, { FormEvent } from "react";
2
-
3
- export type FormexController<T = unknown> = {
4
- values: T;
5
- initialValues: T;
6
- setValues: (values: T) => void;
7
- setFieldValue: (key: string, value: unknown, shouldValidate?: boolean) => void;
8
- touched: Record<string, boolean>;
9
- setFieldTouched: (key: string, touched: boolean, shouldValidate?: boolean) => void;
10
- setTouched: (touched: Record<string, boolean>) => void;
11
- dirty: boolean;
12
- setDirty: (dirty: boolean) => void;
13
- setSubmitCount: (submitCount: number) => void;
14
- errors: Record<string, string>;
15
- setFieldError: (key: string, error?: string) => void;
16
- handleChange: (event: React.SyntheticEvent) => void,
17
- handleBlur: (event: React.FocusEvent) => void,
18
- handleSubmit: (event?: FormEvent<HTMLFormElement>) => void;
19
- validate: () => void;
20
- resetForm: (props?: FormexResetProps<T>) => void;
21
- submitCount: number;
22
- isSubmitting: boolean;
23
- setSubmitting: (isSubmitting: boolean) => void;
24
- isValidating: boolean;
25
- /**
26
- * The version of the form. This is incremented every time the form is reset
27
- * or the form is submitted.
28
- */
29
- version: number;
30
-
31
- debugId?: string;
32
-
33
- undo: () => void;
34
- redo: () => void;
35
-
36
- canUndo: boolean;
37
- canRedo: boolean;
38
- }
39
-
40
- export type FormexResetProps<T = unknown> = {
41
- values?: T;
42
- submitCount?: number;
43
- errors?: Record<string, string>;
44
- touched?: Record<string, boolean>;
45
- };
@@ -1,81 +0,0 @@
1
- /**
2
- * @group Models
3
- */
4
- export type Locale =
5
- "af" |
6
- "ar" |
7
- "arDZ" |
8
- "arMA" |
9
- "arSA" |
10
- "az" |
11
- "be" |
12
- "bg" |
13
- "bn" |
14
- "ca" |
15
- "cs" |
16
- "cy" |
17
- "da" |
18
- "de" |
19
- "el" |
20
- "enAU" |
21
- "enCA" |
22
- "enGB" |
23
- "enIN" |
24
- "enNZ" |
25
- "enUS" |
26
- "eo" |
27
- "es" |
28
- "et" |
29
- "eu" |
30
- "faIR" |
31
- "fi" |
32
- "fil" |
33
- "fr" |
34
- "frCA" |
35
- "frCH" |
36
- "gd" |
37
- "gl" |
38
- "gu" |
39
- "he" |
40
- "hi" |
41
- "hr" |
42
- "hu" |
43
- "hy" |
44
- "id" |
45
- "is" |
46
- "it" |
47
- "ja" |
48
- "ka" |
49
- "kk" |
50
- "kn" |
51
- "ko" |
52
- "lb" |
53
- "lt" |
54
- "lv" |
55
- "mk" |
56
- "ms" |
57
- "mt" |
58
- "nb" |
59
- "nl" |
60
- "nlBE" |
61
- "nn" |
62
- "pl" |
63
- "pt" |
64
- "ptBR" |
65
- "ro" |
66
- "ru" |
67
- "sk" |
68
- "sl" |
69
- "sr" |
70
- "srLatn" |
71
- "sv" |
72
- "ta" |
73
- "te" |
74
- "th" |
75
- "tr" |
76
- "ug" |
77
- "uk" |
78
- "uz" |
79
- "vi" |
80
- "zhCN" |
81
- "zhTW";
@@ -1,6 +0,0 @@
1
- import { CollectionConfig } from "./collections";
2
-
3
- export type ModifyCollectionProps = {
4
- collection: CollectionConfig,
5
- parentPaths: string[],
6
- };