Lines Matching refs:access
4 library that provides programmatic access to the guts of the npm CLI's `npm
5 access` command and its various subcommands. This includes managing account 2FA,
12 const access = require('libnpmaccess')
14 // List all packages @zkat has access to on the npm registry.
15 console.log(Object.keys(await access.lsPackages('zkat')))
24 * [access opts](#opts)
71 #### <a name="public"></a> `> access.public(spec, [opts]) -> Promise`
81 await access.public('@foo/bar', {token: 'myregistrytoken'})
85 #### <a name="restricted"></a> `> access.restricted(spec, [opts]) -> Promise`
95 await access.restricted('@foo/bar', {token: 'myregistrytoken'})
99 #### <a name="grant"></a> `> access.grant(spec, team, permissions, [opts]) -> Promise`
111 await access.grant('@foo/bar', '@foo:myteam', 'read-write', {
117 #### <a name="revoke"></a> `> access.revoke(spec, team, [opts]) -> Promise`
124 Removes access to a package from a certain team.
129 await access.revoke('@foo/bar', '@foo:myteam', {
132 // @foo:myteam can no longer access `@foo/bar`
135 #### <a name="tfa-required"></a> `> access.tfaRequired(spec, [opts]) -> Promise`
146 await access.tfaRequires('lodash', {token: 'myregistrytoken'})
150 #### <a name="tfa-not-required"></a> `> access.tfaNotRequired(spec, [opts]) -> Promise`
161 await access.tfaNotRequired('lodash', {otp: '123654', token: 'myregistrytoken'})
166 #### <a name="ls-packages"></a> `> access.lsPackages(entity, [opts]) -> Promise`
171 Lists out packages a user, org, or team has access to, with corresponding
172 permissions. Packages that the access token does not have access to won't be
179 [`access.lsPackages.stream()`](#ls-package-stream).
184 await access.lsPackages('zkat', {
187 // Lists all packages `@zkat` has access to on the registry, and the
191 #### <a name="ls-packages-stream"></a> `> access.lsPackages.stream(scope, [team], [opts]) -> Stream`
196 Streams out packages a user, org, or team has access to, with corresponding
198 permissions]`. Packages that the access token does not have access to won't be
209 for await (let [pkg, perm] of access.lsPackages.stream('zkat')) {
210 console.log('zkat has', perm, 'access to', pkg)
212 // zkat has read-write access to eggplant
213 // zkat has read-only access to @npmcorp/secret
216 #### <a name="ls-collaborators"></a> `> access.lsCollaborators(spec, [user], [opts]) -> Promise`
222 Lists out access privileges for a certain package. Will only show permissions
223 for packages to which you have at least read access. If `user` is passed in, the
226 For a streamed version of these results, see [`access.lsCollaborators.stream()`](#ls-collaborators-…
231 await access.lsCollaborators('@npm/foo', 'zkat', {
234 // Lists all teams with access to @npm/foo that @zkat belongs to.
237 #### <a name="ls-collaborators-stream"></a> `> access.lsCollaborators.stream(spec, [user], [opts]) …
243 Stream out access privileges for a certain package, with each entry in `[user,
245 at least read access. If `user` is passed in, the list is filtered only to teams
253 for await (let [usr, perm] of access.lsCollaborators.stream('npm')) {
254 console.log(usr, 'has', perm, 'access to npm')
256 // zkat has read-write access to npm
257 // iarna has read-write access to npm