@rebasepro/types 0.0.1-canary.0

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 (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +174 -0
  3. package/dist/components/EntityFormActionsProps.d.ts +17 -0
  4. package/dist/components/EntityFormProps.d.ts +46 -0
  5. package/dist/components/PropertyPreviewProps.d.ts +50 -0
  6. package/dist/components/formex.d.ts +40 -0
  7. package/dist/components/index.d.ts +3 -0
  8. package/dist/controllers/analytics_controller.d.ts +7 -0
  9. package/dist/controllers/auth.d.ts +73 -0
  10. package/dist/controllers/customization_controller.d.ts +50 -0
  11. package/dist/controllers/datasource.d.ts +179 -0
  12. package/dist/controllers/dialogs_controller.d.ts +36 -0
  13. package/dist/controllers/index.d.ts +11 -0
  14. package/dist/controllers/local_config_persistence.d.ts +20 -0
  15. package/dist/controllers/navigation.d.ts +262 -0
  16. package/dist/controllers/side_dialogs_controller.d.ts +67 -0
  17. package/dist/controllers/side_entity_controller.d.ts +90 -0
  18. package/dist/controllers/snackbar.d.ts +24 -0
  19. package/dist/controllers/storage.d.ts +173 -0
  20. package/dist/index.d.ts +5 -0
  21. package/dist/index.es.js +113 -0
  22. package/dist/index.es.js.map +1 -0
  23. package/dist/index.umd.js +117 -0
  24. package/dist/index.umd.js.map +1 -0
  25. package/dist/rebase_context.d.ts +91 -0
  26. package/dist/types/backend.d.ts +254 -0
  27. package/dist/types/chips.d.ts +5 -0
  28. package/dist/types/collections.d.ts +887 -0
  29. package/dist/types/entities.d.ts +140 -0
  30. package/dist/types/entity_actions.d.ts +98 -0
  31. package/dist/types/entity_callbacks.d.ts +173 -0
  32. package/dist/types/entity_link_builder.d.ts +7 -0
  33. package/dist/types/entity_overrides.d.ts +5 -0
  34. package/dist/types/export_import.d.ts +21 -0
  35. package/dist/types/fields.d.ts +221 -0
  36. package/dist/types/index.d.ts +19 -0
  37. package/dist/types/locales.d.ts +4 -0
  38. package/dist/types/modify_collections.d.ts +5 -0
  39. package/dist/types/plugins.d.ts +276 -0
  40. package/dist/types/properties.d.ts +1103 -0
  41. package/dist/types/property_config.d.ts +68 -0
  42. package/dist/types/rebase.d.ts +180 -0
  43. package/dist/types/relations.d.ts +336 -0
  44. package/dist/types/user_management_delegate.d.ts +78 -0
  45. package/dist/types/websockets.d.ts +33 -0
  46. package/dist/users/index.d.ts +2 -0
  47. package/dist/users/roles.d.ts +22 -0
  48. package/dist/users/user.d.ts +42 -0
  49. package/package.json +137 -0
  50. package/src/components/EntityFormActionsProps.tsx +18 -0
  51. package/src/components/EntityFormProps.tsx +52 -0
  52. package/src/components/PropertyPreviewProps.tsx +61 -0
  53. package/src/components/formex.tsx +46 -0
  54. package/src/components/index.ts +3 -0
  55. package/src/controllers/analytics_controller.tsx +57 -0
  56. package/src/controllers/auth.tsx +94 -0
  57. package/src/controllers/customization_controller.tsx +61 -0
  58. package/src/controllers/datasource.ts +218 -0
  59. package/src/controllers/dialogs_controller.tsx +37 -0
  60. package/src/controllers/index.ts +11 -0
  61. package/src/controllers/local_config_persistence.tsx +22 -0
  62. package/src/controllers/navigation.ts +317 -0
  63. package/src/controllers/side_dialogs_controller.tsx +82 -0
  64. package/src/controllers/side_entity_controller.tsx +104 -0
  65. package/src/controllers/snackbar.ts +29 -0
  66. package/src/controllers/storage.ts +196 -0
  67. package/src/index.ts +5 -0
  68. package/src/rebase_context.tsx +122 -0
  69. package/src/types/backend.ts +385 -0
  70. package/src/types/chips.ts +46 -0
  71. package/src/types/collections.ts +1013 -0
  72. package/src/types/entities.ts +207 -0
  73. package/src/types/entity_actions.tsx +118 -0
  74. package/src/types/entity_callbacks.ts +217 -0
  75. package/src/types/entity_link_builder.ts +8 -0
  76. package/src/types/entity_overrides.tsx +6 -0
  77. package/src/types/export_import.ts +26 -0
  78. package/src/types/fields.tsx +298 -0
  79. package/src/types/index.ts +20 -0
  80. package/src/types/locales.ts +81 -0
  81. package/src/types/modify_collections.tsx +6 -0
  82. package/src/types/plugins.tsx +328 -0
  83. package/src/types/properties.ts +1270 -0
  84. package/src/types/property_config.tsx +93 -0
  85. package/src/types/rebase.tsx +211 -0
  86. package/src/types/relations.ts +351 -0
  87. package/src/types/user_management_delegate.ts +98 -0
  88. package/src/types/websockets.ts +37 -0
  89. package/src/users/index.ts +2 -0
  90. package/src/users/roles.ts +33 -0
  91. package/src/users/user.ts +46 -0
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ /**
3
+ * Controller to open the side dialog
4
+ * @group Hooks and utilities
5
+ */
6
+ export interface DialogsController {
7
+ /**
8
+ * Close the last dialog
9
+ */
10
+ close: () => void;
11
+ /**
12
+ * Open a dialog
13
+ * @param props
14
+ */
15
+ open: <T extends object = object>(props: DialogControllerEntryProps<T>) => {
16
+ closeDialog: () => void;
17
+ };
18
+ }
19
+ /**
20
+ * Props used to open a side dialog
21
+ * @group Hooks and utilities
22
+ */
23
+ export interface DialogControllerEntryProps<T extends object = object> {
24
+ key: string;
25
+ /**
26
+ * The component type that will be rendered
27
+ */
28
+ Component: React.ComponentType<{
29
+ open: boolean;
30
+ closeDialog: () => void;
31
+ } & T>;
32
+ /**
33
+ * Props to pass to the dialog component
34
+ */
35
+ props?: T;
36
+ }
@@ -0,0 +1,11 @@
1
+ export * from "./analytics_controller";
2
+ export * from "./auth";
3
+ export * from "./customization_controller";
4
+ export * from "./datasource";
5
+ export * from "./dialogs_controller";
6
+ export * from "./local_config_persistence";
7
+ export * from "./navigation";
8
+ export * from "./side_dialogs_controller";
9
+ export * from "./side_entity_controller";
10
+ export * from "./snackbar";
11
+ export * from "./storage";
@@ -0,0 +1,20 @@
1
+ import { EntityCollection } from "../types";
2
+ /**
3
+ * @group Models
4
+ */
5
+ export type PartialEntityCollection<M extends Record<string, any> = any> = Partial<EntityCollection<M>>;
6
+ /**
7
+ * This interface is in charge of defining the controller that persists
8
+ * modifications to a collection or collection, and retrieves them back from
9
+ * a data source, such as local storage or Firestore.
10
+ */
11
+ export interface UserConfigurationPersistence {
12
+ onCollectionModified: <M extends Record<string, any> = any>(path: string, partialCollection: PartialEntityCollection<M>) => void;
13
+ getCollectionConfig: <M extends Record<string, any> = any>(path: string) => PartialEntityCollection<M>;
14
+ recentlyVisitedPaths: string[];
15
+ setRecentlyVisitedPaths: (paths: string[]) => void;
16
+ favouritePaths: string[];
17
+ setFavouritePaths: (paths: string[]) => void;
18
+ collapsedGroups: string[];
19
+ setCollapsedGroups: (paths: string[]) => void;
20
+ }
@@ -0,0 +1,262 @@
1
+ import React from "react";
2
+ import { EntityCollection, EntityReference, RebasePlugin } from "../types";
3
+ /**
4
+ * Controller that handles URL path building and resolution.
5
+ * @group Models
6
+ */
7
+ export type CMSUrlController = {
8
+ /**
9
+ * Default path under the navigation routes of the CMS will be created.
10
+ * Defaults to '/'. You may want to change this `basepath` to 'admin' for example.
11
+ */
12
+ basePath: string;
13
+ /**
14
+ * Default path under the collection routes of the CMS will be created.
15
+ * It defaults to '/c'
16
+ */
17
+ baseCollectionPath: string;
18
+ /**
19
+ * Convert a URL path to a collection or entity path
20
+ * `/c/products` => `products`
21
+ * `/my_cms/c/products/B34SAP8Z` => `products/B34SAP8Z`
22
+ * `/my_cms/my_view` => `my_view`
23
+ * @param cmsPath
24
+ */
25
+ urlPathToDataPath: (cmsPath: string) => string;
26
+ /**
27
+ * Base url path for the home screen
28
+ */
29
+ homeUrl: string;
30
+ /**
31
+ * Check if a url path belongs to a collection
32
+ * @param path
33
+ */
34
+ isUrlCollectionPath: (urlPath: string) => boolean;
35
+ /**
36
+ * Build a URL collection path from a data path
37
+ * `products` => `/c/products`
38
+ * `products/B34SAP8Z` => `/c/products/B34SAP8Z`
39
+ * @param path
40
+ */
41
+ buildUrlCollectionPath: (path: string) => string;
42
+ /**
43
+ * Build a URL path for the CMS (e.g. for custom views)
44
+ * @param path
45
+ */
46
+ buildCMSUrlPath: (path: string) => string;
47
+ /**
48
+ * Turn a path with collection ids into a resolved path.
49
+ * The ids (typically used in urls) will be replaced with relative paths (typically used in database paths)
50
+ * @param path
51
+ */
52
+ resolveDatabasePathsFrom: (path: string) => string;
53
+ /**
54
+ * A function to navigate to a specified route or URL.
55
+ *
56
+ * @param {string} to - The target route or URL to navigate to.
57
+ * @param {NavigateOptions} [options] - Optional configuration settings for navigation, such as replace behavior or state data.
58
+ */
59
+ navigate: (to: string, options?: NavigateOptions) => void;
60
+ };
61
+ /**
62
+ * Controller that manages the state of the navigation menu,
63
+ * including resolved views and top-level grouping.
64
+ * @group Models
65
+ */
66
+ export type NavigationStateController = {
67
+ /**
68
+ * Custom additional views created by the developer, added to the main
69
+ * navigation
70
+ */
71
+ views?: CMSView[];
72
+ /**
73
+ * Custom additional views created by the developer, added to the admin
74
+ * navigation
75
+ */
76
+ adminViews?: CMSView[];
77
+ /**
78
+ * Configuration for the views that should be displayed at the top
79
+ * level of the navigation (e.g. in the home page or the navigation
80
+ * drawer)
81
+ */
82
+ topLevelNavigation?: NavigationResult;
83
+ /**
84
+ * Is the navigation loading (the configuration persistence has not
85
+ * loaded yet, or a specified navigation builder has not completed)
86
+ */
87
+ loading: boolean;
88
+ /**
89
+ * Was there an error while loading the navigation data
90
+ */
91
+ navigationLoadingError?: unknown;
92
+ /**
93
+ * Call this method to recalculate the navigation
94
+ */
95
+ refreshNavigation: () => void;
96
+ /**
97
+ * Plugin system allowing to extend the CMS functionality.
98
+ */
99
+ plugins?: RebasePlugin<any, any, any>[];
100
+ };
101
+ /**
102
+ * Controller that provides access to the registered entity collections.
103
+ * @group Models
104
+ */
105
+ export type CollectionRegistryController<EC extends EntityCollection = EntityCollection<any>> = {
106
+ /**
107
+ * List of the mapped collections in the CMS.
108
+ * Each entry relates to a collection in the root database.
109
+ * Each of the navigation entries in this field
110
+ * generates an entry in the main menu.
111
+ */
112
+ collections?: EntityCollection[];
113
+ /**
114
+ * Is the registry ready to be used
115
+ */
116
+ initialised: boolean;
117
+ /**
118
+ * Get the collection configuration for a given path.
119
+ * The collection is resolved from the given path or alias.
120
+ */
121
+ getCollection: (slugOrPath: string, includeUserOverride?: boolean) => EC | undefined;
122
+ /**
123
+ * Get the raw, un-normalized collection configuration.
124
+ * This bypasses the `CollectionRegistry` normalization (such as injecting `relation` instances).
125
+ * This is strictly for the Visual Editor to manipulate AST code without persisting runtime state.
126
+ */
127
+ getRawCollection: (slugOrPath: string) => EC | undefined;
128
+ /**
129
+ * Retrieve all the related parent references for a given path
130
+ * @param path
131
+ */
132
+ getParentReferencesFromPath: (path: string) => EntityReference[];
133
+ /**
134
+ * Retrieve all the related parent collection ids for a given path
135
+ * @param path
136
+ */
137
+ getParentCollectionIds: (path: string) => string[];
138
+ /**
139
+ * Resolve paths from a list of ids
140
+ * @param ids
141
+ */
142
+ convertIdsToPaths: (ids: string[]) => string[];
143
+ };
144
+ /**
145
+ * Legacy monolithic controller that includes the resolved navigation and utility methods and attributes.
146
+ * It is a combination of CMSUrlController, NavigationStateController, and CollectionRegistryController.
147
+ * @group Models
148
+ * @deprecated Use the specific controllers instead.
149
+ */
150
+ export type NavigationController<EC extends EntityCollection = EntityCollection<any>> = CMSUrlController & NavigationStateController & CollectionRegistryController<EC>;
151
+ export interface NavigateOptions {
152
+ replace?: boolean;
153
+ state?: unknown;
154
+ preventScrollReset?: boolean;
155
+ relative?: "route" | "path";
156
+ flushSync?: boolean;
157
+ viewTransition?: boolean;
158
+ }
159
+ export type NavigationBlocker = {
160
+ updateBlockListener: (path: string, block: boolean, basePath?: string) => () => void;
161
+ isBlocked: (path: string) => boolean;
162
+ proceed?: () => void;
163
+ reset?: () => void;
164
+ };
165
+ /**
166
+ * Custom additional views created by the developer, added to the main
167
+ * navigation.
168
+ * @group Models
169
+ */
170
+ export interface CMSView {
171
+ /**
172
+ * CMS Path you can reach this view from.
173
+ */
174
+ slug: string;
175
+ /**
176
+ * Name of this view
177
+ */
178
+ name: string;
179
+ /**
180
+ * Optional description of this view. You can use Markdown
181
+ */
182
+ description?: string;
183
+ /**
184
+ * Icon key to use in this view.
185
+ * You can use any of the icons in the Material specs:
186
+ * https://fonts.google.com/icons
187
+ * e.g. 'account_tree' or 'person'
188
+ * Find all the icons in https://rebase.pro/docs/icons
189
+ */
190
+ icon?: string | React.ReactNode;
191
+ /**
192
+ * Should this view be hidden from the main navigation panel.
193
+ * It will still be accessible if you reach the specified path
194
+ */
195
+ hideFromNavigation?: boolean;
196
+ /**
197
+ * Component to be rendered. This can be any React component, and can use
198
+ * any of the provided hooks
199
+ */
200
+ view: React.ReactNode;
201
+ /**
202
+ * Optional field used to group top level navigation entries under a
203
+ * navigation view.
204
+ * This prop is ignored for admin views.
205
+ */
206
+ group?: string;
207
+ /**
208
+ * If true, a wildcard route (slug/*) is automatically registered
209
+ * alongside the base route, enabling nested navigation within this view.
210
+ */
211
+ nestedRoutes?: boolean;
212
+ }
213
+ /**
214
+ * A composable section that can be rendered on the home page.
215
+ * Use this to add custom content alongside the auto-generated
216
+ * navigation groups.
217
+ * @group Models
218
+ */
219
+ export interface HomePageSection {
220
+ /**
221
+ * Unique key for this section.
222
+ */
223
+ key: string;
224
+ /**
225
+ * Title displayed as the section header.
226
+ */
227
+ title: string;
228
+ /**
229
+ * Arbitrary React content rendered inside the section.
230
+ */
231
+ children: React.ReactNode;
232
+ }
233
+ /**
234
+ * Used to group navigation entries in the main navigation.
235
+ */
236
+ export interface NavigationGroupMapping {
237
+ /**
238
+ * Name of the group, used to display the group header in the UI
239
+ */
240
+ name: string;
241
+ /**
242
+ * List of collection ids or view paths that belong to this group.
243
+ */
244
+ entries: string[];
245
+ }
246
+ export interface NavigationEntry {
247
+ id: string;
248
+ url: string;
249
+ name: string;
250
+ slug: string;
251
+ type: "collection" | "view" | "admin";
252
+ collection?: EntityCollection;
253
+ view?: CMSView;
254
+ description?: string;
255
+ group: string;
256
+ }
257
+ export type NavigationResult = {
258
+ allowDragAndDrop: boolean;
259
+ navigationEntries: NavigationEntry[];
260
+ groups: string[];
261
+ onNavigationEntriesUpdate: (entries: NavigationGroupMapping[]) => void;
262
+ };
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ /**
3
+ * Controller to open the side dialog
4
+ * @group Hooks and utilities
5
+ */
6
+ export interface SideDialogsController {
7
+ /**
8
+ * Close the last panel
9
+ */
10
+ close: () => void;
11
+ /**
12
+ * List of side panels currently open
13
+ */
14
+ sidePanels: SideDialogPanelProps[];
15
+ /**
16
+ * Override the current side panels
17
+ * @param panels
18
+ */
19
+ setSidePanels: (panels: SideDialogPanelProps[]) => void;
20
+ /**
21
+ * Open one or multiple side panels
22
+ * @param props
23
+ */
24
+ open: (panelProps: SideDialogPanelProps | SideDialogPanelProps[]) => void;
25
+ /**
26
+ * Replace the last open panel with the given one
27
+ * @param props
28
+ */
29
+ replace: (panelProps: SideDialogPanelProps | SideDialogPanelProps[]) => void;
30
+ }
31
+ /**
32
+ * Props used to open a side dialog
33
+ * @group Hooks and utilities
34
+ */
35
+ export interface SideDialogPanelProps {
36
+ /**
37
+ * A key that identifies this panel
38
+ */
39
+ key: string;
40
+ /**
41
+ * The component type that will be rendered
42
+ */
43
+ component: React.ReactNode;
44
+ /**
45
+ * Optional width of the panel
46
+ */
47
+ width?: string;
48
+ /**
49
+ * When open, change the URL to this path.
50
+ * Note that if you want to restore state from a URL you need to add the
51
+ * logic yourself by listening to URL updates, and probably call `open`.
52
+ */
53
+ urlPath?: string;
54
+ /**
55
+ * If the navigation stack is empty (you landed in the `urlPath` url), what
56
+ * url path to change to when the panel gets closed.
57
+ */
58
+ parentUrlPath?: string;
59
+ /**
60
+ * Callback when the panel is closed
61
+ */
62
+ onClose?: () => void;
63
+ /**
64
+ * Use this prop to store additional data in the panel
65
+ */
66
+ additional?: unknown;
67
+ }
@@ -0,0 +1,90 @@
1
+ import { Entity, EntityCollection } from "../types";
2
+ import { EntityFormProps } from "../components";
3
+ /**
4
+ * Props used to open a side dialog
5
+ * @group Hooks and utilities
6
+ */
7
+ export interface EntitySidePanelProps<M extends Record<string, any> = any> {
8
+ /**
9
+ * Absolute path of the entity
10
+ */
11
+ path: string;
12
+ /**
13
+ * ID of the entity, if not set, it means we are creating a new entity
14
+ */
15
+ entityId?: string | number;
16
+ /**
17
+ * Set this flag to true if you want to make a copy of an existing entity
18
+ */
19
+ copy?: boolean;
20
+ /**
21
+ * Open the entity with a selected sub-collection view. If the panel for this
22
+ * entity was already open, it is replaced.
23
+ */
24
+ selectedTab?: string;
25
+ /**
26
+ * Use this prop to override the width of the form view.
27
+ * e.g. "600px"
28
+ */
29
+ width?: number | string;
30
+ /**
31
+ * Collection representing the entities of this view.
32
+ * If you leave it blank it will be induced by your navigation
33
+ */
34
+ collection?: EntityCollection<M>;
35
+ /**
36
+ * Should update the URL when opening the dialog.
37
+ * Consider that if the collection that you provide is not defined in the base
38
+ * config of your `Rebase` component, you will not be able to recreate
39
+ * the state if copying the URL to a different window.
40
+ */
41
+ updateUrl?: boolean;
42
+ /**
43
+ * Callback when the entity is updated
44
+ * @param params
45
+ */
46
+ onUpdate?: (params: {
47
+ entity: Entity<any>;
48
+ }) => void;
49
+ /**
50
+ * Callback when the dialog is closed
51
+ */
52
+ onClose?: () => void;
53
+ /**
54
+ * Should this panel close when saving
55
+ */
56
+ closeOnSave?: boolean;
57
+ /**
58
+ * Override some form properties
59
+ */
60
+ formProps?: Partial<EntityFormProps<M>>;
61
+ /**
62
+ * Allow the user to open the entity fullscreen
63
+ */
64
+ allowFullScreen?: boolean;
65
+ }
66
+ /**
67
+ * Controller to open the side dialog displaying entity forms
68
+ * @group Hooks and utilities
69
+ */
70
+ export interface SideEntityController {
71
+ /**
72
+ * Close the last panel
73
+ */
74
+ close: () => void;
75
+ /**
76
+ * Open a new entity sideDialog. By default, the collection and configuration
77
+ * of the view is fetched from the collections you have specified in the
78
+ * navigation.
79
+ * At least you need to pass the path of the entity you would like
80
+ * to edit. You can set an entityId if you would like to edit and existing one
81
+ * (or a new one with that id).
82
+ * @param props
83
+ */
84
+ open: <M extends Record<string, any> = any>(props: EntitySidePanelProps<M>) => void;
85
+ /**
86
+ * Replace the last open entity panel with the given one.
87
+ * @param props
88
+ */
89
+ replace: <M extends Record<string, any> = any>(props: EntitySidePanelProps<M>) => void;
90
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Possible snackbar types
3
+ * @group Hooks and utilities
4
+ */
5
+ export type SnackbarMessageType = "success" | "info" | "warning" | "error";
6
+ /**
7
+ * Controller to display snackbars
8
+ * @group Hooks and utilities
9
+ */
10
+ export interface SnackbarController {
11
+ /**
12
+ * Close the currently open snackbar
13
+ */
14
+ close: () => void;
15
+ /**
16
+ * Display a new snackbar. You need to specify the type and message.
17
+ * You can optionally specify a title
18
+ */
19
+ open: (props: {
20
+ type: SnackbarMessageType;
21
+ message: React.ReactNode;
22
+ autoHideDuration?: number;
23
+ }) => void;
24
+ }
@@ -0,0 +1,173 @@
1
+ /**
2
+ * @group Models
3
+ */
4
+ export interface UploadFileProps {
5
+ file: File;
6
+ fileName?: string;
7
+ path?: string;
8
+ metadata?: Record<string, unknown>;
9
+ bucket?: string;
10
+ }
11
+ /**
12
+ * @group Models
13
+ */
14
+ export interface UploadFileResult {
15
+ /**
16
+ * Storage path including the file name where the file was uploaded.
17
+ */
18
+ path: string;
19
+ /**
20
+ * Bucket where the file was uploaded
21
+ */
22
+ bucket: string;
23
+ /**
24
+ * Fully qualified storage URL for the uploaded file.
25
+ *
26
+ * For example: `gs://my-bucket/path/to/file.png`.
27
+ *
28
+ * This is optional for backwards compatibility.
29
+ */
30
+ storageUrl?: string;
31
+ }
32
+ /**
33
+ * @group Models
34
+ */
35
+ export interface DownloadConfig {
36
+ /**
37
+ * Temporal url that can be used to download the file
38
+ */
39
+ url: string | null;
40
+ metadata?: DownloadMetadata;
41
+ fileNotFound?: boolean;
42
+ }
43
+ /**
44
+ * The full set of object metadata, including read-only properties.
45
+ * @public
46
+ */
47
+ export declare interface DownloadMetadata {
48
+ /**
49
+ * The bucket this object is contained in.
50
+ */
51
+ bucket: string;
52
+ /**
53
+ * The full path of this object.
54
+ */
55
+ fullPath: string;
56
+ /**
57
+ * The short name of this object, which is the last component of the full path.
58
+ * For example, if path is 'full/path/image.png', name is 'image.png'.
59
+ */
60
+ name: string;
61
+ /**
62
+ * The size of this object, in bytes.
63
+ */
64
+ size: number;
65
+ /**
66
+ * Type of the uploaded file
67
+ * e.g. "image/jpeg"
68
+ */
69
+ contentType: string;
70
+ customMetadata: Record<string, unknown>;
71
+ }
72
+ /**
73
+ * @group Models
74
+ */
75
+ export interface StorageSource {
76
+ /**
77
+ * Upload a file, specifying a name and a path
78
+ * @param file
79
+ * @param fileName
80
+ * @param path
81
+ * @param metadata
82
+ * @param bucket
83
+ */
84
+ uploadFile: ({ file, fileName, path, metadata, bucket }: UploadFileProps) => Promise<UploadFileResult>;
85
+ /**
86
+ * Convert a storage path or URL into a download configuration
87
+ * @param path
88
+ * @param bucket
89
+ */
90
+ getDownloadURL: (pathOrUrl: string, bucket?: string) => Promise<DownloadConfig>;
91
+ /**
92
+ * Get a file from a storage path.
93
+ * It returns null if the file does not exist.
94
+ * @param props
95
+ * @param bucket
96
+ */
97
+ getFile: (path: string, bucket?: string) => Promise<File | null>;
98
+ /**
99
+ * Delete a file.
100
+ * @param path
101
+ * @param bucket
102
+ */
103
+ deleteFile: (path: string, bucket?: string) => Promise<void>;
104
+ /**
105
+ * List the contents of a path.
106
+ * @param path
107
+ * @param options
108
+ */
109
+ list: (path: string, options?: {
110
+ bucket?: string;
111
+ maxResults?: number;
112
+ pageToken?: string;
113
+ }) => Promise<StorageListResult>;
114
+ }
115
+ /**
116
+ * Result returned by list().
117
+ * @public
118
+ */
119
+ export declare interface StorageListResult {
120
+ /**
121
+ * References to prefixes (sub-folders). You can call list() on them to
122
+ * get its contents.
123
+ *
124
+ * Folders are implicit based on '/' in the object paths.
125
+ * For example, if a bucket has two objects '/a/b/1' and '/a/b/2', list('/a')
126
+ * will return '/a/b' as a prefix.
127
+ */
128
+ prefixes: StorageReference[];
129
+ /**
130
+ * Objects in this directory.
131
+ * You can call getMetadata() and getDownloadUrl() on them.
132
+ */
133
+ items: StorageReference[];
134
+ /**
135
+ * If set, there might be more results for this list. Use this token to resume the list.
136
+ */
137
+ nextPageToken?: string;
138
+ }
139
+ /**
140
+ * Represents a reference to a Google Cloud Storage object. Developers can
141
+ * upload, download, and delete objects, as well as get/set object metadata.
142
+ * @public
143
+ */
144
+ export declare interface StorageReference {
145
+ /**
146
+ * Returns a gs:// URL for this object in the form
147
+ * `gs://<bucket>/<path>/<to>/<object>`
148
+ * @returns The gs:// URL.
149
+ */
150
+ toString(): string;
151
+ /**
152
+ * A reference to the root of this object's bucket.
153
+ */
154
+ root: StorageReference;
155
+ /**
156
+ * The name of the bucket containing this reference's object.
157
+ */
158
+ bucket: string;
159
+ /**
160
+ * The full path of this object.
161
+ */
162
+ fullPath: string;
163
+ /**
164
+ * The short name of this object, which is the last component of the full path.
165
+ * For example, if path is 'full/path/image.png', name is 'image.png'.
166
+ */
167
+ name: string;
168
+ /**
169
+ * A reference pointing to the parent location of this reference, or null if
170
+ * this reference is the root.
171
+ */
172
+ parent: StorageReference | null;
173
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./rebase_context";
2
+ export * from "./types";
3
+ export * from "./components";
4
+ export * from "./controllers";
5
+ export * from "./users";