npm-registry-client
Advanced tools
Comparing version 5.0.0 to 5.1.0
35
index.js
@@ -49,9 +49,32 @@ // utilities for working with the js-registry site. | ||
delete this.config.log | ||
var client = this | ||
fs.readdirSync(join(__dirname, "lib")).forEach(function (f) { | ||
var entry = join(__dirname, "lib", f) | ||
// lib/group-name/operation.js -> client.groupName.operation | ||
var stat = fs.statSync(entry) | ||
if (stat.isDirectory()) { | ||
var groupName = f.replace(/-([a-z])/, dashToCamel) | ||
fs.readdirSync(entry).forEach(function (f) { | ||
if (!f.match(/\.js$/)) return | ||
if (!client[groupName]) { | ||
// keep client.groupName.operation from stomping client.operation | ||
client[groupName] = Object.create(client) | ||
} | ||
var name = f.replace(/\.js$/, "").replace(/-([a-z])/, dashToCamel) | ||
client[groupName][name] = require(join(entry, f)) | ||
}) | ||
return | ||
} | ||
if (!f.match(/\.js$/)) return | ||
var name = f.replace(/\.js$/, "").replace(/-([a-z])/, dashToCamel) | ||
client[name] = require(entry) | ||
}) | ||
} | ||
fs.readdirSync(join(__dirname, "lib")).forEach(function (f) { | ||
if (!f.match(/\.js$/)) return | ||
var name = f.replace(/\.js$/, "") | ||
.replace(/-([a-z])/, function (_, l) { return l.toUpperCase() }) | ||
RegClient.prototype[name] = require(join(__dirname, "lib", f)) | ||
}) | ||
function dashToCamel (_, l) { | ||
return l.toUpperCase() | ||
} |
@@ -12,3 +12,6 @@ module.exports = tag | ||
assert(typeof params.tag === "string", "must pass tag name to tag") | ||
assert(params.auth && typeof params.auth === "object", "must pass auth to tag") | ||
assert( | ||
params.auth && typeof params.auth === "object", | ||
"must pass auth to tag" | ||
) | ||
@@ -15,0 +18,0 @@ var options = { |
@@ -5,3 +5,3 @@ { | ||
"description": "Client for the npm registry", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"repository": { | ||
@@ -20,2 +20,3 @@ "url": "git://github.com/isaacs/npm-registry-client" | ||
"normalize-package-data": "~1.0.1", | ||
"npm-package-arg": "^3.0.0", | ||
"once": "^1.3.0", | ||
@@ -22,0 +23,0 @@ "request": "^2.47.0", |
@@ -58,2 +58,15 @@ # npm-registry-client | ||
### client.access(uri, params, cb) | ||
* `uri` {String} Registry URL for the package's access API endpoint. | ||
Looks like `/-/package/<package name>/access`. | ||
* `params` {Object} Object containing per-request properties. | ||
* `access` {String} New access level for the package. Can be either | ||
`public` or `restricted`. Registry will raise an error if trying | ||
to change the access level of an unscoped package. | ||
* `auth` {Credentials} | ||
Set the access level for scoped packages. For now, there are only two | ||
access levels: "public" and "restricted". | ||
### client.adduser(uri, params, cb) | ||
@@ -83,2 +96,63 @@ | ||
### client.distTags.fetch(uri, params, cb) | ||
* `uri` {String} Base URL for the registry. | ||
* `params` {Object} Object containing per-request properties. | ||
* `package` {String} Name of the package. | ||
* `auth` {Credentials} | ||
* `cb` {Function} | ||
Fetch all of the `dist-tags` for the named package. | ||
### client.distTags.add(uri, params, cb) | ||
* `uri` {String} Base URL for the registry. | ||
* `params` {Object} Object containing per-request properties. | ||
* `package` {String} Name of the package. | ||
* `distTag` {String} Name of the new `dist-tag`. | ||
* `version` {String} Exact version to be mapped to the `dist-tag`. | ||
* `auth` {Credentials} | ||
* `cb` {Function} | ||
Add (or replace) a single dist-tag onto the named package. | ||
### client.distTags.set(uri, params, cb) | ||
* `uri` {String} Base URL for the registry. | ||
* `params` {Object} Object containing per-request properties. | ||
* `package` {String} Name of the package. | ||
* `distTags` {Object} Object containing a map from tag names to package | ||
versions. | ||
* `auth` {Credentials} | ||
* `cb` {Function} | ||
Set all of the `dist-tags` for the named package at once, creating any | ||
`dist-tags` that do not already exit. Any `dist-tags` not included in the | ||
`distTags` map will be removed. | ||
### client.distTags.update(uri, params, cb) | ||
* `uri` {String} Base URL for the registry. | ||
* `params` {Object} Object containing per-request properties. | ||
* `package` {String} Name of the package. | ||
* `distTags` {Object} Object containing a map from tag names to package | ||
versions. | ||
* `auth` {Credentials} | ||
* `cb` {Function} | ||
Update the values of multiple `dist-tags`, creating any `dist-tags` that do | ||
not already exist. Any pre-existing `dist-tags` not included in the `distTags` | ||
map will be left alone. | ||
### client.distTags.rm(uri, params, cb) | ||
* `uri` {String} Base URL for the registry. | ||
* `params` {Object} Object containing per-request properties. | ||
* `package` {String} Name of the package. | ||
* `distTag` {String} Name of the new `dist-tag`. | ||
* `auth` {Credentials} | ||
* `cb` {Function} | ||
Remove a single `dist-tag` from the named package. | ||
### client.get(uri, params, cb) | ||
@@ -85,0 +159,0 @@ |
@@ -60,3 +60,3 @@ var test = require("tap").test | ||
{ name : "AssertionError", message : "must pass version to tag" }, | ||
"auth must include username" | ||
"tag must include version" | ||
) | ||
@@ -73,3 +73,3 @@ | ||
{ name : "AssertionError", message : "must pass tag name to tag" }, | ||
"auth must include username" | ||
"tag must include name" | ||
) | ||
@@ -86,3 +86,3 @@ | ||
{ name : "AssertionError", message : "must pass auth to tag" }, | ||
"auth must include username" | ||
"params must include auth" | ||
) | ||
@@ -89,0 +89,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
310224
70
4328
314
13
10
6
+ Addednpm-package-arg@^3.0.0
+ Addedhosted-git-info@1.6.0(transitive)
+ Addednpm-package-arg@3.1.1(transitive)