@rebasepro/types 0.30.1 → 0.31.0-canary.g902a0ce
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.
- package/README.md +16 -18
- package/dist/call_context.d.ts +3 -3
- package/dist/controllers/client.d.ts +29 -0
- package/dist/controllers/data.d.ts +85 -332
- package/dist/controllers/data_driver.d.ts +47 -57
- package/dist/controllers/index.d.ts +0 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +2567 -1151
- package/dist/index.es.js.map +1 -1
- package/dist/schema/column_options.d.ts +336 -0
- package/dist/schema/column_type.d.ts +116 -0
- package/dist/schema/columns.d.ts +646 -0
- package/dist/schema/compiled.d.ts +114 -0
- package/dist/schema/descriptor.d.ts +349 -0
- package/dist/schema/hooks.d.ts +164 -0
- package/dist/schema/index.d.ts +13 -0
- package/dist/schema/infer.d.ts +340 -0
- package/dist/schema/json.d.ts +237 -0
- package/dist/schema/relations.d.ts +205 -0
- package/dist/schema/table.d.ts +304 -0
- package/dist/schema/table_options.d.ts +103 -0
- package/dist/schema/table_patch.d.ts +338 -0
- package/dist/types/auth_adapter.d.ts +5 -5
- package/dist/types/auth_hooks.d.ts +65 -0
- package/dist/types/backend.d.ts +85 -96
- package/dist/types/data_source.d.ts +4 -9
- package/dist/types/database_adapter.d.ts +30 -31
- package/dist/types/entities.d.ts +0 -162
- package/dist/types/filter-operators.d.ts +2 -26
- package/dist/types/history.d.ts +6 -9
- package/dist/types/index.d.ts +3 -9
- package/dist/types/mcp_app_modules.d.ts +0 -2
- package/dist/types/policy.d.ts +85 -10
- package/dist/types/project_manifest.d.ts +113 -46
- package/dist/types/read_query.d.ts +98 -0
- package/dist/types/register.d.ts +35 -5
- package/dist/types/relations.d.ts +0 -430
- package/dist/types/schema_editing.d.ts +54 -2
- package/dist/types/schema_version.d.ts +24 -4
- package/dist/types/security_rules.d.ts +225 -15
- package/dist/types/storage_authorize.d.ts +2 -2
- package/dist/types/tenancy.d.ts +3 -3
- package/dist/types/ui_preferences.d.ts +228 -0
- package/package.json +3 -2
- package/dist/controllers/auth_state.d.ts +0 -23
- package/dist/controllers/collection_registry.d.ts +0 -67
- package/dist/controllers/effective_role.d.ts +0 -4
- package/dist/types/admin_block.d.ts +0 -96
- package/dist/types/chips.d.ts +0 -16
- package/dist/types/collection_contract.d.ts +0 -43
- package/dist/types/collection_patch.d.ts +0 -74
- package/dist/types/collections.d.ts +0 -783
- package/dist/types/component_ref.d.ts +0 -81
- package/dist/types/conditions-contract.types.d.ts +0 -14
- package/dist/types/entity_callbacks.d.ts +0 -393
- package/dist/types/indexes.d.ts +0 -179
- package/dist/types/properties.d.ts +0 -1640
|
@@ -1,1640 +0,0 @@
|
|
|
1
|
-
import type { ResourceRef } from "./resources.js";
|
|
2
|
-
import type { EntityReference, EntityRelation, EntityValues, GeoPoint, Vector } from "./entities.js";
|
|
3
|
-
import type { Relation, ResolvedRelation } from "./relations.js";
|
|
4
|
-
import type { ColorKey, ColorScheme } from "./chips.js";
|
|
5
|
-
import type { AuthState } from "../controllers/auth_state.js";
|
|
6
|
-
import type { AfterReadProps, BeforeSaveProps } from "./entity_callbacks.js";
|
|
7
|
-
import type { User } from "../users/index.js";
|
|
8
|
-
/**
|
|
9
|
-
* A SQL expression, written in template form: ``"sql`gen_random_uuid()`"``.
|
|
10
|
-
* The `sql` and backticks are markup; the text between them is the SQL.
|
|
11
|
-
* @group Entity properties
|
|
12
|
-
*/
|
|
13
|
-
export type SqlExpression = `sql\`${string}\``;
|
|
14
|
-
/**
|
|
15
|
-
* Callbacks/Hooks for individual property fields
|
|
16
|
-
* @group Entity properties
|
|
17
|
-
*/
|
|
18
|
-
export type PropertyCallbacks<T = unknown, M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> = {
|
|
19
|
-
/**
|
|
20
|
-
* Callback used after fetching data, to transform the value before
|
|
21
|
-
* rendering. `row` is the whole row it was read in, as the server sends it.
|
|
22
|
-
*/
|
|
23
|
-
afterRead?(props: AfterReadProps<M, USER> & {
|
|
24
|
-
value: T;
|
|
25
|
-
}): Promise<T> | T;
|
|
26
|
-
/**
|
|
27
|
-
* Callback used before saving, after validation.
|
|
28
|
-
* You can modify the value before it's saved.
|
|
29
|
-
*/
|
|
30
|
-
beforeSave?(props: Omit<BeforeSaveProps<M, USER>, "values"> & {
|
|
31
|
-
value: T;
|
|
32
|
-
previousValue: T | undefined;
|
|
33
|
-
values: Partial<M>;
|
|
34
|
-
}): Promise<T> | T;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* @group Entity properties
|
|
38
|
-
*/
|
|
39
|
-
export type DataType = "string" | "number" | "boolean" | "date" | "geopoint" | "reference" | "relation" | "array" | "map" | "vector" | "binary";
|
|
40
|
-
export type Property = StringProperty | NumberProperty | BooleanProperty | DateProperty | GeopointProperty | ReferenceProperty | RelationProperty | ArrayProperty | MapProperty | VectorProperty | BinaryProperty;
|
|
41
|
-
export type Properties = {
|
|
42
|
-
[key: string]: Property;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* `Omit` that survives a union.
|
|
46
|
-
*
|
|
47
|
-
* `Property` is a union discriminated on `type`, and a bare `Omit<Property, K>`
|
|
48
|
-
* collapses it into one object whose `type` is the union of every tag — so
|
|
49
|
-
* `property.type === "string"` stops narrowing and the concrete property types
|
|
50
|
-
* become unreachable. The `T extends unknown` clause makes it distribute, so
|
|
51
|
-
* each member is omitted from separately and keeps its own discriminant.
|
|
52
|
-
*/
|
|
53
|
-
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
54
|
-
/**
|
|
55
|
-
* The fields that describe a property's **column**, which only an engine with
|
|
56
|
-
* columns has.
|
|
57
|
-
*
|
|
58
|
-
* `columnType` names a Postgres type (`uuid`, `bigserial`, `jsonb`, `text[]`)
|
|
59
|
-
* and `columnName` overrides the snake_case derivation used to build a column
|
|
60
|
-
* name. `DataSourceCapabilities.supportsColumnTypes` already reported this at
|
|
61
|
-
* runtime — `false` for both document engines — while the types let a MongoDB
|
|
62
|
-
* property declare `columnType: "bigserial"`.
|
|
63
|
-
*
|
|
64
|
-
* They stay declared on the concrete property interfaces rather than moving,
|
|
65
|
-
* because that is where their per-type value unions live; what changes is that
|
|
66
|
-
* the document engines' property aliases omit them.
|
|
67
|
-
*/
|
|
68
|
-
type SqlColumnFields = "columnType" | "columnName";
|
|
69
|
-
export type PostgresProperty = Exclude<Property, ReferenceProperty>;
|
|
70
|
-
export type PostgresProperties = {
|
|
71
|
-
[key: string]: PostgresProperty;
|
|
72
|
-
};
|
|
73
|
-
export type FirebaseProperty = DistributiveOmit<Exclude<Property, RelationProperty | VectorProperty>, SqlColumnFields>;
|
|
74
|
-
export type FirebaseProperties = {
|
|
75
|
-
[key: string]: FirebaseProperty;
|
|
76
|
-
};
|
|
77
|
-
export type MongoProperty = DistributiveOmit<Exclude<Property, RelationProperty | VectorProperty>, SqlColumnFields>;
|
|
78
|
-
export type MongoProperties = {
|
|
79
|
-
[key: string]: MongoProperty;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Union of all engine-specific property maps. Use this at engine-agnostic
|
|
83
|
-
* boundaries (collection editor, normalization) where the concrete engine is
|
|
84
|
-
* unknown but the narrowed property constraint must be satisfied.
|
|
85
|
-
*/
|
|
86
|
-
export type EngineProperties = PostgresProperties | FirebaseProperties | MongoProperties;
|
|
87
|
-
/**
|
|
88
|
-
* What a key the surrounding shape does not declare resolves to.
|
|
89
|
-
*
|
|
90
|
-
* Nothing is assignable to it — it has required members nobody can spell — so
|
|
91
|
-
* the key errors. It is a *named* type rather than `never` purely for the
|
|
92
|
-
* message: TypeScript prints the target, so the compiler reads back the key that
|
|
93
|
-
* is wrong and the keys that would have been right, instead of saying "not
|
|
94
|
-
* assignable to type 'never'".
|
|
95
|
-
*
|
|
96
|
-
* ```
|
|
97
|
-
* Type '{ required: true }' is not assignable to type
|
|
98
|
-
* '{ readonly required: true } & NoSuchKey<"validaton", "name" | "type" | "validation" | …>'.
|
|
99
|
-
* Property 'didYouMean' is missing …
|
|
100
|
-
* ```
|
|
101
|
-
*
|
|
102
|
-
* `Known` is the set of keys that *were* available. TypeScript elides a long
|
|
103
|
-
* union after a few members, so this is a hint and not an exhaustive listing —
|
|
104
|
-
* which is the right trade: the near-miss is usually alphabetically adjacent to
|
|
105
|
-
* the key that was meant, and a wall of 25 names would be read by nobody.
|
|
106
|
-
*/
|
|
107
|
-
export type NoSuchKey<K extends PropertyKey, Known extends PropertyKey = never> = {
|
|
108
|
-
/** The key that was written, so the compiler reads it back verbatim. */
|
|
109
|
-
readonly noSuchKey: K;
|
|
110
|
-
/** The keys that were available. Required, so the type is unsatisfiable. */
|
|
111
|
-
readonly didYouMean: Known;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* What a property whose `type` the engine does not have resolves to.
|
|
115
|
-
*
|
|
116
|
-
* Same trick as {@link NoSuchKey}, for a different mistake: a `relation` on a
|
|
117
|
-
* Firestore collection, a `vector` on MongoDB.
|
|
118
|
-
*
|
|
119
|
-
* Without it, `ExactProperty<V, never>` is `V & {}` — which is `V`, and
|
|
120
|
-
* therefore no check at all. The gate is normally caught one level up, by the
|
|
121
|
-
* builder's `P extends FirebaseProperties` constraint; this is what catches it
|
|
122
|
-
* when `StrictProperties` is applied to a property map that carries no such
|
|
123
|
-
* constraint, and it reports on the property rather than on the whole map.
|
|
124
|
-
*/
|
|
125
|
-
export type PropertyTypeNotOnThisEngine<T> = {
|
|
126
|
-
/** The `type` tag that has no home on this engine. Required, so nothing fits. */
|
|
127
|
-
readonly __rebasePropertyTypeNotOnThisEngine: T;
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* A relation checked against the concrete member of the union its own `kind`
|
|
131
|
-
* selects, rather than against the union as a whole.
|
|
132
|
-
*
|
|
133
|
-
* `Relation` is closed — `BelongsToRelation` has `localKey` and no
|
|
134
|
-
* `foreignKeyOnTarget`, `HasManyRelation` the reverse — but excess-property
|
|
135
|
-
* checking against a *union* passes any key that any member declares. So
|
|
136
|
-
* `{ kind: "belongsTo", foreignKeyOnTarget: "author_id" }` typechecked, and
|
|
137
|
-
* described a link that cannot exist: the generator reads `localKey`, defaults
|
|
138
|
-
* it to `<relationName>_id`, and the column the author actually named is never
|
|
139
|
-
* looked at. The relation resolves to a different link than the one written.
|
|
140
|
-
*
|
|
141
|
-
* The runtime already refuses this — `validate-config` rejects a link field that
|
|
142
|
-
* does not belong to the kind — so this is the same rule one stage earlier,
|
|
143
|
-
* where it costs a red squiggle instead of a failed boot.
|
|
144
|
-
*/
|
|
145
|
-
type StrictRelation<R> = R extends {
|
|
146
|
-
kind: infer K;
|
|
147
|
-
} ? R & {
|
|
148
|
-
[Key in Exclude<keyof R, keyof Extract<Relation, {
|
|
149
|
-
kind: K;
|
|
150
|
-
}>>]: NoSuchKey<Key, keyof Extract<Relation, {
|
|
151
|
-
kind: K;
|
|
152
|
-
}>>;
|
|
153
|
-
} : R;
|
|
154
|
-
/**
|
|
155
|
-
* `V`, plus every key it carries that `Shape` does not declare, typed so it
|
|
156
|
-
* cannot be satisfied.
|
|
157
|
-
*
|
|
158
|
-
* The `relation` block is descended into, because it is the one nested shape
|
|
159
|
-
* that is a closed union rather than a single interface — see
|
|
160
|
-
* {@link StrictRelation}. The rest (`array.of`, `map.properties`, the `admin`
|
|
161
|
-
* options) are left to the weak-type check and the boot validator.
|
|
162
|
-
*/
|
|
163
|
-
type ExactProperty<V, Shape> = [Shape] extends [never] ? PropertyTypeNotOnThisEngine<V extends {
|
|
164
|
-
type: infer T;
|
|
165
|
-
} ? T : never> : V & {
|
|
166
|
-
[K in Exclude<keyof V, keyof Shape>]: NoSuchKey<K, keyof Shape>;
|
|
167
|
-
} & (V extends {
|
|
168
|
-
relation: infer R;
|
|
169
|
-
} ? {
|
|
170
|
-
relation: StrictRelation<R>;
|
|
171
|
-
} : unknown);
|
|
172
|
-
/**
|
|
173
|
-
* A property map in which each value is checked against the *concrete* member of
|
|
174
|
-
* the property union that its own `type` tag selects.
|
|
175
|
-
*
|
|
176
|
-
* ### Why this type has to exist
|
|
177
|
-
*
|
|
178
|
-
* `defineCollection` takes `properties: P` where `const P extends Properties`.
|
|
179
|
-
* `Properties` is an index signature, and **every object literal is assignable
|
|
180
|
-
* to an index signature** — extra keys included — so TypeScript's
|
|
181
|
-
* excess-property check never ran inside a property. The consequences were not
|
|
182
|
-
* theoretical:
|
|
183
|
-
*
|
|
184
|
-
* - `validation` misspelled `validaton` compiled, and the field was quietly not
|
|
185
|
-
* required.
|
|
186
|
-
* - `multiline: true` and `markdown: true` written flat — the shape the docs
|
|
187
|
-
* themselves showed — compiled, and then the backend refused to boot with a
|
|
188
|
-
* migration hint pointing at `admin: { … }`.
|
|
189
|
-
* - `multiSelect: true`, a key that exists nowhere in the codebase, compiled.
|
|
190
|
-
*
|
|
191
|
-
* Annotating `const c: PostgresCollectionConfig = { … }` *did* catch all three,
|
|
192
|
-
* which is the tell: the checking was never missing, only bypassed by the
|
|
193
|
-
* inference the builder exists to provide.
|
|
194
|
-
*
|
|
195
|
-
* The map is homomorphic (`[K in keyof P]`), so it stays invertible and `const P`
|
|
196
|
-
* inference is unaffected — `admin.display.title` still completes over the
|
|
197
|
-
* collection's own keys. Verified against the full probe suite before landing.
|
|
198
|
-
*
|
|
199
|
-
* Nested shapes (`array.of`, `map.properties`, and the `admin` block's own
|
|
200
|
-
* options) are not reached by this type; the weak-type check covers an `admin`
|
|
201
|
-
* block whose keys are *all* unknown, and the boot validator covers the rest.
|
|
202
|
-
*/
|
|
203
|
-
export type StrictProperties<P, AllowedProperty> = {
|
|
204
|
-
[K in keyof P]: P[K] extends {
|
|
205
|
-
type: infer T;
|
|
206
|
-
} ? ExactProperty<P[K], Extract<AllowedProperty, {
|
|
207
|
-
type: T;
|
|
208
|
-
}>> : P[K];
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
* A helper type to infer the underlying data type from a Property definition.
|
|
212
|
-
* This is the core of the type inference system.
|
|
213
|
-
*/
|
|
214
|
-
export type InferPropertyType<P extends Property> = P extends StringProperty ? string : P extends NumberProperty ? number : P extends BooleanProperty ? boolean : P extends DateProperty ? Date : P extends GeopointProperty ? GeoPoint : P extends ReferenceProperty ? EntityReference : P extends RelationProperty ? EntityRelation | EntityRelation[] : P extends ArrayProperty ? (P["of"] extends Property ? InferPropertyType<P["of"]>[] : unknown[]) : P extends MapProperty ? (P["properties"] extends Properties ? InferEntityType<P["properties"]> : Record<string, unknown>) : P extends VectorProperty ? Vector : P extends BinaryProperty ? string : never;
|
|
215
|
-
/**
|
|
216
|
-
* Helper type that determines whether a property is required.
|
|
217
|
-
* Uses direct structural matching against `{ validation: { required: true } }`
|
|
218
|
-
* (without the optional marker on `validation`), which correctly narrows
|
|
219
|
-
* literal `true` while treating widened `boolean` as not-required.
|
|
220
|
-
*/
|
|
221
|
-
type IsRequired<P extends Property> = P extends {
|
|
222
|
-
validation: {
|
|
223
|
-
required: true;
|
|
224
|
-
};
|
|
225
|
-
} ? true : false;
|
|
226
|
-
/**
|
|
227
|
-
* Extract keys from Properties where the property is required.
|
|
228
|
-
*/
|
|
229
|
-
type RequiredPropertyKeys<P extends Properties> = {
|
|
230
|
-
[K in keyof P]: IsRequired<P[K]> extends true ? K : never;
|
|
231
|
-
}[keyof P];
|
|
232
|
-
/**
|
|
233
|
-
* Extract keys from Properties where the property is optional.
|
|
234
|
-
*/
|
|
235
|
-
type OptionalPropertyKeys<P extends Properties> = {
|
|
236
|
-
[K in keyof P]: IsRequired<P[K]> extends true ? never : K;
|
|
237
|
-
}[keyof P];
|
|
238
|
-
/**
|
|
239
|
-
* A generic type that converts a `Properties` schema definition into a corresponding
|
|
240
|
-
* TypeScript entity type. It correctly handles required and optional properties.
|
|
241
|
-
*
|
|
242
|
-
* A property is considered required when it has `validation: { required: true }`.
|
|
243
|
-
* The `true` must be a literal type — if `required` is typed as `boolean`,
|
|
244
|
-
* the property will be treated as optional (use `as const` for literal inference).
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* const productSchema = {
|
|
248
|
-
* name: { type: 'string', validation: { required: true } },
|
|
249
|
-
* price: { type: 'number' }
|
|
250
|
-
* } as const satisfies Properties;
|
|
251
|
-
* type Product = InferEntityType<typeof productSchema>;
|
|
252
|
-
* // Result: { name: string; price?: number; }
|
|
253
|
-
*/
|
|
254
|
-
export type InferEntityType<P extends Properties> = {
|
|
255
|
-
-readonly [K in RequiredPropertyKeys<P>]: InferPropertyType<P[K]>;
|
|
256
|
-
} & {
|
|
257
|
-
-readonly [K in OptionalPropertyKeys<P>]?: InferPropertyType<P[K]>;
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* Per-field read and write permission, by application role.
|
|
261
|
-
*
|
|
262
|
-
* An omitted list is not an empty one, and the difference is the whole type:
|
|
263
|
-
* *omitted* delegates to the row — everyone the collection's security rules let
|
|
264
|
-
* read (or write) the row gets the field; *`[]`* is nobody, through the API, at
|
|
265
|
-
* any privilege. `["editor"]` is everyone holding `editor`, plus `admin`.
|
|
266
|
-
*
|
|
267
|
-
* @see BaseProperty.access
|
|
268
|
-
*/
|
|
269
|
-
export interface FieldAccess {
|
|
270
|
-
/**
|
|
271
|
-
* Roles that may read the field. Omitted = everyone the collection's RLS
|
|
272
|
-
* lets read the row. `[]` = nobody through the API.
|
|
273
|
-
*/
|
|
274
|
-
read?: readonly string[];
|
|
275
|
-
/**
|
|
276
|
-
* Roles that may write the field. Omitted = everyone the collection's RLS
|
|
277
|
-
* lets write the row. `[]` = nobody through the API.
|
|
278
|
-
*/
|
|
279
|
-
write?: readonly string[];
|
|
280
|
-
}
|
|
281
|
-
export interface BaseProperty<CustomProps = unknown> {
|
|
282
|
-
/**
|
|
283
|
-
* The label the admin panel shows for this field — a column header, a form
|
|
284
|
-
* label, a card caption.
|
|
285
|
-
*
|
|
286
|
-
* Optional, and derived from the property key when absent
|
|
287
|
-
* (`publishDate` -> "Publish Date", via `prettifyIdentifier`, which is the
|
|
288
|
-
* same derivation the collection editor already uses when it suggests one).
|
|
289
|
-
*
|
|
290
|
-
* It was required, and that was a UI concern levied on everyone: a headless
|
|
291
|
-
* project has no panel and no reason to invent display names, yet could not
|
|
292
|
-
* declare a property without one. Set it when the derived label is wrong —
|
|
293
|
-
* `"URL"` rather than "Url", `"Postcode"` rather than "Zip" — which is the
|
|
294
|
-
* only time it earns the line.
|
|
295
|
-
*/
|
|
296
|
-
name?: string;
|
|
297
|
-
/**
|
|
298
|
-
* Property description, always displayed under the field
|
|
299
|
-
*/
|
|
300
|
-
description?: string;
|
|
301
|
-
/**
|
|
302
|
-
* You can use this prop to reuse a property that has been defined
|
|
303
|
-
* in the top level of the admin in the prop `fields`.
|
|
304
|
-
* All the configuration will be taken from the inherited config, and
|
|
305
|
-
* overwritten by the current property config.
|
|
306
|
-
*/
|
|
307
|
-
propertyConfig?: string;
|
|
308
|
-
/**
|
|
309
|
-
* Explicit database column name. When set, this value is used as-is
|
|
310
|
-
* for the SQL column name, bypassing any snake_case conversion of
|
|
311
|
-
* the property key.
|
|
312
|
-
*
|
|
313
|
-
* This is automatically populated by `rebase schema introspect`
|
|
314
|
-
* to guarantee an exact match with the live database schema.
|
|
315
|
-
*
|
|
316
|
-
* For manually-authored collections you can omit this — the framework
|
|
317
|
-
* will derive the column name from the property key via `toSnakeCase()`.
|
|
318
|
-
*/
|
|
319
|
-
columnName?: string;
|
|
320
|
-
/**
|
|
321
|
-
* Rules for validating this property
|
|
322
|
-
*/
|
|
323
|
-
validation?: PropertyValidationSchema;
|
|
324
|
-
/**
|
|
325
|
-
* Never mention this column on the API surface, in either direction.
|
|
326
|
-
*
|
|
327
|
-
* For secrets the server must store and read but no client should ever
|
|
328
|
-
* receive — password hashes, verification tokens. The value is still
|
|
329
|
-
* written, and readable server-side through `rebase.sql()` only; it is
|
|
330
|
-
* stripped from every row the API serves, for every caller, including
|
|
331
|
-
* admins, service keys and `rebase.dataAsAdmin` reads, and it is
|
|
332
|
-
* absent from every generated description of the surface: the SDK's `Row`,
|
|
333
|
-
* `Insert` and `Update` types, and the OpenAPI schemas, filters and
|
|
334
|
-
* parameters.
|
|
335
|
-
*
|
|
336
|
-
* The generated types are a *description*, not a second enforcement point:
|
|
337
|
-
* the server still accepts such a field on a write, because that is how the
|
|
338
|
-
* value gets written in the first place. Nothing generated offers it.
|
|
339
|
-
*
|
|
340
|
-
* This is a server-side guarantee, unlike `admin.hideFromCollection`, which
|
|
341
|
-
* only stops the admin panel from *rendering* a field and leaves it in the
|
|
342
|
-
* JSON payload.
|
|
343
|
-
*
|
|
344
|
-
* Sugar for `access: { read: [], write: [] }` — the two are one mechanism,
|
|
345
|
-
* not two, and declaring both on the same property is refused at boot. Write
|
|
346
|
-
* whichever reads better: the flag says "this is the server's column", the
|
|
347
|
-
* empty lists say the same thing in the vocabulary of {@link FieldAccess}.
|
|
348
|
-
*/
|
|
349
|
-
excludeFromApi?: boolean;
|
|
350
|
-
/**
|
|
351
|
-
* Who may read and who may write this one field.
|
|
352
|
-
*
|
|
353
|
-
* Row access is the collection's `securityRules`; this is the field inside
|
|
354
|
-
* the row. A caller the row's policies let through still does not receive a
|
|
355
|
-
* field their roles cannot read — it is *absent* from the response rather
|
|
356
|
-
* than `null`, so a client cannot tell a withheld value from a stored one by
|
|
357
|
-
* its shape — and a write naming a field their roles cannot write is a 400
|
|
358
|
-
* (`FIELD_NOT_WRITABLE`), never a silently dropped key.
|
|
359
|
-
*
|
|
360
|
-
* Roles are Rebase application roles, the same ones `policy.rolesOverlap`
|
|
361
|
-
* compiles against and the same list `rebase.roles()` reads inside a policy:
|
|
362
|
-
* whatever the call context carries as `user.roles`. `admin` satisfies any
|
|
363
|
-
* non-empty list, mirroring the `rolesOverlap(['admin'])` arm every baseline
|
|
364
|
-
* policy carries — a field-level rule must not lock an administrator out of
|
|
365
|
-
* their own data, and `rebase.dataAsAdmin` holds that role.
|
|
366
|
-
*
|
|
367
|
-
* The enforcement point is the API boundary. In-process writes through
|
|
368
|
-
* `rebase.data` / `rebase.dataAsAdmin` and the framework's own auth paths do
|
|
369
|
-
* not pass through it — the same exemption `excludeFromApi` has always had,
|
|
370
|
-
* and the reason it is possible to store a password hash at all.
|
|
371
|
-
*
|
|
372
|
-
* @example
|
|
373
|
-
* ```ts
|
|
374
|
-
* salary: {
|
|
375
|
-
* type: "number",
|
|
376
|
-
* // Readable by HR and by admins; writable by nobody through the API.
|
|
377
|
-
* access: { read: ["hr"], write: [] }
|
|
378
|
-
* }
|
|
379
|
-
* ```
|
|
380
|
-
*/
|
|
381
|
-
access?: FieldAccess;
|
|
382
|
-
/**
|
|
383
|
-
* The database fills this column when a create leaves it empty: a
|
|
384
|
-
* `NOT NULL DEFAULT <expression>` column such as `gen_random_uuid()`,
|
|
385
|
-
* `nextval(…)` or `now()`, whose value no property can state.
|
|
386
|
-
*
|
|
387
|
-
* A `validation.required` field with it may be left out of a create, by
|
|
388
|
-
* the admin form and by the API alike, and a create that sends it as `null`
|
|
389
|
-
* leaves it to the database rather than storing `NULL`. It is still
|
|
390
|
-
* required when a stored record is edited. The generated SDK's `Insert`
|
|
391
|
-
* type makes the field optional. Defaults to `false`.
|
|
392
|
-
*
|
|
393
|
-
* Give the expression, in the template form `isId` takes
|
|
394
|
-
* (``databaseDefault: "sql`gen_random_uuid()`"``), and the schema planner
|
|
395
|
-
* writes it as the column's `DEFAULT`, so `rebase db push` keeps it. `true`
|
|
396
|
-
* declares a DEFAULT someone else wrote: the planner writes none, and
|
|
397
|
-
* `rebase db push` leaves the one the database holds as it is. "Import
|
|
398
|
-
* from table" and `rebase schema introspect` set the expression they read.
|
|
399
|
-
*/
|
|
400
|
-
databaseDefault?: boolean | SqlExpression;
|
|
401
|
-
/**
|
|
402
|
-
* Use this to define dynamic properties that change based on certain conditions
|
|
403
|
-
* or on the entity's values. For example, you can make a field read-only if
|
|
404
|
-
* another field has a certain value.
|
|
405
|
-
* This function receives the same props as a `PropertyBuilder` and should return a partial `Property` object.
|
|
406
|
-
*
|
|
407
|
-
* **Admin form only — not enforced by the API or the database.** The
|
|
408
|
-
* function is bundled into the panel and called while a form renders. A
|
|
409
|
-
* write that never goes through a form never goes through it, so a rule
|
|
410
|
-
* that must hold for every caller belongs in {@link validation}, which the
|
|
411
|
-
* server checks, or in a security rule, which the database enforces.
|
|
412
|
-
*/
|
|
413
|
-
dynamicProps?: (props: PropertyBuilderProps) => Partial<Property>;
|
|
414
|
-
/**
|
|
415
|
-
* Declarative conditions for dynamic property behavior using JSON Logic.
|
|
416
|
-
*
|
|
417
|
-
* An alternative to PropertyBuilder functions that can be:
|
|
418
|
-
* - Stored in the database as JSON
|
|
419
|
-
* - Edited via the collection editor UI
|
|
420
|
-
* - Evaluated at runtime like property builders
|
|
421
|
-
*
|
|
422
|
-
* **Admin form only — not enforced by the API or the database.** Like
|
|
423
|
-
* {@link dynamicProps}, these are evaluated while a form renders and shape
|
|
424
|
-
* what the panel offers. `conditions.required` does not make a column
|
|
425
|
-
* `NOT NULL` and does not make a write fail.
|
|
426
|
-
*
|
|
427
|
-
* @see PropertyConditions for available condition options
|
|
428
|
-
* @see https://jsonlogic.com/ for JSON Logic syntax
|
|
429
|
-
*/
|
|
430
|
-
conditions?: PropertyConditions;
|
|
431
|
-
/**
|
|
432
|
-
* Callbacks/Hooks for this property field to transform and sanitize data during its lifecycle.
|
|
433
|
-
*/
|
|
434
|
-
callbacks?: PropertyCallbacks;
|
|
435
|
-
/**
|
|
436
|
-
* Arbitrary key-value metadata for external consumers.
|
|
437
|
-
* Not interpreted by Rebase — passed through serialization unchanged.
|
|
438
|
-
* Used by domain apps to store custom per-property config
|
|
439
|
-
* (e.g. CRM visibility flags, display hints).
|
|
440
|
-
*/
|
|
441
|
-
metadata?: Record<string, unknown>;
|
|
442
|
-
}
|
|
443
|
-
export interface StringProperty extends BaseProperty {
|
|
444
|
-
type: "string";
|
|
445
|
-
/**
|
|
446
|
-
* Default value for new entities. Must be a string.
|
|
447
|
-
*/
|
|
448
|
-
defaultValue?: string;
|
|
449
|
-
/**
|
|
450
|
-
* Optional database column type. If not set, it is `text` — or `uuid` for an `isId: "uuid"` key.
|
|
451
|
-
* `validation.max` does not bound a `text` column; declare `varchar` (or `char`) to get a
|
|
452
|
-
* width, which is then taken from `validation.max` (255 when it states none).
|
|
453
|
-
*/
|
|
454
|
-
columnType?: "varchar" | "text" | "char" | "uuid";
|
|
455
|
-
/**
|
|
456
|
-
* Rules for validating this property
|
|
457
|
-
*/
|
|
458
|
-
validation?: StringPropertyValidationSchema;
|
|
459
|
-
/**
|
|
460
|
-
* Marks this field as a Primary Key / Unique Identifier.
|
|
461
|
-
* Framework behavior: Auto-maps to `collection.primaryKeys` internally if not explicitly set.
|
|
462
|
-
* Drizzle append: `.primaryKey()`
|
|
463
|
-
* UI behavior: Field value cannot be changed after creation.
|
|
464
|
-
*
|
|
465
|
-
* Marking several properties declares one composite key: the table gets a
|
|
466
|
-
* single `PRIMARY KEY (a, b)` constraint (Drizzle: `primaryKey({ columns })`)
|
|
467
|
-
* and a row is addressed by all of its key values, joined in declaration
|
|
468
|
-
* order — `1:::en_US`. A foreign key cannot point at a composite key, so a
|
|
469
|
-
* relation or reference into such a collection is refused by the schema
|
|
470
|
-
* generators.
|
|
471
|
-
*
|
|
472
|
-
* You can set this to `"manual"` for a user-defined ID, or specify a generation strategy:
|
|
473
|
-
* 'uuid' -> Drizzle `.defaultRandom()` (Postgres gen_random_uuid())
|
|
474
|
-
* Or any other string to act as a raw SQL default expression, written either
|
|
475
|
-
* bare (`gen_random_uuid()::text`) or in template form
|
|
476
|
-
* (``isId: "sql`my_id()`"``) — the wrapper is markup and is stripped before
|
|
477
|
-
* the SQL is written. The function has to exist: nothing here creates it.
|
|
478
|
-
*
|
|
479
|
-
* `"cuid"` is **refused on Postgres**, at config load. It emitted
|
|
480
|
-
* `DEFAULT cuid()` against a function Rebase has never created — not by a
|
|
481
|
-
* generator, not at boot, not in a migration — so the column has never had a
|
|
482
|
-
* working default and the first insert relying on it failed with
|
|
483
|
-
* `function cuid() does not exist`. Use `"uuid"`, or supply your own SQL
|
|
484
|
-
* expression above and create the function in a migration.
|
|
485
|
-
*
|
|
486
|
-
* On the UI side, the field automatically gets disabled on new entities if a string strategy is provided.
|
|
487
|
-
*/
|
|
488
|
-
isId?: boolean | "manual" | "uuid" | string;
|
|
489
|
-
/**
|
|
490
|
-
* You can use the enum values providing a map of possible
|
|
491
|
-
* exclusive values the property can take, mapped to the label that it is
|
|
492
|
-
* displayed in the dropdown. You can use a simple object with the format
|
|
493
|
-
* `value` => `label`, or with the format `value` => `EnumValueConfig` if you
|
|
494
|
-
* need extra customization, (like disabling specific options or assigning
|
|
495
|
-
* colors). If you need to ensure the order of the elements, you can pass
|
|
496
|
-
* a `Map` instead of a plain object.
|
|
497
|
-
*
|
|
498
|
-
* On a SQL store this compiles to a Postgres enum type named
|
|
499
|
-
* `<table>_<column>`, so the ids are the type's labels. An empty list is
|
|
500
|
-
* refused at config load: `CREATE TYPE … AS ENUM ()` is not valid SQL, and
|
|
501
|
-
* the column would reference a type nothing creates.
|
|
502
|
-
*/
|
|
503
|
-
enum?: EnumValues;
|
|
504
|
-
/**
|
|
505
|
-
* You can specify a `Storage` configuration. It is used to
|
|
506
|
-
* indicate that this string refers to a path in your storage provider.
|
|
507
|
-
*/
|
|
508
|
-
storage?: StorageConfig;
|
|
509
|
-
/**
|
|
510
|
-
* This property is used to indicate that the string is a user ID, and
|
|
511
|
-
* it will be rendered as a user picker.
|
|
512
|
-
* Note that the user ID needs to be the one used in your authentication
|
|
513
|
-
* provider (e.g. the ID in your `users` table).
|
|
514
|
-
* You can also use a property builder to specify the user path dynamically
|
|
515
|
-
* based on other values of the entity.
|
|
516
|
-
*
|
|
517
|
-
* **Admin form only — not enforced by the API or the database.** The column
|
|
518
|
-
* is an ordinary string; there is no foreign key to the users table and
|
|
519
|
-
* nothing resolves or checks the id on the way in. To make the link real,
|
|
520
|
-
* declare a `relation` to the auth collection instead.
|
|
521
|
-
*/
|
|
522
|
-
userSelect?: boolean;
|
|
523
|
-
/**
|
|
524
|
-
* Does this field include an email
|
|
525
|
-
*/
|
|
526
|
-
email?: boolean;
|
|
527
|
-
/**
|
|
528
|
-
* Does this string hold a URL?
|
|
529
|
-
*
|
|
530
|
-
* A statement about the *data*, which is why it sits here beside `email`
|
|
531
|
-
* rather than in the admin block: the OpenAPI generator turns it into
|
|
532
|
-
* `format: "uri"`, so it is part of the published API contract. How the panel
|
|
533
|
-
* renders it — as a link, an image, a video — is `admin.urlPreview`.
|
|
534
|
-
*/
|
|
535
|
-
url?: boolean;
|
|
536
|
-
/**
|
|
537
|
-
* Stamp this column with the **uid of the acting user**, on creation only
|
|
538
|
-
* (`user_on_create`) or on every write including creation
|
|
539
|
-
* (`user_on_update`). The `created_by` / `updated_by` twin of
|
|
540
|
-
* {@link DateProperty.autoValue}, which has always done the same for
|
|
541
|
-
* timestamps.
|
|
542
|
-
*
|
|
543
|
-
* The value is taken from the call context, not from the request body: a
|
|
544
|
-
* caller cannot claim to be somebody else by sending the field, because the
|
|
545
|
-
* driver overwrites whatever arrived. That is the whole point — a column
|
|
546
|
-
* whose value the caller supplies is not an audit column.
|
|
547
|
-
*
|
|
548
|
-
* With no acting user (an anonymous request, a service token, a seed
|
|
549
|
-
* script) the column is set to `null`. If it is also
|
|
550
|
-
* `validation: { required: true }`, that is a 400 rather than a null: a
|
|
551
|
-
* collection that demands to know who wrote a row is a collection that
|
|
552
|
-
* cannot accept an anonymous write.
|
|
553
|
-
*
|
|
554
|
-
* There is no foreign key here. The uid is a string, the user store may be
|
|
555
|
-
* another database entirely, and a deleted user must not take their audit
|
|
556
|
-
* trail with them — declare a `relation` if you want the join.
|
|
557
|
-
*/
|
|
558
|
-
autoValue?: "user_on_create" | "user_on_update";
|
|
559
|
-
}
|
|
560
|
-
export interface NumberProperty extends BaseProperty {
|
|
561
|
-
type: "number";
|
|
562
|
-
/**
|
|
563
|
-
* Default value for new entities. Must be a number.
|
|
564
|
-
*/
|
|
565
|
-
defaultValue?: number;
|
|
566
|
-
/**
|
|
567
|
-
* Optional database column type. Allows specifying exact database numeric types.
|
|
568
|
-
* If not provided, integer fields (where validation.integer is true or isId is true) default to `integer`, others to `numeric`.
|
|
569
|
-
*/
|
|
570
|
-
columnType?: "integer" | "real" | "double precision" | "numeric" | "bigint" | "serial" | "bigserial";
|
|
571
|
-
/**
|
|
572
|
-
* Total significant digits for a `numeric` column — `NUMERIC(precision, scale)`.
|
|
573
|
-
*
|
|
574
|
-
* Money is the case this exists for. Without it a price lands as an
|
|
575
|
-
* *unbounded* `NUMERIC`, which stores `19.999999999999998` as faithfully as
|
|
576
|
-
* `19.99` and cannot be tightened afterwards without rewriting the column,
|
|
577
|
-
* so the rounding rule ends up living in whichever caller last touched the
|
|
578
|
-
* value. `precision: 10, scale: 2` makes the database the one that decides.
|
|
579
|
-
*
|
|
580
|
-
* Read only when the column is `numeric` — either declared
|
|
581
|
-
* ({@link NumberProperty.columnType}) or arrived at by default, which is
|
|
582
|
-
* what a non-integer `number` gets. Ignored on `integer`, `real`,
|
|
583
|
-
* `double precision` and the serial types, which have no modifier.
|
|
584
|
-
*
|
|
585
|
-
* Changing it on a live column is an `ALTER COLUMN … TYPE`, so `db push`
|
|
586
|
-
* plans it and the boot-time ensure reports it rather than applying it —
|
|
587
|
-
* the same treatment every other type change gets.
|
|
588
|
-
*/
|
|
589
|
-
precision?: number;
|
|
590
|
-
/** Digits after the decimal point. Requires {@link NumberProperty.precision}. */
|
|
591
|
-
scale?: number;
|
|
592
|
-
/**
|
|
593
|
-
* Rules for validating this property
|
|
594
|
-
*/
|
|
595
|
-
validation?: NumberPropertyValidationSchema;
|
|
596
|
-
/**
|
|
597
|
-
* Marks this field as a Primary Key / Unique Identifier.
|
|
598
|
-
* Framework behavior: Auto-maps to `collection.primaryKeys` internally if not explicitly set.
|
|
599
|
-
* Drizzle append: `.primaryKey()`
|
|
600
|
-
* UI behavior: Field value cannot be changed after creation.
|
|
601
|
-
*
|
|
602
|
-
* Marking several properties declares one composite key — see
|
|
603
|
-
* {@link StringProperty.isId}. A column whose value the database does not
|
|
604
|
-
* generate, such as a foreign key that is part of the key, takes `true`.
|
|
605
|
-
*
|
|
606
|
-
* You can set this to `"manual"` for a user-defined ID, or specify a generation strategy:
|
|
607
|
-
* 'increment' -> PostgreSQL `INTEGER GENERATED BY DEFAULT AS IDENTITY`.
|
|
608
|
-
* Or any other string to act as a raw SQL default expression, bare or in
|
|
609
|
-
* template form (``isId: "sql`nextval('s')`"``).
|
|
610
|
-
*
|
|
611
|
-
* {@link NumberProperty.columnType} is **not read** beside
|
|
612
|
-
* `isId: "increment"`: an increment key is always INTEGER, because every
|
|
613
|
-
* foreign key and junction column that points at a numeric primary key is
|
|
614
|
-
* INTEGER, and a wider key would be referenced by narrower columns. Config
|
|
615
|
-
* validation warns when the two are written together.
|
|
616
|
-
*/
|
|
617
|
-
isId?: boolean | "manual" | "increment" | string;
|
|
618
|
-
/**
|
|
619
|
-
* You can use the enum values providing a map of possible
|
|
620
|
-
* exclusive values the property can take, mapped to the label that it is
|
|
621
|
-
* displayed in the dropdown.
|
|
622
|
-
*
|
|
623
|
-
* Unlike a string enum, this creates **no Postgres enum type**: the column
|
|
624
|
-
* stays NUMERIC or INTEGER, so the values are offered by the panel and are
|
|
625
|
-
* not enforced by the database. (One used to be created, referenced by
|
|
626
|
-
* nothing, and every `db push` planned a DROP for it.) An empty list is
|
|
627
|
-
* refused at config load.
|
|
628
|
-
*/
|
|
629
|
-
enum?: EnumValues;
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* @group Entity properties
|
|
633
|
-
*/
|
|
634
|
-
export interface BooleanProperty extends BaseProperty {
|
|
635
|
-
type: "boolean";
|
|
636
|
-
/**
|
|
637
|
-
* Default value for new entities. Must be a boolean.
|
|
638
|
-
*/
|
|
639
|
-
defaultValue?: boolean;
|
|
640
|
-
/**
|
|
641
|
-
* Rules for validating this property
|
|
642
|
-
*/
|
|
643
|
-
validation?: PropertyValidationSchema;
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* Which pgvector distance a query measures with, and therefore which operator
|
|
647
|
-
* class an index has to be built for. The names match the `distance` option on
|
|
648
|
-
* `vectorSearch`, because an index built for one operator is not used by a
|
|
649
|
-
* query that asks for another.
|
|
650
|
-
*
|
|
651
|
-
* @group Entity properties
|
|
652
|
-
*/
|
|
653
|
-
export type VectorDistance = "cosine" | "l2" | "inner_product";
|
|
654
|
-
/**
|
|
655
|
-
* How the ANN index over a vector column is built.
|
|
656
|
-
*
|
|
657
|
-
* Without an index, `vectorSearch` is an exact scan: correct at any size,
|
|
658
|
-
* and linear in the number of rows. With one, it is approximate and fast.
|
|
659
|
-
* That trade is why this is configurable rather than implied.
|
|
660
|
-
*
|
|
661
|
-
* @group Entity properties
|
|
662
|
-
*/
|
|
663
|
-
export interface VectorIndexConfig {
|
|
664
|
-
/**
|
|
665
|
-
* `hnsw` (the default) builds a navigable-graph index: slower to build,
|
|
666
|
-
* better recall, and it needs no training data, so it works on an empty
|
|
667
|
-
* table. `ivfflat` is cheaper to build but partitions by centroid, so an
|
|
668
|
-
* index built on an empty or tiny table has useless partitions — build it
|
|
669
|
-
* after the data is loaded, and set {@link lists}.
|
|
670
|
-
*/
|
|
671
|
-
method?: "hnsw" | "ivfflat";
|
|
672
|
-
/**
|
|
673
|
-
* Which distance operators to index, defaulting to `cosine` — the default
|
|
674
|
-
* `vectorSearch` measures with. Name several to index several; each one is
|
|
675
|
-
* a separate index with its own build cost and its own storage.
|
|
676
|
-
*/
|
|
677
|
-
distance?: VectorDistance | VectorDistance[];
|
|
678
|
-
/** HNSW: connections per node. Postgres defaults to 16. */
|
|
679
|
-
m?: number;
|
|
680
|
-
/** HNSW: candidate-list size while building. Postgres defaults to 64. */
|
|
681
|
-
efConstruction?: number;
|
|
682
|
-
/** IVFFlat: number of partitions. Postgres defaults to 100. */
|
|
683
|
-
lists?: number;
|
|
684
|
-
}
|
|
685
|
-
export interface VectorProperty extends BaseProperty {
|
|
686
|
-
type: "vector";
|
|
687
|
-
/**
|
|
688
|
-
* Default value for new entities.
|
|
689
|
-
*/
|
|
690
|
-
defaultValue?: Vector;
|
|
691
|
-
/**
|
|
692
|
-
* How many numbers each embedding has — 1536 for OpenAI's
|
|
693
|
-
* `text-embedding-3-small`, 768 for many sentence transformers.
|
|
694
|
-
*
|
|
695
|
-
* **Required, and effectively frozen.** It is the column's width
|
|
696
|
-
* (`vector(1536)`), so changing it is a rewrite of every row, and every
|
|
697
|
-
* stored embedding was produced by a model that no longer matches. Take the
|
|
698
|
-
* number from the model you are actually going to use.
|
|
699
|
-
*/
|
|
700
|
-
dimensions: number;
|
|
701
|
-
/**
|
|
702
|
-
* ANN index configuration for this column.
|
|
703
|
-
*
|
|
704
|
-
* Omitted, a single HNSW index for cosine distance is created — which is
|
|
705
|
-
* what the default `vectorSearch` uses. `false` creates none, leaving
|
|
706
|
-
* `vectorSearch` an exact scan.
|
|
707
|
-
*
|
|
708
|
-
* Indexes are only created when {@link dimensions} is at most 2000:
|
|
709
|
-
* pgvector cannot index a wider `vector` column, so a 3072-dimension
|
|
710
|
-
* embedding is left unindexed rather than failing the boot.
|
|
711
|
-
*/
|
|
712
|
-
index?: VectorIndexConfig | false;
|
|
713
|
-
/**
|
|
714
|
-
* The rules every property has: `required`, `unique`. A vector has no
|
|
715
|
-
* length or range rules of its own — {@link dimensions} is the column's
|
|
716
|
-
* width, and the database enforces it.
|
|
717
|
-
*/
|
|
718
|
-
validation?: PropertyValidationSchema;
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
* @group Entity properties
|
|
722
|
-
*/
|
|
723
|
-
export interface BinaryProperty extends BaseProperty {
|
|
724
|
-
type: "binary";
|
|
725
|
-
/**
|
|
726
|
-
* Default value for new entities. Must be a base64-encoded string.
|
|
727
|
-
*/
|
|
728
|
-
defaultValue?: string;
|
|
729
|
-
/**
|
|
730
|
-
* The rules every property has: `required`, `unique`. Size limits belong to
|
|
731
|
-
* the upload path, not here.
|
|
732
|
-
*/
|
|
733
|
-
validation?: PropertyValidationSchema;
|
|
734
|
-
}
|
|
735
|
-
export interface DateProperty extends BaseProperty {
|
|
736
|
-
type: "date";
|
|
737
|
-
/**
|
|
738
|
-
* Default value for new entities. Must be a Date.
|
|
739
|
-
*/
|
|
740
|
-
defaultValue?: Date;
|
|
741
|
-
/**
|
|
742
|
-
* Optional database column type. If not set, defaults to `timestamp` with timezone.
|
|
743
|
-
*/
|
|
744
|
-
columnType?: "timestamp" | "date" | "time";
|
|
745
|
-
/**
|
|
746
|
-
* Rules for validating this property
|
|
747
|
-
*/
|
|
748
|
-
validation?: DatePropertyValidationSchema;
|
|
749
|
-
/**
|
|
750
|
-
* Set the granularity of the field to a date or date + time.
|
|
751
|
-
* Defaults to `date_time`.
|
|
752
|
-
*
|
|
753
|
-
* **Admin form only — not enforced by the API or the database.** It picks
|
|
754
|
-
* the picker. The column is whatever {@link columnType} says, and the API
|
|
755
|
-
* accepts a full timestamp either way — narrowing the widget does not
|
|
756
|
-
* narrow the value.
|
|
757
|
-
*/
|
|
758
|
-
mode?: "date" | "date_time";
|
|
759
|
-
/**
|
|
760
|
-
* Timezone string to evaluate the date in.
|
|
761
|
-
*
|
|
762
|
-
* **Admin form only — not enforced by the API or the database.** It is the
|
|
763
|
-
* zone the panel reads and writes the value in; what is stored is a
|
|
764
|
-
* `timestamptz`, which has no zone of its own.
|
|
765
|
-
*/
|
|
766
|
-
timezone?: string;
|
|
767
|
-
/**
|
|
768
|
-
* If this flag is set to `on_create` or `on_update` this timestamp is
|
|
769
|
-
* updated automatically on creation of the entity only or on every
|
|
770
|
-
* update (including creation). Useful for creating `created_on` or
|
|
771
|
-
* `updated_on` fields
|
|
772
|
-
*/
|
|
773
|
-
autoValue?: "on_create" | "on_update";
|
|
774
|
-
/**
|
|
775
|
-
* Makes this field (part of) the primary key — a calendar day in a key such
|
|
776
|
-
* as `(day, player)`. Only on `columnType: "date"`, whose value is a day and
|
|
777
|
-
* not an instant: it travels as `YYYY-MM-DD` in rows and in addresses
|
|
778
|
-
* (`2026-11-09:::p1`), never through a `Date`, so no time zone moves it.
|
|
779
|
-
* The day is the caller's (`"manual"`); the database assigns none.
|
|
780
|
-
*/
|
|
781
|
-
isId?: "manual" | true;
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* @group Entity properties
|
|
785
|
-
*/
|
|
786
|
-
export interface GeopointProperty extends BaseProperty {
|
|
787
|
-
type: "geopoint";
|
|
788
|
-
/**
|
|
789
|
-
* Default value for new entities. Must be a GeoPoint.
|
|
790
|
-
*/
|
|
791
|
-
defaultValue?: GeoPoint;
|
|
792
|
-
/**
|
|
793
|
-
* Rules for validating this property
|
|
794
|
-
*/
|
|
795
|
-
validation?: PropertyValidationSchema;
|
|
796
|
-
}
|
|
797
|
-
/**
|
|
798
|
-
* A pointer to a entity, stored **as a value** on the row (id + path, and
|
|
799
|
-
* optionally a `driver`/`databaseId` for cross-datasource pointers).
|
|
800
|
-
*
|
|
801
|
-
* This is the native primitive of **document databases** — it maps 1:1 to a
|
|
802
|
-
* Firestore `DocumentReference`, and is persisted by the MongoDB driver as a
|
|
803
|
-
* tagged sub-document. It carries no schema-level relationship (no foreign key,
|
|
804
|
-
* no join, no cascade) and is resolved on demand.
|
|
805
|
-
*
|
|
806
|
-
* **Which to use:**
|
|
807
|
-
* - Firestore / MongoDB collection → use `reference`.
|
|
808
|
-
* - Postgres collection → use {@link RelationProperty} (`type: "relation"`),
|
|
809
|
-
* which models a real foreign key / join with prefetch and cascade.
|
|
810
|
-
*
|
|
811
|
-
* @group Entity properties
|
|
812
|
-
*/
|
|
813
|
-
export interface ReferenceProperty extends BaseProperty {
|
|
814
|
-
type: "reference";
|
|
815
|
-
/**
|
|
816
|
-
* Default value for new entities. Must be a EntityReference.
|
|
817
|
-
*/
|
|
818
|
-
defaultValue?: EntityReference;
|
|
819
|
-
/**
|
|
820
|
-
* Marks this field as a Primary Key / Unique Identifier.
|
|
821
|
-
* Framework behavior: Auto-maps to `collection.primaryKeys` internally if not explicitly set.
|
|
822
|
-
* Drizzle append: `.primaryKey()`
|
|
823
|
-
* UI behavior: Field value cannot be changed after creation.
|
|
824
|
-
*/
|
|
825
|
-
isId?: boolean;
|
|
826
|
-
/**
|
|
827
|
-
* Absolute collection path of the collection this reference points to.
|
|
828
|
-
* The collection of the entity is inferred based on the root navigation, so
|
|
829
|
-
* the filters and search delegate existing there are applied to this view
|
|
830
|
-
* as well.
|
|
831
|
-
* You can leave this prop undefined if the path is not yet know, e.g.
|
|
832
|
-
* you are using a property builder and the path depends on a different
|
|
833
|
-
* property.
|
|
834
|
-
*/
|
|
835
|
-
path?: string;
|
|
836
|
-
}
|
|
837
|
-
/**
|
|
838
|
-
* A schema-level relationship between collections **within a single
|
|
839
|
-
* datasource** — backed by a foreign key, junction table, or explicit join
|
|
840
|
-
* path. The resolved value (an `EntityRelation`) can carry a prefetched entity
|
|
841
|
-
* payload to eliminate N+1 queries, and supports `onUpdate`/`onDelete` cascade.
|
|
842
|
-
*
|
|
843
|
-
* This is the native primitive of **relational databases** (Postgres). It is
|
|
844
|
-
* the SQL counterpart to {@link ReferenceProperty}.
|
|
845
|
-
*
|
|
846
|
-
* **Which to use:**
|
|
847
|
-
* - Postgres collection → use `relation`.
|
|
848
|
-
* - Firestore / MongoDB collection → use {@link ReferenceProperty}
|
|
849
|
-
* (`type: "reference"`), a stored pointer with no join engine.
|
|
850
|
-
*
|
|
851
|
-
* @group Entity properties
|
|
852
|
-
*/
|
|
853
|
-
export interface RelationProperty extends BaseProperty {
|
|
854
|
-
type: "relation";
|
|
855
|
-
/**
|
|
856
|
-
* Default value for new entities. Must be a EntityRelation or array of EntityRelation.
|
|
857
|
-
*/
|
|
858
|
-
defaultValue?: EntityRelation | EntityRelation[];
|
|
859
|
-
/**
|
|
860
|
-
* Marks this field as a Primary Key / Unique Identifier.
|
|
861
|
-
* Framework behavior: Auto-maps to `collection.primaryKeys` internally if not explicitly set.
|
|
862
|
-
* Drizzle append: `.primaryKey()`
|
|
863
|
-
* UI behavior: Field value cannot be changed after creation.
|
|
864
|
-
*/
|
|
865
|
-
isId?: boolean;
|
|
866
|
-
/**
|
|
867
|
-
* The link this field represents.
|
|
868
|
-
*
|
|
869
|
-
* A closed union: pick the `kind` and the type offers exactly the fields
|
|
870
|
-
* that kind needs. This used to be the relation's fields spread flat across
|
|
871
|
-
* the property — `target`, `cardinality`, `direction`, `localKey`,
|
|
872
|
-
* `foreignKeyOnTarget`, `through` and `joinPath`, every one optional and all
|
|
873
|
-
* of them simultaneously legal. Which link you meant then had to be
|
|
874
|
-
* inferred, and combinations that meant nothing (a `many` relation carrying
|
|
875
|
-
* a `localKey`) typechecked and corrupted writes.
|
|
876
|
-
*
|
|
877
|
-
* @example
|
|
878
|
-
* ```ts
|
|
879
|
-
* tags: {
|
|
880
|
-
* name: "Tags",
|
|
881
|
-
* type: "relation",
|
|
882
|
-
* relation: { kind: "manyToMany", target: () => tagsCollection }
|
|
883
|
-
* }
|
|
884
|
-
* ```
|
|
885
|
-
*
|
|
886
|
-
* Optional because there is a second way to say the same thing: an entry in
|
|
887
|
-
* the collection's `relations` array whose `relationName` is this
|
|
888
|
-
* property's key. One of the two is required, and boot refuses a
|
|
889
|
-
* `type: "relation"` property that has neither — a field with no link is a
|
|
890
|
-
* relation in name only.
|
|
891
|
-
*/
|
|
892
|
-
relation?: Relation;
|
|
893
|
-
/**
|
|
894
|
-
* The same relation with every default filled in, stamped during
|
|
895
|
-
* normalization. **Do not set manually** — it is derived from
|
|
896
|
-
* {@link RelationProperty.relation}, or looked up by name from the
|
|
897
|
-
* collection's `relations` array.
|
|
898
|
-
*/
|
|
899
|
-
resolvedRelation?: ResolvedRelation;
|
|
900
|
-
}
|
|
901
|
-
export interface ArrayProperty extends BaseProperty {
|
|
902
|
-
type: "array";
|
|
903
|
-
/**
|
|
904
|
-
* Default value for new entities. Must be an array.
|
|
905
|
-
*/
|
|
906
|
-
defaultValue?: unknown[];
|
|
907
|
-
/**
|
|
908
|
-
* Optional database column type. By default, maps to a native Postgres array
|
|
909
|
-
* (e.g. `text[]`, `integer[]`/`numeric[]`, `boolean[]`) if the element type
|
|
910
|
-
* is a primitive, otherwise defaults to `jsonb`.
|
|
911
|
-
*/
|
|
912
|
-
columnType?: "json" | "jsonb" | "text[]" | "integer[]" | "boolean[]" | "numeric[]";
|
|
913
|
-
/**
|
|
914
|
-
* The property of this array.
|
|
915
|
-
* You can specify any property (except another Array property)
|
|
916
|
-
* You can leave this field empty only if you are providing a custom field,
|
|
917
|
-
* or using the `oneOf` prop, otherwise an error will be thrown.
|
|
918
|
-
*/
|
|
919
|
-
of?: Property | Property[];
|
|
920
|
-
/**
|
|
921
|
-
* Use this field if you would like to have an array of typed objects.
|
|
922
|
-
* It is useful if you need to have values of different types in the same
|
|
923
|
-
* array.
|
|
924
|
-
* Each entry of the array is an object with the shape:
|
|
925
|
-
* ```
|
|
926
|
-
* { type: "YOUR_TYPE", value: "YOUR_VALUE"}
|
|
927
|
-
* ```
|
|
928
|
-
* Note that you can use any property so `value` can take any value (strings,
|
|
929
|
-
* numbers, array, objects...)
|
|
930
|
-
* You can customise the `type` and `value` fields to suit your needs.
|
|
931
|
-
*
|
|
932
|
-
* An example use case for this feature may be a blog entry, where you have
|
|
933
|
-
* images and text blocks using markdown.
|
|
934
|
-
*/
|
|
935
|
-
oneOf?: {
|
|
936
|
-
/**
|
|
937
|
-
* Record of properties, where the key is the `type` and the value
|
|
938
|
-
* is the corresponding property
|
|
939
|
-
*/
|
|
940
|
-
properties: Properties;
|
|
941
|
-
/**
|
|
942
|
-
* Order in which the properties are displayed.
|
|
943
|
-
* If you are specifying your collection as code, the order is the same as the
|
|
944
|
-
* one you define in `properties`, and you don't need to specify this prop.
|
|
945
|
-
*/
|
|
946
|
-
propertiesOrder?: string[];
|
|
947
|
-
/**
|
|
948
|
-
* Name of the field to use as the discriminator for type
|
|
949
|
-
* Defaults to `type`
|
|
950
|
-
*/
|
|
951
|
-
typeField?: string;
|
|
952
|
-
/**
|
|
953
|
-
* Name of the field to use as the value
|
|
954
|
-
* Defaults to `value`
|
|
955
|
-
*/
|
|
956
|
-
valueField?: string;
|
|
957
|
-
};
|
|
958
|
-
/**
|
|
959
|
-
* Rules for validating this property
|
|
960
|
-
*/
|
|
961
|
-
validation?: ArrayPropertyValidationSchema;
|
|
962
|
-
}
|
|
963
|
-
export interface MapProperty extends BaseProperty {
|
|
964
|
-
type: "map";
|
|
965
|
-
/**
|
|
966
|
-
* Default value for new entities. Must be a record/object.
|
|
967
|
-
*/
|
|
968
|
-
defaultValue?: Record<string, unknown>;
|
|
969
|
-
/**
|
|
970
|
-
* Optional database column type. Defaults to `jsonb`.
|
|
971
|
-
*/
|
|
972
|
-
columnType?: "json" | "jsonb";
|
|
973
|
-
/**
|
|
974
|
-
* Record of properties included in this map.
|
|
975
|
-
*/
|
|
976
|
-
properties?: Properties;
|
|
977
|
-
/**
|
|
978
|
-
* Order in which the properties are displayed.
|
|
979
|
-
* If you are specifying your collection as code, the order is the same as the
|
|
980
|
-
* one you define in `properties`, and you don't need to specify this prop.
|
|
981
|
-
*
|
|
982
|
-
* Stays on the property rather than moving to the `admin` block, unlike the
|
|
983
|
-
* rest of the map's presentation options: `sortProperties` in
|
|
984
|
-
* `@rebasepro/common` reads it recursively, and `@rebasepro/firebase` calls
|
|
985
|
-
* that when it builds collections. A core package cannot read the admin
|
|
986
|
-
* block — the field exists only once `@rebasepro/cms-types` is installed.
|
|
987
|
-
*/
|
|
988
|
-
propertiesOrder?: string[];
|
|
989
|
-
/**
|
|
990
|
-
* Rules for validating this property.
|
|
991
|
-
* NOTE: If you don't set `required` in the map property, an empty object
|
|
992
|
-
* will be considered valid, even if you set `required` in the properties.
|
|
993
|
-
*/
|
|
994
|
-
validation?: PropertyValidationSchema;
|
|
995
|
-
/**
|
|
996
|
-
* Render this map as a key-value table that allows to use
|
|
997
|
-
* arbitrary keys. You don't need to define the properties in this case.
|
|
998
|
-
*
|
|
999
|
-
* Core rather than admin despite the wording: it says the map has no
|
|
1000
|
-
* declared shape, which is what the OpenAPI generator emits the schema
|
|
1001
|
-
* from (`additionalProperties` instead of a property list).
|
|
1002
|
-
*/
|
|
1003
|
-
keyValue?: boolean;
|
|
1004
|
-
}
|
|
1005
|
-
/**
|
|
1006
|
-
* What a `dynamicProps` builder is handed when it computes a property.
|
|
1007
|
-
*
|
|
1008
|
-
* Called on every render of the form, for one field, so it is a pure function of
|
|
1009
|
-
* these arguments: the entity being edited, the value in this field, and who is
|
|
1010
|
-
* editing. It runs **in the browser** and shapes what is offered — it is not a
|
|
1011
|
-
* security boundary, and a rule that must hold has to be a security rule as well.
|
|
1012
|
-
*
|
|
1013
|
-
* @group Entity properties
|
|
1014
|
-
*/
|
|
1015
|
-
export type PropertyBuilderProps<M extends Record<string, unknown> = Record<string, unknown>> = {
|
|
1016
|
-
/** The entity's values as they stand right now, including unsaved edits. */
|
|
1017
|
-
values: Partial<M>;
|
|
1018
|
-
/** The values as last saved, or `undefined` for an entity being created. */
|
|
1019
|
-
previousValues?: Partial<M>;
|
|
1020
|
-
/** The value in *this* field. `undefined` before anything is typed. */
|
|
1021
|
-
propertyValue?: unknown;
|
|
1022
|
-
/** Position within the parent array, when this property is an array element. */
|
|
1023
|
-
index?: number;
|
|
1024
|
-
/** The collection path this entity belongs to. */
|
|
1025
|
-
path: string;
|
|
1026
|
-
/** The record's id, or `undefined` while it is being created. */
|
|
1027
|
-
id?: string | number;
|
|
1028
|
-
/** @deprecated Use `id` instead. */
|
|
1029
|
-
entityId?: string | number;
|
|
1030
|
-
/** Who is editing — the signed-in user and their roles. */
|
|
1031
|
-
authController: AuthState;
|
|
1032
|
-
};
|
|
1033
|
-
/**
|
|
1034
|
-
* We use this type to define mapping between string or number values in
|
|
1035
|
-
* the data source to a label (such in a select dropdown).
|
|
1036
|
-
* The key in this Record is the value saved in the driver, and the value in
|
|
1037
|
-
* this record is the label displayed in the UI.
|
|
1038
|
-
* You can add additional customization by assigning a {@link EnumValueConfig} for the
|
|
1039
|
-
* label instead of a simple string (for enabling or disabling options and
|
|
1040
|
-
* choosing colors).
|
|
1041
|
-
* If you need to ensure the order of the elements use an array of {@link EnumValueConfig}
|
|
1042
|
-
* @group Entity properties
|
|
1043
|
-
*/
|
|
1044
|
-
export type EnumValues = EnumValueConfig[] | Record<string | number, string | EnumValueConfig>;
|
|
1045
|
-
/**
|
|
1046
|
-
* Configuration for a particular entry in an `EnumValues`
|
|
1047
|
-
* @group Entity properties
|
|
1048
|
-
*/
|
|
1049
|
-
export type EnumValueConfig = {
|
|
1050
|
-
/**
|
|
1051
|
-
* Value stored in the data source.
|
|
1052
|
-
*/
|
|
1053
|
-
id: string | number;
|
|
1054
|
-
/**
|
|
1055
|
-
* Displayed label
|
|
1056
|
-
*/
|
|
1057
|
-
label: string;
|
|
1058
|
-
/**
|
|
1059
|
-
* This value will not be selectable
|
|
1060
|
-
*/
|
|
1061
|
-
disabled?: boolean;
|
|
1062
|
-
/**
|
|
1063
|
-
* You can pick from a list of predefined color combinations or define
|
|
1064
|
-
* your own {@link ColorScheme}
|
|
1065
|
-
*/
|
|
1066
|
-
color?: ColorKey | ColorScheme;
|
|
1067
|
-
};
|
|
1068
|
-
/**
|
|
1069
|
-
* Rules to validate any property. Some properties have specific rules
|
|
1070
|
-
* additionally to these.
|
|
1071
|
-
* @group Entity properties
|
|
1072
|
-
*/
|
|
1073
|
-
export interface PropertyValidationSchema {
|
|
1074
|
-
/**
|
|
1075
|
-
* Is this field required
|
|
1076
|
-
*/
|
|
1077
|
-
required?: boolean;
|
|
1078
|
-
/**
|
|
1079
|
-
* Customize the required message when the property is not set.
|
|
1080
|
-
*
|
|
1081
|
-
* **Admin form only — not enforced by the API or the database.** It is the
|
|
1082
|
-
* sentence the panel shows under the field; an API rejection carries its
|
|
1083
|
-
* own error code and message.
|
|
1084
|
-
*/
|
|
1085
|
-
requiredMessage?: string;
|
|
1086
|
-
/**
|
|
1087
|
-
* If the unique flag is set to `true`, you can only have one entity in the
|
|
1088
|
-
* collection with this value.
|
|
1089
|
-
*/
|
|
1090
|
-
unique?: boolean;
|
|
1091
|
-
/**
|
|
1092
|
-
* If the uniqueInArray flag is set to `true`, you can only have this value
|
|
1093
|
-
* once per entry in the parent `ArrayProperty`. It has no effect if this
|
|
1094
|
-
* property is not a child of an `ArrayProperty`. It works on direct
|
|
1095
|
-
* children of an `ArrayProperty` or first level children of `MapProperty`
|
|
1096
|
-
*
|
|
1097
|
-
* **Admin form only — not enforced by the API or the database.** Unlike
|
|
1098
|
-
* {@link unique}, which compiles to a constraint, this one is checked as
|
|
1099
|
-
* the form is filled in: the column holds a JSON array, and nothing in
|
|
1100
|
-
* Postgres is looking inside it.
|
|
1101
|
-
*/
|
|
1102
|
-
uniqueInArray?: boolean;
|
|
1103
|
-
}
|
|
1104
|
-
/**
|
|
1105
|
-
* Validation rules for numbers
|
|
1106
|
-
* @group Entity properties
|
|
1107
|
-
*/
|
|
1108
|
-
export interface NumberPropertyValidationSchema extends PropertyValidationSchema {
|
|
1109
|
-
/** Smallest accepted value, **inclusive**. `min: 0` accepts `0`. */
|
|
1110
|
-
min?: number;
|
|
1111
|
-
/** Largest accepted value, **inclusive**. `max: 100` accepts `100`. */
|
|
1112
|
-
max?: number;
|
|
1113
|
-
/** Must be strictly below this. The exclusive twin of {@link max}. */
|
|
1114
|
-
lessThan?: number;
|
|
1115
|
-
/** Must be strictly above this. The exclusive twin of {@link min}. */
|
|
1116
|
-
moreThan?: number;
|
|
1117
|
-
/** Must be greater than zero. `0` is rejected — use `min: 0` to allow it. */
|
|
1118
|
-
positive?: boolean;
|
|
1119
|
-
/** Must be less than zero. `0` is rejected. */
|
|
1120
|
-
negative?: boolean;
|
|
1121
|
-
/** No fractional part. Does not change the column type; see `columnType`. */
|
|
1122
|
-
integer?: boolean;
|
|
1123
|
-
}
|
|
1124
|
-
/**
|
|
1125
|
-
* Validation rules for strings
|
|
1126
|
-
* @group Entity properties
|
|
1127
|
-
*/
|
|
1128
|
-
export interface StringPropertyValidationSchema extends PropertyValidationSchema {
|
|
1129
|
-
/** Exactly this many characters — a country code, a fixed-width reference. */
|
|
1130
|
-
length?: number;
|
|
1131
|
-
/** Fewest characters accepted, inclusive. */
|
|
1132
|
-
min?: number;
|
|
1133
|
-
/**
|
|
1134
|
-
* Most characters accepted, inclusive.
|
|
1135
|
-
*
|
|
1136
|
-
* Also sizes the column: a `max` turns `TEXT` into `VARCHAR(max)`, so
|
|
1137
|
-
* lowering it on a table that already has longer rows is a migration the
|
|
1138
|
-
* database will refuse, not just a stricter form.
|
|
1139
|
-
*/
|
|
1140
|
-
max?: number;
|
|
1141
|
-
/**
|
|
1142
|
-
* A pattern the whole value must match.
|
|
1143
|
-
*
|
|
1144
|
-
* A `string` is compiled per request, so it must be a valid regular
|
|
1145
|
-
* expression — one that will not compile is rejected at boot, because
|
|
1146
|
-
* `toPattern` answers `undefined` for it and the caller reads
|
|
1147
|
-
* `if (pattern && !pattern.test(value))`: the rule would silently become no
|
|
1148
|
-
* rule. A `RegExp` literal has already been compiled by the engine.
|
|
1149
|
-
*/
|
|
1150
|
-
matches?: string | RegExp;
|
|
1151
|
-
/**
|
|
1152
|
-
* Message displayed when the input does not satisfy the regex in `matches`
|
|
1153
|
-
*/
|
|
1154
|
-
matchesMessage?: string;
|
|
1155
|
-
/**
|
|
1156
|
-
* Strip leading and trailing whitespace **before** saving.
|
|
1157
|
-
*
|
|
1158
|
-
* A transform, not a check: it changes the value that is written, which is
|
|
1159
|
-
* what makes it the fix for "the same tag twice, one with a trailing space".
|
|
1160
|
-
*
|
|
1161
|
-
* **Admin form only — not enforced by the API or the database.** The panel
|
|
1162
|
-
* applies it on its way to the API; a value written any other way arrives
|
|
1163
|
-
* as it was sent. A transform that must always happen is a `beforeSave`
|
|
1164
|
-
* callback, which runs on the server for every write.
|
|
1165
|
-
*/
|
|
1166
|
-
trim?: boolean;
|
|
1167
|
-
/**
|
|
1168
|
-
* Lowercase the value before saving. A transform, like {@link trim}.
|
|
1169
|
-
*
|
|
1170
|
-
* **Admin form only — not enforced by the API or the database.**
|
|
1171
|
-
*/
|
|
1172
|
-
lowercase?: boolean;
|
|
1173
|
-
/**
|
|
1174
|
-
* Uppercase the value before saving. A transform, like {@link trim}.
|
|
1175
|
-
*
|
|
1176
|
-
* **Admin form only — not enforced by the API or the database.**
|
|
1177
|
-
*/
|
|
1178
|
-
uppercase?: boolean;
|
|
1179
|
-
}
|
|
1180
|
-
/**
|
|
1181
|
-
* Validation rules for dates
|
|
1182
|
-
* @group Entity properties
|
|
1183
|
-
*/
|
|
1184
|
-
export interface DatePropertyValidationSchema extends PropertyValidationSchema {
|
|
1185
|
-
/** Earliest accepted date, inclusive. A fixed instant, not "today". */
|
|
1186
|
-
min?: Date;
|
|
1187
|
-
/** Latest accepted date, inclusive. A fixed instant, not "today". */
|
|
1188
|
-
max?: Date;
|
|
1189
|
-
}
|
|
1190
|
-
/**
|
|
1191
|
-
* Validation rules for arrays
|
|
1192
|
-
* @group Entity properties
|
|
1193
|
-
*/
|
|
1194
|
-
export interface ArrayPropertyValidationSchema extends PropertyValidationSchema {
|
|
1195
|
-
/** Fewest elements accepted, inclusive. Counts elements, not characters. */
|
|
1196
|
-
min?: number;
|
|
1197
|
-
/** Most elements accepted, inclusive. Counts elements, not characters. */
|
|
1198
|
-
max?: number;
|
|
1199
|
-
}
|
|
1200
|
-
/**
|
|
1201
|
-
* Additional configuration related to Storage related fields
|
|
1202
|
-
* @group Entity properties
|
|
1203
|
-
*/
|
|
1204
|
-
export type StorageConfig = {
|
|
1205
|
-
/**
|
|
1206
|
-
* Key referencing a named storage backend from the StorageRegistry.
|
|
1207
|
-
* Must match a `StorageSourceDefinition.key` or a key registered
|
|
1208
|
-
* in `initializeRebaseBackend({ storage: { ... } })`.
|
|
1209
|
-
*
|
|
1210
|
-
* When omitted, the default storage source is used.
|
|
1211
|
-
*
|
|
1212
|
-
* A string key, or the handle `bucket("media")` returned — the handle is
|
|
1213
|
-
* the same name spelled once, and `defineCollection` records its key.
|
|
1214
|
-
*/
|
|
1215
|
-
storageSource?: ResourceRef;
|
|
1216
|
-
/**
|
|
1217
|
-
* Store files for this property as **public**: they are placed under the
|
|
1218
|
-
* public prefix and served via stable, token-less, permanent, CDN-cacheable
|
|
1219
|
-
* URLs (safe to persist and hotlink). Use for public assets like avatars or
|
|
1220
|
-
* storefront images. Defaults to `false` (private, short-lived signed URLs).
|
|
1221
|
-
*/
|
|
1222
|
-
public?: boolean;
|
|
1223
|
-
/**
|
|
1224
|
-
* File MIME types that can be uploaded to this reference. Don't specify for
|
|
1225
|
-
* all.
|
|
1226
|
-
* Note that you can also use the asterisk notation, so `image/*`
|
|
1227
|
-
* accepts any image file, and so on.
|
|
1228
|
-
*/
|
|
1229
|
-
acceptedFiles?: FileType[];
|
|
1230
|
-
/**
|
|
1231
|
-
* Advanced image resizing and cropping configuration.
|
|
1232
|
-
* Applied before upload to optimize storage and bandwidth.
|
|
1233
|
-
* Only applies to image MIME types: image/jpeg, image/png, image/webp
|
|
1234
|
-
*
|
|
1235
|
-
* **Admin form only — not enforced by the API or the database.** The
|
|
1236
|
-
* resizing happens in the browser, before the bytes are sent. An upload
|
|
1237
|
-
* that does not go through the panel is stored at its original size.
|
|
1238
|
-
*/
|
|
1239
|
-
imageResize?: ImageResize;
|
|
1240
|
-
/**
|
|
1241
|
-
* Specific metadata set in your uploaded file.
|
|
1242
|
-
* For the default Firebase implementation, the values passed here are of type
|
|
1243
|
-
* `firebase.storage.UploadMetadata`
|
|
1244
|
-
*/
|
|
1245
|
-
metadata?: Record<string, unknown>;
|
|
1246
|
-
/**
|
|
1247
|
-
* You can use this prop to customize the uploaded filename.
|
|
1248
|
-
* You can use a function as a callback or a string where you
|
|
1249
|
-
* specify some placeholders that get replaced with the corresponding values.
|
|
1250
|
-
* - `{file}` - Full file name
|
|
1251
|
-
* - `{file.name}` - Name of the file without extension
|
|
1252
|
-
* - `{file.ext}` - Extension of the file
|
|
1253
|
-
* - `{rand}` - Random value used to avoid name collisions
|
|
1254
|
-
* - `{id}` - The record's id (`{entityId}` is read the same)
|
|
1255
|
-
* - `{propertyKey}` - ID of this property
|
|
1256
|
-
* - `{path}` - Path of this entity
|
|
1257
|
-
*
|
|
1258
|
-
* **Admin form only — not enforced by the API or the database.** The panel's
|
|
1259
|
-
* uploader resolves it; `client.storage.upload()` names its own `key`.
|
|
1260
|
-
*
|
|
1261
|
-
* @param context
|
|
1262
|
-
*/
|
|
1263
|
-
fileName?: string | ((context: UploadedFileContext) => string | Promise<string>);
|
|
1264
|
-
/**
|
|
1265
|
-
* Absolute path in your bucket.
|
|
1266
|
-
*
|
|
1267
|
-
* You can use a function as a callback or a string where you
|
|
1268
|
-
* specify some placeholders that get replaced with the corresponding values.
|
|
1269
|
-
* - `{file}` - Full file name
|
|
1270
|
-
* - `{file.name}` - Name of the file without extension
|
|
1271
|
-
* - `{file.ext}` - Extension of the file
|
|
1272
|
-
* - `{rand}` - Random value used to avoid name collisions
|
|
1273
|
-
* - `{id}` - The record's id (`{entityId}` is read the same)
|
|
1274
|
-
* - `{propertyKey}` - ID of this property
|
|
1275
|
-
* - `{path}` - Path of this entity
|
|
1276
|
-
*
|
|
1277
|
-
* **Admin form only — not enforced by the API or the database.** Required
|
|
1278
|
-
* on the type because a file field in the panel has to put the object
|
|
1279
|
-
* somewhere, but it is the panel's uploader that resolves it. Nothing on
|
|
1280
|
-
* the server confines an upload to this prefix — that is what a storage
|
|
1281
|
-
* authorization rule is for.
|
|
1282
|
-
*/
|
|
1283
|
-
storagePath: string | ((context: UploadedFileContext) => string);
|
|
1284
|
-
/**
|
|
1285
|
-
* When set to true, this flag indicates that the bucket name will be
|
|
1286
|
-
* included in the saved storage path.
|
|
1287
|
-
*
|
|
1288
|
-
* E.g. `s3://my-bucket/path/to/file.png` instead of just `path/to/file.png`
|
|
1289
|
-
*
|
|
1290
|
-
* Defaults to false.
|
|
1291
|
-
*/
|
|
1292
|
-
includeBucketUrl?: boolean;
|
|
1293
|
-
/**
|
|
1294
|
-
* When set to true, this flag indicates that the download URL of the file
|
|
1295
|
-
* will be saved in the driver, instead of the storage path.
|
|
1296
|
-
*
|
|
1297
|
-
* Note that the generated URL may use a token that, if disabled, may
|
|
1298
|
-
* make the URL unusable and lose the original reference to Cloud Storage,
|
|
1299
|
-
* so it is not encouraged to use this flag.
|
|
1300
|
-
*
|
|
1301
|
-
* Defaults to false.
|
|
1302
|
-
*/
|
|
1303
|
-
storeUrl?: boolean;
|
|
1304
|
-
/**
|
|
1305
|
-
* Define maximal file size in bytes
|
|
1306
|
-
*/
|
|
1307
|
-
maxSize?: number;
|
|
1308
|
-
/**
|
|
1309
|
-
* Use this callback to process the file before uploading it to the storage.
|
|
1310
|
-
* If nothing is returned, the file is uploaded as it is.
|
|
1311
|
-
*
|
|
1312
|
-
* **Admin form only — not enforced by the API or the database.** It runs in
|
|
1313
|
-
* the browser, on the file the reader picked.
|
|
1314
|
-
*
|
|
1315
|
-
* @param file
|
|
1316
|
-
*/
|
|
1317
|
-
processFile?: (file: File) => Promise<File> | undefined;
|
|
1318
|
-
/**
|
|
1319
|
-
* Postprocess the saved value (storage path or URL)
|
|
1320
|
-
* after it has been resolved.
|
|
1321
|
-
*
|
|
1322
|
-
* **Admin form only — not enforced by the API or the database.**
|
|
1323
|
-
*/
|
|
1324
|
-
postProcess?: (pathOrUrl: string) => Promise<string>;
|
|
1325
|
-
/**
|
|
1326
|
-
* You can use this prop in order to provide a custom preview URL.
|
|
1327
|
-
* Useful when the file's path is different from the original field value
|
|
1328
|
-
*
|
|
1329
|
-
* **Admin form only — not enforced by the API or the database.** It changes
|
|
1330
|
-
* what the panel renders, never what is stored.
|
|
1331
|
-
*/
|
|
1332
|
-
previewUrl?: (fileName: string) => string;
|
|
1333
|
-
};
|
|
1334
|
-
/**
|
|
1335
|
-
* @group Entity properties
|
|
1336
|
-
*/
|
|
1337
|
-
export interface UploadedFileContext {
|
|
1338
|
-
/**
|
|
1339
|
-
* Uploaded file
|
|
1340
|
-
*/
|
|
1341
|
-
file: File;
|
|
1342
|
-
/**
|
|
1343
|
-
* Property field name
|
|
1344
|
-
*/
|
|
1345
|
-
propertyKey: string;
|
|
1346
|
-
/**
|
|
1347
|
-
* Property related to this upload
|
|
1348
|
-
*/
|
|
1349
|
-
property: StringProperty | ArrayProperty;
|
|
1350
|
-
/**
|
|
1351
|
-
* The record's id; absent for one being created.
|
|
1352
|
-
*/
|
|
1353
|
-
id?: string | number;
|
|
1354
|
-
/**
|
|
1355
|
-
* @deprecated Use `id` instead.
|
|
1356
|
-
*/
|
|
1357
|
-
entityId?: string | number;
|
|
1358
|
-
/**
|
|
1359
|
-
* Entity path. E.g. `products/PID/locales`
|
|
1360
|
-
*/
|
|
1361
|
-
path?: string;
|
|
1362
|
-
/**
|
|
1363
|
-
* Values of the current entity
|
|
1364
|
-
*/
|
|
1365
|
-
values: EntityValues<any>;
|
|
1366
|
-
/**
|
|
1367
|
-
* Storage meta specified by the developer
|
|
1368
|
-
*/
|
|
1369
|
-
storage: StorageConfig;
|
|
1370
|
-
}
|
|
1371
|
-
/**
|
|
1372
|
-
* MIME types for storage fields
|
|
1373
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
|
1374
|
-
* @group Entity properties
|
|
1375
|
-
*/
|
|
1376
|
-
export type FileType = "image/*" | "video/*" | "audio/*" | "application/*" | "text/*" | "font/*" | string;
|
|
1377
|
-
export interface ImageResize {
|
|
1378
|
-
/**
|
|
1379
|
-
* Maximum width in pixels. Image will be scaled down proportionally if wider.
|
|
1380
|
-
*/
|
|
1381
|
-
maxWidth?: number;
|
|
1382
|
-
/**
|
|
1383
|
-
* Maximum height in pixels. Image will be scaled down proportionally if taller.
|
|
1384
|
-
*/
|
|
1385
|
-
maxHeight?: number;
|
|
1386
|
-
/**
|
|
1387
|
-
* Resize mode determines how the image fits within maxWidth/maxHeight bounds.
|
|
1388
|
-
* - `contain`: Scale down to fit within bounds, preserving aspect ratio (default)
|
|
1389
|
-
* - `cover`: Scale to fill bounds, preserving aspect ratio (may crop)
|
|
1390
|
-
*/
|
|
1391
|
-
mode?: "contain" | "cover";
|
|
1392
|
-
/**
|
|
1393
|
-
* Output format for the resized image.
|
|
1394
|
-
* - `original`: Keep the original format (default)
|
|
1395
|
-
* - `jpeg`: Convert to JPEG
|
|
1396
|
-
* - `png`: Convert to PNG
|
|
1397
|
-
* - `webp`: Convert to WebP
|
|
1398
|
-
*/
|
|
1399
|
-
format?: "original" | "jpeg" | "png" | "webp";
|
|
1400
|
-
/**
|
|
1401
|
-
* Quality for lossy formats (JPEG, WebP). Number between 0 and 100.
|
|
1402
|
-
* Higher is better quality but larger file size. Defaults to 80.
|
|
1403
|
-
*/
|
|
1404
|
-
quality?: number;
|
|
1405
|
-
}
|
|
1406
|
-
/**
|
|
1407
|
-
* A JSON Logic rule that gets evaluated at runtime.
|
|
1408
|
-
* @see https://jsonlogic.com/
|
|
1409
|
-
*
|
|
1410
|
-
* Common operators:
|
|
1411
|
-
* - Comparison: ==, !=, ===, !==, >, <, >=, <=
|
|
1412
|
-
* - Logic: and, or, !, !!
|
|
1413
|
-
* - Data access: var, missing, missing_some
|
|
1414
|
-
* - Array: in, map, filter, reduce, all, some, none, merge
|
|
1415
|
-
* - String: substr, cat
|
|
1416
|
-
* - Numeric: +, -, *, /, %, min, max
|
|
1417
|
-
*
|
|
1418
|
-
* Custom operators:
|
|
1419
|
-
* - hasRole(roleId) - check if user has role by ID
|
|
1420
|
-
* - hasAnyRole([roleIds]) - check if user has any of the roles
|
|
1421
|
-
* - isToday(timestamp) - check if timestamp is today
|
|
1422
|
-
* - isPast(timestamp) - check if timestamp is in the past
|
|
1423
|
-
* - isFuture(timestamp) - check if timestamp is in the future
|
|
1424
|
-
*
|
|
1425
|
-
* @group Entity properties
|
|
1426
|
-
*/
|
|
1427
|
-
export type JsonLogicRule = Record<string, any>;
|
|
1428
|
-
/**
|
|
1429
|
-
* A condition that is either a JSON Logic rule or a literal answer.
|
|
1430
|
-
*
|
|
1431
|
-
* The unconditional case is the common one — "this field is never editable",
|
|
1432
|
-
* "this field is never shown" — and with only a rule accepted it had to be
|
|
1433
|
-
* spelled `{ "==": [1, 1] }`, which reads as a puzzle at the call site. A plain
|
|
1434
|
-
* `true` says the same thing.
|
|
1435
|
-
*
|
|
1436
|
-
* @group Entity properties
|
|
1437
|
-
*/
|
|
1438
|
-
export type ConditionRule = JsonLogicRule | boolean;
|
|
1439
|
-
/**
|
|
1440
|
-
* Conditions for individual enum values within a property.
|
|
1441
|
-
* @group Entity properties
|
|
1442
|
-
*/
|
|
1443
|
-
export interface EnumValueConditions {
|
|
1444
|
-
/**
|
|
1445
|
-
* Disable this enum option when condition is true.
|
|
1446
|
-
* The option appears grayed out and cannot be selected.
|
|
1447
|
-
*/
|
|
1448
|
-
disabled?: JsonLogicRule;
|
|
1449
|
-
/**
|
|
1450
|
-
* Message explaining why this option is disabled.
|
|
1451
|
-
*/
|
|
1452
|
-
disabledMessage?: string;
|
|
1453
|
-
/**
|
|
1454
|
-
* Completely hide this enum option when condition is true.
|
|
1455
|
-
* The option is removed from the dropdown/list.
|
|
1456
|
-
*/
|
|
1457
|
-
hidden?: JsonLogicRule;
|
|
1458
|
-
}
|
|
1459
|
-
/**
|
|
1460
|
-
* Declarative conditions for dynamic property behavior.
|
|
1461
|
-
* All conditions are JSON Logic rules evaluated against ConditionContext.
|
|
1462
|
-
*
|
|
1463
|
-
* An alternative to PropertyBuilder functions that can be:
|
|
1464
|
-
* - Stored in the database as JSON
|
|
1465
|
-
* - Edited via the collection editor UI
|
|
1466
|
-
* - Evaluated at runtime like property builders
|
|
1467
|
-
*
|
|
1468
|
-
* @see https://jsonlogic.com/ for JSON Logic syntax
|
|
1469
|
-
* @group Entity properties
|
|
1470
|
-
*/
|
|
1471
|
-
export interface PropertyConditions {
|
|
1472
|
-
/**
|
|
1473
|
-
* Disable the field when this condition evaluates to true.
|
|
1474
|
-
* The field becomes non-editable but still visible (unless also hidden).
|
|
1475
|
-
*
|
|
1476
|
-
* @example Disable when another field has a specific value
|
|
1477
|
-
* \`\`\`json
|
|
1478
|
-
* { "==": [{ "var": "values.status" }, "archived"] }
|
|
1479
|
-
* \`\`\`
|
|
1480
|
-
*
|
|
1481
|
-
* A literal `true` disables it unconditionally.
|
|
1482
|
-
*/
|
|
1483
|
-
disabled?: ConditionRule;
|
|
1484
|
-
/**
|
|
1485
|
-
* Message to display when the field is disabled by a condition.
|
|
1486
|
-
*/
|
|
1487
|
-
disabledMessage?: string;
|
|
1488
|
-
/**
|
|
1489
|
-
* Clear the field's value when it becomes disabled.
|
|
1490
|
-
* @default false
|
|
1491
|
-
*/
|
|
1492
|
-
clearOnDisabled?: boolean;
|
|
1493
|
-
/**
|
|
1494
|
-
* Hide the field completely when this condition evaluates to true.
|
|
1495
|
-
* The field is removed from the form (not just visually hidden).
|
|
1496
|
-
*
|
|
1497
|
-
* A literal `true` hides it unconditionally. This is the way to keep a
|
|
1498
|
-
* property out of the form without keeping it out of the collection.
|
|
1499
|
-
*/
|
|
1500
|
-
hidden?: ConditionRule;
|
|
1501
|
-
/**
|
|
1502
|
-
* Make the field read-only when this condition evaluates to true.
|
|
1503
|
-
* Renders as a preview instead of an input.
|
|
1504
|
-
*
|
|
1505
|
-
* A literal `true` makes it read-only unconditionally.
|
|
1506
|
-
*/
|
|
1507
|
-
readOnly?: ConditionRule;
|
|
1508
|
-
/**
|
|
1509
|
-
* Make the field required when this condition evaluates to true.
|
|
1510
|
-
* Overrides the static `validation.required` setting.
|
|
1511
|
-
*
|
|
1512
|
-
* A literal `true` makes it required unconditionally.
|
|
1513
|
-
*/
|
|
1514
|
-
required?: ConditionRule;
|
|
1515
|
-
/**
|
|
1516
|
-
* Custom message when conditional required validation fails.
|
|
1517
|
-
*/
|
|
1518
|
-
requiredMessage?: string;
|
|
1519
|
-
/**
|
|
1520
|
-
* Dynamic minimum value for number/string length.
|
|
1521
|
-
* A number, or a rule that evaluates to one.
|
|
1522
|
-
*/
|
|
1523
|
-
min?: number | JsonLogicRule;
|
|
1524
|
-
/**
|
|
1525
|
-
* Dynamic maximum value for number/string length.
|
|
1526
|
-
* A number, or a rule that evaluates to one.
|
|
1527
|
-
*/
|
|
1528
|
-
max?: number | JsonLogicRule;
|
|
1529
|
-
/**
|
|
1530
|
-
* Dynamic default value for new entities.
|
|
1531
|
-
* Should evaluate to a value of the appropriate type for the field.
|
|
1532
|
-
* Only applied when entityId is empty (new entity).
|
|
1533
|
-
*/
|
|
1534
|
-
defaultValue?: JsonLogicRule;
|
|
1535
|
-
/**
|
|
1536
|
-
* Conditions for individual enum values.
|
|
1537
|
-
* Keys are the enum value IDs, values are condition configs.
|
|
1538
|
-
*
|
|
1539
|
-
* @example Disable certain enum options based on user role
|
|
1540
|
-
* \`\`\`json
|
|
1541
|
-
* {
|
|
1542
|
-
* "admin": {
|
|
1543
|
-
* "disabled": { "!": { "hasRole": "admin" } },
|
|
1544
|
-
* "disabledMessage": "Admin option requires admin role"
|
|
1545
|
-
* }
|
|
1546
|
-
* }
|
|
1547
|
-
* \`\`\`
|
|
1548
|
-
*/
|
|
1549
|
-
enumConditions?: Record<string | number, EnumValueConditions>;
|
|
1550
|
-
/**
|
|
1551
|
-
* Filter which enum values are available.
|
|
1552
|
-
* Should evaluate to an array of allowed enum value IDs.
|
|
1553
|
-
*/
|
|
1554
|
-
allowedEnumValues?: JsonLogicRule;
|
|
1555
|
-
/**
|
|
1556
|
-
* Exclude specific enum values.
|
|
1557
|
-
* Should evaluate to an array of enum value IDs to exclude.
|
|
1558
|
-
*/
|
|
1559
|
-
excludedEnumValues?: JsonLogicRule;
|
|
1560
|
-
/**
|
|
1561
|
-
* Dynamic path for reference properties.
|
|
1562
|
-
* Should evaluate to a collection path string.
|
|
1563
|
-
*/
|
|
1564
|
-
referencePath?: JsonLogicRule;
|
|
1565
|
-
/**
|
|
1566
|
-
* Dynamic filter for reference selection.
|
|
1567
|
-
* Should evaluate to a FilterValues object.
|
|
1568
|
-
*/
|
|
1569
|
-
referenceFilter?: JsonLogicRule;
|
|
1570
|
-
/**
|
|
1571
|
-
* Can elements be added to the array?
|
|
1572
|
-
*/
|
|
1573
|
-
canAddElements?: JsonLogicRule;
|
|
1574
|
-
/**
|
|
1575
|
-
* Can elements be reordered in the array?
|
|
1576
|
-
*/
|
|
1577
|
-
sortable?: JsonLogicRule;
|
|
1578
|
-
/**
|
|
1579
|
-
* Dynamic accepted file types.
|
|
1580
|
-
* Should evaluate to an array of MIME types.
|
|
1581
|
-
*/
|
|
1582
|
-
acceptedFiles?: JsonLogicRule;
|
|
1583
|
-
/**
|
|
1584
|
-
* Dynamic maximum file size in bytes.
|
|
1585
|
-
* A number, or a rule that evaluates to one.
|
|
1586
|
-
*/
|
|
1587
|
-
maxFileSize?: number | JsonLogicRule;
|
|
1588
|
-
}
|
|
1589
|
-
/**
|
|
1590
|
-
* Context available during JSON Logic condition evaluation.
|
|
1591
|
-
* Mirrors PropertyBuilderProps but adapted for JSON serialization.
|
|
1592
|
-
* @group Entity properties
|
|
1593
|
-
*/
|
|
1594
|
-
export interface ConditionContext {
|
|
1595
|
-
/**
|
|
1596
|
-
* Current form/entity values.
|
|
1597
|
-
* Date values are converted to Unix timestamps (milliseconds).
|
|
1598
|
-
*/
|
|
1599
|
-
values: Record<string, unknown>;
|
|
1600
|
-
/**
|
|
1601
|
-
* Previous values before the current edit session.
|
|
1602
|
-
*/
|
|
1603
|
-
previousValues: Record<string, unknown>;
|
|
1604
|
-
/**
|
|
1605
|
-
* Current value of this property specifically.
|
|
1606
|
-
*/
|
|
1607
|
-
propertyValue: unknown;
|
|
1608
|
-
/**
|
|
1609
|
-
* Collection path (e.g., "products", "users/uid123/orders")
|
|
1610
|
-
*/
|
|
1611
|
-
path: string;
|
|
1612
|
-
/**
|
|
1613
|
-
* Entity ID. Undefined for new entities.
|
|
1614
|
-
*/
|
|
1615
|
-
entityId?: string;
|
|
1616
|
-
/**
|
|
1617
|
-
* Whether this is a new entity being created.
|
|
1618
|
-
*/
|
|
1619
|
-
isNew: boolean;
|
|
1620
|
-
/**
|
|
1621
|
-
* Index of this property (only for array items).
|
|
1622
|
-
*/
|
|
1623
|
-
index?: number;
|
|
1624
|
-
/**
|
|
1625
|
-
* Current authenticated user information.
|
|
1626
|
-
*/
|
|
1627
|
-
user: {
|
|
1628
|
-
uid: string;
|
|
1629
|
-
email: string | null;
|
|
1630
|
-
displayName: string | null;
|
|
1631
|
-
photoURL: string | null;
|
|
1632
|
-
/** Role IDs the user has (extracted from Role[].id) */
|
|
1633
|
-
roles: string[];
|
|
1634
|
-
};
|
|
1635
|
-
/**
|
|
1636
|
-
* Current timestamp as Unix milliseconds.
|
|
1637
|
-
*/
|
|
1638
|
-
now: number;
|
|
1639
|
-
}
|
|
1640
|
-
export {};
|