(
row: ConnectionRow,
detail: string,
)
| 1909 | * which is what re-arms refresh. Best-effort: a bookkeeping write failure |
| 1910 | * must not mask the refresh failure being reported. */ |
| 1911 | const markRefreshGrantDead = ( |
| 1912 | row: ConnectionRow, |
| 1913 | detail: string, |
| 1914 | ): Effect.Effect<void, never> => { |
| 1915 | const existingState = decodeJsonColumn(row.provider_state); |
| 1916 | const mergedState = |
| 1917 | existingState != null && typeof existingState === "object" && !Array.isArray(existingState) |
| 1918 | ? (existingState as Record<string, unknown>) |
| 1919 | : {}; |
| 1920 | const health: HealthCheckResult = { |
| 1921 | status: "expired", |
| 1922 | checkedAt: Date.now(), |
| 1923 | detail, |
| 1924 | }; |
| 1925 | return core |
| 1926 | .updateMany("connection", { |
| 1927 | where: (b: AnyCb) => |
| 1928 | b.and( |
| 1929 | byOwner(row.owner as Owner)(b), |
| 1930 | b("integration", "=", String(row.integration)), |
| 1931 | b("name", "=", String(row.name)), |
| 1932 | ), |
| 1933 | set: { |
| 1934 | provider_state: { |
| 1935 | ...mergedState, |
| 1936 | oauthReauthRequiredAt: Date.now(), |
| 1937 | oauthReauthRequiredDetail: detail, |
| 1938 | }, |
| 1939 | last_health: health, |
| 1940 | updated_at: new Date(), |
| 1941 | }, |
| 1942 | }) |
| 1943 | .pipe(Effect.ignore); |
| 1944 | }; |
| 1945 | |
| 1946 | /** Write a re-minted token back: a ROTATED refresh token into the refresh |
| 1947 | * item, the access token into the connection's primary provider item, and |
no test coverage detected