{"name":"virtual-cookies","version":"0.1.1","description":"Virtual cookies store to manage Request/Response associations.","main":"lib/index.js","scripts":{"test":"jest","clean":"rimraf lib","build":"tsc","prepublishOnly":"yarn test && yarn clean && yarn build"},"repository":{"type":"git","url":"git@github.com:mswjs/cookies.git"},"author":{"name":"Artem Zakharchenko"},"license":"MIT","devDependencies":{"@types/jest":"^26.0.15","jest":"^26.6.3","rimraf":"^3.0.2","ts-jest":"^26.4.4","ts-node":"^9.0.0","typescript":"^4.0.5","whatwg-fetch":"^3.5.0"},"dependencies":{"@types/set-cookie-parser":"^2.4.0","set-cookie-parser":"^2.4.6"},"_id":"virtual-cookies@0.1.1","dist":{"shasum":"5fac667e3ec54f07fe4f586c50cae61075ef969d","integrity":"sha512-fkJ/15BmsHd2y+JZ+s4+JCDf29g0JbuM97/KwMsj0sKf4fNEmN9+q7rkTmMf0V1WfNAriOh33EcNCGhYSXugeA==","tarball":"http://registry-npm.ywwl.com/virtual-cookies/download/virtual-cookies-0.1.1.tgz","fileCount":8,"unpackedSize":6118,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJftpwTCRA9TVsSAnZWagAAM3kQAIBbfXRiA/SmBoZZWEzn\nhRzQ4qG3UVRvUpRsFMOBeNWGufuk6gfyqVRUoCZKklW3lnTd0B/5JML/vB57\nnRMiCBcD3GAXq+GBR11bLrxh7qtiWJM5328h8zU06661R4iYs9kVI4ampoWp\nXJMA5Layt15Ru+l+OPJpessTnOYm4+2wSCDE79oSVVHYKuWk8MA7RfBdg8Ry\nEw3T6Eove88Plq55HqqOxr1dJSY9RU6Nw5JXFqBTDVr1RpxLRlD2ITjLNfRy\ni20RjVIiC8ciTvzgPKgzcwNUhWXmBtc8Y4NceH9enfYHlGs2UMXMhFZ8SS3d\nY4N29N3HEULZ9RqXrHhCM2ghtoTZtjwlzIwBobawvkqFUZNKZ6YCSRlK9DZ1\nxFrTZUU8yJH1L299s/M9PTUluJjW/iWr7SGaC//IgdUBYIkkOF059tGM6VXh\nGcan1eeNP+B5hE/ErNlPo39RlIwNx9YOoDuuZNjVpxchau/wG3yoUAM1Pze7\ncGKEMnmehusQKOuhIbUlCWICjwJ+GsGWYqtH1dddgPJsxrpl8Wz6OqsZbfgB\ntAalP7XEgXver/DbKR3nZEmuHPvpQjRyy6DWpTRiKlpUjq1pHmTHV3+YPmA7\nf1U47tcmnNZ9L3hKHkv/fSIp7sSU0AuG7cEAdwWYyWKIA1sn88kBEMRbzFFn\no/AV\r\n=kjjG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFCAHhSAxVI8N2PabFXHNPgvwffXJ6EYGAzhnxZPHp6/AiBqtbuexCWYFZ9qsmOYY1dU+2eqtIoksMQdUAftg2v3cA=="}],"size":2039,"noattachment":false,"key":"/virtual-cookies/-/virtual-cookies-0.1.1.tgz"},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/virtual-cookies_0.1.1_1605803026562_0.5341636039087481"},"_hasShrinkwrap":false,"readme":"[![Latest version](https://img.shields.io/npm/v/virtual-cookies.svg)](https://www.npmjs.com/package/virtual-cookies)\n\n# `virtual-cookies`\n\nVirtual cookie store to manage request/response cookies associations in a unique collection.\n\n## API\n\n### `set(req: Request, res: 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(req: 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(req: 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 [\nChristoph Guttandin](https://github.com/chrisguttandin).\n","publish_time":1605803026678,"_cnpm_publish_time":1605803026678,"dist-tags":{"latest":"0.1.2"}}