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

Function connectionsUpdate

packages/core/sdk/src/executor.ts:2495–2522  ·  view source on GitHub ↗
(
      ref: ConnectionRef,
      input: UpdateConnectionInput,
    )

Source from the content-addressed store, hash-verified

2493 findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null)));
2494
2495 const connectionsUpdate = (
2496 ref: ConnectionRef,
2497 input: UpdateConnectionInput,
2498 ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> =>
2499 Effect.gen(function* () {
2500 const row = yield* findConnectionRow(ref);
2501 if (!row) {
2502 return yield* new ConnectionNotFoundError({
2503 owner: ref.owner,
2504 integration: ref.integration,
2505 name: ref.name,
2506 });
2507 }
2508 const set: Record<string, unknown> = { updated_at: new Date() };
2509 if (input.description !== undefined) set.description = input.description;
2510 if (input.identityLabel !== undefined) set.identity_label = input.identityLabel;
2511 yield* core.updateMany("connection", {
2512 where: (b: AnyCb) =>
2513 b.and(
2514 byOwner(ref.owner)(b),
2515 b("integration", "=", String(ref.integration)),
2516 b("name", "=", String(ref.name)),
2517 ),
2518 set,
2519 });
2520 const updated = yield* findConnectionRow(ref);
2521 return rowToConnection(updated ?? row);
2522 });
2523
2524 const connectionsRemove = (
2525 ref: ConnectionRef,

Callers 1

createExecutorFunction · 0.85

Calls 3

findConnectionRowFunction · 0.85
byOwnerFunction · 0.85
rowToConnectionFunction · 0.85

Tested by

no test coverage detected