effect-durable-agent-cloudflare 0.1.0-alpha.22 → 0.1.0-alpha.24
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/durable-object-BZJM3RyV.js +477 -0
- package/dist/durable-object-BZJM3RyV.js.map +1 -0
- package/dist/durable-object-storage-D3muKtpz.d.ts +115 -0
- package/dist/durable-object-store-Dct3N6rk.js +1148 -0
- package/dist/durable-object-store-Dct3N6rk.js.map +1 -0
- package/dist/durable-object.d.ts +59 -4
- package/dist/durable-object.js +2 -207
- package/dist/index.d.ts +181 -5
- package/dist/index.js +5 -4
- package/dist/rpc-spec-B5cL83zd.js +303 -0
- package/dist/rpc-spec-B5cL83zd.js.map +1 -0
- package/dist/{rpc-spec-C8wknrbN.d.ts → rpc-spec-BTVd02Rg.d.ts} +1718 -4
- package/dist/rpc.d.ts +2 -2
- package/dist/rpc.js +2 -2
- package/dist/{session-controller-DoeFP_Ej.d.ts → session-controller-D8uXDKVG.d.ts} +66 -6
- package/dist/{session-controller-BGfz1DdS.js → session-controller-DoUy9zR6.js} +637 -642
- package/dist/session-controller-DoUy9zR6.js.map +1 -0
- package/dist/session-controller.d.ts +1 -1
- package/dist/session-controller.js +1 -1
- package/dist/storage.d.ts +1 -1
- package/package.json +2 -2
- package/dist/durable-object-storage-BZCOHz9p.d.ts +0 -40
- package/dist/durable-object.js.map +0 -1
- package/dist/rpc-spec-CkWEeWJG.js +0 -105
- package/dist/rpc-spec-CkWEeWJG.js.map +0 -1
- package/dist/session-controller-BGfz1DdS.js.map +0 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { SequenceNumber, SessionId } from "effect-durable-agent/types/core";
|
|
2
|
+
import { CommittedDurableEvent } from "effect-durable-agent/services/session-store";
|
|
3
|
+
import { TranscriptLogIncarnation, TranscriptMaintenanceConfig, TranscriptVersion, TranscriptVersionMeta } from "effect-durable-agent/transcript";
|
|
4
|
+
//#region src/durable-object-transcript-tables.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A host's existing synchronous key/value incarnation to adopt (Gia: `gia.log_incarnation` in the
|
|
7
|
+
* Durable Object's `ctx.storage.kv`). The adapter adopts the host's value when one exists and
|
|
8
|
+
* otherwise writes the value it mints there too, so host and adapter always name the same log.
|
|
9
|
+
*/
|
|
10
|
+
interface AdoptedLogIncarnation {
|
|
11
|
+
readonly key: string;
|
|
12
|
+
readonly kv: {
|
|
13
|
+
readonly get: (key: string) => unknown;
|
|
14
|
+
readonly put: (key: string, value: string) => void;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/durable-object-transcript-maintenance.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* Something an operator must look at, raised after the transaction that caused it commits.
|
|
21
|
+
*
|
|
22
|
+
* - `ProjectionFailed`: a version froze at its last good cursor (§5.2). On the active version
|
|
23
|
+
* readers see a degraded tail until a new definition rebuilds it; on a building version the
|
|
24
|
+
* active version keeps serving and the backfill reports it.
|
|
25
|
+
* - `MissedSession`: the active version is one this release no longer carries, so its history is
|
|
26
|
+
* frozen behind the log and `current` is being built at once (§7 safety net).
|
|
27
|
+
*/
|
|
28
|
+
type TranscriptAlert = {
|
|
29
|
+
readonly _tag: "ProjectionFailed";
|
|
30
|
+
readonly version: TranscriptVersion;
|
|
31
|
+
readonly role: "active" | "building";
|
|
32
|
+
readonly failedAtSeq: SequenceNumber;
|
|
33
|
+
readonly error: string;
|
|
34
|
+
} | {
|
|
35
|
+
readonly _tag: "MissedSession";
|
|
36
|
+
readonly activeVersion: TranscriptVersion;
|
|
37
|
+
readonly currentVersion: TranscriptVersion;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Host hooks for transcript maintenance. Every hook runs only after the transaction that caused
|
|
41
|
+
* it has committed, so nothing observed here can be rolled back afterwards.
|
|
42
|
+
*/
|
|
43
|
+
interface DurableObjectTranscriptObserver {
|
|
44
|
+
readonly onAlert?: (alert: TranscriptAlert) => void;
|
|
45
|
+
/** A built version became active; connected clients need a window replacement (§9.4). */
|
|
46
|
+
readonly onActivated?: (activation: {
|
|
47
|
+
readonly version: TranscriptVersion;
|
|
48
|
+
readonly previousVersion: TranscriptVersion | undefined;
|
|
49
|
+
}) => void;
|
|
50
|
+
/** Bounded builder or cleanup work is pending; the host schedules a slice. */
|
|
51
|
+
readonly onPendingWork?: () => void;
|
|
52
|
+
}
|
|
53
|
+
/** Bounds on one builder slice. */
|
|
54
|
+
interface DurableObjectTranscriptSliceLimits {
|
|
55
|
+
/** Log events projected into the building version per slice. */
|
|
56
|
+
readonly maxEvents: number;
|
|
57
|
+
/** Events decoded and planned together; matches the store's bounded event read page. */
|
|
58
|
+
readonly pageEvents: number;
|
|
59
|
+
/** Rows of retired versions deleted per slice. */
|
|
60
|
+
readonly maxDeletedRows: number;
|
|
61
|
+
}
|
|
62
|
+
/** Transcript maintenance configuration of one session store. */
|
|
63
|
+
interface DurableObjectTranscriptOptions {
|
|
64
|
+
/** The definitions this release carries; supplied by the host. */
|
|
65
|
+
readonly definitions: TranscriptMaintenanceConfig;
|
|
66
|
+
/** Adopt a host's existing log incarnation instead of minting a new one. */
|
|
67
|
+
readonly adoptIncarnation?: AdoptedLogIncarnation;
|
|
68
|
+
readonly observer?: DurableObjectTranscriptObserver;
|
|
69
|
+
readonly sliceLimits?: Partial<DurableObjectTranscriptSliceLimits>;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/durable-object-storage.d.ts
|
|
73
|
+
/**
|
|
74
|
+
* Minimal synchronous SQL cursor surface used by Cloudflare Durable Object storage.
|
|
75
|
+
*
|
|
76
|
+
* This type is host-only on purpose: framework services should depend on
|
|
77
|
+
* `EDASessionStore`, not Cloudflare's SQL API.
|
|
78
|
+
*/
|
|
79
|
+
interface DurableObjectSqlCursor<Row> {
|
|
80
|
+
readonly one: () => Row;
|
|
81
|
+
readonly toArray: () => Array<Row>;
|
|
82
|
+
}
|
|
83
|
+
/** Minimal synchronous SQL executor surface used by Cloudflare Durable Object storage. */
|
|
84
|
+
interface DurableObjectSqlStorage {
|
|
85
|
+
readonly exec: <Row = Record<string, unknown>>(query: string, ...bindings: ReadonlyArray<unknown>) => DurableObjectSqlCursor<Row>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Durable Object storage capabilities needed by EDA SQL adapters.
|
|
89
|
+
*
|
|
90
|
+
* The `transactionSync` callback must remain purely synchronous. Adapter code
|
|
91
|
+
* may run SQL here; model calls, live publish, and Effect suspension must stay
|
|
92
|
+
* outside the callback.
|
|
93
|
+
*/
|
|
94
|
+
interface DurableObjectSessionStorage {
|
|
95
|
+
readonly sql: DurableObjectSqlStorage;
|
|
96
|
+
readonly transactionSync: <A>(closure: () => A) => A;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Construction options for one session-scoped Durable Object session store.
|
|
100
|
+
*
|
|
101
|
+
* One Durable Object SQLite database represents one EDA session, so `sessionId`
|
|
102
|
+
* is fixed at layer construction and not a method parameter.
|
|
103
|
+
*/
|
|
104
|
+
interface DurableObjectSessionStoreOptions {
|
|
105
|
+
readonly sessionId: SessionId;
|
|
106
|
+
readonly storage: DurableObjectSessionStorage;
|
|
107
|
+
/**
|
|
108
|
+
* Transcript definitions to maintain inside every append. Without it the store maintains no
|
|
109
|
+
* transcript; the Durable Object host always supplies one.
|
|
110
|
+
*/
|
|
111
|
+
readonly transcript?: DurableObjectTranscriptOptions;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { DurableObjectTranscriptObserver as a, TranscriptAlert as c, DurableObjectSqlStorage as i, AdoptedLogIncarnation as l, DurableObjectSessionStoreOptions as n, DurableObjectTranscriptOptions as o, DurableObjectSqlCursor as r, DurableObjectTranscriptSliceLimits as s, DurableObjectSessionStorage as t };
|
|
115
|
+
//# sourceMappingURL=durable-object-storage-D3muKtpz.d.ts.map
|