Function
withRefreshedSession
(
identity: Identity,
response: Response,
orgSelector: string,
)
Source from the content-addressed store, hash-verified
| 129 | }); |
| 130 | |
| 131 | const withRefreshedSession = ( |
| 132 | identity: Identity, |
| 133 | response: Response, |
| 134 | orgSelector: string, |
| 135 | ): Identity => { |
| 136 | const refreshed = (response.headers.getSetCookie?.() ?? []) |
| 137 | .find((header) => header.startsWith("wos-session=")) |
| 138 | ?.split(";")[0]; |
| 139 | if (!refreshed) throw new Error("response did not refresh the session cookie"); |
| 140 | return { |
| 141 | ...identity, |
| 142 | headers: { cookie: refreshed, [ORG_SELECTOR_HEADER]: orgSelector }, |
| 143 | }; |
| 144 | }; |
| 145 | |
| 146 | /** Invite `member` into `admin`'s org and accept — the real invite flow. |
| 147 | * The member's requests inherit the admin's org selector (org-scoped reads |
Tested by
no test coverage detected