Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gitlab

Package Overview
Dependencies
Maintainers
1
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitlab - npm Package Compare versions

Comparing version 0.1.1 to 0.2.1

lib/ApiV3.js

3

examples/example.credentials.js

@@ -1,4 +0,3 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {
module.exports = {

@@ -5,0 +4,0 @@ url: 'https://gitlab.example.com',

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {

@@ -19,2 +19,3 @@ var Gitlab, credentials, gitlab;

var project, _i, _len, _results;
_results = [];

@@ -21,0 +22,0 @@ for (_i = 0, _len = projects.length; _i < _len; _i++) {

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {

@@ -19,2 +19,3 @@ var Gitlab, credentials, gitlab;

var user, _i, _len, _results;
_results = [];

@@ -21,0 +22,0 @@ for (_i = 0, _len = users.length; _i < _len; _i++) {

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {

@@ -3,0 +3,0 @@ var Gitlab, credentials, gitlab, projectId;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {

@@ -3,0 +3,0 @@ var Gitlab, credentials, gitlab, userId;

module.exports = {
ApiV2: require('./lib/apiV2')
ApiV2: require('./lib/ApiV2').ApiV2,
ApiV3: require('./lib/ApiV3').ApiV3
};

@@ -1,19 +0,13 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {
var ApiBase,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__slice = [].slice;
ApiBase = (function() {
module.exports.ApiBase = (function() {
function ApiBase(options) {
this.options = options;
this.init = __bind(this.init, this);
this.debug = __bind(this.debug, this);
this.log = __bind(this.log, this);
this.handleOptions = __bind(this.handleOptions, this);
this.handleOptions();

@@ -26,2 +20,3 @@ this.init();

var _base, _ref;
if ((_ref = (_base = this.options).verbose) == null) {

@@ -35,2 +30,3 @@ _base.verbose = false;

var args, name, _ref, _ref1;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];

@@ -43,2 +39,3 @@ name = (typeof this !== "undefined" && this !== null ? (_ref = this.constructor) != null ? typeof _ref.toString === "function" ? (_ref1 = _ref.toString().match(/function\s*(\w+)/)) != null ? _ref1[1] : void 0 : void 0 : void 0 : void 0) || 'ApiBase';

var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];

@@ -61,4 +58,2 @@ if (this.options.verbose !== false) {

module.exports = ApiBase;
}).call(this);

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {
var ApiBase, ApiBaseHTTP,
var ApiBase, _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -8,6 +8,5 @@ __hasProp = {}.hasOwnProperty,

ApiBase = require('./ApiBase');
ApiBase = require('./ApiBase').ApiBase;
ApiBaseHTTP = (function(_super) {
module.exports.ApiBaseHTTP = (function(_super) {
__extends(ApiBaseHTTP, _super);

@@ -17,32 +16,25 @@

this._request = __bind(this._request, this);
this._parseResponse = __bind(this._parseResponse, this);
this._request_options = __bind(this._request_options, this);
this.put = __bind(this.put, this);
this.post = __bind(this.post, this);
this["delete"] = __bind(this["delete"], this);
this.get = __bind(this.get, this);
this._translateUrl = __bind(this._translateUrl, this);
this.handleOptions = __bind(this.handleOptions, this);
return ApiBaseHTTP.__super__.constructor.apply(this, arguments);
this.handleOptions = __bind(this.handleOptions, this); _ref = ApiBaseHTTP.__super__.constructor.apply(this, arguments);
return _ref;
}
ApiBaseHTTP.prototype.handleOptions = function() {
var host, key, value, _base, _base1, _base10, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _base9, _ref, _ref1, _ref10, _ref11, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
var host, key, value, _base, _base1, _base10, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _base9, _ref1, _ref10, _ref11, _ref12, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
ApiBaseHTTP.__super__.handleOptions.apply(this, arguments);
if ((_ref = (_base = this.options).debug) == null) {
if ((_ref1 = (_base = this.options).debug) == null) {
_base.debug = false;
}
if (this.options.url != null) {
_ref1 = require('url').parse(this.options.url);
for (key in _ref1) {
value = _ref1[key];
if ((_ref2 = (_base1 = this.options)[key]) == null) {
_ref2 = require('url').parse(this.options.url);
for (key in _ref2) {
value = _ref2[key];
if ((_ref3 = (_base1 = this.options)[key]) == null) {
_base1[key] = value;

@@ -52,30 +44,30 @@ }

}
if ((_ref3 = (_base2 = this.options).host) == null) {
if ((_ref4 = (_base2 = this.options).host) == null) {
_base2.host = this.options.hostname;
}
host = this.options.host.split(':');
if ((_ref4 = (_base3 = this.options).hostname) == null) {
if ((_ref5 = (_base3 = this.options).hostname) == null) {
_base3.hostname = host[0];
}
if ((_ref5 = (_base4 = this.options).port) == null) {
if ((_ref6 = (_base4 = this.options).port) == null) {
_base4.port = host[1];
}
if ((_ref6 = (_base5 = this.options).username) == null) {
if ((_ref7 = (_base5 = this.options).username) == null) {
_base5.username = null;
}
if ((_ref7 = (_base6 = this.options).protocol) == null) {
if ((_ref8 = (_base6 = this.options).protocol) == null) {
_base6.protocol = 'http:';
}
if ((_ref8 = (_base7 = this.options).port) == null) {
if ((_ref9 = (_base7 = this.options).port) == null) {
_base7.port = this.options.protocol === 'https:' ? 443 : 80;
}
this.options.port = parseInt(this.options.port);
if ((_ref9 = (_base8 = this.options).path) == null) {
if ((_ref10 = (_base8 = this.options).path) == null) {
_base8.path = '/';
}
if ((_ref10 = (_base9 = this.options).pathname) == null) {
if ((_ref11 = (_base9 = this.options).pathname) == null) {
_base9.pathname = this.options.path;
}
this.options.host = "" + this.options.hostname + ":" + this.options.port;
if ((_ref11 = (_base10 = this.options).base_url) == null) {
if ((_ref12 = (_base10 = this.options).base_url) == null) {
_base10.base_url = '';

@@ -92,2 +84,3 @@ }

var options;
if (fn == null) {

@@ -105,2 +98,3 @@ fn = null;

var options;
if (fn == null) {

@@ -118,2 +112,3 @@ fn = null;

var options;
if (data == null) {

@@ -135,2 +130,3 @@ data = {};

var options;
if (data == null) {

@@ -151,23 +147,24 @@ data = {};

ApiBaseHTTP.prototype._request_options = function(options) {
var _base, _base1, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
if ((_ref = options.host) == null) {
var _base, _base1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;
if ((_ref1 = options.host) == null) {
options.host = this.options.hostname;
}
if ((_ref1 = options.protocol) == null) {
if ((_ref2 = options.protocol) == null) {
options.protocol = this.options.protocol;
}
if ((_ref2 = options.port) == null) {
if ((_ref3 = options.port) == null) {
options.port = this.options.port;
}
if ((_ref3 = options.method) == null) {
if ((_ref4 = options.method) == null) {
options.method = 'GET';
}
if ((_ref4 = options.headers) == null) {
if ((_ref5 = options.headers) == null) {
options.headers = {};
}
if ((_ref5 = (_base = options.headers).host) == null) {
if ((_ref6 = (_base = options.headers).host) == null) {
_base.host = this.options.hostname;
}
if (this.options.username != null) {
if ((_ref6 = (_base1 = options.header).Authorization) == null) {
if ((_ref7 = (_base1 = options.header).Authorization) == null) {
_base1.Authorization = 'Basic ' + new Buffer("" + this.options.username + ":" + this.options.password).toString('base64');

@@ -180,9 +177,15 @@ }

ApiBaseHTTP.prototype._parseResponse = function(buffer, fn) {
var response;
var e, response;
if (fn == null) {
fn = null;
}
response = JSON.parse(buffer);
if (fn) {
return fn(response);
try {
response = JSON.parse(buffer);
if (fn) {
return fn(response);
}
} catch (_error) {
e = _error;
return console.log(e, buffer);
}

@@ -192,4 +195,5 @@ };

ApiBaseHTTP.prototype._request = function(options, fn) {
var client, request,
var httpClient, post_data, request, _base, _base1, _ref1, _ref2, _ref3,
_this = this;
if (fn == null) {

@@ -201,16 +205,32 @@ fn = null;

if (options.protocol === 'http:') {
if (this.client == null) {
this.client = require('http');
if (this.httpClient == null) {
this.httpClient = require('http');
}
client = this.client;
httpClient = this.httpClient;
} else if (options.protocol === 'https:') {
if (this.client_ssl == null) {
this.client_ssl = require('https');
if (this.httpClient_ssl == null) {
this.httpClient_ssl = require('https');
}
client = this.client_ssl;
httpClient = this.httpClient_ssl;
}
request = client.request(options);
if (options.data) {
post_data = require('querystring').stringify(options.data);
if ((_ref1 = options.headers) == null) {
options.headers = {};
}
if ((_ref2 = (_base = options.headers)['Content-Length']) == null) {
_base['Content-Length'] = post_data.length;
}
if ((_ref3 = (_base1 = options.headers)['Content-Type']) == null) {
_base1['Content-Type'] = 'application/x-www-form-urlencoded';
}
}
request = httpClient.request(options);
if (post_data != null) {
request.write(post_data);
}
request.end();
return request.on('response', function(response) {
var buffer;
buffer = '';

@@ -230,4 +250,2 @@ response.on('data', function(chunk) {

module.exports = ApiBaseHTTP;
}).call(this);

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {
var ApiBaseHTTP, ApiV2,
var ApiBaseHTTP, _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -8,11 +8,10 @@ __hasProp = {}.hasOwnProperty,

ApiBaseHTTP = require('./ApiBaseHTTP');
ApiBaseHTTP = require('./ApiBaseHTTP').ApiBaseHTTP;
ApiV2 = (function(_super) {
module.exports.ApiV2 = (function(_super) {
__extends(ApiV2, _super);
function ApiV2() {
this.handleOptions = __bind(this.handleOptions, this);
return ApiV2.__super__.constructor.apply(this, arguments);
this.handleOptions = __bind(this.handleOptions, this); _ref = ApiV2.__super__.constructor.apply(this, arguments);
return _ref;
}

@@ -30,4 +29,2 @@

module.exports = ApiV2;
}).call(this);

@@ -1,22 +0,18 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {
var BaseModel,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
BaseModel = (function() {
function BaseModel(client) {
module.exports = (function() {
function exports(client) {
this.client = client;
this._init = __bind(this._init, this);
this.load = __bind(this.load, this);
this._init();
}
BaseModel.prototype.load = function(model) {
exports.prototype.load = function(model) {
return require("./" + model)(this.client);
};
BaseModel.prototype._init = function() {
exports.prototype._init = function() {
this.debug = this.client.debug;

@@ -32,8 +28,6 @@ this.get = this.client.get;

return BaseModel;
return exports;
})();
module.exports = BaseModel;
}).call(this);

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {
var BaseModel, ProjectHooks,
var BaseModel, ProjectHooks, _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -11,3 +11,2 @@ __hasProp = {}.hasOwnProperty,

ProjectHooks = (function(_super) {
__extends(ProjectHooks, _super);

@@ -17,11 +16,7 @@

this.remove = __bind(this.remove, this);
this.update = __bind(this.update, this);
this.add = __bind(this.add, this);
this.show = __bind(this.show, this);
this.list = __bind(this.list, this);
return ProjectHooks.__super__.constructor.apply(this, arguments);
this.list = __bind(this.list, this); _ref = ProjectHooks.__super__.constructor.apply(this, arguments);
return _ref;
}

@@ -31,2 +26,3 @@

var _this = this;
if (fn == null) {

@@ -45,2 +41,3 @@ fn = null;

var _this = this;
if (fn == null) {

@@ -60,2 +57,3 @@ fn = null;

_this = this;
if (fn == null) {

@@ -78,2 +76,3 @@ fn = null;

_this = this;
if (fn == null) {

@@ -96,2 +95,3 @@ fn = null;

_this = this;
if (fn == null) {

@@ -98,0 +98,0 @@ fn = null;

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {
var BaseModel, ProjectMembers,
var BaseModel, ProjectMembers, _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -11,3 +11,2 @@ __hasProp = {}.hasOwnProperty,

ProjectMembers = (function(_super) {
__extends(ProjectMembers, _super);

@@ -17,11 +16,7 @@

this.remove = __bind(this.remove, this);
this.update = __bind(this.update, this);
this.add = __bind(this.add, this);
this.show = __bind(this.show, this);
this.list = __bind(this.list, this);
return ProjectMembers.__super__.constructor.apply(this, arguments);
this.list = __bind(this.list, this); _ref = ProjectMembers.__super__.constructor.apply(this, arguments);
return _ref;
}

@@ -31,2 +26,3 @@

var _this = this;
if (fn == null) {

@@ -45,2 +41,3 @@ fn = null;

var _this = this;
if (fn == null) {

@@ -60,2 +57,3 @@ fn = null;

_this = this;
if (accessLevel == null) {

@@ -82,2 +80,3 @@ accessLevel = 30;

_this = this;
if (accessLevel == null) {

@@ -102,2 +101,3 @@ accessLevel = 30;

var _this = this;
if (fn == null) {

@@ -104,0 +104,0 @@ fn = null;

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {
var BaseModel, Projects,
var BaseModel, Projects, _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -11,14 +11,13 @@ __hasProp = {}.hasOwnProperty,

Projects = (function(_super) {
__extends(Projects, _super);
function Projects() {
this.listCommits = __bind(this.listCommits, this);
this.listMembers = __bind(this.listMembers, this);
this.addMember = __bind(this.addMember, this);
this.create = __bind(this.create, this);
this.show = __bind(this.show, this);
this.all = __bind(this.all, this);
this.init = __bind(this.init, this);
return Projects.__super__.constructor.apply(this, arguments);
this.init = __bind(this.init, this); _ref = Projects.__super__.constructor.apply(this, arguments);
return _ref;
}

@@ -33,2 +32,3 @@

var _this = this;
if (fn == null) {

@@ -47,2 +47,3 @@ fn = null;

var _this = this;
if (fn == null) {

@@ -59,3 +60,3 @@ fn = null;

Projects.prototype.create = function(name, params, fn) {
Projects.prototype.create = function(params, fn) {
if (params == null) {

@@ -68,3 +69,2 @@ params = {};

this.debug("Projects::create()");
params.name = name;
return this.post("projects", params, function(data) {

@@ -77,2 +77,49 @@ if (fn) {

Projects.prototype.addMember = function(params, fn) {
if (params == null) {
params = {};
}
if (fn == null) {
fn = null;
}
this.debug("Projects::addMember()");
return this.post("projects/" + params.id + "/members", params, function(data) {
if (fn) {
return fn(data);
}
});
};
Projects.prototype.listMembers = function(params, fn) {
if (params == null) {
params = {};
}
if (fn == null) {
fn = null;
}
this.debug("Projects::listMembers()");
return this.get("projects/" + params.id + "/members", function(data) {
if (fn) {
return fn(data);
}
});
};
Projects.prototype.listCommits = function(params, fn) {
var _this = this;
if (params == null) {
params = {};
}
if (fn == null) {
fn = null;
}
this.debug("Projects::listCommits()");
return this.get("projects/" + params.id + "/repository/commits", function(data) {
if (fn) {
return fn(data);
}
});
};
return Projects;

@@ -79,0 +126,0 @@

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.6.2
(function() {
var BaseModel, Users,
var BaseModel, Users, _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -11,3 +11,2 @@ __hasProp = {}.hasOwnProperty,

Users = (function(_super) {
__extends(Users, _super);

@@ -17,9 +16,6 @@

this.session = __bind(this.session, this);
this.create = __bind(this.create, this);
this.show = __bind(this.show, this);
this.all = __bind(this.all, this);
return Users.__super__.constructor.apply(this, arguments);
this.all = __bind(this.all, this); _ref = Users.__super__.constructor.apply(this, arguments);
return _ref;
}

@@ -29,2 +25,3 @@

var _this = this;
if (fn == null) {

@@ -43,2 +40,3 @@ fn = null;

var _this = this;
if (fn == null) {

@@ -55,3 +53,3 @@ fn = null;

Users.prototype.create = function(name, email, password, params, fn) {
Users.prototype.create = function(params, fn) {
if (params == null) {

@@ -63,5 +61,3 @@ params = {};

}
this.debug("Users::create()");
params.email = email;
params.password = password;
this.debug("Users::create()", params);
return this.post("users", params, function(data) {

@@ -76,2 +72,3 @@ if (fn) {

var params;
if (fn == null) {

@@ -78,0 +75,0 @@ fn = null;

{
"name": "gitlab",
"version": "0.1.1",
"version": "0.2.1",
"description": "gitlab api nodejs library",

@@ -5,0 +5,0 @@ "main": "index.js",

node-gitlab
===========
gitlab api nodejs library
[gitlab](https://github.com/gitlabhq/gitlabhq) api nodejs library
Install
=======
```bash
npm install gitlab
```
SEE ALSO
========
* [Examples](https://github.com/moul/node-gitlab/tree/master/examples)
LICENSE
-------
MIT

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc