@rebasepro/types 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/client.d.ts +47 -2
- package/dist/controllers/storage.d.ts +112 -0
- package/dist/index.es.js.map +1 -1
- package/dist/types/auth_adapter.d.ts +5 -0
- package/dist/types/backend.d.ts +34 -0
- package/dist/types/channel_bus.d.ts +26 -0
- package/dist/types/conditions-contract.types.d.ts +14 -0
- package/dist/types/cron.d.ts +5 -1
- package/dist/types/properties.d.ts +4 -4
- package/package.json +1 -1
|
@@ -264,6 +264,11 @@ export interface AuthAdapterCapabilities {
|
|
|
264
264
|
anonymousLogin: boolean;
|
|
265
265
|
/** List of enabled OAuth provider IDs (e.g. `["google", "github"]`). */
|
|
266
266
|
enabledProviders: string[];
|
|
267
|
+
/**
|
|
268
|
+
* Public client ids, by provider id, for the providers whose sign-in a
|
|
269
|
+
* browser starts with one (Apple's Services ID). Absent when none does.
|
|
270
|
+
*/
|
|
271
|
+
providerClientIds?: Record<string, string>;
|
|
267
272
|
/**
|
|
268
273
|
* For external auth (Clerk, Auth0, etc.): the URL where the user should
|
|
269
274
|
* be redirected for login. The Rebase frontend will navigate here instead
|
package/dist/types/backend.d.ts
CHANGED
|
@@ -354,6 +354,12 @@ export interface RealtimeProvider {
|
|
|
354
354
|
* still look live, so it is reported rather than inferred.
|
|
355
355
|
*/
|
|
356
356
|
health?(): RealtimeListenerHealth[];
|
|
357
|
+
/**
|
|
358
|
+
* This process's realtime counts, for `/metrics`. Read at each scrape, so
|
|
359
|
+
* it must be cheap. Absent on a provider with nothing to count, and the
|
|
360
|
+
* series are then not emitted rather than reported as zeros.
|
|
361
|
+
*/
|
|
362
|
+
counts?(): RealtimeCounts;
|
|
357
363
|
/**
|
|
358
364
|
* Run the provider's own background reads — the refetches a change
|
|
359
365
|
* schedules, whatever announced it (a write here, change capture, another
|
|
@@ -375,6 +381,21 @@ export interface RealtimeListenerHealth {
|
|
|
375
381
|
/** When (epoch ms) it went down, while it is down. */
|
|
376
382
|
downSince?: number;
|
|
377
383
|
}
|
|
384
|
+
/**
|
|
385
|
+
* What one realtime process is carrying. Counts only: a channel's name is
|
|
386
|
+
* customer data and never leaves in a metric.
|
|
387
|
+
* @group Backend
|
|
388
|
+
*/
|
|
389
|
+
export interface RealtimeCounts {
|
|
390
|
+
/** Open sockets on this process. */
|
|
391
|
+
sockets: number;
|
|
392
|
+
/** Channels with a member on this process. */
|
|
393
|
+
channels: number;
|
|
394
|
+
/** Frames this process published to the channel bus, by frame kind. */
|
|
395
|
+
busFramesPublished: Record<string, number>;
|
|
396
|
+
/** Broadcasts and presence changes not published because no other instance had members. */
|
|
397
|
+
busFramesSkipped: number;
|
|
398
|
+
}
|
|
378
399
|
/**
|
|
379
400
|
* Abstract collection registry interface.
|
|
380
401
|
* Manages registration and lookup of entity collections.
|
|
@@ -569,6 +590,19 @@ export interface SQLAdmin {
|
|
|
569
590
|
isolateSession?: boolean;
|
|
570
591
|
maxResultBytes?: number;
|
|
571
592
|
}): Promise<Record<string, unknown>[]>;
|
|
593
|
+
/**
|
|
594
|
+
* Ask the database whether it answers, on a connection of its own.
|
|
595
|
+
*
|
|
596
|
+
* For the health check. `executeSql("SELECT 1")` waits for a pooled
|
|
597
|
+
* connection, so a pool that is merely busy (every connection serving a
|
|
598
|
+
* slow request) failed a readiness probe that gives a few seconds — and an
|
|
599
|
+
* orchestrator took a working pod out of service, sending its load to the
|
|
600
|
+
* others or, with one pod, to nobody. Implementations open a connection
|
|
601
|
+
* outside the pool, run the cheapest round trip, and throw if that does not
|
|
602
|
+
* finish within `timeoutMs`. Optional: without it the health check asks
|
|
603
|
+
* through `executeSql` as before.
|
|
604
|
+
*/
|
|
605
|
+
probe?(timeoutMs: number): Promise<void>;
|
|
572
606
|
/**
|
|
573
607
|
* Run a script a person wrote — the Studio SQL console — and describe what
|
|
574
608
|
* it returned.
|
|
@@ -61,6 +61,23 @@ export type ChannelBusFrame =
|
|
|
61
61
|
channel: string;
|
|
62
62
|
joins: Record<string, Record<string, unknown>>;
|
|
63
63
|
leaves: Record<string, Record<string, unknown>>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Which channels an instance has members in, so the others can skip
|
|
67
|
+
* publishing to channels nobody else is listening on (see
|
|
68
|
+
* {@link ChannelBus.publishesOnDemand}). `add` is a channel's first local
|
|
69
|
+
* member. A full list comes as `list` parts, the last with `done`, and
|
|
70
|
+
* replaces what was known. `hello` asks everyone for theirs. `channel` is
|
|
71
|
+
* always `"__peers"`: a transport drops frames without one.
|
|
72
|
+
*/
|
|
73
|
+
| {
|
|
74
|
+
kind: "channels";
|
|
75
|
+
sid: string;
|
|
76
|
+
channel: string;
|
|
77
|
+
add?: string[];
|
|
78
|
+
list?: string[];
|
|
79
|
+
done?: boolean;
|
|
80
|
+
hello?: boolean;
|
|
64
81
|
};
|
|
65
82
|
/** Receives frames published by *other* instances. */
|
|
66
83
|
export type ChannelBusHandler = (frame: ChannelBusFrame) => void | Promise<void>;
|
|
@@ -98,6 +115,15 @@ export interface ChannelBus {
|
|
|
98
115
|
* whether publishing is worth attempting at all.
|
|
99
116
|
*/
|
|
100
117
|
readonly kind: string;
|
|
118
|
+
/**
|
|
119
|
+
* Publish only to channels another instance has members in.
|
|
120
|
+
*
|
|
121
|
+
* For a transport where each publish costs something (the Postgres bus: a
|
|
122
|
+
* query on the primary), the service gossips over the bus which channels each
|
|
123
|
+
* instance serves, and a frame nobody else is waiting for is not published
|
|
124
|
+
* at all. An instance alone publishes nothing. Unset: every frame is published.
|
|
125
|
+
*/
|
|
126
|
+
readonly publishesOnDemand?: boolean;
|
|
101
127
|
/**
|
|
102
128
|
* Largest frame this transport will carry, in bytes of encoded JSON, or
|
|
103
129
|
* `Infinity` when there is no meaningful ceiling.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile-time assertions about `PropertyConditions`.
|
|
3
|
+
*
|
|
4
|
+
* A plain module under `src`, imported by nothing, for the reason
|
|
5
|
+
* `packages/client/src/query-contract.types.ts` gives: `pnpm typecheck` reads
|
|
6
|
+
* `src`, and a type assertion in a jest test is checked by nothing.
|
|
7
|
+
*
|
|
8
|
+
* A dynamic bound is usually a constant. The evaluator returns a literal
|
|
9
|
+
* number as it is, and the docs write `min: 0` — which the type, a JSON Logic
|
|
10
|
+
* rule only, refused.
|
|
11
|
+
*/
|
|
12
|
+
import type { PropertyConditions } from "./properties.js";
|
|
13
|
+
export declare const literalBounds: PropertyConditions;
|
|
14
|
+
export declare const ruleBounds: PropertyConditions;
|
package/dist/types/cron.d.ts
CHANGED
|
@@ -93,7 +93,11 @@ export interface CronJobDefinition<DB = RegisteredDatabase> {
|
|
|
93
93
|
export interface CronJobContext<DB = RegisteredDatabase> {
|
|
94
94
|
/** The job's unique ID (derived from filename). */
|
|
95
95
|
jobId: string;
|
|
96
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* The slot this run fires for. A catch-up run gets the slot it missed,
|
|
98
|
+
* not the time it started; a manual trigger, which has no slot, gets the
|
|
99
|
+
* moment the run started.
|
|
100
|
+
*/
|
|
97
101
|
scheduledAt: Date;
|
|
98
102
|
/**
|
|
99
103
|
* A simple logger scoped to this job run. Each line is written to the
|
|
@@ -1501,14 +1501,14 @@ export interface PropertyConditions {
|
|
|
1501
1501
|
requiredMessage?: string;
|
|
1502
1502
|
/**
|
|
1503
1503
|
* Dynamic minimum value for number/string length.
|
|
1504
|
-
*
|
|
1504
|
+
* A number, or a rule that evaluates to one.
|
|
1505
1505
|
*/
|
|
1506
|
-
min?: JsonLogicRule;
|
|
1506
|
+
min?: number | JsonLogicRule;
|
|
1507
1507
|
/**
|
|
1508
1508
|
* Dynamic maximum value for number/string length.
|
|
1509
|
-
*
|
|
1509
|
+
* A number, or a rule that evaluates to one.
|
|
1510
1510
|
*/
|
|
1511
|
-
max?: JsonLogicRule;
|
|
1511
|
+
max?: number | JsonLogicRule;
|
|
1512
1512
|
/**
|
|
1513
1513
|
* Dynamic default value for new entities.
|
|
1514
1514
|
* Should evaluate to a value of the appropriate type for the field.
|