@rebasepro/types 0.0.1-canary.eae7889 → 0.0.1-canary.eb08332

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 (109) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +93 -174
  3. package/dist/controllers/auth.d.ts +20 -29
  4. package/dist/controllers/client.d.ts +364 -53
  5. package/dist/controllers/collection_registry.d.ts +5 -4
  6. package/dist/controllers/customization_controller.d.ts +11 -10
  7. package/dist/controllers/data.d.ts +304 -61
  8. package/dist/controllers/data_driver.d.ts +105 -34
  9. package/dist/controllers/email.d.ts +4 -2
  10. package/dist/controllers/index.d.ts +1 -1
  11. package/dist/controllers/local_config_persistence.d.ts +4 -4
  12. package/dist/controllers/navigation.d.ts +33 -21
  13. package/dist/controllers/registry.d.ts +37 -11
  14. package/dist/controllers/{side_entity_controller.d.ts → side_panel_controller.d.ts} +14 -7
  15. package/dist/controllers/storage.d.ts +39 -0
  16. package/dist/errors.d.ts +64 -0
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.es.js +533 -196
  19. package/dist/index.es.js.map +1 -1
  20. package/dist/index.umd.js +589 -220
  21. package/dist/index.umd.js.map +1 -1
  22. package/dist/rebase_context.d.ts +25 -20
  23. package/dist/types/api_keys.d.ts +57 -0
  24. package/dist/types/auth_adapter.d.ts +443 -0
  25. package/dist/types/backend.d.ts +76 -29
  26. package/dist/types/backup.d.ts +20 -0
  27. package/dist/types/breadcrumbs.d.ts +26 -0
  28. package/dist/types/builders.d.ts +2 -2
  29. package/dist/types/collections.d.ts +481 -127
  30. package/dist/types/component_overrides.d.ts +196 -0
  31. package/dist/types/component_ref.d.ts +47 -0
  32. package/dist/types/cron.d.ts +13 -4
  33. package/dist/types/data_source.d.ts +92 -3
  34. package/dist/types/database_adapter.d.ts +111 -0
  35. package/dist/types/entities.d.ts +7 -7
  36. package/dist/types/entity_actions.d.ts +15 -9
  37. package/dist/types/entity_callbacks.d.ts +55 -43
  38. package/dist/types/entity_views.d.ts +46 -12
  39. package/dist/types/export_import.d.ts +1 -1
  40. package/dist/types/filter-operators.d.ts +153 -0
  41. package/dist/types/formex.d.ts +40 -0
  42. package/dist/types/index.d.ts +11 -1
  43. package/dist/types/modify_collections.d.ts +2 -2
  44. package/dist/types/plugins.d.ts +16 -18
  45. package/dist/types/policy.d.ts +191 -0
  46. package/dist/types/properties.d.ts +259 -145
  47. package/dist/types/property_config.d.ts +6 -2
  48. package/dist/types/relations.d.ts +3 -3
  49. package/dist/types/slots.d.ts +34 -24
  50. package/dist/types/storage_source.d.ts +83 -0
  51. package/dist/types/translations.d.ts +58 -13
  52. package/dist/types/user_management_delegate.d.ts +7 -106
  53. package/dist/types/websockets.d.ts +12 -13
  54. package/dist/users/index.d.ts +0 -1
  55. package/dist/users/user.d.ts +26 -10
  56. package/package.json +15 -20
  57. package/src/controllers/auth.tsx +13 -35
  58. package/src/controllers/client.ts +402 -38
  59. package/src/controllers/collection_registry.ts +5 -4
  60. package/src/controllers/customization_controller.tsx +12 -12
  61. package/src/controllers/data.ts +335 -75
  62. package/src/controllers/data_driver.ts +119 -36
  63. package/src/controllers/email.ts +4 -2
  64. package/src/controllers/index.ts +1 -1
  65. package/src/controllers/local_config_persistence.tsx +4 -4
  66. package/src/controllers/navigation.ts +36 -23
  67. package/src/controllers/registry.ts +41 -11
  68. package/src/controllers/{side_entity_controller.tsx → side_panel_controller.tsx} +15 -7
  69. package/src/controllers/storage.ts +60 -1
  70. package/src/errors.ts +80 -0
  71. package/src/index.ts +1 -0
  72. package/src/rebase_context.tsx +26 -20
  73. package/src/types/api_keys.ts +52 -0
  74. package/src/types/auth_adapter.ts +517 -0
  75. package/src/types/backend.ts +91 -40
  76. package/src/types/backup.ts +26 -0
  77. package/src/types/breadcrumbs.ts +27 -0
  78. package/src/types/builders.ts +2 -2
  79. package/src/types/collections.ts +544 -158
  80. package/src/types/component_overrides.ts +244 -0
  81. package/src/types/component_ref.ts +57 -0
  82. package/src/types/cron.ts +14 -4
  83. package/src/types/data_source.ts +111 -5
  84. package/src/types/database_adapter.ts +135 -0
  85. package/src/types/entities.ts +7 -7
  86. package/src/types/entity_actions.tsx +16 -9
  87. package/src/types/entity_callbacks.ts +58 -47
  88. package/src/types/entity_views.tsx +49 -12
  89. package/src/types/export_import.ts +1 -1
  90. package/src/types/filter-operators.ts +240 -0
  91. package/src/types/formex.ts +45 -0
  92. package/src/types/index.ts +12 -1
  93. package/src/types/modify_collections.tsx +2 -2
  94. package/src/types/plugins.tsx +17 -18
  95. package/src/types/policy.ts +229 -0
  96. package/src/types/properties.ts +302 -163
  97. package/src/types/property_config.tsx +6 -4
  98. package/src/types/relations.ts +3 -3
  99. package/src/types/slots.tsx +34 -24
  100. package/src/types/storage_source.ts +90 -0
  101. package/src/types/translations.ts +62 -13
  102. package/src/types/user_management_delegate.ts +7 -125
  103. package/src/types/websockets.ts +12 -14
  104. package/src/users/index.ts +1 -1
  105. package/src/users/user.ts +28 -10
  106. package/dist/types/entity_overrides.d.ts +0 -10
  107. package/dist/users/roles.d.ts +0 -22
  108. package/src/types/entity_overrides.tsx +0 -11
  109. package/src/users/roles.ts +0 -32
