Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2014-12-12 10:24:23 +0300
committerForrest L Norvell <forrest@npmjs.com>2014-12-12 10:24:23 +0300
commitf1c8bdb3f6b753d0600597e12346bdc3a34cb9c1 (patch)
tree88424d91a2f6d83ca0936e25eba0ec2d3d0a6320 /node_modules/npm-registry-client
parentcb6ff8dace1b439851701d4784d2d719c22ca7a7 (diff)
npm-registry-client@4.0.5
Some endpoints will return an object property named "error", which is not the same as the string property containing an error message.
Diffstat (limited to 'node_modules/npm-registry-client')
-rw-r--r--node_modules/npm-registry-client/lib/request.js4
-rw-r--r--node_modules/npm-registry-client/node_modules/concat-stream/package.json16
-rw-r--r--node_modules/npm-registry-client/node_modules/concat-stream/readme.md32
-rw-r--r--node_modules/npm-registry-client/package.json10
-rw-r--r--node_modules/npm-registry-client/test/request.js28
5 files changed, 66 insertions, 24 deletions
diff --git a/node_modules/npm-registry-client/lib/request.js b/node_modules/npm-registry-client/lib/request.js
index 7156c13d7..ec39cc25d 100644
--- a/node_modules/npm-registry-client/lib/request.js
+++ b/node_modules/npm-registry-client/lib/request.js
@@ -220,7 +220,9 @@ function requestDone (method, where, cb) {
parsed._etag = response.headers.etag
}
- if (parsed && parsed.error || response.statusCode >= 400) {
+ // for the search endpoint, the "error" property can be an object
+ if (parsed && parsed.error && typeof parsed.error !== "object" ||
+ response.statusCode >= 400) {
var w = url.parse(where).pathname.substr(1)
var name
if (!w.match(/^-/)) {
diff --git a/node_modules/npm-registry-client/node_modules/concat-stream/package.json b/node_modules/npm-registry-client/node_modules/concat-stream/package.json
index d0800ac33..0cdb8416d 100644
--- a/node_modules/npm-registry-client/node_modules/concat-stream/package.json
+++ b/node_modules/npm-registry-client/node_modules/concat-stream/package.json
@@ -1,6 +1,6 @@
{
"name": "concat-stream",
- "version": "1.4.6",
+ "version": "1.4.7",
"description": "writable stream that concatenates strings or binary data and calls a callback with the result",
"tags": [
"stream",
@@ -51,11 +51,13 @@
"android-browser/4.2..latest"
]
},
+ "gitHead": "41edc57536490dce9f015131c29a6470c9412b27",
"homepage": "https://github.com/maxogden/concat-stream",
- "_id": "concat-stream@1.4.6",
- "_shasum": "8cb736a556a32f020f1ddc82fa3448381c5e5cce",
+ "_id": "concat-stream@1.4.7",
+ "_shasum": "0ceaa47b87a581d2a7a782b92b81d5020c3f9925",
"_from": "concat-stream@>=1.4.6 <2.0.0",
- "_npmVersion": "1.4.10",
+ "_npmVersion": "2.1.8",
+ "_nodeVersion": "0.10.28",
"_npmUser": {
"name": "maxogden",
"email": "max@maxogden.com"
@@ -67,10 +69,10 @@
}
],
"dist": {
- "shasum": "8cb736a556a32f020f1ddc82fa3448381c5e5cce",
- "tarball": "http://registry.npmjs.org/concat-stream/-/concat-stream-1.4.6.tgz"
+ "shasum": "0ceaa47b87a581d2a7a782b92b81d5020c3f9925",
+ "tarball": "http://registry.npmjs.org/concat-stream/-/concat-stream-1.4.7.tgz"
},
"directories": {},
- "_resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.4.6.tgz",
+ "_resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.4.7.tgz",
"readme": "ERROR: No README data found!"
}
diff --git a/node_modules/npm-registry-client/node_modules/concat-stream/readme.md b/node_modules/npm-registry-client/node_modules/concat-stream/readme.md
index dfd441b5f..e6dda4e34 100644
--- a/node_modules/npm-registry-client/node_modules/concat-stream/readme.md
+++ b/node_modules/npm-registry-client/node_modules/concat-stream/readme.md
@@ -4,22 +4,30 @@ Writable stream that concatenates strings or binary data and calls a callback wi
[![NPM](https://nodei.co/npm/concat-stream.png)](https://nodei.co/npm/concat-stream/)
-[![browser support](https://ci.testling.com/maxogden/concat-stream.png)](https://ci.testling.com/maxogden/concat-stream)
-
### examples
#### Buffers
```js
-var concat = require('concat-stream')
var fs = require('fs')
-
-var read = fs.createReadStream('readme.md')
-var write = concat(function(data) {
- // data is all of readme.md as a Buffer
-})
-
-read.pipe(write)
+var concat = require('concat-stream')
+
+var readStream = fs.createReadStream('cat.png')
+var concatStream = concat(gotPicture)
+
+readStream.on('error', handleError)
+readStream.pipe(concatStream)
+
+function gotPicture(imageBuffer) {
+ // imageBuffer is all of `cat.png` as a node.js Buffer
+}
+
+function handleError(err) {
+ // handle your error appropriately here, e.g.:
+ console.error(err) // print the error to STDERR
+ process.exit(1) // exit program with non-zero exit code
+}
+
```
#### Arrays
@@ -67,6 +75,10 @@ By default `concat-stream` will give you back the same data type as the type of
If you don't specify an encoding, and the types can't be inferred (e.g. you write things that aren't int he list above), it will try to convert concat them into a `Buffer`.
+# error handling
+
+`concat-stream` does not handle errors for you, so you must handle errors on whatever streams you pipe into `concat-stream`. This is a general rule when programming with node.js streams: always handle errors on each and every stream. Since `concat-stream` is not itself a stream it does not emit errors.
+
# license
MIT LICENSE
diff --git a/node_modules/npm-registry-client/package.json b/node_modules/npm-registry-client/package.json
index 4b13d8711..e98b732f7 100644
--- a/node_modules/npm-registry-client/package.json
+++ b/node_modules/npm-registry-client/package.json
@@ -6,7 +6,7 @@
},
"name": "npm-registry-client",
"description": "Client for the npm registry",
- "version": "4.0.4",
+ "version": "4.0.5",
"repository": {
"url": "git://github.com/isaacs/npm-registry-client"
},
@@ -38,12 +38,12 @@
"license": "ISC",
"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 = \"npm://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 by 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## API\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.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* `cb` {Function}\n\nFetches data from the registry via a GET request, saving it in the cache folder\nwith the ETag.\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 * `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.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 * `follow` {Boolean} Follow 302/301 responses. Optional (default: true).\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} Cerficate 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",
"readmeFilename": "README.md",
- "gitHead": "3e10914ef704b8d043c5c410281868de1756fb0e",
+ "gitHead": "33bd08aa65bb26ba1b956d2f119b5e952f4d3141",
"bugs": {
"url": "https://github.com/isaacs/npm-registry-client/issues"
},
"homepage": "https://github.com/isaacs/npm-registry-client",
- "_id": "npm-registry-client@4.0.4",
- "_shasum": "6935cde6460a3bf1cb6019d7523196e0fb96fb62",
- "_from": "npm-registry-client@>=4.0.4 <4.1.0"
+ "_id": "npm-registry-client@4.0.5",
+ "_shasum": "27d37ca0c7bbd5df14f4ae35223a4d588dd4fea6",
+ "_from": "npm-registry-client@>=4.0.5 <4.1.0"
}
diff --git a/node_modules/npm-registry-client/test/request.js b/node_modules/npm-registry-client/test/request.js
index 72a066bad..799a626ea 100644
--- a/node_modules/npm-registry-client/test/request.js
+++ b/node_modules/npm-registry-client/test/request.js
@@ -81,7 +81,7 @@ test("request call contract", function (t) {
})
test("run request through its paces", function (t) {
- t.plan(22)
+ t.plan(24)
server.expect("/request-defaults", function (req, res) {
t.equal(req.method, "GET", "uses GET by default")
@@ -144,6 +144,20 @@ test("run request through its paces", function (t) {
}))
})
+ server.expect("GET", "/body-error-string", function (req, res) {
+ req.pipe(concat(function () {
+ res.statusCode = 200
+ res.json({ "error" : "not really an error", "reason" : "unknown" })
+ }))
+ })
+
+ server.expect("GET", "/body-error-object", function (req, res) {
+ req.pipe(concat(function () {
+ res.statusCode = 200
+ res.json({ "error" : {} })
+ }))
+ })
+
var defaults = {}
client.request(common.registry+"/request-defaults", defaults, function (er, data) {
t.ifError(er, "call worked")
@@ -204,4 +218,16 @@ test("run request through its paces", function (t) {
t.ifError(er, "call worked")
t.deepEquals(data, { put : "object" }, "PUT request with object sent")
})
+
+ client.request(common.registry+"/body-error-string", defaults, function (er) {
+ t.equal(
+ er && er.message,
+ "not really an error unknown: body-error-string",
+ "call worked"
+ )
+ })
+
+ client.request(common.registry+"/body-error-object", defaults, function (er) {
+ t.ifError(er, "call worked")
+ })
})