@rebasepro/types 0.24.0 → 0.24.1-canary.g19596ef
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/dist/call_context.d.ts +8 -4
- package/dist/controllers/client.d.ts +68 -10
- package/dist/controllers/data.d.ts +412 -76
- package/dist/controllers/data_driver.d.ts +85 -1
- package/dist/controllers/index.d.ts +1 -0
- package/dist/controllers/storage-references.d.ts +114 -0
- package/dist/controllers/storage.d.ts +20 -79
- package/dist/index.es.js +140 -12
- package/dist/index.es.js.map +1 -1
- package/dist/types/auth_adapter.d.ts +32 -1
- package/dist/types/backend.d.ts +180 -4
- package/dist/types/backup.d.ts +19 -0
- package/dist/types/cron.d.ts +22 -7
- package/dist/types/database_adapter.d.ts +32 -6
- package/dist/types/entities.d.ts +11 -0
- package/dist/types/history.d.ts +15 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/project_manifest.d.ts +8 -0
- package/dist/types/properties.d.ts +28 -2
- package/dist/types/register.d.ts +43 -0
- package/dist/types/relations.d.ts +37 -1
- package/dist/types/resource_kinds.d.ts +20 -10
- package/dist/types/storage_authorize.d.ts +5 -0
- package/dist/types/storage_source.d.ts +2 -6
- package/dist/types/websockets.d.ts +32 -1
- package/package.json +1 -1
|
@@ -22,6 +22,23 @@ export type OnAction = "cascade" | "restrict" | "no action" | "set null" | "set
|
|
|
22
22
|
* @group Models
|
|
23
23
|
*/
|
|
24
24
|
export declare const JUNCTION_PIVOT_KEY = "_pivot";
|
|
25
|
+
/**
|
|
26
|
+
* The key a row carries the totals of its counted relations under.
|
|
27
|
+
*
|
|
28
|
+
* An include that asks for a count — `include: { tags: { limit: 4, count: true } }`
|
|
29
|
+
* — serves, beside the (capped) `tags`, how many related rows there are in all:
|
|
30
|
+
* `{ id: 1, tags: [ …4 rows ], _count: { tags: 37 } }`. One object per row,
|
|
31
|
+
* keyed by relation name, so counting a second relation adds a key rather than
|
|
32
|
+
* a second top-level name.
|
|
33
|
+
*
|
|
34
|
+
* Leading underscore, like {@link JUNCTION_PIVOT_KEY} and `_matches`: it
|
|
35
|
+
* describes the read, not the record, and no column or form writes it. A
|
|
36
|
+
* collection with a property of this name cannot ask for a count — the read
|
|
37
|
+
* answers 400 rather than writing over the column.
|
|
38
|
+
*
|
|
39
|
+
* @group Models
|
|
40
|
+
*/
|
|
41
|
+
export declare const INCLUDE_COUNT_KEY = "_count";
|
|
25
42
|
/**
|
|
26
43
|
* What kind of link a relation is.
|
|
27
44
|
*
|
|
@@ -108,6 +125,23 @@ export interface BelongsToRelation extends RelationBase {
|
|
|
108
125
|
* Defaults to `<relationName>_id`.
|
|
109
126
|
*/
|
|
110
127
|
localKey?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Whether Rebase creates a btree index on {@link localKey}. Defaults to
|
|
130
|
+
* `true`.
|
|
131
|
+
*
|
|
132
|
+
* Postgres indexes the key a foreign key *points at* but never the column
|
|
133
|
+
* holding it, so without one every read from the other side seq-scans this
|
|
134
|
+
* table: a `hasMany`/`hasOne` include, a nested listing such as
|
|
135
|
+
* `/authors/5/posts`, and the `ON DELETE` check when a target row is
|
|
136
|
+
* deleted. The derived index is skipped on its own when the column already
|
|
137
|
+
* leads one — the primary key, a `validation.unique`, or an entry in
|
|
138
|
+
* `indexes:` — so it never duplicates an index you declared.
|
|
139
|
+
*
|
|
140
|
+
* Set `false` for a table so write-heavy that the index costs more than
|
|
141
|
+
* the lookups it serves, or when you keep an index of your own on the
|
|
142
|
+
* column outside Rebase's `indexes:` block.
|
|
143
|
+
*/
|
|
144
|
+
index?: boolean;
|
|
111
145
|
}
|
|
112
146
|
/**
|
|
113
147
|
* The target holds the foreign key, and at most one target row points back.
|
|
@@ -234,7 +268,7 @@ export interface ManyToManyRelation extends RelationBase {
|
|
|
234
268
|
* through: {
|
|
235
269
|
* table: "org_members",
|
|
236
270
|
* properties: {
|
|
237
|
-
* role: { type: "string", enum:
|
|
271
|
+
* role: { type: "string", enum: { owner: "Owner", admin: "Admin", member: "Member" },
|
|
238
272
|
* defaultValue: "member", validation: { required: true } },
|
|
239
273
|
* joinedAt: { type: "date", autoValue: "on_create" }
|
|
240
274
|
* }
|
|
@@ -364,6 +398,8 @@ export interface ResolvedBelongsTo extends ResolvedRelationBase {
|
|
|
364
398
|
shared: false;
|
|
365
399
|
/** Column on this collection's table. */
|
|
366
400
|
localKey: string;
|
|
401
|
+
/** As authored, with the default filled in — see {@link BelongsToRelation.index}. */
|
|
402
|
+
index: boolean;
|
|
367
403
|
}
|
|
368
404
|
/** @group Models */
|
|
369
405
|
export interface ResolvedHasOne extends ResolvedRelationBase {
|
|
@@ -94,20 +94,24 @@ export interface BucketOptions extends DeclareOptions {
|
|
|
94
94
|
* is a data leak that nothing errors on.
|
|
95
95
|
*/
|
|
96
96
|
publicRead?: boolean;
|
|
97
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated Never applied: every object lands at the root of its bucket,
|
|
99
|
+
* whatever this says, so two sources declaring one bucket share one
|
|
100
|
+
* namespace. Give each source a bucket of its own (`S3_BUCKET__<KEY>`,
|
|
101
|
+
* `GCS_BUCKET__<KEY>`, or `STORAGE_PATH__<KEY>` for a local one), or put
|
|
102
|
+
* the folder in each storage property's `storagePath`. The backend warns
|
|
103
|
+
* once at boot when it is set. Will be removed in a future release.
|
|
104
|
+
*/
|
|
98
105
|
prefix?: string;
|
|
99
106
|
/**
|
|
100
107
|
* Serve unqualified uploads — a storage property with no `storageSource` —
|
|
101
108
|
* from this bucket.
|
|
102
109
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* default is dropped in production and the promotion is not. So it is now
|
|
109
|
-
* a boot error, and this is one of the two ways to answer it — the other
|
|
110
|
-
* being `bucket()`, which declares the default bucket itself.
|
|
110
|
+
* Without it, declaring `bucket("media")` leaves the default source where
|
|
111
|
+
* it was: on its own `STORAGE_PATH` / `./uploads`, or the bucket the
|
|
112
|
+
* unsuffixed `S3_BUCKET` / `GCS_BUCKET` names. Mark a named bucket to make
|
|
113
|
+
* it the default instead; the files the default held before stay where
|
|
114
|
+
* they are and are no longer served through it.
|
|
111
115
|
*/
|
|
112
116
|
default?: boolean;
|
|
113
117
|
/**
|
|
@@ -167,11 +171,13 @@ export interface TopicOptions extends DeclareOptions {
|
|
|
167
171
|
*
|
|
168
172
|
* `attempt` counts from 1. Worth branching on: the first delivery and the
|
|
169
173
|
* fourth are the same call, but the fourth is where it is worth logging loudly.
|
|
174
|
+
* `signal` is aborted when the attempt runs past the job queue's `timeoutMs`.
|
|
170
175
|
*/
|
|
171
176
|
export type TopicHandler<T> = (event: T, context: {
|
|
172
177
|
attempt: number;
|
|
173
178
|
topic: string;
|
|
174
179
|
subscription: string;
|
|
180
|
+
signal: AbortSignal;
|
|
175
181
|
}) => Promise<void> | void;
|
|
176
182
|
/** A declared subscription, as recorded in the graph and wired at boot. */
|
|
177
183
|
export interface TopicSubscription<T = unknown> {
|
|
@@ -279,11 +285,15 @@ export interface QueueOptions extends DeclareOptions {
|
|
|
279
285
|
/** Attempts before a job is left failed. Default 5. */
|
|
280
286
|
maxAttempts?: number;
|
|
281
287
|
}
|
|
282
|
-
/**
|
|
288
|
+
/**
|
|
289
|
+
* What a queue's handler receives. `attempt` counts from 1; `signal` is
|
|
290
|
+
* aborted when the attempt runs past the job queue's `timeoutMs`.
|
|
291
|
+
*/
|
|
283
292
|
export type QueueHandler<T> = (payload: T, context: {
|
|
284
293
|
attempt: number;
|
|
285
294
|
queue: string;
|
|
286
295
|
jobId: string;
|
|
296
|
+
signal: AbortSignal;
|
|
287
297
|
}) => Promise<void> | void;
|
|
288
298
|
/** Per-job options at enqueue time. */
|
|
289
299
|
export interface QueueEnqueueOptions {
|
|
@@ -18,6 +18,11 @@ export interface StorageAuthorizeUser {
|
|
|
18
18
|
export interface StorageAuthorizeContext {
|
|
19
19
|
/** Object key, bucket prefix stripped and traversal already sanitized. */
|
|
20
20
|
key: string;
|
|
21
|
+
/**
|
|
22
|
+
* The bucket, by one name per bucket. On S3 and GCS, whose source serves a
|
|
23
|
+
* single bucket, this is always `"default"` — also when the request named
|
|
24
|
+
* the provider's bucket (`acme-media`), which reaches the same objects.
|
|
25
|
+
*/
|
|
21
26
|
bucket: string;
|
|
22
27
|
operation: StorageOperation;
|
|
23
28
|
/** Null when the route allows unauthenticated access. */
|
|
@@ -93,12 +93,8 @@ export interface StorageSourceDefinition {
|
|
|
93
93
|
* Serve unqualified uploads — a storage property naming no `storageSource`
|
|
94
94
|
* — from this source.
|
|
95
95
|
*
|
|
96
|
-
* Declared, never inferred. A
|
|
97
|
-
*
|
|
98
|
-
* the choice differed between development and production because the
|
|
99
|
-
* synthesized local default is dropped in production and the promotion was
|
|
100
|
-
* not. Where the files land is the author's decision; boot now fails
|
|
101
|
-
* without one.
|
|
96
|
+
* Declared, never inferred. A source without it never becomes the default:
|
|
97
|
+
* the default keeps its own configuration whatever else is declared.
|
|
102
98
|
*/
|
|
103
99
|
default?: boolean;
|
|
104
100
|
/** Human-readable label for the UI (e.g. "Firebase Storage", "S3 Media"). */
|
|
@@ -69,6 +69,13 @@ export interface CollectionUpdateMeta {
|
|
|
69
69
|
hasMore: boolean;
|
|
70
70
|
/** The opaque cursor continuing this listing — see `PaginationMeta.nextCursor`. */
|
|
71
71
|
nextCursor?: string;
|
|
72
|
+
/**
|
|
73
|
+
* When `total` was counted, ISO-8601 — present only when it was not
|
|
74
|
+
* counted for this frame. A server with `REALTIME_RECOUNT_INTERVAL_MS` set
|
|
75
|
+
* reuses a big list's total for that long rather than counting it on every
|
|
76
|
+
* write; `hasMore` is then judged against the reused total.
|
|
77
|
+
*/
|
|
78
|
+
totalAsOf?: string;
|
|
72
79
|
/**
|
|
73
80
|
* The count could not be taken, so `total` is missing and `hasMore` is a
|
|
74
81
|
* floor rather than an answer.
|
|
@@ -97,6 +104,14 @@ export interface SingleUpdateMessage extends WebSocketMessage {
|
|
|
97
104
|
type: "single_update";
|
|
98
105
|
subscriptionId: string;
|
|
99
106
|
row: Record<string, unknown> | null;
|
|
107
|
+
/**
|
|
108
|
+
* The row's version: the `ETag` a `GET /:id` of it answers, to send back
|
|
109
|
+
* as `If-Match` on a `PATCH` or `DELETE`. Sent only to a `subscribe_one`
|
|
110
|
+
* that asked with `etag: true`, and never beside a `null` row. A server
|
|
111
|
+
* that predates it ignores the ask and sends no tag; a client that does
|
|
112
|
+
* not ask gets frames without one.
|
|
113
|
+
*/
|
|
114
|
+
etag?: string;
|
|
100
115
|
}
|
|
101
116
|
/**
|
|
102
117
|
* Lightweight patch message sent to collection subscribers when a single
|
|
@@ -151,6 +166,22 @@ export interface BroadcastMessage extends WebSocketMessage {
|
|
|
151
166
|
*/
|
|
152
167
|
seq?: number;
|
|
153
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Server → client: the sequence number the sender's own broadcast took on a
|
|
171
|
+
* retained channel, sent to the sender in place of the message itself (which
|
|
172
|
+
* is never echoed back).
|
|
173
|
+
*
|
|
174
|
+
* Sent only to a socket that opted into `channel_seq` when it opened (see the
|
|
175
|
+
* socket's `hello`). With it, every member of a retained channel hears of
|
|
176
|
+
* every number, one way or the other, so a client that sees a hole in the
|
|
177
|
+
* sequence knows it missed a message and can ask for it — which is what the
|
|
178
|
+
* SDK does.
|
|
179
|
+
*/
|
|
180
|
+
export interface BroadcastAckMessage extends WebSocketMessage {
|
|
181
|
+
type: "broadcast_ack";
|
|
182
|
+
channel: string;
|
|
183
|
+
seq: number;
|
|
184
|
+
}
|
|
154
185
|
/**
|
|
155
186
|
* Server → client: the whole roster of a channel.
|
|
156
187
|
*
|
|
@@ -276,4 +307,4 @@ export interface ChannelHistoryMessage extends WebSocketMessage {
|
|
|
276
307
|
* {@link WebSocketMessage}, whose `type` is a bare `string`, and a `string`
|
|
277
308
|
* discriminates nothing.
|
|
278
309
|
*/
|
|
279
|
-
export type ChannelMessage = BroadcastMessage | PresenceStateMessage | PresenceDiffMessage | ChannelHistoryMessage | ChannelErrorMessage;
|
|
310
|
+
export type ChannelMessage = BroadcastMessage | BroadcastAckMessage | PresenceStateMessage | PresenceDiffMessage | ChannelHistoryMessage | ChannelErrorMessage;
|