The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as ivsrealtime from "@distilled.cloud/aws/ivs-realtime"; |
| 2 | import { toWireSeconds } from "alchemy/Util/Duration"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import * as Layer from "effect/Layer"; |
| 5 | import { makeIvsRealtimeReplicationHttpBinding } from "./BindingHttp.ts"; |
| 6 | import type { Stage } from "./Stage.ts"; |
| 7 | import { |
| 8 | StartParticipantReplication, |
| 9 | type StartParticipantReplicationRequest, |
| 10 | } from "./StartParticipantReplication.ts"; |
| 11 | |
| 12 | export const StartParticipantReplicationHttp = Layer.effect( |
| 13 | StartParticipantReplication, |
| 14 | Effect.gen(function* () { |
| 15 | const make = yield* makeIvsRealtimeReplicationHttpBinding({ |
| 16 | tag: "AWS.IVSRealtime.StartParticipantReplication", |
| 17 | operation: ivsrealtime.startParticipantReplication, |
| 18 | actions: ["ivs:StartParticipantReplication"], |
| 19 | }); |
| 20 | return Effect.fn(function* (sourceStage: Stage, destinationStage: Stage) { |
| 21 | const startReplication = yield* make(sourceStage, destinationStage); |
| 22 | return ({ reconnectWindow, ...request }: StartParticipantReplicationRequest) => |
| 23 | startReplication({ |
| 24 | ...request, |
| 25 | reconnectWindowSeconds: toWireSeconds(reconnectWindow), |
| 26 | }); |
| 27 | }); |
| 28 | }), |
| 29 | ); |