diff options
author | Rebecca Turner <me@re-becca.org> | 2017-03-21 03:44:24 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-03-25 01:13:40 +0300 |
commit | 41789cffac9845603f4bdf3f5b03f412144a0e9f (patch) | |
tree | 3d5cba62636f59b5b433a6d3dfd0c11153a01ff2 | |
parent | 63468a65738547d730232196c094f19a8a383c99 (diff) |
npm-registry-client@8.1.0
-rw-r--r-- | node_modules/npm-registry-client/README.md | 15 | ||||
-rw-r--r-- | node_modules/npm-registry-client/lib/ping.js | 8 | ||||
-rw-r--r-- | node_modules/npm-registry-client/lib/request.js | 6 | ||||
-rw-r--r-- | node_modules/npm-registry-client/package.json | 72 | ||||
-rw-r--r-- | npm-shrinkwrap.json | 6 | ||||
-rw-r--r-- | package.json | 2 |
6 files changed, 49 insertions, 60 deletions
diff --git a/node_modules/npm-registry-client/README.md b/node_modules/npm-registry-client/README.md index 7e650f75f..e9ab77b0d 100644 --- a/node_modules/npm-registry-client/README.md +++ b/node_modules/npm-registry-client/README.md @@ -53,6 +53,19 @@ for authorization. These credentials always look the same: * `alwaysAuth` {Boolean} Whether calls to the target registry are always authed. +## Requests + +As of `npm-registry-client@8`, all requests are made with an `Accept` header +of `application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`. + +This enables filtered document responses to requests for package metadata. +You know that you got a filtered response if the mime type is set to +`application/vnd.npm.install-v1+json` and not `application/json`. + +This filtering substantially reduces the over all data size. For example +for `https://registry.npmjs.org/npm`, the compressed metadata goes from +410kB to 21kB. + ## API ### client.access(uri, params, cb) @@ -164,6 +177,8 @@ Remove a single `dist-tag` from the named package. the callback quickly, and update the cache the background. Optional (default: false). * `auth` {Credentials} Optional. + * `fullMetadata` {Boolean} If true, don't attempt to fetch filtered + ("corgi") registry metadata. (default: false) * `cb` {Function} Fetches data from the registry via a GET request, saving it in the cache folder diff --git a/node_modules/npm-registry-client/lib/ping.js b/node_modules/npm-registry-client/lib/ping.js index b90f99d11..5ab98c52d 100644 --- a/node_modules/npm-registry-client/lib/ping.js +++ b/node_modules/npm-registry-client/lib/ping.js @@ -11,11 +11,9 @@ function ping (uri, params, cb) { var auth = params.auth assert(auth && typeof auth === 'object', 'must pass auth to ping') - this.request(url.resolve(uri, '-/ping?write=true'), { auth: auth }, function (er, fullData) { - if (er) { - cb(er) - } else if (fullData) { - cb(null, fullData) + this.request(url.resolve(uri, '-/ping?write=true'), { auth: auth }, function (er, fullData, data, response) { + if (er || fullData) { + cb(er, fullData, data, response) } else { cb(new Error('No data received')) } diff --git a/node_modules/npm-registry-client/lib/request.js b/node_modules/npm-registry-client/lib/request.js index 0c5c991aa..e96c47ef0 100644 --- a/node_modules/npm-registry-client/lib/request.js +++ b/node_modules/npm-registry-client/lib/request.js @@ -111,13 +111,17 @@ function makeRequest (uri, params, cb_) { // metadata should be compressed headers['accept-encoding'] = 'gzip' + // metadata should be minified, if the registry supports it + var er = this.authify(params.authed, parsed, headers, params.auth) if (er) return cb_(er) + var useCorgi = params.fullMetadata == null ? false : !params.fullMetadata + var opts = this.initialize( parsed, params.method, - 'application/json', + useCorgi ? 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' : 'application/json', headers ) diff --git a/node_modules/npm-registry-client/package.json b/node_modules/npm-registry-client/package.json index 9cbb25306..d579ab8b1 100644 --- a/node_modules/npm-registry-client/package.json +++ b/node_modules/npm-registry-client/package.json @@ -2,53 +2,43 @@ "_args": [ [ { - "raw": "npm-registry-client@latest", + "raw": "npm-registry-client@8.1.0", "scope": null, "escapedName": "npm-registry-client", "name": "npm-registry-client", - "rawSpec": "latest", - "spec": "latest", - "type": "tag" + "rawSpec": "8.1.0", + "spec": "8.1.0", + "type": "version" }, - "/Users/zkat/Documents/code/npm" + "/Users/rebecca/code/npm" ] ], - "_from": "npm-registry-client@latest", - "_id": "npm-registry-client@7.4.6", - "_inCache": true, + "_from": "npm-registry-client@8.1.0", + "_hasShrinkwrap": false, + "_id": "npm-registry-client@8.1.0", "_location": "/npm-registry-client", - "_nodeVersion": "7.7.1", - "_npmOperationalInternal": { - "host": "packages-18-east.internal.npmjs.com", - "tmp": "tmp/npm-registry-client-7.4.6.tgz_1488932684661_0.5164784051012248" - }, - "_npmUser": { - "name": "zkat", - "email": "kat@sykosomatic.org" - }, - "_npmVersion": "4.1.2", "_phantomChildren": { "inherits": "2.0.3", - "readable-stream": "2.2.3" + "readable-stream": "2.2.6" }, "_requested": { - "raw": "npm-registry-client@latest", + "raw": "npm-registry-client@8.1.0", "scope": null, "escapedName": "npm-registry-client", "name": "npm-registry-client", - "rawSpec": "latest", - "spec": "latest", - "type": "tag" + "rawSpec": "8.1.0", + "spec": "8.1.0", + "type": "version" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-7.4.6.tgz", - "_shasum": "0aa7c55f18631b941b7b80a7aa501bfcb8b19717", + "_resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-8.1.0.tgz", + "_shasum": "ed7e5f58dfb98cb905f7b8adbf4858ce746db8d3", "_shrinkwrap": null, - "_spec": "npm-registry-client@latest", - "_where": "/Users/zkat/Documents/code/npm", + "_spec": "npm-registry-client@8.1.0", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -81,45 +71,27 @@ }, "directories": {}, "dist": { - "shasum": "0aa7c55f18631b941b7b80a7aa501bfcb8b19717", - "tarball": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-7.4.6.tgz" + "shasum": "ed7e5f58dfb98cb905f7b8adbf4858ce746db8d3", + "tarball": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-8.1.0.tgz" }, "files": [ "lib", "index.js" ], - "gitHead": "b6069f9a7f74c264f6647e4b43d41cf195c6ca8e", "homepage": "https://github.com/npm/npm-registry-client#readme", "license": "ISC", "main": "index.js", - "maintainers": [ - { - "name": "isaacs", - "email": "isaacs@npmjs.com" - }, - { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" - }, - { - "name": "iarna", - "email": "me@re-becca.org" - }, - { - "name": "zkat", - "email": "kat@sykosomatic.org" - } - ], "name": "npm-registry-client", "optionalDependencies": { "npmlog": "2 || ^3.1.0 || ^4.0.0" }, - "readme": "ERROR: No README data found!", + "readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(config)\nvar uri = \"https://registry.npmjs.org/npm\"\nvar params = {timeout: 1000}\n\nclient.get(uri, params, function (error, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Registry URLs\n\nThe registry calls take either a full URL pointing to a resource in the\nregistry, or a base URL for the registry as a whole (including the registry\npath – but be sure to terminate the path with `/`). `http` and `https` URLs are\nthe only ones supported.\n\n## Using the client\n\nEvery call to the client follows the same pattern:\n\n* `uri` {String} The *fully-qualified* URI of the registry API method being\n invoked.\n* `params` {Object} Per-request parameters.\n* `callback` {Function} Callback to be invoked when the call is complete.\n\n### Credentials\n\nMany requests to the registry can be authenticated, and require credentials\nfor authorization. These credentials always look the same:\n\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `alwaysAuth` {Boolean} Whether calls to the target registry are always\n authed.\n\n**or**\n\n* `token` {String}\n* `alwaysAuth` {Boolean} Whether calls to the target registry are always\n authed.\n\n## Requests\n\nAs of `npm-registry-client@8`, all requests are made with an `Accept` header\nof `application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`.\n\nThis enables filtered document responses to requests for package metadata.\nYou know that you got a filtered response if the mime type is set to\n`application/vnd.npm.install-v1+json` and not `application/json`.\n\nThis filtering substantially reduces the over all data size. For example\nfor `https://registry.npmjs.org/npm`, the compressed metadata goes from\n410kB to 21kB.\n\n## API\n\n### client.access(uri, params, cb)\n\n* `uri` {String} Registry URL for the package's access API endpoint.\n Looks like `/-/package/<package name>/access`.\n* `params` {Object} Object containing per-request properties.\n * `access` {String} New access level for the package. Can be either\n `public` or `restricted`. Registry will raise an error if trying\n to change the access level of an unscoped package.\n * `auth` {Credentials}\n\nSet the access level for scoped packages. For now, there are only two\naccess levels: \"public\" and \"restricted\".\n\n### client.adduser(uri, params, cb)\n\n* `uri` {String} Base registry URL.\n* `params` {Object} Object containing per-request properties.\n * `auth` {Credentials}\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nAdd a user account to the registry, or verify the credentials.\n\n### client.deprecate(uri, params, cb)\n\n* `uri` {String} Full registry URI for the deprecated package.\n* `params` {Object} Object containing per-request properties.\n * `version` {String} Semver version range.\n * `message` {String} The message to use as a deprecation warning.\n * `auth` {Credentials}\n* `cb` {Function}\n\nDeprecate a version of a package in the registry.\n\n### client.distTags.fetch(uri, params, cb)\n\n* `uri` {String} Base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `package` {String} Name of the package.\n * `auth` {Credentials}\n* `cb` {Function}\n\nFetch all of the `dist-tags` for the named package.\n\n### client.distTags.add(uri, params, cb)\n\n* `uri` {String} Base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `package` {String} Name of the package.\n * `distTag` {String} Name of the new `dist-tag`.\n * `version` {String} Exact version to be mapped to the `dist-tag`.\n * `auth` {Credentials}\n* `cb` {Function}\n\nAdd (or replace) a single dist-tag onto the named package.\n\n### client.distTags.set(uri, params, cb)\n\n* `uri` {String} Base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `package` {String} Name of the package.\n * `distTags` {Object} Object containing a map from tag names to package\n versions.\n * `auth` {Credentials}\n* `cb` {Function}\n\nSet all of the `dist-tags` for the named package at once, creating any\n`dist-tags` that do not already exist. Any `dist-tags` not included in the\n`distTags` map will be removed.\n\n### client.distTags.update(uri, params, cb)\n\n* `uri` {String} Base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `package` {String} Name of the package.\n * `distTags` {Object} Object containing a map from tag names to package\n versions.\n * `auth` {Credentials}\n* `cb` {Function}\n\nUpdate the values of multiple `dist-tags`, creating any `dist-tags` that do\nnot already exist. Any pre-existing `dist-tags` not included in the `distTags`\nmap will be left alone.\n\n### client.distTags.rm(uri, params, cb)\n\n* `uri` {String} Base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `package` {String} Name of the package.\n * `distTag` {String} Name of the new `dist-tag`.\n * `auth` {Credentials}\n* `cb` {Function}\n\nRemove a single `dist-tag` from the named package.\n\n### client.get(uri, params, cb)\n\n* `uri` {String} The complete registry URI to fetch\n* `params` {Object} Object containing per-request properties.\n * `timeout` {Number} Duration before the request times out. Optional\n (default: never).\n * `follow` {Boolean} Follow 302/301 responses. Optional (default: true).\n * `staleOk` {Boolean} If there's cached data available, then return that to\n the callback quickly, and update the cache the background. Optional\n (default: false).\n * `auth` {Credentials} Optional.\n * `fullMetadata` {Boolean} If true, don't attempt to fetch filtered\n (\"corgi\") registry metadata. (default: false)\n* `cb` {Function}\n\nFetches data from the registry via a GET request, saving it in the cache folder\nwith the ETag or the \"Last Modified\" timestamp.\n\n### client.publish(uri, params, cb)\n\n* `uri` {String} The registry URI for the package to publish.\n* `params` {Object} Object containing per-request properties.\n * `metadata` {Object} Package metadata.\n * `access` {String} Access for the package. Can be `public` or `restricted` (no default).\n * `body` {Stream} Stream of the package body / tarball.\n * `auth` {Credentials}\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder.\n\n### client.sendAnonymousCLIMetrics(uri, params, cb)\n\n- `uri` {String} Base URL for the registry.\n- `params` {Object} Object containing per-request properties.\n - `metricId` {String} A uuid unique to this dataset.\n - `metrics` {Object} The metrics to share with the registry, with the following properties:\n - `from` {Date} When the first data in this report was collected.\n - `to` {Date} When the last data in this report was collected. Usually right now.\n - `successfulInstalls` {Number} The number of successful installs in this period.\n - `failedInstalls` {Number} The number of installs that ended in error in this period.\n- `cb` {Function}\n\nPUT a metrics object to the `/-/npm/anon-metrics/v1/` endpoint on the registry.\n\n### client.star(uri, params, cb)\n\n* `uri` {String} The complete registry URI for the package to star.\n* `params` {Object} Object containing per-request properties.\n * `starred` {Boolean} True to star the package, false to unstar it. Optional\n (default: false).\n * `auth` {Credentials}\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or unstar a\npackage, though other writes do require that the user be the package owner.\n\n### client.stars(uri, params, cb)\n\n* `uri` {String} The base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `username` {String} Name of user to fetch starred packages for. Optional\n (default: user in `auth`).\n * `auth` {Credentials} Optional (required if `username` is omitted).\n* `cb` {Function}\n\nView your own or another user's starred packages.\n\n### client.tag(uri, params, cb)\n\n* `uri` {String} The complete registry URI to tag\n* `params` {Object} Object containing per-request properties.\n * `version` {String} Version to tag.\n * `tag` {String} Tag name to apply.\n * `auth` {Credentials}\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag` will fetch the\nspecified version.\n\n### client.unpublish(uri, params, cb)\n\n* `uri` {String} The complete registry URI of the package to unpublish.\n* `params` {Object} Object containing per-request properties.\n * `version` {String} version to unpublish. Optional – omit to unpublish all\n versions.\n * `auth` {Credentials}\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When the\nlast version us unpublished, the entire document is removed from the database.\n\n### client.whoami(uri, params, cb)\n\n* `uri` {String} The base registry for the URI.\n* `params` {Object} Object containing per-request properties.\n * `auth` {Credentials}\n* `cb` {Function}\n\nSimple call to see who the registry thinks you are. Especially useful with\ntoken-based auth.\n\n\n## PLUMBING\n\nThe below are primarily intended for use by the rest of the API, or by the npm\ncaching logic directly.\n\n### client.request(uri, params, cb)\n\n* `uri` {String} URI pointing to the resource to request.\n* `params` {Object} Object containing per-request properties.\n * `method` {String} HTTP method. Optional (default: \"GET\").\n * `body` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON. Optional – body\n only used for write operations.\n * `etag` {String} The cached ETag. Optional.\n * `lastModified` {String} The cached Last-Modified timestamp. Optional.\n * `follow` {Boolean} Follow 302/301 responses. Optional (default: true).\n * `streaming` {Boolean} Stream the request body as it comes, handling error\n responses in a non-streaming way.\n * `auth` {Credentials} Optional.\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a generic request to the registry. All the other methods are wrappers\naround `client.request`.\n\n### client.fetch(uri, params, cb)\n\n* `uri` {String} The complete registry URI to upload to\n* `params` {Object} Object containing per-request properties.\n * `headers` {Stream} HTTP headers to be included with the request. Optional.\n * `auth` {Credentials} Optional.\n* `cb` {Function}\n\nFetch a package from a URL, with auth set appropriately if included. Used to\ncache remote tarballs as well as request package tarballs from the registry.\n\n# Configuration\n\nThe client uses its own configuration, which is just passed in as a simple\nnested object. The following are the supported values (with their defaults, if\nany):\n\n* `proxy.http` {URL} The URL to proxy HTTP requests through.\n* `proxy.https` {URL} The URL to proxy HTTPS requests through. Defaults to be\n the same as `proxy.http` if unset.\n* `proxy.localAddress` {IP} The local address to use on multi-homed systems.\n* `ssl.ca` {String} Certificate signing authority certificates to trust.\n* `ssl.certificate` {String} Client certificate (PEM encoded). Enable access\n to servers that require client certificates.\n* `ssl.key` {String} Private key (PEM encoded) for client certificate.\n* `ssl.strict` {Boolean} Whether or not to be strict with SSL certificates.\n Default = `true`\n* `retry.count` {Number} Number of times to retry on GET failures. Default = 2.\n* `retry.factor` {Number} `factor` setting for `node-retry`. Default = 10.\n* `retry.minTimeout` {Number} `minTimeout` setting for `node-retry`.\n Default = 10000 (10 seconds)\n* `retry.maxTimeout` {Number} `maxTimeout` setting for `node-retry`.\n Default = 60000 (60 seconds)\n* `userAgent` {String} User agent header to send. Default =\n `\"node/{process.version}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n* `defaultTag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `couchToken` {Object} A token for use with\n [couch-login](https://npmjs.org/package/couch-login).\n* `sessionToken` {String} A random identifier for this set of client requests.\n Default = 8 random hexadecimal bytes.\n* `maxSockets` {Number} The maximum number of connections that will be open per\n origin (unique combination of protocol:host:port). Passed to the\n [httpAgent](https://nodejs.org/api/http.html#http_agent_maxsockets).\n Default = 50\n* `isFromCI` {Boolean} Identify to severs if this request is coming from CI (for statistics purposes).\n Default = detected from environment– primarily this is done by looking for\n the CI environment variable to be set to `true`. Also accepted are the\n existence of the `JENKINS_URL`, `bamboo.buildKey` and `TDDIUM` environment\n variables.\n* `scope` {String} The scope of the project this command is being run for. This is the\n top level npm module in which a command was run.\n Default = none\n", + "readmeFilename": "README.md", "repository": { "url": "git+https://github.com/npm/npm-registry-client.git" }, "scripts": { "test": "standard && tap test/*.js" }, - "version": "7.4.6" + "version": "8.1.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 915730970..d87eebc20 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -605,9 +605,9 @@ "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-4.2.1.tgz" }, "npm-registry-client": { - "version": "7.4.6", - "from": "npm-registry-client@latest", - "resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-7.4.6.tgz", + "version": "8.1.0", + "from": "npm-registry-client@8.1.0", + "resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-8.1.0.tgz", "dependencies": { "concat-stream": { "version": "1.6.0", diff --git a/package.json b/package.json index 5835260fc..08bdbaf9b 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "npm-cache-filename": "~1.0.2", "npm-install-checks": "~3.0.0", "npm-package-arg": "~4.2.1", - "npm-registry-client": "~7.4.6", + "npm-registry-client": "~8.1.0", "npm-user-validate": "~0.1.5", "npmlog": "~4.0.2", "once": "~1.4.0", |