()
| 2155 | ); |
| 2156 | |
| 2157 | const integrationsList = (): Effect.Effect<readonly Integration[], StorageFailure> => |
| 2158 | Effect.gen(function* () { |
| 2159 | const rows = yield* core.findMany("integration", {}); |
| 2160 | const staticIntegrationList = staticIntegrations().map(staticDeclToIntegration); |
| 2161 | const dbIntegrations = rows.map((row) => |
| 2162 | rowToIntegration(row, describeAuthMethodsForRow(row), describeDisplayForRow(row)), |
| 2163 | ); |
| 2164 | // A scoped toolkit must not advertise providers it grants no tools from |
| 2165 | // (mirrors `connectionsList`). Static integrations are system namespaces, not |
| 2166 | // user providers, so they stay; DB-backed integrations are filtered to |
| 2167 | // those that contribute at least one visible tool under the active policy. |
| 2168 | if (!activeToolPolicyProvider) return [...staticIntegrationList, ...dbIntegrations]; |
| 2169 | const visibleTools = yield* toolsList({ includeAnnotations: false }); |
| 2170 | const visibleIntegrationSlugs = new Set( |
| 2171 | visibleTools.filter((tool) => !tool.static).map((tool) => String(tool.integration)), |
| 2172 | ); |
| 2173 | return [ |
| 2174 | ...staticIntegrationList, |
| 2175 | ...dbIntegrations.filter((integration) => |
| 2176 | visibleIntegrationSlugs.has(String(integration.slug)), |
| 2177 | ), |
| 2178 | ]; |
| 2179 | }); |
| 2180 | |
| 2181 | const integrationsGet = ( |
| 2182 | slug: IntegrationSlug, |
no test coverage detected