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

Function connectionsUpdate

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

Source from the content-addressed store, hash-verified

3125 findConnectionRow(ref).pipe(Effect.map((row) => (row ? rowToConnection(row) : null)));
3126
3127 const connectionsUpdate = (
3128 ref: ConnectionRef,
3129 input: UpdateConnectionInput,
3130 ): Effect.Effect<Connection, ConnectionNotFoundError | StorageFailure> =>
3131 Effect.gen(function* () {
3132 const row = yield* findConnectionRow(ref);
3133 if (!row) {
3134 return yield* new ConnectionNotFoundError({
3135 owner: ref.owner,
3136 integration: ref.integration,
3137 name: ref.name,
3138 });
3139 }
3140 const set: Record<string, unknown> = { updated_at: new Date() };
3141 if (input.description !== undefined) set.description = input.description;
3142 if (input.identityLabel !== undefined) set.identity_label = input.identityLabel;
3143 yield* core.updateMany("connection", {
3144 where: (b: AnyCb) =>
3145 b.and(
3146 byOwner(ref.owner)(b),
3147 b("integration", "=", String(ref.integration)),
3148 b("name", "=", String(ref.name)),
3149 ),
3150 set,
3151 });
3152 const updated = yield* findConnectionRow(ref);
3153 return rowToConnection(updated ?? row);
3154 });
3155
3156 const connectionsRemove = (
3157 ref: ConnectionRef,

Callers 1

createExecutorFunction · 0.85

Calls 3

findConnectionRowFunction · 0.85
byOwnerFunction · 0.85
rowToConnectionFunction · 0.85

Tested by

no test coverage detected