(address: string)
| 195 | * `tools.<integration>.<owner>.<connection>.aliases.deleteAlias` — the same |
| 196 | * dotted nesting the sandbox `tools` proxy produces from property access. */ |
| 197 | export const parseToolAddress = (address: string): ParsedToolAddress | null => { |
| 198 | // Walk to the 4th dot; everything past it is the tool (dots and all). |
| 199 | let cut = -1; |
| 200 | for (let i = 0; i < 4; i++) { |
| 201 | cut = address.indexOf(".", cut + 1); |
| 202 | if (cut === -1) return null; |
| 203 | } |
| 204 | const [prefix, integration, owner, connection] = address.slice(0, cut).split(".") as [ |
| 205 | string, |
| 206 | string, |
| 207 | string, |
| 208 | string, |
| 209 | ]; |
| 210 | const tool = address.slice(cut + 1); |
| 211 | if (prefix !== ADDRESS_PREFIX) return null; |
| 212 | if (!isOwner(owner)) return null; |
| 213 | if (integration.length === 0 || connection.length === 0 || tool.length === 0) { |
| 214 | return null; |
| 215 | } |
| 216 | return { |
| 217 | integration: IntegrationSlug.make(integration), |
| 218 | owner, |
| 219 | connection: ConnectionName.make(connection), |
| 220 | tool: ToolName.make(tool), |
| 221 | }; |
| 222 | }; |
| 223 | |
| 224 | export const connectionAddress = ( |
| 225 | owner: Owner, |
no test coverage detected