(address: string)
| 288 | * `tools.<integration>.<owner>.<connection>.aliases.deleteAlias` — the same |
| 289 | * dotted nesting the sandbox `tools` proxy produces from property access. */ |
| 290 | export const parseToolAddress = (address: string): ParsedToolAddress | null => { |
| 291 | // Walk to the 4th dot; everything past it is the tool (dots and all). |
| 292 | let cut = -1; |
| 293 | for (let i = 0; i < 4; i++) { |
| 294 | cut = address.indexOf(".", cut + 1); |
| 295 | if (cut === -1) return null; |
| 296 | } |
| 297 | const [prefix, integration, owner, connection] = address.slice(0, cut).split(".") as [ |
| 298 | string, |
| 299 | string, |
| 300 | string, |
| 301 | string, |
| 302 | ]; |
| 303 | const tool = address.slice(cut + 1); |
| 304 | if (prefix !== ADDRESS_PREFIX) return null; |
| 305 | if (!isOwner(owner)) return null; |
| 306 | if (integration.length === 0 || connection.length === 0 || tool.length === 0) { |
| 307 | return null; |
| 308 | } |
| 309 | return { |
| 310 | integration: IntegrationSlug.make(integration), |
| 311 | owner, |
| 312 | connection: ConnectionName.make(connection), |
| 313 | tool: ToolName.make(tool), |
| 314 | }; |
| 315 | }; |
| 316 | |
| 317 | export const connectionAddress = ( |
| 318 | owner: Owner, |
no test coverage detected