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