(address: string)
| 213 | * `tools.<integration>.<owner>.<connection>.aliases.deleteAlias` — the same |
| 214 | * dotted nesting the sandbox `tools` proxy produces from property access. */ |
| 215 | export const parseToolAddress = (address: string): ParsedToolAddress | null => { |
| 216 | // Walk to the 4th dot; everything past it is the tool (dots and all). |
| 217 | let cut = -1; |
| 218 | for (let i = 0; i < 4; i++) { |
| 219 | cut = address.indexOf(".", cut + 1); |
| 220 | if (cut === -1) return null; |
| 221 | } |
| 222 | const [prefix, integration, owner, connection] = address.slice(0, cut).split(".") as [ |
| 223 | string, |
| 224 | string, |
| 225 | string, |
| 226 | string, |
| 227 | ]; |
| 228 | const tool = address.slice(cut + 1); |
| 229 | if (prefix !== ADDRESS_PREFIX) return null; |
| 230 | if (!isOwner(owner)) return null; |
| 231 | if (integration.length === 0 || connection.length === 0 || tool.length === 0) { |
| 232 | return null; |
| 233 | } |
| 234 | return { |
| 235 | integration: IntegrationSlug.make(integration), |
| 236 | owner, |
| 237 | connection: ConnectionName.make(connection), |
| 238 | tool: ToolName.make(tool), |
| 239 | }; |
| 240 | }; |
| 241 | |
| 242 | export const connectionAddress = ( |
| 243 | owner: Owner, |
no test coverage detected