()
| 2986 | ); |
| 2987 | |
| 2988 | const integrationsList = (): Effect.Effect<readonly Integration[], StorageFailure> => |
| 2989 | Effect.gen(function* () { |
| 2990 | const rows = yield* core.findMany("integration", {}); |
| 2991 | const staticIntegrationList = staticIntegrations().map(staticDeclToIntegration); |
| 2992 | const dbIntegrations = rows.map((row) => |
| 2993 | rowToIntegration(row, describeAuthMethodsForRow(row), describeDisplayForRow(row)), |
| 2994 | ); |
| 2995 | // A scoped toolkit must not advertise providers it grants no tools from |
| 2996 | // (mirrors `connectionsList`). Static integrations are system namespaces, not |
| 2997 | // user providers, so they stay; DB-backed integrations are filtered to |
| 2998 | // those that contribute at least one visible tool under the active policy. |
| 2999 | if (!activeToolPolicyProvider) return [...staticIntegrationList, ...dbIntegrations]; |
| 3000 | const visibleTools = yield* toolsList({ includeAnnotations: false }); |
| 3001 | const visibleIntegrationSlugs = new Set( |
| 3002 | visibleTools.filter((tool) => !tool.static).map((tool) => String(tool.integration)), |
| 3003 | ); |
| 3004 | return [ |
| 3005 | ...staticIntegrationList, |
| 3006 | ...dbIntegrations.filter((integration) => |
| 3007 | visibleIntegrationSlugs.has(String(integration.slug)), |
| 3008 | ), |
| 3009 | ]; |
| 3010 | }); |
| 3011 | |
| 3012 | const integrationsGet = ( |
| 3013 | slug: IntegrationSlug, |
no test coverage detected