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

Function connectionsUpdate

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

Source from the content-addressed store, hash-verified

3486 findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null)));
3487
3488 const connectionsUpdate = (
3489 ref: ConnectionRef,
3490 input: UpdateConnectionInput,
3491 ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> =>
3492 Effect.gen(function* () {
3493 const row = yield* findConnectionRow(ref);
3494 if (!row) {
3495 return yield* new ConnectionNotFoundError({
3496 owner: ref.owner,
3497 integration: ref.integration,
3498 name: ref.name,
3499 });
3500 }
3501 const set: Record<string, unknown> = { updated_at: new Date() };
3502 if (input.description !== undefined) set.description = input.description;
3503 if (input.identityLabel !== undefined) set.identity_label = input.identityLabel;
3504 yield* core.updateMany("connection", {
3505 where: (b: AnyCb) =>
3506 b.and(
3507 byOwner(ref.owner)(b),
3508 b("integration", "=", String(ref.integration)),
3509 b("name", "=", String(ref.name)),
3510 ),
3511 set,
3512 });
3513 const updated = yield* findConnectionRow(ref);
3514 return rowToConnection(updated ?? row);
3515 });
3516
3517 const connectionsRemove = (
3518 ref: ConnectionRef,

Callers 1

createExecutorFunction · 0.85

Calls 3

findConnectionRowFunction · 0.85
byOwnerFunction · 0.85
rowToConnectionFunction · 0.85

Tested by

no test coverage detected