@rebasepro/types 0.11.1-canary.gfadf355 → 0.12.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.
@@ -49,6 +49,6 @@ export type AdminCollectionKey = typeof ADMIN_COLLECTION_KEYS[number];
49
49
  *
50
50
  * @group Models
51
51
  */
52
- export declare const ADMIN_PROPERTY_KEYS: readonly ["clearable", "columnWidth", "customProps", "disabled", "expanded", "Field", "Filter", "filterOperators", "hideFromCollection", "markdown", "minimalistView", "multiline", "Preview", "previewAsTag", "previewProperties", "readOnly", "spreadChildren", "urlPreview", "widget", "widthPercentage"];
52
+ export declare const ADMIN_PROPERTY_KEYS: readonly ["canAddElements", "clearable", "columnWidth", "customProps", "disabled", "expanded", "Field", "Filter", "filterOperators", "fixedFilter", "hideFromCollection", "includeEntityLink", "includeId", "markdown", "minimalistView", "multiline", "Preview", "previewAsTag", "previewProperties", "readOnly", "sortable", "spreadChildren", "urlPreview", "widget", "widthPercentage"];
53
53
  /** A key of a property's `admin` block. @group Models */
54
54
  export type AdminPropertyKey = typeof ADMIN_PROPERTY_KEYS[number];
@@ -1,15 +1,54 @@
1
- /** A single permission entry scoping an API key to a collection and its allowed operations. */
1
+ /**
2
+ * Service API keys — machine-to-machine authentication for scripts, cron jobs
3
+ * and third-party integrations.
4
+ *
5
+ * The wire contract lives here because all three sides need it and used to
6
+ * declare it separately: `@rebasepro/server` implements the routes,
7
+ * `@rebasepro/client` calls them, and {@link ApiKeysAPI} types the SDK surface.
8
+ * The client's copy had already drifted — it never gained `admin`.
9
+ *
10
+ * The database row itself (`ApiKey`, which carries `key_hash`) stays in the
11
+ * server package: nothing off the server may see it.
12
+ */
13
+ /**
14
+ * A single permission entry scoping an API key to a collection and set of
15
+ * operations.
16
+ *
17
+ * Use `"*"` as the collection value to grant access to all collections (and all
18
+ * custom functions). Custom functions are addressed with the `functions`
19
+ * namespace: `"functions"` grants every function, `"functions/<name>"` grants a
20
+ * single one.
21
+ *
22
+ * @group Models
23
+ */
2
24
  export interface ApiKeyPermission {
25
+ /** Collection slug, `"functions"`/`"functions/<name>"`, or `"*"` for everything. */
3
26
  collection: string;
27
+ /** Allowed operations on the collection. */
4
28
  operations: ("read" | "write" | "delete")[];
5
29
  }
