| 126 | }); |
| 127 | |
| 128 | const withRefreshedSession = (identity: Identity, response: Response): Identity => { |
| 129 | const refreshed = (response.headers.getSetCookie?.() ?? []) |
| 130 | .find((header) => header.startsWith("wos-session=")) |
| 131 | ?.split(";")[0]; |
| 132 | if (!refreshed) throw new Error("response did not refresh the session cookie"); |
| 133 | return { ...identity, headers: { cookie: refreshed } }; |
| 134 | }; |
| 135 | |
| 136 | /** Invite `member` into `admin`'s org and accept — the real invite flow. */ |
| 137 | const joinOrg = (target: TargetShape, admin: Identity, member: Identity) => |