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

Function connectionsUpdate

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

Source from the content-addressed store, hash-verified

2702 findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null)));
2703
2704 const connectionsUpdate = (
2705 ref: ConnectionRef,
2706 input: UpdateConnectionInput,
2707 ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> =>
2708 Effect.gen(function* () {
2709 const row = yield* findConnectionRow(ref);
2710 if (!row) {
2711 return yield* new ConnectionNotFoundError({
2712 owner: ref.owner,
2713 integration: ref.integration,
2714 name: ref.name,
2715 });
2716 }
2717 const set: Record<string, unknown> = { updated_at: new Date() };
2718 if (input.description !== undefined) set.description = input.description;
2719 if (input.identityLabel !== undefined) set.identity_label = input.identityLabel;
2720 yield* core.updateMany("connection", {
2721 where: (b: AnyCb) =>
2722 b.and(
2723 byOwner(ref.owner)(b),
2724 b("integration", "=", String(ref.integration)),
2725 b("name", "=", String(ref.name)),
2726 ),
2727 set,
2728 });
2729 const updated = yield* findConnectionRow(ref);
2730 return rowToConnection(updated ?? row);
2731 });
2732
2733 const connectionsRemove = (
2734 ref: ConnectionRef,

Callers 1

createExecutorFunction · 0.85

Calls 3

findConnectionRowFunction · 0.85
byOwnerFunction · 0.85
rowToConnectionFunction · 0.85

Tested by

no test coverage detected