| 1 | import { |
| 2 | createEnvironmentRpcCommand, |
| 3 | createEnvironmentRpcQueryAtomFamily, |
| 4 | } from "@t3tools/client-runtime/state/runtime"; |
| 5 | import { WS_METHODS, type EnvironmentId } from "@t3tools/contracts"; |
| 6 | import { Atom } from "effect/reactivity"; |
| 7 | |
| 8 | import { connectionAtomRuntime } from "../connection/runtime"; |
| 9 | |
| 10 | export const managedWorkspaceStatus = createEnvironmentRpcQueryAtomFamily(connectionAtomRuntime, { |
| 11 | label: "environment-data:managed-workspaces:status", |
| 12 | tag: WS_METHODS.managedWorkspacesStatus, |
| 13 | staleTimeMs: 30_000, |
| 14 | idleTtlMs: 60_000, |
| 15 | }); |
| 16 | |
| 17 | export const createManagedWorkspace = createEnvironmentRpcCommand(connectionAtomRuntime, { |
| 18 | label: "environment-data:managed-workspaces:create", |
| 19 | tag: WS_METHODS.managedWorkspacesCreate, |
| 20 | }); |
| 21 | |
| 22 | export const managedWorkspacePending = Atom.family< |
| 23 | EnvironmentId | null, |
| 24 | Atom.Writable<boolean, boolean> |
| 25 | >(() => Atom.make(false)); |