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

Function integrationsRemove

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

Source from the content-addressed store, hash-verified

2956 });
2957
2958 const integrationsRemove = (
2959 slug: IntegrationSlug,
2960 ): Effect.Effect<void, IntegrationRemovalNotAllowedError | StorageFailure> =>
2961 transaction(
2962 Effect.gen(function* () {
2963 const existing = yield* findIntegrationRow(slug);
2964 if (!existing) return null;
2965 if (!existing.can_remove) {
2966 return yield* new IntegrationRemovalNotAllowedError({ slug });
2967 }
2968 const runtime = runtimes.get(existing.plugin_id);
2969 if (runtime?.plugin.removeIntegration) {
2970 yield* runtime.plugin
2971 .removeIntegration({
2972 ctx: runtime.ctx,
2973 integration: rowToIntegrationRecord(existing, describeAuthMethodsForRow(existing)),
2974 })
2975 .pipe(
2976 Effect.mapError((cause) =>
2977 pluginStorageFailure(existing.plugin_id, "removeIntegration", cause),
2978 ),
2979 );
2980 }
2981 // Drop owned connections / tools / definitions for this integration.
2982 const where = (b: AnyCb) => b("integration", "=", String(slug));
2983 yield* core.deleteMany("tool", { where });
2984 yield* core.deleteMany("definition", { where });
2985 yield* core.deleteMany("connection", { where });
2986 yield* core.deleteMany("integration", {
2987 where: (b: AnyCb) => b("slug", "=", String(slug)),
2988 });
2989 return existing.plugin_id;
2990 }),
2991 ).pipe(
2992 Effect.tap((removedPluginId) =>
2993 removedPluginId !== null
2994 ? notifyIntegrationChange({ kind: "removed", pluginKey: removedPluginId, slug })
2995 : Effect.void,
2996 ),
2997 Effect.asVoid,
2998 );
2999
3000 const integrationsDetect = (
3001 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