durable-db 0.13.3 → 0.14.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.
@@ -1,41 +0,0 @@
1
- //#region src/db/outbox.d.ts
2
- /** What a message may be: declare it once with `declare global { interface DurableDbOutbox { message: MyMessage } }`. */
3
- declare global {
4
- interface DurableDbOutbox {}
5
- }
6
- /** The message `ctx.outbox.push()` takes: `DurableDbOutbox['message']` when declared, else any JSON value. */
7
- type OutboxMessage = DurableDbOutbox extends {
8
- message: infer M;
9
- } ? M : unknown;
10
- /** What an action records messages with. */
11
- interface Outbox {
12
- /** Records `message` (a JSON value) for delivery after the action succeeds. */
13
- push(message: OutboxMessage): void;
14
- }
15
- /** A recorded message, as the sink gets it. */
16
- interface OutboxEnvelope<M = OutboxMessage> {
17
- message: M;
18
- /** The instance key of the Durable Object that recorded it. */
19
- instanceKey: string;
20
- /** The tenant of a per-tenant database's instance (its key without the dev epoch); null for a global database. */
21
- tenantId: string | null;
22
- /** When the action recorded it (ms since the epoch). */
23
- recordedAt: number;
24
- }
25
- interface OutboxSinkContext<Env = unknown> {
26
- /** The Durable Object's env: the worker's bindings. */
27
- env: Env;
28
- }
29
- /** Where the outbox delivers. A delivery that throws is retried, every envelope of it. */
30
- interface OutboxSink<Env = unknown> {
31
- deliver(envelopes: OutboxEnvelope[], context: OutboxSinkContext<Env>): Promise<void> | void;
32
- }
33
- type OutboxSinkModule<Env = unknown> = OutboxSink<Env> | OutboxSink<Env>['deliver'];
34
- /** A sink module's default export as a sink: a deliver function, or an object with one. */
35
- declare function outboxSink<Env = unknown>(module: OutboxSinkModule<Env>): OutboxSink<Env>;
36
- /** Each message to the Queue binding `binding`, as it was pushed. */
37
- declare function queueOutboxSink(binding: string): OutboxSink;
38
- /** The tenant an instance key belongs to (its dev epoch suffix dropped); null for a global database. */
39
- declare function tenantOfInstanceKey(instanceKey: string): string | null;
40
- //#endregion
41
- export { OutboxSinkContext as a, queueOutboxSink as c, OutboxSink as i, tenantOfInstanceKey as l, OutboxEnvelope as n, OutboxSinkModule as o, OutboxMessage as r, outboxSink as s, Outbox as t };