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