rets-client
Advanced tools
Comparing version 4.5.0 to 4.6.0
@@ -34,3 +34,3 @@ // Generated by CoffeeScript 1.10.0 | ||
_processBody = function(headers, bodyStream, preDecoded) { | ||
_processBody = function(headers, bodyStream, preDecoded, options) { | ||
return new Promise(function(resolve, reject) { | ||
@@ -42,7 +42,11 @@ var b64, headerInfo, onError, ref, retsParser; | ||
}; | ||
if (_insensitiveStartsWith(headerInfo.contentType, 'text/xml')) { | ||
if (_insensitiveStartsWith(headerInfo.contentType, 'text/xml') && options.Location === 1) { | ||
return resolve({ | ||
headerInfo: headerInfo | ||
}); | ||
} else if (_insensitiveStartsWith(headerInfo.contentType, 'text/xml')) { | ||
retsParser = retsParsing.getSimpleParser('getObject', onError, headerInfo); | ||
return bodyStream.pipe(retsParser.parser); | ||
} else if (_insensitiveStartsWith(headerInfo.contentType, 'multipart')) { | ||
return multipart.getObjectStream(headerInfo, bodyStream, _processBody).then(function(objectStream) { | ||
return multipart.getObjectStream(headerInfo, bodyStream, _processBody, options).then(function(objectStream) { | ||
return resolve({ | ||
@@ -195,5 +199,2 @@ headerInfo: headerInfo, | ||
fail = function(error) { | ||
if (done) { | ||
return; | ||
} | ||
done = true; | ||
@@ -209,3 +210,3 @@ return reject(errors.ensureRetsError('getObject', error)); | ||
done = true; | ||
return _processBody(response.rawHeaders, bodyStream, true).then(function(result) { | ||
return _processBody(response.rawHeaders, bodyStream, true, options).then(function(result) { | ||
return resolve(result); | ||
@@ -212,0 +213,0 @@ })["catch"](function(error) { |
@@ -22,3 +22,3 @@ // Generated by CoffeeScript 1.10.0 | ||
getObjectStream = function(headerInfo, stream, handler) { | ||
getObjectStream = function(headerInfo, stream, handler, options) { | ||
return new Promise(function(resolve, reject) { | ||
@@ -100,3 +100,3 @@ var bodyStream, done, flush, flushed, handleEnd, handleError, headerField, headerValue, headers, interceptor, multipartBoundary, objectStream, objectStreamDone, parser, partDone, ref, ref1, streamError; | ||
}); | ||
handler(headers, bodyStream).then(function(object) { | ||
handler(headers, bodyStream, false, options).then(function(object) { | ||
if (!objectStreamDone) { | ||
@@ -138,9 +138,14 @@ return objectStream.write(object); | ||
flush = function(callback) { | ||
var err; | ||
err = parser.end(); | ||
if (err) { | ||
handleError(new errors.RetsProcessingError('getObject', "Unexpected end of data: " + (errors.getErrorMessage(err)), headerInfo)); | ||
var err, err2, error1; | ||
try { | ||
err = parser.end(); | ||
if (err) { | ||
handleError(new errors.RetsProcessingError('getObject', "Unexpected end of data: " + (errors.getErrorMessage(err)), headerInfo)); | ||
} | ||
flushed = true; | ||
return handleEnd(); | ||
} catch (error1) { | ||
err2 = error1; | ||
return console.log('uncaught error is now caught: ' + errors.getErrorMessage(err) + '\n' + (err2.stack || errors.getErrorMessage(err2))); | ||
} | ||
flushed = true; | ||
return handleEnd(); | ||
}; | ||
@@ -147,0 +152,0 @@ stream.pipe(through2(interceptor, flush)); |
@@ -47,3 +47,3 @@ // Generated by CoffeeScript 1.10.0 | ||
streamRetsMethod = function(methodName, retsSession, queryOptions, failCallback, responseCallback, client) { | ||
var done, errorHandler, responseHandler, stream; | ||
var done, errorHandler, request, responseHandler, stream; | ||
debug("RETS " + methodName + " (streaming)", queryOptions); | ||
@@ -73,11 +73,14 @@ done = false; | ||
}; | ||
request = {}; | ||
if (client.settings.method === 'POST') { | ||
stream = retsSession({ | ||
form: queryOptions | ||
}); | ||
request.form = queryOptions; | ||
} else { | ||
stream = retsSession({ | ||
qs: queryOptions | ||
}); | ||
request.qs = queryOptions; | ||
} | ||
if (methodName === 'getObject') { | ||
request.headers = { | ||
Accept: '*/*' | ||
}; | ||
} | ||
stream = retsSession(request); | ||
stream.on('error', errorHandler); | ||
@@ -84,0 +87,0 @@ return stream.on('response', responseHandler); |
{ | ||
"name": "rets-client", | ||
"version": "4.5.0", | ||
"version": "4.6.0", | ||
"description": "A RETS client (Real Estate Transaction Standard).", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,2 +8,5 @@ rets-client | ||
#### 4.6.0 | ||
Added support for `Location: 1` option on `getObject` calls. | ||
#### 4.5.0 | ||
@@ -10,0 +13,0 @@ Added a new error class for RETS permissions problems on login. |
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
94081
1965
338