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

Function markRefreshGrantDead

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

Source from the content-addressed store, hash-verified

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

Callers 1

performTokenRefreshFunction · 0.85

Calls 2

decodeJsonColumnFunction · 0.85
byOwnerFunction · 0.85

Tested by

no test coverage detected