Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release version to master #417

Merged
merged 10 commits into from
Dec 2, 2024
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bfx-report",
"version": "4.11.1",
"version": "4.11.2",
"description": "Reporting tool",
"main": "worker.js",
"license": "Apache-2.0",
Expand Down
9 changes: 5 additions & 4 deletions test/1-api.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ describe('API', () => {
assert.isObject(res.body.error)
assert.propertyVal(res.body.error, 'code', 401)
assert.propertyVal(res.body.error, 'message', 'Unauthorized')
assert.propertyVal(res.body.error, 'data', null)
assert.isObject(res.body.error.data)
assert.propertyVal(res.body, 'id', null)
assert.isString(res.body.jsonrpc)
})
Expand Down Expand Up @@ -1199,10 +1199,11 @@ describe('API', () => {
assert.isObject(res.body)
assert.isObject(res.body.error)
assert.propertyVal(res.body.error, 'code', 400)
assert.isArray(res.body.error.data)
assert.isAbove(res.body.error.data.length, 0)
assert.isObject(res.body.error.data)
assert.isArray(res.body.error.data.errorMetadata)
assert.isAbove(res.body.error.data.errorMetadata.length, 0)

res.body.error.data.forEach((item) => {
res.body.error.data.errorMetadata.forEach((item) => {
assert.isObject(item)
})

Expand Down
18 changes: 1 addition & 17 deletions workers/loc.api/helpers/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,7 @@ const dateFormat = {
'YYYY-MM-DD'
]
}
const language = {
type: 'string',
enum: [
'en',
'en-US',
'ru',
'zh-CN',
'zh-TW',
'tr',
'tr-TR',
'es',
'es-EM',
'pt',
'pt-PT',
'pt-BR'
]
}
const language = { type: 'string' }

const paramsSchemaForPayInvoiceList = {
...paramsSchemaForApi,
Expand Down
6 changes: 3 additions & 3 deletions workers/loc.api/i18next/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ module.exports = (params) => {
const configs = merge(
{
fallbackLng: {
es: ['es-EM'],
pt: ['pt-BR'],
zh: ['zh-CN'],
es: ['es-EM', 'en'],
pt: ['pt-BR', 'en'],
zh: ['zh-CN', 'en'],
default: ['en']
},
ns: Object.values(TRANSLATION_NAMESPACES),
Expand Down
26 changes: 19 additions & 7 deletions workers/loc.api/responder/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

const { omit } = require('lib-js-util-base')

const AbstractWSEventEmitter = require('../abstract.ws.event.emitter')

const {
Expand Down Expand Up @@ -130,7 +132,6 @@ const _getErrorWithMetadataForNonBaseError = (args, err) => {
err.message = err.message.replace(']', `,"${symbol}"]`)
err.statusCode = 500
err.statusMessage = `Invalid symbol error, '${symbol}' is not supported`
err.data = [{ symbol }]

return err
}
Expand Down Expand Up @@ -163,12 +164,23 @@ const _getErrorMetadata = (args, err, name) => {
const message = bfxApiErrorMessage
? `${statusMessage}: BFX API Error${bfxApiStatusText}${bfxApiRawBodyResponse}`
: statusMessage
const extendedData = bfxApiErrorMessage
? {
bfxApiErrorMessage,
...data
}
: data
const pubRequestParams = (
args?.params &&
typeof args?.params === 'object'
)
? omit(args.params, [
'id',
'subAccountApiKeys',
'subAccountPassword',
'addingSubUsers',
'removingSubUsersByEmails'
])
: args?.params ?? null
const extendedData = {
pubRequestParams,
bfxApiErrorMessage,
errorMetadata: data
}

const error = Object.assign(
errWithMetadata,
Expand Down
Loading