@rebasepro/types 0.24.0 → 0.24.1-canary.gcb918fc
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 +168 -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 +7 -1
- package/dist/types/storage_authorize.d.ts +5 -0
- 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 {
|
|
@@ -167,11 +167,13 @@ export interface TopicOptions extends DeclareOptions {
|
|
|
167
167
|
*
|
|
168
168
|
* `attempt` counts from 1. Worth branching on: the first delivery and the
|
|
169
169
|
* fourth are the same call, but the fourth is where it is worth logging loudly.
|
|
170
|
+
* `signal` is aborted when the attempt runs past the job queue's `timeoutMs`.
|
|
170
171
|
*/
|
|
171
172
|
export type TopicHandler<T> = (event: T, context: {
|
|
172
173
|
attempt: number;
|
|
173
174
|
topic: string;
|
|
174
175
|
subscription: string;
|
|
176
|
+
signal: AbortSignal;
|
|
175
177
|
}) => Promise<void> | void;
|
|
176
178
|
/** A declared subscription, as recorded in the graph and wired at boot. */
|
|
177
179
|
export interface TopicSubscription<T = unknown> {
|
|
@@ -279,11 +281,15 @@ export interface QueueOptions extends DeclareOptions {
|
|
|
279
281
|
/** Attempts before a job is left failed. Default 5. */
|
|
280
282
|
maxAttempts?: number;
|
|
281
283
|
}
|
|
282
|
-
/**
|
|
284
|
+
/**
|
|
285
|
+
* What a queue's handler receives. `attempt` counts from 1; `signal` is
|
|
286
|
+
* aborted when the attempt runs past the job queue's `timeoutMs`.
|
|
287
|
+
*/
|
|
283
288
|
export type QueueHandler<T> = (payload: T, context: {
|
|
284
289
|
attempt: number;
|
|
285
290
|
queue: string;
|
|
286
291
|
jobId: string;
|
|
292
|
+
signal: AbortSignal;
|
|
287
293
|
}) => Promise<void> | void;
|
|
288
294
|
/** Per-job options at enqueue time. */
|
|
289
295
|
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. */
|
|
@@ -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;
|