diff --git a/README.md b/README.md index 5ce7fe8..3fd1408 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ Check the service with these examples (in the dev environment, replace 5607 with - [fallback to standard screenshot with custom filename](http://localhost:5607/api/v1/screenshot?key=capture&type=gif&filename=test.gif&target=http://localhost:5607/test/resources/test1.html) - [remote url with a webgl based map](http://localhost:5617/api/v1/print?key=capture&target=https://staging-koumoul.com/cadastre/parcel?id=56251000AV0142) +## Logging + +Logs go through the logger shared by the data-fair stack ([`@data-fair/lib-node/log.js`](https://github.com/data-fair/lib/tree/main/packages/node#logging)): one JSON object per line on stdout when `NODE_ENV=production` (the docker image), pretty output otherwise, `LOG_FORMAT=json|pretty` overrides. Warn, alert and error lines are counted in the `df_logs{level, code, host}` metric. `DEBUG=capture,timer` adds the debug lines of the capture steps and their durations. + ## Security Consider reading this article https://github.com/Zenika/alpine-chrome#3-ways-to-securely-use-chrome-headless-with-this-image diff --git a/api/index.ts b/api/index.ts index e50a802..c225bf6 100644 --- a/api/index.ts +++ b/api/index.ts @@ -1,17 +1,18 @@ +import log from '@data-fair/lib-node/log.js' import { start, stop } from './server.ts' start().then(() => {}, err => { - console.error('Failure while starting service', err) + log.error('failure while starting the service', { code: 'start-process', err }) process.exit(1) }) process.on('SIGTERM', function onSigterm () { - console.info('Received SIGTERM signal, shutdown gracefully...') + log.info('received SIGTERM signal, shutting down gracefully...') stop().then(() => { - console.log('shutting down now') + log.info('shutting down now') process.exit() }, err => { - console.error('Failure while stopping service', err) + log.error('failure while stopping the service', { code: 'stop-process', err }) process.exit(1) }) }) diff --git a/api/server.ts b/api/server.ts index 306fbfb..a90d464 100644 --- a/api/server.ts +++ b/api/server.ts @@ -1,6 +1,7 @@ import { createServer } from 'node:http' import { session } from '@data-fair/lib-express/index.js' import { startObserver, stopObserver } from '@data-fair/lib-node/observer.js' +import log from '@data-fair/lib-node/log.js' import eventPromise from '@data-fair/lib-utils/event-promise.js' import { createHttpTerminator } from 'http-terminator' import app from './app.ts' @@ -22,15 +23,15 @@ export const start = async () => { await pageUtils.start() if (config.observer.active) await startObserver(config.observer.port) if (config.privateDirectoryUrl) { - console.log('Configure with Simple Directory authentication') + log.info('configured with simple-directory authentication') session.init(config.privateDirectoryUrl) } else { - console.log('Configure without authentication, this instance of @data-fair/capture should not be exposed publicly') + log.warn('configured without authentication, this instance of @data-fair/capture should not be exposed publicly', { code: 'config-no-auth' }) } server.listen(config.port) await eventPromise(server, 'listening') - console.log(`API server listening on port ${config.port}`) + log.info(`API server listening on port ${config.port}`) } export const stop = async () => { diff --git a/api/utils/animation.ts b/api/utils/animation.ts index 42fb279..bc2c7aa 100644 --- a/api/utils/animation.ts +++ b/api/utils/animation.ts @@ -6,9 +6,11 @@ import { pipeline } from 'node:stream/promises' import GifEncoder from 'gif-encoder' import getPixelsCb from 'get-pixels' import { optimizeGif } from './gifsicle.ts' -import debug from 'debug' +import debugModule from 'debug' import { type Page } from 'puppeteer' +const debug = debugModule('capture') + const getPixels = promisify(getPixelsCb) export const capture = async (target: string, page: Page, width: number, height: number) => { diff --git a/api/utils/page.ts b/api/utils/page.ts index bb03376..b13cba8 100644 --- a/api/utils/page.ts +++ b/api/utils/page.ts @@ -3,6 +3,7 @@ import puppeteer, { type Viewport, type Browser, type BrowserContext, type Page, import genericPool, { type Factory, type Pool } from 'generic-pool' import { contextsCleanups } from './metrics.ts' import debugModule from 'debug' +import log from '@data-fair/lib-node/log.js' import { Timer } from './timer.ts' import { httpError } from '@data-fair/lib-express' @@ -19,7 +20,7 @@ export function contextPool () { } export const start = async () => { - console.log('init puppeteer browser', config.puppeteerLaunchOptions) + log.info('init puppeteer browser', { launchOptions: config.puppeteerLaunchOptions }) _browser = await puppeteer.launch(config.puppeteerLaunchOptions) const contextFactory: Factory = { async create () { @@ -36,14 +37,14 @@ export const start = async () => { // auto reconnection, cf https://github.com/GoogleChrome/puppeteer/issues/4428 _browser.on('disconnected', async () => { if (!_closed) { - console.log('Browser was disconnected for some reason, reconnect') + log.error('browser was disconnected, reconnect', { code: 'browser-disconnected' }) try { await _contextPool.drain() _contextPool.clear() } catch (err) { - console.log('Error while draining replaced contexts pool', err) + log.error('failure while draining the replaced contexts pool', { code: 'contexts-pool-drain', err }) } - exports.start() + start().catch(err => log.error('failure while restarting the browser', { code: 'browser-restart', err })) } }) } @@ -67,7 +68,7 @@ const debugPage = (page: Page) => { } if (args.length) debug(`[${page.url()}] console.${msg.type()}: `, ...args) } catch (err) { - console.error(`[${page.url()}] failed to parse console message: ${msg.text()}`, err) + log.warn('failed to parse a console message of a captured page', { code: 'page-console-parse', url: page.url(), err }) } }) page.on('pageerror', err => { @@ -202,7 +203,7 @@ const safeCleanContext = async (page: Page, openSuccess: boolean) => { await _contextPool.release(page.browserContext()) contextsCleanups.inc() } catch (err) { - console.error('Failed to clean page properly, do not reuse this context', err) + log.warn('failed to clean page properly, do not reuse this context', { code: 'page-clean', err }) await _contextPool.destroy(page.browserContext()) } } else { diff --git a/eslint.config.mjs b/eslint.config.mjs index 5971fb4..a00d79f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -4,5 +4,10 @@ import dfLibRecommended from '@data-fair/lib-utils/eslint/recommended.js' export default [ { ignores: ['**/.type/'] }, ...dfLibRecommended, - ...neostandard({ ts: true }) + ...neostandard({ ts: true }), + { + // server code logs through @data-fair/lib-node/log.js (its README, "Logging") + files: ['api/**/*.ts'], + rules: { 'no-console': 'error' } + } ] diff --git a/package-lock.json b/package-lock.json index e1059d2..245717a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "3.4.0", "license": "AGPL-3.0-only", "dependencies": { - "@data-fair/lib-express": "^1.34.1", - "@data-fair/lib-node": "^2.17.1", + "@data-fair/lib-express": "^2.0.0", + "@data-fair/lib-node": "^3.0.0", "@data-fair/lib-utils": "^1.14.1", "@data-fair/lib-validation": "^1.0.2", "config": "^5.0.1", @@ -43,6 +43,7 @@ "neostandard": "^0.14.1", "nodemon": "^3.1.14", "pdf-parse": "^2.4.5", + "pino-pretty": "^13.2.0", "typescript": "^6.0.3" }, "engines": { @@ -460,9 +461,9 @@ } }, "node_modules/@data-fair/lib-express": { - "version": "1.34.1", - "resolved": "https://registry.npmjs.org/@data-fair/lib-express/-/lib-express-1.34.1.tgz", - "integrity": "sha512-IEgcXC6xgdTquVxQG/eLA6FOn63HzQwldFQfgG0IYT2JxS6gqU3Wu0pQXsOUB2cbBcxMjz7SKCZmTtnyY8D6Hg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@data-fair/lib-express/-/lib-express-2.0.0.tgz", + "integrity": "sha512-Cgqvs5KaKWi7/XT0zSn0BgTcZVdeELeumzDDk9byYc9dAC/0Qx4FpwVopHi8kadgIvcL6IpSTerYPlFannD/zg==", "license": "MIT", "dependencies": { "@data-fair/lib-common-types": "^1.25.0", @@ -473,7 +474,7 @@ "serialize-javascript": "^7.0.0" }, "peerDependencies": { - "@data-fair/lib-node": "^2.16.0", + "@data-fair/lib-node": "^3.0.0", "express": "5", "ws": "8" }, @@ -484,9 +485,9 @@ } }, "node_modules/@data-fair/lib-node": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/@data-fair/lib-node/-/lib-node-2.17.1.tgz", - "integrity": "sha512-6+jadFjgh49BqXKUN6iTC2ynSnqAGF3d+piQCcDvHr77tpHcDEl1q5Dyp1xNijIymaX5ObdsiiCWg3QFkCC6DQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@data-fair/lib-node/-/lib-node-3.0.0.tgz", + "integrity": "sha512-kVFuDxUqSwlEyvIXSyviZYa7wTJiXc1RHVTnIjnk+yZafCA09D3aWNWpKbKvOtwxbAGYh3sBi0jGy91cX4xVag==", "license": "MIT", "dependencies": { "@data-fair/lib-common-types": "^1.25.0", @@ -496,13 +497,16 @@ "axios": "^1.7.7", "cacheable-lookup": "^7.0.0", "cookie": "^0.7.2", + "debug": "^4.4.3", "ipaddr.js": "^2.5.0", "jsonwebtoken": "^9.0.2", "jwks-rsa": "^3.1.0", + "pino": "^10.4.0", "semver": "^7.6.3" }, "peerDependencies": { "mongodb": "6", + "pino-pretty": "13", "prom-client": "15", "tough-cookie": "5", "ws": "8" @@ -511,6 +515,9 @@ "mongodb": { "optional": true }, + "pino-pretty": { + "optional": true + }, "prom-client": { "optional": true }, @@ -1011,6 +1018,12 @@ "node": ">=8.0.0" } }, + "node_modules/@pinojs/redact": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz", + "integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==", + "license": "MIT" + }, "node_modules/@puppeteer/browsers": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-3.2.6.tgz", @@ -1728,6 +1741,15 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "license": "MIT" }, + "node_modules/atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/axios": { "version": "1.21.0", "resolved": "https://registry.npmjs.org/axios/-/axios-1.21.0.tgz", @@ -2004,6 +2026,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "devOptional": true, + "license": "MIT" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -2198,6 +2227,16 @@ "integrity": "sha512-Cp+jOa8QJef5nXS5hU7M1DWzXPEIoVR3kbV0dQuVGwROZg8bGf1DcCnkmajBTnvghTtSNMUdRrPjgaT6ZQucbw==", "license": "MIT" }, + "node_modules/dateformat": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", + "integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -2306,6 +2345,16 @@ "url": "https://opencollective.com/express" } }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/enhanced-resolve": { "version": "5.26.1", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.26.1.tgz", @@ -2813,6 +2862,13 @@ "node": ">=6.6.0" } }, + "node_modules/fast-copy": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-4.3.1.tgz", + "integrity": "sha512-CRzQaTFOFUs6PuhsAq7lk9Zqr995soJBcFNZlfJS/5keTSl1awREV9dZW4xS2nX4pWbhIIR0xp4h+J8PQxCkvg==", + "devOptional": true, + "license": "MIT" + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2842,6 +2898,13 @@ "node": ">=10.0" } }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/fast-uri": { "version": "3.1.9", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz", @@ -3327,6 +3390,13 @@ "url": "https://github.com/sponsors/EvanHahn" } }, + "node_modules/help-me": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", + "integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==", + "devOptional": true, + "license": "MIT" + }, "node_modules/hookified": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", @@ -3618,6 +3688,16 @@ "url": "https://github.com/sponsors/panva" } }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/jpeg-js": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", @@ -3989,7 +4069,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, + "devOptional": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4246,6 +4326,15 @@ "integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==", "license": "MIT" }, + "node_modules/on-exit-leak-free": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", + "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/on-finished": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz", @@ -4502,6 +4591,78 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pino": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-10.4.0.tgz", + "integrity": "sha512-bk1ZMTwG/Vymx+zPoa28MhNzucFvXJWp3csrSuxuHPSMeUettaCoQ5Jvg07mtC4JGNpcfTwz41oVCnNgBK9+vA==", + "license": "MIT", + "dependencies": { + "@pinojs/redact": "^0.4.0", + "atomic-sleep": "^1.0.0", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "^3.0.0", + "pino-std-serializers": "^7.0.0", + "process-warning": "^5.0.0", + "quick-format-unescaped": "^4.0.3", + "real-require": "^1.0.0", + "safe-stable-stringify": "^2.3.1", + "sonic-boom": "^4.0.1", + "thread-stream": "^4.0.0" + }, + "bin": { + "pino": "bin.js" + } + }, + "node_modules/pino-abstract-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-3.0.0.tgz", + "integrity": "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==", + "license": "MIT", + "dependencies": { + "split2": "^4.0.0" + } + }, + "node_modules/pino-pretty": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-13.2.0.tgz", + "integrity": "sha512-jjghD1ML+Di/WxjJDz6j6Y4FT7hIXOlb8h27AyJ+ohtAXJXH4PS/xkv7si+RCCIW59HMgZsMKTDgzdr0RhuRrg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "colorette": "^2.0.7", + "dateformat": "^4.6.3", + "fast-copy": "^4.0.0", + "fast-safe-stringify": "^2.1.1", + "help-me": "^5.0.0", + "joycon": "^3.1.1", + "minimist": "^1.2.6", + "on-exit-leak-free": "^2.1.2", + "pino-abstract-transport": "^3.0.0", + "pump": "^3.0.3", + "secure-json-parse": "^4.1.0", + "sonic-boom": "^5.0.0", + "strip-json-comments": "^5.0.3" + }, + "bin": { + "pino-pretty": "bin.js" + } + }, + "node_modules/pino-pretty/node_modules/sonic-boom": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-5.0.2.tgz", + "integrity": "sha512-/JEruzo6yhNVhsLblTRchgTQHIt7SsdJP0YyrfWaNKjIOQDfrdZv9gwYraYCAsmKV39/LAdV31FLL5NCDpoL/A==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "atomic-sleep": "^1.0.0" + } + }, + "node_modules/pino-std-serializers": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.1.0.tgz", + "integrity": "sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==", + "license": "MIT" + }, "node_modules/pngjs": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", @@ -4537,6 +4698,22 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/process-warning": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.1.1.tgz", + "integrity": "sha512-oCkNVj4OKnKEcocVBcDfiIugN1/cE6rgfT3nCtzeqZPA8+rIxMaQ0xXzIkGP8Gj2qUaP1UR7uhJ1VD8lUCpzCg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, "node_modules/prom-client": { "version": "15.1.3", "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.3.tgz", @@ -4593,6 +4770,17 @@ "dev": true, "license": "MIT" }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -4677,6 +4865,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/quick-format-unescaped": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", + "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", + "license": "MIT" + }, "node_modules/range-parser": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz", @@ -4743,6 +4937,12 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/real-require": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-1.0.0.tgz", + "integrity": "sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g==", + "license": "MIT" + }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -4837,6 +5037,23 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "license": "MIT" }, + "node_modules/secure-json-parse": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-4.1.1.tgz", + "integrity": "sha512-lnd81MQEZKjhW/Gd2TQqdd4XP6QYNdDW/EP+I7nTrFHP9y2LmaGPIHk9xsnzcOiEr1c39c/e84xFgGviQKBTRw==", + "devOptional": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/semver": { "version": "7.8.6", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz", @@ -5023,6 +5240,24 @@ "node": ">=10" } }, + "node_modules/sonic-boom": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.1.tgz", + "integrity": "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q==", + "license": "MIT", + "dependencies": { + "atomic-sleep": "^1.0.0" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, "node_modules/statuses": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", @@ -5069,6 +5304,19 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, + "node_modules/strip-json-comments": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.0.3.tgz", + "integrity": "sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -5105,6 +5353,18 @@ "bintrees": "1.0.2" } }, + "node_modules/thread-stream": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-4.2.1.tgz", + "integrity": "sha512-Stg6edJXC/6/xqGwSXwFokrUhChJ18amEjpKH89WrQQ0oVFDF+pUUcTpiwWhFUrE89Vf16FBOlwhaw+lescxMQ==", + "license": "MIT", + "dependencies": { + "real-require": "^1.0.0" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", diff --git a/package.json b/package.json index 332b69f..b2e0c0a 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build-types": "df-build-types .", "dev-zellij": "df-dev zellij", "test": "npm run test-base test-it/*.ts", - "test-base": "NODE_ENV=test EVENTS_LOG_LEVEL=alert node --env-file-if-exists=.env --disable-warning=ExperimentalWarning --test-force-exit --test-concurrency=1 --test", + "test-base": "NODE_ENV=test node --env-file-if-exists=.env --disable-warning=ExperimentalWarning --test-force-exit --test-concurrency=1 --test", "lint": "eslint .", "lint-fix": "eslint --fix .", "check-types": "tsc", @@ -37,8 +37,8 @@ }, "homepage": "https://github.com/koumoul-dev/capture#readme", "dependencies": { - "@data-fair/lib-express": "^1.34.1", - "@data-fair/lib-node": "^2.17.1", + "@data-fair/lib-express": "^2.0.0", + "@data-fair/lib-node": "^3.0.0", "@data-fair/lib-utils": "^1.14.1", "@data-fair/lib-validation": "^1.0.2", "config": "^5.0.1", @@ -71,6 +71,7 @@ "neostandard": "^0.14.1", "nodemon": "^3.1.14", "pdf-parse": "^2.4.5", + "pino-pretty": "^13.2.0", "typescript": "^6.0.3" } }