( relayUrl: string, pubkey: string, name?: string, )
| 110 | } |
| 111 | |
| 112 | export function initFirstWorkspace( |
| 113 | relayUrl: string, |
| 114 | pubkey: string, |
| 115 | name?: string, |
| 116 | ): Workspace { |
| 117 | const normalizedUrl = normalizeRelayUrl(relayUrl); |
| 118 | const trimmedName = name?.trim(); |
| 119 | const workspace: Workspace = { |
| 120 | id: crypto.randomUUID(), |
| 121 | name: trimmedName || deriveWorkspaceName(normalizedUrl), |
| 122 | relayUrl: normalizedUrl, |
| 123 | pubkey, |
| 124 | addedAt: new Date().toISOString(), |
| 125 | }; |
| 126 | saveWorkspaces([workspace]); |
| 127 | saveActiveWorkspaceId(workspace.id); |
| 128 | return workspace; |
| 129 | } |
no test coverage detected