@weeb_services/wapi-core
Advanced tools
Comparing version 1.4.2 to 1.5.0
@@ -20,5 +20,5 @@ 'use strict' | ||
module.exports.Errors = { | ||
HttpError: require('./lib/structures/errors/HttpError'), | ||
HttpError: require('./lib/structures/errors/HttpError') | ||
} | ||
module.exports.ShutdownHandler = require('./lib/shutdownHandler') |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -6,7 +6,7 @@ const winston = require('winston') | ||
winston.format.align(), | ||
winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`), | ||
winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`) | ||
) | ||
module.exports = winston.createLogger({ | ||
transports: [new winston.transports.Console()], | ||
format: alignedWithColorsAndTime, | ||
format: alignedWithColorsAndTime | ||
}) |
@@ -7,3 +7,3 @@ 'use strict' | ||
const BaseMiddleware = require('./base.middleware') | ||
const {HTTPCodes} = require('../constants') | ||
const { HTTPCodes } = require('../constants') | ||
@@ -46,3 +46,3 @@ class AccountAPIMiddleware extends BaseMiddleware { | ||
method: 'get', | ||
headers: {'User-Agent': this.uagent} | ||
headers: { 'User-Agent': this.uagent } | ||
}) | ||
@@ -53,3 +53,3 @@ } catch (e) { | ||
} | ||
return {status: HTTPCodes.INTERNAL_SERVER_ERROR, message: 'Failed to contact Account API'} | ||
return { status: HTTPCodes.INTERNAL_SERVER_ERROR, message: 'Failed to contact Account API' } | ||
} | ||
@@ -56,0 +56,0 @@ |
@@ -5,3 +5,3 @@ 'use strict' | ||
const {HTTPCodes, DefaultResponses} = require('../constants') | ||
const { HTTPCodes, DefaultResponses } = require('../constants') | ||
const UrlPattern = require('url-pattern') | ||
@@ -15,3 +15,3 @@ | ||
getResponse (response) { | ||
if (typeof response === 'number') return {status: response, message: DefaultResponses[response]} | ||
if (typeof response === 'number') return { status: response, message: DefaultResponses[response] } | ||
if (!response.status) response.status = HTTPCodes.OK | ||
@@ -23,7 +23,7 @@ if (response.status !== HTTPCodes.OK && !response.message) response.message = DefaultResponses[response.status] | ||
async exec () { | ||
return {status: HTTPCodes.INTERNAL_SERVER_ERROR, message: 'Empty middleware'} | ||
return { status: HTTPCodes.INTERNAL_SERVER_ERROR, message: 'Empty middleware' } | ||
} | ||
whitelist (path, method) { | ||
this.whitelistArray.push({pattern: new UrlPattern(path), method: method || 'all'}) | ||
this.whitelistArray.push({ pattern: new UrlPattern(path), method: method || 'all' }) | ||
} | ||
@@ -30,0 +30,0 @@ |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -13,3 +13,3 @@ const Middleware = require('./base.middleware') | ||
async exec (req) { | ||
async exec (req, additionalData) { | ||
let ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress | ||
@@ -28,3 +28,3 @@ const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}` | ||
} | ||
const visitor = ua(this.trackingKey, {https: true}) | ||
const visitor = ua(this.trackingKey, { https: true }) | ||
const trackingData = { | ||
@@ -46,2 +46,6 @@ uid, | ||
} | ||
if (additionalData) { | ||
Object.assign(trackingData, additionalData) | ||
} | ||
visitor.pageview(trackingData, (err) => { | ||
@@ -52,3 +56,3 @@ if (err) { | ||
}) | ||
return {status: 200} | ||
return { status: 200 } | ||
} | ||
@@ -55,0 +59,0 @@ } |
@@ -10,3 +10,3 @@ const axios = require('axios') | ||
} | ||
this.agent = axios.create({baseURL: `http://${host}/v1/`, headers}) | ||
this.agent = axios.create({ baseURL: `http://${host}/v1/`, headers }) | ||
this.id = shortid.generate() | ||
@@ -16,3 +16,3 @@ } | ||
async register (name, tags, port, checks) { | ||
return this.agent.put('/agent/service/register', {name, id: `${name}-${this.id}`, tags, port, checks}) | ||
return this.agent.put('/agent/service/register', { name, id: `${name}-${this.id}`, tags, port, checks }) | ||
} | ||
@@ -19,0 +19,0 @@ |
@@ -9,4 +9,4 @@ 'use strict' | ||
this.all('/', async () => ({version, message})) | ||
this.all('/permnode', async () => ({apiIdentifier, permNodes})) | ||
this.all('/', async () => ({ version, message })) | ||
this.all('/permnode', async () => ({ apiIdentifier, permNodes })) | ||
} | ||
@@ -13,0 +13,0 @@ } |
@@ -0,0 +0,0 @@ 'use strict' |
@@ -56,2 +56,2 @@ 'use strict' | ||
module.exports = {buildFullyQualifiedScope, buildMissingScopeMessage, checkPermissions, checkScopes, isTrue} | ||
module.exports = { buildFullyQualifiedScope, buildMissingScopeMessage, checkPermissions, checkScopes, isTrue } |
{ | ||
"name": "@weeb_services/wapi-core", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"description": "Weeb API core", | ||
@@ -22,9 +22,9 @@ "main": "index.js", | ||
"dependencies": { | ||
"@moebius/http-graceful-shutdown": "^1.0.1", | ||
"axios": "^0.18.0", | ||
"express": "^4.16.3", | ||
"shortid": "^2.2.8", | ||
"universal-analytics": "^0.4.16", | ||
"@moebius/http-graceful-shutdown": "^1.1.0", | ||
"axios": "^0.19.2", | ||
"express": "^4.17.1", | ||
"shortid": "^2.2.15", | ||
"universal-analytics": "^0.4.20", | ||
"url-pattern": "^1.0.3", | ||
"winston": "^3.0.0-rc2" | ||
"winston": "^3.2.1" | ||
}, | ||
@@ -35,8 +35,8 @@ "engines": { | ||
"devDependencies": { | ||
"eslint": "^4.18.2", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.9.0", | ||
"eslint-plugin-node": "^6.0.1", | ||
"eslint-plugin-promise": "^3.7.0", | ||
"eslint-plugin-standard": "^3.0.1" | ||
"eslint": "^6.8.0", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.1" | ||
}, | ||
@@ -43,0 +43,0 @@ "bugs": { |
@@ -0,0 +0,0 @@ ![awoo](https://i.imgur.com/dTuYvKG.jpg) |
@@ -34,5 +34,5 @@ 'use strict' | ||
axios({ | ||
url: `http://localhost:12011`, | ||
url: 'http://localhost:12011', | ||
method: 'get', | ||
headers: {Authorization: `Bearer ${token}`} | ||
headers: { Authorization: `Bearer ${token}` } | ||
}) | ||
@@ -39,0 +39,0 @@ .then(response => { |
@@ -0,0 +0,0 @@ 'use strict' |
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
542
18676
21
+ Addedaxios@0.19.2(transitive)
- Removedaxios@0.18.1(transitive)
- Removedis-buffer@2.0.5(transitive)
Updatedaxios@^0.19.2
Updatedexpress@^4.17.1
Updatedshortid@^2.2.15
Updateduniversal-analytics@^0.4.20
Updatedwinston@^3.2.1