New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

geartrack

Package Overview
Dependencies
Maintainers
2
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geartrack - npm Package Compare versions

Comparing version

to
2.7.19

2

package.json
{
"name": "geartrack",
"version": "2.7.18",
"version": "2.7.19",
"description": "Tracking providers for Gearbest and AliExpress Orders.",

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

@@ -51,7 +51,7 @@ 'use strict';

if (info.dat[0].yt != null) {
throw utils.getError('ACTION_REQUIRED')
throw utils.errorActionRequired()
}
if (info.dat[0].track == null) {
throw utils.getError('NO_DATA')
throw utils.errorNoData()
}

@@ -65,7 +65,7 @@

console.log(id, error)
throw utils.getError('PARSER')
throw utils.errorParser(id, error.message)
}
}
throw utils.getError('BUSY')
throw utils.errorBusy()
}

@@ -72,0 +72,0 @@

@@ -25,3 +25,3 @@ 'use strict';

if (error || response.statusCode != 200) {
callback(utils.getError('DOWN'))
callback(utils.errorDown())
return

@@ -31,3 +31,3 @@ }

if(body.length == 0) {
return callback(utils.getError('EMPTY'))
return callback(utils.errorNoData())
}

@@ -39,3 +39,3 @@

if (json.length == 0) {
callback(utils.getError('NO_DATA'))
callback(utils.errorNoData())
return

@@ -50,4 +50,3 @@ }

} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -54,0 +53,0 @@

@@ -37,3 +37,3 @@ 'use strict';

if (error || response.statusCode != 200) {
callback(utils.getError('DOWN'))
callback(utils.errorDown())
return

@@ -47,3 +47,3 @@ }

if (val.data[0].errorCode == "ORDER_NOT_FOUND" || val.data[0].errorCode == "RESULT_EMPTY") {
callback(utils.getError('NO_DATA'))
callback(utils.errorNoData())
return

@@ -57,4 +57,3 @@ }

} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -61,0 +60,0 @@

@@ -29,3 +29,3 @@ 'use strict';

if (error || response.statusCode != 200) {
cb(utils.getError('DOWN'))
cb(utils.errorDown())
return

@@ -53,3 +53,3 @@ }

if (!trs || trs.length === 0) {
cb(utils.getError('NO_DATA'))
cb(utils.errorNoData())
return

@@ -73,4 +73,3 @@ }

} catch (error) {
console.log(id, error)
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -77,0 +76,0 @@

@@ -31,7 +31,7 @@ 'use strict';

console.log('error:', error)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}
if (response.statusCode != 200) {
console.log('response.statusCode: ', response.statusCode)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}

@@ -44,3 +44,3 @@

if (!entity) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}

@@ -50,4 +50,3 @@ entity.retries = response.attempts

} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -54,0 +53,0 @@

@@ -27,3 +27,3 @@ 'use strict';

if (error || response.statusCode != 200) {
cb(utils.getError('DOWN'))
cb(utils.errorDown())
return

@@ -34,3 +34,3 @@ }

if (body.indexOf('portlet-msg-error') != -1) {
cb(utils.getError('NO_DATA'))
cb(utils.errorNoData())
return

@@ -44,4 +44,3 @@ }

} catch (error) {
console.log(id, error)
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -48,0 +47,0 @@

@@ -43,3 +43,3 @@ 'use strict';

if (error || response.statusCode != 200) {
cb(utils.getError('DOWN'))
cb(utils.errorDown())
return

@@ -50,3 +50,3 @@ }

if (body.indexOf('errorMessage') != -1) {
cb(utils.getError('NO_DATA'))
cb(utils.errorNoData())
return

@@ -60,4 +60,3 @@ }

} catch (error) {
console.log(id, error)
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -64,0 +63,0 @@

@@ -30,3 +30,3 @@ 'use strict';

if (error || response.statusCode != 200) {
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}

@@ -37,3 +37,3 @@

body.indexOf('Insira pelo menos 10 caracteres') != -1) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}

@@ -43,4 +43,3 @@

if(err) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, err.message))
}

@@ -47,0 +46,0 @@

@@ -38,3 +38,3 @@ 'use strict';

if (error || response.statusCode != 200) {
cb(utils.getError('DOWN'))
cb(utils.errorDown())
return

@@ -45,3 +45,3 @@ }

if (data.errors != undefined) {
cb(utils.getError('NO_DATA'))
cb(utils.errorNoData())
return

@@ -54,4 +54,3 @@ }

} catch (error) {
console.log(id, error)
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -58,0 +57,0 @@

@@ -44,3 +44,3 @@ 'use strict';

console.log('error:', error)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}

@@ -50,7 +50,7 @@

console.log('response.statusCode: ', response.statusCode)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}
if(body.indexOf('Sorry order number') !== -1) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}