@@ -1,12 +1,20 @@
1
- import { User } from "../users";
2
- import { RebaseData } from "./data";
3
- import { EmailService } from "./email";
1
+ import type { User } from "../users";
2
+ import type { RebaseSdkData } from "./data";
3
+ import type { EmailService } from "./email";
4
+ import type { StorageSource } from "./storage";
5
+ import type { CronJobStatus, CronJobLogEntry } from "../types/cron";
6
+ import type { BackupInfo, BackupDestinationKind } from "../types/backup";
7
+ import type { ApiKeysAPI } from "../types/api_keys";
8
+ import type { StorageSourceDefinition } from "../types/storage_source";
4
9
  /**
5
10
  * Event type for authentication state changes
6
11
  */
7
12
  export type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "USER_UPDATED";
8
13
  /**
9
- * Standard session interface representing an authenticated state
14
+ * Standard session interface representing an authenticated state.
15
+ *
16
+ * There is exactly one canonical definition of this type (here in
17
+ * `@rebasepro/types`). The `@rebasepro/client` package re-exports it.
10
18
  */
11
19
  export interface RebaseSession {
12
20
  accessToken: string;
@@ -14,7 +22,36 @@ export interface RebaseSession {
14
22
  expiresAt: number;
15
23
  user: User;
16
24
  }
17
- import { StorageSource } from "./storage";
25
+ /**
26
+ * Access and refresh token pair returned by authentication endpoints.
27
+ *
28
+ * Replaces the former `RebaseTokens` (client) and `AuthTokens` (auth) types,
29
+ * which had identical shapes.
30
+ *
31
+ * @group Auth
32
+ */
33
+ export interface AuthTokens {
34
+ accessToken: string;
35
+ refreshToken: string;
36
+ /** Unix timestamp (ms) when the access token expires. */
37
+ accessTokenExpiresAt: number;
38
+ }
39
+ /**
40
+ * A device-level session entry as returned by `GET /auth/sessions`.
41
+ *
42
+ * Represents one refresh-token / device pair. Not to be confused with
43
+ * {@link RebaseSession}, which is the client-side representation of the
44
+ * *current* authenticated state (user + tokens).
45
+ *
46
+ * @group Auth
47
+ */
48
+ export interface DeviceSession {
49
+ id: string;
50
+ userAgent?: string;
51
+ ipAddress?: string;
52
+ createdAt: string;
53
+ isCurrentSession?: boolean;
54
+ }
18
55
  /**
19
56
  * Unified Authentication Client Interface
20
57
  * Pure functional SDK interface, decoupled from UI and React hooks
@@ -28,6 +65,12 @@ export interface AuthClient {
28
65
  * Get the currently active session
29
66
  */
30
67
  getSession(): RebaseSession | null;
68
+ /**
69
+ * Get the current user's active sessions
70
+ */
71
+ getSessions?: () => Promise<DeviceSession[]>;
72
+ revokeSession?: (sessionId: string) => Promise<void>;
73
+ revokeAllSessions?: () => Promise<void>;
31
74
  /**
32
75
  * Sign out the current user and clear local session
33
76
  */
@@ -42,7 +85,14 @@ export interface AuthClient {
42
85
  refreshSession(): Promise<RebaseSession>;
43
86
  }
44
87
  /**
45
- * User record as returned by the Admin API.
88
+ * User record as returned by the Admin API (`GET /admin/users`, etc.).
89
+ *
90
+ * This is a dedicated DTO for admin operations and differs from {@link User}:
91
+ * - `roles` is required (always an array), vs optional on `User`
92
+ * - Includes audit timestamps (`createdAt`, `updatedAt`) as ISO strings
93
+ * - `email` is non-nullable (admin users always have an email)
94
+ *
95
+ * @see User — the canonical client-facing user type
46
96
  * @group Admin
47
97
  */
48
98
  export interface AdminUser {
@@ -50,25 +100,19 @@ export interface AdminUser {
50
100
  email: string;
51
101
  displayName: string | null;
52
102
  photoURL: string | null;
53
- provider: string;
103
+ /**
104
+ * The provider used to authenticate the user (e.g. `"password"`,
105
+ * `"google"`). Named to match the canonical {@link User.providerId}.
106
+ */
107
+ providerId: string;
54
108
  roles: string[];
109
+ metadata?: Record<string, any>;
55
110
  createdAt: string;
56
111
  updatedAt: string;
57
112
  }
58
- /**
59
- * Role record as returned by the Admin API.
60
- * @group Admin
61
- */
62
- export interface AdminRole {
63
- id: string;
64
- name: string;
65
- isAdmin: boolean;
66
- defaultPermissions: Record<string, unknown> | null;
67
- config: Record<string, unknown> | null;
68
- }
69
113
  /**
70
114
  * Client-side Admin API interface.
71
- * Provides user and role management operations.
115
+ * Provides user management operations.
72
116
  * @group Admin
73
117
  */
74
118
  export interface AdminAPI {
@@ -95,6 +139,7 @@ export interface AdminAPI {
95
139
  displayName?: string;
96
140
  password?: string;
97
141
  roles?: string[];
142
+ metadata?: Record<string, any>;
98
143
  }): Promise<{
99
144
  user: AdminUser;
100
145
  }>;
@@ -103,37 +148,26 @@ export interface AdminAPI {
103
148
  displayName?: string;
104
149
  password?: string;
105
150
  roles?: string[];
151
+ metadata?: Record<string, any>;
106
152
  }): Promise<{
107
153
  user: AdminUser;
108
154
  }>;
109
155
  deleteUser(userId: string): Promise<{
110
156
  success: boolean;
111
157
  }>;
112
- listRoles(): Promise<{
113
- roles: AdminRole[];
114
- }>;
115
- getRole(roleId: string): Promise<{
116
- role: AdminRole;
117
- }>;
118
- createRole(data: {
119
- id: string;
120
- name: string;
121
- isAdmin?: boolean;
122
- defaultPermissions?: Record<string, unknown>;
123
- config?: Record<string, unknown>;
124
- }): Promise<{
125
- role: AdminRole;
126
- }>;
127
- updateRole(roleId: string, data: {
128
- name?: string;
129
- isAdmin?: boolean;
130
- defaultPermissions?: Record<string, unknown>;
131
- config?: Record<string, unknown>;
158
+ resetPassword(userId: string, options?: {
159
+ password?: string;
132
160
  }): Promise<{
133
- role: AdminRole;
161
+ user: AdminUser;
162
+ temporaryPassword?: string;
163
+ invitationSent?: boolean;
164
+ emailDeliveryFailed?: boolean;
134
165
  }>;
135
- deleteRole(roleId: string): Promise<{
136
- success: boolean;
166
+ listRoles(): Promise<{
167
+ roles: Array<{
168
+ id: string;
169
+ name: string;
170
+ }>;
137
171
  }>;
138
172
  bootstrap(): Promise<{
139
173
  success: boolean;
@@ -145,26 +179,303 @@ export interface AdminAPI {
145
179
  }>;
146
180
  }
147
181
  /**
148
- * Overarching abstraction that unites Data, Auth, Storage, and Email.
149
- * Adapters for Supabase or Firebase simply need to implement this interface.
182
+ * Client-side Cron job management interface.
183
+ * @group Cron
184
+ */
185
+ export interface CronAPI {
186
+ listJobs(): Promise<{
187
+ jobs: CronJobStatus[];
188
+ }>;
189
+ getJob(jobId: string): Promise<{
190
+ job: CronJobStatus;
191
+ }>;
192
+ triggerJob(jobId: string): Promise<{
193
+ log: CronJobLogEntry;
194
+ job: CronJobStatus;
195
+ }>;
196
+ getJobLogs(jobId: string, options?: {
197
+ limit?: number;
198
+ }): Promise<{
199
+ logs: CronJobLogEntry[];
200
+ }>;
201
+ toggleJob(jobId: string, enabled: boolean): Promise<{
202
+ job: CronJobStatus;
203
+ }>;
204
+ }
205
+ /**
206
+ * Client-side database-backup management interface.
207
+ * @group Backups
208
+ */
209
+ export interface BackupsAPI {
210
+ /** List available backups at the configured destination, newest first. */
211
+ list(): Promise<{
212
+ backups: BackupInfo[];
213
+ destinationKind: BackupDestinationKind;
214
+ configured: boolean;
215
+ }>;
216
+ /** Fetch a backup's bytes for download (authenticated). */
217
+ download(key: string): Promise<Blob>;
218
+ }
219
+ /**
220
+ * Options for invoking a custom backend function.
221
+ * @group Functions
222
+ */
223
+ export interface FunctionInvokeOptions {
224
+ /** HTTP method — defaults to `"POST"`. */
225
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
226
+ /** Sub-path appended after the function name. */
227
+ path?: string;
228
+ /** Extra headers merged into the request. */
229
+ headers?: Record<string, string>;
230
+ }
231
+ /**
232
+ * Client interface for invoking custom backend functions.
233
+ * @group Functions
234
+ */
235
+ export interface FunctionsAPI {
236
+ /**
237
+ * Invoke a custom backend function by name.
238
+ *
239
+ * @typeParam T - Expected shape of the response payload.
240
+ * @param name - Function name (filename without extension, e.g. `"extract-job"`).
241
+ * @param payload - Optional JSON-serialisable body sent as POST.
242
+ * @param options - Optional overrides (method, sub-path, headers).
243
+ */
244
+ invoke<T = unknown>(name: string, payload?: unknown, options?: FunctionInvokeOptions): Promise<T>;
245
+ }
246
+ /**
247
+ * Configuration for entity history / audit-log tracking.
248
+ *
249
+ * - `true` — enable history with default settings
250
+ * - `{ retention?: number }` — enable with optional retention period in days
251
+ */
252
+ export type HistoryConfig = boolean | {
253
+ retention?: number;
254
+ };
255
+ /**
256
+ * Minimal WebSocket client contract exposed on {@link RebaseClient}.
257
+ *
258
+ * The full implementation (`RebaseWebSocketClient` in `@rebasepro/client`)
259
+ * adds subscription helpers, CRUD-over-WS, SQL execution, etc.
260
+ */
261
+ export interface RebaseWebSocket {
262
+ /** Disconnect the WebSocket and stop reconnecting. */
263
+ disconnect(): void;
264
+ /** Send an authentication token to the server. */
265
+ authenticate(token: string): Promise<void>;
266
+ /** Set a function that lazily resolves the auth token for auto-authentication. */
267
+ setAuthTokenGetter(getter: () => Promise<string | null>): void;
268
+ /** Listen for connection lifecycle events. */
269
+ on(event: "connect" | "disconnect" | "reconnect" | "error", cb: (...args: unknown[]) => void): () => void;
270
+ }
271
+ /**
272
+ * The single, canonical Rebase client interface.
273
+ *
274
+ * Used everywhere: the server-side `rebase` singleton, the SDK's
275
+ * `createRebaseClient()`, React context, cron job context, etc.
276
+ *
277
+ * Core fields (`data`, `auth`) are always present. Everything else
278
+ * is optional — which capabilities are populated depends on the
279
+ * runtime environment and adapter.
150
280
  */
151
281
  export interface RebaseClient<DB = unknown> {
152
282
  /** Unified Data access layer */
153
- data: RebaseData;
283
+ data: RebaseSdkData<DB>;
284
+ /**
285
+ * Admin-scoped, **RLS-bypassing** data accessor.
286
+ *
287
+ * Present on the **server** singleton only (see {@link RebaseServerClient}).
288
+ * It runs with `{ uid: "service", roles: ["admin"] }` — every read and write
289
+ * bypasses row-level-security policies. This is the correct tool for trusted
290
+ * background work (cron jobs, migrations, service-to-service tasks).
291
+ *
292
+ * ⚠️ **Do NOT use it to serve user-facing data.** Inside a request handler,
293
+ * user-scoped queries must go through the request-scoped driver
294
+ * (`c.var.driver`), which carries the caller's identity so RLS applies.
295
+ * Reaching for `dataAsAdmin` (or its alias {@link data}) in a request handler
296
+ * silently exposes every row to every caller.
297
+ *
298
+ * Undefined in the browser SDK.
299
+ */
300
+ dataAsAdmin?: RebaseSdkData<DB>;
154
301
  /** Unified Authentication layer */
155
302
  auth: AuthClient;
156
- /** Unified Storage layer */
303
+ /** Unified Storage layer (default storage source, backward-compatible) */
157
304
  storage?: StorageSource;
305
+ /** Registry of all named storage sources for multi-backend support */
306
+ storageRegistry?: StorageSourceRegistry;
307
+ /**
308
+ * Build a server-backed {@link StorageSource} for a named storage source.
309
+ * The returned source forwards `storageId` to the backend so requests are
310
+ * routed to the matching `StorageController`. Used to lazily wire
311
+ * `transport: "server"` sources on the frontend.
312
+ */
313
+ createStorageSource?(storageId: string): StorageSource;
314
+ /**
315
+ * Discover the storage sources declared on the backend via
316
+ * `GET /api/storage/sources`. Server-transport sources are auto-registered
317
+ * into {@link storageRegistry}; `direct` sources are returned so the app
318
+ * can supply the live {@link StorageSource} instance. The result is cached
319
+ * (a failed call is retryable). This makes the backend the single source of
320
+ * truth for storage-source configuration.
321
+ */
322
+ fetchStorageSources?(): Promise<StorageSourceDefinition[]>;
158
323
  /**
159
324
  * Server-side email service.
160
- *
161
- * Available when SMTP (or a custom `sendEmail` function) is configured
162
- * in the backend auth config. `undefined` when email is not configured.
163
- *
164
- * > **Note:** This is only available on the server-side `rebase` singleton.
165
- * > The client-side SDK does not include an email service.
325
+ * Available when SMTP or a custom `sendEmail` function is configured.
166
326
  */
167
327
  email?: EmailService;
168
- /** Admin API for user and role management */
328
+ /** Admin API for user management */
329
+ admin?: AdminAPI;
330
+ /** Cron job management API */
331
+ cron?: CronAPI;
332
+ /** Database backup management API */
333
+ backups?: BackupsAPI;
334
+ /** Custom backend functions API */
335
+ functions?: FunctionsAPI;
336
+ /** Service API keys management API */
337
+ apiKeys?: ApiKeysAPI;
338
+ /** Base HTTP URL of the backend server */
339
+ baseUrl?: string;
340
+ /** WebSocket client for realtime subscriptions */
341
+ ws?: RebaseWebSocket;
342
+ /** Set the auth token for subsequent requests */
343
+ setToken?(token: string | null): void;
344
+ /** Set a function that lazily resolves the auth token */
345
+ setAuthTokenGetter?(getter: () => Promise<string | null>): void;
346
+ /** Set handler called when a request returns 401 */
347
+ setOnUnauthorized?(handler: () => Promise<boolean>): void;
348
+ /** Resolve the current auth token */
349
+ resolveToken?(): Promise<string | null>;
350
+ /** Make a raw HTTP call to the backend */
351
+ call?<T = unknown>(endpoint: string, payload?: unknown): Promise<T>;
352
+ /**
353
+ * Execute raw SQL against the database.
354
+ * Only available server-side with a SQL database.
355
+ */
356
+ sql?(query: string, options?: {
357
+ database?: string;
358
+ role?: string;
359
+ }): Promise<Record<string, unknown>[]>;
360
+ }
361
+ /**
362
+ * The server-side Rebase surface — the shape of the `rebase` singleton exported
363
+ * from `@rebasepro/server`.
364
+ *
365
+ * Narrows {@link RebaseClient} to the guarantees that always hold on the server:
366
+ * the admin-scoped {@link dataAsAdmin} accessor, raw {@link sql}, and the
367
+ * {@link email} service are all present (non-optional).
368
+ *
369
+ * **Trust levels.** Both {@link dataAsAdmin} and the deprecated {@link data}
370
+ * alias point at the same admin-scoped, **RLS-bypassing** driver. Prefer
371
+ * `dataAsAdmin` so the privilege is explicit at every call site. For user-scoped
372
+ * queries inside a request handler use the request-scoped driver
373
+ * (`c.var.driver`) instead — never `dataAsAdmin`/`data`.
374
+ */
375
+ export interface RebaseServerClient<DB = unknown> extends RebaseClient<DB> {
376
+ /**
377
+ * @deprecated On the server, prefer {@link dataAsAdmin} for admin scope or
378
+ * the request-scoped driver (`c.var.driver`) for user scope. This alias
379
+ * points at the same admin-scoped, RLS-bypassing accessor as `dataAsAdmin`.
380
+ */
381
+ data: RebaseSdkData<DB>;
382
+ /**
383
+ * Admin-scoped, **RLS-bypassing** data accessor. Always present server-side.
384
+ * See {@link RebaseClient.dataAsAdmin} for the full safety contract.
385
+ */
386
+ dataAsAdmin: RebaseSdkData<DB>;
387
+ /**
388
+ * Server-side email service. Always present server-side (a no-op sender is
389
+ * wired when SMTP is not configured).
390
+ */
391
+ email: EmailService;
392
+ /**
393
+ * Execute raw SQL against the database. Always present server-side for SQL
394
+ * engines.
395
+ */
396
+ sql(query: string, options?: {
397
+ database?: string;
398
+ role?: string;
399
+ }): Promise<Record<string, unknown>[]>;
400
+ }
401
+ /**
402
+ * The browser-side Rebase surface — the shape produced by
403
+ * `createRebaseClient()` in `@rebasepro/client`.
404
+ *
405
+ * Its {@link data} accessor is **user-scoped**: every call carries the signed-in
406
+ * user's token, so backend RLS policies apply. It deliberately omits the
407
+ * server-only members — there is no `sql`, no `email`, and no
408
+ * `dataAsAdmin`, so the RLS-bypassing accessor can never be reached from
409
+ * browser code.
410
+ */
411
+ export interface RebaseBrowserClient<DB = unknown> {
412
+ /** User-scoped data access layer (carries the signed-in user's token). */
413
+ data: RebaseSdkData<DB>;
414
+ /** Unified Authentication layer */
415
+ auth: AuthClient;
416
+ /** Unified Storage layer (default storage source, backward-compatible) */
417
+ storage?: StorageSource;
418
+ /** Registry of all named storage sources for multi-backend support */
419
+ storageRegistry?: StorageSourceRegistry;
420
+ /** Build a server-backed {@link StorageSource} for a named storage source. */
421
+ createStorageSource?(storageId: string): StorageSource;
422
+ /** Discover the storage sources declared on the backend. */
423
+ fetchStorageSources?(): Promise<StorageSourceDefinition[]>;
424
+ /** Admin API for user management */
169
425
  admin?: AdminAPI;
426
+ /** Cron job management API */
427
+ cron?: CronAPI;
428
+ /** Database backup management API */
429
+ backups?: BackupsAPI;
430
+ /** Custom backend functions API */
431
+ functions?: FunctionsAPI;
432
+ /** Service API keys management API */
433
+ apiKeys?: ApiKeysAPI;
434
+ /** Base HTTP URL of the backend server */
435
+ baseUrl?: string;
436
+ /** WebSocket client for realtime subscriptions */
437
+ ws?: RebaseWebSocket;
438
+ /** Set the auth token for subsequent requests */
439
+ setToken?(token: string | null): void;
440
+ /** Set a function that lazily resolves the auth token */
441
+ setAuthTokenGetter?(getter: () => Promise<string | null>): void;
442
+ /** Set handler called when a request returns 401 */
443
+ setOnUnauthorized?(handler: () => Promise<boolean>): void;
444
+ /** Resolve the current auth token */
445
+ resolveToken?(): Promise<string | null>;
446
+ /** Make a raw HTTP call to the backend */
447
+ call?<T = unknown>(endpoint: string, payload?: unknown): Promise<T>;
448
+ }
449
+ /**
450
+ * Client-side registry for managing multiple storage sources.
451
+ *
452
+ * Mirrors the server-side `StorageRegistry` pattern. Allows collection
453
+ * properties to reference a named storage backend via
454
+ * `StorageConfig.storageSource`.
455
+ *
456
+ * @group Models
457
+ */
458
+ export interface StorageSourceRegistry {
459
+ /**
460
+ * Get a storage source by key.
461
+ * @param key - Storage source key, or undefined/null for default
462
+ * @returns The StorageSource, or undefined if not found
463
+ */
464
+ get(key: string | undefined | null): StorageSource | undefined;
465
+ /**
466
+ * Get the default storage source (key = "(default)").
467
+ * @throws Error if no default storage is registered
468
+ */
469
+ getDefault(): StorageSource;
470
+ /**
471
+ * Get a storage source by key, with fallback to default.
472
+ * @param key - Storage source key, or undefined/null for default
473
+ * @returns The StorageSource (falls back to default if key not found)
474
+ * @throws Error if neither the specified nor default storage exists
475
+ */
476
+ getOrDefault(key: string | undefined | null): StorageSource;
477
+ /** Check if a storage source with the given key exists */
478
+ has(key: string): boolean;
479
+ /** List all registered storage source keys */
480
+ list(): string[];
170
481
  }
@@ -1,17 +1,17 @@
1
- import type { EntityCollection } from "../types/collections";
1
+ import type { CollectionConfig } from "../types/collections";
2
2
  import type { EntityReference } from "../types/entities";
3
3
  /**
4
4
  * Controller that provides access to the registered entity collections.
5
5
  * @group Models
6
6
  */
7
- export type CollectionRegistryController<DB = Record<string, unknown>, EC extends EntityCollection = EntityCollection<any>> = {
7
+ export type CollectionRegistryController<DB = Record<string, unknown>, EC extends CollectionConfig = CollectionConfig> = {
8
8
  /**
9
9
  * List of the mapped collections in the CMS.
10
10
  * Each entry relates to a collection in the root database.
11
11
  * Each of the navigation entries in this field
12
12
  * generates an entry in the main menu.
13
13
  */
14
- collections?: EntityCollection[];
14
+ collections?: CollectionConfig[];
15
15
  /**
16
16
  * Is the registry ready to be used
17
17
  */
@@ -36,7 +36,8 @@ export type CollectionRegistryController<DB = Record<string, unknown>, EC extend
36
36
  * Retrieve all the related parent collection ids for a given path
37
37
  * @param path
38
38
  */
39
- getParentCollectionIds: (path: string) => string[];
39
+ getParentCollectionSlugs: (path: string) => string[];
40
+ getParentEntityIds: (path: string) => string[];
40
41
  /**
41
42
  * Resolve paths from a list of ids
42
43
  * @param ids
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import type { EntityLinkBuilder } from "../types/entity_link_builder";
3
2
  import type { Locale } from "../types/locales";
4
3
  import type { EntityAction } from "../types/entity_actions";
@@ -6,6 +5,7 @@ import type { EntityCustomView } from "../types/entity_views";
6
5
  import type { RebasePlugin } from "../types/plugins";
7
6
  import type { PropertyConfig } from "../types/property_config";
8
7
  import type { SlotContribution } from "../types/slots";
8
+ import type { ComponentOverrideMap } from "../types/component_overrides";
9
9
  export type CustomizationController = {
10
10
  /**
11
11
  * Builder for generating utility links for entities
@@ -24,7 +24,7 @@ export type CustomizationController = {
24
24
  * You can use the key to reference the custom view in
25
25
  * the `entityViews` prop of a collection.
26
26
  *
27
- * You can also define an entity view from the UI.
27
+ * You can also define a entity view from the UI.
28
28
  */
29
29
  entityViews?: EntityCustomView[];
30
30
  /**
@@ -49,12 +49,13 @@ export type CustomizationController = {
49
49
  * the `propertyConfig` prop of a property in a collection.
50
50
  */
51
51
  propertyConfigs: Record<string, PropertyConfig>;
52
- components?: {
53
- /**
54
- * Component to render when a reference is missing
55
- */
56
- missingReference?: React.ComponentType<{
57
- path: string;
58
- }>;
59
- };
52
+ /**
53
+ * Global component overrides. Keys are component names from
54
+ * {@link OverridableComponentName}. Values replace the default
55
+ * implementation everywhere in the app.
56
+ *
57
+ * Collection-scoped overrides (set on individual collections)
58
+ * take precedence over global overrides.
59
+ */
60
+ components?: ComponentOverrideMap;
60
61
  };