@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,783 +0,0 @@
|
|
|
1
|
-
import type { CollectionCallbacks } from "./entity_callbacks.js";
|
|
2
|
-
import type { Properties, PostgresProperties, FirebaseProperties, MongoProperties } from "./properties.js";
|
|
3
|
-
import type { User } from "../users/index.js";
|
|
4
|
-
import type { EmailSendResult } from "../controllers/email.js";
|
|
5
|
-
import type { Relation } from "./relations.js";
|
|
6
|
-
import type { SecurityRule } from "./security_rules.js";
|
|
7
|
-
import type { RoleDefinition, ScopeDefinition } from "./scopes.js";
|
|
8
|
-
import type { SearchConfig } from "./search.js";
|
|
9
|
-
import type { CollectionIndex } from "./indexes.js";
|
|
10
|
-
import type { CollectionTenantConfig } from "./tenancy.js";
|
|
11
|
-
/**
|
|
12
|
-
* Base interface containing all driver-agnostic collection properties.
|
|
13
|
-
* Use {@link PostgresCollectionConfig} or {@link FirebaseCollectionConfig} for
|
|
14
|
-
* driver-specific type safety, or {@link CollectionConfig} when you
|
|
15
|
-
* need to handle any collection regardless of backend.
|
|
16
|
-
*
|
|
17
|
-
* @group Models
|
|
18
|
-
*/
|
|
19
|
-
export interface BaseCollectionConfig<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> {
|
|
20
|
-
/**
|
|
21
|
-
* The collection's identity. Required, and the value nearly everything else
|
|
22
|
-
* keys on:
|
|
23
|
-
*
|
|
24
|
-
* - the REST path — `/api/data/<slug>`
|
|
25
|
-
* - the SDK accessor — `client.data.<slug>` / `client.data.collection("<slug>")`
|
|
26
|
-
* - the admin panel's URL
|
|
27
|
-
* - the target of a `reference` or `relation` property
|
|
28
|
-
*
|
|
29
|
-
* Conventionally kebab-case and plural (`blog-posts`). It is independent of
|
|
30
|
-
* {@link table}: the slug is what callers say, the table is where the rows
|
|
31
|
-
* live, and renaming one does not rename the other.
|
|
32
|
-
*
|
|
33
|
-
* Treat it as frozen once anything has shipped against it — changing a slug
|
|
34
|
-
* changes every URL and every generated accessor at once.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* defineCollection({
|
|
38
|
-
* slug: "blog-posts", // /api/data/blog-posts, client.data.blogPosts
|
|
39
|
-
* table: "posts",
|
|
40
|
-
* properties: { … }
|
|
41
|
-
* })
|
|
42
|
-
*/
|
|
43
|
-
slug: string;
|
|
44
|
-
/**
|
|
45
|
-
* Name of the collection, typically plural.
|
|
46
|
-
* E.g. `Products`, `Blog`
|
|
47
|
-
*/
|
|
48
|
-
name: string;
|
|
49
|
-
/**
|
|
50
|
-
* Singular name of an entry in this collection
|
|
51
|
-
* E.g. `Product`, `Blog entry`
|
|
52
|
-
*/
|
|
53
|
-
singularName?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Optional description of this view. You can use Markdown.
|
|
56
|
-
*/
|
|
57
|
-
description?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Child collections nested under entities of this collection.
|
|
60
|
-
* Populated automatically during normalization from driver-specific fields
|
|
61
|
-
* (e.g. Firebase `subcollections`, Postgres `relations` with many-cardinality).
|
|
62
|
-
*
|
|
63
|
-
* Custom drivers can set this directly to expose child collections to the UI.
|
|
64
|
-
*/
|
|
65
|
-
childCollections?: () => CollectionConfig<Record<string, unknown>>[];
|
|
66
|
-
/**
|
|
67
|
-
* The data source this collection belongs to — the routing key shared by
|
|
68
|
-
* the frontend router and the backend driver registry. It points at a
|
|
69
|
-
* {@link DataSourceDefinition} registered on `<Rebase dataSources>` (front)
|
|
70
|
-
* and `initializeRebaseBackend({ dataSources })` (back).
|
|
71
|
-
*
|
|
72
|
-
* If not specified, the default data source `"(default)"` is used, which
|
|
73
|
-
* for a standard Rebase app is the server-mediated Postgres backend.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* // Default data source (server-mediated Postgres)
|
|
77
|
-
* { slug: "products" }
|
|
78
|
-
*
|
|
79
|
-
* // A direct-transport Firestore data source registered as "analytics"
|
|
80
|
-
* { slug: "events", dataSource: "analytics" }
|
|
81
|
-
*
|
|
82
|
-
* // The same, spelled once — `defineCollection` accepts the handle
|
|
83
|
-
* // `database("analytics")` returned and records its key here.
|
|
84
|
-
* import { analytics } from "../resources";
|
|
85
|
-
* defineCollection({ slug: "events", dataSource: analytics, … })
|
|
86
|
-
*
|
|
87
|
-
* A string on the recorded collection, because a collection is data past
|
|
88
|
-
* `defineCollection`: it serialises, it compares with `===`, and it reaches
|
|
89
|
-
* the admin UI over the wire, none of which a handle survives.
|
|
90
|
-
*/
|
|
91
|
-
dataSource?: string;
|
|
92
|
-
/**
|
|
93
|
-
* The database engine backing this collection (`"postgres"`, `"firestore"`,
|
|
94
|
-
* `"mongodb"`, or a custom id).
|
|
95
|
-
*
|
|
96
|
-
* On concrete collection types ({@link PostgresCollectionConfig},
|
|
97
|
-
* {@link FirebaseCollectionConfig}, {@link MongoDBCollectionConfig}) this is a literal
|
|
98
|
-
* discriminant. On the base type it is optional and gets stamped
|
|
99
|
-
* automatically during collection normalization from the registered
|
|
100
|
-
* {@link DataSourceDefinition}.
|
|
101
|
-
*
|
|
102
|
-
* Prefer setting {@link dataSource} and letting the engine be resolved.
|
|
103
|
-
*/
|
|
104
|
-
engine?: string;
|
|
105
|
-
/**
|
|
106
|
-
* Which database within the engine.
|
|
107
|
-
* - For Firestore: The Firestore database ID (e.g., for multi-database projects)
|
|
108
|
-
* - For PostgreSQL: Schema or database name
|
|
109
|
-
* - For MongoDB: Database name
|
|
110
|
-
*
|
|
111
|
-
* If not specified, the default database of the engine is used. Resolved
|
|
112
|
-
* from the collection's {@link DataSourceDefinition} when omitted here.
|
|
113
|
-
*/
|
|
114
|
-
databaseId?: string;
|
|
115
|
-
/**
|
|
116
|
-
* Set of properties that compose a entity
|
|
117
|
-
*/
|
|
118
|
-
properties: Properties;
|
|
119
|
-
/**
|
|
120
|
-
* Mark this collection as an authentication collection.
|
|
121
|
-
* When true, this collection is used for user management, login, password hashing, and invitation flows.
|
|
122
|
-
*/
|
|
123
|
-
auth?: boolean | AuthCollectionConfig;
|
|
124
|
-
/**
|
|
125
|
-
* Row-level authorization rules for this collection.
|
|
126
|
-
*
|
|
127
|
-
* Driver-agnostic on purpose, unlike `disableDefaultPolicies`, `table` and
|
|
128
|
-
* `relations`, which are declared on {@link PostgresCollectionConfig} only.
|
|
129
|
-
* The rules are a *contract* — who may read or write which rows — and each
|
|
130
|
-
* engine enforces it its own way:
|
|
131
|
-
*
|
|
132
|
-
* - **Postgres** compiles them to real `CREATE POLICY` statements and lets
|
|
133
|
-
* the database enforce them (see {@link PostgresCollectionConfig.securityRules},
|
|
134
|
-
* which narrows this with the raw-SQL details).
|
|
135
|
-
* - **MongoDB** translates them into a query filter it AND-s into every
|
|
136
|
-
* read and write, honouring `access`, `ownerField`, `roles`, `mode` and
|
|
137
|
-
* the `operation`/`operations` selectors, and making a best effort at raw
|
|
138
|
-
* `using`/`withCheck` SQL.
|
|
139
|
-
* - **Firestore** does not implement them at all; its own rules language is
|
|
140
|
-
* evaluated by Google, not from here. `supportsRLS` on
|
|
141
|
-
* {@link DataSourceCapabilities} reports which engines generate policies,
|
|
142
|
-
* which is not the same question as whether an engine honours a rule.
|
|
143
|
-
*/
|
|
144
|
-
securityRules?: readonly SecurityRule[];
|
|
145
|
-
/**
|
|
146
|
-
* This interface defines all the callbacks that can be used when a entity
|
|
147
|
-
* is being created, updated or deleted.
|
|
148
|
-
* Useful for adding your own logic or blocking the execution of the operation.
|
|
149
|
-
*/
|
|
150
|
-
readonly callbacks?: CollectionCallbacks<M, USER>;
|
|
151
|
-
/**
|
|
152
|
-
* User id of the owner of this collection. This is used only by plugins, or if you
|
|
153
|
-
* are writing custom code
|
|
154
|
-
*
|
|
155
|
-
* **Admin form only — not enforced by the API or the database.** The
|
|
156
|
-
* collection editor stamps it on a collection it creates and shows it
|
|
157
|
-
* beside the name; nothing on the request path consults it. It is not an
|
|
158
|
-
* ownership check, and a collection with somebody else's id here is served
|
|
159
|
-
* to exactly the same callers as one with none.
|
|
160
|
-
*/
|
|
161
|
-
ownerId?: string;
|
|
162
|
-
/**
|
|
163
|
-
* Arbitrary key-value metadata for external consumers.
|
|
164
|
-
* Not interpreted by Rebase — passed through serialization unchanged.
|
|
165
|
-
* Used by domain apps to store custom per-collection config.
|
|
166
|
-
*/
|
|
167
|
-
metadata?: Record<string, unknown>;
|
|
168
|
-
/**
|
|
169
|
-
* If set to true, changes to the entity will be saved in a subcollection.
|
|
170
|
-
* This prop has no effect if the history plugin is not enabled
|
|
171
|
-
*/
|
|
172
|
-
history?: boolean;
|
|
173
|
-
/**
|
|
174
|
-
* Whether a write naming a field this collection does not declare is
|
|
175
|
-
* rejected with a 400. Defaults to `true`.
|
|
176
|
-
*
|
|
177
|
-
* Set to `false` where a column really does exist that the config never
|
|
178
|
-
* declared — populated by a trigger, or introspected rather than declared —
|
|
179
|
-
* and callers need to write it. The column still has to exist: the driver
|
|
180
|
-
* checks the key against the table's own columns whatever this is set to,
|
|
181
|
-
* because a key with no column behind it is not passed to the database and
|
|
182
|
-
* refused, it is dropped from the statement and answered 201.
|
|
183
|
-
*
|
|
184
|
-
* It does not let a typo through to Postgres for Postgres to judge. That is
|
|
185
|
-
* what this flag was documented as doing, and no such judgment ever
|
|
186
|
-
* happened.
|
|
187
|
-
*/
|
|
188
|
-
strictWrites?: boolean;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* The SQL view a collection serves. See {@link PostgresCollectionConfig.view}.
|
|
192
|
-
*
|
|
193
|
-
* @group Models
|
|
194
|
-
*/
|
|
195
|
-
export interface CollectionView {
|
|
196
|
-
/** The view's `SELECT`, as SQL. Its columns are the collection's properties. */
|
|
197
|
-
query: string;
|
|
198
|
-
/**
|
|
199
|
-
* Store the rows (`CREATE MATERIALIZED VIEW`) rather than run the query on
|
|
200
|
-
* every read. Refresh them with the collection's `refresh()`.
|
|
201
|
-
*/
|
|
202
|
-
materialized?: boolean;
|
|
203
|
-
/**
|
|
204
|
-
* Who may read a materialized view: callers holding one of these roles.
|
|
205
|
-
* Defaults to `["admin"]`, which `dataAsAdmin` and the server's own work
|
|
206
|
-
* hold. Ignored for a plain view, whose rows the base tables' policies
|
|
207
|
-
* decide.
|
|
208
|
-
*/
|
|
209
|
-
roles?: string[];
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* A collection backed by PostgreSQL (or any SQL database).
|
|
213
|
-
* Adds support for SQL-style relations (JOINs) and Row Level Security.
|
|
214
|
-
*
|
|
215
|
-
* Use this type instead of {@link CollectionConfig} when you want
|
|
216
|
-
* compile-time safety that only SQL-relevant fields appear.
|
|
217
|
-
*
|
|
218
|
-
* @group Models
|
|
219
|
-
*/
|
|
220
|
-
export interface PostgresCollectionConfig<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> extends BaseCollectionConfig<M, USER> {
|
|
221
|
-
properties: PostgresProperties;
|
|
222
|
-
/**
|
|
223
|
-
* The database engine for this collection. For Postgres collections this
|
|
224
|
-
* can be omitted (Postgres is the default) or set to `"postgres"`.
|
|
225
|
-
*/
|
|
226
|
-
engine?: "postgres" | undefined;
|
|
227
|
-
/**
|
|
228
|
-
* The PostgreSQL table name for this collection.
|
|
229
|
-
*
|
|
230
|
-
* Optional: it defaults to `toSnakeCase(slug)`, which is what
|
|
231
|
-
* `getTableName()` has always returned when it was absent. The type simply
|
|
232
|
-
* demanded what the runtime already derived, so the smallest collection
|
|
233
|
-
* anyone could write named its table twice —
|
|
234
|
-
* `{ slug: "todos", table: "todos", … }` — and "why do I write it twice"
|
|
235
|
-
* is the first question every evaluator asked.
|
|
236
|
-
*
|
|
237
|
-
* Set it only when the table name differs from the slug: an existing
|
|
238
|
-
* database whose table is `blog_posts` while the URL should stay `posts`.
|
|
239
|
-
*
|
|
240
|
-
* Note that a **derived** name is still a real name, and nothing yet warns
|
|
241
|
-
* when one moves. Foreign-key and junction column defaults are derived from
|
|
242
|
-
* the *slug* rather than from this field, so renaming a slug re-derives
|
|
243
|
-
* them on the next `db push` even where `table` is pinned.
|
|
244
|
-
*/
|
|
245
|
-
table?: string;
|
|
246
|
-
/**
|
|
247
|
-
* The PostgreSQL schema name for this table.
|
|
248
|
-
* E.g. "public", "rebase", "auth".
|
|
249
|
-
* If not specified, "public" is used (or the default search path).
|
|
250
|
-
*/
|
|
251
|
-
schema?: string;
|
|
252
|
-
/**
|
|
253
|
-
* Serve a SQL view instead of a table: the collection is read-only, and
|
|
254
|
-
* `db push` (and a managed boot) creates the view under `table` from
|
|
255
|
-
* `query`, recreating it when the query changes.
|
|
256
|
-
*
|
|
257
|
-
* The properties describe the view's columns, and one of them must be
|
|
258
|
-
* `isId`: a view has no primary key of its own.
|
|
259
|
-
*
|
|
260
|
-
* A plain view runs as the caller (`security_invoker`), so the policies of
|
|
261
|
-
* the tables it reads decide which rows each caller sees; `securityRules`
|
|
262
|
-
* do not apply to it. A materialized view stores its rows and has no
|
|
263
|
-
* row-level security at all, so it is served whole, and only to callers
|
|
264
|
-
* holding one of `roles`.
|
|
265
|
-
*
|
|
266
|
-
* ```ts
|
|
267
|
-
* view: {
|
|
268
|
-
* query: "SELECT lower(artist) AS artist, count(*)::int AS songs FROM songs GROUP BY 1",
|
|
269
|
-
* materialized: true
|
|
270
|
-
* }
|
|
271
|
-
* ```
|
|
272
|
-
*/
|
|
273
|
-
view?: CollectionView;
|
|
274
|
-
/**
|
|
275
|
-
* For SQL databases, you can define the relations between collections here.
|
|
276
|
-
* Relations describe JOINs, foreign keys, and junction tables.
|
|
277
|
-
*/
|
|
278
|
-
relations?: Relation[];
|
|
279
|
-
/**
|
|
280
|
-
* Security rules for this collection (PostgreSQL Row Level Security).
|
|
281
|
-
* When defined, the schema generator will enable RLS on the table and
|
|
282
|
-
* create the corresponding PostgreSQL policies.
|
|
283
|
-
*
|
|
284
|
-
* Supports three levels of expressiveness:
|
|
285
|
-
* 1. **Convenience shortcuts** — `ownerField`, `access`, `roles`
|
|
286
|
-
* 2. **Raw SQL** — `using` and `withCheck` for full PostgreSQL power
|
|
287
|
-
* 3. **Combined** — mix shortcuts with `roles` for common patterns
|
|
288
|
-
*
|
|
289
|
-
* The authenticated user context is available in raw SQL via:
|
|
290
|
-
* - `rebase.uid()` — the current user's ID
|
|
291
|
-
* - `rebase.roles()` — comma-separated app role IDs
|
|
292
|
-
* - `rebase.jwt()` — full JWT claims as JSONB
|
|
293
|
-
*/
|
|
294
|
-
securityRules?: readonly SecurityRule[];
|
|
295
|
-
/**
|
|
296
|
-
* Opt out of the framework's default Row Level Security policies.
|
|
297
|
-
*
|
|
298
|
-
* The schema generator automatically injects, for every collection, a
|
|
299
|
-
* baseline SELECT policy granting the trusted server context and the
|
|
300
|
-
* `admin` role read access (reads run under a restricted role, so RLS
|
|
301
|
-
* default-denies without it). For auth collections it additionally injects
|
|
302
|
-
* a self-read policy (`id = rebase.uid()`) and an admin-only write gate
|
|
303
|
-
* (INSERT/UPDATE/DELETE require the `admin` role or the trusted server
|
|
304
|
-
* context), making privileged columns such as `roles` safe by default.
|
|
305
|
-
*
|
|
306
|
-
* Author-defined `securityRules` are permissive and broaden access on top
|
|
307
|
-
* of these defaults. Set this flag to `true` to remove the defaults
|
|
308
|
-
* entirely and take full responsibility for the collection's RLS.
|
|
309
|
-
*
|
|
310
|
-
* @default false
|
|
311
|
-
*/
|
|
312
|
-
disableDefaultPolicies?: boolean;
|
|
313
|
-
/**
|
|
314
|
-
* Opt in to Postgres full-text search for this collection.
|
|
315
|
-
*
|
|
316
|
-
* Omit it and `.search()` keeps its existing behaviour exactly — an
|
|
317
|
-
* `ILIKE '%term%'` across top-level string properties. Declare it and the
|
|
318
|
-
* collection gains one generated `tsvector` column and a GIN index, and
|
|
319
|
-
* `.search()` compiles to a ranked `@@ websearch_to_tsquery` against them.
|
|
320
|
-
*
|
|
321
|
-
* Postgres-only, like {@link VectorProperty}: the block is rejected at boot
|
|
322
|
-
* on other engines rather than silently ignored.
|
|
323
|
-
*
|
|
324
|
-
* @see SearchConfig
|
|
325
|
-
*/
|
|
326
|
-
search?: SearchConfig;
|
|
327
|
-
/**
|
|
328
|
-
* Ordinary indexes on this collection's table.
|
|
329
|
-
*
|
|
330
|
-
* Collection-level, not per-property, because an index over two columns
|
|
331
|
-
* has no single property to hang on and a partial index has none at all —
|
|
332
|
-
* and because a second declaration site for the single-column case would
|
|
333
|
-
* put the same object in two places. An index's identity is a column list
|
|
334
|
-
* in an order; the single-column case is a degenerate one, not a special
|
|
335
|
-
* one.
|
|
336
|
-
*
|
|
337
|
-
* `VectorProperty.index` stays where it is: an ANN structure is a property
|
|
338
|
-
* of the column's type, not of a query.
|
|
339
|
-
*
|
|
340
|
-
* Postgres-only, like {@link SearchConfig}: refused on another engine
|
|
341
|
-
* rather than silently ignored.
|
|
342
|
-
*/
|
|
343
|
-
indexes?: readonly CollectionIndex<Extract<keyof M, string>>[];
|
|
344
|
-
/**
|
|
345
|
-
* Turn `delete` into "stamp a timestamp", and hide stamped rows from reads.
|
|
346
|
-
*
|
|
347
|
-
* With this on, a delete — single, bulk or through a nested path — sets the
|
|
348
|
-
* field to `now()` instead of issuing a `DELETE`, and every read filters
|
|
349
|
-
* `<field> IS NULL` by default: `find`, `findById`, `count`, aggregates, the
|
|
350
|
-
* realtime refetch, and the loading of this collection through a relation.
|
|
351
|
-
* A restore is an ordinary update setting the field back to `null`. A real
|
|
352
|
-
* `DELETE` is still available as `delete(…, { hard: true })` / `?hard=true`,
|
|
353
|
-
* and needs exactly the same permission an ordinary delete does — it is the
|
|
354
|
-
* same operation, and gating it separately would be a second access-control
|
|
355
|
-
* surface for one verb.
|
|
356
|
-
*
|
|
357
|
-
* `true` uses `deletedAt` (column `deleted_at`). The object form renames the
|
|
358
|
-
* field. **Either way the collection must declare that property itself**, as
|
|
359
|
-
* a `date` — this flag says what a column *means*, it does not conjure the
|
|
360
|
-
* column into existence. A config that turns it on without the property is
|
|
361
|
-
* refused at boot rather than at the first delete, because the failure would
|
|
362
|
-
* otherwise land on a caller trying to remove a row.
|
|
363
|
-
*
|
|
364
|
-
* The hooks do not change: `beforeDelete` can still veto and `afterDelete`
|
|
365
|
-
* still fires. From the application's point of view the row was deleted;
|
|
366
|
-
* how the table records that is this flag's business.
|
|
367
|
-
*
|
|
368
|
-
* Postgres-only, like {@link SearchConfig}.
|
|
369
|
-
*/
|
|
370
|
-
softDelete?: boolean | {
|
|
371
|
-
/**
|
|
372
|
-
* The `date` property that records the deletion. Defaults to
|
|
373
|
-
* `deletedAt`.
|
|
374
|
-
*/
|
|
375
|
-
field?: string;
|
|
376
|
-
};
|
|
377
|
-
/**
|
|
378
|
-
* Scope every row of this collection to a tenant.
|
|
379
|
-
*
|
|
380
|
-
* One declaration replaces the four hand-written pieces a tenant-scoped
|
|
381
|
-
* table used to need — the `NOT NULL` column, the RLS rule, the value
|
|
382
|
-
* stamped on insert, and the index — and keeps them in agreement, because
|
|
383
|
-
* they are all derived from this.
|
|
384
|
-
*
|
|
385
|
-
* ```ts
|
|
386
|
-
* tenant: { field: "orgId", from: { claim: "org_id" } }
|
|
387
|
-
* ```
|
|
388
|
-
*
|
|
389
|
-
* The property must already be declared: this says what a column *means*,
|
|
390
|
-
* it does not create one. Postgres-only, like {@link SearchConfig} — RLS is
|
|
391
|
-
* what enforces the boundary.
|
|
392
|
-
*
|
|
393
|
-
* @see CollectionTenantConfig
|
|
394
|
-
*/
|
|
395
|
-
tenant?: CollectionTenantConfig<M>;
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* A collection backed by Firebase / Firestore.
|
|
399
|
-
* Adds support for subcollections (nested document collections).
|
|
400
|
-
*
|
|
401
|
-
* Use this type instead of {@link CollectionConfig} when you want
|
|
402
|
-
* compile-time safety that only Firestore-relevant fields appear.
|
|
403
|
-
*
|
|
404
|
-
* @group Models
|
|
405
|
-
*/
|
|
406
|
-
export interface FirebaseCollectionConfig<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> extends BaseCollectionConfig<M, USER> {
|
|
407
|
-
/**
|
|
408
|
-
* The database engine for this collection. Must be set to `"firestore"`.
|
|
409
|
-
*/
|
|
410
|
-
engine: "firestore";
|
|
411
|
-
/**
|
|
412
|
-
* Set of properties that compose a entity.
|
|
413
|
-
* Firestore collections support `reference` properties but not `relation`.
|
|
414
|
-
*/
|
|
415
|
-
properties: FirebaseProperties;
|
|
416
|
-
/**
|
|
417
|
-
* The Firestore collection path to query. Defaults to `slug` if not set.
|
|
418
|
-
* Use this when the Firestore path differs from the slug
|
|
419
|
-
* (e.g., when a PostgreSQL collection already uses the same slug).
|
|
420
|
-
*
|
|
421
|
-
* @example
|
|
422
|
-
* ```typescript
|
|
423
|
-
* const fsCustomer: FirebaseCollectionConfig = {
|
|
424
|
-
* slug: "fs_customer", // URL: /c/fs_customer
|
|
425
|
-
* path: "customer", // Firestore path: customer
|
|
426
|
-
* name: "Customers (Firestore)",
|
|
427
|
-
* engine: "firestore",
|
|
428
|
-
* properties: { ... }
|
|
429
|
-
* };
|
|
430
|
-
* ```
|
|
431
|
-
*/
|
|
432
|
-
path?: string;
|
|
433
|
-
/**
|
|
434
|
-
* You can add subcollections to your entity in the same way you define the root
|
|
435
|
-
* collections. The collections added here will be displayed when opening
|
|
436
|
-
* the side dialog of a entity.
|
|
437
|
-
*/
|
|
438
|
-
subcollections?: () => CollectionConfig<Record<string, unknown>>[];
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* A collection backed by MongoDB.
|
|
442
|
-
*
|
|
443
|
-
* Use this type instead of {@link CollectionConfig} when you want
|
|
444
|
-
* compile-time safety that only MongoDB-relevant fields appear.
|
|
445
|
-
*
|
|
446
|
-
* @group Models
|
|
447
|
-
*/
|
|
448
|
-
export interface MongoDBCollectionConfig<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> extends BaseCollectionConfig<M, USER> {
|
|
449
|
-
/**
|
|
450
|
-
* The database engine for this collection. Must be set to `"mongodb"`.
|
|
451
|
-
*/
|
|
452
|
-
engine: "mongodb";
|
|
453
|
-
/**
|
|
454
|
-
* Set of properties that compose a entity.
|
|
455
|
-
* MongoDB collections support `reference` properties but not `relation`.
|
|
456
|
-
*/
|
|
457
|
-
properties: MongoProperties;
|
|
458
|
-
/**
|
|
459
|
-
* The MongoDB collection name to use. Defaults to `slug` if not set.
|
|
460
|
-
* Use this when the MongoDB collection name differs from the slug
|
|
461
|
-
* (e.g., when a PostgreSQL collection already uses the same slug).
|
|
462
|
-
*
|
|
463
|
-
* @example
|
|
464
|
-
* ```typescript
|
|
465
|
-
* const mongoCustomer: MongoDBCollectionConfig = {
|
|
466
|
-
* slug: "mongo_customer", // URL: /c/mongo_customer
|
|
467
|
-
* path: "customer", // MongoDB collection: customer
|
|
468
|
-
* name: "Customers (MongoDB)",
|
|
469
|
-
* engine: "mongodb",
|
|
470
|
-
* properties: { ... }
|
|
471
|
-
* };
|
|
472
|
-
* ```
|
|
473
|
-
*/
|
|
474
|
-
path?: string;
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* A collection backed by any data source.
|
|
478
|
-
* This is a discriminated union — use {@link PostgresCollectionConfig},
|
|
479
|
-
* {@link FirebaseCollectionConfig}, or {@link MongoDBCollectionConfig} for
|
|
480
|
-
* driver-specific type safety.
|
|
481
|
-
*
|
|
482
|
-
* @group Models
|
|
483
|
-
*/
|
|
484
|
-
export type CollectionConfig<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> = PostgresCollectionConfig<M, USER> | FirebaseCollectionConfig<M, USER> | MongoDBCollectionConfig<M, USER>;
|
|
485
|
-
/**
|
|
486
|
-
* A collection of *any* row type.
|
|
487
|
-
*
|
|
488
|
-
* `CollectionConfig` is **invariant** in `M`: `callbacks` both consumes `M`
|
|
489
|
-
* (`AfterReadProps<M>`) and produces it, so neither direction of assignment
|
|
490
|
-
* holds. `CollectionConfig<SomeRow>` is therefore not assignable to a bare
|
|
491
|
-
* `CollectionConfig`, whose `M` defaults to `Record<string, unknown>`.
|
|
492
|
-
*
|
|
493
|
-
* That matters wherever a collection is merely *referred to* rather than read
|
|
494
|
-
* from. `defineCollection` returns a config whose `M` is inferred from the
|
|
495
|
-
* properties — the whole point of it — so a field typed `() => CollectionConfig`
|
|
496
|
-
* rejects every collection the builder produces, and `target: () => otherCollection`
|
|
497
|
-
* (the documented way to point a relation at its other end) does not compile in
|
|
498
|
-
* any project that uses the builder.
|
|
499
|
-
*
|
|
500
|
-
* `any` is deliberate and is what it is for here: these positions never read the
|
|
501
|
-
* target's rows, they only identify which collection is meant, so there is no
|
|
502
|
-
* type safety to preserve and invariance is pure obstruction.
|
|
503
|
-
*
|
|
504
|
-
* @group Models
|
|
505
|
-
*/
|
|
506
|
-
export type AnyCollectionConfig = CollectionConfig<any, any>;
|
|
507
|
-
/**
|
|
508
|
-
* Type guard for PostgreSQL collections.
|
|
509
|
-
* Returns true if the collection uses the Postgres engine (or the default engine).
|
|
510
|
-
*
|
|
511
|
-
* Generic over the *input* type, and narrows by intersection rather than
|
|
512
|
-
* replacement. Narrowing to a bare `PostgresCollectionConfig` discarded whatever
|
|
513
|
-
* the caller actually had — most visibly the admin panel's view model, whose
|
|
514
|
-
* flattened presentation fields vanished the moment a collection passed through
|
|
515
|
-
* one of these guards.
|
|
516
|
-
*
|
|
517
|
-
* @group Models
|
|
518
|
-
*/
|
|
519
|
-
export declare function isPostgresCollectionConfig<C extends CollectionConfig<any, any>>(collection: C): collection is C & PostgresCollectionConfig<any, any>;
|
|
520
|
-
/**
|
|
521
|
-
* Narrows to the SQL collection fields — `table`, `relations`,
|
|
522
|
-
* `disableDefaultPolicies` — by asking the engine's declared capabilities
|
|
523
|
-
* rather than by naming Postgres.
|
|
524
|
-
*
|
|
525
|
-
* The two halves of this already existed and were never joined. The engine
|
|
526
|
-
* split (`PostgresCollectionConfig` / `FirebaseCollectionConfig` /
|
|
527
|
-
* `MongoDBCollectionConfig`) said which fields belong to which engine at the
|
|
528
|
-
* type level; {@link DataSourceCapabilities} said the same thing at runtime,
|
|
529
|
-
* down to a `supportsRelations` flag. So call sites guarded on the capability
|
|
530
|
-
* and then read a field the base type had to declare for them — which is why
|
|
531
|
-
* those fields were on the base, and why a MongoDB collection could be written
|
|
532
|
-
* with a `table`.
|
|
533
|
-
*
|
|
534
|
-
* Prefer this over {@link isPostgresCollectionConfig} wherever the question is
|
|
535
|
-
* "does this collection live in a SQL table", so a custom SQL engine
|
|
536
|
-
* registered through `registerDataSourceCapabilities` is included.
|
|
537
|
-
*
|
|
538
|
-
* @group Models
|
|
539
|
-
*/
|
|
540
|
-
export declare function isRelationalCollectionConfig<C extends CollectionConfig<any, any>>(collection: C): collection is C & PostgresCollectionConfig<any, any>;
|
|
541
|
-
/**
|
|
542
|
-
* Type guard for Firebase / Firestore collections.
|
|
543
|
-
* @group Models
|
|
544
|
-
*/
|
|
545
|
-
export declare function isFirebaseCollectionConfig<C extends CollectionConfig<any, any>>(collection: C): collection is C & FirebaseCollectionConfig<any, any>;
|
|
546
|
-
/**
|
|
547
|
-
* Type guard for MongoDB collections.
|
|
548
|
-
* @group Models
|
|
549
|
-
*/
|
|
550
|
-
export declare function isMongoDBCollectionConfig<C extends CollectionConfig<any, any>>(collection: C): collection is C & MongoDBCollectionConfig<any, any>;
|
|
551
|
-
/**
|
|
552
|
-
* Returns the data path for a collection.
|
|
553
|
-
* For Firestore or MongoDB collections with a `path`, returns that value;
|
|
554
|
-
* otherwise falls back to `slug`.
|
|
555
|
-
*/
|
|
556
|
-
export declare function getCollectionDataPath<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User>(collection: CollectionConfig<M, USER>): string;
|
|
557
|
-
/**
|
|
558
|
-
* Reads a collection's driver-declared subcollections thunk (the `subcollections`
|
|
559
|
-
* field) independent of engine identity, so engine-agnostic code doesn't have to
|
|
560
|
-
* type-guard against a specific driver. Returns `undefined` when the collection
|
|
561
|
-
* declares none.
|
|
562
|
-
*
|
|
563
|
-
* Pair with `getDataSourceCapabilities(engine).supportsSubcollections` to decide
|
|
564
|
-
* whether the engine honours subcollections at all before reading them.
|
|
565
|
-
* @group Models
|
|
566
|
-
*/
|
|
567
|
-
export declare function getDeclaredSubcollections<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User>(collection: CollectionConfig<M, USER>): (() => CollectionConfig<Record<string, unknown>>[]) | undefined;
|
|
568
|
-
/**
|
|
569
|
-
* Where the rows in an {@link EntityChildView} come from.
|
|
570
|
-
*
|
|
571
|
-
* The two are not the same thing, and conflating them is what made a Postgres
|
|
572
|
-
* relation borrow Firestore's addressing:
|
|
573
|
-
*
|
|
574
|
-
* - `subcollection` is **containment**. The rows live under the parent; the
|
|
575
|
-
* path is their identity, and they cannot exist without it. This is what
|
|
576
|
-
* Firestore has natively.
|
|
577
|
-
* - `relation` is a **link**. The rows are an ordinary collection, narrowed to
|
|
578
|
-
* those the parent reaches. `owned` means the child carries the parent's
|
|
579
|
-
* foreign key and belongs to it alone; `linked` means the row is shared
|
|
580
|
-
* through a junction, so what the parent controls is the link, not the row.
|
|
581
|
-
*
|
|
582
|
-
* @group Models
|
|
583
|
-
*/
|
|
584
|
-
export type ChildViewSource = {
|
|
585
|
-
kind: "subcollection";
|
|
586
|
-
} | {
|
|
587
|
-
kind: "relation";
|
|
588
|
-
relationKey: string;
|
|
589
|
-
mode: "owned" | "linked";
|
|
590
|
-
/**
|
|
591
|
-
* Slug of the collection the rows actually live in.
|
|
592
|
-
*
|
|
593
|
-
* Distinct from the view's `key`, which is the relation. A `linked` view
|
|
594
|
-
* needs both: the key addresses the parent's set, and this addresses the
|
|
595
|
-
* whole collection to pick an existing row out of.
|
|
596
|
-
*/
|
|
597
|
-
targetSlug: string;
|
|
598
|
-
};
|
|
599
|
-
/**
|
|
600
|
-
* A list of rows rendered inside an entity view — the tab under a record.
|
|
601
|
-
*
|
|
602
|
-
* This is a *presentation* descriptor, which is the whole point: rendering a
|
|
603
|
-
* related list as a tab used to require minting a child `CollectionConfig` with
|
|
604
|
-
* its own slug, which dragged a URL grammar, a path resolver and a second
|
|
605
|
-
* read/write pipeline along with it. A tab needs a key, a collection to list,
|
|
606
|
-
* and to know where its rows come from.
|
|
607
|
-
*
|
|
608
|
-
* @group Models
|
|
609
|
-
*/
|
|
610
|
-
export interface EntityChildView<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
611
|
-
/**
|
|
612
|
-
* Stable identifier for this view: the tab id and the path segment.
|
|
613
|
-
*
|
|
614
|
-
* For a relation this is the **relation key** — the name the backend
|
|
615
|
-
* resolves a nested path segment by — not the target collection's slug.
|
|
616
|
-
* Those differ whenever a relation is named, which is every inline relation
|
|
617
|
-
* property, and the mismatch is why such a tab used to open onto an error.
|
|
618
|
-
*/
|
|
619
|
-
key: string;
|
|
620
|
-
/** The collection whose rows this view lists, with any overrides applied. */
|
|
621
|
-
collection: CollectionConfig<M>;
|
|
622
|
-
source: ChildViewSource;
|
|
623
|
-
}
|
|
624
|
-
export type { WhereFilterOp, FilterValues, WireFilterValues, FilterPreset } from "./filter-operators.js";
|
|
625
|
-
export type InferCollectionConfigType<S extends CollectionConfig> = S extends CollectionConfig<infer M> ? M : never;
|
|
626
|
-
/**
|
|
627
|
-
* Configuration for authentication collections.
|
|
628
|
-
*
|
|
629
|
-
* Controls what happens when admins create users, reset passwords,
|
|
630
|
-
* and which entity actions are auto-injected.
|
|
631
|
-
*
|
|
632
|
-
* Use `auth: true` as sugar for `{ enabled: true }` with all defaults.
|
|
633
|
-
*
|
|
634
|
-
* @example Override user creation
|
|
635
|
-
* ```ts
|
|
636
|
-
* auth: {
|
|
637
|
-
* enabled: true,
|
|
638
|
-
* onCreateUser: async (values, ctx) => {
|
|
639
|
-
* const hash = await ctx.hashPassword("welcome123");
|
|
640
|
-
* return {
|
|
641
|
-
* values: { ...values, passwordHash: hash, emailVerified: true },
|
|
642
|
-
* temporaryPassword: "welcome123",
|
|
643
|
-
* };
|
|
644
|
-
* },
|
|
645
|
-
* }
|
|
646
|
-
* ```
|
|
647
|
-
*
|
|
648
|
-
* @example Disable the reset-password entity action
|
|
649
|
-
* ```ts
|
|
650
|
-
* auth: {
|
|
651
|
-
* enabled: true,
|
|
652
|
-
* actions: { resetPassword: false },
|
|
653
|
-
* }
|
|
654
|
-
* ```
|
|
655
|
-
*
|
|
656
|
-
* @group Models
|
|
657
|
-
*/
|
|
658
|
-
export interface AuthCollectionConfig {
|
|
659
|
-
/** Set to true to mark this collection as the authentication collection. */
|
|
660
|
-
enabled: boolean;
|
|
661
|
-
/**
|
|
662
|
-
* The app's roles and the admin-plane scopes each holds.
|
|
663
|
-
*
|
|
664
|
-
* `admin` is built in — it holds every scope — and cannot be declared. A
|
|
665
|
-
* role used only by RLS policies needs no entry here. See
|
|
666
|
-
* {@link RoleDefinition}.
|
|
667
|
-
*/
|
|
668
|
-
roles?: Record<string, RoleDefinition>;
|
|
669
|
-
/**
|
|
670
|
-
* Scopes the app defines for its own operations, named `resource:action`
|
|
671
|
-
* like the built-in ones and checked with `requireScope` in a function.
|
|
672
|
-
* Every signed-in person holds them; they exist so a key can be narrowed
|
|
673
|
-
* to one action. See {@link ScopeDefinition}.
|
|
674
|
-
*/
|
|
675
|
-
scopes?: Record<string, ScopeDefinition>;
|
|
676
|
-
/**
|
|
677
|
-
* Let every signed-in account mint personal API keys at
|
|
678
|
-
* `/api/auth/keys`. A personal key acts as its owner and can never hold
|
|
679
|
-
* a scope its owner does not. Off by default: each one is a long-lived
|
|
680
|
-
* credential for the account, and an app opts into handing those out.
|
|
681
|
-
*/
|
|
682
|
-
personalKeys?: boolean;
|
|
683
|
-
/**
|
|
684
|
-
* Called when an admin creates a user, through the collection REST API or
|
|
685
|
-
* `POST /admin/users`.
|
|
686
|
-
*
|
|
687
|
-
* Default: generate password → hash → normalize email → save →
|
|
688
|
-
* send invitation email (or return temp password if no email configured).
|
|
689
|
-
*
|
|
690
|
-
* Override to implement custom invitation flows, LDAP sync, etc. The hook
|
|
691
|
-
* then owns delivery: Rebase sends no invitation of its own, and the
|
|
692
|
-
* response reports the hook's `invitationSent` and shows its
|
|
693
|
-
* `temporaryPassword` to the admin.
|
|
694
|
-
*/
|
|
695
|
-
onCreateUser?: (values: Record<string, unknown>, ctx: AuthCollectionContext) => Promise<AuthCollectionCreateResult>;
|
|
696
|
-
/**
|
|
697
|
-
* Called when an admin resets a user's password via the admin panel.
|
|
698
|
-
*
|
|
699
|
-
* Default: generate reset token → send email (or generate + return temp password).
|
|
700
|
-
* Override for custom reset flows.
|
|
701
|
-
*
|
|
702
|
-
* Return a `temporaryPassword` to set one: Rebase hashes it with the
|
|
703
|
-
* configured algorithm, saves it as the account's password and shows it to
|
|
704
|
-
* the admin. The hook does not write it — its context has no way to. Return
|
|
705
|
-
* none when the hook sends its own link instead. Either way, the account's
|
|
706
|
-
* existing sessions are signed out.
|
|
707
|
-
*/
|
|
708
|
-
onResetPassword?: (uid: string, ctx: AuthCollectionContext) => Promise<AuthCollectionResetResult>;
|
|
709
|
-
/**
|
|
710
|
-
* Control which auth-specific entity actions are auto-injected.
|
|
711
|
-
*
|
|
712
|
-
* Default: `{ resetPassword: true }` — the framework auto-injects
|
|
713
|
-
* the built-in `resetPasswordAction` into the collection's entity actions.
|
|
714
|
-
*
|
|
715
|
-
* Set to `false` to disable, or pass a custom `EntityAction` to replace the UI.
|
|
716
|
-
*
|
|
717
|
-
* The object form is an `EntityAction` from `@rebasepro/cms-types`, typed
|
|
718
|
-
* here as `object` because it is a React component with admin controllers in
|
|
719
|
-
* its props and nothing on the server reads it — only whether the built-in
|
|
720
|
-
* action is injected, which is the boolean.
|
|
721
|
-
*/
|
|
722
|
-
actions?: {
|
|
723
|
-
resetPassword?: boolean | object;
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
/**
|
|
727
|
-
* Context provided to collection-level auth hooks.
|
|
728
|
-
*
|
|
729
|
-
* This is a simplified facade over the server internals —
|
|
730
|
-
* it exposes only what's needed for custom auth flows without
|
|
731
|
-
* coupling collection config to internal interfaces.
|
|
732
|
-
*
|
|
733
|
-
* @group Models
|
|
734
|
-
*/
|
|
735
|
-
export interface AuthCollectionContext {
|
|
736
|
-
/** Hash a password using the configured algorithm (scrypt by default). */
|
|
737
|
-
hashPassword: (password: string) => Promise<string>;
|
|
738
|
-
/**
|
|
739
|
-
* Send an email. Only available when email service is configured.
|
|
740
|
-
*
|
|
741
|
-
* Resolves with what the provider reported — the assigned Message-ID, most
|
|
742
|
-
* usefully — so a hook that sends a message can store the id and later
|
|
743
|
-
* thread a reply back to it. Callers that do not care may ignore it.
|
|
744
|
-
*/
|
|
745
|
-
sendEmail?: (options: {
|
|
746
|
-
to: string;
|
|
747
|
-
subject: string;
|
|
748
|
-
html: string;
|
|
749
|
-
text?: string;
|
|
750
|
-
}) => Promise<EmailSendResult>;
|
|
751
|
-
/** Whether the email service is configured and available. */
|
|
752
|
-
emailConfigured: boolean;
|
|
753
|
-
/** The app name from email config (for templates). */
|
|
754
|
-
appName: string;
|
|
755
|
-
/** The base URL for password reset links. */
|
|
756
|
-
resetPasswordUrl: string;
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* Result of a collection-level `onCreateUser` hook.
|
|
760
|
-
* @group Models
|
|
761
|
-
*/
|
|
762
|
-
export interface AuthCollectionCreateResult {
|
|
763
|
-
/** Processed values to persist (must include passwordHash, NOT raw password). */
|
|
764
|
-
values: Record<string, unknown>;
|
|
765
|
-
/** If set, shown to the admin in the creation result dialog. */
|
|
766
|
-
temporaryPassword?: string;
|
|
767
|
-
/** Whether an invitation email was sent. */
|
|
768
|
-
invitationSent?: boolean;
|
|
769
|
-
}
|
|
770
|
-
/**
|
|
771
|
-
* Result of a collection-level `onResetPassword` hook.
|
|
772
|
-
* @group Models
|
|
773
|
-
*/
|
|
774
|
-
export interface AuthCollectionResetResult {
|
|
775
|
-
/**
|
|
776
|
-
* The account's new password. Rebase hashes and saves it, then shows it to
|
|
777
|
-
* the admin; leave it unset when the account keeps its password for now
|
|
778
|
-
* (for example, because the hook emailed a link).
|
|
779
|
-
*/
|
|
780
|
-
temporaryPassword?: string;
|
|
781
|
-
/** Whether a reset email was sent. */
|
|
782
|
-
invitationSent?: boolean;
|
|
783
|
-
}
|