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

Function markRefreshGrantDead

packages/core/sdk/src/executor.ts:1767–1796  ·  view source on GitHub ↗
(
      row: ConnectionRow,
      detail: string,
    )

Source from the content-addressed store, hash-verified

1765 * which is what re-arms refresh. Best-effort: a bookkeeping write failure
1766 * must not mask the refresh failure being reported. */
1767 const markRefreshGrantDead = (
1768 row: ConnectionRow,
1769 detail: string,
1770 ): Effect.Effect<void, never> => {
1771 const existingState = decodeJsonColumn(row.provider_state);
1772 const mergedState =
1773 existingState != null && typeof existingState === "object" && !Array.isArray(existingState)
1774 ? (existingState as Record<string, unknown>)
1775 : {};
1776 const health: HealthCheckResult = {
1777 status: "expired",
1778 checkedAt: Date.now(),
1779 detail,
1780 };
1781 return core
1782 .updateMany("connection", {
1783 where: (b: AnyCb) =>
1784 b.and(
1785 byOwner(row.owner as Owner)(b),
1786 b("integration", "=", String(row.integration)),
1787 b("name", "=", String(row.name)),
1788 ),
1789 set: {
1790 provider_state: { ...mergedState, oauthReauthRequiredAt: Date.now() },
1791 last_health: health,
1792 updated_at: new Date(),
1793 },
1794 })
1795 .pipe(Effect.ignore);
1796 };
1797
1798 // Perform the actual refresh-token grant and persist the rotated material.
1799 const performTokenRefresh = (

Callers 1

performTokenRefreshFunction · 0.85

Calls 2

decodeJsonColumnFunction · 0.85
byOwnerFunction · 0.85

Tested by

no test coverage detected