Comparing version 0.8.0 to 0.8.1
@@ -0,1 +1,7 @@ | ||
## v0.8.1 | ||
* Added support for limit/marker options for Rackspace getContainers, getFiles | ||
* removed unused Rackspace.File.rm/ls/cp methods | ||
* Fixed a bug in File.fullPath | ||
* Fixed a bug in Azure header signing | ||
## v0.8.0 | ||
@@ -2,0 +8,0 @@ * Rewrote Rackspace Client to derive from Openstack Client |
@@ -13,2 +13,3 @@ /* | ||
utile = require('utile'), | ||
urlJoin = require('url-join'), | ||
qs = require('querystring'), | ||
@@ -38,3 +39,3 @@ base = require('../../../core/storage'), | ||
method:'DELETE', | ||
path: container + '/' + file | ||
path: urlJoin(container, file) | ||
}, function (err, body, res) { | ||
@@ -78,3 +79,3 @@ return err | ||
path = container + '/' + options.remote; | ||
path = urlJoin(container, options.remote); | ||
@@ -178,3 +179,3 @@ if (options.azureBlockId) { | ||
path = container + '/' + options.remote; | ||
path = urlJoin(container, options.remote); | ||
qs = { | ||
@@ -224,3 +225,3 @@ comp: 'blocklist' | ||
rstream = this.request({ | ||
path: container + '/' + options.remote, | ||
path: urlJoin(container, options.remote), | ||
download: true | ||
@@ -249,3 +250,3 @@ }, function (err, body, res) { | ||
method: 'GET', | ||
path: containerName + '/' + file | ||
path: urlJoin(containerName, file) | ||
}, function (err, body, res) { | ||
@@ -252,0 +253,0 @@ return err |
@@ -49,6 +49,15 @@ /* | ||
var fragment = ''; | ||
if (options.container) { | ||
fragment = options.container; | ||
} | ||
if (options.path) { | ||
fragment = urlJoin(fragment, options.path); | ||
} | ||
return urlJoin('http://' + this.azureKeys.storageAccount + '.' + this.serversUrl + '/', | ||
(typeof options === 'string' | ||
? options : | ||
options.path)) | ||
fragment); | ||
}; |
@@ -106,5 +106,4 @@ /** | ||
if (req.path) { | ||
var u = URL.parse(req.path, true); | ||
var queryStringValues = u.query; | ||
if (req.qs) { | ||
var queryStringValues = req.qs; | ||
@@ -111,0 +110,0 @@ // Build the canonicalized resource by sorting the values by name. |
@@ -36,2 +36,4 @@ /* | ||
* @description is the global request handler for a pkgcloud client request. | ||
* Some clients can override this function, for example | ||
* rackspace and openstack providers implement an inline authentication mechanism. | ||
* | ||
@@ -42,18 +44,2 @@ * @param {object} options options for this client request | ||
Client.prototype.request = function (options, callback) { | ||
return this._doRequest(options, callback); | ||
}; | ||
/** | ||
* Client._doRequest | ||
* | ||
* @description Private function that handles the prepared payload and then | ||
* spawns the request. Some clients can override this function, for example | ||
* rackspace and openstack providers implement an inline authentication. | ||
* | ||
* @param {object} options the prepared options from Client.request | ||
* @param {Function} callback the callback for the request | ||
* @returns {*} | ||
* @private | ||
*/ | ||
Client.prototype._doRequest = function (options, callback) { | ||
var self = this; | ||
@@ -171,3 +157,4 @@ | ||
href: res.request.uri.href, | ||
method: res.request.method | ||
method: res.request.method, | ||
headers: res.headers | ||
}; | ||
@@ -188,2 +175,3 @@ | ||
method: res.request.method, | ||
headers: res.headers, | ||
statusCode: res.statusCode | ||
@@ -190,0 +178,0 @@ }); |
@@ -19,3 +19,3 @@ /* | ||
File.prototype.remove = File.prototype.rm = function (callback) { | ||
File.prototype.remove = function (callback) { | ||
this.client.removeFile(this.containerName, this.name, callback); | ||
@@ -28,8 +28,7 @@ }; | ||
File.prototype.update = function (data, callback) { | ||
}; | ||
File.prototype.__defineGetter__('fullPath', function () { | ||
return this.client.storageUrl(this.containerName, this.name); | ||
return this.client.getUrl({ | ||
container: this.containerName, | ||
path: this.name | ||
}); | ||
}); | ||
@@ -36,0 +35,0 @@ |
@@ -128,12 +128,11 @@ /* | ||
/** | ||
* Client._doRequest | ||
* Client.request | ||
* | ||
* @description custom _doRequest implementation for supporting inline auth for | ||
* @description custom request implementation for supporting inline auth for | ||
* OpenStack. this allows piping while not yet possesing a valid auth token | ||
* | ||
* @param payload | ||
* @returns {*} | ||
* @private | ||
* @param {object} options options for this client request | ||
* @param {Function} callback the callback for the client request | ||
*/ | ||
Client.prototype._doRequest = function (options, callback) { | ||
Client.prototype.request = function (options, callback) { | ||
@@ -155,3 +154,3 @@ var self = this; | ||
self.emit('log::debug', 'Creating Authenticated Proxy Request'); | ||
var apiStream = Client.super_.prototype._doRequest.call(self, options, callback); | ||
var apiStream = Client.super_.prototype.request.call(self, options, callback); | ||
@@ -172,3 +171,3 @@ if (options.upload) { | ||
self.emit('log::debug', 'Creating Authenticated Request'); | ||
return Client.super_.prototype._doRequest.call(self, options, callback); | ||
return Client.super_.prototype.request.call(self, options, callback); | ||
} | ||
@@ -175,0 +174,0 @@ }; |
@@ -19,6 +19,11 @@ /* | ||
// | ||
exports.getContainers = function (callback) { | ||
exports.getContainers = function (options, callback) { | ||
var self = this; | ||
this.request({ | ||
if (typeof options === 'function') { | ||
callback = options; | ||
options = {}; | ||
} | ||
var getContainerOpts = { | ||
path: '', | ||
@@ -28,3 +33,13 @@ qs: { | ||
} | ||
}, function (err, body) { | ||
}; | ||
if (options.limit) { | ||
getContainerOpts.qs.limit = options.limit; | ||
} | ||
if (options.marker) { | ||
getContainerOpts.qs.marker = options.marker; | ||
} | ||
this.request(getContainerOpts, function (err, body) { | ||
return err | ||
@@ -60,3 +75,3 @@ ? callback(err) | ||
method: 'HEAD', | ||
path: containerName | ||
container: containerName | ||
}, function (err, body, res) { | ||
@@ -95,3 +110,3 @@ if (err) { | ||
method: 'PUT', | ||
path: containerName | ||
container: containerName | ||
}, function (err, body, res) { | ||
@@ -126,3 +141,3 @@ return err | ||
method: 'DELETE', | ||
path: containerName | ||
container: containerName | ||
}, function(err) { | ||
@@ -129,0 +144,0 @@ return err |
@@ -25,5 +25,8 @@ /* | ||
exports.removeFile = function (container, file, callback) { | ||
var containerName = container instanceof base.Container ? container.name : container; | ||
this.request({ | ||
method: 'DELETE', | ||
path: [container instanceof base.Container ? container.name : container, file].join('/') | ||
container: containerName, | ||
path: file | ||
}, function(err) { | ||
@@ -84,3 +87,4 @@ return err | ||
upload: true, | ||
path: [container, options.remote].join('/'), | ||
container: container, | ||
path: options.remote, | ||
headers: options.headers || {} | ||
@@ -118,3 +122,4 @@ }, function (err, body, res) { | ||
apiStream = this.request({ | ||
path: [container, options.remote].join('/'), | ||
container: container, | ||
path: options.remote, | ||
download: true | ||
@@ -143,3 +148,4 @@ }, function (err, body, res) { | ||
method: 'HEAD', | ||
path: [containerName, file].join('/'), | ||
container: containerName, | ||
path: file, | ||
qs: { | ||
@@ -164,6 +170,6 @@ format: 'json' | ||
callback = options; | ||
options = null; | ||
options = {}; | ||
} | ||
this.request({ | ||
var getFilesOpts = { | ||
path: containerName, | ||
@@ -173,3 +179,13 @@ qs: { | ||
} | ||
}, function (err, body, res) { | ||
}; | ||
if (options.limit) { | ||
getFilesOpts.qs.limit = options.limit; | ||
} | ||
if (options.marker) { | ||
getFilesOpts.qs.marker = options.marker; | ||
} | ||
this.request(getFilesOpts, function (err, body) { | ||
return err | ||
@@ -176,0 +192,0 @@ ? callback(err) |
@@ -26,20 +26,17 @@ /* | ||
if (!options || options === '' || options.path === '') { | ||
return this.getServiceUrl(this.serviceType); | ||
var fragment = ''; | ||
if (options.container) { | ||
fragment = options.container; | ||
} | ||
return urlJoin(this.getServiceUrl(this.serviceType), (typeof options === 'string' ? | ||
options : options.path)); | ||
}; | ||
if (options.path) { | ||
fragment = urlJoin(fragment, options.path); | ||
} | ||
Client.prototype.ls = function (path, callback) { | ||
if (fragment === '' || fragment === '/') { | ||
return this.getServiceUrl(this.serviceType); | ||
} | ||
return urlJoin(this.getServiceUrl(this.serviceType), fragment); | ||
}; | ||
Client.prototype.rm = function (path, callback) { | ||
}; | ||
Client.prototype.cp = function (options, callback) { | ||
}; |
@@ -64,14 +64,18 @@ /* | ||
this.name = details.name || null; | ||
this.etag = details.etag || null; | ||
this.contentType = details['content-type'] || null; | ||
this.etag = details.etag || details.hash || null; | ||
this.contentType = details['content-type'] || details['content_type'] || null; | ||
this.lastModified = details['last-modified'] | ||
? new Date(details['last-modified']) | ||
: null; | ||
: details['last_modified'] | ||
? new Date(details['last_modified']) | ||
: null; | ||
this.size = this.bytes = details['content-length'] | ||
? parseInt(details['content-length'], 10) | ||
: details['bytes'] | ||
? parseInt(details['bytes'], 10) | ||
: null; | ||
Object.keys(details).forEach(function (header) { | ||
@@ -78,0 +82,0 @@ var match; |
{ | ||
"name": "pkgcloud", | ||
"description": "An infrastructure-as-a-service agnostic cloud library for node.js", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"author": "Nodejitsu Inc <info@nodejitsu.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
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
438494
12707