MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / integrationsRemove

Function integrationsRemove

packages/core/sdk/src/executor.ts:1963–1995  ·  view source on GitHub ↗
(
      slug: IntegrationSlug,
    )

Source from the content-addressed store, hash-verified

1961 });
1962
1963 const integrationsRemove = (
1964 slug: IntegrationSlug,
1965 ): Effect.Effect<void, IntegrationRemovalNotAllowedError | StorageFailure> =>
1966 transaction(
1967 Effect.gen(function* () {
1968 const existing = yield* findIntegrationRow(slug);
1969 if (!existing) return;
1970 if (!existing.can_remove) {
1971 return yield* new IntegrationRemovalNotAllowedError({ slug });
1972 }
1973 const runtime = runtimes.get(existing.plugin_id);
1974 if (runtime?.plugin.removeIntegration) {
1975 yield* runtime.plugin
1976 .removeIntegration({
1977 ctx: runtime.ctx,
1978 integration: rowToIntegrationRecord(existing, describeAuthMethodsForRow(existing)),
1979 })
1980 .pipe(
1981 Effect.mapError((cause) =>
1982 pluginStorageFailure(existing.plugin_id, "removeIntegration", cause),
1983 ),
1984 );
1985 }
1986 // Drop owned connections / tools / definitions for this integration.
1987 const where = (b: AnyCb) => b("integration", "=", String(slug));
1988 yield* core.deleteMany("tool", { where });
1989 yield* core.deleteMany("definition", { where });
1990 yield* core.deleteMany("connection", { where });
1991 yield* core.deleteMany("integration", {
1992 where: (b: AnyCb) => b("slug", "=", String(slug)),
1993 });
1994 }),
1995 );
1996
1997 const integrationsDetect = (
1998 url: string,

Callers 1

createExecutorFunction · 0.85

Calls 6

findIntegrationRowFunction · 0.85
rowToIntegrationRecordFunction · 0.85
pluginStorageFailureFunction · 0.85
transactionFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected