{"_id":"virtual-cookies","_rev":"2-66ecee56b50df4ee861ed2e55b28850e","name":"virtual-cookies","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.1":{"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":"https://registry.npmjs.org/virtual-cookies/-/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=="}]},"_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},"0.1.2":{"name":"virtual-cookies","version":"0.1.2","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.2","dist":{"shasum":"67683d2bba98b9351d9446274ccbfb9c105671cd","integrity":"sha512-mcjWP9Jp1Qzsm06aXKVUJaTaSdnPuRFz/KOLkx7joAJEcWjdQVJwfyKjlvUS6kpKDhZGWi0qSCZelMc6uij9BQ==","tarball":"https://registry.npmjs.org/virtual-cookies/-/virtual-cookies-0.1.2.tgz","fileCount":8,"unpackedSize":9626,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfy4QaCRA9TVsSAnZWagAAu7MP/0sN18vIOsmXAx8Nhyp2\nrSL15Ww1p09vc+mS+yMKjxmFbsL+uUAhSdfoagkW84mcFJZb4zwOk/SP2Zs3\n+J35aGUrt25oOFGJHGq68mjjrt/uV4GmFvDZwNerelPLKD2S5V3paN8+JHGD\nw/Yip3NnD7/sprYXzLZDoFr0rg9wtRPT3Dd+zQO4piyL1or6lkS4av9yNflb\n0jFzSFJlFiWre2xTzvHTDN5TbVI6yQG45mvnpX4wDt4qjc5DcCPv8jHYfXM5\nOa3oe+MTMa6OFipjpUC6ufCuMBSEyMlmkV4rSz2uRLeOsAcBRKfWaSIooiHa\nNC77+rK0q6BCNOT6Vtm4qI4v+J+3Gs/gnHwRxOhPx2qbNNClnLiQgvhsxTDt\nV/hMr5CF5g6+xaazlANONf4UNZfhOg+uRuoEDRXscnbdqW0TcO/N8p70V7Ey\naAC2URgPoP7dGFhpHncuJH//5CuWllx9r6KLKVDxgxJZAMLJ53FXdJ7vt0Jl\ncCOcgH1U26vvSbEz0oLMTtO8wRPT89ap6n0kz3PjIZNnqzw0p0f90kLVHGJd\naeBgTpKZTOicbSz9o4JzTnINFqQYAy0eLelDTZlujxFHtDwi3z9QQh/G+Mjy\n6UeQKJV15s3bU3Ty8iskPEt2wAs1Wmv3TH/1jJ1zPa+7AZNENMq55azI+YG0\nczry\r\n=dOEB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdbe7F1iqgOw7kUmSeTNanPdzE1Ou7Mm0yf8sam8OBVgIgHWucOn/9XEt4OnSJZeVOmFoaBgT3MCubhVK11rTpfaQ="}]},"_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.2_1607173146223_0.1295647482387401"},"_hasShrinkwrap":false}},"time":{"created":"2020-11-19T16:23:46.561Z","0.1.1":"2020-11-19T16:23:46.678Z","modified":"2022-05-23T07:43:16.948Z","0.1.2":"2020-12-05T12:59:06.409Z"},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"description":"Virtual cookies store to manage Request/Response associations.","repository":{"type":"git","url":"git@github.com:mswjs/cookies.git"},"author":{"name":"Artem Zakharchenko"},"license":"MIT","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","readmeFilename":"README.md"}