Server IP : 127.0.0.2 / Your IP : 13.58.199.13 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/npm/node_modules/npm-registry-client/lib/ |
Upload File : |
module.exports = team var assert = require('assert') var url = require('url') var subcommands = {} function team (sub, uri, params, cb) { teamAssertions(sub, uri, params, cb) return subcommands[sub].call(this, uri, params, cb) } subcommands.create = function (uri, params, cb) { return this.request(apiUri(uri, 'org', params.scope, 'team'), { method: 'PUT', auth: params.auth, body: JSON.stringify({ name: params.team }) }, cb) } subcommands.destroy = function (uri, params, cb) { return this.request(apiUri(uri, 'team', params.scope, params.team), { method: 'DELETE', auth: params.auth }, cb) } subcommands.add = function (uri, params, cb) { return this.request(apiUri(uri, 'team', params.scope, params.team, 'user'), { method: 'PUT', auth: params.auth, body: JSON.stringify({ user: params.user }) }, cb) } subcommands.rm = function (uri, params, cb) { return this.request(apiUri(uri, 'team', params.scope, params.team, 'user'), { method: 'DELETE', auth: params.auth, body: JSON.stringify({ user: params.user }) }, cb) } subcommands.ls = function (uri, params, cb) { var uriParams = '?format=cli' if (params.team) { var reqUri = apiUri( uri, 'team', params.scope, params.team, 'user') + uriParams return this.request(reqUri, { method: 'GET', auth: params.auth }, cb) } else { return this.request(apiUri(uri, 'org', params.scope, 'team') + uriParams, { method: 'GET', auth: params.auth }, cb) } } // TODO - we punted this to v2 // subcommands.edit = function (uri, params, cb) { // return this.request(apiUri(uri, 'team', params.scope, params.team, 'user'), { // method: 'POST', // auth: params.auth, // body: JSON.stringify({ // users: params.users // }) // }, cb) // } function apiUri (registryUri) { var path = Array.prototype.slice.call(arguments, 1) .map(encodeURIComponent) .join('/') return url.resolve(registryUri, '-/' + path) } function teamAssertions (subcommand, uri, params, cb) { assert(subcommand, 'subcommand is required') assert(subcommands.hasOwnProperty(subcommand), 'team subcommand must be one of ' + Object.keys(subcommands)) assert(typeof uri === 'string', 'registry URI is required') assert(typeof params === 'object', 'params are required') assert(typeof params.auth === 'object', 'auth is required') assert(typeof params.scope === 'string', 'scope is required') assert(!cb || typeof cb === 'function', 'callback must be a function') if (subcommand !== 'ls') { assert(typeof params.team === 'string', 'team name is required') } if (subcommand === 'rm' || subcommand === 'add') { assert(typeof params.user === 'string', 'user is required') } if (subcommand === 'edit') { assert(typeof params.users === 'object' && params.users.length != null, 'users is required') } }