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

Function connectionsRemove

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

Source from the content-addressed store, hash-verified

3154 });
3155
3156 const connectionsRemove = (
3157 ref: ConnectionRef,
3158 ): Effect.Effect<void, ConnectionNotFoundError | StorageFailure> =>
3159 transaction(
3160 Effect.gen(function* () {
3161 const row = yield* findConnectionRow(ref);
3162 if (!row) {
3163 return yield* new ConnectionNotFoundError({
3164 owner: ref.owner,
3165 integration: ref.integration,
3166 name: ref.name,
3167 });
3168 }
3169 const integrationRow = yield* findIntegrationRow(ref.integration);
3170 const runtime = integrationRow ? runtimes.get(integrationRow.plugin_id) : undefined;
3171 if (integrationRow && runtime?.plugin.removeConnection) {
3172 yield* runtime.plugin
3173 .removeConnection({
3174 ctx: runtime.ctx,
3175 integration: ref.integration,
3176 connection: ref,
3177 })
3178 .pipe(
3179 Effect.mapError((cause) =>
3180 pluginStorageFailure(integrationRow.plugin_id, "removeConnection", cause),
3181 ),
3182 );
3183 }
3184 const where = (b: AnyCb) =>
3185 b.and(
3186 byOwner(ref.owner)(b),
3187 b("integration", "=", String(ref.integration)),
3188 b("connection", "=", String(ref.name)),
3189 );
3190 yield* core.deleteMany("tool", { where });
3191 yield* core.deleteMany("definition", { where });
3192 yield* core.deleteMany("connection", {
3193 where: (b: AnyCb) =>
3194 b.and(
3195 byOwner(ref.owner)(b),
3196 b("integration", "=", String(ref.integration)),
3197 b("name", "=", String(ref.name)),
3198 ),
3199 });
3200 }),
3201 );
3202
3203 const connectionsRefresh = (
3204 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