Would you be open to exposing a typed setCookies() API for the Node.js client?
Koon's cookie jar currently receives cookies from responses or loadSession(). There is no typed API for seeding it with cookies obtained outside the current client. Callers must construct Koon's serialized session format or send a raw Cookie header, losing a supported way to preserve domain, path, expiry, Secure, HttpOnly, SameSite, and host-only metadata.
The proposed API:
client.setCookies([{
name: 'session',
value: '...',
domain: '.example.com',
path: '/',
expires: -1,
secure: true,
httpOnly: true,
sameSite: 'Lax',
}])
The implementation performs atomic upserts by name/domain/path, supports browser-style session expiry (-1), preserves scope metadata, and rejects unsafe values, public-suffix domains, and unsupported partitioned cookies with structured errors.
I have a tested implementation here:
privatenumber@d10f484
It also fixes the documented ESM named import and adds Node boundary coverage in CI. PR creation appears unavailable for outside contributors, so I am opening an issue first. I am happy to adapt the API shape or provide the patch another way.
Would you be open to exposing a typed
setCookies()API for the Node.js client?Koon's cookie jar currently receives cookies from responses or
loadSession(). There is no typed API for seeding it with cookies obtained outside the current client. Callers must construct Koon's serialized session format or send a rawCookieheader, losing a supported way to preserve domain, path, expiry, Secure, HttpOnly, SameSite, and host-only metadata.The proposed API:
The implementation performs atomic upserts by name/domain/path, supports browser-style session expiry (
-1), preserves scope metadata, and rejects unsafe values, public-suffix domains, and unsupported partitioned cookies with structured errors.I have a tested implementation here:
privatenumber@d10f484
It also fixes the documented ESM named import and adds Node boundary coverage in CI. PR creation appears unavailable for outside contributors, so I am opening an issue first. I am happy to adapt the API shape or provide the patch another way.