@@ -63,4 +63,3 @@

if(idx == -1 || endIdx == -1) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id))
}

@@ -73,4 +72,3 @@

} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -89,11 +87,11 @@

console.log('error:', error)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}
if (response.statusCode != 200) {
console.log('response.statusCode: ', response.statusCode)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}
if (body.length == 0) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}

@@ -128,4 +126,3 @@

} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -142,3 +139,3 @@

console.log('error:', error)
return cb(utils.getError('DOWN'))
return cb(utils.errorDown())
}

@@ -148,3 +145,3 @@

console.log('response.statusCode: ', response.statusCode)
return cb(utils.getError('DOWN'))
return cb(utils.errorDown())
}

@@ -151,0 +148,0 @@

@@ -34,3 +34,3 @@ 'use strict';

if (error || response.statusCode != 200) {
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}

@@ -40,3 +40,3 @@

if (body.indexOf('Nenhuma guia encontrada com esta') != -1) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}

@@ -49,4 +49,3 @@

} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -53,0 +52,0 @@

@@ -23,3 +23,3 @@ 'use strict';

if (error || response.statusCode != 200) {
return cb(utils.getError('DOWN'))
return cb(utils.errorDown())
}

@@ -29,3 +29,3 @@

if (body.indexOf('No information, please check your item identifier') !== -1) {
return cb(utils.getError('NO_DATA'))
return cb(utils.errorNoData())
}

@@ -38,4 +38,3 @@

} catch (error) {
console.log(id, error)
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -42,0 +41,0 @@

@@ -44,3 +44,3 @@ 'use strict';

if (error || response.statusCode != 200) {
cb(utils.getError('DOWN'))
cb(utils.errorDown())
return

@@ -51,3 +51,3 @@ }

if (body.indexOf('Please insert the correct Tracking Number.') != -1) {
cb(utils.getError('NO_DATA'))
cb(utils.errorNoData())
return

@@ -60,4 +60,3 @@ }

} catch (error) {
console.log(id, error)
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -64,0 +63,0 @@

@@ -23,3 +23,3 @@ 'use strict';

if (error || response.statusCode > 200 && response.statusCode < 500) {
return cb(utils.getError('DOWN'))
return cb(utils.errorDown())
}

@@ -29,3 +29,3 @@

if (response.statusCode >= 500) { // ahah when the id is not valid they have an error
return cb(utils.getError('NO_DATA'))
return cb(utils.errorNoData())
}

@@ -38,4 +38,3 @@

} catch (error) {
console.log(id, error)
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -42,0 +41,0 @@

@@ -26,3 +26,3 @@ 'use strict';

if (error || response.statusCode != 200) {
cb(utils.getError('DOWN'))
cb(utils.errorDown())
return

@@ -33,3 +33,3 @@ }

if (body.indexOf('Order does not exist') != -1 || body.indexOf('one-parcel') == -1) {
cb(utils.getError('NO_DATA'))
cb(utils.errorNoData())
return

@@ -43,4 +43,3 @@ }

} catch (error) {
console.log(error);
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -47,0 +46,0 @@

@@ -37,3 +37,3 @@ 'use strict';

if (error || response.statusCode != 200) {
cb(utils.getError('DOWN'))
cb(utils.errorDown())
return

@@ -44,3 +44,3 @@ }

if (body.indexOf('errorMessage') != -1) {
cb(utils.getError('NO_DATA'))
cb(utils.errorNoData())
return

@@ -53,4 +53,3 @@ }

} catch (error) {
console.log(id, error)
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -57,0 +56,0 @@

@@ -39,11 +39,11 @@ 'use strict';

console.log('error:', error)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}
if (response.statusCode != 200) {
console.log('response.statusCode: ', response.statusCode)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}
if (body.indexOf('The shipment barcode was not found.') != -1){
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}

@@ -55,8 +55,7 @@

if (!entity) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}
entity.retries = response.attempts
} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -63,0 +62,0 @@

@@ -35,3 +35,3 @@ 'use strict';

if (error || response.statusCode != 200) {
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}

@@ -41,7 +41,7 @@

if (body.indexOf('Item status not found in the system.') != -1) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}
if(body.indexOf('This function is currently unavailable.') != -1) {
return callback(utils.getError('UNAVAILABLE'))
return callback(utils.errorUnavailable())
}

@@ -54,4 +54,3 @@

} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -58,0 +57,0 @@

@@ -25,3 +25,3 @@ 'use strict';

if (error || response.statusCode != 200) {
return callback(utils.getError('DOWN'))
return callback(utils.errorDown(id))
}

@@ -33,4 +33,3 @@

} catch (e) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, e.message))
}

@@ -41,3 +40,3 @@

(json.message == '<br/>' && json.List.row == null )) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}

