The best way to control Claude Code, Codex and more from any computer or phone

main
ts 53 lines 1.88 KB
Raw
1 import type * as eventbridge from "@distilled.cloud/aws/eventbridge";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { Archive } from "./Archive.ts";
5
6 export interface StartReplayRequest extends Omit<
7 eventbridge.StartReplayRequest,
8 "EventSourceArn" | "Destination"
9 > {
10 /**
11 * Replay destination. Defaults to the archive's source event bus — the
12 * only destination EventBridge allows for a replay. Provide it explicitly
13 * to narrow delivery to specific rules via `FilterArns`.
14 */
15 Destination?: eventbridge.ReplayDestination;
16 }
17
18 /**
19 * Starts a replay of archived events (`events:StartReplay`).
20 *
21 * Bind this operation to an {@link Archive} inside a function runtime to get
22 * a callable that replays a time window of archived events onto a
23 * destination event bus — the runtime half of disaster-recovery and
24 * backfill tooling. Provide the `StartReplayHttp` layer on the Function to
25 * satisfy the binding.
26 * ### Replaying Events
27 * **Example:** Replay a Time Window from the Bound Archive
28 * ```typescript
29 * // init — bind the archive (provide AWS.EventBridge.StartReplayHttp on the Function)
30 * const startReplay = yield* AWS.EventBridge.StartReplay(archive);
31 *
32 * // runtime — replay yesterday's events back onto the archive's source bus
33 * const replay = yield* startReplay({
34 * ReplayName: "backfill-2026-07-14",
35 * EventStartTime: new Date("2026-07-14T00:00:00Z"),
36 * EventEndTime: new Date("2026-07-15T00:00:00Z"),
37 * });
38 * ```
39 *
40 * @binding
41 */
42 export interface StartReplay extends Binding.Service<
43 StartReplay,
44 "AWS.EventBridge.StartReplay",
45 (
46 archive: Archive,
47 ) => Effect.Effect<
48 (
49 request: StartReplayRequest,
50 ) => Effect.Effect<eventbridge.StartReplayResponse, eventbridge.StartReplayError>
51 >
52 > {}
53 export const StartReplay = Binding.Service<StartReplay>("AWS.EventBridge.StartReplay");