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

Function integrationsRemove

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

Source from the content-addressed store, hash-verified

2036 });
2037
2038 const integrationsRemove = (
2039 slug: IntegrationSlug,
2040 ): Effect.Effect<void, IntegrationRemovalNotAllowedError | StorageFailure> =>
2041 transaction(
2042 Effect.gen(function* () {
2043 const existing = yield* findIntegrationRow(slug);
2044 if (!existing) return;
2045 if (!existing.can_remove) {
2046 return yield* new IntegrationRemovalNotAllowedError({ slug });
2047 }
2048 const runtime = runtimes.get(existing.plugin_id);
2049 if (runtime?.plugin.removeIntegration) {
2050 yield* runtime.plugin
2051 .removeIntegration({
2052 ctx: runtime.ctx,
2053 integration: rowToIntegrationRecord(existing, describeAuthMethodsForRow(existing)),
2054 })
2055 .pipe(
2056 Effect.mapError((cause) =>
2057 pluginStorageFailure(existing.plugin_id, "removeIntegration", cause),
2058 ),
2059 );
2060 }
2061 // Drop owned connections / tools / definitions for this integration.
2062 const where = (b: AnyCb) => b("integration", "=", String(slug));
2063 yield* core.deleteMany("tool", { where });
2064 yield* core.deleteMany("definition", { where });
2065 yield* core.deleteMany("connection", { where });
2066 yield* core.deleteMany("integration", {
2067 where: (b: AnyCb) => b("slug", "=", String(slug)),
2068 });
2069 }),
2070 );
2071
2072 const integrationsDetect = (
2073 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