From 649ae8d24cd0457fd6a16b35bd5d35dc556d0ef7 Mon Sep 17 00:00:00 2001 From: opensourcezeal <269018900+opensourcezeal@users.noreply.github.com> Date: Mon, 20 Apr 2026 21:41:12 +0200 Subject: [PATCH 1/2] Fixed non-functional typos throughout the codebase --- lib/commands/ci.js | 2 +- lib/trust-cmd.js | 2 +- .../content/browserify-zlib.json | 2 +- .../content/https-browserify.json | 10 ++-- .../fixtures/registry-mocks/content/ms.json | 8 +-- .../registry-mocks/content/retry.json | 2 +- .../registry-mocks/content/through.json | 50 +++++++++---------- .../registry-mocks/content/tough-cookie.json | 2 +- .../reify-cases/tap-with-yarn-lock.js | 2 +- workspaces/libnpmexec/test/registry.js | 4 +- 10 files changed, 42 insertions(+), 42 deletions(-) diff --git a/lib/commands/ci.js b/lib/commands/ci.js index f6c97aea30f70..9b89c88498dc7 100644 --- a/lib/commands/ci.js +++ b/lib/commands/ci.js @@ -63,7 +63,7 @@ class CI extends ArboristWorkspaceCmd { const virtualInventory = new Map(virtualArb.virtualTree.inventory) // Now we make our real Arborist. - // We need a new one because the virtual tree fromt the lockfile can have extraneous dependencies in it that won't install on this platform + // We need a new one because the virtual tree from the lockfile can have extraneous dependencies in it that won't install on this platform const arb = new Arborist(opts) await arb.buildIdealTree() diff --git a/lib/trust-cmd.js b/lib/trust-cmd.js index 5fab8df1d21aa..8da76568e27e0 100644 --- a/lib/trust-cmd.js +++ b/lib/trust-cmd.js @@ -27,7 +27,7 @@ class TrustCommand extends BaseCommand { // dialogue is non-log text that is different from our usual npm prefix logging // it should always show to the user unless --json is specified - // it's not controled by log levels + // it's not controlled by log levels dialogue (strings, ...values) { const json = this.config.get('json') if (!json) { diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/browserify-zlib.json b/workspaces/arborist/test/fixtures/registry-mocks/content/browserify-zlib.json index 4f87ba764f2a8..8922c562797fc 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/browserify-zlib.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/browserify-zlib.json @@ -438,7 +438,7 @@ } } }, - "readme": "# browserify-zlib\n\n[![Travis CI](https://travis-ci.org/devongovett/browserify-zlib.svg?branch=master)](https://travis-ci.org/devongovett/browserify-zlib)\n[![Dependency Status](https://david-dm.org/devongovett/browserify-zlib.svg?style=flat-square)](https://david-dm.org/devongovett/browserify-zlib) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n## Description\n\nEmulates Node's [zlib](https://nodejs.org/api/zlib.html) module for the browser. Can be used as a drop in replacement with [Browserify](http://browserify.org) and [webpack](http://webpack.github.io/).\n\nThe heavy lifting is done using [pako](https://github.com/nodeca/pako). The code in this module is modeled closely after the code in the source of Node core to get as much compatability as possible.\n\n## API\n\nhttps://nodejs.org/api/zlib.html\n\n## Not implemented\n\nThe following options/methods are not supported because pako does not support them yet.\n\n* The `params` method\n\n## License\n\nMIT\n", + "readme": "# browserify-zlib\n\n[![Travis CI](https://travis-ci.org/devongovett/browserify-zlib.svg?branch=master)](https://travis-ci.org/devongovett/browserify-zlib)\n[![Dependency Status](https://david-dm.org/devongovett/browserify-zlib.svg?style=flat-square)](https://david-dm.org/devongovett/browserify-zlib) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n## Description\n\nEmulates Node's [zlib](https://nodejs.org/api/zlib.html) module for the browser. Can be used as a drop in replacement with [Browserify](http://browserify.org) and [webpack](http://webpack.github.io/).\n\nThe heavy lifting is done using [pako](https://github.com/nodeca/pako). The code in this module is modeled closely after the code in the source of Node core to get as much compatibility as possible.\n\n## API\n\nhttps://nodejs.org/api/zlib.html\n\n## Not implemented\n\nThe following options/methods are not supported because pako does not support them yet.\n\n* The `params` method\n\n## License\n\nMIT\n", "maintainers": [ { "email": "dignifiedquire@gmail.com", diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/https-browserify.json b/workspaces/arborist/test/fixtures/registry-mocks/content/https-browserify.json index 13009536197d3..0b7254b02ca45 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/https-browserify.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/https-browserify.json @@ -2,7 +2,7 @@ "_id": "https-browserify", "_rev": "9-880a61611dbcc5663dcb3364ce5cdfc3", "name": "https-browserify", - "description": "https module compatability for browserify", + "description": "https module compatibility for browserify", "dist-tags": { "latest": "1.0.0" }, @@ -10,7 +10,7 @@ "0.0.0": { "name": "https-browserify", "version": "0.0.0", - "description": "https module compatability for browserify", + "description": "https module compatibility for browserify", "main": "index.js", "repository": { "type": "git", @@ -53,7 +53,7 @@ "0.0.1": { "name": "https-browserify", "version": "0.0.1", - "description": "https module compatability for browserify", + "description": "https module compatibility for browserify", "main": "index.js", "repository": { "type": "git", @@ -107,7 +107,7 @@ }, "1.0.0": { "name": "https-browserify", - "description": "https module compatability for browserify", + "description": "https module compatibility for browserify", "version": "1.0.0", "author": { "name": "James Halliday", @@ -170,7 +170,7 @@ "directories": {} } }, - "readme": "# https-browserify\n\nhttps module compatability for browserify\n\n# example\n\n``` js\nvar https = require('https-browserify')\nvar r = https.request('https://github.com')\nr.on('request', function (res) {\n console.log(res)\n})\n```\n\n# methods\n\nThe API is the same as the client portion of the\n[node core https module](http://nodejs.org/docs/latest/api/https.html).\n\n# license\n\nMIT\n", + "readme": "# https-browserify\n\nhttps module compatibility for browserify\n\n# example\n\n``` js\nvar https = require('https-browserify')\nvar r = https.request('https://github.com')\nr.on('request', function (res) {\n console.log(res)\n})\n```\n\n# methods\n\nThe API is the same as the client portion of the\n[node core https module](http://nodejs.org/docs/latest/api/https.html).\n\n# license\n\nMIT\n", "maintainers": [ { "name": "feross", diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/ms.json b/workspaces/arborist/test/fixtures/registry-mocks/content/ms.json index 0dafe515088ec..df4f8c786dabe 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/ms.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/ms.json @@ -391,7 +391,7 @@ "0.7.2": { "name": "ms", "version": "0.7.2", - "description": "Tiny milisecond conversion utility", + "description": "Tiny millisecond conversion utility", "repository": { "type": "git", "url": "git+https://github.com/zeit/ms.git" @@ -463,7 +463,7 @@ "0.7.3": { "name": "ms", "version": "0.7.3", - "description": "Tiny milisecond conversion utility", + "description": "Tiny millisecond conversion utility", "repository": { "type": "git", "url": "git+https://github.com/zeit/ms.git" @@ -535,7 +535,7 @@ "1.0.0": { "name": "ms", "version": "1.0.0", - "description": "Tiny milisecond conversion utility", + "description": "Tiny millisecond conversion utility", "repository": { "type": "git", "url": "git+https://github.com/zeit/ms.git" @@ -608,7 +608,7 @@ "2.0.0": { "name": "ms", "version": "2.0.0", - "description": "Tiny milisecond conversion utility", + "description": "Tiny millisecond conversion utility", "repository": { "type": "git", "url": "git+https://github.com/zeit/ms.git" diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/retry.json b/workspaces/arborist/test/fixtures/registry-mocks/content/retry.json index 15662e3780cd5..36950179f70b9 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/retry.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/retry.json @@ -736,7 +736,7 @@ "johnloy": true, "losymear": true }, - "readme": "\n[![Build Status](https://secure.travis-ci.org/tim-kos/node-retry.png?branch=master)](http://travis-ci.org/tim-kos/node-retry \"Check this project's build status on TravisCI\")\n[![codecov](https://codecov.io/gh/tim-kos/node-retry/branch/master/graph/badge.svg)](https://codecov.io/gh/tim-kos/node-retry)\n\n\n# retry\n\nAbstraction for exponential and custom retry strategies for failed operations.\n\n## Installation\n\n npm install retry\n\n## Current Status\n\nThis module has been tested and is ready to be used.\n\n## Tutorial\n\nThe example below will retry a potentially failing `dns.resolve` operation\n`10` times using an exponential backoff strategy. With the default settings, this\nmeans the last attempt is made after `17 minutes and 3 seconds`.\n\n``` javascript\nvar dns = require('dns');\nvar retry = require('retry');\n\nfunction faultTolerantResolve(address, cb) {\n var operation = retry.operation();\n\n operation.attempt(function(currentAttempt) {\n dns.resolve(address, function(err, addresses) {\n if (operation.retry(err)) {\n return;\n }\n\n cb(err ? operation.mainError() : null, addresses);\n });\n });\n}\n\nfaultTolerantResolve('nodejs.org', function(err, addresses) {\n console.log(err, addresses);\n});\n```\n\nOf course you can also configure the factors that go into the exponential\nbackoff. See the API documentation below for all available settings.\ncurrentAttempt is an int representing the number of attempts so far.\n\n``` javascript\nvar operation = retry.operation({\n retries: 5,\n factor: 3,\n minTimeout: 1 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n});\n```\n\n## API\n\n### retry.operation([options])\n\nCreates a new `RetryOperation` object. `options` is the same as `retry.timeouts()`'s `options`, with two additions:\n\n* `forever`: Whether to retry forever, defaults to `false`.\n* `unref`: Whether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.\n* `maxRetryTime`: The maximum time (in milliseconds) that the retried operation is allowed to run. Default is `Infinity`. \n\n### retry.timeouts([options])\n\nReturns an array of timeouts. All time `options` and return values are in\nmilliseconds. If `options` is an array, a copy of that array is returned.\n\n`options` is a JS object that can contain any of the following keys:\n\n* `retries`: The maximum amount of times to retry the operation. Default is `10`. Seting this to `1` means `do it once, then retry it once`.\n* `factor`: The exponential factor to use. Default is `2`.\n* `minTimeout`: The number of milliseconds before starting the first retry. Default is `1000`.\n* `maxTimeout`: The maximum number of milliseconds between two retries. Default is `Infinity`.\n* `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `false`.\n\nThe formula used to calculate the individual timeouts is:\n\n```\nMath.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout)\n```\n\nHave a look at [this article][article] for a better explanation of approach.\n\nIf you want to tune your `factor` / `times` settings to attempt the last retry\nafter a certain amount of time, you can use wolfram alpha. For example in order\nto tune for `10` attempts in `5 minutes`, you can use this equation:\n\n![screenshot](https://github.com/tim-kos/node-retry/raw/master/equation.gif)\n\nExplaining the various values from left to right:\n\n* `k = 0 ... 9`: The `retries` value (10)\n* `1000`: The `minTimeout` value in ms (1000)\n* `x^k`: No need to change this, `x` will be your resulting factor\n* `5 * 60 * 1000`: The desired total amount of time for retrying in ms (5 minutes)\n\nTo make this a little easier for you, use wolfram alpha to do the calculations:\n\n\n\n[article]: http://dthain.blogspot.com/2009/02/exponential-backoff-in-distributed.html\n\n### retry.createTimeout(attempt, opts)\n\nReturns a new `timeout` (integer in milliseconds) based on the given parameters.\n\n`attempt` is an integer representing for which retry the timeout should be calculated. If your retry operation was executed 4 times you had one attempt and 3 retries. If you then want to calculate a new timeout, you should set `attempt` to 4 (attempts are zero-indexed).\n\n`opts` can include `factor`, `minTimeout`, `randomize` (boolean) and `maxTimeout`. They are documented above.\n\n`retry.createTimeout()` is used internally by `retry.timeouts()` and is public for you to be able to create your own timeouts for reinserting an item, see [issue #13](https://github.com/tim-kos/node-retry/issues/13).\n\n### retry.wrap(obj, [options], [methodNames])\n\nWrap all functions of the `obj` with retry. Optionally you can pass operation options and\nan array of method names which need to be wrapped.\n\n```\nretry.wrap(obj)\n\nretry.wrap(obj, ['method1', 'method2'])\n\nretry.wrap(obj, {retries: 3})\n\nretry.wrap(obj, {retries: 3}, ['method1', 'method2'])\n```\nThe `options` object can take any options that the usual call to `retry.operation` can take.\n\n### new RetryOperation(timeouts, [options])\n\nCreates a new `RetryOperation` where `timeouts` is an array where each value is\na timeout given in milliseconds.\n\nAvailable options:\n* `forever`: Whether to retry forever, defaults to `false`.\n* `unref`: Wether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.\n\nIf `forever` is true, the following changes happen:\n* `RetryOperation.errors()` will only output an array of one item: the last error.\n* `RetryOperation` will repeatedly use the `timeouts` array. Once all of its timeouts have been used up, it restarts with the first timeout, then uses the second and so on.\n\n#### retryOperation.errors()\n\nReturns an array of all errors that have been passed to `retryOperation.retry()` so far. The\nreturning array has the errors ordered chronologically based on when they were passed to\n`retryOperation.retry()`, which means the first passed error is at index zero and the last is\nat the last index.\n\n#### retryOperation.mainError()\n\nA reference to the error object that occured most frequently. Errors are\ncompared using the `error.message` property.\n\nIf multiple error messages occured the same amount of time, the last error\nobject with that message is returned.\n\nIf no errors occured so far, the value is `null`.\n\n#### retryOperation.attempt(fn, timeoutOps)\n\nDefines the function `fn` that is to be retried and executes it for the first\ntime right away. The `fn` function can receive an optional `currentAttempt` callback that represents the number of attempts to execute `fn` so far.\n\nOptionally defines `timeoutOps` which is an object having a property `timeout` in miliseconds and a property `cb` callback function.\nWhenever your retry operation takes longer than `timeout` to execute, the timeout callback function `cb` is called.\n\n\n#### retryOperation.try(fn)\n\nThis is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.\n\n#### retryOperation.start(fn)\n\nThis is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.\n\n#### retryOperation.retry(error)\n\nReturns `false` when no `error` value is given, or the maximum amount of retries\nhas been reached.\n\nOtherwise it returns `true`, and retries the operation after the timeout for\nthe current attempt number.\n\n#### retryOperation.stop()\n\nAllows you to stop the operation being retried. Useful for aborting the operation on a fatal error etc.\n\n#### retryOperation.reset()\n\nResets the internal state of the operation object, so that you can call `attempt()` again as if this was a new operation object.\n\n#### retryOperation.attempts()\n\nReturns an int representing the number of attempts it took to call `fn` before it was successful.\n\n## License\n\nretry is licensed under the MIT license.\n\n\n# Changelog\n\n0.10.0 Adding `stop` functionality, thanks to @maxnachlinger.\n\n0.9.0 Adding `unref` functionality, thanks to @satazor.\n\n0.8.0 Implementing retry.wrap.\n\n0.7.0 Some bug fixes and made retry.createTimeout() public. Fixed issues [#10](https://github.com/tim-kos/node-retry/issues/10), [#12](https://github.com/tim-kos/node-retry/issues/12), and [#13](https://github.com/tim-kos/node-retry/issues/13).\n\n0.6.0 Introduced optional timeOps parameter for the attempt() function which is an object having a property timeout in milliseconds and a property cb callback function. Whenever your retry operation takes longer than timeout to execute, the timeout callback function cb is called.\n\n0.5.0 Some minor refactoring.\n\n0.4.0 Changed retryOperation.try() to retryOperation.attempt(). Deprecated the aliases start() and try() for it.\n\n0.3.0 Added retryOperation.start() which is an alias for retryOperation.try().\n\n0.2.0 Added attempts() function and parameter to retryOperation.try() representing the number of attempts it took to call fn().\n", + "readme": "\n[![Build Status](https://secure.travis-ci.org/tim-kos/node-retry.png?branch=master)](http://travis-ci.org/tim-kos/node-retry \"Check this project's build status on TravisCI\")\n[![codecov](https://codecov.io/gh/tim-kos/node-retry/branch/master/graph/badge.svg)](https://codecov.io/gh/tim-kos/node-retry)\n\n\n# retry\n\nAbstraction for exponential and custom retry strategies for failed operations.\n\n## Installation\n\n npm install retry\n\n## Current Status\n\nThis module has been tested and is ready to be used.\n\n## Tutorial\n\nThe example below will retry a potentially failing `dns.resolve` operation\n`10` times using an exponential backoff strategy. With the default settings, this\nmeans the last attempt is made after `17 minutes and 3 seconds`.\n\n``` javascript\nvar dns = require('dns');\nvar retry = require('retry');\n\nfunction faultTolerantResolve(address, cb) {\n var operation = retry.operation();\n\n operation.attempt(function(currentAttempt) {\n dns.resolve(address, function(err, addresses) {\n if (operation.retry(err)) {\n return;\n }\n\n cb(err ? operation.mainError() : null, addresses);\n });\n });\n}\n\nfaultTolerantResolve('nodejs.org', function(err, addresses) {\n console.log(err, addresses);\n});\n```\n\nOf course you can also configure the factors that go into the exponential\nbackoff. See the API documentation below for all available settings.\ncurrentAttempt is an int representing the number of attempts so far.\n\n``` javascript\nvar operation = retry.operation({\n retries: 5,\n factor: 3,\n minTimeout: 1 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n});\n```\n\n## API\n\n### retry.operation([options])\n\nCreates a new `RetryOperation` object. `options` is the same as `retry.timeouts()`'s `options`, with two additions:\n\n* `forever`: Whether to retry forever, defaults to `false`.\n* `unref`: Whether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.\n* `maxRetryTime`: The maximum time (in milliseconds) that the retried operation is allowed to run. Default is `Infinity`. \n\n### retry.timeouts([options])\n\nReturns an array of timeouts. All time `options` and return values are in\nmilliseconds. If `options` is an array, a copy of that array is returned.\n\n`options` is a JS object that can contain any of the following keys:\n\n* `retries`: The maximum amount of times to retry the operation. Default is `10`. Seting this to `1` means `do it once, then retry it once`.\n* `factor`: The exponential factor to use. Default is `2`.\n* `minTimeout`: The number of milliseconds before starting the first retry. Default is `1000`.\n* `maxTimeout`: The maximum number of milliseconds between two retries. Default is `Infinity`.\n* `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `false`.\n\nThe formula used to calculate the individual timeouts is:\n\n```\nMath.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout)\n```\n\nHave a look at [this article][article] for a better explanation of approach.\n\nIf you want to tune your `factor` / `times` settings to attempt the last retry\nafter a certain amount of time, you can use wolfram alpha. For example in order\nto tune for `10` attempts in `5 minutes`, you can use this equation:\n\n![screenshot](https://github.com/tim-kos/node-retry/raw/master/equation.gif)\n\nExplaining the various values from left to right:\n\n* `k = 0 ... 9`: The `retries` value (10)\n* `1000`: The `minTimeout` value in ms (1000)\n* `x^k`: No need to change this, `x` will be your resulting factor\n* `5 * 60 * 1000`: The desired total amount of time for retrying in ms (5 minutes)\n\nTo make this a little easier for you, use wolfram alpha to do the calculations:\n\n\n\n[article]: http://dthain.blogspot.com/2009/02/exponential-backoff-in-distributed.html\n\n### retry.createTimeout(attempt, opts)\n\nReturns a new `timeout` (integer in milliseconds) based on the given parameters.\n\n`attempt` is an integer representing for which retry the timeout should be calculated. If your retry operation was executed 4 times you had one attempt and 3 retries. If you then want to calculate a new timeout, you should set `attempt` to 4 (attempts are zero-indexed).\n\n`opts` can include `factor`, `minTimeout`, `randomize` (boolean) and `maxTimeout`. They are documented above.\n\n`retry.createTimeout()` is used internally by `retry.timeouts()` and is public for you to be able to create your own timeouts for reinserting an item, see [issue #13](https://github.com/tim-kos/node-retry/issues/13).\n\n### retry.wrap(obj, [options], [methodNames])\n\nWrap all functions of the `obj` with retry. Optionally you can pass operation options and\nan array of method names which need to be wrapped.\n\n```\nretry.wrap(obj)\n\nretry.wrap(obj, ['method1', 'method2'])\n\nretry.wrap(obj, {retries: 3})\n\nretry.wrap(obj, {retries: 3}, ['method1', 'method2'])\n```\nThe `options` object can take any options that the usual call to `retry.operation` can take.\n\n### new RetryOperation(timeouts, [options])\n\nCreates a new `RetryOperation` where `timeouts` is an array where each value is\na timeout given in milliseconds.\n\nAvailable options:\n* `forever`: Whether to retry forever, defaults to `false`.\n* `unref`: Wether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.\n\nIf `forever` is true, the following changes happen:\n* `RetryOperation.errors()` will only output an array of one item: the last error.\n* `RetryOperation` will repeatedly use the `timeouts` array. Once all of its timeouts have been used up, it restarts with the first timeout, then uses the second and so on.\n\n#### retryOperation.errors()\n\nReturns an array of all errors that have been passed to `retryOperation.retry()` so far. The\nreturning array has the errors ordered chronologically based on when they were passed to\n`retryOperation.retry()`, which means the first passed error is at index zero and the last is\nat the last index.\n\n#### retryOperation.mainError()\n\nA reference to the error object that occured most frequently. Errors are\ncompared using the `error.message` property.\n\nIf multiple error messages occured the same amount of time, the last error\nobject with that message is returned.\n\nIf no errors occured so far, the value is `null`.\n\n#### retryOperation.attempt(fn, timeoutOps)\n\nDefines the function `fn` that is to be retried and executes it for the first\ntime right away. The `fn` function can receive an optional `currentAttempt` callback that represents the number of attempts to execute `fn` so far.\n\nOptionally defines `timeoutOps` which is an object having a property `timeout` in milliseconds and a property `cb` callback function.\nWhenever your retry operation takes longer than `timeout` to execute, the timeout callback function `cb` is called.\n\n\n#### retryOperation.try(fn)\n\nThis is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.\n\n#### retryOperation.start(fn)\n\nThis is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.\n\n#### retryOperation.retry(error)\n\nReturns `false` when no `error` value is given, or the maximum amount of retries\nhas been reached.\n\nOtherwise it returns `true`, and retries the operation after the timeout for\nthe current attempt number.\n\n#### retryOperation.stop()\n\nAllows you to stop the operation being retried. Useful for aborting the operation on a fatal error etc.\n\n#### retryOperation.reset()\n\nResets the internal state of the operation object, so that you can call `attempt()` again as if this was a new operation object.\n\n#### retryOperation.attempts()\n\nReturns an int representing the number of attempts it took to call `fn` before it was successful.\n\n## License\n\nretry is licensed under the MIT license.\n\n\n# Changelog\n\n0.10.0 Adding `stop` functionality, thanks to @maxnachlinger.\n\n0.9.0 Adding `unref` functionality, thanks to @satazor.\n\n0.8.0 Implementing retry.wrap.\n\n0.7.0 Some bug fixes and made retry.createTimeout() public. Fixed issues [#10](https://github.com/tim-kos/node-retry/issues/10), [#12](https://github.com/tim-kos/node-retry/issues/12), and [#13](https://github.com/tim-kos/node-retry/issues/13).\n\n0.6.0 Introduced optional timeOps parameter for the attempt() function which is an object having a property timeout in milliseconds and a property cb callback function. Whenever your retry operation takes longer than timeout to execute, the timeout callback function cb is called.\n\n0.5.0 Some minor refactoring.\n\n0.4.0 Changed retryOperation.try() to retryOperation.attempt(). Deprecated the aliases start() and try() for it.\n\n0.3.0 Added retryOperation.start() which is an alias for retryOperation.try().\n\n0.2.0 Added attempts() function and parameter to retryOperation.try() representing the number of attempts it took to call fn().\n", "homepage": "https://github.com/tim-kos/node-retry", "bugs": { "url": "https://github.com/tim-kos/node-retry/issues" diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/through.json b/workspaces/arborist/test/fixtures/registry-mocks/content/through.json index ca93347f66869..0b294889dad63 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/through.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/through.json @@ -10,7 +10,7 @@ "0.0.1": { "name": "through", "version": "0.0.1", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -48,7 +48,7 @@ "0.0.2": { "name": "through", "version": "0.0.2", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -86,7 +86,7 @@ "0.0.3": { "name": "through", "version": "0.0.3", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -124,7 +124,7 @@ "0.0.4": { "name": "through", "version": "0.0.4", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -162,7 +162,7 @@ "0.1.0": { "name": "through", "version": "0.1.0", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -200,7 +200,7 @@ "0.1.1": { "name": "through", "version": "0.1.1", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -238,7 +238,7 @@ "0.1.2": { "name": "through", "version": "0.1.2", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -276,7 +276,7 @@ "0.1.3": { "name": "through", "version": "0.1.3", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -319,7 +319,7 @@ "0.1.4": { "name": "through", "version": "0.1.4", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -362,7 +362,7 @@ "1.0.0": { "name": "through", "version": "1.0.0", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -405,7 +405,7 @@ "1.1.0": { "name": "through", "version": "1.1.0", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -453,7 +453,7 @@ "1.1.1": { "name": "through", "version": "1.1.1", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -501,7 +501,7 @@ "1.1.2": { "name": "through", "version": "1.1.2", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -549,7 +549,7 @@ "2.0.0": { "name": "through", "version": "2.0.0", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -597,7 +597,7 @@ "2.1.0": { "name": "through", "version": "2.1.0", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -645,7 +645,7 @@ "2.2.0": { "name": "through", "version": "2.2.0", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -694,7 +694,7 @@ "2.2.1": { "name": "through", "version": "2.2.1", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -743,7 +743,7 @@ "2.2.2": { "name": "through", "version": "2.2.2", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -800,7 +800,7 @@ "2.2.4": { "name": "through", "version": "2.2.4", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -857,7 +857,7 @@ "2.2.5": { "name": "through", "version": "2.2.5", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -914,7 +914,7 @@ "2.2.6": { "name": "through", "version": "2.2.6", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -971,7 +971,7 @@ "2.2.7": { "name": "through", "version": "2.2.7", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -1028,7 +1028,7 @@ "2.3.1": { "name": "through", "version": "2.3.1", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -1085,7 +1085,7 @@ "2.3.2": { "name": "through", "version": "2.3.2", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -1142,7 +1142,7 @@ "2.3.3": { "name": "through", "version": "2.3.3", - "description": "simplified stream contruction", + "description": "simplified stream construction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/tough-cookie.json b/workspaces/arborist/test/fixtures/registry-mocks/content/tough-cookie.json index b61764610224e..2c4d1033b472b 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/tough-cookie.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/tough-cookie.json @@ -2988,7 +2988,7 @@ "rossdavis": true, "mrxf": true }, - "readme": "[RFC6265](https://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js\n\n[![npm package](https://nodei.co/npm/tough-cookie.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/tough-cookie/)\n\n[![Build Status](https://travis-ci.org/salesforce/tough-cookie.svg?branch=master)](https://travis-ci.org/salesforce/tough-cookie)\n\n# Synopsis\n\n``` javascript\nvar tough = require('tough-cookie');\nvar Cookie = tough.Cookie;\nvar cookie = Cookie.parse(header);\ncookie.value = 'somethingdifferent';\nheader = cookie.toString();\n\nvar cookiejar = new tough.CookieJar();\ncookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);\n// ...\ncookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {\n res.headers['cookie'] = cookies.join('; ');\n});\n```\n\n# Installation\n\nIt's _so_ easy!\n\n`npm install tough-cookie`\n\nWhy the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.\n\n## Version Support\n\nSupport for versions of node.js will follow that of the [request](https://www.npmjs.com/package/request) module.\n\n# API\n\n## tough\n\nFunctions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be \"bound\".\n\n**Note**: prior to 1.0.x, several of these functions took a `strict` parameter. This has since been removed from the API as it was no longer necessary.\n\n### `parseDate(string)`\n\nParse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`.\n\n### `formatDate(date)`\n\nFormat a Date into a RFC1123 string (the RFC6265-recommended format).\n\n### `canonicalDomain(str)`\n\nTransforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).\n\n### `domainMatch(str,domStr[,canonicalize=true])`\n\nAnswers \"does this real domain match the domain in a cookie?\". The `str` is the \"current\" domain-name and the `domStr` is the \"cookie\" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a \"suffix match\".\n\nThe `canonicalize` parameter will run the other two parameters through `canonicalDomain` or not.\n\n### `defaultPath(path)`\n\nGiven a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the \"directory\" of a \"file\" in the path, but is specified by Section 5.1.4 of the RFC.\n\nThe `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.\n\n### `pathMatch(reqPath,cookiePath)`\n\nAnswers \"does the request-path path-match a given cookie-path?\" as per RFC6265 Section 5.1.4. Returns a boolean.\n\nThis is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.\n\n### `parse(cookieString[, options])`\n\nalias for `Cookie.parse(cookieString[, options])`\n\n### `fromJSON(string)`\n\nalias for `Cookie.fromJSON(string)`\n\n### `getPublicSuffix(hostname)`\n\nReturns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.\n\nFor example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.\n\nFor further information, see http://publicsuffix.org/. This module derives its list from that site. This call is currently a wrapper around [`psl`](https://www.npmjs.com/package/psl)'s [get() method](https://www.npmjs.com/package/psl#pslgetdomain).\n\n### `cookieCompare(a,b)`\n\nFor use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). The sort algorithm is, in order of precedence:\n\n* Longest `.path`\n* oldest `.creation` (which has a 1ms precision, same as `Date`)\n* lowest `.creationIndex` (to get beyond the 1ms precision)\n\n``` javascript\nvar cookies = [ /* unsorted array of Cookie objects */ ];\ncookies = cookies.sort(cookieCompare);\n```\n\n**Note**: Since JavaScript's `Date` is limited to a 1ms precision, cookies within the same milisecond are entirely possible. This is especially true when using the `now` option to `.setCookie()`. The `.creationIndex` property is a per-process global counter, assigned during construction with `new Cookie()`. This preserves the spirit of the RFC sorting: older cookies go first. This works great for `MemoryCookieStore`, since `Set-Cookie` headers are parsed in order, but may not be so great for distributed systems. Sophisticated `Store`s may wish to set this to some other _logical clock_ such that if cookies A and B are created in the same millisecond, but cookie A is created before cookie B, then `A.creationIndex < B.creationIndex`. If you want to alter the global counter, which you probably _shouldn't_ do, it's stored in `Cookie.cookiesCreated`.\n\n### `permuteDomain(domain)`\n\nGenerates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.\n\n### `permutePath(path)`\n\nGenerates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.\n\n\n## Cookie\n\nExported via `tough.Cookie`.\n\n### `Cookie.parse(cookieString[, options])`\n\nParses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed.\n\nThe options parameter is not required and currently has only one property:\n\n * _loose_ - boolean - if `true` enable parsing of key-less cookies like `=abc` and `=`, which are not RFC-compliant.\n\nIf options is not an object, it is ignored, which means you can use `Array#map` with it.\n\nHere's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:\n\n``` javascript\nif (res.headers['set-cookie'] instanceof Array)\n cookies = res.headers['set-cookie'].map(Cookie.parse);\nelse\n cookies = [Cookie.parse(res.headers['set-cookie'])];\n```\n\n_Note:_ in version 2.3.3, tough-cookie limited the number of spaces before the `=` to 256 characters. This limitation has since been removed.\nSee [Issue 92](https://github.com/salesforce/tough-cookie/issues/92)\n\n### Properties\n\nCookie object properties:\n\n * _key_ - string - the name or key of the cookie (default \"\")\n * _value_ - string - the value of the cookie (default \"\")\n * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `\"Infinity\"`). See `setExpires()`\n * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `\"Infinity\"` and `\"-Infinity\"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`\n * _domain_ - string - the `Domain=` attribute of the cookie\n * _path_ - string - the `Path=` of the cookie\n * _secure_ - boolean - the `Secure` cookie flag\n * _httpOnly_ - boolean - the `HttpOnly` cookie flag\n * _sameSite_ - string - the `SameSite` cookie attribute (from [RFC6265bis]); must be one of `none`, `lax`, or `strict`\n * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)\n * _creation_ - `Date` - when this cookie was constructed\n * _creationIndex_ - number - set at construction, used to provide greater sort precision (please see `cookieCompare(a,b)` for a full explanation)\n\nAfter a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:\n\n * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)\n * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.\n * _creation_ - `Date` - **modified** from construction to when the cookie was added to the jar\n * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.\n\n### `Cookie([{properties}])`\n\nReceives an options object that can contain any of the above Cookie properties, uses the default for unspecified properties.\n\n### `.toString()`\n\nencode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.\n\n### `.cookieString()`\n\nencode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').\n\n### `.setExpires(String)`\n\nsets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `\"Infinity\"` (a string) is set.\n\n### `.setMaxAge(number)`\n\nsets the maxAge in seconds. Coerces `-Infinity` to `\"-Infinity\"` and `Infinity` to `\"Infinity\"` so it JSON serializes correctly.\n\n### `.expiryTime([now=Date.now()])`\n\n### `.expiryDate([now=Date.now()])`\n\nexpiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.\n\nMax-Age takes precedence over Expires (as per the RFC). The `.creation` attribute -- or, by default, the `now` parameter -- is used to offset the `.maxAge` attribute.\n\nIf Expires (`.expires`) is set, that's returned.\n\nOtherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for \"Tue, 19 Jan 2038 03:14:07 GMT\" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).\n\n### `.TTL([now=Date.now()])`\n\ncompute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.\n\nThe \"number\" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.\n\n### `.canonicalizedDomain()`\n\n### `.cdomain()`\n\nreturn the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.\n\n### `.toJSON()`\n\nFor convenience in using `JSON.serialize(cookie)`. Returns a plain-old `Object` that can be JSON-serialized.\n\nAny `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are exported in ISO format (`.toISOString()`).\n\n**NOTE**: Custom `Cookie` properties will be discarded. In tough-cookie 1.x, since there was no `.toJSON` method explicitly defined, all enumerable properties were captured. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.\n\n### `Cookie.fromJSON(strOrObj)`\n\nDoes the reverse of `cookie.toJSON()`. If passed a string, will `JSON.parse()` that first.\n\nAny `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are parsed via `Date.parse()`, not the tough-cookie `parseDate`, since it's JavaScript/JSON-y timestamps being handled at this layer.\n\nReturns `null` upon JSON parsing error.\n\n### `.clone()`\n\nDoes a deep clone of this cookie, exactly implemented as `Cookie.fromJSON(cookie.toJSON())`.\n\n### `.validate()`\n\nStatus: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.\n\nvalidates cookie attributes for semantic correctness. Useful for \"lint\" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:\n\n``` javascript\nif (cookie.validate() === true) {\n // it's tasty\n} else {\n // yuck!\n}\n```\n\n\n## CookieJar\n\nExported via `tough.CookieJar`.\n\n### `CookieJar([store],[options])`\n\nSimply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _rejectPublicSuffixes_ - boolean - default `true` - reject cookies with domains like \"com\" and \"co.uk\"\n * _looseMode_ - boolean - default `false` - accept malformed cookies like `bar` and `=bar`, which have an implied empty name.\n * _prefixSecurity_ - string - default `silent` - set to `'unsafe-disabled'`, `'silent'`, or `'strict'`. See [Cookie Prefixes] below.\n * _allowSpecialUseDomain_ - boolean - default `false` - accepts special-use domain suffixes, such as `local`. Useful for testing purposes.\n This is not in the standard, but is used sometimes on the web and is accepted by (most) browsers.\n\nSince eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.\n\n### `.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))`\n\nAttempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.creation`, `.lastAccessed` and `.hostOnly` properties.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. `Store` errors aren't ignored by this option.\n * _sameSiteContext_ - string - default unset - set to `'none'`, `'lax'`, or `'strict'` See [SameSite Cookies] below.\n\nAs per the RFC, the `.hostOnly` property is set if there was no \"Domain=\" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).\n\n### `.setCookieSync(cookieOrString, currentUrl, [{options}])`\n\nSynchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getCookies(currentUrl, [{options},] cb(err,cookies))`\n\nRetrieve the list of cookies that can be sent in a Cookie header for the current url.\n\nIf an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).\n * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the underlying store (the default `MemoryCookieStore` supports it).\n * _sameSiteContext_ - string - default unset - Set this to `'none'`, `'lax'` or `'strict'` to enforce SameSite cookies upon retrival. See [SameSite Cookies] below.\n\nThe `.lastAccessed` property of the returned cookies will have been updated.\n\n### `.getCookiesSync(currentUrl, [{options}])`\n\nSynchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getCookieString(...)`\n\nAccepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.\n\n### `.getCookieStringSync(...)`\n\nSynchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getSetCookieStrings(...)`\n\nReturns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`.\n\n### `.getSetCookieStringsSync(...)`\n\nSynchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.serialize(cb(err,serializedObject))`\n\nSerialize the Jar if the underlying store supports `.getAllCookies`.\n\n**NOTE**: Custom `Cookie` properties will be discarded. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.\n\nSee [Serialization Format].\n\n### `.serializeSync()`\n\nSync version of .serialize\n\n### `.toJSON()`\n\nAlias of .serializeSync() for the convenience of `JSON.stringify(cookiejar)`.\n\n### `CookieJar.deserialize(serialized, [store], cb(err,object))`\n\nA new Jar is created and the serialized Cookies are added to the underlying store. Each `Cookie` is added via `store.putCookie` in the order in which they appear in the serialization.\n\nThe `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created.\n\nAs a convenience, if `serialized` is a string, it is passed through `JSON.parse` first. If that throws an error, this is passed to the callback.\n\n### `CookieJar.deserializeSync(serialized, [store])`\n\nSync version of `.deserialize`. _Note_ that the `store` must be synchronous for this to work.\n\n### `CookieJar.fromJSON(string)`\n\nAlias of `.deserializeSync` to provide consistency with `Cookie.fromJSON()`.\n\n### `.clone([store,]cb(err,newJar))`\n\nProduces a deep clone of this jar. Modifications to the original won't affect the clone, and vice versa.\n\nThe `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created. Transferring between store types is supported so long as the source implements `.getAllCookies()` and the destination implements `.putCookie()`.\n\n### `.cloneSync([store])`\n\nSynchronous version of `.clone`, returning a new `CookieJar` instance.\n\nThe `store` argument is optional, but must be a _synchronous_ `Store` instance if specified. If not passed, a new instance of `MemoryCookieStore` is used.\n\nThe _source_ and _destination_ must both be synchronous `Store`s. If one or both stores are asynchronous, use `.clone` instead. Recall that `MemoryCookieStore` supports both synchronous and asynchronous API calls.\n\n### `.removeAllCookies(cb(err))`\n\nRemoves all cookies from the jar.\n\nThis is a new backwards-compatible feature of `tough-cookie` version 2.5, so not all Stores will implement it efficiently. For Stores that do not implement `removeAllCookies`, the fallback is to call `removeCookie` after `getAllCookies`. If `getAllCookies` fails or isn't implemented in the Store, that error is returned. If one or more of the `removeCookie` calls fail, only the first error is returned.\n\n### `.removeAllCookiesSync()`\n\nSync version of `.removeAllCookies()`\n\n## Store\n\nBase class for CookieJar stores. Available as `tough.Store`.\n\n## Store API\n\nThe storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.\n\nStores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`.\n\nStores are asynchronous by default, but if `store.synchronous` is set to `true`, then the `*Sync` methods on the of the containing `CookieJar` can be used (however, the continuation-passing style\n\nAll `domain` parameters will have been normalized before calling.\n\nThe Cookie store must have all of the following methods.\n\n### `store.findCookie(domain, path, key, cb(err,cookie))`\n\nRetrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.\n\nCallback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).\n\n### `store.findCookies(domain, path, cb(err,cookies))`\n\nLocates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.\n\nIf no cookies are found, the callback MUST be passed an empty array.\n\nThe resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.\n\nAs of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).\n\n### `store.putCookie(cookie, cb(err))`\n\nAdds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.\n\nThe `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.\n\nPass an error if the cookie cannot be stored.\n\n### `store.updateCookie(oldCookie, newCookie, cb(err))`\n\nUpdate an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.\n\nThe `.lastAccessed` property will always be different between the two objects (to the precision possible via JavaScript's clock). Both `.creation` and `.creationIndex` are guaranteed to be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are selected for automatic deletion (e.g., least-recently-used, which is up to the store to implement).\n\nStores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.\n\nThe `newCookie` and `oldCookie` objects MUST NOT be modified.\n\nPass an error if the newCookie cannot be stored.\n\n### `store.removeCookie(domain, path, key, cb(err))`\n\nRemove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).\n\nThe implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.\n\n### `store.removeCookies(domain, path, cb(err))`\n\nRemoves matching cookies from the store. The `path` parameter is optional, and if missing means all paths in a domain should be removed.\n\nPass an error ONLY if removing any existing cookies failed.\n\n### `store.removeAllCookies(cb(err))`\n\n_Optional_. Removes all cookies from the store.\n\nPass an error if one or more cookies can't be removed.\n\n**Note**: New method as of `tough-cookie` version 2.5, so not all Stores will implement this, plus some stores may choose not to implement this.\n\n### `store.getAllCookies(cb(err, cookies))`\n\n_Optional_. Produces an `Array` of all cookies during `jar.serialize()`. The items in the array can be true `Cookie` objects or generic `Object`s with the [Serialization Format] data structure.\n\nCookies SHOULD be returned in creation order to preserve sorting via `compareCookies()`. For reference, `MemoryCookieStore` will sort by `.creationIndex` since it uses true `Cookie` objects internally. If you don't return the cookies in creation order, they'll still be sorted by creation time, but this only has a precision of 1ms. See `compareCookies` for more detail.\n\nPass an error if retrieval fails.\n\n**Note**: not all Stores can implement this due to technical limitations, so it is optional.\n\n## MemoryCookieStore\n\nInherits from `Store`.\n\nA just-in-memory CookieJar synchronous store implementation, used by default. Despite being a synchronous implementation, it's usable with both the synchronous and asynchronous forms of the `CookieJar` API. Supports serialization, `getAllCookies`, and `removeAllCookies`.\n\n## Community Cookie Stores\n\nThese are some Store implementations authored and maintained by the community. They aren't official and we don't vouch for them but you may be interested to have a look:\n\n- [`db-cookie-store`](https://github.com/JSBizon/db-cookie-store): SQL including SQLite-based databases\n- [`file-cookie-store`](https://github.com/JSBizon/file-cookie-store): Netscape cookie file format on disk\n- [`redis-cookie-store`](https://github.com/benkroeger/redis-cookie-store): Redis\n- [`tough-cookie-filestore`](https://github.com/mitsuru/tough-cookie-filestore): JSON on disk\n- [`tough-cookie-web-storage-store`](https://github.com/exponentjs/tough-cookie-web-storage-store): DOM localStorage and sessionStorage\n\n\n# Serialization Format\n\n**NOTE**: if you want to have custom `Cookie` properties serialized, add the property name to `Cookie.serializableProperties`.\n\n```js\n {\n // The version of tough-cookie that serialized this jar.\n version: 'tough-cookie@1.x.y',\n\n // add the store type, to make humans happy:\n storeType: 'MemoryCookieStore',\n\n // CookieJar configuration:\n rejectPublicSuffixes: true,\n // ... future items go here\n\n // Gets filled from jar.store.getAllCookies():\n cookies: [\n {\n key: 'string',\n value: 'string',\n // ...\n /* other Cookie.serializableProperties go here */\n }\n ]\n }\n```\n\n# RFC6265bis\n\nSupport for RFC6265bis revision 02 is being developed. Since this is a bit of an omnibus revision to the RFC6252, support is broken up into the functional areas.\n\n## Leave Secure Cookies Alone\n\nNot yet supported.\n\nThis change makes it so that if a cookie is sent from the server to the client with a `Secure` attribute, the channel must also be secure or the cookie is ignored.\n\n## SameSite Cookies\n\nSupported.\n\nThis change makes it possible for servers, and supporting clients, to mitigate certain types of CSRF attacks by disallowing `SameSite` cookies from being sent cross-origin.\n\nOn the Cookie object itself, you can get/set the `.sameSite` attribute, which will be serialized into the `SameSite=` cookie attribute. When unset or `undefined`, no `SameSite=` attribute will be serialized. The valid values of this attribute are `'none'`, `'lax'`, or `'strict'`. Other values will be serialized as-is.\n\nWhen parsing cookies with a `SameSite` cookie attribute, values other than `'lax'` or `'strict'` are parsed as `'none'`. For example, `SomeCookie=SomeValue; SameSite=garbage` will parse so that `cookie.sameSite === 'none'`.\n\nIn order to support SameSite cookies, you must provide a `sameSiteContext` option to _both_ `setCookie` and `getCookies`. Valid values for this option are just like for the Cookie object, but have particular meanings:\n1. `'strict'` mode - If the request is on the same \"site for cookies\" (see the RFC draft for what this means), pass this option to add a layer of defense against CSRF.\n2. `'lax'` mode - If the request is from another site, _but_ is directly because of navigation by the user, e.g., `` or ``, pass `sameSiteContext: 'lax'`.\n3. `'none'` - Otherwise, pass `sameSiteContext: 'none'` (this indicates a cross-origin request).\n4. unset/`undefined` - SameSite **will not** be enforced! This can be a valid use-case for when CSRF isn't in the threat model of the system being built.\n\nIt is highly recommended that you read RFC 6265bis for fine details on SameSite cookies. In particular [Section 8.8](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-8.8) discusses security considerations and defense in depth.\n\n## Cookie Prefixes\n\nSupported.\n\nCookie prefixes are a way to indicate that a given cookie was set with a set of attributes simply by inspecting the first few characters of the cookie's name.\n\nCookie prefixes are defined in [Section 4.1.3 of 6265bis](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.3). Two prefixes are defined:\n\n1. `\"__Secure-\" Prefix`: If a cookie's name begins with a case-sensitive match for the string \"__Secure-\", then the cookie will have been set with a \"Secure\" attribute.\n2. `\"__Host-\" Prefix`: If a cookie's name begins with a case-sensitive match for the string \"__Host-\", then the cookie will have been set with a \"Secure\" attribute, a \"Path\" attribute with a value of \"/\", and no \"Domain\" attribute.\n\nIf `prefixSecurity` is enabled for `CookieJar`, then cookies that match the prefixes defined above but do not obey the attribute restrictions will not be added.\n\nYou can define this functionality by passing in `prefixSecurity` option to `CookieJar`. It can be one of 3 values:\n\n1. `silent`: Enable cookie prefix checking but silently fail to add the cookie if conditions not met. Default.\n2. `strict`: Enable cookie prefix checking and error out if conditions not met.\n3. `unsafe-disabled`: Disable cookie prefix checking.\n\nNote that if `ignoreError` is passed in as `true` then the error will be silent regardless of `prefixSecurity` option (assuming it's enabled).\n\n\n# Copyright and License\n\nBSD-3-Clause:\n\n```text\n Copyright (c) 2015, Salesforce.com, Inc.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n 3. Neither the name of Salesforce.com nor the names of its contributors may\n be used to endorse or promote products derived from this software without\n specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n```\n", + "readme": "[RFC6265](https://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js\n\n[![npm package](https://nodei.co/npm/tough-cookie.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/tough-cookie/)\n\n[![Build Status](https://travis-ci.org/salesforce/tough-cookie.svg?branch=master)](https://travis-ci.org/salesforce/tough-cookie)\n\n# Synopsis\n\n``` javascript\nvar tough = require('tough-cookie');\nvar Cookie = tough.Cookie;\nvar cookie = Cookie.parse(header);\ncookie.value = 'somethingdifferent';\nheader = cookie.toString();\n\nvar cookiejar = new tough.CookieJar();\ncookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);\n// ...\ncookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {\n res.headers['cookie'] = cookies.join('; ');\n});\n```\n\n# Installation\n\nIt's _so_ easy!\n\n`npm install tough-cookie`\n\nWhy the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.\n\n## Version Support\n\nSupport for versions of node.js will follow that of the [request](https://www.npmjs.com/package/request) module.\n\n# API\n\n## tough\n\nFunctions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be \"bound\".\n\n**Note**: prior to 1.0.x, several of these functions took a `strict` parameter. This has since been removed from the API as it was no longer necessary.\n\n### `parseDate(string)`\n\nParse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`.\n\n### `formatDate(date)`\n\nFormat a Date into a RFC1123 string (the RFC6265-recommended format).\n\n### `canonicalDomain(str)`\n\nTransforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).\n\n### `domainMatch(str,domStr[,canonicalize=true])`\n\nAnswers \"does this real domain match the domain in a cookie?\". The `str` is the \"current\" domain-name and the `domStr` is the \"cookie\" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a \"suffix match\".\n\nThe `canonicalize` parameter will run the other two parameters through `canonicalDomain` or not.\n\n### `defaultPath(path)`\n\nGiven a current request/response path, gives the Path appropriate for storing in a cookie. This is basically the \"directory\" of a \"file\" in the path, but is specified by Section 5.1.4 of the RFC.\n\nThe `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.\n\n### `pathMatch(reqPath,cookiePath)`\n\nAnswers \"does the request-path path-match a given cookie-path?\" as per RFC6265 Section 5.1.4. Returns a boolean.\n\nThis is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.\n\n### `parse(cookieString[, options])`\n\nalias for `Cookie.parse(cookieString[, options])`\n\n### `fromJSON(string)`\n\nalias for `Cookie.fromJSON(string)`\n\n### `getPublicSuffix(hostname)`\n\nReturns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.\n\nFor example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.\n\nFor further information, see http://publicsuffix.org/. This module derives its list from that site. This call is currently a wrapper around [`psl`](https://www.npmjs.com/package/psl)'s [get() method](https://www.npmjs.com/package/psl#pslgetdomain).\n\n### `cookieCompare(a,b)`\n\nFor use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). The sort algorithm is, in order of precedence:\n\n* Longest `.path`\n* oldest `.creation` (which has a 1ms precision, same as `Date`)\n* lowest `.creationIndex` (to get beyond the 1ms precision)\n\n``` javascript\nvar cookies = [ /* unsorted array of Cookie objects */ ];\ncookies = cookies.sort(cookieCompare);\n```\n\n**Note**: Since JavaScript's `Date` is limited to a 1ms precision, cookies within the same millisecond are entirely possible. This is especially true when using the `now` option to `.setCookie()`. The `.creationIndex` property is a per-process global counter, assigned during construction with `new Cookie()`. This preserves the spirit of the RFC sorting: older cookies go first. This works great for `MemoryCookieStore`, since `Set-Cookie` headers are parsed in order, but may not be so great for distributed systems. Sophisticated `Store`s may wish to set this to some other _logical clock_ such that if cookies A and B are created in the same millisecond, but cookie A is created before cookie B, then `A.creationIndex < B.creationIndex`. If you want to alter the global counter, which you probably _shouldn't_ do, it's stored in `Cookie.cookiesCreated`.\n\n### `permuteDomain(domain)`\n\nGenerates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.\n\n### `permutePath(path)`\n\nGenerates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.\n\n\n## Cookie\n\nExported via `tough.Cookie`.\n\n### `Cookie.parse(cookieString[, options])`\n\nParses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed.\n\nThe options parameter is not required and currently has only one property:\n\n * _loose_ - boolean - if `true` enable parsing of key-less cookies like `=abc` and `=`, which are not RFC-compliant.\n\nIf options is not an object, it is ignored, which means you can use `Array#map` with it.\n\nHere's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:\n\n``` javascript\nif (res.headers['set-cookie'] instanceof Array)\n cookies = res.headers['set-cookie'].map(Cookie.parse);\nelse\n cookies = [Cookie.parse(res.headers['set-cookie'])];\n```\n\n_Note:_ in version 2.3.3, tough-cookie limited the number of spaces before the `=` to 256 characters. This limitation has since been removed.\nSee [Issue 92](https://github.com/salesforce/tough-cookie/issues/92)\n\n### Properties\n\nCookie object properties:\n\n * _key_ - string - the name or key of the cookie (default \"\")\n * _value_ - string - the value of the cookie (default \"\")\n * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `\"Infinity\"`). See `setExpires()`\n * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `\"Infinity\"` and `\"-Infinity\"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`\n * _domain_ - string - the `Domain=` attribute of the cookie\n * _path_ - string - the `Path=` of the cookie\n * _secure_ - boolean - the `Secure` cookie flag\n * _httpOnly_ - boolean - the `HttpOnly` cookie flag\n * _sameSite_ - string - the `SameSite` cookie attribute (from [RFC6265bis]); must be one of `none`, `lax`, or `strict`\n * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)\n * _creation_ - `Date` - when this cookie was constructed\n * _creationIndex_ - number - set at construction, used to provide greater sort precision (please see `cookieCompare(a,b)` for a full explanation)\n\nAfter a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:\n\n * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)\n * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.\n * _creation_ - `Date` - **modified** from construction to when the cookie was added to the jar\n * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.\n\n### `Cookie([{properties}])`\n\nReceives an options object that can contain any of the above Cookie properties, uses the default for unspecified properties.\n\n### `.toString()`\n\nencode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.\n\n### `.cookieString()`\n\nencode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').\n\n### `.setExpires(String)`\n\nsets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `\"Infinity\"` (a string) is set.\n\n### `.setMaxAge(number)`\n\nsets the maxAge in seconds. Coerces `-Infinity` to `\"-Infinity\"` and `Infinity` to `\"Infinity\"` so it JSON serializes correctly.\n\n### `.expiryTime([now=Date.now()])`\n\n### `.expiryDate([now=Date.now()])`\n\nexpiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.\n\nMax-Age takes precedence over Expires (as per the RFC). The `.creation` attribute -- or, by default, the `now` parameter -- is used to offset the `.maxAge` attribute.\n\nIf Expires (`.expires`) is set, that's returned.\n\nOtherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for \"Tue, 19 Jan 2038 03:14:07 GMT\" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).\n\n### `.TTL([now=Date.now()])`\n\ncompute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.\n\nThe \"number\" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.\n\n### `.canonicalizedDomain()`\n\n### `.cdomain()`\n\nreturn the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.\n\n### `.toJSON()`\n\nFor convenience in using `JSON.serialize(cookie)`. Returns a plain-old `Object` that can be JSON-serialized.\n\nAny `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are exported in ISO format (`.toISOString()`).\n\n**NOTE**: Custom `Cookie` properties will be discarded. In tough-cookie 1.x, since there was no `.toJSON` method explicitly defined, all enumerable properties were captured. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.\n\n### `Cookie.fromJSON(strOrObj)`\n\nDoes the reverse of `cookie.toJSON()`. If passed a string, will `JSON.parse()` that first.\n\nAny `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are parsed via `Date.parse()`, not the tough-cookie `parseDate`, since it's JavaScript/JSON-y timestamps being handled at this layer.\n\nReturns `null` upon JSON parsing error.\n\n### `.clone()`\n\nDoes a deep clone of this cookie, exactly implemented as `Cookie.fromJSON(cookie.toJSON())`.\n\n### `.validate()`\n\nStatus: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.\n\nvalidates cookie attributes for semantic correctness. Useful for \"lint\" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:\n\n``` javascript\nif (cookie.validate() === true) {\n // it's tasty\n} else {\n // yuck!\n}\n```\n\n\n## CookieJar\n\nExported via `tough.CookieJar`.\n\n### `CookieJar([store],[options])`\n\nSimply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _rejectPublicSuffixes_ - boolean - default `true` - reject cookies with domains like \"com\" and \"co.uk\"\n * _looseMode_ - boolean - default `false` - accept malformed cookies like `bar` and `=bar`, which have an implied empty name.\n * _prefixSecurity_ - string - default `silent` - set to `'unsafe-disabled'`, `'silent'`, or `'strict'`. See [Cookie Prefixes] below.\n * _allowSpecialUseDomain_ - boolean - default `false` - accepts special-use domain suffixes, such as `local`. Useful for testing purposes.\n This is not in the standard, but is used sometimes on the web and is accepted by (most) browsers.\n\nSince eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.\n\n### `.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))`\n\nAttempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.creation`, `.lastAccessed` and `.hostOnly` properties.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. `Store` errors aren't ignored by this option.\n * _sameSiteContext_ - string - default unset - set to `'none'`, `'lax'`, or `'strict'` See [SameSite Cookies] below.\n\nAs per the RFC, the `.hostOnly` property is set if there was no \"Domain=\" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).\n\n### `.setCookieSync(cookieOrString, currentUrl, [{options}])`\n\nSynchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getCookies(currentUrl, [{options},] cb(err,cookies))`\n\nRetrieve the list of cookies that can be sent in a Cookie header for the current url.\n\nIf an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).\n * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the underlying store (the default `MemoryCookieStore` supports it).\n * _sameSiteContext_ - string - default unset - Set this to `'none'`, `'lax'` or `'strict'` to enforce SameSite cookies upon retrival. See [SameSite Cookies] below.\n\nThe `.lastAccessed` property of the returned cookies will have been updated.\n\n### `.getCookiesSync(currentUrl, [{options}])`\n\nSynchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getCookieString(...)`\n\nAccepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.\n\n### `.getCookieStringSync(...)`\n\nSynchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getSetCookieStrings(...)`\n\nReturns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`.\n\n### `.getSetCookieStringsSync(...)`\n\nSynchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.serialize(cb(err,serializedObject))`\n\nSerialize the Jar if the underlying store supports `.getAllCookies`.\n\n**NOTE**: Custom `Cookie` properties will be discarded. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.\n\nSee [Serialization Format].\n\n### `.serializeSync()`\n\nSync version of .serialize\n\n### `.toJSON()`\n\nAlias of .serializeSync() for the convenience of `JSON.stringify(cookiejar)`.\n\n### `CookieJar.deserialize(serialized, [store], cb(err,object))`\n\nA new Jar is created and the serialized Cookies are added to the underlying store. Each `Cookie` is added via `store.putCookie` in the order in which they appear in the serialization.\n\nThe `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created.\n\nAs a convenience, if `serialized` is a string, it is passed through `JSON.parse` first. If that throws an error, this is passed to the callback.\n\n### `CookieJar.deserializeSync(serialized, [store])`\n\nSync version of `.deserialize`. _Note_ that the `store` must be synchronous for this to work.\n\n### `CookieJar.fromJSON(string)`\n\nAlias of `.deserializeSync` to provide consistency with `Cookie.fromJSON()`.\n\n### `.clone([store,]cb(err,newJar))`\n\nProduces a deep clone of this jar. Modifications to the original won't affect the clone, and vice versa.\n\nThe `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created. Transferring between store types is supported so long as the source implements `.getAllCookies()` and the destination implements `.putCookie()`.\n\n### `.cloneSync([store])`\n\nSynchronous version of `.clone`, returning a new `CookieJar` instance.\n\nThe `store` argument is optional, but must be a _synchronous_ `Store` instance if specified. If not passed, a new instance of `MemoryCookieStore` is used.\n\nThe _source_ and _destination_ must both be synchronous `Store`s. If one or both stores are asynchronous, use `.clone` instead. Recall that `MemoryCookieStore` supports both synchronous and asynchronous API calls.\n\n### `.removeAllCookies(cb(err))`\n\nRemoves all cookies from the jar.\n\nThis is a new backwards-compatible feature of `tough-cookie` version 2.5, so not all Stores will implement it efficiently. For Stores that do not implement `removeAllCookies`, the fallback is to call `removeCookie` after `getAllCookies`. If `getAllCookies` fails or isn't implemented in the Store, that error is returned. If one or more of the `removeCookie` calls fail, only the first error is returned.\n\n### `.removeAllCookiesSync()`\n\nSync version of `.removeAllCookies()`\n\n## Store\n\nBase class for CookieJar stores. Available as `tough.Store`.\n\n## Store API\n\nThe storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.\n\nStores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`.\n\nStores are asynchronous by default, but if `store.synchronous` is set to `true`, then the `*Sync` methods on the of the containing `CookieJar` can be used (however, the continuation-passing style\n\nAll `domain` parameters will have been normalized before calling.\n\nThe Cookie store must have all of the following methods.\n\n### `store.findCookie(domain, path, key, cb(err,cookie))`\n\nRetrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.\n\nCallback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).\n\n### `store.findCookies(domain, path, cb(err,cookies))`\n\nLocates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.\n\nIf no cookies are found, the callback MUST be passed an empty array.\n\nThe resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.\n\nAs of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).\n\n### `store.putCookie(cookie, cb(err))`\n\nAdds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.\n\nThe `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.\n\nPass an error if the cookie cannot be stored.\n\n### `store.updateCookie(oldCookie, newCookie, cb(err))`\n\nUpdate an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.\n\nThe `.lastAccessed` property will always be different between the two objects (to the precision possible via JavaScript's clock). Both `.creation` and `.creationIndex` are guaranteed to be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are selected for automatic deletion (e.g., least-recently-used, which is up to the store to implement).\n\nStores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.\n\nThe `newCookie` and `oldCookie` objects MUST NOT be modified.\n\nPass an error if the newCookie cannot be stored.\n\n### `store.removeCookie(domain, path, key, cb(err))`\n\nRemove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).\n\nThe implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.\n\n### `store.removeCookies(domain, path, cb(err))`\n\nRemoves matching cookies from the store. The `path` parameter is optional, and if missing means all paths in a domain should be removed.\n\nPass an error ONLY if removing any existing cookies failed.\n\n### `store.removeAllCookies(cb(err))`\n\n_Optional_. Removes all cookies from the store.\n\nPass an error if one or more cookies can't be removed.\n\n**Note**: New method as of `tough-cookie` version 2.5, so not all Stores will implement this, plus some stores may choose not to implement this.\n\n### `store.getAllCookies(cb(err, cookies))`\n\n_Optional_. Produces an `Array` of all cookies during `jar.serialize()`. The items in the array can be true `Cookie` objects or generic `Object`s with the [Serialization Format] data structure.\n\nCookies SHOULD be returned in creation order to preserve sorting via `compareCookies()`. For reference, `MemoryCookieStore` will sort by `.creationIndex` since it uses true `Cookie` objects internally. If you don't return the cookies in creation order, they'll still be sorted by creation time, but this only has a precision of 1ms. See `compareCookies` for more detail.\n\nPass an error if retrieval fails.\n\n**Note**: not all Stores can implement this due to technical limitations, so it is optional.\n\n## MemoryCookieStore\n\nInherits from `Store`.\n\nA just-in-memory CookieJar synchronous store implementation, used by default. Despite being a synchronous implementation, it's usable with both the synchronous and asynchronous forms of the `CookieJar` API. Supports serialization, `getAllCookies`, and `removeAllCookies`.\n\n## Community Cookie Stores\n\nThese are some Store implementations authored and maintained by the community. They aren't official and we don't vouch for them but you may be interested to have a look:\n\n- [`db-cookie-store`](https://github.com/JSBizon/db-cookie-store): SQL including SQLite-based databases\n- [`file-cookie-store`](https://github.com/JSBizon/file-cookie-store): Netscape cookie file format on disk\n- [`redis-cookie-store`](https://github.com/benkroeger/redis-cookie-store): Redis\n- [`tough-cookie-filestore`](https://github.com/mitsuru/tough-cookie-filestore): JSON on disk\n- [`tough-cookie-web-storage-store`](https://github.com/exponentjs/tough-cookie-web-storage-store): DOM localStorage and sessionStorage\n\n\n# Serialization Format\n\n**NOTE**: if you want to have custom `Cookie` properties serialized, add the property name to `Cookie.serializableProperties`.\n\n```js\n {\n // The version of tough-cookie that serialized this jar.\n version: 'tough-cookie@1.x.y',\n\n // add the store type, to make humans happy:\n storeType: 'MemoryCookieStore',\n\n // CookieJar configuration:\n rejectPublicSuffixes: true,\n // ... future items go here\n\n // Gets filled from jar.store.getAllCookies():\n cookies: [\n {\n key: 'string',\n value: 'string',\n // ...\n /* other Cookie.serializableProperties go here */\n }\n ]\n }\n```\n\n# RFC6265bis\n\nSupport for RFC6265bis revision 02 is being developed. Since this is a bit of an omnibus revision to the RFC6252, support is broken up into the functional areas.\n\n## Leave Secure Cookies Alone\n\nNot yet supported.\n\nThis change makes it so that if a cookie is sent from the server to the client with a `Secure` attribute, the channel must also be secure or the cookie is ignored.\n\n## SameSite Cookies\n\nSupported.\n\nThis change makes it possible for servers, and supporting clients, to mitigate certain types of CSRF attacks by disallowing `SameSite` cookies from being sent cross-origin.\n\nOn the Cookie object itself, you can get/set the `.sameSite` attribute, which will be serialized into the `SameSite=` cookie attribute. When unset or `undefined`, no `SameSite=` attribute will be serialized. The valid values of this attribute are `'none'`, `'lax'`, or `'strict'`. Other values will be serialized as-is.\n\nWhen parsing cookies with a `SameSite` cookie attribute, values other than `'lax'` or `'strict'` are parsed as `'none'`. For example, `SomeCookie=SomeValue; SameSite=garbage` will parse so that `cookie.sameSite === 'none'`.\n\nIn order to support SameSite cookies, you must provide a `sameSiteContext` option to _both_ `setCookie` and `getCookies`. Valid values for this option are just like for the Cookie object, but have particular meanings:\n1. `'strict'` mode - If the request is on the same \"site for cookies\" (see the RFC draft for what this means), pass this option to add a layer of defense against CSRF.\n2. `'lax'` mode - If the request is from another site, _but_ is directly because of navigation by the user, e.g., `` or ``, pass `sameSiteContext: 'lax'`.\n3. `'none'` - Otherwise, pass `sameSiteContext: 'none'` (this indicates a cross-origin request).\n4. unset/`undefined` - SameSite **will not** be enforced! This can be a valid use-case for when CSRF isn't in the threat model of the system being built.\n\nIt is highly recommended that you read RFC 6265bis for fine details on SameSite cookies. In particular [Section 8.8](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-8.8) discusses security considerations and defense in depth.\n\n## Cookie Prefixes\n\nSupported.\n\nCookie prefixes are a way to indicate that a given cookie was set with a set of attributes simply by inspecting the first few characters of the cookie's name.\n\nCookie prefixes are defined in [Section 4.1.3 of 6265bis](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.3). Two prefixes are defined:\n\n1. `\"__Secure-\" Prefix`: If a cookie's name begins with a case-sensitive match for the string \"__Secure-\", then the cookie will have been set with a \"Secure\" attribute.\n2. `\"__Host-\" Prefix`: If a cookie's name begins with a case-sensitive match for the string \"__Host-\", then the cookie will have been set with a \"Secure\" attribute, a \"Path\" attribute with a value of \"/\", and no \"Domain\" attribute.\n\nIf `prefixSecurity` is enabled for `CookieJar`, then cookies that match the prefixes defined above but do not obey the attribute restrictions will not be added.\n\nYou can define this functionality by passing in `prefixSecurity` option to `CookieJar`. It can be one of 3 values:\n\n1. `silent`: Enable cookie prefix checking but silently fail to add the cookie if conditions not met. Default.\n2. `strict`: Enable cookie prefix checking and error out if conditions not met.\n3. `unsafe-disabled`: Disable cookie prefix checking.\n\nNote that if `ignoreError` is passed in as `true` then the error will be silent regardless of `prefixSecurity` option (assuming it's enabled).\n\n\n# Copyright and License\n\nBSD-3-Clause:\n\n```text\n Copyright (c) 2015, Salesforce.com, Inc.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n 3. Neither the name of Salesforce.com nor the names of its contributors may\n be used to endorse or promote products derived from this software without\n specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n```\n", "homepage": "https://github.com/salesforce/tough-cookie", "keywords": [ "HTTP", diff --git a/workspaces/arborist/test/fixtures/reify-cases/tap-with-yarn-lock.js b/workspaces/arborist/test/fixtures/reify-cases/tap-with-yarn-lock.js index 25f15a7aa6640..6905f81906f9f 100644 --- a/workspaces/arborist/test/fixtures/reify-cases/tap-with-yarn-lock.js +++ b/workspaces/arborist/test/fixtures/reify-cases/tap-with-yarn-lock.js @@ -4992,7 +4992,7 @@ module.exports = t => { "package.json": JSON.stringify({ "name": "ms", "version": "2.0.0", - "description": "Tiny milisecond conversion utility", + "description": "Tiny millisecond conversion utility", "repository": "zeit/ms", "main": "./index", "files": [ diff --git a/workspaces/libnpmexec/test/registry.js b/workspaces/libnpmexec/test/registry.js index 899c19d47ca8f..adbf4116107b4 100644 --- a/workspaces/libnpmexec/test/registry.js +++ b/workspaces/libnpmexec/test/registry.js @@ -229,7 +229,7 @@ t.test('packages with different versions in the global tree', async t => { }) }) -t.test('run from registry - non existant global path', async t => { +t.test('run from registry - non existent global path', async t => { const { fixtures, package } = createPkg({ versions: ['2.0.0'] }) const { exec, path, registry, readOutput } = setup(t, { @@ -240,7 +240,7 @@ t.test('run from registry - non existant global path', async t => { await exec({ args: ['@npmcli/create-index'], - globalPath: resolve(path, 'non-existant'), + globalPath: resolve(path, 'non-existent'), }) t.match(await readOutput('@npmcli-create-index'), { From 34b58e89903d4fce6a44ac7838adc4b4caf4efd4 Mon Sep 17 00:00:00 2001 From: opensourcezeal <269018900+opensourcezeal@users.noreply.github.com> Date: Tue, 21 Apr 2026 19:32:52 +0200 Subject: [PATCH 2/2] Fixed non functional typos with respect to upstream registry --- .../content/browserify-zlib.json | 2 +- .../content/https-browserify.json | 10 ++-- .../fixtures/registry-mocks/content/ms.json | 8 +-- .../registry-mocks/content/retry.json | 2 +- .../registry-mocks/content/through.json | 50 +++++++++---------- .../registry-mocks/content/tough-cookie.json | 2 +- .../reify-cases/tap-with-yarn-lock.js | 2 +- 7 files changed, 38 insertions(+), 38 deletions(-) diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/browserify-zlib.json b/workspaces/arborist/test/fixtures/registry-mocks/content/browserify-zlib.json index 8922c562797fc..4f87ba764f2a8 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/browserify-zlib.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/browserify-zlib.json @@ -438,7 +438,7 @@ } } }, - "readme": "# browserify-zlib\n\n[![Travis CI](https://travis-ci.org/devongovett/browserify-zlib.svg?branch=master)](https://travis-ci.org/devongovett/browserify-zlib)\n[![Dependency Status](https://david-dm.org/devongovett/browserify-zlib.svg?style=flat-square)](https://david-dm.org/devongovett/browserify-zlib) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n## Description\n\nEmulates Node's [zlib](https://nodejs.org/api/zlib.html) module for the browser. Can be used as a drop in replacement with [Browserify](http://browserify.org) and [webpack](http://webpack.github.io/).\n\nThe heavy lifting is done using [pako](https://github.com/nodeca/pako). The code in this module is modeled closely after the code in the source of Node core to get as much compatibility as possible.\n\n## API\n\nhttps://nodejs.org/api/zlib.html\n\n## Not implemented\n\nThe following options/methods are not supported because pako does not support them yet.\n\n* The `params` method\n\n## License\n\nMIT\n", + "readme": "# browserify-zlib\n\n[![Travis CI](https://travis-ci.org/devongovett/browserify-zlib.svg?branch=master)](https://travis-ci.org/devongovett/browserify-zlib)\n[![Dependency Status](https://david-dm.org/devongovett/browserify-zlib.svg?style=flat-square)](https://david-dm.org/devongovett/browserify-zlib) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n## Description\n\nEmulates Node's [zlib](https://nodejs.org/api/zlib.html) module for the browser. Can be used as a drop in replacement with [Browserify](http://browserify.org) and [webpack](http://webpack.github.io/).\n\nThe heavy lifting is done using [pako](https://github.com/nodeca/pako). The code in this module is modeled closely after the code in the source of Node core to get as much compatability as possible.\n\n## API\n\nhttps://nodejs.org/api/zlib.html\n\n## Not implemented\n\nThe following options/methods are not supported because pako does not support them yet.\n\n* The `params` method\n\n## License\n\nMIT\n", "maintainers": [ { "email": "dignifiedquire@gmail.com", diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/https-browserify.json b/workspaces/arborist/test/fixtures/registry-mocks/content/https-browserify.json index 0b7254b02ca45..13009536197d3 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/https-browserify.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/https-browserify.json @@ -2,7 +2,7 @@ "_id": "https-browserify", "_rev": "9-880a61611dbcc5663dcb3364ce5cdfc3", "name": "https-browserify", - "description": "https module compatibility for browserify", + "description": "https module compatability for browserify", "dist-tags": { "latest": "1.0.0" }, @@ -10,7 +10,7 @@ "0.0.0": { "name": "https-browserify", "version": "0.0.0", - "description": "https module compatibility for browserify", + "description": "https module compatability for browserify", "main": "index.js", "repository": { "type": "git", @@ -53,7 +53,7 @@ "0.0.1": { "name": "https-browserify", "version": "0.0.1", - "description": "https module compatibility for browserify", + "description": "https module compatability for browserify", "main": "index.js", "repository": { "type": "git", @@ -107,7 +107,7 @@ }, "1.0.0": { "name": "https-browserify", - "description": "https module compatibility for browserify", + "description": "https module compatability for browserify", "version": "1.0.0", "author": { "name": "James Halliday", @@ -170,7 +170,7 @@ "directories": {} } }, - "readme": "# https-browserify\n\nhttps module compatibility for browserify\n\n# example\n\n``` js\nvar https = require('https-browserify')\nvar r = https.request('https://github.com')\nr.on('request', function (res) {\n console.log(res)\n})\n```\n\n# methods\n\nThe API is the same as the client portion of the\n[node core https module](http://nodejs.org/docs/latest/api/https.html).\n\n# license\n\nMIT\n", + "readme": "# https-browserify\n\nhttps module compatability for browserify\n\n# example\n\n``` js\nvar https = require('https-browserify')\nvar r = https.request('https://github.com')\nr.on('request', function (res) {\n console.log(res)\n})\n```\n\n# methods\n\nThe API is the same as the client portion of the\n[node core https module](http://nodejs.org/docs/latest/api/https.html).\n\n# license\n\nMIT\n", "maintainers": [ { "name": "feross", diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/ms.json b/workspaces/arborist/test/fixtures/registry-mocks/content/ms.json index df4f8c786dabe..0dafe515088ec 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/ms.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/ms.json @@ -391,7 +391,7 @@ "0.7.2": { "name": "ms", "version": "0.7.2", - "description": "Tiny millisecond conversion utility", + "description": "Tiny milisecond conversion utility", "repository": { "type": "git", "url": "git+https://github.com/zeit/ms.git" @@ -463,7 +463,7 @@ "0.7.3": { "name": "ms", "version": "0.7.3", - "description": "Tiny millisecond conversion utility", + "description": "Tiny milisecond conversion utility", "repository": { "type": "git", "url": "git+https://github.com/zeit/ms.git" @@ -535,7 +535,7 @@ "1.0.0": { "name": "ms", "version": "1.0.0", - "description": "Tiny millisecond conversion utility", + "description": "Tiny milisecond conversion utility", "repository": { "type": "git", "url": "git+https://github.com/zeit/ms.git" @@ -608,7 +608,7 @@ "2.0.0": { "name": "ms", "version": "2.0.0", - "description": "Tiny millisecond conversion utility", + "description": "Tiny milisecond conversion utility", "repository": { "type": "git", "url": "git+https://github.com/zeit/ms.git" diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/retry.json b/workspaces/arborist/test/fixtures/registry-mocks/content/retry.json index 36950179f70b9..15662e3780cd5 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/retry.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/retry.json @@ -736,7 +736,7 @@ "johnloy": true, "losymear": true }, - "readme": "\n[![Build Status](https://secure.travis-ci.org/tim-kos/node-retry.png?branch=master)](http://travis-ci.org/tim-kos/node-retry \"Check this project's build status on TravisCI\")\n[![codecov](https://codecov.io/gh/tim-kos/node-retry/branch/master/graph/badge.svg)](https://codecov.io/gh/tim-kos/node-retry)\n\n\n# retry\n\nAbstraction for exponential and custom retry strategies for failed operations.\n\n## Installation\n\n npm install retry\n\n## Current Status\n\nThis module has been tested and is ready to be used.\n\n## Tutorial\n\nThe example below will retry a potentially failing `dns.resolve` operation\n`10` times using an exponential backoff strategy. With the default settings, this\nmeans the last attempt is made after `17 minutes and 3 seconds`.\n\n``` javascript\nvar dns = require('dns');\nvar retry = require('retry');\n\nfunction faultTolerantResolve(address, cb) {\n var operation = retry.operation();\n\n operation.attempt(function(currentAttempt) {\n dns.resolve(address, function(err, addresses) {\n if (operation.retry(err)) {\n return;\n }\n\n cb(err ? operation.mainError() : null, addresses);\n });\n });\n}\n\nfaultTolerantResolve('nodejs.org', function(err, addresses) {\n console.log(err, addresses);\n});\n```\n\nOf course you can also configure the factors that go into the exponential\nbackoff. See the API documentation below for all available settings.\ncurrentAttempt is an int representing the number of attempts so far.\n\n``` javascript\nvar operation = retry.operation({\n retries: 5,\n factor: 3,\n minTimeout: 1 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n});\n```\n\n## API\n\n### retry.operation([options])\n\nCreates a new `RetryOperation` object. `options` is the same as `retry.timeouts()`'s `options`, with two additions:\n\n* `forever`: Whether to retry forever, defaults to `false`.\n* `unref`: Whether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.\n* `maxRetryTime`: The maximum time (in milliseconds) that the retried operation is allowed to run. Default is `Infinity`. \n\n### retry.timeouts([options])\n\nReturns an array of timeouts. All time `options` and return values are in\nmilliseconds. If `options` is an array, a copy of that array is returned.\n\n`options` is a JS object that can contain any of the following keys:\n\n* `retries`: The maximum amount of times to retry the operation. Default is `10`. Seting this to `1` means `do it once, then retry it once`.\n* `factor`: The exponential factor to use. Default is `2`.\n* `minTimeout`: The number of milliseconds before starting the first retry. Default is `1000`.\n* `maxTimeout`: The maximum number of milliseconds between two retries. Default is `Infinity`.\n* `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `false`.\n\nThe formula used to calculate the individual timeouts is:\n\n```\nMath.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout)\n```\n\nHave a look at [this article][article] for a better explanation of approach.\n\nIf you want to tune your `factor` / `times` settings to attempt the last retry\nafter a certain amount of time, you can use wolfram alpha. For example in order\nto tune for `10` attempts in `5 minutes`, you can use this equation:\n\n![screenshot](https://github.com/tim-kos/node-retry/raw/master/equation.gif)\n\nExplaining the various values from left to right:\n\n* `k = 0 ... 9`: The `retries` value (10)\n* `1000`: The `minTimeout` value in ms (1000)\n* `x^k`: No need to change this, `x` will be your resulting factor\n* `5 * 60 * 1000`: The desired total amount of time for retrying in ms (5 minutes)\n\nTo make this a little easier for you, use wolfram alpha to do the calculations:\n\n\n\n[article]: http://dthain.blogspot.com/2009/02/exponential-backoff-in-distributed.html\n\n### retry.createTimeout(attempt, opts)\n\nReturns a new `timeout` (integer in milliseconds) based on the given parameters.\n\n`attempt` is an integer representing for which retry the timeout should be calculated. If your retry operation was executed 4 times you had one attempt and 3 retries. If you then want to calculate a new timeout, you should set `attempt` to 4 (attempts are zero-indexed).\n\n`opts` can include `factor`, `minTimeout`, `randomize` (boolean) and `maxTimeout`. They are documented above.\n\n`retry.createTimeout()` is used internally by `retry.timeouts()` and is public for you to be able to create your own timeouts for reinserting an item, see [issue #13](https://github.com/tim-kos/node-retry/issues/13).\n\n### retry.wrap(obj, [options], [methodNames])\n\nWrap all functions of the `obj` with retry. Optionally you can pass operation options and\nan array of method names which need to be wrapped.\n\n```\nretry.wrap(obj)\n\nretry.wrap(obj, ['method1', 'method2'])\n\nretry.wrap(obj, {retries: 3})\n\nretry.wrap(obj, {retries: 3}, ['method1', 'method2'])\n```\nThe `options` object can take any options that the usual call to `retry.operation` can take.\n\n### new RetryOperation(timeouts, [options])\n\nCreates a new `RetryOperation` where `timeouts` is an array where each value is\na timeout given in milliseconds.\n\nAvailable options:\n* `forever`: Whether to retry forever, defaults to `false`.\n* `unref`: Wether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.\n\nIf `forever` is true, the following changes happen:\n* `RetryOperation.errors()` will only output an array of one item: the last error.\n* `RetryOperation` will repeatedly use the `timeouts` array. Once all of its timeouts have been used up, it restarts with the first timeout, then uses the second and so on.\n\n#### retryOperation.errors()\n\nReturns an array of all errors that have been passed to `retryOperation.retry()` so far. The\nreturning array has the errors ordered chronologically based on when they were passed to\n`retryOperation.retry()`, which means the first passed error is at index zero and the last is\nat the last index.\n\n#### retryOperation.mainError()\n\nA reference to the error object that occured most frequently. Errors are\ncompared using the `error.message` property.\n\nIf multiple error messages occured the same amount of time, the last error\nobject with that message is returned.\n\nIf no errors occured so far, the value is `null`.\n\n#### retryOperation.attempt(fn, timeoutOps)\n\nDefines the function `fn` that is to be retried and executes it for the first\ntime right away. The `fn` function can receive an optional `currentAttempt` callback that represents the number of attempts to execute `fn` so far.\n\nOptionally defines `timeoutOps` which is an object having a property `timeout` in milliseconds and a property `cb` callback function.\nWhenever your retry operation takes longer than `timeout` to execute, the timeout callback function `cb` is called.\n\n\n#### retryOperation.try(fn)\n\nThis is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.\n\n#### retryOperation.start(fn)\n\nThis is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.\n\n#### retryOperation.retry(error)\n\nReturns `false` when no `error` value is given, or the maximum amount of retries\nhas been reached.\n\nOtherwise it returns `true`, and retries the operation after the timeout for\nthe current attempt number.\n\n#### retryOperation.stop()\n\nAllows you to stop the operation being retried. Useful for aborting the operation on a fatal error etc.\n\n#### retryOperation.reset()\n\nResets the internal state of the operation object, so that you can call `attempt()` again as if this was a new operation object.\n\n#### retryOperation.attempts()\n\nReturns an int representing the number of attempts it took to call `fn` before it was successful.\n\n## License\n\nretry is licensed under the MIT license.\n\n\n# Changelog\n\n0.10.0 Adding `stop` functionality, thanks to @maxnachlinger.\n\n0.9.0 Adding `unref` functionality, thanks to @satazor.\n\n0.8.0 Implementing retry.wrap.\n\n0.7.0 Some bug fixes and made retry.createTimeout() public. Fixed issues [#10](https://github.com/tim-kos/node-retry/issues/10), [#12](https://github.com/tim-kos/node-retry/issues/12), and [#13](https://github.com/tim-kos/node-retry/issues/13).\n\n0.6.0 Introduced optional timeOps parameter for the attempt() function which is an object having a property timeout in milliseconds and a property cb callback function. Whenever your retry operation takes longer than timeout to execute, the timeout callback function cb is called.\n\n0.5.0 Some minor refactoring.\n\n0.4.0 Changed retryOperation.try() to retryOperation.attempt(). Deprecated the aliases start() and try() for it.\n\n0.3.0 Added retryOperation.start() which is an alias for retryOperation.try().\n\n0.2.0 Added attempts() function and parameter to retryOperation.try() representing the number of attempts it took to call fn().\n", + "readme": "\n[![Build Status](https://secure.travis-ci.org/tim-kos/node-retry.png?branch=master)](http://travis-ci.org/tim-kos/node-retry \"Check this project's build status on TravisCI\")\n[![codecov](https://codecov.io/gh/tim-kos/node-retry/branch/master/graph/badge.svg)](https://codecov.io/gh/tim-kos/node-retry)\n\n\n# retry\n\nAbstraction for exponential and custom retry strategies for failed operations.\n\n## Installation\n\n npm install retry\n\n## Current Status\n\nThis module has been tested and is ready to be used.\n\n## Tutorial\n\nThe example below will retry a potentially failing `dns.resolve` operation\n`10` times using an exponential backoff strategy. With the default settings, this\nmeans the last attempt is made after `17 minutes and 3 seconds`.\n\n``` javascript\nvar dns = require('dns');\nvar retry = require('retry');\n\nfunction faultTolerantResolve(address, cb) {\n var operation = retry.operation();\n\n operation.attempt(function(currentAttempt) {\n dns.resolve(address, function(err, addresses) {\n if (operation.retry(err)) {\n return;\n }\n\n cb(err ? operation.mainError() : null, addresses);\n });\n });\n}\n\nfaultTolerantResolve('nodejs.org', function(err, addresses) {\n console.log(err, addresses);\n});\n```\n\nOf course you can also configure the factors that go into the exponential\nbackoff. See the API documentation below for all available settings.\ncurrentAttempt is an int representing the number of attempts so far.\n\n``` javascript\nvar operation = retry.operation({\n retries: 5,\n factor: 3,\n minTimeout: 1 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n});\n```\n\n## API\n\n### retry.operation([options])\n\nCreates a new `RetryOperation` object. `options` is the same as `retry.timeouts()`'s `options`, with two additions:\n\n* `forever`: Whether to retry forever, defaults to `false`.\n* `unref`: Whether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.\n* `maxRetryTime`: The maximum time (in milliseconds) that the retried operation is allowed to run. Default is `Infinity`. \n\n### retry.timeouts([options])\n\nReturns an array of timeouts. All time `options` and return values are in\nmilliseconds. If `options` is an array, a copy of that array is returned.\n\n`options` is a JS object that can contain any of the following keys:\n\n* `retries`: The maximum amount of times to retry the operation. Default is `10`. Seting this to `1` means `do it once, then retry it once`.\n* `factor`: The exponential factor to use. Default is `2`.\n* `minTimeout`: The number of milliseconds before starting the first retry. Default is `1000`.\n* `maxTimeout`: The maximum number of milliseconds between two retries. Default is `Infinity`.\n* `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `false`.\n\nThe formula used to calculate the individual timeouts is:\n\n```\nMath.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout)\n```\n\nHave a look at [this article][article] for a better explanation of approach.\n\nIf you want to tune your `factor` / `times` settings to attempt the last retry\nafter a certain amount of time, you can use wolfram alpha. For example in order\nto tune for `10` attempts in `5 minutes`, you can use this equation:\n\n![screenshot](https://github.com/tim-kos/node-retry/raw/master/equation.gif)\n\nExplaining the various values from left to right:\n\n* `k = 0 ... 9`: The `retries` value (10)\n* `1000`: The `minTimeout` value in ms (1000)\n* `x^k`: No need to change this, `x` will be your resulting factor\n* `5 * 60 * 1000`: The desired total amount of time for retrying in ms (5 minutes)\n\nTo make this a little easier for you, use wolfram alpha to do the calculations:\n\n\n\n[article]: http://dthain.blogspot.com/2009/02/exponential-backoff-in-distributed.html\n\n### retry.createTimeout(attempt, opts)\n\nReturns a new `timeout` (integer in milliseconds) based on the given parameters.\n\n`attempt` is an integer representing for which retry the timeout should be calculated. If your retry operation was executed 4 times you had one attempt and 3 retries. If you then want to calculate a new timeout, you should set `attempt` to 4 (attempts are zero-indexed).\n\n`opts` can include `factor`, `minTimeout`, `randomize` (boolean) and `maxTimeout`. They are documented above.\n\n`retry.createTimeout()` is used internally by `retry.timeouts()` and is public for you to be able to create your own timeouts for reinserting an item, see [issue #13](https://github.com/tim-kos/node-retry/issues/13).\n\n### retry.wrap(obj, [options], [methodNames])\n\nWrap all functions of the `obj` with retry. Optionally you can pass operation options and\nan array of method names which need to be wrapped.\n\n```\nretry.wrap(obj)\n\nretry.wrap(obj, ['method1', 'method2'])\n\nretry.wrap(obj, {retries: 3})\n\nretry.wrap(obj, {retries: 3}, ['method1', 'method2'])\n```\nThe `options` object can take any options that the usual call to `retry.operation` can take.\n\n### new RetryOperation(timeouts, [options])\n\nCreates a new `RetryOperation` where `timeouts` is an array where each value is\na timeout given in milliseconds.\n\nAvailable options:\n* `forever`: Whether to retry forever, defaults to `false`.\n* `unref`: Wether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.\n\nIf `forever` is true, the following changes happen:\n* `RetryOperation.errors()` will only output an array of one item: the last error.\n* `RetryOperation` will repeatedly use the `timeouts` array. Once all of its timeouts have been used up, it restarts with the first timeout, then uses the second and so on.\n\n#### retryOperation.errors()\n\nReturns an array of all errors that have been passed to `retryOperation.retry()` so far. The\nreturning array has the errors ordered chronologically based on when they were passed to\n`retryOperation.retry()`, which means the first passed error is at index zero and the last is\nat the last index.\n\n#### retryOperation.mainError()\n\nA reference to the error object that occured most frequently. Errors are\ncompared using the `error.message` property.\n\nIf multiple error messages occured the same amount of time, the last error\nobject with that message is returned.\n\nIf no errors occured so far, the value is `null`.\n\n#### retryOperation.attempt(fn, timeoutOps)\n\nDefines the function `fn` that is to be retried and executes it for the first\ntime right away. The `fn` function can receive an optional `currentAttempt` callback that represents the number of attempts to execute `fn` so far.\n\nOptionally defines `timeoutOps` which is an object having a property `timeout` in miliseconds and a property `cb` callback function.\nWhenever your retry operation takes longer than `timeout` to execute, the timeout callback function `cb` is called.\n\n\n#### retryOperation.try(fn)\n\nThis is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.\n\n#### retryOperation.start(fn)\n\nThis is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.\n\n#### retryOperation.retry(error)\n\nReturns `false` when no `error` value is given, or the maximum amount of retries\nhas been reached.\n\nOtherwise it returns `true`, and retries the operation after the timeout for\nthe current attempt number.\n\n#### retryOperation.stop()\n\nAllows you to stop the operation being retried. Useful for aborting the operation on a fatal error etc.\n\n#### retryOperation.reset()\n\nResets the internal state of the operation object, so that you can call `attempt()` again as if this was a new operation object.\n\n#### retryOperation.attempts()\n\nReturns an int representing the number of attempts it took to call `fn` before it was successful.\n\n## License\n\nretry is licensed under the MIT license.\n\n\n# Changelog\n\n0.10.0 Adding `stop` functionality, thanks to @maxnachlinger.\n\n0.9.0 Adding `unref` functionality, thanks to @satazor.\n\n0.8.0 Implementing retry.wrap.\n\n0.7.0 Some bug fixes and made retry.createTimeout() public. Fixed issues [#10](https://github.com/tim-kos/node-retry/issues/10), [#12](https://github.com/tim-kos/node-retry/issues/12), and [#13](https://github.com/tim-kos/node-retry/issues/13).\n\n0.6.0 Introduced optional timeOps parameter for the attempt() function which is an object having a property timeout in milliseconds and a property cb callback function. Whenever your retry operation takes longer than timeout to execute, the timeout callback function cb is called.\n\n0.5.0 Some minor refactoring.\n\n0.4.0 Changed retryOperation.try() to retryOperation.attempt(). Deprecated the aliases start() and try() for it.\n\n0.3.0 Added retryOperation.start() which is an alias for retryOperation.try().\n\n0.2.0 Added attempts() function and parameter to retryOperation.try() representing the number of attempts it took to call fn().\n", "homepage": "https://github.com/tim-kos/node-retry", "bugs": { "url": "https://github.com/tim-kos/node-retry/issues" diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/through.json b/workspaces/arborist/test/fixtures/registry-mocks/content/through.json index 0b294889dad63..ca93347f66869 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/through.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/through.json @@ -10,7 +10,7 @@ "0.0.1": { "name": "through", "version": "0.0.1", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -48,7 +48,7 @@ "0.0.2": { "name": "through", "version": "0.0.2", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -86,7 +86,7 @@ "0.0.3": { "name": "through", "version": "0.0.3", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -124,7 +124,7 @@ "0.0.4": { "name": "through", "version": "0.0.4", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -162,7 +162,7 @@ "0.1.0": { "name": "through", "version": "0.1.0", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -200,7 +200,7 @@ "0.1.1": { "name": "through", "version": "0.1.1", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -238,7 +238,7 @@ "0.1.2": { "name": "through", "version": "0.1.2", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -276,7 +276,7 @@ "0.1.3": { "name": "through", "version": "0.1.3", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -319,7 +319,7 @@ "0.1.4": { "name": "through", "version": "0.1.4", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -362,7 +362,7 @@ "1.0.0": { "name": "through", "version": "1.0.0", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -405,7 +405,7 @@ "1.1.0": { "name": "through", "version": "1.1.0", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -453,7 +453,7 @@ "1.1.1": { "name": "through", "version": "1.1.1", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -501,7 +501,7 @@ "1.1.2": { "name": "through", "version": "1.1.2", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -549,7 +549,7 @@ "2.0.0": { "name": "through", "version": "2.0.0", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -597,7 +597,7 @@ "2.1.0": { "name": "through", "version": "2.1.0", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -645,7 +645,7 @@ "2.2.0": { "name": "through", "version": "2.2.0", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -694,7 +694,7 @@ "2.2.1": { "name": "through", "version": "2.2.1", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "asynct test/*.js" @@ -743,7 +743,7 @@ "2.2.2": { "name": "through", "version": "2.2.2", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -800,7 +800,7 @@ "2.2.4": { "name": "through", "version": "2.2.4", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -857,7 +857,7 @@ "2.2.5": { "name": "through", "version": "2.2.5", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -914,7 +914,7 @@ "2.2.6": { "name": "through", "version": "2.2.6", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -971,7 +971,7 @@ "2.2.7": { "name": "through", "version": "2.2.7", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -1028,7 +1028,7 @@ "2.3.1": { "name": "through", "version": "2.3.1", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -1085,7 +1085,7 @@ "2.3.2": { "name": "through", "version": "2.3.2", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" @@ -1142,7 +1142,7 @@ "2.3.3": { "name": "through", "version": "2.3.3", - "description": "simplified stream construction", + "description": "simplified stream contruction", "main": "index.js", "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" diff --git a/workspaces/arborist/test/fixtures/registry-mocks/content/tough-cookie.json b/workspaces/arborist/test/fixtures/registry-mocks/content/tough-cookie.json index 2c4d1033b472b..b61764610224e 100644 --- a/workspaces/arborist/test/fixtures/registry-mocks/content/tough-cookie.json +++ b/workspaces/arborist/test/fixtures/registry-mocks/content/tough-cookie.json @@ -2988,7 +2988,7 @@ "rossdavis": true, "mrxf": true }, - "readme": "[RFC6265](https://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js\n\n[![npm package](https://nodei.co/npm/tough-cookie.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/tough-cookie/)\n\n[![Build Status](https://travis-ci.org/salesforce/tough-cookie.svg?branch=master)](https://travis-ci.org/salesforce/tough-cookie)\n\n# Synopsis\n\n``` javascript\nvar tough = require('tough-cookie');\nvar Cookie = tough.Cookie;\nvar cookie = Cookie.parse(header);\ncookie.value = 'somethingdifferent';\nheader = cookie.toString();\n\nvar cookiejar = new tough.CookieJar();\ncookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);\n// ...\ncookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {\n res.headers['cookie'] = cookies.join('; ');\n});\n```\n\n# Installation\n\nIt's _so_ easy!\n\n`npm install tough-cookie`\n\nWhy the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.\n\n## Version Support\n\nSupport for versions of node.js will follow that of the [request](https://www.npmjs.com/package/request) module.\n\n# API\n\n## tough\n\nFunctions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be \"bound\".\n\n**Note**: prior to 1.0.x, several of these functions took a `strict` parameter. This has since been removed from the API as it was no longer necessary.\n\n### `parseDate(string)`\n\nParse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`.\n\n### `formatDate(date)`\n\nFormat a Date into a RFC1123 string (the RFC6265-recommended format).\n\n### `canonicalDomain(str)`\n\nTransforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).\n\n### `domainMatch(str,domStr[,canonicalize=true])`\n\nAnswers \"does this real domain match the domain in a cookie?\". The `str` is the \"current\" domain-name and the `domStr` is the \"cookie\" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a \"suffix match\".\n\nThe `canonicalize` parameter will run the other two parameters through `canonicalDomain` or not.\n\n### `defaultPath(path)`\n\nGiven a current request/response path, gives the Path appropriate for storing in a cookie. This is basically the \"directory\" of a \"file\" in the path, but is specified by Section 5.1.4 of the RFC.\n\nThe `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.\n\n### `pathMatch(reqPath,cookiePath)`\n\nAnswers \"does the request-path path-match a given cookie-path?\" as per RFC6265 Section 5.1.4. Returns a boolean.\n\nThis is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.\n\n### `parse(cookieString[, options])`\n\nalias for `Cookie.parse(cookieString[, options])`\n\n### `fromJSON(string)`\n\nalias for `Cookie.fromJSON(string)`\n\n### `getPublicSuffix(hostname)`\n\nReturns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.\n\nFor example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.\n\nFor further information, see http://publicsuffix.org/. This module derives its list from that site. This call is currently a wrapper around [`psl`](https://www.npmjs.com/package/psl)'s [get() method](https://www.npmjs.com/package/psl#pslgetdomain).\n\n### `cookieCompare(a,b)`\n\nFor use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). The sort algorithm is, in order of precedence:\n\n* Longest `.path`\n* oldest `.creation` (which has a 1ms precision, same as `Date`)\n* lowest `.creationIndex` (to get beyond the 1ms precision)\n\n``` javascript\nvar cookies = [ /* unsorted array of Cookie objects */ ];\ncookies = cookies.sort(cookieCompare);\n```\n\n**Note**: Since JavaScript's `Date` is limited to a 1ms precision, cookies within the same millisecond are entirely possible. This is especially true when using the `now` option to `.setCookie()`. The `.creationIndex` property is a per-process global counter, assigned during construction with `new Cookie()`. This preserves the spirit of the RFC sorting: older cookies go first. This works great for `MemoryCookieStore`, since `Set-Cookie` headers are parsed in order, but may not be so great for distributed systems. Sophisticated `Store`s may wish to set this to some other _logical clock_ such that if cookies A and B are created in the same millisecond, but cookie A is created before cookie B, then `A.creationIndex < B.creationIndex`. If you want to alter the global counter, which you probably _shouldn't_ do, it's stored in `Cookie.cookiesCreated`.\n\n### `permuteDomain(domain)`\n\nGenerates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.\n\n### `permutePath(path)`\n\nGenerates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.\n\n\n## Cookie\n\nExported via `tough.Cookie`.\n\n### `Cookie.parse(cookieString[, options])`\n\nParses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed.\n\nThe options parameter is not required and currently has only one property:\n\n * _loose_ - boolean - if `true` enable parsing of key-less cookies like `=abc` and `=`, which are not RFC-compliant.\n\nIf options is not an object, it is ignored, which means you can use `Array#map` with it.\n\nHere's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:\n\n``` javascript\nif (res.headers['set-cookie'] instanceof Array)\n cookies = res.headers['set-cookie'].map(Cookie.parse);\nelse\n cookies = [Cookie.parse(res.headers['set-cookie'])];\n```\n\n_Note:_ in version 2.3.3, tough-cookie limited the number of spaces before the `=` to 256 characters. This limitation has since been removed.\nSee [Issue 92](https://github.com/salesforce/tough-cookie/issues/92)\n\n### Properties\n\nCookie object properties:\n\n * _key_ - string - the name or key of the cookie (default \"\")\n * _value_ - string - the value of the cookie (default \"\")\n * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `\"Infinity\"`). See `setExpires()`\n * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `\"Infinity\"` and `\"-Infinity\"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`\n * _domain_ - string - the `Domain=` attribute of the cookie\n * _path_ - string - the `Path=` of the cookie\n * _secure_ - boolean - the `Secure` cookie flag\n * _httpOnly_ - boolean - the `HttpOnly` cookie flag\n * _sameSite_ - string - the `SameSite` cookie attribute (from [RFC6265bis]); must be one of `none`, `lax`, or `strict`\n * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)\n * _creation_ - `Date` - when this cookie was constructed\n * _creationIndex_ - number - set at construction, used to provide greater sort precision (please see `cookieCompare(a,b)` for a full explanation)\n\nAfter a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:\n\n * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)\n * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.\n * _creation_ - `Date` - **modified** from construction to when the cookie was added to the jar\n * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.\n\n### `Cookie([{properties}])`\n\nReceives an options object that can contain any of the above Cookie properties, uses the default for unspecified properties.\n\n### `.toString()`\n\nencode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.\n\n### `.cookieString()`\n\nencode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').\n\n### `.setExpires(String)`\n\nsets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `\"Infinity\"` (a string) is set.\n\n### `.setMaxAge(number)`\n\nsets the maxAge in seconds. Coerces `-Infinity` to `\"-Infinity\"` and `Infinity` to `\"Infinity\"` so it JSON serializes correctly.\n\n### `.expiryTime([now=Date.now()])`\n\n### `.expiryDate([now=Date.now()])`\n\nexpiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.\n\nMax-Age takes precedence over Expires (as per the RFC). The `.creation` attribute -- or, by default, the `now` parameter -- is used to offset the `.maxAge` attribute.\n\nIf Expires (`.expires`) is set, that's returned.\n\nOtherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for \"Tue, 19 Jan 2038 03:14:07 GMT\" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).\n\n### `.TTL([now=Date.now()])`\n\ncompute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.\n\nThe \"number\" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.\n\n### `.canonicalizedDomain()`\n\n### `.cdomain()`\n\nreturn the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.\n\n### `.toJSON()`\n\nFor convenience in using `JSON.serialize(cookie)`. Returns a plain-old `Object` that can be JSON-serialized.\n\nAny `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are exported in ISO format (`.toISOString()`).\n\n**NOTE**: Custom `Cookie` properties will be discarded. In tough-cookie 1.x, since there was no `.toJSON` method explicitly defined, all enumerable properties were captured. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.\n\n### `Cookie.fromJSON(strOrObj)`\n\nDoes the reverse of `cookie.toJSON()`. If passed a string, will `JSON.parse()` that first.\n\nAny `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are parsed via `Date.parse()`, not the tough-cookie `parseDate`, since it's JavaScript/JSON-y timestamps being handled at this layer.\n\nReturns `null` upon JSON parsing error.\n\n### `.clone()`\n\nDoes a deep clone of this cookie, exactly implemented as `Cookie.fromJSON(cookie.toJSON())`.\n\n### `.validate()`\n\nStatus: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.\n\nvalidates cookie attributes for semantic correctness. Useful for \"lint\" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:\n\n``` javascript\nif (cookie.validate() === true) {\n // it's tasty\n} else {\n // yuck!\n}\n```\n\n\n## CookieJar\n\nExported via `tough.CookieJar`.\n\n### `CookieJar([store],[options])`\n\nSimply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _rejectPublicSuffixes_ - boolean - default `true` - reject cookies with domains like \"com\" and \"co.uk\"\n * _looseMode_ - boolean - default `false` - accept malformed cookies like `bar` and `=bar`, which have an implied empty name.\n * _prefixSecurity_ - string - default `silent` - set to `'unsafe-disabled'`, `'silent'`, or `'strict'`. See [Cookie Prefixes] below.\n * _allowSpecialUseDomain_ - boolean - default `false` - accepts special-use domain suffixes, such as `local`. Useful for testing purposes.\n This is not in the standard, but is used sometimes on the web and is accepted by (most) browsers.\n\nSince eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.\n\n### `.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))`\n\nAttempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.creation`, `.lastAccessed` and `.hostOnly` properties.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. `Store` errors aren't ignored by this option.\n * _sameSiteContext_ - string - default unset - set to `'none'`, `'lax'`, or `'strict'` See [SameSite Cookies] below.\n\nAs per the RFC, the `.hostOnly` property is set if there was no \"Domain=\" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).\n\n### `.setCookieSync(cookieOrString, currentUrl, [{options}])`\n\nSynchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getCookies(currentUrl, [{options},] cb(err,cookies))`\n\nRetrieve the list of cookies that can be sent in a Cookie header for the current url.\n\nIf an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).\n * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the underlying store (the default `MemoryCookieStore` supports it).\n * _sameSiteContext_ - string - default unset - Set this to `'none'`, `'lax'` or `'strict'` to enforce SameSite cookies upon retrival. See [SameSite Cookies] below.\n\nThe `.lastAccessed` property of the returned cookies will have been updated.\n\n### `.getCookiesSync(currentUrl, [{options}])`\n\nSynchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getCookieString(...)`\n\nAccepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.\n\n### `.getCookieStringSync(...)`\n\nSynchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getSetCookieStrings(...)`\n\nReturns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`.\n\n### `.getSetCookieStringsSync(...)`\n\nSynchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.serialize(cb(err,serializedObject))`\n\nSerialize the Jar if the underlying store supports `.getAllCookies`.\n\n**NOTE**: Custom `Cookie` properties will be discarded. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.\n\nSee [Serialization Format].\n\n### `.serializeSync()`\n\nSync version of .serialize\n\n### `.toJSON()`\n\nAlias of .serializeSync() for the convenience of `JSON.stringify(cookiejar)`.\n\n### `CookieJar.deserialize(serialized, [store], cb(err,object))`\n\nA new Jar is created and the serialized Cookies are added to the underlying store. Each `Cookie` is added via `store.putCookie` in the order in which they appear in the serialization.\n\nThe `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created.\n\nAs a convenience, if `serialized` is a string, it is passed through `JSON.parse` first. If that throws an error, this is passed to the callback.\n\n### `CookieJar.deserializeSync(serialized, [store])`\n\nSync version of `.deserialize`. _Note_ that the `store` must be synchronous for this to work.\n\n### `CookieJar.fromJSON(string)`\n\nAlias of `.deserializeSync` to provide consistency with `Cookie.fromJSON()`.\n\n### `.clone([store,]cb(err,newJar))`\n\nProduces a deep clone of this jar. Modifications to the original won't affect the clone, and vice versa.\n\nThe `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created. Transferring between store types is supported so long as the source implements `.getAllCookies()` and the destination implements `.putCookie()`.\n\n### `.cloneSync([store])`\n\nSynchronous version of `.clone`, returning a new `CookieJar` instance.\n\nThe `store` argument is optional, but must be a _synchronous_ `Store` instance if specified. If not passed, a new instance of `MemoryCookieStore` is used.\n\nThe _source_ and _destination_ must both be synchronous `Store`s. If one or both stores are asynchronous, use `.clone` instead. Recall that `MemoryCookieStore` supports both synchronous and asynchronous API calls.\n\n### `.removeAllCookies(cb(err))`\n\nRemoves all cookies from the jar.\n\nThis is a new backwards-compatible feature of `tough-cookie` version 2.5, so not all Stores will implement it efficiently. For Stores that do not implement `removeAllCookies`, the fallback is to call `removeCookie` after `getAllCookies`. If `getAllCookies` fails or isn't implemented in the Store, that error is returned. If one or more of the `removeCookie` calls fail, only the first error is returned.\n\n### `.removeAllCookiesSync()`\n\nSync version of `.removeAllCookies()`\n\n## Store\n\nBase class for CookieJar stores. Available as `tough.Store`.\n\n## Store API\n\nThe storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.\n\nStores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`.\n\nStores are asynchronous by default, but if `store.synchronous` is set to `true`, then the `*Sync` methods on the of the containing `CookieJar` can be used (however, the continuation-passing style\n\nAll `domain` parameters will have been normalized before calling.\n\nThe Cookie store must have all of the following methods.\n\n### `store.findCookie(domain, path, key, cb(err,cookie))`\n\nRetrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.\n\nCallback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).\n\n### `store.findCookies(domain, path, cb(err,cookies))`\n\nLocates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.\n\nIf no cookies are found, the callback MUST be passed an empty array.\n\nThe resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.\n\nAs of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).\n\n### `store.putCookie(cookie, cb(err))`\n\nAdds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.\n\nThe `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.\n\nPass an error if the cookie cannot be stored.\n\n### `store.updateCookie(oldCookie, newCookie, cb(err))`\n\nUpdate an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.\n\nThe `.lastAccessed` property will always be different between the two objects (to the precision possible via JavaScript's clock). Both `.creation` and `.creationIndex` are guaranteed to be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are selected for automatic deletion (e.g., least-recently-used, which is up to the store to implement).\n\nStores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.\n\nThe `newCookie` and `oldCookie` objects MUST NOT be modified.\n\nPass an error if the newCookie cannot be stored.\n\n### `store.removeCookie(domain, path, key, cb(err))`\n\nRemove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).\n\nThe implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.\n\n### `store.removeCookies(domain, path, cb(err))`\n\nRemoves matching cookies from the store. The `path` parameter is optional, and if missing means all paths in a domain should be removed.\n\nPass an error ONLY if removing any existing cookies failed.\n\n### `store.removeAllCookies(cb(err))`\n\n_Optional_. Removes all cookies from the store.\n\nPass an error if one or more cookies can't be removed.\n\n**Note**: New method as of `tough-cookie` version 2.5, so not all Stores will implement this, plus some stores may choose not to implement this.\n\n### `store.getAllCookies(cb(err, cookies))`\n\n_Optional_. Produces an `Array` of all cookies during `jar.serialize()`. The items in the array can be true `Cookie` objects or generic `Object`s with the [Serialization Format] data structure.\n\nCookies SHOULD be returned in creation order to preserve sorting via `compareCookies()`. For reference, `MemoryCookieStore` will sort by `.creationIndex` since it uses true `Cookie` objects internally. If you don't return the cookies in creation order, they'll still be sorted by creation time, but this only has a precision of 1ms. See `compareCookies` for more detail.\n\nPass an error if retrieval fails.\n\n**Note**: not all Stores can implement this due to technical limitations, so it is optional.\n\n## MemoryCookieStore\n\nInherits from `Store`.\n\nA just-in-memory CookieJar synchronous store implementation, used by default. Despite being a synchronous implementation, it's usable with both the synchronous and asynchronous forms of the `CookieJar` API. Supports serialization, `getAllCookies`, and `removeAllCookies`.\n\n## Community Cookie Stores\n\nThese are some Store implementations authored and maintained by the community. They aren't official and we don't vouch for them but you may be interested to have a look:\n\n- [`db-cookie-store`](https://github.com/JSBizon/db-cookie-store): SQL including SQLite-based databases\n- [`file-cookie-store`](https://github.com/JSBizon/file-cookie-store): Netscape cookie file format on disk\n- [`redis-cookie-store`](https://github.com/benkroeger/redis-cookie-store): Redis\n- [`tough-cookie-filestore`](https://github.com/mitsuru/tough-cookie-filestore): JSON on disk\n- [`tough-cookie-web-storage-store`](https://github.com/exponentjs/tough-cookie-web-storage-store): DOM localStorage and sessionStorage\n\n\n# Serialization Format\n\n**NOTE**: if you want to have custom `Cookie` properties serialized, add the property name to `Cookie.serializableProperties`.\n\n```js\n {\n // The version of tough-cookie that serialized this jar.\n version: 'tough-cookie@1.x.y',\n\n // add the store type, to make humans happy:\n storeType: 'MemoryCookieStore',\n\n // CookieJar configuration:\n rejectPublicSuffixes: true,\n // ... future items go here\n\n // Gets filled from jar.store.getAllCookies():\n cookies: [\n {\n key: 'string',\n value: 'string',\n // ...\n /* other Cookie.serializableProperties go here */\n }\n ]\n }\n```\n\n# RFC6265bis\n\nSupport for RFC6265bis revision 02 is being developed. Since this is a bit of an omnibus revision to the RFC6252, support is broken up into the functional areas.\n\n## Leave Secure Cookies Alone\n\nNot yet supported.\n\nThis change makes it so that if a cookie is sent from the server to the client with a `Secure` attribute, the channel must also be secure or the cookie is ignored.\n\n## SameSite Cookies\n\nSupported.\n\nThis change makes it possible for servers, and supporting clients, to mitigate certain types of CSRF attacks by disallowing `SameSite` cookies from being sent cross-origin.\n\nOn the Cookie object itself, you can get/set the `.sameSite` attribute, which will be serialized into the `SameSite=` cookie attribute. When unset or `undefined`, no `SameSite=` attribute will be serialized. The valid values of this attribute are `'none'`, `'lax'`, or `'strict'`. Other values will be serialized as-is.\n\nWhen parsing cookies with a `SameSite` cookie attribute, values other than `'lax'` or `'strict'` are parsed as `'none'`. For example, `SomeCookie=SomeValue; SameSite=garbage` will parse so that `cookie.sameSite === 'none'`.\n\nIn order to support SameSite cookies, you must provide a `sameSiteContext` option to _both_ `setCookie` and `getCookies`. Valid values for this option are just like for the Cookie object, but have particular meanings:\n1. `'strict'` mode - If the request is on the same \"site for cookies\" (see the RFC draft for what this means), pass this option to add a layer of defense against CSRF.\n2. `'lax'` mode - If the request is from another site, _but_ is directly because of navigation by the user, e.g., `` or ``, pass `sameSiteContext: 'lax'`.\n3. `'none'` - Otherwise, pass `sameSiteContext: 'none'` (this indicates a cross-origin request).\n4. unset/`undefined` - SameSite **will not** be enforced! This can be a valid use-case for when CSRF isn't in the threat model of the system being built.\n\nIt is highly recommended that you read RFC 6265bis for fine details on SameSite cookies. In particular [Section 8.8](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-8.8) discusses security considerations and defense in depth.\n\n## Cookie Prefixes\n\nSupported.\n\nCookie prefixes are a way to indicate that a given cookie was set with a set of attributes simply by inspecting the first few characters of the cookie's name.\n\nCookie prefixes are defined in [Section 4.1.3 of 6265bis](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.3). Two prefixes are defined:\n\n1. `\"__Secure-\" Prefix`: If a cookie's name begins with a case-sensitive match for the string \"__Secure-\", then the cookie will have been set with a \"Secure\" attribute.\n2. `\"__Host-\" Prefix`: If a cookie's name begins with a case-sensitive match for the string \"__Host-\", then the cookie will have been set with a \"Secure\" attribute, a \"Path\" attribute with a value of \"/\", and no \"Domain\" attribute.\n\nIf `prefixSecurity` is enabled for `CookieJar`, then cookies that match the prefixes defined above but do not obey the attribute restrictions will not be added.\n\nYou can define this functionality by passing in `prefixSecurity` option to `CookieJar`. It can be one of 3 values:\n\n1. `silent`: Enable cookie prefix checking but silently fail to add the cookie if conditions not met. Default.\n2. `strict`: Enable cookie prefix checking and error out if conditions not met.\n3. `unsafe-disabled`: Disable cookie prefix checking.\n\nNote that if `ignoreError` is passed in as `true` then the error will be silent regardless of `prefixSecurity` option (assuming it's enabled).\n\n\n# Copyright and License\n\nBSD-3-Clause:\n\n```text\n Copyright (c) 2015, Salesforce.com, Inc.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n 3. Neither the name of Salesforce.com nor the names of its contributors may\n be used to endorse or promote products derived from this software without\n specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n```\n", + "readme": "[RFC6265](https://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js\n\n[![npm package](https://nodei.co/npm/tough-cookie.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/tough-cookie/)\n\n[![Build Status](https://travis-ci.org/salesforce/tough-cookie.svg?branch=master)](https://travis-ci.org/salesforce/tough-cookie)\n\n# Synopsis\n\n``` javascript\nvar tough = require('tough-cookie');\nvar Cookie = tough.Cookie;\nvar cookie = Cookie.parse(header);\ncookie.value = 'somethingdifferent';\nheader = cookie.toString();\n\nvar cookiejar = new tough.CookieJar();\ncookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);\n// ...\ncookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {\n res.headers['cookie'] = cookies.join('; ');\n});\n```\n\n# Installation\n\nIt's _so_ easy!\n\n`npm install tough-cookie`\n\nWhy the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.\n\n## Version Support\n\nSupport for versions of node.js will follow that of the [request](https://www.npmjs.com/package/request) module.\n\n# API\n\n## tough\n\nFunctions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be \"bound\".\n\n**Note**: prior to 1.0.x, several of these functions took a `strict` parameter. This has since been removed from the API as it was no longer necessary.\n\n### `parseDate(string)`\n\nParse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`.\n\n### `formatDate(date)`\n\nFormat a Date into a RFC1123 string (the RFC6265-recommended format).\n\n### `canonicalDomain(str)`\n\nTransforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).\n\n### `domainMatch(str,domStr[,canonicalize=true])`\n\nAnswers \"does this real domain match the domain in a cookie?\". The `str` is the \"current\" domain-name and the `domStr` is the \"cookie\" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a \"suffix match\".\n\nThe `canonicalize` parameter will run the other two parameters through `canonicalDomain` or not.\n\n### `defaultPath(path)`\n\nGiven a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the \"directory\" of a \"file\" in the path, but is specified by Section 5.1.4 of the RFC.\n\nThe `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.\n\n### `pathMatch(reqPath,cookiePath)`\n\nAnswers \"does the request-path path-match a given cookie-path?\" as per RFC6265 Section 5.1.4. Returns a boolean.\n\nThis is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.\n\n### `parse(cookieString[, options])`\n\nalias for `Cookie.parse(cookieString[, options])`\n\n### `fromJSON(string)`\n\nalias for `Cookie.fromJSON(string)`\n\n### `getPublicSuffix(hostname)`\n\nReturns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.\n\nFor example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.\n\nFor further information, see http://publicsuffix.org/. This module derives its list from that site. This call is currently a wrapper around [`psl`](https://www.npmjs.com/package/psl)'s [get() method](https://www.npmjs.com/package/psl#pslgetdomain).\n\n### `cookieCompare(a,b)`\n\nFor use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). The sort algorithm is, in order of precedence:\n\n* Longest `.path`\n* oldest `.creation` (which has a 1ms precision, same as `Date`)\n* lowest `.creationIndex` (to get beyond the 1ms precision)\n\n``` javascript\nvar cookies = [ /* unsorted array of Cookie objects */ ];\ncookies = cookies.sort(cookieCompare);\n```\n\n**Note**: Since JavaScript's `Date` is limited to a 1ms precision, cookies within the same milisecond are entirely possible. This is especially true when using the `now` option to `.setCookie()`. The `.creationIndex` property is a per-process global counter, assigned during construction with `new Cookie()`. This preserves the spirit of the RFC sorting: older cookies go first. This works great for `MemoryCookieStore`, since `Set-Cookie` headers are parsed in order, but may not be so great for distributed systems. Sophisticated `Store`s may wish to set this to some other _logical clock_ such that if cookies A and B are created in the same millisecond, but cookie A is created before cookie B, then `A.creationIndex < B.creationIndex`. If you want to alter the global counter, which you probably _shouldn't_ do, it's stored in `Cookie.cookiesCreated`.\n\n### `permuteDomain(domain)`\n\nGenerates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.\n\n### `permutePath(path)`\n\nGenerates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.\n\n\n## Cookie\n\nExported via `tough.Cookie`.\n\n### `Cookie.parse(cookieString[, options])`\n\nParses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed.\n\nThe options parameter is not required and currently has only one property:\n\n * _loose_ - boolean - if `true` enable parsing of key-less cookies like `=abc` and `=`, which are not RFC-compliant.\n\nIf options is not an object, it is ignored, which means you can use `Array#map` with it.\n\nHere's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:\n\n``` javascript\nif (res.headers['set-cookie'] instanceof Array)\n cookies = res.headers['set-cookie'].map(Cookie.parse);\nelse\n cookies = [Cookie.parse(res.headers['set-cookie'])];\n```\n\n_Note:_ in version 2.3.3, tough-cookie limited the number of spaces before the `=` to 256 characters. This limitation has since been removed.\nSee [Issue 92](https://github.com/salesforce/tough-cookie/issues/92)\n\n### Properties\n\nCookie object properties:\n\n * _key_ - string - the name or key of the cookie (default \"\")\n * _value_ - string - the value of the cookie (default \"\")\n * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `\"Infinity\"`). See `setExpires()`\n * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `\"Infinity\"` and `\"-Infinity\"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`\n * _domain_ - string - the `Domain=` attribute of the cookie\n * _path_ - string - the `Path=` of the cookie\n * _secure_ - boolean - the `Secure` cookie flag\n * _httpOnly_ - boolean - the `HttpOnly` cookie flag\n * _sameSite_ - string - the `SameSite` cookie attribute (from [RFC6265bis]); must be one of `none`, `lax`, or `strict`\n * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)\n * _creation_ - `Date` - when this cookie was constructed\n * _creationIndex_ - number - set at construction, used to provide greater sort precision (please see `cookieCompare(a,b)` for a full explanation)\n\nAfter a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:\n\n * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)\n * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.\n * _creation_ - `Date` - **modified** from construction to when the cookie was added to the jar\n * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.\n\n### `Cookie([{properties}])`\n\nReceives an options object that can contain any of the above Cookie properties, uses the default for unspecified properties.\n\n### `.toString()`\n\nencode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.\n\n### `.cookieString()`\n\nencode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').\n\n### `.setExpires(String)`\n\nsets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `\"Infinity\"` (a string) is set.\n\n### `.setMaxAge(number)`\n\nsets the maxAge in seconds. Coerces `-Infinity` to `\"-Infinity\"` and `Infinity` to `\"Infinity\"` so it JSON serializes correctly.\n\n### `.expiryTime([now=Date.now()])`\n\n### `.expiryDate([now=Date.now()])`\n\nexpiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.\n\nMax-Age takes precedence over Expires (as per the RFC). The `.creation` attribute -- or, by default, the `now` parameter -- is used to offset the `.maxAge` attribute.\n\nIf Expires (`.expires`) is set, that's returned.\n\nOtherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for \"Tue, 19 Jan 2038 03:14:07 GMT\" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).\n\n### `.TTL([now=Date.now()])`\n\ncompute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.\n\nThe \"number\" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.\n\n### `.canonicalizedDomain()`\n\n### `.cdomain()`\n\nreturn the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.\n\n### `.toJSON()`\n\nFor convenience in using `JSON.serialize(cookie)`. Returns a plain-old `Object` that can be JSON-serialized.\n\nAny `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are exported in ISO format (`.toISOString()`).\n\n**NOTE**: Custom `Cookie` properties will be discarded. In tough-cookie 1.x, since there was no `.toJSON` method explicitly defined, all enumerable properties were captured. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.\n\n### `Cookie.fromJSON(strOrObj)`\n\nDoes the reverse of `cookie.toJSON()`. If passed a string, will `JSON.parse()` that first.\n\nAny `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are parsed via `Date.parse()`, not the tough-cookie `parseDate`, since it's JavaScript/JSON-y timestamps being handled at this layer.\n\nReturns `null` upon JSON parsing error.\n\n### `.clone()`\n\nDoes a deep clone of this cookie, exactly implemented as `Cookie.fromJSON(cookie.toJSON())`.\n\n### `.validate()`\n\nStatus: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.\n\nvalidates cookie attributes for semantic correctness. Useful for \"lint\" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:\n\n``` javascript\nif (cookie.validate() === true) {\n // it's tasty\n} else {\n // yuck!\n}\n```\n\n\n## CookieJar\n\nExported via `tough.CookieJar`.\n\n### `CookieJar([store],[options])`\n\nSimply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _rejectPublicSuffixes_ - boolean - default `true` - reject cookies with domains like \"com\" and \"co.uk\"\n * _looseMode_ - boolean - default `false` - accept malformed cookies like `bar` and `=bar`, which have an implied empty name.\n * _prefixSecurity_ - string - default `silent` - set to `'unsafe-disabled'`, `'silent'`, or `'strict'`. See [Cookie Prefixes] below.\n * _allowSpecialUseDomain_ - boolean - default `false` - accepts special-use domain suffixes, such as `local`. Useful for testing purposes.\n This is not in the standard, but is used sometimes on the web and is accepted by (most) browsers.\n\nSince eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.\n\n### `.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))`\n\nAttempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.creation`, `.lastAccessed` and `.hostOnly` properties.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. `Store` errors aren't ignored by this option.\n * _sameSiteContext_ - string - default unset - set to `'none'`, `'lax'`, or `'strict'` See [SameSite Cookies] below.\n\nAs per the RFC, the `.hostOnly` property is set if there was no \"Domain=\" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).\n\n### `.setCookieSync(cookieOrString, currentUrl, [{options}])`\n\nSynchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getCookies(currentUrl, [{options},] cb(err,cookies))`\n\nRetrieve the list of cookies that can be sent in a Cookie header for the current url.\n\nIf an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).\n * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the underlying store (the default `MemoryCookieStore` supports it).\n * _sameSiteContext_ - string - default unset - Set this to `'none'`, `'lax'` or `'strict'` to enforce SameSite cookies upon retrival. See [SameSite Cookies] below.\n\nThe `.lastAccessed` property of the returned cookies will have been updated.\n\n### `.getCookiesSync(currentUrl, [{options}])`\n\nSynchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getCookieString(...)`\n\nAccepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.\n\n### `.getCookieStringSync(...)`\n\nSynchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.getSetCookieStrings(...)`\n\nReturns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`.\n\n### `.getSetCookieStringsSync(...)`\n\nSynchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n### `.serialize(cb(err,serializedObject))`\n\nSerialize the Jar if the underlying store supports `.getAllCookies`.\n\n**NOTE**: Custom `Cookie` properties will be discarded. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.\n\nSee [Serialization Format].\n\n### `.serializeSync()`\n\nSync version of .serialize\n\n### `.toJSON()`\n\nAlias of .serializeSync() for the convenience of `JSON.stringify(cookiejar)`.\n\n### `CookieJar.deserialize(serialized, [store], cb(err,object))`\n\nA new Jar is created and the serialized Cookies are added to the underlying store. Each `Cookie` is added via `store.putCookie` in the order in which they appear in the serialization.\n\nThe `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created.\n\nAs a convenience, if `serialized` is a string, it is passed through `JSON.parse` first. If that throws an error, this is passed to the callback.\n\n### `CookieJar.deserializeSync(serialized, [store])`\n\nSync version of `.deserialize`. _Note_ that the `store` must be synchronous for this to work.\n\n### `CookieJar.fromJSON(string)`\n\nAlias of `.deserializeSync` to provide consistency with `Cookie.fromJSON()`.\n\n### `.clone([store,]cb(err,newJar))`\n\nProduces a deep clone of this jar. Modifications to the original won't affect the clone, and vice versa.\n\nThe `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created. Transferring between store types is supported so long as the source implements `.getAllCookies()` and the destination implements `.putCookie()`.\n\n### `.cloneSync([store])`\n\nSynchronous version of `.clone`, returning a new `CookieJar` instance.\n\nThe `store` argument is optional, but must be a _synchronous_ `Store` instance if specified. If not passed, a new instance of `MemoryCookieStore` is used.\n\nThe _source_ and _destination_ must both be synchronous `Store`s. If one or both stores are asynchronous, use `.clone` instead. Recall that `MemoryCookieStore` supports both synchronous and asynchronous API calls.\n\n### `.removeAllCookies(cb(err))`\n\nRemoves all cookies from the jar.\n\nThis is a new backwards-compatible feature of `tough-cookie` version 2.5, so not all Stores will implement it efficiently. For Stores that do not implement `removeAllCookies`, the fallback is to call `removeCookie` after `getAllCookies`. If `getAllCookies` fails or isn't implemented in the Store, that error is returned. If one or more of the `removeCookie` calls fail, only the first error is returned.\n\n### `.removeAllCookiesSync()`\n\nSync version of `.removeAllCookies()`\n\n## Store\n\nBase class for CookieJar stores. Available as `tough.Store`.\n\n## Store API\n\nThe storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.\n\nStores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`.\n\nStores are asynchronous by default, but if `store.synchronous` is set to `true`, then the `*Sync` methods on the of the containing `CookieJar` can be used (however, the continuation-passing style\n\nAll `domain` parameters will have been normalized before calling.\n\nThe Cookie store must have all of the following methods.\n\n### `store.findCookie(domain, path, key, cb(err,cookie))`\n\nRetrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.\n\nCallback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).\n\n### `store.findCookies(domain, path, cb(err,cookies))`\n\nLocates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.\n\nIf no cookies are found, the callback MUST be passed an empty array.\n\nThe resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.\n\nAs of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).\n\n### `store.putCookie(cookie, cb(err))`\n\nAdds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.\n\nThe `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.\n\nPass an error if the cookie cannot be stored.\n\n### `store.updateCookie(oldCookie, newCookie, cb(err))`\n\nUpdate an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.\n\nThe `.lastAccessed` property will always be different between the two objects (to the precision possible via JavaScript's clock). Both `.creation` and `.creationIndex` are guaranteed to be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are selected for automatic deletion (e.g., least-recently-used, which is up to the store to implement).\n\nStores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.\n\nThe `newCookie` and `oldCookie` objects MUST NOT be modified.\n\nPass an error if the newCookie cannot be stored.\n\n### `store.removeCookie(domain, path, key, cb(err))`\n\nRemove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).\n\nThe implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.\n\n### `store.removeCookies(domain, path, cb(err))`\n\nRemoves matching cookies from the store. The `path` parameter is optional, and if missing means all paths in a domain should be removed.\n\nPass an error ONLY if removing any existing cookies failed.\n\n### `store.removeAllCookies(cb(err))`\n\n_Optional_. Removes all cookies from the store.\n\nPass an error if one or more cookies can't be removed.\n\n**Note**: New method as of `tough-cookie` version 2.5, so not all Stores will implement this, plus some stores may choose not to implement this.\n\n### `store.getAllCookies(cb(err, cookies))`\n\n_Optional_. Produces an `Array` of all cookies during `jar.serialize()`. The items in the array can be true `Cookie` objects or generic `Object`s with the [Serialization Format] data structure.\n\nCookies SHOULD be returned in creation order to preserve sorting via `compareCookies()`. For reference, `MemoryCookieStore` will sort by `.creationIndex` since it uses true `Cookie` objects internally. If you don't return the cookies in creation order, they'll still be sorted by creation time, but this only has a precision of 1ms. See `compareCookies` for more detail.\n\nPass an error if retrieval fails.\n\n**Note**: not all Stores can implement this due to technical limitations, so it is optional.\n\n## MemoryCookieStore\n\nInherits from `Store`.\n\nA just-in-memory CookieJar synchronous store implementation, used by default. Despite being a synchronous implementation, it's usable with both the synchronous and asynchronous forms of the `CookieJar` API. Supports serialization, `getAllCookies`, and `removeAllCookies`.\n\n## Community Cookie Stores\n\nThese are some Store implementations authored and maintained by the community. They aren't official and we don't vouch for them but you may be interested to have a look:\n\n- [`db-cookie-store`](https://github.com/JSBizon/db-cookie-store): SQL including SQLite-based databases\n- [`file-cookie-store`](https://github.com/JSBizon/file-cookie-store): Netscape cookie file format on disk\n- [`redis-cookie-store`](https://github.com/benkroeger/redis-cookie-store): Redis\n- [`tough-cookie-filestore`](https://github.com/mitsuru/tough-cookie-filestore): JSON on disk\n- [`tough-cookie-web-storage-store`](https://github.com/exponentjs/tough-cookie-web-storage-store): DOM localStorage and sessionStorage\n\n\n# Serialization Format\n\n**NOTE**: if you want to have custom `Cookie` properties serialized, add the property name to `Cookie.serializableProperties`.\n\n```js\n {\n // The version of tough-cookie that serialized this jar.\n version: 'tough-cookie@1.x.y',\n\n // add the store type, to make humans happy:\n storeType: 'MemoryCookieStore',\n\n // CookieJar configuration:\n rejectPublicSuffixes: true,\n // ... future items go here\n\n // Gets filled from jar.store.getAllCookies():\n cookies: [\n {\n key: 'string',\n value: 'string',\n // ...\n /* other Cookie.serializableProperties go here */\n }\n ]\n }\n```\n\n# RFC6265bis\n\nSupport for RFC6265bis revision 02 is being developed. Since this is a bit of an omnibus revision to the RFC6252, support is broken up into the functional areas.\n\n## Leave Secure Cookies Alone\n\nNot yet supported.\n\nThis change makes it so that if a cookie is sent from the server to the client with a `Secure` attribute, the channel must also be secure or the cookie is ignored.\n\n## SameSite Cookies\n\nSupported.\n\nThis change makes it possible for servers, and supporting clients, to mitigate certain types of CSRF attacks by disallowing `SameSite` cookies from being sent cross-origin.\n\nOn the Cookie object itself, you can get/set the `.sameSite` attribute, which will be serialized into the `SameSite=` cookie attribute. When unset or `undefined`, no `SameSite=` attribute will be serialized. The valid values of this attribute are `'none'`, `'lax'`, or `'strict'`. Other values will be serialized as-is.\n\nWhen parsing cookies with a `SameSite` cookie attribute, values other than `'lax'` or `'strict'` are parsed as `'none'`. For example, `SomeCookie=SomeValue; SameSite=garbage` will parse so that `cookie.sameSite === 'none'`.\n\nIn order to support SameSite cookies, you must provide a `sameSiteContext` option to _both_ `setCookie` and `getCookies`. Valid values for this option are just like for the Cookie object, but have particular meanings:\n1. `'strict'` mode - If the request is on the same \"site for cookies\" (see the RFC draft for what this means), pass this option to add a layer of defense against CSRF.\n2. `'lax'` mode - If the request is from another site, _but_ is directly because of navigation by the user, e.g., `` or ``, pass `sameSiteContext: 'lax'`.\n3. `'none'` - Otherwise, pass `sameSiteContext: 'none'` (this indicates a cross-origin request).\n4. unset/`undefined` - SameSite **will not** be enforced! This can be a valid use-case for when CSRF isn't in the threat model of the system being built.\n\nIt is highly recommended that you read RFC 6265bis for fine details on SameSite cookies. In particular [Section 8.8](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-8.8) discusses security considerations and defense in depth.\n\n## Cookie Prefixes\n\nSupported.\n\nCookie prefixes are a way to indicate that a given cookie was set with a set of attributes simply by inspecting the first few characters of the cookie's name.\n\nCookie prefixes are defined in [Section 4.1.3 of 6265bis](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.3). Two prefixes are defined:\n\n1. `\"__Secure-\" Prefix`: If a cookie's name begins with a case-sensitive match for the string \"__Secure-\", then the cookie will have been set with a \"Secure\" attribute.\n2. `\"__Host-\" Prefix`: If a cookie's name begins with a case-sensitive match for the string \"__Host-\", then the cookie will have been set with a \"Secure\" attribute, a \"Path\" attribute with a value of \"/\", and no \"Domain\" attribute.\n\nIf `prefixSecurity` is enabled for `CookieJar`, then cookies that match the prefixes defined above but do not obey the attribute restrictions will not be added.\n\nYou can define this functionality by passing in `prefixSecurity` option to `CookieJar`. It can be one of 3 values:\n\n1. `silent`: Enable cookie prefix checking but silently fail to add the cookie if conditions not met. Default.\n2. `strict`: Enable cookie prefix checking and error out if conditions not met.\n3. `unsafe-disabled`: Disable cookie prefix checking.\n\nNote that if `ignoreError` is passed in as `true` then the error will be silent regardless of `prefixSecurity` option (assuming it's enabled).\n\n\n# Copyright and License\n\nBSD-3-Clause:\n\n```text\n Copyright (c) 2015, Salesforce.com, Inc.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n 3. Neither the name of Salesforce.com nor the names of its contributors may\n be used to endorse or promote products derived from this software without\n specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n```\n", "homepage": "https://github.com/salesforce/tough-cookie", "keywords": [ "HTTP", diff --git a/workspaces/arborist/test/fixtures/reify-cases/tap-with-yarn-lock.js b/workspaces/arborist/test/fixtures/reify-cases/tap-with-yarn-lock.js index 6905f81906f9f..25f15a7aa6640 100644 --- a/workspaces/arborist/test/fixtures/reify-cases/tap-with-yarn-lock.js +++ b/workspaces/arborist/test/fixtures/reify-cases/tap-with-yarn-lock.js @@ -4992,7 +4992,7 @@ module.exports = t => { "package.json": JSON.stringify({ "name": "ms", "version": "2.0.0", - "description": "Tiny millisecond conversion utility", + "description": "Tiny milisecond conversion utility", "repository": "zeit/ms", "main": "./index", "files": [