@@ -59,3 +58,3 @@

// if(entity.messages.length == 0) // we should have messages!
// return callback(utils.getError('EMPTY'))
// return callback(utils.errorEmpty())

@@ -67,4 +66,3 @@ break

} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -71,0 +69,0 @@

@@ -48,3 +48,3 @@ 'use strict';

if (error || response.statusCode != 200) {
cb(utils.getError('DOWN'))
cb(utils.errorDown())
return

@@ -57,4 +57,3 @@ }

} catch (error) {
console.log(error);
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -66,3 +65,3 @@

data.data.events[0].operationAttributeTranslated == 'The track code is added to the database Track24.ru for automatic monitoring.')) {
cb(utils.getError('NO_DATA'))
cb(utils.errorNoData())
return

@@ -77,4 +76,3 @@ }

} catch (error) {
console.log(id, error)
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -81,0 +79,0 @@

@@ -23,3 +23,3 @@ 'use strict';

if (_try >= 4) {
return callback(utils.getError('BUSY'))
return callback(utils.errorBusy())
}

@@ -34,8 +34,7 @@ request.post({

if (error) {
console.log('error:', error)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}
if (response.statusCode != 200) {
console.log('response.statusCode: ', response.statusCode)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}

@@ -48,3 +47,3 @@

if (body.indexOf('is invalid') != -1 || body.indexOf('can not be longer than 13') != -1) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}

@@ -56,3 +55,3 @@

if (!entity) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}

@@ -62,4 +61,3 @@ entity.retries = response.attempts

} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -66,0 +64,0 @@

@@ -7,5 +7,6 @@ "use strict";

* @param type
* @param error Error message
* @returns {Error}
*/
module.exports.getError = function (type) {
const getErrorMessage = function(type, error = null, id = null) {
type = type.toUpperCase()

@@ -22,5 +23,38 @@ let errors = {

return new Error(type + ' - ' + errors[type])
let message = error != null ? error : errors[type]
message = id != null ? message + ' ID:' + id : message
return new Error(type + ' - ' + message)
}
module.exports.getError = getErrorMessage // old compatibility
module.exports.errorParser = function(id = null, error = null) {
return getErrorMessage('PARSER', error, id)
}
module.exports.errorEmpty = function(id = null, error = null) {
return getErrorMessage('EMPTY', error, id)
}
module.exports.errorNoData = function(id = null, error = null) {
return getErrorMessage('NO_DATA', error, id)
}
module.exports.errorBusy = function(id = null, error = null) {
return getErrorMessage('BUSY', error, id)
}
module.exports.errorUnavailable = function(id = null, error = null) {
return getErrorMessage('UNAVAILABLE', error, id)
}
module.exports.errorDown = function(id = null, error = null) {
return getErrorMessage('DOWN', error, id)
}
module.exports.errorActionRequired = function(id = null, error = null) {
return getErrorMessage('ACTION_REQUIRED', error, id)
}
/**

@@ -27,0 +61,0 @@ * Extract postal code from an id

@@ -32,3 +32,3 @@ 'use strict';

if (error || response.statusCode != 200) {
callback(utils.getError('DOWN'))
callback(utils.errorDown())
return

@@ -40,4 +40,3 @@ }

if (hidden.length == 0) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, "No hidden input __hash__"))
}

@@ -69,3 +68,3 @@

if (error || response.statusCode != 200) {
cb(utils.getError('DOWN'))
cb(utils.errorDown())
return

@@ -78,3 +77,3 @@ }

if (trs.length < 2) {
cb(utils.getError('NO_DATA'))
cb(utils.errorNoData())
return

@@ -89,4 +88,3 @@ }

} catch (error) {
console.log(id, error)
return cb(utils.getError('PARSER'))
return cb(utils.errorParser(id, error.message))
}

@@ -93,0 +91,0 @@

@@ -20,6 +20,3 @@ 'use strict';

*/
yanwen.getInfo = function (id, callback, _try = 0) {
if(_try >= 3){
return callback(utils.getError('BUSY'))
}
yanwen.getInfo = function (id, callback) {
request.post({

@@ -34,11 +31,11 @@ url: URL,

console.log('error:', error)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}
if (response.statusCode != 200) {
console.log('response.statusCode: ', response.statusCode)
return callback(utils.getError('DOWN'))
return callback(utils.errorDown())
}
if (body.indexOf('The shipment barcode was not found.') != -1){
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}

@@ -50,9 +47,7 @@

if (!entity) {
return callback(utils.getError('NO_DATA'))
return callback(utils.errorNoData())
}
entity.retries = response.attempts
entity.busy_count = _try
} catch (error) {
console.log(id, error)
return callback(utils.getError('PARSER'))
return callback(utils.errorParser(id, error.message))
}

@@ -59,0 +54,0 @@