()
| 3207 | ); |
| 3208 | |
| 3209 | const integrationsList = (): Effect.Effect<readonly Integration[], StorageFailure> => |
| 3210 | Effect.gen(function* () { |
| 3211 | const rows = yield* core.findMany("integration", {}); |
| 3212 | const staticIntegrationList = staticIntegrations().map(staticDeclToIntegration); |
| 3213 | const dbIntegrations = yield* Effect.forEach(rows, (row) => |
| 3214 | describeAuthMethodsForRow(row).pipe( |
| 3215 | Effect.map((authMethods) => |
| 3216 | rowToIntegration(row, authMethods, describeDisplayForRow(row)), |
| 3217 | ), |
| 3218 | ), |
| 3219 | ); |
| 3220 | // A scoped toolkit must not advertise providers it grants no tools from |
| 3221 | // (mirrors `connectionsList`). Static integrations are system namespaces, not |
| 3222 | // user providers, so they stay; DB-backed integrations are filtered to |
| 3223 | // those that contribute at least one visible tool under the active policy. |
| 3224 | if (!activeToolPolicyProvider) return [...staticIntegrationList, ...dbIntegrations]; |
| 3225 | const visibleTools = yield* toolsList({ includeAnnotations: false }); |
| 3226 | const visibleIntegrationSlugs = new Set( |
| 3227 | visibleTools.filter((tool) => !tool.static).map((tool) => String(tool.integration)), |
| 3228 | ); |
| 3229 | return [ |
| 3230 | ...staticIntegrationList, |
| 3231 | ...dbIntegrations.filter((integration) => |
| 3232 | visibleIntegrationSlugs.has(String(integration.slug)), |
| 3233 | ), |
| 3234 | ]; |
| 3235 | }); |
| 3236 | |
| 3237 | const integrationsGet = ( |
| 3238 | slug: IntegrationSlug, |
no test coverage detected