@rebasepro/types 0.17.3 → 0.18.1

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 (71) hide show
  1. package/README.md +4 -0
  2. package/dist/call_context.d.ts +20 -0
  3. package/dist/controllers/client.d.ts +36 -4
  4. package/dist/controllers/data.d.ts +120 -10
  5. package/dist/errors.d.ts +83 -4
  6. package/dist/index.es.js +522 -160
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/types/admin_block.d.ts +2 -2
  9. package/dist/types/auth_adapter.d.ts +41 -6
  10. package/dist/types/backend.d.ts +48 -0
  11. package/dist/types/collections.d.ts +25 -1
  12. package/dist/types/cron.d.ts +34 -0
  13. package/dist/types/database_adapter.d.ts +39 -0
  14. package/dist/types/entity_callbacks.d.ts +14 -1
  15. package/dist/types/filter-operators.d.ts +24 -1
  16. package/dist/types/policy.d.ts +29 -1
  17. package/dist/types/properties.d.ts +216 -3
  18. package/dist/types/relations.d.ts +65 -7
  19. package/dist/types/resource_kinds.d.ts +173 -17
  20. package/dist/types/resources.d.ts +108 -7
  21. package/dist/types/rls-functions.d.ts +11 -0
  22. package/dist/types/storage_source.d.ts +12 -23
  23. package/package.json +24 -23
  24. package/src/call_context.ts +0 -120
  25. package/src/controllers/auth_state.ts +0 -24
  26. package/src/controllers/client.ts +0 -494
  27. package/src/controllers/collection_registry.ts +0 -62
  28. package/src/controllers/data.ts +0 -1012
  29. package/src/controllers/data_driver.ts +0 -576
  30. package/src/controllers/effective_role.ts +0 -4
  31. package/src/controllers/email.ts +0 -91
  32. package/src/controllers/index.ts +0 -11
  33. package/src/controllers/storage.ts +0 -252
  34. package/src/errors.ts +0 -119
  35. package/src/index.ts +0 -5
  36. package/src/types/admin_block.ts +0 -209
  37. package/src/types/api_keys.ts +0 -108
  38. package/src/types/auth_adapter.ts +0 -580
  39. package/src/types/backend.ts +0 -987
  40. package/src/types/backup.ts +0 -26
  41. package/src/types/channel_bus.ts +0 -202
  42. package/src/types/chips.ts +0 -34
  43. package/src/types/collection_contract.ts +0 -278
  44. package/src/types/collections.ts +0 -763
  45. package/src/types/component_ref.ts +0 -92
  46. package/src/types/cron.ts +0 -213
  47. package/src/types/data_source.ts +0 -357
  48. package/src/types/database_adapter.ts +0 -267
  49. package/src/types/entities.ts +0 -226
  50. package/src/types/entity_callbacks.ts +0 -229
  51. package/src/types/filter-operators.ts +0 -444
  52. package/src/types/history.ts +0 -66
  53. package/src/types/index.ts +0 -36
  54. package/src/types/indexes.ts +0 -180
  55. package/src/types/policy.ts +0 -328
  56. package/src/types/postgres_introspection.ts +0 -101
  57. package/src/types/project_manifest.ts +0 -598
  58. package/src/types/properties.ts +0 -1368
  59. package/src/types/relations.ts +0 -417
  60. package/src/types/resource_kinds.ts +0 -390
  61. package/src/types/resources.ts +0 -368
  62. package/src/types/rls-functions.ts +0 -98
  63. package/src/types/schema_editing.ts +0 -157
  64. package/src/types/schema_version.ts +0 -112
  65. package/src/types/search.ts +0 -247
  66. package/src/types/security_rules.ts +0 -344
  67. package/src/types/storage_authorize.ts +0 -77
  68. package/src/types/storage_source.ts +0 -248
  69. package/src/types/websockets.ts +0 -117
  70. package/src/users/index.ts +0 -2
  71. package/src/users/user.ts +0 -69
