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

Function connectionsUpdate

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

Source from the content-addressed store, hash-verified

4776 findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null)));
4777
4778 const connectionsUpdate = (
4779 ref: ConnectionRef,
4780 input: UpdateConnectionInput,
4781 ): Effect.Effect<Connection, ConnectionNotFoundError | OrgWriteDeniedError | StorageFailure> =>
4782 transaction(
4783 Effect.gen(function* () {
4784 yield* guardOrgWrite(ref.owner);
4785 const row = yield* findConnectionRow(ref);
4786 if (!row) {
4787 return yield* new ConnectionNotFoundError({
4788 owner: ref.owner,
4789 integration: ref.integration,
4790 name: ref.name,
4791 });
4792 }
4793 const set: Record<string, unknown> = { updated_at: new Date() };
4794 if (input.description !== undefined) set.description = input.description;
4795 if (input.identityLabel !== undefined) set.identity_label = input.identityLabel;
4796 yield* core.updateMany("connection", {
4797 where: (b: AnyCb) =>
4798 b.and(
4799 byOwner(ref.owner)(b),
4800 b("integration", "=", String(ref.integration)),
4801 b("name", "=", String(ref.name)),
4802 ),
4803 set,
4804 });
4805 const updated = yield* findConnectionRow(ref);
4806 return rowToConnection(updated ?? row);
4807 }),
4808 );
4809
4810 const connectionsRemove = (
4811 ref: ConnectionRef,

Callers 1

createExecutorFunction · 0.85

Calls 5

guardOrgWriteFunction · 0.85
findConnectionRowFunction · 0.85
byOwnerFunction · 0.85
rowToConnectionFunction · 0.85
transactionFunction · 0.70

Tested by

no test coverage detected