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

Function integrationsRemove

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

Source from the content-addressed store, hash-verified

2758 });
2759
2760 const integrationsRemove = (
2761 slug: IntegrationSlug,
2762 ): Effect.Effect<void, IntegrationRemovalNotAllowedError | StorageFailure> =>
2763 transaction(
2764 Effect.gen(function* () {
2765 const existing = yield* findIntegrationRow(slug);
2766 if (!existing) return null;
2767 if (!existing.can_remove) {
2768 return yield* new IntegrationRemovalNotAllowedError({ slug });
2769 }
2770 const runtime = runtimes.get(existing.plugin_id);
2771 if (runtime?.plugin.removeIntegration) {
2772 yield* runtime.plugin
2773 .removeIntegration({
2774 ctx: runtime.ctx,
2775 integration: rowToIntegrationRecord(existing, describeAuthMethodsForRow(existing)),
2776 })
2777 .pipe(
2778 Effect.mapError((cause) =>
2779 pluginStorageFailure(existing.plugin_id, "removeIntegration", cause),
2780 ),
2781 );
2782 }
2783 // Drop owned connections / tools / definitions for this integration.
2784 const where = (b: AnyCb) => b("integration", "=", String(slug));
2785 yield* core.deleteMany("tool", { where });
2786 yield* core.deleteMany("definition", { where });
2787 yield* core.deleteMany("connection", { where });
2788 yield* core.deleteMany("integration", {
2789 where: (b: AnyCb) => b("slug", "=", String(slug)),
2790 });
2791 return existing.plugin_id;
2792 }),
2793 ).pipe(
2794 Effect.tap((removedPluginId) =>
2795 removedPluginId !== null
2796 ? notifyIntegrationChange({ kind: "removed", pluginKey: removedPluginId, slug })
2797 : Effect.void,
2798 ),
2799 Effect.asVoid,
2800 );
2801
2802 const integrationsDetect = (
2803 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