6
- /** An API key with the secret portion masked (returned by list / get / update). */
30
+ /**
31
+ * An API key with the secret portion masked — what list / get / update return.
32
+ * @group Models
33
+ */
7
34
  export interface ApiKeyMasked {
8
35
  id: string;
9
36
  name: string;
37
+ /** First 12 characters of the plaintext key, for display only. */
10
38
  key_prefix: string;
11
39
  permissions: ApiKeyPermission[];
40
+ /**
41
+ * When true, the key is granted the `admin` role: it passes the admin-gated
42
+ * routes (users, roles, cron, backups, logs, API keys) and the RLS
43
+ * `default_admin` policies. Non-admin keys carry only the `service` role —
44
+ * RLS grants them nothing unless a collection policy names that role.
45
+ */
12
46
  admin: boolean;
47
+ /**
48
+ * Requests per 15-minute window. `null` means "no per-key override" — the
49
+ * data rate limiter then applies its default API-key limit (1000/window
50
+ * unless configured otherwise), not unlimited.
51
+ */
13
52
  rate_limit: number | null;
14
53
  created_by: string;
15
54
  created_at: string;
@@ -18,26 +57,42 @@ export interface ApiKeyMasked {
18
57
  expires_at: string | null;
19
58
  revoked_at: string | null;
20
59
  }
21
- /** An API key including the full secret (returned only on creation). */
60
+ /**
61
+ * Returned exactly once, when a key is created. The `key` field holds the full
62
+ * plaintext key — it is never stored or returned again.
63
+ * @group Models
64
+ */
22
65
  export interface ApiKeyWithSecret extends ApiKeyMasked {
66
+ /** Full plaintext API key (e.g. `rk_live_abc123...`). */
23
67
  key: string;
24
68
  }
25
- /** Payload for creating a new API key. */
69
+ /**
70
+ * Payload for creating a new API key.
71
+ * @group Models
72
+ */
26
73
  export interface CreateApiKeyRequest {
27
74
  name: string;
28
75
  permissions: ApiKeyPermission[];
76
+ /** When true, grants the `admin` role. See {@link ApiKeyMasked.admin}. */
29
77
  admin?: boolean;
78
+ /** Requests per 15-minute window. Omit or `null` for the server default. */
30
79
  rate_limit?: number | null;
80
+ /** ISO-8601 expiration timestamp. Omit for no expiration. */
31
81
  expires_at?: string | null;
32
82
  }
33
- /** Payload for updating an existing API key. */
83
+ /**
84
+ * Payload for updating an existing API key. Only the fields provided change.
85
+ * @group Models
86
+ */
34
87
  export interface UpdateApiKeyRequest {
35
88
  name?: string;
36
89
  permissions?: ApiKeyPermission[];
90
+ /** When true, grants the `admin` role. See {@link ApiKeyMasked.admin}. */
37
91
  admin?: boolean;
38
92
  rate_limit?: number | null;
39
93
  expires_at?: string | null;
40
94
  }
95
+ /** @group Models */
41
96
  export interface ApiKeysAPI {
42
97
  listKeys(): Promise<{
43
98
  keys: ApiKeyMasked[];
@@ -90,23 +90,26 @@ export interface BaseCollectionConfig<M extends Record<string, unknown> = Record
90
90
  */
91
91
  auth?: boolean | AuthCollectionConfig;
92
92
  /**
93
- * Opt out of the framework's default Row Level Security policies.
94
- *
95
- * The schema generator automatically injects, for every collection, a
96
- * baseline SELECT policy granting the trusted server context and the
97
- * `admin` role read access (reads run under a restricted role, so RLS
98
- * default-denies without it). For auth collections it additionally injects
99
- * a self-read policy (`id = auth.uid()`) and an admin-only write gate
100
- * (INSERT/UPDATE/DELETE require the `admin` role or the trusted server
101
- * context), making privileged columns such as `roles` safe by default.
93
+ * Row-level authorization rules for this collection.
102
94
  *
103
- * Author-defined `securityRules` are permissive and broaden access on top
104
- * of these defaults. Set this flag to `true` to remove the defaults
105
- * entirely and take full responsibility for the collection's RLS.
95
+ * Driver-agnostic on purpose, unlike `disableDefaultPolicies`, `table` and
96
+ * `relations`, which are declared on {@link PostgresCollectionConfig} only.
97
+ * The rules are a *contract* — who may read or write which rows — and each
98
+ * engine enforces it its own way:
106
99
  *
107
- * @default false
100
+ * - **Postgres** compiles them to real `CREATE POLICY` statements and lets
101
+ * the database enforce them (see {@link PostgresCollectionConfig.securityRules},
102
+ * which narrows this with the raw-SQL details).
103
+ * - **MongoDB** translates them into a query filter it AND-s into every
104
+ * read and write, honouring `access`, `ownerField`, `roles`, `mode` and
105
+ * the `operation`/`operations` selectors, and making a best effort at raw
106
+ * `using`/`withCheck` SQL.
107
+ * - **Firestore** does not implement them at all; its own rules language is
108
+ * evaluated by Google, not from here. `supportsRLS` on
109
+ * {@link DataSourceCapabilities} reports which engines generate policies,
110
+ * which is not the same question as whether an engine honours a rule.
108
111
  */
109
- disableDefaultPolicies?: boolean;
112
+ securityRules?: readonly SecurityRule[];
110
113
  /**
111
114
  * This interface defines all the callbacks that can be used when a entity
112
115
  * is being created, updated or deleted.
@@ -140,23 +143,6 @@ export interface BaseCollectionConfig<M extends Record<string, unknown> = Record
140
143
  * quietly worked. The second case is the reason for the escape hatch.
141
144
  */
142
145
  strictWrites?: boolean;
143
- /**
144
- * The database table name for this collection.
145
- * Automatically set for PostgreSQL collections.
146
- * For non-SQL backends, this may be undefined.
147
- */
148
- table?: string;
149
- /**
150
- * Relations defined for this collection.
151
- * Populated at normalization time from inline relation properties
152
- * or explicit relation definitions.
153
- */
154
- relations?: Relation[];
155
- /**
156
- * Security rules for this collection (Row Level Security).
157
- * When defined, the backend enforces access control policies.
158
- */
159
- securityRules?: readonly SecurityRule[];
160
146
  }
161
147
  /**
162
148
  * A collection backed by PostgreSQL (or any SQL database).
@@ -205,6 +191,24 @@ export interface PostgresCollectionConfig<M extends Record<string, unknown> = Re
205
191
  * - `auth.jwt()` — full JWT claims as JSONB
206
192
  */
207
193
  securityRules?: readonly SecurityRule[];
194
+ /**
195
+ * Opt out of the framework's default Row Level Security policies.
196
+ *
197
+ * The schema generator automatically injects, for every collection, a
198
+ * baseline SELECT policy granting the trusted server context and the
199
+ * `admin` role read access (reads run under a restricted role, so RLS
200
+ * default-denies without it). For auth collections it additionally injects
201
+ * a self-read policy (`id = auth.uid()`) and an admin-only write gate
202
+ * (INSERT/UPDATE/DELETE require the `admin` role or the trusted server
203
+ * context), making privileged columns such as `roles` safe by default.
204
+ *
205
+ * Author-defined `securityRules` are permissive and broaden access on top
206
+ * of these defaults. Set this flag to `true` to remove the defaults
207
+ * entirely and take full responsibility for the collection's RLS.
208
+ *
209
+ * @default false
210
+ */
211
+ disableDefaultPolicies?: boolean;
208
212
  }
209
213
  /**
210
214
  * A collection backed by Firebase / Firestore.
@@ -329,6 +333,27 @@ export type AnyCollectionConfig = CollectionConfig<any, any>;
329
333
  * @group Models
330
334
  */
331
335
  export declare function isPostgresCollectionConfig<C extends CollectionConfig<any, any>>(collection: C): collection is C & PostgresCollectionConfig<any, any>;
336
+ /**
337
+ * Narrows to the SQL collection fields — `table`, `relations`,
338
+ * `disableDefaultPolicies` — by asking the engine's declared capabilities
339
+ * rather than by naming Postgres.
340
+ *
341
+ * The two halves of this already existed and were never joined. The engine
342
+ * split (`PostgresCollectionConfig` / `FirebaseCollectionConfig` /
343
+ * `MongoDBCollectionConfig`) said which fields belong to which engine at the
344
+ * type level; {@link DataSourceCapabilities} said the same thing at runtime,
345
+ * down to a `supportsRelations` flag. So call sites guarded on the capability
346
+ * and then read a field the base type had to declare for them — which is why
347
+ * those fields were on the base, and why a MongoDB collection could be written
348
+ * with a `table`.
349
+ *
350
+ * Prefer this over {@link isPostgresCollectionConfig} wherever the question is
351
+ * "does this collection live in a SQL table", so a custom SQL engine
352
+ * registered through `registerDataSourceCapabilities` is included.
353
+ *
354
+ * @group Models
355
+ */
356
+ export declare function isRelationalCollectionConfig<C extends CollectionConfig<any, any>>(collection: C): collection is C & PostgresCollectionConfig<any, any>;
332
357
  /**
333
358
  * Type guard for Firebase / Firestore collections.
334
359
  * @group Models
@@ -27,6 +27,16 @@ export interface DataSourceCapabilities {
27
27
  supportsColumnTypes: boolean;
28
28
  /** Does this source support real-time listeners? */
29
29
  supportsRealtime: boolean;
30
+ /**
31
+ * Does this source store vectors natively?
32
+ *
33
+ * `VectorProperty` carries a `dimensions` and is pgvector-shaped. It was
34
+ * the one driver-specific property kind with no flag to gate it, so unlike
35
+ * every other field in this descriptor there was not even a runtime answer
36
+ * to appeal to — a Firestore collection could declare an embedding column
37
+ * and no driver would do anything with it.
38
+ */
39
+ supportsVectors: boolean;
30
40
  /**
31
41
  * Canonical filter operators this engine can execute.
32
42
  *
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Entity change history — the shape a history entry has on the wire.
3
+ *
4
+ * This was declared three times: once in `@rebasepro/server-postgres`, once in
5
+ * `@rebasepro/server-mongo`, and once again in the admin's `useHistory` hook.
6
+ * The two driver copies disagreed on the one field that matters for a consumer,
7
+ * `updated_at`, which was a `string` in Postgres and a `Date` in MongoDB — so
8
+ * nothing could read history without first choosing a driver.
9
+ *
10
+ * The contract is the wire shape, and on the wire it is an ISO-8601 string.
11
+ * A driver whose stored document differs (MongoDB keeps a `Date` and an
12
+ * `ObjectId`) declares that storage row for itself and maps to this on the way
13
+ * out; it is not the shared type.
14
+ *
15
+ * @group Backend
16
+ */
17
+ /**
18
+ * One recorded change to a row.
19
+ * @group Backend
20
+ */
21
+ export interface EntityHistoryEntry {
22
+ id: string;
23
+ /** The table (Postgres) or collection (MongoDB) the row belongs to. */
24
+ table_name: string;
25
+ /** The row's id, as a string regardless of its native type. */
26
+ entity_id: string;
27
+ action: "create" | "update" | "delete";
28
+ /** Which fields changed. `null` for creates and deletes. */
29
+ changed_fields: string[] | null;
30
+ values: Record<string, unknown> | null;
31
+ previous_values: Record<string, unknown> | null;
32
+ updated_by: string | null;
33
+ /** ISO-8601. A driver storing a native date converts on read. */
34
+ updated_at: string;
35
+ }
36
+ /**
37
+ * Arguments to record one change.
38
+ * @group Backend
39
+ */
40
+ export interface RecordHistoryParams {
41
+ tableName: string;
42
+ id: string;
43
+ action: "create" | "update" | "delete";
44
+ values?: Record<string, unknown> | null;
45
+ previousValues?: Record<string, unknown> | null;
46
+ updatedBy?: string | null;
47
+ }
48
+ /**
49
+ * How much history to keep. Pruning runs per row after each write.
50
+ * @group Backend
51
+ */
52
+ export interface HistoryRetentionConfig {
53
+ /** Max entries per row. Oldest pruned first. Default 200. */
54
+ maxEntries: number;
55
+ /** Entries older than this many days are pruned. Default 90. */
56
+ ttlDays: number;
57
+ }
58
+ /** @group Backend */
59
+ export interface FetchHistoryOptions {
60
+ limit?: number;
61
+ offset?: number;
62
+ }
@@ -19,6 +19,8 @@ export * from "./component_ref";
19
19
  export * from "./auth_adapter";
20
20
  export * from "./database_adapter";
21
21
  export * from "./api_keys";
22
+ export * from "./history";
23
+ export * from "./postgres_introspection";
22
24
  export * from "./project_manifest";
23
25
  export * from "./collection_contract";
24
26
  export * from "./schema_version";
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Shapes returned by Postgres introspection queries.
3
+ *
4
+ * These are **not** driver-agnostic and they are not a model of anything — each
5
+ * one is the projection of a specific `SELECT` against `information_schema` or
6
+ * `pg_policies`, which is why the fields are snake_cased and why `is_nullable`
7
+ * is a string rather than a boolean. They describe rows, not concepts.
8
+ *
9
+ * They were spread across three places that had nothing to do with each other:
10
+ * the `Table*` shapes sat in `websockets.ts`, next to the WebSocket frame types
11
+ * they share no relationship with, and `PostgresPolicy` was declared twice — in
12
+ * `@rebasepro/admin`'s RLS tab and again in `@rebasepro/studio`'s RLS editor,
13
+ * the second with a comment explaining it was inline "to avoid depending on
14
+ * @rebasepro/studio". Neither had to: this package is already a dependency of
15
+ * both.
16
+ *
17
+ * Producer: `@rebasepro/server-postgres`. Consumers: the collection editor, the
18
+ * studio schema browser, the RLS editors.
19
+ */
20
+ /**
21
+ * A column, as `information_schema.columns` reports it.
22
+ * @group Models
23
+ */
24
+ export interface TableColumnInfo {
25
+ column_name: string;
26
+ data_type: string;
27
+ udt_name: string;
28
+ /** `"YES"` or `"NO"` — `information_schema` reports this as text. */
29
+ is_nullable: string;
30
+ column_default: string | null;
31
+ character_maximum_length: number | null;
32
+ /** Enum values, populated for USER-DEFINED (enum) columns */
33
+ enum_values?: string[];
34
+ }
35
+ /** @group Models */
36
+ export interface TableForeignKeyInfo {
37
+ column_name: string;
38
+ foreign_table_name: string;
39
+ foreign_column_name: string;
40
+ }
41
+ /** @group Models */
42
+ export interface TableJunctionInfo {
43
+ junction_table_name: string;
44
+ source_column_name: string;
45
+ target_table_name: string;
46
+ target_column_name: string;
47
+ }
48
+ /**
49
+ * A policy as the *table metadata* query projects it.
50
+ *
51
+ * Distinct from {@link PostgresPolicy}, which is the RLS editor's fuller
52
+ * projection of `pg_policies` — this one carries only what the collection
53
+ * editor needs to show that a table is protected.
54
+ *
55
+ * @group Models
56
+ */
57
+ export interface TablePolicyInfo {
58
+ policy_name: string;
59
+ roles: string[];
60
+ cmd: string;
61
+ qual?: string;
62
+ with_check?: string;
63
+ }
64
+ /** @group Models */
65
+ export interface TableMetadata {
66
+ columns: TableColumnInfo[];
67
+ foreignKeys: TableForeignKeyInfo[];
68
+ junctions: TableJunctionInfo[];
69
+ policies: TablePolicyInfo[];
70
+ }
71
+ /**
72
+ * A row of `pg_policies`, as the RLS editors read it.
73
+ *
74
+ * Note the unseparated column names (`policyname`, `tablename`) — those are
75
+ * Postgres's, not ours. See {@link TablePolicyInfo} for the narrower projection
76
+ * the collection editor uses.
77
+ *
78
+ * @group Models
79
+ */
80
+ export interface PostgresPolicy {
81
+ policyname: string;
82
+ tablename: string;
83
+ permissive: "PERMISSIVE" | "RESTRICTIVE";
84
+ roles: string[];
85
+ cmd: "SELECT" | "INSERT" | "UPDATE" | "DELETE" | "ALL";
86
+ /** The `USING` clause. */
87
+ qual: string | null;
88
+ /** The `WITH CHECK` clause. */
89
+ with_check: string | null;
90
+ /**
91
+ * Whether this policy exists in the live database, in the collection's
92
+ * `securityRules`, or both. Computed by the editor, not by Postgres.
93
+ */
94
+ status?: "live" | "code_only" | "both";
95
+ }
@@ -1,6 +1,5 @@
1
1
  import type { Entity, EntityReference, EntityRelation, EntityValues, GeoPoint, Vector } from "./entities";
2
2
  import type { Relation, ResolvedRelation } from "./relations";
3
- import type { FilterValues } from "./collections";
4
3
  import type { ColorKey, ColorScheme } from "./chips";
5
4
  import type { AuthState } from "../controllers/auth_state";
6
5
  import type { AfterReadProps, BeforeSaveProps } from "./entity_callbacks";
@@ -35,15 +34,40 @@ export type Property = StringProperty | NumberProperty | BooleanProperty | DateP
35
34
  export type Properties = {
36
35
  [key: string]: Property;
37
36
  };
37
+ /**
38
+ * `Omit` that survives a union.
39
+ *
40
+ * `Property` is a union discriminated on `type`, and a bare `Omit<Property, K>`
41
+ * collapses it into one object whose `type` is the union of every tag — so
42
+ * `property.type === "string"` stops narrowing and the concrete property types
43
+ * become unreachable. The `T extends unknown` clause makes it distribute, so
44
+ * each member is omitted from separately and keeps its own discriminant.
45
+ */
46
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
47
+ /**
48
+ * The fields that describe a property's **column**, which only an engine with
49
+ * columns has.
50
+ *
51
+ * `columnType` names a Postgres type (`uuid`, `bigserial`, `jsonb`, `text[]`)
52
+ * and `columnName` overrides the snake_case derivation used to build a column
53
+ * name. `DataSourceCapabilities.supportsColumnTypes` already reported this at
54
+ * runtime — `false` for both document engines — while the types let a MongoDB
55
+ * property declare `columnType: "bigserial"`.
56
+ *
57
+ * They stay declared on the concrete property interfaces rather than moving,
58
+ * because that is where their per-type value unions live; what changes is that
59
+ * the document engines' property aliases omit them.
60
+ */
61
+ type SqlColumnFields = "columnType" | "columnName";
38
62
  export type PostgresProperty = Exclude<Property, ReferenceProperty>;
39
63
  export type PostgresProperties = {
40
64
  [key: string]: PostgresProperty;
41
65
  };
42
- export type FirebaseProperty = Exclude<Property, RelationProperty>;
66
+ export type FirebaseProperty = DistributiveOmit<Exclude<Property, RelationProperty | VectorProperty>, SqlColumnFields>;
43
67
  export type FirebaseProperties = {
44
68
  [key: string]: FirebaseProperty;
45
69
  };
46
- export type MongoProperty = Exclude<Property, RelationProperty>;
70
+ export type MongoProperty = DistributiveOmit<Exclude<Property, RelationProperty | VectorProperty>, SqlColumnFields>;
47
71
  export type MongoProperties = {
48
72
  [key: string]: MongoProperty;
49
73
  };
@@ -398,19 +422,6 @@ export interface ReferenceProperty extends BaseProperty {
398
422
  * property.
399
423
  */
400
424
  path?: string;
401
- /**
402
- * Allow selection of entities that pass the given filter only.
403
- * e.g. `fixedFilter: { age: [">=", 18] }`
404
- */
405
- fixedFilter?: FilterValues<string>;
406
- /**
407
- * Should the reference include the ID of the entity. Defaults to `true`
408
- */
409
- includeId?: boolean;
410
- /**
411
- * Should the reference include a link to the entity (open the entity details). Defaults to `true`
412
- */
413
- includeEntityLink?: boolean;
414
425
  }
415
426
  /**
416
427
  * A schema-level relationship between collections **within a single
@@ -469,24 +480,6 @@ export interface RelationProperty extends BaseProperty {
469
480
  * collection's `relations` array.
470
481
  */
471
482
  resolvedRelation?: ResolvedRelation;
472
- /**
473
- * Allow selection of entities that pass the given filter only.
474
- * e.g. `fixedFilter: { age: [">=", 18] }`
475
- */
476
- fixedFilter?: FilterValues<string>;
477
- /**
478
- * Should the reference include the ID of the entity. Defaults to `true`
479
- */
480
- includeId?: boolean;
481
- /**
482
- * Should the reference include a link to the entity (open the entity details). Defaults to `true`
483
- */
484
- includeEntityLink?: boolean;
485
- /**
486
- * Choose the widget to use for selecting the relation.
487
- * Defaults to `select`.
488
- */
489
- widget?: "select" | "dialog";
490
483
  }
