{"name":"@mswjs/cookies","version":"0.2.0","author":{"name":"Artem Zakharchenko"},"license":"MIT","_id":"@mswjs/cookies@0.2.0","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/cookies#readme","bugs":{"url":"https://github.com/mswjs/cookies/issues"},"dist":{"shasum":"7ef2b5d7e444498bb27cf57720e61f76a4ce9f23","tarball":"http://registry-npm.ywwl.com/@mswjs/cookies/download/@mswjs/cookies-0.2.0.tgz","fileCount":6,"integrity":"sha512-GTKYnIfXVP8GL8HRWrse+ujqDXCLKvu7+JoL6pvZFzS/d2i9pziByoWD69cOe35JNoSrx2DPNqrhUF+vgV3qUA==","signatures":[{"sig":"MEQCIF46Oc9gayHVFMaNBQ4kx5jKQPOxhDWn3PYhPi+gKODaAiA4r5L7IM49S6VyfLQ1AOK/tEOFHFtFSj+rIJqfNPFkqw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10704,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiK1PGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpAKA//REdmRVFXxrDk9LfP9yxlaYnhduwJbKwLUOBosqtGuYTMxWR7\r\ntJYH3vyzkVw1KyjTmIM4Y13IYnbxwGdvYIiH4ITrRee4XaOvNqET42THH5fe\r\naLaNJjWLzBV9IJgf35LQ7O272vBNIvm7YoOobH4v0lRw4UQHes9kuUN8fnJo\r\nprD8UH/vJfRfAsfR3vj4ZaVYiGr5Z1fFHtUheGx3JDD3xBOUBo3LkfOMPh0E\r\neqI/IeTvQyPuP9UWJJ7yYRyh4vDYv64TbBvgZ1i/2BNwUHuvpe5frgvYZyQ+\r\nl7/+cI3qdhrr4IHdFJxBIvtsGosoGIQvQqseWaYhJpDFAYIp0+qWA0laY5yN\r\nLhXJ8FaiR3GISB61SWMtF0p4zPYI5HcLufuAn7H0To/L9rbECqVtSvgHzbAW\r\nt0TPY5o2UFZvOjxOIgcH7l4QZbMGQ3B3/sdNcfoh4aSGvaeCl2RKCcwk7Dbn\r\n3a0tjxc4HNeVqDvTctVda/LbWPv65Oh3eby0JWSYLs6LTeixPdKsFw+6yUHU\r\nxNPCMaGNqSiSXy68f7ERAP4QWI+YUDhTs9wl5tDqNIUQyP7hFjnEjE6RPZqG\r\nR68dbwmCvSRnHTPMxgbs0Ji7BPCyw9IV8wA5LBZJ/CQpT76hk36iMCHuZkjM\r\npLguz2MfCb48bVxHtZanim4L66jxD9dmbUU=\r\n=vpHQ\r\n-----END PGP SIGNATURE-----\r\n","size":3429,"noattachment":false,"key":"/@mswjs/cookies/-/@mswjs/cookies-0.2.0.tgz"},"main":"lib/index.js","types":"./lib/index.d.ts","engines":{"node":">=14"},"gitHead":"e9f59e3251719ef5c8d17d174f0a18d3099eff02","scripts":{"test":"jest","build":"yarn clean && tsc","clean":"rimraf lib","start":"tsc -w","prepack":"yarn build","prepare":"yarn simple-git-hooks init","release":"semantic-release","prepublishOnly":"yarn test"},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"repository":{"url":"git+ssh://git@github.com/mswjs/cookies.git","type":"git"},"_npmVersion":"8.5.4","description":"Virtual cookies store to manage Request/Response associations.","directories":{},"_nodeVersion":"16.14.0","dependencies":{"set-cookie-parser":"^2.4.6","@types/set-cookie-parser":"^2.4.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","rimraf":"^3.0.2","ts-jest":"^26.4.4","ts-node":"^9.0.0","commitizen":"^4.2.4","typescript":"^4.0.5","@types/jest":"^26.0.15","whatwg-fetch":"^3.5.0","@commitlint/cli":"^16.0.3","semantic-release":"^19.0.2","simple-git-hooks":"^2.7.0","@semantic-release/git":"^10.0.1","cz-conventional-changelog":"^3.3.0","@commitlint/config-conventional":"^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/cookies_0.2.0_1647006661953_0.919301769837138","host":"s3://npm-registry-packages"},"readme":"[![Latest version](https://img.shields.io/npm/v/@mswjs/cookies.svg)](https://www.npmjs.com/package/@mswjs/cookies)\n\n# Cookies\n\nManage request/response cookies in the environments where those are not supported.\n\n## Install\n\n```bash\nnpm install @mswjs/cookies\n```\n\n## API\n\n### `set(request: Request, response: Response)`\n\nSets the response cookies in the store associated with the given request origin.\n\n```js\nstore.set(\n  new Request('https://mswjs.io'),\n  new Response(null, {\n    headers: new Headers({\n      'set-cookie': 'id=abc-123',\n    }),\n  }),\n)\n```\n\n### `get(request: Request)`\n\nRetrieves the cookies relevant to the given request's origin.\n\n```js\nstore.get(new Request('https://mswjs.io'))\n```\n\n> `.get()` respects the `req.credentials` policy.\n\nExecuting this command returns a `Map` instance with the request cookies:\n\n```js\nMap {\n  \"id\" => { name: \"id\", value: \"abc-123\" }\n}\n```\n\n### `getAll()`\n\nReturns all the cookies in the store.\n\nExecuting `.getAll()` method returns a `Map` instance with request cookies grouped by request origin.\n\n```js\nMap {\n  \"https://mswjs.io\" => Map {\n    \"id\" => { name: \"id\", value: \"abc-123\" }\n  }\n}\n```\n\n### `deleteAll(request: Request)`\n\nRemoves all the cookies associated with the given request's origin.\n\n### `persist()`\n\nPersists the current store state in the `localStorage`.\n\n### `hydrate()`\n\nHydrates the store values from the previously persisted state in `localStorage`.\n\n### `clear()`\n\nRemoves all the cookies from the store, producing a nice and shiny empty store.\n\n## Credits\n\nOriginal idea by [Christoph Guttandin](https://github.com/chrisguttandin).\n","publish_time":1647006662130,"_cnpm_publish_time":1647006662130,"dist-tags":{"latest":"1.1.1"}}