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

Function connectionsRemove

packages/core/sdk/src/executor.ts:3091–3136  ·  view source on GitHub ↗
(
      ref: ConnectionRef,
    )

Source from the content-addressed store, hash-verified

3089 });
3090
3091 const connectionsRemove = (
3092 ref: ConnectionRef,
3093 ): Effect.Effect<void, ConnectionNotFoundError | StorageFailure> =>
3094 transaction(
3095 Effect.gen(function* () {
3096 const row = yield* findConnectionRow(ref);
3097 if (!row) {
3098 return yield* new ConnectionNotFoundError({
3099 owner: ref.owner,
3100 integration: ref.integration,
3101 name: ref.name,
3102 });
3103 }
3104 const integrationRow = yield* findIntegrationRow(ref.integration);
3105 const runtime = integrationRow ? runtimes.get(integrationRow.plugin_id) : undefined;
3106 if (integrationRow && runtime?.plugin.removeConnection) {
3107 yield* runtime.plugin
3108 .removeConnection({
3109 ctx: runtime.ctx,
3110 integration: ref.integration,
3111 connection: ref,
3112 })
3113 .pipe(
3114 Effect.mapError((cause) =>
3115 pluginStorageFailure(integrationRow.plugin_id, "removeConnection", cause),
3116 ),
3117 );
3118 }
3119 const where = (b: AnyCb) =>
3120 b.and(
3121 byOwner(ref.owner)(b),
3122 b("integration", "=", String(ref.integration)),
3123 b("connection", "=", String(ref.name)),
3124 );
3125 yield* core.deleteMany("tool", { where });
3126 yield* core.deleteMany("definition", { where });
3127 yield* core.deleteMany("connection", {
3128 where: (b: AnyCb) =>
3129 b.and(
3130 byOwner(ref.owner)(b),
3131 b("integration", "=", String(ref.integration)),
3132 b("name", "=", String(ref.name)),
3133 ),
3134 });
3135 }),
3136 );
3137
3138 const connectionsRefresh = (
3139 ref: ConnectionRef,

Callers 1

createExecutorFunction · 0.85

Calls 6

findConnectionRowFunction · 0.85
findIntegrationRowFunction · 0.85
pluginStorageFailureFunction · 0.85
byOwnerFunction · 0.85
transactionFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected