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

Function integrationsRemove

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

Source from the content-addressed store, hash-verified

2436 });
2437
2438 const integrationsRemove = (
2439 slug: IntegrationSlug,
2440 ): Effect.Effect<void, IntegrationRemovalNotAllowedError | StorageFailure> =>
2441 transaction(
2442 Effect.gen(function* () {
2443 const existing = yield* findIntegrationRow(slug);
2444 if (!existing) return null;
2445 if (!existing.can_remove) {
2446 return yield* new IntegrationRemovalNotAllowedError({ slug });
2447 }
2448 const runtime = runtimes.get(existing.plugin_id);
2449 if (runtime?.plugin.removeIntegration) {
2450 yield* runtime.plugin
2451 .removeIntegration({
2452 ctx: runtime.ctx,
2453 integration: rowToIntegrationRecord(existing, describeAuthMethodsForRow(existing)),
2454 })
2455 .pipe(
2456 Effect.mapError((cause) =>
2457 pluginStorageFailure(existing.plugin_id, "removeIntegration", cause),
2458 ),
2459 );
2460 }
2461 // Drop owned connections / tools / definitions for this integration.
2462 const where = (b: AnyCb) => b("integration", "=", String(slug));
2463 yield* core.deleteMany("tool", { where });
2464 yield* core.deleteMany("definition", { where });
2465 yield* core.deleteMany("connection", { where });
2466 yield* core.deleteMany("integration", {
2467 where: (b: AnyCb) => b("slug", "=", String(slug)),
2468 });
2469 return existing.plugin_id;
2470 }),
2471 ).pipe(
2472 Effect.tap((removedPluginId) =>
2473 removedPluginId !== null
2474 ? notifyIntegrationChange({ kind: "removed", pluginKey: removedPluginId, slug })
2475 : Effect.void,
2476 ),
2477 Effect.asVoid,
2478 );
2479
2480 const integrationsDetect = (
2481 url: string,

Callers 1

createExecutorFunction · 0.85

Calls 7

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

Tested by

no test coverage detected