| 1 | import * as Context from "effect/Context"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import type * as Option from "effect/Option"; |
| 4 | |
| 5 | import type { ConnectionProfile } from "./catalog.ts"; |
| 6 | import type { ConnectionAttemptError } from "./model.ts"; |
| 7 | |
| 8 | export class ConnectionProfileStore extends Context.Service< |
| 9 | ConnectionProfileStore, |
| 10 | { |
| 11 | readonly get: ( |
| 12 | connectionId: string, |
| 13 | ) => Effect.Effect<Option.Option<ConnectionProfile>, ConnectionAttemptError>; |
| 14 | readonly put: (profile: ConnectionProfile) => Effect.Effect<void, ConnectionAttemptError>; |
| 15 | readonly remove: (connectionId: string) => Effect.Effect<void, ConnectionAttemptError>; |
| 16 | } |
| 17 | >()("@t3tools/client-runtime/connection/profileStore/ConnectionProfileStore") {} |
| 18 | |
| 19 | export const make = (service: ConnectionProfileStore["Service"]) => |
| 20 | ConnectionProfileStore.of(service); |