{"name":"@mswjs/cookies","version":"0.1.7","author":{"name":"Artem Zakharchenko"},"license":"MIT","_id":"@mswjs/cookies@0.1.7","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/cookies#readme","bugs":{"url":"https://github.com/mswjs/cookies/issues"},"dist":{"shasum":"d334081b2c51057a61c1dd7b76ca3cac02251651","tarball":"http://registry-npm.ywwl.com/@mswjs/cookies/download/@mswjs/cookies-0.1.7.tgz","fileCount":6,"integrity":"sha512-bDg1ReMBx+PYDB4Pk7y1Q07Zz1iKIEUWQpkEXiA2lEWg9gvOZ8UBmGXilCEUvyYoRFlmr/9iXTRR69TrgSwX/Q==","signatures":[{"sig":"MEUCIQC+8d65wUL7AEK3ucR/BqJ+bfPmgdcTN1+3UHmKhJldigIgdpPcowKnvjZfpxEjWEAVze4lRFeNrFsu9PiKGGjY3pw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10540,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh6Bl7CRA9TVsSAnZWagAA2xsQAKSl1V/fkQLlOl0mDhOY\nlFuHyoyeyM5PUByfqqOlR6IVRaqI3PtyumsdQ1PCKv4h4pH0KEGxG7lQk4i/\nObYsINT2jGUE3v6TPfz6cfPkkPTjLrsxXXYTEUhdA/X2GLK0vCZh1VCbm5Ik\npkDwe+pVNpDyrTAnh8HlIsVaLN1ci1Nv/Dsakj9L7SPk7MYy6yGdowdCZ8dl\n/AaNi3cMcihWX3JFsOe0fz50A3pg59pWIuc0Pzg3a3PLxftiUixNR1WNq2Gf\n6H4r4CzNQl3Jd3T7+qXNl27zFr4H37vnFhbEkfc1tlIY0OtwFb3nFpM7AEz8\ntkBHm4YOhogr7dZawHNDRAYq6087kTGUF7c1i1AxAvg3D0SWj+jyH6nqdU9m\nwSL2WBEf9Q7YSkkIoMjouQuJos9eJaTrb+Md6Wc/7Xf+espitaoNBIhAVFX8\nfdV4yboBv+dIEbdYuexZ9v+MqXgHvMfDNgE6duHxPMGKGGBdtwFPSq3J0QyB\nCNnje6Kec8ZaYGN7XejBpfSVjU1y81k25q5P2hmQp91/F4Ej9PnTaW2dKyRS\nG8CV2ZK5ZSV5rQ7yQH5fTOZ+K7ViRSnn6yZreiM3ewjnaLiFjDeo1IEv3J0W\nKyj1LDDr3Up5G9WFgoXimcn8SwnA97MThkB2inDdFobSDZqwS5jnPPhBptya\nPOqT\r\n=bGAJ\r\n-----END PGP SIGNATURE-----\r\n","size":3415,"noattachment":false,"key":"/@mswjs/cookies/-/@mswjs/cookies-0.1.7.tgz"},"main":"lib/index.js","gitHead":"80abf96d8455c0f5b9e8d148385fba5d06daf175","scripts":{"test":"jest","build":"yarn clean && tsc","clean":"rimraf lib","start":"tsc -w","prepare":"yarn simple-git-hooks init","prepublishOnly":"yarn test && yarn build"},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"repository":{"url":"git+ssh://git@github.com/mswjs/cookies.git","type":"git"},"_npmVersion":"6.12.1","description":"Virtual cookies store to manage Request/Response associations.","directories":{},"_nodeVersion":"12.13.1","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","simple-git-hooks":"^2.7.0","cz-conventional-changelog":"^3.3.0","@commitlint/config-conventional":"^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/cookies_0.1.7_1642600827737_0.08795633350429277","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":1642600827910,"_cnpm_publish_time":1642600827910,"dist-tags":{"latest":"1.1.1"}}