diff --git a/README.md b/README.md index ae80df03..480a0767 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ * **Secure**: Retain total control of data, using **ClickHouse**, **DuckDB** or **InfluxDB** IOx with **S3** object storage * **Indepentent**: Opensource, Community powered, Anti lock-in alternative to Vendor controlled stacks -![lgtm_vs_qryn](https://github.com/metrico/qryn/assets/1423657/2e9071ba-c578-49fc-be1d-d91944a5891e) +
diff --git a/jest.config.js b/jest.config.js index 437c608e..85caef4e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,7 @@ const path = require('path') module.exports = { - setupFilesAfterEnv: [path.join(__dirname, '/test/jest.setup.js')] + setupFilesAfterEnv: [path.join(__dirname, '/test/jest.setup.js')], + moduleNameMapper: { + '^axios$': 'axios/dist/node/axios.cjs' + } } diff --git a/lib/db/clickhouse.js b/lib/db/clickhouse.js index 369212f4..f934708f 100644 --- a/lib/db/clickhouse.js +++ b/lib/db/clickhouse.js @@ -1363,12 +1363,27 @@ const samplesReadTable = { */ const rawRequest = async (query, data, database, config) => { try { + if (data && !(Buffer.isBuffer(data) || data instanceof Uint8Array || typeof data === 'string')) { + throw new Error('data must be Buffer, Uint8Array or String: currently the data is: ' + typeof data) + } + if (typeof data === 'string') { + data = Buffer.from(data, 'utf8') + } + if (typeof query !== 'string') { + throw new Error('query must be String: currently the query is: ' + typeof query) + } const getParams = [ (database ? `database=${encodeURIComponent(database)}` : null), (data ? `query=${encodeURIComponent(query)}` : null) ].filter(p => p) const url = `${getClickhouseUrl()}/${getParams.length ? `?${getParams.join('&')}` : ''}` - return await axios.post(url, data || query, config) + config = { + ...(config || {}), + method: 'post', + url: url, + data: data || query + } + return await axios(config) } catch (e) { logger.error('rawRequest error: ' + query) e.response?.data && logger.error(e.response.data.toString()) diff --git a/package-lock.json b/package-lock.json index 71207d81..eb128abd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@qxip/plugnplay": "^3.3.1", "@stricjs/router": "^5.0.6", "@stricjs/utils": "^1.6.1", - "axios": "^0.28.0", + "axios": "^1.6.8", "basic-auth": "^2.0.1", "bnf": "^1.0.1", "csv-writer": "^1.6.0", @@ -3574,11 +3574,11 @@ } }, "node_modules/axios": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.28.0.tgz", - "integrity": "sha512-Tu7NYoGY4Yoc7I+Npf9HhUMtEEpV7ZiLH9yndTCoNhcpBH0kwcvFbzYN9/u5QKI5A6uefjsNNWaz5olJVYS62Q==", + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", + "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } diff --git a/package.json b/package.json index b2fcc193..5fe5e2ce 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@qxip/influx-line-protocol-parser": "^0.2.1", "@qxip/plugnplay": "^3.3.1", "@stricjs/router": "^5.0.6", - "axios": "^0.28.0", + "axios": "^1.6.8", "bnf": "^1.0.1", "csv-writer": "^1.6.0", "date-fns": "^2.27.0", diff --git a/test/e2e b/test/e2e index 85e344c8..8847ca00 160000 --- a/test/e2e +++ b/test/e2e @@ -1 +1 @@ -Subproject commit 85e344c83efb747b123758212e216f9f6a355da2 +Subproject commit 8847ca00a0deda194008bb2d8dccc02d879267d2 diff --git a/traceql/traceql.bnf b/traceql/traceql.bnf index d9f21c12..366698ce 100644 --- a/traceql/traceql.bnf +++ b/traceql/traceql.bnf @@ -13,7 +13,7 @@ cmp ::= "="|"!="|"<="|">="|"<"|">" cmp_val ::= [] measurement ::= "ns"|"us"|"ms"|"s"|"m"|"h"|"d" -label_name ::= ("." | | "_") *("." | | "_" | ) +label_name ::= ("." | | "-" | "_") *("." | | "_" | "-" | ) number ::= ["-"] ["." ] attr_selector ::=