@rebasepro/types 0.6.1 → 0.8.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 (49) hide show
  1. package/dist/controllers/client.d.ts +69 -1
  2. package/dist/controllers/data.d.ts +19 -47
  3. package/dist/controllers/navigation.d.ts +14 -14
  4. package/dist/controllers/registry.d.ts +8 -4
  5. package/dist/index.es.js +164 -10
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js +171 -9
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/types/api_keys.d.ts +57 -0
  10. package/dist/types/auth_adapter.d.ts +66 -4
  11. package/dist/types/backend.d.ts +5 -0
  12. package/dist/types/collections.d.ts +200 -90
  13. package/dist/types/data_source.d.ts +79 -3
  14. package/dist/types/entity_actions.d.ts +2 -2
  15. package/dist/types/entity_callbacks.d.ts +18 -6
  16. package/dist/types/entity_views.d.ts +1 -1
  17. package/dist/types/filter-operators.d.ts +108 -0
  18. package/dist/types/index.d.ts +4 -2
  19. package/dist/types/plugins.d.ts +1 -1
  20. package/dist/types/policy.d.ts +137 -0
  21. package/dist/types/properties.d.ts +122 -37
  22. package/dist/types/property_config.d.ts +1 -1
  23. package/dist/types/storage_source.d.ts +83 -0
  24. package/dist/types/translations.d.ts +8 -0
  25. package/package.json +1 -1
  26. package/src/controllers/client.ts +69 -1
  27. package/src/controllers/data.ts +20 -59
  28. package/src/controllers/navigation.ts +17 -16
  29. package/src/controllers/registry.ts +10 -4
  30. package/src/types/api_keys.ts +52 -0
  31. package/src/types/auth_adapter.ts +80 -4
  32. package/src/types/backend.ts +6 -1
  33. package/src/types/collections.ts +235 -113
  34. package/src/types/data_source.ts +89 -5
  35. package/src/types/entity_actions.tsx +2 -2
  36. package/src/types/entity_callbacks.ts +18 -7
  37. package/src/types/entity_views.tsx +1 -1
  38. package/src/types/filter-operators.ts +167 -0
  39. package/src/types/index.ts +5 -2
  40. package/src/types/plugins.tsx +1 -1
  41. package/src/types/policy.ts +173 -0
  42. package/src/types/properties.ts +132 -39
  43. package/src/types/property_config.tsx +0 -1
  44. package/src/types/storage_source.ts +90 -0
  45. package/src/types/translations.ts +8 -0
  46. package/dist/types/backend_hooks.d.ts +0 -109
  47. package/dist/types/entity_overrides.d.ts +0 -10
  48. package/src/types/backend_hooks.ts +0 -114
  49. package/src/types/entity_overrides.tsx +0 -11
@@ -3,6 +3,8 @@ import type { RebaseData } from "./data";
3
3
  import type { EmailService } from "./email";
4
4
  import type { StorageSource } from "./storage";
5
5
  import type { CronJobStatus, CronJobLogEntry } from "../types/cron";
6
+ import type { ApiKeysAPI } from "../types/api_keys";
7
+ import type { StorageSourceDefinition } from "../types/storage_source";
6
8
  /**
7
9
  * Event type for authentication state changes
8
10
  */