@@ -1,494 +0,0 @@
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";
9
-
10
-
11
- /**
12
- * Event type for authentication state changes
13
- */
14
- export type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "USER_UPDATED";
15
-
16
- /**
17
- * Standard session interface representing an authenticated state.
18
- *
19
- * There is exactly one canonical definition of this type (here in
20
- * `@rebasepro/types`). The `@rebasepro/client` package re-exports it.
21
- */
22
- export interface RebaseSession {
23
- accessToken: string;
24
- refreshToken: string;
25
- expiresAt: number;
26
- user: User;
27
- }
28
-
29
- /**
30
- * Access and refresh token pair returned by authentication endpoints.
31
- *
32
- * Replaces the former `RebaseTokens` (client) and `AuthTokens` (auth) types,
33
- * which had identical shapes.
34
- *
35
- * @group Auth
36
- */
37
- export interface AuthTokens {
38
- accessToken: string;
39
- refreshToken: string;
40
- /** Unix timestamp (ms) when the access token expires. */
41
- accessTokenExpiresAt: number;
42
- }
43
-
44
- /**
45
- * A device-level session entry as returned by `GET /auth/sessions`.
46
- *
47
- * Represents one refresh-token / device pair. Not to be confused with
48
- * {@link RebaseSession}, which is the client-side representation of the
49
- * *current* authenticated state (user + tokens).
50
- *
51
- * @group Auth
52
- */
53
- export interface DeviceSession {
54
- id: string;
55
- userAgent?: string;
56
- ipAddress?: string;
57
- createdAt: string;
58
- isCurrentSession?: boolean;
59
- }
60
-
61
- /**
62
- * Unified Authentication Client Interface
63
- * Pure functional SDK interface, decoupled from UI and React hooks
64
- */
65
- export interface AuthClient {
66
- /**
67
- * Get the current user from the server or cache
68
- */
69
- getUser(): Promise<User | null>;
70
-
71
- /**
72
- * Get the currently active session
73
- */
74
- getSession(): RebaseSession | null;
75
-
76
- /**
77
- * Get the current user's active sessions
78
- */
79
- getSessions?: () => Promise<DeviceSession[]>;
80
- revokeSession?: (sessionId: string) => Promise<void>;
81
- revokeAllSessions?: () => Promise<void>;
82
-
83
- /**
84
- * Sign out the current user and clear local session
85
- */
86
- signOut(): Promise<void>;
87
-
88
- /**
89
- * Subscribe to authentication state changes
90
- */
91
- onAuthStateChange(callback: (event: AuthChangeEvent, session: RebaseSession | null) => void): () => void;
92
-
93
- /**
94
- * Manually refresh the session token
95
- */
96
- refreshSession(): Promise<RebaseSession>;
97
-
98
- /**
99
- * Whether a session could exist that this client has not loaded yet.
100
- *
101
- * `false` means the only way this client can hold a session is an explicit
102
- * sign-in during this page's lifetime: it neither persists sessions nor
103
- * carries an httpOnly auth cookie, so there is nothing on disk or in the
104
- * browser to restore from. A caller that would otherwise probe the server
105
- * — `getUser()` on mount, say — can skip it, because the answer is already
106
- * known and the request can only ever fail.
107
- *
108
- * Optional so that alternative {@link AuthClient} implementations need not
109
- * supply it; treat a missing implementation as "unknown, go ahead and ask".
110
- */
111
- canRestoreSession?: () => boolean;
112
- }
113
-
114
- // ─── Admin API ───────────────────────────────────────────────────────────────
115
-
116
- /**
117
- * User record as returned by the Admin API (`GET /admin/users`, etc.).
118
- *
119
- * This is a dedicated DTO for admin operations and differs from {@link User}:
120
- * - `roles` is required (always an array), vs optional on `User`
121
- * - Includes audit timestamps (`createdAt`, `updatedAt`) as ISO strings
122
- * - `email` is non-nullable (admin users always have an email)
123
- *
124
- * @see User — the canonical client-facing user type
125
- * @group Admin
126
- */
127
- export interface AdminUser {
128
- uid: string;
129
- email: string;
130
- displayName: string | null;
131
- photoURL: string | null;
132
- /**
133
- * The provider used to authenticate the user (e.g. `"password"`,
134
- * `"google"`). Named to match the canonical {@link User.providerId}.
135
- */
136
- providerId: string;
137
- roles: string[];
138
- metadata?: Record<string, any>;
139
- createdAt: string;
140
- updatedAt: string;
141
- }
142
-
143
- /**
144
- * Client-side Admin API interface.
145
- * Provides user management operations.
146
- * @group Admin
147
- */
148
- export interface AdminAPI {
149
- listUsers(): Promise<{ users: AdminUser[] }>;
150
- listUsersPaginated(options?: {
151
- search?: string;
152
- limit?: number;
153
- offset?: number;
154
- orderBy?: string;
155
- orderDir?: "asc" | "desc";
156
- }): Promise<{ users: AdminUser[]; total: number; limit: number; offset: number }>;
157
- getUser(uid: string): Promise<{ user: AdminUser }>;
158
- createUser(data: { email: string; displayName?: string; password?: string; roles?: string[]; metadata?: Record<string, any> }): Promise<{ user: AdminUser }>;
159
- updateUser(uid: string, data: { email?: string; displayName?: string; password?: string; roles?: string[]; metadata?: Record<string, any> }): Promise<{ user: AdminUser }>;
160
- deleteUser(uid: string): Promise<{ success: boolean }>;
161
- resetPassword(uid: string, options?: { password?: string }): Promise<{ user: AdminUser; temporaryPassword?: string; invitationSent?: boolean; emailDeliveryFailed?: boolean }>;
162
- listRoles(): Promise<{ roles: Array<{ id: string; name: string }> }>;
163
- bootstrap(): Promise<{ success: boolean; message: string; user: { uid: string; roles: string[] } }>;
164
- }
165
-
166
- // ─── Cron API ────────────────────────────────────────────────────────────────
167
-
168
- /**
169
- * Client-side Cron job management interface.
170
- * @group Cron
171
- */
172
- export interface CronAPI {
173
- listJobs(): Promise<{ jobs: CronJobStatus[] }>;
174
- getJob(jobId: string): Promise<{ job: CronJobStatus }>;
175
- triggerJob(jobId: string): Promise<{ log: CronJobLogEntry; job: CronJobStatus }>;
176
- getJobLogs(jobId: string, options?: { limit?: number }): Promise<{ logs: CronJobLogEntry[] }>;
177
- toggleJob(jobId: string, enabled: boolean): Promise<{ job: CronJobStatus }>;
178
- }
179
-
180
- // ─── Backups API ─────────────────────────────────────────────────────────────
181
-
182
- /**
183
- * Client-side database-backup management interface.
184
- * @group Backups
185
- */
186
- export interface BackupsAPI {
187
- /** List available backups at the configured destination, newest first. */
188
- list(): Promise<{ backups: BackupInfo[]; destinationKind: BackupDestinationKind; configured: boolean }>;
189
- /** Fetch a backup's bytes for download (authenticated). */
190
- download(key: string): Promise<Blob>;
191
- }
192
-
193
- // ─── Functions API ───────────────────────────────────────────────────────────
194
-
195
- /**
196
- * Options for invoking a custom backend function.
197
- * @group Functions
198
- */
199
- export interface FunctionInvokeOptions {
200
- /** HTTP method — defaults to `"POST"`. */
201
- method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
202
- /** Sub-path appended after the function name. */
203
- path?: string;
204
- /** Extra headers merged into the request. */
205
- headers?: Record<string, string>;
206
- }
207
-
208
- /**
209
- * Client interface for invoking custom backend functions.
210
- * @group Functions
211
- */
212
- export interface FunctionsAPI {
213
- /**
214
- * Invoke a custom backend function by name.
215
- *
216
- * @typeParam T - Expected shape of the response payload.
217
- * @param name - Function name (filename without extension, e.g. `"extract-job"`).
218
- * @param payload - Optional JSON-serialisable body sent as POST.
219
- * @param options - Optional overrides (method, sub-path, headers).
220
- */
221
- invoke<T = unknown>(name: string, payload?: unknown, options?: FunctionInvokeOptions): Promise<T>;
222
- }
223
-
224
- // ─── HistoryConfig ───────────────────────────────────────────────────────────
225
-
226
- /**
227
- * Configuration for entity history / audit-log tracking.
228
- *
229
- * - `true` — enable history with default settings
230
- * - `{ retention?: number }` — enable with optional retention period in days
231
- */
232
- export type HistoryConfig = boolean | { retention?: number };
233
-
234
- // ─── RebaseWebSocket ─────────────────────────────────────────────────────────
235
-
236
- /**
237
- * Minimal WebSocket client contract exposed on {@link RebaseClient}.
238
- *
239
- * The full implementation (`RebaseWebSocketClient` in `@rebasepro/client`)
240
- * adds subscription helpers, CRUD-over-WS, SQL execution, etc.
241
- */
242
- export interface RebaseWebSocket {
243
- /** Disconnect the WebSocket and stop reconnecting. */
244
- disconnect(): void;
245
- /** Send an authentication token to the server. */
246
- authenticate(token: string): Promise<void>;
247
- /** Set a function that lazily resolves the auth token for auto-authentication. */
248
- setAuthTokenGetter(getter: () => Promise<string | null>): void;
249
- /** Listen for connection lifecycle events. */
250
- on(event: "connect" | "disconnect" | "reconnect" | "error", cb: (...args: unknown[]) => void): () => void;
251
- }
252
-
253
- // ─── RebaseClient ────────────────────────────────────────────────────────────
254
-
255
- /**
256
- * The single, canonical Rebase client interface.
257
- *
258
- * Used everywhere: the server-side `rebase` singleton, the SDK's
259
- * `createRebaseClient()`, React context, cron job context, etc.
260
- *
261
- * Core fields (`data`, `auth`) are always present. Everything else
262
- * is optional — which capabilities are populated depends on the
263
- * runtime environment and adapter.
264
- */
265
- export interface RebaseClient<DB = unknown> {
266
- /** Unified Data access layer */
267
- data: RebaseSdkData<DB>;
268
-
269
- /**
270
- * Admin-scoped data accessor — **not** an RLS bypass.
271
- *
272
- * Present on the **server** singleton only (see {@link RebaseServerClient}).
273
- * It runs as the service identity `{ uid: "service", roles: ["admin"] }`,
274
- * and the driver is scoped with `withAuth()` at boot, so every read and
275
- * write runs in a transaction that has switched to the restricted
276
- * `rebase_user` role with `app.uid = 'service'`: policies are evaluated,
277
- * against that identity. This is the correct tool for trusted background
278
- * work (cron jobs, migrations, service-to-service tasks).
279
- *
280
- * Two consequences the name does not suggest:
281
- *
282
- * - `policy.serverContext()` compiles to `rebase.uid() IS NULL` and is
283
- * therefore **false** here. A collection with `disableDefaultPolicies:
284
- * true` whose only rule is `serverContext()` refuses these writes
285
- * (`42501`) and returns zero rows — HTTP 200, empty — for these reads.
286
- * - Its reach equals an `admin`-roled application user's reach. It is not a
287
- * private channel. The true bypass is {@link sql}, which runs on the
288
- * owner connection and never goes through `withAuth`.
289
- *
290
- * ⚠️ **Do NOT use it to serve user-facing data.** Inside a request handler,
291
- * user-scoped queries must go through the request-scoped driver
292
- * (`c.var.driver`), which carries the caller's identity. Reaching for
293
- * `dataAsAdmin` (or its alias {@link data}) in a request handler serves
294
- * every caller whatever an admin may see.
295
- *
296
- * Undefined in the browser SDK.
297
- */
298
- dataAsAdmin?: RebaseSdkData<DB>;
299
-
300
- /** Unified Authentication layer */
301
- auth: AuthClient;
302
-
303
- /** Unified Storage layer — the default storage source. */
304
- storage?: StorageSource;
305
-
306
- /** Registry of all named storage sources for multi-backend support */
307
- storageRegistry?: StorageSourceRegistry;
308
-
309
- /**
310
- * Build a server-backed {@link StorageSource} for a named storage source.
311
- * The returned source forwards `storageId` to the backend so requests are
312
- * routed to the matching `StorageController`. Used to lazily wire
313
- * `transport: "server"` sources on the frontend.
314
- */
315
- createStorageSource?(storageId: string): StorageSource;
316
-
317
- /**
318
- * Discover the storage sources declared on the backend via
319
- * `GET /api/storage/sources`. Server-transport sources are auto-registered
320
- * into {@link storageRegistry}; `direct` sources are returned so the app
321
- * can supply the live {@link StorageSource} instance. The result is cached
322
- * (a failed call is retryable). This makes the backend the single source of
323
- * truth for storage-source configuration.
324
- */
325
- fetchStorageSources?(): Promise<StorageSourceDefinition[]>;
326
-
327
- /**
328
- * Server-side email service.
329
- * Available when SMTP or a custom `sendEmail` function is configured.
330
- */
331
- email?: EmailService;
332
-
333
- /** Admin API for user management */
334
- admin?: AdminAPI;
335
-
336
- /** Cron job management API */
337
- cron?: CronAPI;
338
-
339
- /** Database backup management API */
340
- backups?: BackupsAPI;
341
-
342
- /** Custom backend functions API */
343
- functions?: FunctionsAPI;
344
-
345
- /** Service API keys management API */
346
- apiKeys?: ApiKeysAPI;
347
-
348
-
349
- /** Base HTTP URL of the backend server */
350
- baseUrl?: string;
351
-
352
- /**
353
- * The path every API route is mounted under, appended to {@link baseUrl}.
354
- *
355
- * `"/api"` unless the backend was configured with a different `basePath`
356
- * and the client told to match. Exposed because code that builds a URL by
357
- * hand — rather than going through the client's own methods — otherwise has
358
- * to guess, and guessing `/api` is wrong for exactly the projects that set
359
- * the option.
360
- */
361
- apiPath?: string;
362
-
363
- /** WebSocket client for realtime subscriptions */
364
- ws?: RebaseWebSocket;
365
-
366
- /** Set the auth token for subsequent requests */
367
- setToken?(token: string | null): void;
368
-
369
- /** Set a function that lazily resolves the auth token */
370
- setAuthTokenGetter?(getter: () => Promise<string | null>): void;
371
-
372
- /** Set handler called when a request returns 401 */
373
- setOnUnauthorized?(handler: () => Promise<boolean>): void;
374
-
375
- /** Resolve the current auth token */
376
- resolveToken?(): Promise<string | null>;
377
-
378
- /**
379
- * POST to an arbitrary path on the backend — the escape hatch, not the way
380
- * to call a function.
381
- *
382
- * For a custom function use {@link functions}`.invoke(name, payload)`: it
383
- * targets `/functions/<name>`, takes a method and sub-path, and returns the
384
- * response body as sent. This posts wherever you point it and **unwraps**:
385
- * it returns `res.data` when the response has a `data` property and the
386
- * whole envelope otherwise — so an endpoint that legitimately answers
387
- * `{ data: null }` hands back the envelope rather than `null`. Two ways to
388
- * reach a function with two different response contracts is a trap; this is
389
- * the one that exists for paths `invoke` cannot express.
390
- *
391
- * @internal Prefer `functions.invoke()`. Kept public because a backend can
392
- * mount routes outside `/functions`, and nothing else reaches those.
393
- */
394
- call?<T = unknown>(endpoint: string, payload?: unknown): Promise<T>;
395
-
396
- /**
397
- * Execute raw SQL against the database.
398
- * Only available server-side with a SQL database.
399
- */
400
- sql?(query: string, options?: { database?: string; role?: string }): Promise<Record<string, unknown>[]>;
401
- }
402
-
403
- // ─── RebaseServerClient ──────────────────────────────────────────────────────
404
-
405
- /**
406
- * The server-side Rebase surface — the shape of the `rebase` singleton exported
407
- * from `@rebasepro/server`.
408
- *
409
- * Narrows {@link RebaseClient} to the guarantees that always hold on the server:
410
- * the admin-scoped {@link dataAsAdmin} accessor, raw {@link sql}, and the
411
- * {@link email} service are all present (non-optional).
412
- *
413
- * **Trust levels.** {@link dataAsAdmin} is the admin-scoped driver — scoped as
414
- * `{ uid: "service", roles: ["admin"] }`, so policies are still evaluated
415
- * against that identity rather than skipped — and it is the only name for it
416
- * here: the `data` alias that used to sit beside it is deliberately `Omit`ted
417
- * from {@link RebaseClient} so the privilege has to be spelled out at every
418
- * call site. {@link sql} is the unconditional bypass: raw SQL on the owner
419
- * connection, no policies. For user-scoped queries inside a request handler use
420
- * the request-scoped driver (`c.var.driver`) instead — never `dataAsAdmin`.
421
- */
422
- export interface RebaseServerClient<DB = unknown> extends Omit<RebaseClient<DB>, "data"> {
423
- /**
424
- * Admin-scoped data accessor (RLS is evaluated as the service identity, not
425
- * skipped). Always present server-side. See {@link RebaseClient.dataAsAdmin}
426
- * for the full safety contract.
427
- */
428
- dataAsAdmin: RebaseSdkData<DB>;
429
-
430
- /**
431
- * Server-side email service. Always present server-side (a no-op sender is
432
- * wired when SMTP is not configured).
433
- */
434
- email: EmailService;
435
-
436
- /**
437
- * Execute raw SQL against the database. Always present server-side for SQL
438
- * engines. Values interpolated into the query should be passed via
439
- * `params`, referenced as `$1`, `$2`, … placeholders in the query text.
440
- *
441
- * **Runtime note.** This is the one accessor on this object that is not
442
- * portable. It runs on the database owner connection over a TCP socket, so
443
- * it is available wherever the framework holds that connection — every Node
444
- * deployment, self-hosted or managed — and not on a host that has no
445
- * sockets and no business holding owner credentials.
446
- *
447
- * Nothing about that is a problem for a Node deployment, and it is not a
448
- * reason to avoid it there. It is a reason not to build a function's *only*
449
- * data path on it if that function may later move: `c.get("driver")` and
450
- * `rebase.dataAsAdmin` go over the same wire wherever they run. A function
451
- * that genuinely needs raw SQL can ask `runtimeKey()` and degrade, rather
452
- * than discovering it at the call.
453
- */
454
- sql(query: string, options?: { database?: string; role?: string; params?: unknown[] }): Promise<Record<string, unknown>[]>;
455
- }
456
-
457
- /**
458
- * Client-side registry for managing multiple storage sources.
459
- *
460
- * Mirrors the server-side `StorageRegistry` pattern. Allows collection
461
- * properties to reference a named storage backend via
462
- * `StorageConfig.storageSource`.
463
- *
464
- * @group Models
465
- */
466
- export interface StorageSourceRegistry {
467
- /**
468
- * Get a storage source by key.
469
- * @param key - Storage source key, or undefined/null for default
470
- * @returns The StorageSource, or undefined if not found
471
- */
472
- get(key: string | undefined | null): StorageSource | undefined;
473
-
474
- /**
475
- * Get the default storage source (key = "(default)").
476
- * @throws Error if no default storage is registered
477
- */
478
- getDefault(): StorageSource;
479
-
480
- /**
481
- * Get a storage source by key, with fallback to default.
482
- * @param key - Storage source key, or undefined/null for default
483
- * @returns The StorageSource (falls back to default if key not found)
484
- * @throws Error if neither the specified nor default storage exists
485
- */
486
- getOrDefault(key: string | undefined | null): StorageSource;
487
-
488
- /** Check if a storage source with the given key exists */
489
- has(key: string): boolean;
490
-
491
- /** List all registered storage source keys */
492
- list(): string[];
493
- }
494
-
@@ -1,62 +0,0 @@
1
- import type { CollectionConfig } from "../types/collections";
2
- import type { EntityReference } from "../types/entities";
3
-
4
- /**
5
- * Controller that provides access to the registered entity collections.
6
- * @group Models
7
- */
8
- export type CollectionRegistryController<
9
- DB = Record<string, unknown>,
10
- EC extends CollectionConfig = CollectionConfig
11
- > = {
12
-
13
- /**
14
- * List of the mapped collections in the admin.
15
- * Each entry relates to a collection in the root database.
16
- * Each of the navigation entries in this field
17
- * generates an entry in the main menu.
18
- *
19
- * `EC`, like {@link getCollection} — this was hardcoded to `CollectionConfig`
20
- * while `getCollection` honoured the parameter, so the admin panel got its
21
- * view model from one and the raw contract from the other.
22
- */
23
- collections?: EC[];
24
-
25
- /**
26
- * Is the registry ready to be used
27
- */
28
- initialised: boolean;
29
-
30
- /**
31
- * Get the collection configuration for a given path.
32
- * The collection is resolved from the given path or alias.
33
- */
34
- getCollection: <K extends keyof DB>(slugOrPath: Extract<K, string>, includeUserOverride?: boolean) => EC | undefined;
35
-
36
- /**
37
- * Get the raw, un-normalized collection configuration.
38
- * This bypasses the `CollectionRegistry` normalization (such as injecting `relation` instances).
39
- * This is strictly for the Visual Editor to manipulate AST code without persisting runtime state.
40
- */
41
- getRawCollection: (slugOrPath: string) => EC | undefined;
42
-
43
- /**
44
- * Retrieve all the related parent references for a given path
45
- * @param path
46
- */
47
- getParentReferencesFromPath: (path: string) => EntityReference[];
48
-
49
- /**
50
- * Retrieve all the related parent collection ids for a given path
51
- * @param path
52
- */
53
- getParentCollectionSlugs: (path: string) => string[];
54
- getParentEntityIds: (path: string) => string[];
55
-
56
- /**
57
- * Resolve paths from a list of ids
58
- * @param ids
59
- */
60
- convertIdsToPaths: (ids: string[]) => string[];
61
-
62
- };