Skip to content
Source
Sign inSign up
Open History to see the last commit

profileStore.ts

20 lines850 Bytes

1import * as Context from "effect/Context";
2import type * as Effect from "effect/Effect";
3import type * as Option from "effect/Option";
4​
5import type { ConnectionProfile } from "./catalog.ts";
6import type { ConnectionAttemptError } from "./model.ts";
7​
8export 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​
19export const make = (service: ConnectionProfileStore["Service"]) =>
20 ConnectionProfileStore.of(service);