@@ -102,6 +104,19 @@ export interface AdminAPI {
102
104
  deleteUser(userId: string): Promise<{
103
105
  success: boolean;
104
106
  }>;
107
+ resetPassword(userId: string, options?: {
108
+ password?: string;
109
+ }): Promise<{
110
+ user: AdminUser;
111
+ temporaryPassword?: string;
112
+ invitationSent?: boolean;
113
+ }>;
114
+ listRoles(): Promise<{
115
+ roles: Array<{
116
+ id: string;
117
+ name: string;
118
+ }>;
119
+ }>;
105
120
  bootstrap(): Promise<{
106
121
  success: boolean;
107
122
  message: string;
@@ -177,8 +192,26 @@ export interface RebaseClient<DB = unknown> {
177
192
  data: RebaseData;
178
193
  /** Unified Authentication layer */
179
194
  auth: AuthClient;
180
- /** Unified Storage layer */
195
+ /** Unified Storage layer (default storage source, backward-compatible) */
181
196
  storage?: StorageSource;
197
+ /** Registry of all named storage sources for multi-backend support */
198
+ storageRegistry?: StorageSourceRegistry;
199
+ /**
200
+ * Build a server-backed {@link StorageSource} for a named storage source.
201
+ * The returned source forwards `storageId` to the backend so requests are
202
+ * routed to the matching `StorageController`. Used to lazily wire
203
+ * `transport: "server"` sources on the frontend.
204
+ */
205
+ createStorageSource?(storageId: string): StorageSource;
206
+ /**
207
+ * Discover the storage sources declared on the backend via
208
+ * `GET /api/storage/sources`. Server-transport sources are auto-registered
209
+ * into {@link storageRegistry}; `direct` sources are returned so the app
210
+ * can supply the live {@link StorageSource} instance. The result is cached
211
+ * (a failed call is retryable). This makes the backend the single source of
212
+ * truth for storage-source configuration.
213
+ */
214
+ fetchStorageSources?(): Promise<StorageSourceDefinition[]>;
182
215
  /**
183
216
  * Server-side email service.
184
217
  * Available when SMTP or a custom `sendEmail` function is configured.
@@ -190,6 +223,8 @@ export interface RebaseClient<DB = unknown> {
190
223
  cron?: CronAPI;
191
224
  /** Custom backend functions API */
192
225
  functions?: FunctionsAPI;
226
+ /** Service API keys management API */
227
+ apiKeys?: ApiKeysAPI;
193
228
  /** Base HTTP URL of the backend server */
194
229
  baseUrl?: string;
195
230
  /** WebSocket client for realtime subscriptions */
@@ -213,3 +248,36 @@ export interface RebaseClient<DB = unknown> {
213
248
  role?: string;
214
249
  }): Promise<Record<string, unknown>[]>;
215
250
  }
251
+ /**
252
+ * Client-side registry for managing multiple storage sources.
253
+ *
254
+ * Mirrors the server-side `StorageRegistry` pattern. Allows collection
255
+ * properties to reference a named storage backend via
256
+ * `StorageConfig.storageSource`.
257
+ *
258
+ * @group Models
259
+ */
260
+ export interface StorageSourceRegistry {
261
+ /**
262
+ * Get a storage source by key.
263
+ * @param key - Storage source key, or undefined/null for default
264
+ * @returns The StorageSource, or undefined if not found
265
+ */
266
+ get(key: string | undefined | null): StorageSource | undefined;
267
+ /**
268
+ * Get the default storage source (key = "(default)").
269
+ * @throws Error if no default storage is registered
270
+ */
271
+ getDefault(): StorageSource;
272
+ /**
273
+ * Get a storage source by key, with fallback to default.
274
+ * @param key - Storage source key, or undefined/null for default
275
+ * @returns The StorageSource (falls back to default if key not found)
276
+ * @throws Error if neither the specified nor default storage exists
277
+ */
278
+ getOrDefault(key: string | undefined | null): StorageSource;
279
+ /** Check if a storage source with the given key exists */
280
+ has(key: string): boolean;
281
+ /** List all registered storage source keys */
282
+ list(): string[];
283
+ }
@@ -1,22 +1,5 @@
1
1
  import { Entity, EntityValues } from "../types/entities";
2
- /**
3
- * Parameters for querying a collection.
4
- * Uses PostgREST-style filter syntax for consistency between
5
- * the SDK (HTTP) and framework (in-process) contexts.
6
- *
7
- * @group Data
8
- */
9
- /**
10
- * A where-clause value for a single field.
11
- *
12
- * Supports three syntaxes:
13
- * 1. **Equality shorthand**: raw JS values — `null`, `"active"`, `42`, `true`
14
- * 2. **Tuple syntax**: `[operator, value]` — `[">", 18]`, `["in", ["a","b"]]`
15
- * 3. **PostgREST string**: `"eq.published"`, `"gte.18"`, `"in.(a,b)"`
16
- *
17
- * @group Data
18
- */
19
- export type WhereFieldValue = string | number | boolean | null | [WhereFilterOpShort, any] | [WhereFilterOpShort, any][];
2
+ import { WhereFilterOp, FilterValues } from "../types/filter-operators";
20
3
  export type WhereValue<T> = T | T[] | null;
21
4
  export interface LogicalCondition {
22
5
  type: "and" | "or";
@@ -24,11 +7,14 @@ export interface LogicalCondition {
24
7
  }
25
8
  export interface FilterCondition {
26
9
  column: string;
27
- operator: FilterOperator;
10
+ operator: WhereFilterOp;
28
11
  value: unknown;
29
12
  }
30
- /** Short operator strings accepted in the tuple syntax. */
31
- export type WhereFilterOpShort = "==" | "!=" | ">" | ">=" | "<" | "<=" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "nin" | "not-in" | "array-contains" | "array-contains-any" | "cs" | "csa";
13
+ /**
14
+ * Parameters for querying a collection.
15
+ *
16
+ * @group Data
17
+ */
32
18
  export interface FindParams {
33
19
  /** Maximum number of items to return (default: 20) */
34
20
  limit?: number;
@@ -37,30 +23,17 @@ export interface FindParams {
37
23
  /** Page number (1-indexed), alternative to offset */
38
24
  page?: number;
39
25
  /**
40
- * Filter object. Supports multiple syntaxes per field:
41
- *
42
- * **Equality shorthand** raw JS values (null, string, number, boolean):
43
- * ```ts
44
- * { company_profile_id: null }
45
- * { status: "active" }
46
- * { age: 18 }
47
- * ```
26
+ * Filter conditions keyed by field name.
27
+ * Each value is a `[WhereFilterOp, value]` tuple or an array of tuples
28
+ * for multiple conditions on the same field.
48
29
  *
49
- * **Tuple syntax** — `[operator, value]`:
50
- * ```ts
30
+ * @example
31
+ * { status: ["==", "active"] }
51
32
  * { age: [">=", 18] }
52
33
  * { role: ["in", ["admin", "editor"]] }
53
- * { deleted_at: ["!=", null] }
54
- * ```
55
- *
56
- * **PostgREST string syntax** (original format):
57
- * ```ts
58
- * { status: "eq.published" }
59
- * { age: "gte.18" }
60
- * { role: "in.(admin,editor)" }
61
- * ```
34
+ * { age: [[">=", 18], ["<", 65]] }
62
35
  */
63
- where?: Record<string, WhereFieldValue>;
36
+ where?: FilterValues<string>;
64
37
  /** Logical grouping conditions (AND/OR) */
65
38
  logical?: LogicalCondition;
66
39
  /**
@@ -88,15 +61,14 @@ export interface FindResponse<M extends Record<string, unknown> = Record<string,
88
61
  hasMore: boolean;
89
62
  };
90
63
  }
91
- export type FilterOperator = WhereFilterOpShort;
92
64
  /**
93
65
  * Fluent Query Builder Interface supported on both client and server accessors.
94
66
  * @group Data
95
67
  */
96
68
  export interface QueryBuilderInterface<M extends Record<string, unknown> = Record<string, unknown>> {
97
- where<K extends keyof M & string>(column: K, operator: FilterOperator, value: WhereValue<M[K]>): this;
69
+ where<K extends keyof M & string>(column: K, operator: WhereFilterOp, value: WhereValue<M[K]>): this;
98
70
  where(logicalCondition: LogicalCondition): this;
99
- orderBy(column: keyof M & string, ascending?: "asc" | "desc"): this;
71
+ orderBy(column: keyof M & string, direction?: "asc" | "desc"): this;
100
72
  limit(count: number): this;
101
73
  offset(count: number): this;
102
74
  search(searchString: string): this;
@@ -156,9 +128,9 @@ export interface CollectionAccessor<M extends Record<string, unknown> = Record<s
156
128
  * Count the number of records matching the given filter.
157
129
  */
158
130
  count?(params?: FindParams): Promise<number>;
159
- where<K extends keyof M & string>(column: K, operator: FilterOperator, value: WhereValue<M[K]>): QueryBuilderInterface<M>;
131
+ where<K extends keyof M & string>(column: K, operator: WhereFilterOp, value: WhereValue<M[K]>): QueryBuilderInterface<M>;
160
132
  where(logicalCondition: LogicalCondition): QueryBuilderInterface<M>;
161
- orderBy(column: keyof M & string, ascending?: "asc" | "desc"): QueryBuilderInterface<M>;
133
+ orderBy(column: keyof M & string, direction?: "asc" | "desc"): QueryBuilderInterface<M>;
162
134
  limit(count: number): QueryBuilderInterface<M>;
163
135
  offset(count: number): QueryBuilderInterface<M>;
164
136
  search(searchString: string): QueryBuilderInterface<M>;
@@ -195,7 +167,7 @@ export interface RebaseData {
195
167
  * const accessor = data.collection("products");
196
168
  * await accessor.find({ limit: 10 });
197
169
  */
198
- collection(slug: string): CollectionAccessor;
170
+ collection<M extends Record<string, unknown> = Record<string, unknown>>(slug: string): CollectionAccessor<M>;
199
171
  /**
200
172
  * Dynamic collection accessor.
201
173
  * Access any collection by its slug as a property.
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import type { EntityCollection } from "../types/collections";
3
- import type { RebasePlugin } from "../types/plugins";
4
3
  /**
5
4
  * Controller that handles URL path building and resolution.
6
5
  * @group Models
@@ -89,15 +88,11 @@ export type NavigationStateController = {
89
88
  /**
90
89
  * Was there an error while loading the navigation data
91
90
  */
92
- navigationLoadingError?: unknown;
91
+ navigationLoadingError?: Error;
93
92
  /**
94
93
  * Call this method to recalculate the navigation
95
94
  */
96
95
  refreshNavigation: () => void;
97
- /**
98
- * Plugin system allowing to extend the CMS functionality.
99
- */
100
- plugins?: RebasePlugin[];
101
96
  };
102
97
  export interface NavigateOptions {
103
98
  replace?: boolean;
@@ -107,12 +102,6 @@ export interface NavigateOptions {
107
102
  flushSync?: boolean;
108
103
  viewTransition?: boolean;
109
104
  }
110
- export type NavigationBlocker = {
111
- updateBlockListener: (path: string, block: boolean, basePath?: string) => () => void;
112
- isBlocked: (path: string) => boolean;
113
- proceed?: () => void;
114
- reset?: () => void;
115
- };
116
105
  /**
117
106
  * Custom additional views created by the developer, added to the main
118
107
  * navigation.
@@ -153,14 +142,25 @@ export interface AppView {
153
142
  group?: string;
154
143
  /**
155
144
  * Component to be rendered. This can be any React component, and can use
156
- * any of the provided hooks
145
+ * any of the provided hooks.
146
+ *
147
+ * Pass a `ComponentType` to enable lazy rendering — the component will
148
+ * only be instantiated when the route is visited. This is recommended
149
+ * for dynamic views generated from database data.
157
150
  */
158
- view: React.ReactNode;
151
+ view: React.ReactNode | React.ComponentType;
159
152
  /**
160
153
  * If true, a wildcard route (slug/*) is automatically registered
161
154
  * alongside the base route, enabling nested navigation within this view.
162
155
  */
163
156
  nestedRoutes?: boolean;
157
+ /**
158
+ * Restrict this view to users with at least one of the listed roles.
159
+ * When omitted or empty, the view is visible to all authenticated users.
160
+ * Applied during view resolution — the view is filtered out entirely
161
+ * (not just hidden from nav) if the user lacks a matching role.
162
+ */
163
+ roles?: string[];
164
164
  }
165
165
  /**
166
166
  * A composable section that can be rendered on the home page.
@@ -1,10 +1,9 @@
1
1
  import { ReactNode } from "react";
2
2
  import type { EntityCollection } from "../types/collections";
3
- import type { EntityCollectionsBuilder } from "../types/builders";
3
+ import type { EntityCollectionsBuilder, AppViewsBuilder } from "../types/builders";
4
4
  import type { EntityCustomView } from "../types/entity_views";
5
5
  import type { EntityAction } from "../types/entity_actions";
6
6
  import type { AppView, NavigationGroupMapping } from "./navigation";
7
- import type { RebasePlugin } from "../types/plugins";
8
7
  /**
9
8
  * Options to enable the built-in collection editor.
10
9
  * When provided to `<RebaseCMS>`, the editor is auto-wired as a native feature.
@@ -22,10 +21,15 @@ export interface CollectionEditorOptions {
22
21
  }
23
22
  export interface RebaseCMSConfig<EC extends EntityCollection = EntityCollection> {
24
23
  collections?: EC[] | EntityCollectionsBuilder<EC>;
24
+ /**
25
+ * Custom top-level views added to the main navigation.
26
+ * Accepts a static array of views or an async builder function
27
+ * that receives the current user/auth context for role-based views.
28
+ */
29
+ views?: AppView[] | AppViewsBuilder;
25
30
  homePage?: ReactNode;
26
31
  entityViews?: EntityCustomView[];
27
32
  entityActions?: EntityAction[];
28
- plugins?: RebasePlugin[];
29
33
  /**
30
34
  * Centralized configuration for how collections and views are grouped
31
35
  * in the navigation sidebar and home page.
@@ -43,7 +47,7 @@ export interface RebaseCMSConfig<EC extends EntityCollection = EntityCollection>
43
47
  collectionEditor?: boolean | CollectionEditorOptions;
44
48
  }
45
49
  export interface RebaseStudioConfig {
46
- tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api" | "logs")[];
50
+ tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api" | "logs" | "api-keys")[];
47
51
  homePage?: ReactNode;
48
52
  devViews?: AppView[];
49
53
  }
package/dist/index.es.js CHANGED
@@ -122,30 +122,156 @@ var Vector = class {
122
122
  }
123
123
  };
124
124
  //#endregion
125
+ //#region src/types/filter-operators.ts
126
+ /** Maps canonical operators to their REST short-code equivalents. */
127
+ var CANONICAL_TO_REST = {
128
+ "==": "eq",
129
+ "!=": "neq",
130
+ ">": "gt",
131
+ ">=": "gte",
132
+ "<": "lt",
133
+ "<=": "lte",
134
+ "in": "in",
135
+ "not-in": "nin",
136
+ "array-contains": "cs",
137
+ "array-contains-any": "csa"
138
+ };
139
+ /** Maps REST short-code operators to their canonical equivalents. */
140
+ var REST_TO_CANONICAL = {
141
+ "eq": "==",
142
+ "neq": "!=",
143
+ "gt": ">",
144
+ "gte": ">=",
145
+ "lt": "<",
146
+ "lte": "<=",
147
+ "in": "in",
148
+ "nin": "not-in",
149
+ "cs": "array-contains",
150
+ "csa": "array-contains-any"
151
+ };
152
+ /** All canonical operator strings for runtime validation. */
153
+ var CANONICAL_OPS = new Set([
154
+ "<",
155
+ "<=",
156
+ "==",
157
+ "!=",
158
+ ">=",
159
+ ">",
160
+ "in",
161
+ "not-in",
162
+ "array-contains",
163
+ "array-contains-any"
164
+ ]);
165
+ /**
166
+ * Resolve any operator string (canonical or REST short-code) to its
167
+ * canonical `WhereFilterOp` form. Returns `undefined` for unknown operators.
168
+ *
169
+ * @example
170
+ * toCanonicalOp("==") // "=="
171
+ * toCanonicalOp("eq") // "=="
172
+ * toCanonicalOp("cs") // "array-contains"
173
+ * toCanonicalOp("xyz") // undefined
174
+ */
175
+ function toCanonicalOp(op) {
176
+ if (CANONICAL_OPS.has(op)) return op;
177
+ return REST_TO_CANONICAL[op];
178
+ }
179
+ //#endregion
125
180
  //#region src/types/collections.ts
126
181
  /**
127
182
  * Type guard for PostgreSQL collections.
128
- * Returns true if the collection uses the Postgres driver (or the default driver).
183
+ * Returns true if the collection uses the Postgres engine (or the default engine).
129
184
  * @group Models
130
185
  */
131
186
  function isPostgresCollection(collection) {
132
- return !collection.driver || collection.driver === "postgres";
187
+ return !collection.engine || collection.engine === "postgres";
133
188
  }
134
189
  /**
135
190
  * Type guard for Firebase / Firestore collections.
136
191
  * @group Models
137
192
  */
138
193
  function isFirebaseCollection(collection) {
139
- return collection.driver === "firestore";
194
+ return collection.engine === "firestore";
140
195
  }
141
196
  /**
142
197
  * Type guard for MongoDB collections.
143
198
  * @group Models
144
199
  */
145
200
  function isMongoDBCollection(collection) {
146
- return collection.driver === "mongodb";
201
+ return collection.engine === "mongodb";
202
+ }
203
+ /**
204
+ * Returns the data path for a collection.
205
+ * For Firestore or MongoDB collections with a `path`, returns that value;
206
+ * otherwise falls back to `slug`.
207
+ */
208
+ function getCollectionDataPath(collection) {
209
+ if (isFirebaseCollection(collection) && collection.path) return collection.path;
210
+ if (isMongoDBCollection(collection) && collection.path) return collection.path;
211
+ return collection.slug;
212
+ }
213
+ /**
214
+ * Reads a collection's driver-declared subcollections thunk (the `subcollections`
215
+ * field) independent of engine identity, so engine-agnostic code doesn't have to
216
+ * type-guard against a specific driver. Returns `undefined` when the collection
217
+ * declares none.
218
+ *
219
+ * Pair with `getDataSourceCapabilities(engine).supportsSubcollections` to decide
220
+ * whether the engine honours subcollections at all before reading them.
221
+ * @group Models
222
+ */
223
+ function getDeclaredSubcollections(collection) {
224
+ return collection.subcollections;
147
225
  }
148
226
  //#endregion
227
+ //#region src/types/policy.ts
228
+ /** @group Models */
229
+ var policy = {
230
+ true: () => ({ kind: "true" }),
231
+ false: () => ({ kind: "false" }),
232
+ and: (...operands) => ({
233
+ kind: "and",
234
+ operands
235
+ }),
236
+ or: (...operands) => ({
237
+ kind: "or",
238
+ operands
239
+ }),
240
+ not: (operand) => ({
241
+ kind: "not",
242
+ operand
243
+ }),
244
+ compare: (left, op, right) => ({
245
+ kind: "compare",
246
+ op,
247
+ left,
248
+ right
249
+ }),
250
+ rolesOverlap: (roles) => ({
251
+ kind: "rolesOverlap",
252
+ roles
253
+ }),
254
+ rolesContain: (roles) => ({
255
+ kind: "rolesContain",
256
+ roles
257
+ }),
258
+ authenticated: () => ({ kind: "authenticated" }),
259
+ raw: (sql) => ({
260
+ kind: "raw",
261
+ sql
262
+ }),
263
+ field: (name) => ({
264
+ kind: "field",
265
+ name
266
+ }),
267
+ literal: (value) => ({
268
+ kind: "literal",
269
+ value
270
+ }),
271
+ authUid: () => ({ kind: "authUid" }),
272
+ authRoles: () => ({ kind: "authRoles" })
273
+ };
274
+ //#endregion
149
275
  //#region src/types/backend.ts
150
276
  /**
151
277
  * Type guard: does this admin support SQL operations?
@@ -177,6 +303,13 @@ function isBranchAdmin(admin) {
177
303
  }
178
304
  //#endregion
179
305
  //#region src/types/data_source.ts
306
+ /**
307
+ * The default data-source key, used when a collection does not name a
308
+ * `dataSource`. Shared by the frontend router and the backend driver
309
+ * registry so both agree on "the default database".
310
+ * @group Models
311
+ */
312
+ var DEFAULT_DATA_SOURCE_KEY = "(default)";
180
313
  /** @group Models */
181
314
  var POSTGRES_CAPABILITIES = {
182
315
  key: "postgres",
@@ -244,13 +377,13 @@ var CAPABILITIES_REGISTRY = {
244
377
  "(default)": DEFAULT_CAPABILITIES
245
378
  };
246
379
  /**
247
- * Look up capabilities for a given driver key.
248
- * If `driver` is undefined or not found, returns `DEFAULT_CAPABILITIES`.
380
+ * Look up capabilities for a given engine key.
381
+ * If `engine` is undefined or not found, returns `DEFAULT_CAPABILITIES`.
249
382
  * @group Models
250
383
  */
251
- function getDataSourceCapabilities(driver) {
252
- if (!driver) return POSTGRES_CAPABILITIES;
253
- return CAPABILITIES_REGISTRY[driver] ?? DEFAULT_CAPABILITIES;
384
+ function getDataSourceCapabilities(engine) {
385
+ if (!engine) return POSTGRES_CAPABILITIES;
386
+ return CAPABILITIES_REGISTRY[engine] ?? DEFAULT_CAPABILITIES;
254
387
  }
255
388
  /**
256
389
  * Register custom capabilities for a third-party driver.
@@ -260,6 +393,27 @@ function registerDataSourceCapabilities(capabilities) {
260
393
  CAPABILITIES_REGISTRY[capabilities.key] = capabilities;
261
394
  }
262
395
  //#endregion
396
+ //#region src/types/storage_source.ts
397
+ /**
398
+ * Describes a named storage backend — a place files live.
399
+ *
400
+ * Declared once and shared front + back: the frontend uses it to decide
401
+ * transport (HTTP proxy vs direct SDK), the backend uses the same `key`
402
+ * to resolve a StorageController, and collection properties reference
403
+ * a definition by its `key` via `StorageConfig.storageSource`.
404
+ *
405
+ * This mirrors the {@link DataSourceDefinition} pattern used for databases.
406
+ *
407
+ * @group Models
408
+ */
409
+ /**
410
+ * The default storage source key, used when a property does not specify
411
+ * a `storageSource`. Shared by the frontend and backend registries so
412
+ * both agree on "the default storage backend".
413
+ * @group Models
414
+ */
415
+ var DEFAULT_STORAGE_SOURCE_KEY = "(default)";
416
+ //#endregion
263
417
  //#region src/types/component_ref.ts
264
418
  /**
265
419
  * Type guard: checks if a value is a `LazyComponentRef` produced by the
@@ -269,6 +423,6 @@ function isLazyComponentRef(ref) {
269
423
  return typeof ref === "object" && ref !== null && "__rebaseLazy" in ref && ref.__rebaseLazy === true;
270
424
  }
271
425
  //#endregion
272
- export { DEFAULT_CAPABILITIES, EntityReference, EntityRelation, FIREBASE_CAPABILITIES, GeoPoint, MONGODB_CAPABILITIES, POSTGRES_CAPABILITIES, Vector, getDataSourceCapabilities, isBranchAdmin, isDocumentAdmin, isFirebaseCollection, isLazyComponentRef, isMongoDBCollection, isPostgresCollection, isSQLAdmin, isSchemaAdmin, registerDataSourceCapabilities };
426
+ export { CANONICAL_TO_REST, DEFAULT_CAPABILITIES, DEFAULT_DATA_SOURCE_KEY, DEFAULT_STORAGE_SOURCE_KEY, EntityReference, EntityRelation, FIREBASE_CAPABILITIES, GeoPoint, MONGODB_CAPABILITIES, POSTGRES_CAPABILITIES, REST_TO_CANONICAL, Vector, getCollectionDataPath, getDataSourceCapabilities, getDeclaredSubcollections, isBranchAdmin, isDocumentAdmin, isFirebaseCollection, isLazyComponentRef, isMongoDBCollection, isPostgresCollection, isSQLAdmin, isSchemaAdmin, policy, registerDataSourceCapabilities, toCanonicalOp };
273
427
 
274
428
  //# sourceMappingURL=index.es.js.map