libnpmaccess
Advanced tools
Comparing version 1.2.2 to 2.0.0
@@ -5,2 +5,21 @@ # Change Log | ||
<a name="2.0.0"></a> | ||
# [2.0.0](https://github.com/npm/libnpmaccess/compare/v1.2.2...v2.0.0) (2018-08-21) | ||
### Bug Fixes | ||
* **json:** stop trying to parse response JSON ([20fdd84](https://github.com/npm/libnpmaccess/commit/20fdd84)) | ||
* **lsPackages:** team URL was wrong D: ([b52201c](https://github.com/npm/libnpmaccess/commit/b52201c)) | ||
### BREAKING CHANGES | ||
* **json:** use cases where registries were returning JSON | ||
strings in the response body will no longer have an effect. All | ||
API functions except for lsPackages and lsCollaborators will return | ||
`true` on completion. | ||
<a name="1.2.2"></a> | ||
@@ -7,0 +26,0 @@ ## [1.2.2](https://github.com/npm/libnpmaccess/compare/v1.2.1...v1.2.2) (2018-08-20) |
18
index.js
@@ -34,3 +34,3 @@ 'use strict' | ||
const uri = `/-/package/${eu(spec.name)}/access` | ||
return npmFetch.json(uri, opts.concat({ | ||
return npmFetch(uri, opts.concat({ | ||
method: 'POST', | ||
@@ -40,3 +40,3 @@ body: {access}, | ||
})).then(resolve, reject) | ||
}) | ||
}).then(res => res.body.resume() && true) | ||
} | ||
@@ -54,3 +54,3 @@ | ||
const uri = `/-/team/${eu(scope)}/${eu(team)}/package` | ||
return npmFetch.json(uri, opts.concat({ | ||
return npmFetch(uri, opts.concat({ | ||
method: 'PUT', | ||
@@ -61,3 +61,3 @@ body: {package: spec.name, permissions}, | ||
})).then(resolve, reject) | ||
}) | ||
}).then(res => res.body.resume() && true) | ||
} | ||
@@ -72,3 +72,3 @@ | ||
const uri = `/-/team/${eu(scope)}/${eu(team)}/package` | ||
return npmFetch.json(uri, opts.concat({ | ||
return npmFetch(uri, opts.concat({ | ||
method: 'DELETE', | ||
@@ -79,3 +79,3 @@ body: {package: spec.name}, | ||
})).then(resolve, reject) | ||
}) | ||
}).then(res => res.body.resume() && true) | ||
} | ||
@@ -111,3 +111,3 @@ | ||
if (team) { | ||
uri = `/-/org/${eu(scope)}/${eu(team)}/package` | ||
uri = `/-/team/${eu(scope)}/${eu(team)}/package` | ||
} else { | ||
@@ -187,3 +187,3 @@ uri = `/-/org/${eu(scope)}/package` | ||
const uri = `/-/package/${eu(spec.name)}/access` | ||
return npmFetch.json(uri, opts.concat({ | ||
return npmFetch(uri, opts.concat({ | ||
method: 'POST', | ||
@@ -193,3 +193,3 @@ body: {publish_requires_tfa: required}, | ||
})).then(resolve, reject) | ||
}) | ||
}).then(res => res.body.resume() && true) | ||
} | ||
@@ -196,0 +196,0 @@ |
{ | ||
"name": "libnpmaccess", | ||
"version": "1.2.2", | ||
"version": "2.0.0", | ||
"description": "programmatic library for `npm access` commands", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -18,7 +18,5 @@ 'use strict' | ||
'/-/package/%40foo%2Fbar/access', {access: 'public'} | ||
).reply( | ||
200, {accessChanged: true} | ||
) | ||
).reply(200) | ||
return access.public('@foo/bar', OPTS).then(ret => { | ||
t.deepEqual(ret, {accessChanged: true}, 'request succeeded') | ||
t.deepEqual(ret, true, 'request succeeded') | ||
}) | ||
@@ -30,7 +28,5 @@ }) | ||
'/-/package/%40foo%2Fbar/access', {access: 'restricted'} | ||
).reply( | ||
200, {accessChanged: true} | ||
) | ||
).reply(200) | ||
return access.restricted('@foo/bar', OPTS).then(ret => { | ||
t.deepEqual(ret, {accessChanged: true}, 'request succeeded') | ||
t.deepEqual(ret, true, 'request succeeded') | ||
}) | ||
@@ -44,3 +40,3 @@ }) | ||
return access.tfaRequired('@foo/bar', OPTS).then(ret => { | ||
t.deepEqual(ret, {ok: true}, 'request succeeded') | ||
t.deepEqual(ret, true, 'request succeeded') | ||
}) | ||
@@ -54,3 +50,3 @@ }) | ||
return access.tfaNotRequired('@foo/bar', OPTS).then(ret => { | ||
t.deepEqual(ret, {ok: true}, 'request succeeded') | ||
t.deepEqual(ret, true, 'request succeeded') | ||
}) | ||
@@ -63,7 +59,7 @@ }) | ||
permissions: 'read-write' | ||
}).reply(201, {accessChanged: true}) | ||
}).reply(201) | ||
return access.grant( | ||
'@foo/bar', 'myorg', 'myteam', 'read-write', OPTS | ||
).then(ret => { | ||
t.deepEqual(ret, {accessChanged: true}, 'request succeeded') | ||
t.deepEqual(ret, true, 'request succeeded') | ||
}) | ||
@@ -76,7 +72,7 @@ }) | ||
permissions: 'read-only' | ||
}).reply(201, {accessChanged: true}) | ||
}).reply(201) | ||
return access.grant( | ||
'@foo/bar', 'myorg', 'myteam', 'read-only', OPTS | ||
).then(ret => { | ||
t.deepEqual(ret, {accessChanged: true}, 'request succeeded') | ||
t.deepEqual(ret, true, 'request succeeded') | ||
}) | ||
@@ -103,7 +99,7 @@ }) | ||
permissions: 'read-write' | ||
}).reply(201, {accessChanged: true}) | ||
}).reply(201) | ||
return access.grant( | ||
'bar', 'myorg', 'myteam', 'read-write', OPTS | ||
).then(ret => { | ||
t.deepEqual(ret, {accessChanged: true}, 'request succeeded') | ||
t.deepEqual(ret, true, 'request succeeded') | ||
}) | ||
@@ -115,5 +111,5 @@ }) | ||
package: '@foo/bar' | ||
}).reply(200, {accessChanged: true}) | ||
}).reply(200) | ||
return access.revoke('@foo/bar', 'myorg', 'myteam', OPTS).then(ret => { | ||
t.deepEqual(ret, {accessChanged: true}, 'request succeeded') | ||
t.deepEqual(ret, true, 'request succeeded') | ||
}) | ||
@@ -127,3 +123,3 @@ }) | ||
return access.revoke('bar', 'myorg', 'myteam', OPTS).then(ret => { | ||
t.deepEqual(ret, {accessChanged: true}, 'request succeeded') | ||
t.deepEqual(ret, true, 'request succeeded') | ||
}) | ||
@@ -144,3 +140,3 @@ }) | ||
tnock(t, REG).get( | ||
'/-/org/myorg/myteam/package?format=cli' | ||
'/-/team/myorg/myteam/package?format=cli' | ||
).reply(200, serverPackages) | ||
@@ -191,3 +187,3 @@ return access.lsPackages('myorg', 'myteam', OPTS).then(data => { | ||
test('ls-packages error on team', t => { | ||
tnock(t, REG).get('/-/org/myorg/myteam/package?format=cli').reply(404) | ||
tnock(t, REG).get('/-/team/myorg/myteam/package?format=cli').reply(404) | ||
return access.lsPackages( | ||
@@ -203,3 +199,3 @@ 'myorg', 'myteam', OPTS | ||
tnock(t, REG).get( | ||
'/-/org/myorg/myteam/package?format=cli' | ||
'/-/team/myorg/myteam/package?format=cli' | ||
).reply(200, JSON.stringify(null)) | ||
@@ -223,3 +219,3 @@ return access.lsPackages('myorg', 'myteam', OPTS).then(data => { | ||
tnock(t, REG).get( | ||
'/-/org/myorg/myteam/package?format=cli' | ||
'/-/team/myorg/myteam/package?format=cli' | ||
).reply(200, serverPackages) | ||
@@ -226,0 +222,0 @@ return getStream.array( |
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
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
61960
486