491
484
  export interface ArrayProperty extends BaseProperty {
492
485
  type: "array";
@@ -549,16 +542,6 @@ export interface ArrayProperty extends BaseProperty {
549
542
  * Rules for validating this property
550
543
  */
551
544
  validation?: ArrayPropertyValidationSchema;
552
- /**
553
- * Can the elements in this array be reordered. Defaults to `true`.
554
- * This prop has no effect if `disabled` is set to true.
555
- */
556
- sortable?: boolean;
557
- /**
558
- * Can the elements in this array be added. Defaults to `true`
559
- * This prop has no effect if `disabled` is set to true.
560
- */
561
- canAddElements?: boolean;
562
545
  }
563
546
  export interface MapProperty extends BaseProperty {
564
547
  type: "map";
@@ -578,6 +561,12 @@ export interface MapProperty extends BaseProperty {
578
561
  * Order in which the properties are displayed.
579
562
  * If you are specifying your collection as code, the order is the same as the
580
563
  * one you define in `properties`, and you don't need to specify this prop.
564
+ *
565
+ * Stays on the property rather than moving to the `admin` block, unlike the
566
+ * rest of the map's presentation options: `sortProperties` in
567
+ * `@rebasepro/common` reads it recursively, and `@rebasepro/firebase` calls
568
+ * that when it builds collections. A core package cannot read the admin
569
+ * block — the field exists only once `@rebasepro/admin-types` is installed.
581
570
  */
582
571
  propertiesOrder?: string[];
583
572
  /**
@@ -586,13 +575,13 @@ export interface MapProperty extends BaseProperty {
586
575
  * will be considered valid, even if you set `required` in the properties.
587
576
  */
588
577
  validation?: PropertyValidationSchema;
589
- /**
590
- * Properties that are displayed when rendered as a preview
591
- */
592
- previewProperties?: string[];
593
578
  /**
594
579
  * Render this map as a key-value table that allows to use
595
580
  * arbitrary keys. You don't need to define the properties in this case.
581
+ *
582
+ * Core rather than admin despite the wording: it says the map has no
583
+ * declared shape, which is what the OpenAPI generator emits the schema
584
+ * from (`additionalProperties` instead of a property list).
596
585
  */
597
586
  keyValue?: boolean;
598
587
  }
@@ -115,40 +115,3 @@ export interface ChannelHistoryMessage extends WebSocketMessage {
115
115
  */
116
116
  latestSeq?: number;
117
117
  }
118
- /**
119
- * Column metadata returned by table introspection.
120
- */
121
- export interface TableColumnInfo {
122
- column_name: string;
123
- data_type: string;
124
- udt_name: string;
125
- is_nullable: string;
126
- column_default: string | null;
127
- character_maximum_length: number | null;
128
- /** Enum values, populated for USER-DEFINED (enum) columns */
129
- enum_values?: string[];
130
- }
131
- export interface TableForeignKeyInfo {
132
- column_name: string;
133
- foreign_table_name: string;
134
- foreign_column_name: string;
135
- }
136
- export interface TableJunctionInfo {
137
- junction_table_name: string;
138
- source_column_name: string;
139
- target_table_name: string;
140
- target_column_name: string;
141
- }
142
- export interface TablePolicyInfo {
143
- policy_name: string;
144
- roles: string[];
145
- cmd: string;
146
- qual?: string;
147
- with_check?: string;
148
- }
149
- export interface TableMetadata {
150
- columns: TableColumnInfo[];
151
- foreignKeys: TableForeignKeyInfo[];
152
- junctions: TableJunctionInfo[];
153
- policies: TablePolicyInfo[];
154
- }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/types",
3
3
  "type": "module",
4
- "version": "0.11.1-canary.gfadf355",
4
+ "version": "0.12.0",
5
5
  "description": "Rebase type definitions — shared interfaces and controller types",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/rebaseco"
@@ -92,6 +92,7 @@ export type AdminCollectionKey = typeof ADMIN_COLLECTION_KEYS[number];
92
92
  * @group Models
93
93
  */
94
94
  export const ADMIN_PROPERTY_KEYS = [
95
+ "canAddElements",
95
96
  "clearable",
96
97
  "columnWidth",
97
98
  "customProps",
@@ -100,7 +101,10 @@ export const ADMIN_PROPERTY_KEYS = [
100
101
  "Field",
101
102
  "Filter",
102
103
  "filterOperators",
104
+ "fixedFilter",
103
105
  "hideFromCollection",
106
+ "includeEntityLink",
107
+ "includeId",
104
108
  "markdown",
105
109
  "minimalistView",
106
110
  "multiline",
@@ -108,6 +112,7 @@ export const ADMIN_PROPERTY_KEYS = [
108
112
  "previewAsTag",
109
113
  "previewProperties",
110
114
  "readOnly",
115
+ "sortable",
111
116
  "spreadChildren",
112
117
  "urlPreview",
113
118
  "widget",