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

Function integrationsRemove

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

Source from the content-addressed store, hash-verified

1945 });
1946
1947 const integrationsRemove = (
1948 slug: IntegrationSlug,
1949 ): Effect.Effect<void, IntegrationRemovalNotAllowedError | StorageFailure> =>
1950 transaction(
1951 Effect.gen(function* () {
1952 const existing = yield* findIntegrationRow(slug);
1953 if (!existing) return;
1954 if (!existing.can_remove) {
1955 return yield* new IntegrationRemovalNotAllowedError({ slug });
1956 }
1957 const runtime = runtimes.get(existing.plugin_id);
1958 if (runtime?.plugin.removeIntegration) {
1959 yield* runtime.plugin
1960 .removeIntegration({
1961 ctx: runtime.ctx,
1962 integration: rowToIntegrationRecord(existing, describeAuthMethodsForRow(existing)),
1963 })
1964 .pipe(
1965 Effect.mapError((cause) =>
1966 pluginStorageFailure(existing.plugin_id, "removeIntegration", cause),
1967 ),
1968 );
1969 }
1970 // Drop owned connections / tools / definitions for this integration.
1971 const where = (b: AnyCb) => b("integration", "=", String(slug));
1972 yield* core.deleteMany("tool", { where });
1973 yield* core.deleteMany("definition", { where });
1974 yield* core.deleteMany("connection", { where });
1975 yield* core.deleteMany("integration", {
1976 where: (b: AnyCb) => b("slug", "=", String(slug)),
1977 });
1978 }),
1979 );
1980
1981 const integrationsDetect = (
1982 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