From 78e7061a36dbf9f7b791f689aa719cd1d03055f3 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 8 Mar 2024 11:54:48 +0200 Subject: [PATCH 1/5] Add PDFBufferUnderElectronCreationError class error --- workers/loc.api/errors/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/workers/loc.api/errors/index.js b/workers/loc.api/errors/index.js index d12fed4e..1ffc94af 100644 --- a/workers/loc.api/errors/index.js +++ b/workers/loc.api/errors/index.js @@ -178,6 +178,17 @@ class WeightedAveragesTimeframeError extends UnprocessableEntityError { } } +class PDFBufferUnderElectronCreationError extends BaseError { + constructor (electronErrStr) { + const _args = getErrorArgs( + { data: { electronErrStr } }, + 'ERR_PDF_BUFFER_UNDER_ELECTRON_HAS_NOT_BEEN_CREATED' + ) + + super(_args) + } +} + module.exports = { BaseError, BadRequestError, @@ -201,5 +212,6 @@ module.exports = { GrcSlackAvailabilityError, GrcPDFAvailabilityError, ImplementationError, - WeightedAveragesTimeframeError + WeightedAveragesTimeframeError, + PDFBufferUnderElectronCreationError } From 5a0c3cb6dc3fb1a90b20551f7a85a89b0546c7d9 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 8 Mar 2024 11:56:43 +0200 Subject: [PATCH 2/5] Add ability to handle PDFBufferUnderElectronCreationError in framework mode only --- workers/api.service.report.wrk.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/workers/api.service.report.wrk.js b/workers/api.service.report.wrk.js index 1003859d..57d2a906 100644 --- a/workers/api.service.report.wrk.js +++ b/workers/api.service.report.wrk.js @@ -46,6 +46,9 @@ const TYPES = require('./loc.api/di/types') const { setLoggerDeps } = require('./loc.api/logger/logger-deps') +const { + PDFBufferUnderElectronCreationError +} = require('./loc.api/errors') class WrkReportServiceApi extends WrkApi { constructor (conf, ctx) { @@ -209,6 +212,11 @@ class WrkReportServiceApi extends WrkApi { aggregatorQueue.on('job', aggregator) processorQueue.on('error:base', (err) => { + // This error is intercepted and processed in the framework mode + if (err instanceof PDFBufferUnderElectronCreationError) { + return + } + this.logger.error(`PROCESSOR:QUEUE: ${err.stack || err}`) }) aggregatorQueue.on('error:base', (err) => { From fc413ec2b36fb6c5c5b22a9bdf9d7e1ddfea4ad0 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Thu, 14 Mar 2024 13:43:09 +0200 Subject: [PATCH 3/5] Update gh actions to use nodejs v20 --- .github/workflows/ci.yml | 2 +- .github/workflows/test-report.yml | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61a748a0..687b6de2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: run: npm i - name: Run tests run: npm test -- --reporter=json --reporter-option output=test-report.json - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: success() || failure() with: name: test-results diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml index 925aaf43..2a50a6d6 100644 --- a/.github/workflows/test-report.yml +++ b/.github/workflows/test-report.yml @@ -17,13 +17,22 @@ jobs: name: Web Page Report runs-on: ubuntu-22.04 steps: - - uses: dorny/test-reporter@v1 + - name: Download test results + uses: actions/download-artifact@v4 + with: + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + name: test-results + path: test-results + - uses: dorny/test-reporter@v1.8.0 id: test-results with: - artifact: test-results name: Mocha Tests - path: test-report.json + path: test-results/test-report.json reporter: mocha-json + # Workaround for error 'fatal: not a git repository' caused by a call to 'git ls-files' + # See: https://github.com/dorny/test-reporter/issues/169#issuecomment-1583560458 + max-annotations: 0 - name: Test Report Summary run: | echo "### Test Report page is ready! :rocket:" >> $GITHUB_STEP_SUMMARY From 18ed80369551ee66e97e4834e8dafc47be465134 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 15 Mar 2024 15:05:33 +0200 Subject: [PATCH 4/5] Add missing translations for pdf reports --- .../pdf-writer/translations.yml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/workers/loc.api/generate-report-file/pdf-writer/translations.yml b/workers/loc.api/generate-report-file/pdf-writer/translations.yml index 8ba0d5b4..6969e504 100644 --- a/workers/loc.api/generate-report-file/pdf-writer/translations.yml +++ b/workers/loc.api/generate-report-file/pdf-writer/translations.yml @@ -27,3 +27,78 @@ ru: copyright: Авторское право © 2013-2024 iFinex Inc. Все права защищены. page: Стр. from: из + +zh-CN: + template: + title: 报告 + statementDetails: 结算明细 + statementDate: 结算日期 + snapshotAt: 快照时间 + period: 期间 + username: 用户名 + email: 电子邮箱 + errorMessage: 无法建立档案,请重试 + reportGenAt: 报告创建时间 + copyright: Copyright © 2013-2024 iFinex Inc. All rights reserved. + page: 页数 + from: 从 + +zh-TW: + template: + title: 報告 + statementDetails: 結算明細 + statementDate: 結算日期 + snapshotAt: 快照時間: + period: 期間 + username: 用戶名 + email: 電子郵箱 + errorMessage: 無法建立檔案,請重試 + reportGenAt: 報告建立時間: + copyright: Copyright © 2013-2024 iFinex Inc. All rights reserved. + page: 頁數 + from: 從 + +es-EM: + template: + title: Reporte + statementDetails: Detalles del Estado + statementDate: Fecha del Estado + snapshotAt: Captura al + period: Periodo + username: Nombre de Usuario + email: Correo + errorMessage: Tu archivo no pudo ser completado, por favor inténtalo de nuevo + reportGenAt: Reporte generado al + copyright: Copyright © 2013-2024 iFinex Inc. Todos los derechos reservados. + page: Página + from: de + +tr: + template: + title: Rapor + statementDetails: Beyanname Detayları + statementDate: Beyanname Tarihi + snapshotAt: 'Anlık Görüntü:' + period: Dönem + username: Kullanıcı Adı + email: Email + errorMessage: Dosyanız tamamlanamadı, lütfen tekrar deneyin + reportGenAt: 'Rapor şu tarihte oluşturuldu:' + copyright: Telif Hakkı © 2013-2024 iFinex Inc. Tüm hakları saklıdır. + page: Sayfa + from: İtibaren + +pt-BR: + template: + title: Informes + statementDetails: Detalhes da declaração + statementDate: Data da declaração + snapshotAt: Captura de + period: Período + username: Nome de Usuário + email: e-mail + errorMessage: Seu arquivo não pode ser completado, por favor tente novamente + reportGenAt: 'Informe gerado em ' + copyright: Copyright © 2013-2024 iFinex Inc. Todos os direitos reservados. + page: Página + from: de From af92eed76bc0e70c9dea6785bc8ffc62f39e993b Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 19 Mar 2024 13:10:38 +0200 Subject: [PATCH 5/5] Bump version up to 4.10.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8aae21ec..8c5c64ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-report", - "version": "4.9.0", + "version": "4.10.0", "description": "Reporting tool", "main": "worker.js", "license": "Apache-2.0",