author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
305,159
30.10.2020 20:19:53
-3,600
cb57957d7043a7c6fa1f46e74667d473337a93c4
feat(core): optimize encoding
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -4,6 +4,7 @@ import {\nSendOptions,\nCommunicationObserver,\nHeaders,\n+ ChunkCombiner,\n} from '../../transport'\nimport pureJsChunkCombiner from '../pureJsChunkCombiner'\nimport {ConnectionOptions} from '../../options'\n@@ -11,11 +12,21 @@ import {HttpError} from '../../errors'\nimport completeCommunicationObserver from '../completeCommunicationObserver'\nimport Logger from '../Logger'\n+function createTextDecoderCombiner(): ChunkCombiner {\n+ const decoder = new TextDecoder('utf-8')\n+ return {\n+ concat: pureJsChunkCombiner.concat,\n+ copy: pureJsChunkCombiner.copy,\n+ toUtf8String(chunk: Uint8Array, start: number, end: number): string {\n+ return decoder.decode(chunk.subarray(start, end))\n+ },\n+ }\n+}\n/**\n* Transport layer that use browser fetch.\n*/\nexport default class FetchTransport implements Transport {\n- chunkCombiner = pureJsChunkCombiner\n+ chunkCombiner: ChunkCombiner = createTextDecoderCombiner()\nprivate defaultHeaders: {[key: string]: string}\nprivate url: string\nconstructor(private connectionOptions: ConnectionOptions) {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts", "new_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts", "diff": "@@ -386,4 +386,24 @@ describe('FetchTransport', () => {\n}\n)\n})\n+ describe('chunkCombiner', () => {\n+ const options = {url: 'http://test:8086'}\n+ const chunkCombiner = new FetchTransport(options).chunkCombiner\n+ it('concatenates UInt8Arrays', () => {\n+ const a1 = Uint8Array.from([1])\n+ const a2 = Uint8Array.from([2])\n+ expect(chunkCombiner.concat(a1, a2)).deep.equals(Uint8Array.from([1, 2]))\n+ })\n+ it('copies UInt8Arrays', () => {\n+ const a1 = Uint8Array.from([1, 2, 3])\n+ const copy = chunkCombiner.copy(a1, 1, 2)\n+ expect(copy).to.deep.equal(Uint8Array.from([2]))\n+ a1[1] = 3\n+ expect(copy[0]).equals(2)\n+ })\n+ it('creates UTF-8 strings', () => {\n+ const a1 = Uint8Array.from([97, 104, 111, 106])\n+ expect(chunkCombiner.toUtf8String(a1, 2, 3)).equals('o')\n+ })\n+ })\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): optimize UTF-8 encoding
305,159
30.10.2020 18:13:28
-3,600
d6d25e64248529ff295e50468edb4d337da50e0a
feat(giraffe): add giraffe tests to CI
[ { "change_type": "MODIFY", "old_path": ".circleci/config.yml", "new_path": ".circleci/config.yml", "diff": "@@ -30,23 +30,11 @@ jobs:\nname: Run tests\ncommand: |\nyarn build\n- cd ./packages/core\nyarn test:ci\n- yarn lint:ci\n- cd ../apis\n- yarn test\n- yarn eslint ../../examples\n- cd ../..\nyarn apidoc:ci\n# Upload results\n- store_test_results:\n- path: reports\n- - store_artifacts:\n- path: ./packages/core/reports/mocha/test-results.xml\n- - store_artifacts:\n- path: ./packages/core/reports/eslint/eslint.xml\n- - store_artifacts:\n- path: ./packages/core/reports/apidoc\n+ path: ./reports\ncoverage:\nparameters:\ndocker:\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"description\": \"InfluxDB 2.0 client\",\n\"workspaces\": {\n\"packages\": [\n- \"packages/*\"\n+ \"packages/core\",\n+ \"packages/core-browser\",\n+ \"packages/apis\",\n+ \"packages/giraffe\"\n]\n},\n\"scripts\": {\n\"apidoc:gh-pages\": \"gh-pages -d docs/dist -m 'Updates [skip CI]'\",\n\"preinstall\": \"node ./scripts/require-yarn.js\",\n\"clean\": \"rimraf temp docs && yarn workspaces run clean\",\n- \"build\": \"cd packages/core && yarn build && cd ../core-browser && yarn build && cd ../apis && yarn build\",\n- \"test\": \"cd packages/core && yarn test && yarn build && cd ../apis && yarn test && yarn eslint --ignore-pattern node_modules ../../examples\",\n+ \"build\": \"yarn workspaces run build\",\n+ \"test\": \"yarn --cwd packages/core build && yarn workspaces run test && yarn lint:examples\",\n+ \"test:ci\": \"yarn workspaces run test:ci && yarn lint:examples:ci\",\n\"coverage\": \"cd packages/core && yarn coverage\",\n- \"coverage:send\": \"cd packages/core && yarn coverage:send\"\n+ \"coverage:send\": \"cd packages/core && yarn coverage:send\",\n+ \"lint:examples\": \"yarn eslint --ignore-pattern node_modules ./examples\",\n+ \"lint:examples:ci\": \"yarn lint:examples --format junit --output-file ./reports/examples_eslint/eslint.xml\"\n},\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/package.json", "new_path": "packages/apis/package.json", "diff": "\"scripts\": {\n\"apidoc:extract\": \"api-extractor run\",\n\"build\": \"yarn run clean && yarn run lint && rollup -c\",\n- \"clean\": \"rimraf build doc dist\",\n+ \"clean\": \"rimraf build doc dist reports\",\n\"clean:apis\": \"rimraf src/generated/*API.ts\",\n\"generate\": \"yarn ts-node generator && yarn prettier --write src/generated/*.ts\",\n\"test\": \"yarn run lint && yarn run typecheck && yarn run test:unit\",\n\"test:unit\": \"mocha --require ts-node/register 'test/unit/**/*.test.ts' --exit\",\n+ \"test:ci\": \"yarn run lint:ci && yarn run test:unit --reporter mocha-junit-reporter --reporter-options mochaFile=../../reports/apis_mocha/test-results.xml\",\n\"typecheck\": \"tsc --noEmit --pretty\",\n\"lint\": \"eslint 'src/**/*.ts'\",\n+ \"lint:ci\": \"yarn run lint --format junit --output-file ../../reports/apis_eslint/eslint.xml\",\n\"lint:fix\": \"eslint --fix 'src/**/*.ts'\"\n},\n\"main\": \"dist/index.js\",\n" }, { "change_type": "MODIFY", "old_path": "packages/core-browser/package.json", "new_path": "packages/core-browser/package.json", "diff": "\"description\": \"InfluxDB 2.0 client for browser\",\n\"scripts\": {\n\"apidoc:extract\": \"echo \\\"Nothing to do\\\"\",\n+ \"test\": \"echo \\\"Nothing to do\\\"\",\n+ \"test:ci\": \"echo \\\"Nothing to do\\\"\",\n\"build\": \"yarn run clean && cpr ../core/dist ./dist\",\n\"clean\": \"rimraf dist\"\n},\n" }, { "change_type": "MODIFY", "old_path": "packages/core/package.json", "new_path": "packages/core/package.json", "diff": "\"test:all\": \"mocha --require ts-node/register 'test/**/*.test.ts' --exit\",\n\"test:unit\": \"mocha --require ts-node/register 'test/unit/**/*.test.ts' --exit\",\n\"test:integration\": \"mocha --require ts-node/register 'test/integration/**/*.test.ts' --exit\",\n- \"test:ci\": \"yarn run lint && yarn run test:all --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml\",\n+ \"test:ci\": \"yarn run lint:ci && yarn run test:all --exit --reporter mocha-junit-reporter --reporter-options mochaFile=../../reports/core_mocha/test-results.xml\",\n\"test:watch\": \"mocha --require ts-node/register 'test/unit/**/*.test.ts' --watch-extensions ts --watch\",\n\"typecheck\": \"tsc --noEmit --pretty\",\n\"lint\": \"eslint 'src/**/*.ts' 'test/**/*.ts'\",\n- \"lint:ci\": \"yarn run lint --format junit --output-file reports/eslint/eslint.xml\",\n+ \"lint:ci\": \"yarn run lint --format junit --output-file ../../reports/core_eslint/eslint.xml\",\n\"lint:fix\": \"eslint --fix 'src/**/*.ts'\"\n},\n\"main\": \"dist/index.js\",\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/package.json", "new_path": "packages/giraffe/package.json", "diff": "\"coverage\": \"nyc mocha --require ts-node/register 'test/**/*.test.ts' --exit\",\n\"test\": \"yarn run lint && yarn run typecheck && yarn run test:unit\",\n\"test:unit\": \"mocha --require ts-node/register 'test/unit/**/*.test.ts' --exit\",\n- \"test:ci\": \"yarn run lint && yarn run test:unit --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml\",\n+ \"test:ci\": \"yarn run lint:ci && yarn run test:unit --exit --reporter mocha-junit-reporter --reporter-options mochaFile=../../reports/giraffe_mocha/test-results.xml\",\n\"test:watch\": \"mocha --require ts-node/register 'test/unit/**/*.test.ts' --watch-extensions ts --watch\",\n\"typecheck\": \"tsc --noEmit --pretty\",\n\"lint\": \"eslint 'src/**/*.ts' 'test/**/*.ts'\",\n- \"lint:ci\": \"yarn run lint --format junit --output-file reports/eslint/eslint.xml\",\n+ \"lint:ci\": \"yarn run lint --format junit --output-file ../../reports/giraffe_eslint/eslint.xml\",\n\"lint:fix\": \"eslint --fix 'src/**/*.ts'\"\n},\n\"main\": \"dist/index.js\",\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/rollup.config.js", "new_path": "packages/giraffe/rollup.config.js", "diff": "@@ -3,7 +3,7 @@ import gzip from 'rollup-plugin-gzip'\nimport typescript from 'rollup-plugin-typescript2'\nimport pkg from './package.json'\n-const tsBuildConfigPath = './tsconfig.json'\n+const tsBuildConfigPath = './tsconfig.build.json'\nconst externalNodeModules = ['buffer', 'http', 'https', 'url', 'zlib']\nconst input = 'src/index.ts'\n" }, { "change_type": "ADD", "old_path": null, "new_path": "packages/giraffe/tsconfig.build.json", "diff": "+{\n+ \"extends\": \"./tsconfig.json\",\n+ \"compilerOptions\": {\n+ \"resolveJsonModule\": false,\n+ \"lib\": [\"es2015\", \"es2017\"],\n+ \"target\": \"es2015\"\n+ },\n+ \"include\": [\"src/**/*.ts\"]\n+}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(giraffe): add giraffe tests to CI
305,159
30.10.2020 18:49:32
-3,600
797602c759869c3d87771fd93c93138f60272519
feat(giraffe): add code coverage
[ { "change_type": "MODIFY", "old_path": ".circleci/config.yml", "new_path": ".circleci/config.yml", "diff": "@@ -46,7 +46,8 @@ jobs:\nname: Runs tests with coverage\ncommand: |\nyarn --version\n- yarn run coverage\n+ yarn run coverage:ci\n+ yarn run coverage:send\n- run:\nname: Report test results to codecov\ncommand: yarn run coverage:send\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"build\": \"yarn workspaces run build\",\n\"test\": \"yarn --cwd packages/core build && yarn workspaces run test && yarn lint:examples\",\n\"test:ci\": \"yarn workspaces run test:ci && yarn lint:examples:ci\",\n- \"coverage\": \"cd packages/core && yarn coverage\",\n- \"coverage:send\": \"cd packages/core && yarn coverage:send\",\n+ \"coverage\": \"cd packages/core && yarn build && yarn coverage && cd ../giraffe && yarn coverage\",\n+ \"coverage:ci\": \"cd packages/core && yarn build && yarn coverage:ci && cd ../giraffe && yarn coverage:ci\",\n+ \"coverage:send\": \"codecov\",\n\"lint:examples\": \"yarn eslint --ignore-pattern node_modules ./examples\",\n\"lint:examples:ci\": \"yarn lint:examples --format junit --output-file ./reports/examples_eslint/eslint.xml\"\n},\n\"license\": \"MIT\",\n\"dependencies\": {\n\"@microsoft/api-documenter\": \"^7.8.21\",\n+ \"codecov\": \"^3.6.1\",\n\"gh-pages\": \"^3.1.0\",\n\"lerna\": \"^3.20.2\",\n\"prettier\": \"^1.19.1\",\n" }, { "change_type": "MODIFY", "old_path": "packages/core/package.json", "new_path": "packages/core/package.json", "diff": "\"apidoc:extract\": \"api-extractor run\",\n\"build\": \"yarn run clean && rollup -c\",\n\"clean\": \"rimraf dist build coverage .nyc_output doc *.lcov reports\",\n- \"coverage:send\": \"yarn run --silent nyc report --reporter=text-lcov > coverage/coverage.lcov && codecov --root=../..\",\n\"coverage\": \"nyc mocha --require ts-node/register 'test/**/*.test.ts' --exit\",\n+ \"coverage:ci\": \"yarn run coverage && yarn run coverage:lcov\",\n+ \"coverage:lcov\": \"yarn run --silent nyc report --reporter=text-lcov > coverage/coverage.lcov\",\n\"test\": \"yarn run lint && yarn run typecheck && yarn run test:all\",\n\"test:all\": \"mocha --require ts-node/register 'test/**/*.test.ts' --exit\",\n\"test:unit\": \"mocha --require ts-node/register 'test/unit/**/*.test.ts' --exit\",\n\"@typescript-eslint/eslint-plugin\": \"^2.9.0\",\n\"@typescript-eslint/parser\": \"^2.9.0\",\n\"chai\": \"^4.2.0\",\n- \"codecov\": \"^3.6.1\",\n\"eslint\": \"^6.7.1\",\n\"eslint-config-prettier\": \"^6.7.0\",\n\"eslint-plugin-prettier\": \"^3.1.1\",\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/package.json", "new_path": "packages/giraffe/package.json", "diff": "\"build\": \"yarn run clean && rollup -c\",\n\"clean\": \"rimraf dist build coverage .nyc_output doc *.lcov reports\",\n\"coverage\": \"nyc mocha --require ts-node/register 'test/**/*.test.ts' --exit\",\n+ \"coverage:ci\": \"yarn run coverage && yarn run coverage:lcov\",\n+ \"coverage:lcov\": \"yarn run --silent nyc report --reporter=text-lcov > coverage/coverage.lcov\",\n\"test\": \"yarn run lint && yarn run typecheck && yarn run test:unit\",\n\"test:unit\": \"mocha --require ts-node/register 'test/unit/**/*.test.ts' --exit\",\n\"test:ci\": \"yarn run lint:ci && yarn run test:unit --exit --reporter mocha-junit-reporter --reporter-options mochaFile=../../reports/giraffe_mocha/test-results.xml\",\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(giraffe): add code coverage
305,159
02.11.2020 11:17:39
-3,600
b8f9034b490a9b996d68c7cf34963aac86cbc80f
feat(giraffe): add giraffe example
[ { "change_type": "MODIFY", "old_path": "examples/README.md", "new_path": "examples/README.md", "diff": "@@ -28,8 +28,10 @@ This directory contains javascript and typescript examples for node.js and brows\nShows how to control the way of how data points are written to InfluxDB.\n- Browser examples\n- Change `url` in [env.js](./env.js) to match your influxDB instance\n- - Change `token, org, bucket, username, password` variables in [./index.html](index.html) to match your influxDB instance\n+ - Change `token, org, bucket, username, password` variables in [./env_browser.js](env_browser.js) to match your influxDB instance\n- Run `npm run browser`\n- It starts a local HTTP server and opens [index.html](./index.html) that contains examples.\n+ It starts a local HTTP server and opens [index.html](./index.html) that contains client examples.\nThe local HTTP server serves all files from this git repository and also proxies requests\nto a configured influxDB database, see [scripts/server.js](./scripts/server.js) for details.\n+ - Click `Visualize with Giraffe Line Chart` to open [giraffe.html](./giraffe.html) that\n+ shows how to integrate with `@influxdata/giraffe`.\n" }, { "change_type": "ADD", "old_path": null, "new_path": "examples/env_browser.js", "diff": "+// eslint-disable-next-line no-undef\n+window.INFLUX_ENV = {\n+ /** InfluxDB v2 URL, '/influxdb' relies upon proxy to forward to the target influxDB */\n+ url: '/influx', //'http://localhost:8086'\n+ /** InfluxDB authorization token */\n+ token: 'my-token',\n+ /** Organization within InfluxDB */\n+ org: 'my-org',\n+ /**InfluxDB bucket used in examples */\n+ bucket: 'my-bucket',\n+ // ONLY onboarding example\n+ /**InfluxDB user */\n+ username: 'my-user',\n+ /**InfluxDB password */\n+ password: 'my-password',\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "examples/giraffe.html", "diff": "+<html>\n+ <head>\n+ <title>InfluxDB JavaScript Client - Giraffe Integration Example</title>\n+ <script>\n+ // required by react\n+ window.process = {\n+ env : 'development'\n+ }\n+ // required by giraffe\n+ global = window\n+ </script>\n+ <script src=\"https://unpkg.com/[email protected]/umd/react.development.js\"></script>\n+ <script src=\"https://unpkg.com/[email protected]/umd/react-dom.development.js\"></script>\n+ <script src=\"https://cdn.jsdelivr.net/npm/@influxdata/[email protected]/dist/index.js\"></script>\n+ <script src=\"https://unpkg.com/@influxdata/influxdb-client/dist/index.browser.js\"></script>\n+ <!-- TODO switch to https://unpkg.com/@influxdata/influxdb-client-giraffe/dist/index.js after the new client is released -->\n+ <script src=\"../packages/giraffe/dist/index.js\"></script>\n+ <script src=\"./env_browser.js\"></script>\n+ </head>\n+ <body>\n+ <h1>InfluxDB JavaScript Client - Giraffe Integration Example (since 1.9.0)</h1>\n+ <div style=\"display:flex; margin-bottom: 10px;\">\n+ <textarea id=\"fluxQuery\" style=\"flex: 1\" rows=\"2\"\n+ >from(bucket:\"my-bucket\") |> range(start: -1d) |> filter(fn: (r) => r._measurement == \"temperature\")</textarea>\n+ </div>\n+ <div style=\"width: 100%;height: 200px; border: 1px solid grey; margin-bottom: 10px;\" id=\"renderArea\">\n+ </div>\n+ <button id=\"reloadButton\">Reload</button>\n+ <button id=\"clientExamples\">Open InfluxDB JavaScript Client Examples</button>\n+ <script>\n+ // get query from request parameter or use default\n+ fluxQuery = new URLSearchParams(window.location.search).get('fluxQuery');\n+ if (!fluxQuery){\n+ fluxQuery = `from(bucket:\"my-bucket\") |> range(start: -1d) |> filter(fn: (r) => r._measurement == \"temperature\")`\n+ }\n+ const fluxQueryInput = document.getElementById('fluxQuery')\n+ fluxQueryInput.value = fluxQuery\n+\n+ // create query API\n+ const {url, token, org} = window.INFLUX_ENV // loaded in ./env_browser.js\n+ const influxDBClient = window['@influxdata/influxdb-client']\n+ const influxDB = new influxDBClient.InfluxDB({url, token})\n+ const queryApi = influxDB.getQueryApi(org)\n+\n+ // execute query and fill query data into giraffe table\n+ const giraffe = window['@influxdata/giraffe']\n+ // React functional component that renders query results or an error\n+ function RenderResults({error, table}){\n+ if (error){\n+ // render error message\n+ return React.createElement('center', null, error.toString())\n+ } else if (table.length) {\n+ // render giraffe plot\n+ const plotConfig = {\n+ table: table,\n+ layers: [{\n+ type: 'line',\n+ x: '_time',\n+ y: '_value'\n+ }],\n+ valueFormatters: {\n+ _time: giraffe.timeFormatter({\n+ timeZone: 'UTC',\n+ format: 'YYYY-MM-DD HH:mm:ss ZZ',\n+ }),\n+ }\n+ };\n+ return React.createElement(giraffe.Plot, {config: plotConfig})\n+ } else {\n+ // render empty table recevied\n+ return React.createElement('center', null, \"Empty Table Received\")\n+ }\n+ }\n+ const influxDBClientGiraffe = window['@influxdata/influxdb-client-giraffe']\n+ function queryAndVisualize() {\n+ influxDBClientGiraffe.queryTable(\n+ queryApi,\n+ fluxQueryInput.value,\n+ giraffe.newTable\n+ ). then(table => {\n+ console.log('queryTable returns', table)\n+ ReactDOM.render(\n+ React.createElement(RenderResults, {table}),\n+ document.getElementById('renderArea')\n+ );\n+ }). catch(error => {\n+ console.log('queryTable fails', error)\n+ ReactDOM.render(\n+ React.createElement(RenderResults, {error}),\n+ document.getElementById('renderArea')\n+ );\n+ })\n+ }\n+ queryAndVisualize()\n+ document.getElementById('reloadButton').addEventListener('click', () => {\n+ queryAndVisualize()\n+ })\n+ const clientExamples = document.getElementById('clientExamples')\n+ clientExamples.addEventListener('click', e => {\n+ const target = \"./index.html?fluxQuery=\"+encodeURIComponent(fluxQueryInput.value)\n+ window.open(target, \"_blank\")\n+ })\n+ </script>\n+ </body>\n+</html>\n" }, { "change_type": "MODIFY", "old_path": "examples/index.html", "new_path": "examples/index.html", "diff": "// import {InfluxDB, Point} from '../packages/core/dist/index.browser.mjs'\n// import {HealthAPI, SetupAPI} from '../packages/apis/dist/index.browser.mjs'\n- // rely upon proxy to forward to the target influxDB\n- const url = '/influx'\n- // example constants\n- const token = 'my-token'\n- const org = 'my-org'\n- const bucket = 'my-bucket'\n- const username = 'my-user' // onboarding example only\n- const password = 'my-password' // onboarding example only\n+ // import configuration from ./env_browser.js\n+ import './env_browser.js'\n+ const {url, token, org, bucket, username, password} = window.INFLUX_ENV\nconst influxDB = new InfluxDB({url, token})\nelse writeExample(number)\n})\nconst queryInput = document.getElementById('query');\n- const queryButton = document.getElementById('queryButton')\n- queryButton.addEventListener('click', () => {\n+ const fluxQueryParam = new URLSearchParams(window.location.search).get('fluxQuery');\n+ if (fluxQueryParam){\n+ queryInput.value = fluxQueryParam\n+ }\n+ document.getElementById('queryButton').addEventListener('click', () => {\nqueryExample(queryInput.value)\n})\ndocument.getElementById('onboardButton').addEventListener('click', () => {\ndocument.getElementById('healthButton').addEventListener('click', () => {\nhealthExample()\n})\n-\n+ const visualizeInGiraffe = document.getElementById('visualizeInGiraffe')\n+ visualizeInGiraffe.addEventListener('click', e => {\n+ const target = \"./giraffe.html?fluxQuery=\"+encodeURIComponent(queryInput.value)\n+ window.open(target, \"_blank\")\n+ })\n</script>\n</head>\n<h1>InfluxDB JavaScript Client Examples</h1>\n<hr>\n<div style=\"display:flex; margin-bottom: 10px;\">\n<textarea id=\"query\" style=\"flex: 1\" rows=\"2\"\n- >from(bucket:\"my-bucket\") |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")</textarea>\n+ >from(bucket:\"my-bucket\") |> range(start: -1d) |> filter(fn: (r) => r._measurement == \"temperature\")</textarea>\n</div>\n<button id=\"queryButton\">Query InfluxDB</button>\n+ <button id=\"visualizeInGiraffe\">Visualize with Giraffe Line Chart</button>\n<hr>\n<fieldset>\n<legend>Log</legend>\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(giraffe): add giraffe example
305,159
02.11.2020 11:43:46
-3,600
5409c15ca6ac47dcceb2e1ac345dc4b74f9bb287
chore(giraffe): note that giraffe integration is experimental
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -15,7 +15,7 @@ This repository contains the reference javascript client for InfluxDB 2.0. Both\n## Features\n-InfluxDB 2.0 client consists of two packages\n+InfluxDB 2.0 client consists of two main packages\n- @influxdata/influxdb-client\n- Querying data using the Flux language\n@@ -70,6 +70,7 @@ There are also more advanced [examples](./examples/README.md) that show\n- how to use this client in the browser\n- how to process InfluxDB query results with RX Observables\n- how to customize the way of how measurement points are written to InfluxDB\n+- how to visualize query results in giraffe\nThe client API Reference Documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/README.md", "new_path": "packages/giraffe/README.md", "diff": "@@ -19,3 +19,4 @@ const table = await queryTable(\n```\nSee https://github.com/influxdata/influxdb-client-js to know more.\n+This package is **experimental**, `@influxdata/giraffe` package may change until its first GA release.\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/src/index.ts", "new_path": "packages/giraffe/src/index.ts", "diff": "* ```\n*\n* See also {@link https://github.com/influxdata/influxdb-client-js/tree/master/examples | examples} to know more.\n+ * This package is **experimental**, the dependant `@influxdata/giraffe` package may change until its first GA release.\n*\n* @packageDocumentation\n*/\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): note that giraffe integration is experimental
305,159
02.11.2020 19:29:55
-3,600
42ab2fcb735684ef2c2203b34fbe76e1167b6345
feat(giraffe): improve package build
[ { "change_type": "MODIFY", "old_path": "examples/giraffe.html", "new_path": "examples/giraffe.html", "diff": "<html>\n<head>\n- <title>InfluxDB JavaScript Client - Giraffe Integration Example</title>\n+ <title>Example: Flux Query Results visualized with Giraffe</title>\n<script>\n// required by react\nwindow.process = {\n<script src=\"https://unpkg.com/[email protected]/umd/react-dom.development.js\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/@influxdata/[email protected]/dist/index.js\"></script>\n<script src=\"https://unpkg.com/@influxdata/influxdb-client/dist/index.browser.js\"></script>\n- <!-- TODO switch to https://unpkg.com/@influxdata/influxdb-client-giraffe/dist/index.js after the new client is released -->\n+ <!-- TODO switch to https://unpkg.com/@influxdata/influxdb-client-giraffe/dist/index.js after the package is released -->\n<script src=\"../packages/giraffe/dist/index.js\"></script>\n<script src=\"./env_browser.js\"></script>\n</head>\n<body>\n- <h1>InfluxDB JavaScript Client - Giraffe Integration Example (since 1.9.0)</h1>\n+ <h1>Example: Flux Query Results visualized with Giraffe</h1>\n+ <fieldset>\n+ <legend>Flux Query</legend>\n<div style=\"display:flex; margin-bottom: 10px;\">\n<textarea id=\"fluxQuery\" style=\"flex: 1\" rows=\"2\"\n>from(bucket:\"my-bucket\") |> range(start: -1d) |> filter(fn: (r) => r._measurement == \"temperature\")</textarea>\n</div>\n+ </fieldset>\n+ <fieldset>\n+ <legend>Giraffe Visualization</legend>\n<div style=\"width: 100%;height: 200px; border: 1px solid grey; margin-bottom: 10px;\" id=\"renderArea\">\n</div>\n+ </fieldset>\n<button id=\"reloadButton\">Reload</button>\n<button id=\"clientExamples\">Open InfluxDB JavaScript Client Examples</button>\n<script>\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/package.json", "new_path": "packages/giraffe/package.json", "diff": "},\n\"license\": \"MIT\",\n\"devDependencies\": {\n- \"@influxdata/giraffe\": \"0.41.0\",\n+ \"@influxdata/giraffe\": \"*\",\n\"@influxdata/influxdb-client\": \"1.8.0\",\n\"@microsoft/api-extractor\": \"^7.9.2\",\n\"@rollup/plugin-replace\": \"^2.3.0\",\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/rollup.config.js", "new_path": "packages/giraffe/rollup.config.js", "diff": "@@ -4,10 +4,9 @@ import typescript from 'rollup-plugin-typescript2'\nimport pkg from './package.json'\nconst tsBuildConfigPath = './tsconfig.build.json'\n-const externalNodeModules = ['buffer', 'http', 'https', 'url', 'zlib']\nconst input = 'src/index.ts'\n-function createConfig({browser, format, out, name, target, noTerser}) {\n+function createConfig({format, out, name, target, noTerser}) {\nreturn {\ninput,\nplugins: [\n@@ -29,26 +28,10 @@ function createConfig({browser, format, out, name, target, noTerser}) {\nformat: format,\nsourcemap: true,\n},\n- external: browser ? undefined : externalNodeModules,\n}\n}\nexport default [\n- createConfig({browser: false, format: 'umd', out: pkg.main}),\n- createConfig({browser: false, format: 'esm', out: pkg.module}),\n- createConfig({\n- browser: true,\n- format: 'iife',\n- name: 'influxdbToGiraffe',\n- out: 'dist/influxdbToGiraffe.min.js',\n- target: 'es5',\n- }),\n- createConfig({\n- browser: true,\n- format: 'iife',\n- name: 'influxdbToGiraffe',\n- out: 'dist/influxdbToGiraffe.js',\n- target: 'es5',\n- noTerser: true,\n- }),\n+ createConfig({format: 'umd', out: pkg.main}),\n+ createConfig({format: 'esm', out: pkg.module}),\n]\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "unique-filename \"^1.1.1\"\nwhich \"^1.3.1\"\n-\"@influxdata/[email protected]\":\n+\"@influxdata/giraffe@*\":\nversion \"0.41.0\"\nresolved \"https://registry.yarnpkg.com/@influxdata/giraffe/-/giraffe-0.41.0.tgz#b0ca4631bda8c0bea09b55374f5b3cfe48e1cb48\"\nintegrity sha512-M/xgbvIxmnxRtdCk6Ywh61n4DUNfd440t6+Iojipx0KOy6YylXk8MOVc7KWevi3nvreSI03MbjBnPL3ctVdMTQ==\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(giraffe): improve package build
305,159
03.11.2020 09:09:14
-3,600
23a80cb58eb0f0bd8a192f01968c5ae6e5970c34
chore(giraffe): review and improve code
[ { "change_type": "MODIFY", "old_path": "examples/README.md", "new_path": "examples/README.md", "diff": "@@ -34,4 +34,4 @@ This directory contains javascript and typescript examples for node.js and brows\nThe local HTTP server serves all files from this git repository and also proxies requests\nto a configured influxDB database, see [scripts/server.js](./scripts/server.js) for details.\n- Click `Visualize with Giraffe Line Chart` to open [giraffe.html](./giraffe.html) that\n- shows how to integrate with `@influxdata/giraffe`.\n+ shows how visualize query results with [@influxdata/giraffe](https://github.com/influxdata/giraffe).\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/README.md", "new_path": "packages/giraffe/README.md", "diff": "# @influxdata/influxdb-client-giraffe\n-The main goal of this package is to provide an efficient `queryTable` function that\n-queries InfluxDB (v2) and returns a Table that is then directly suitable as a data input\n-of various giraffe visualizations.\n+This package provides an efficient `queryToTable` function that queries\n+InfluxDB (v2) and returns a Table that is then directly suitable as a data input\n+of various [giraffe](https://github.com/influxdata/giraffe) visualizations.\n```js\nimport {InfluxDB} = from('@influxdata/influxdb-client')\n@@ -19,4 +19,4 @@ const table = await queryTable(\n```\nSee https://github.com/influxdata/influxdb-client-js to know more.\n-This package is **experimental**, `@influxdata/giraffe` package may change until its first GA release.\n+This package is **experimental**, `@influxdata/giraffe` package may change.\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/src/index.ts", "new_path": "packages/giraffe/src/index.ts", "diff": "* to a format that is used by {@link https://github.com/influxdata/giraffe | giraffe } to visualize the data.\n*\n* @remarks\n- * The main goal of this package is to provide an efficient {@link @influxdata/influxdb-client-giraffe#queryTable}\n+ * The main goal of this package is to provide an efficient {@link @influxdata/influxdb-client-giraffe#queryToTable}\n* function that executes a Flux query against InfluxDB (v2) and returns a Table that is then directly suitable\n* as a data input of various giraffe visualizations.\n*\n* ```js\n* import {InfluxDB} = from('@influxdata/influxdb-client')\n* import {queryTable} = from('@influxdata/influxdb-client-giraffe')\n- * import {newTable} = from('@influxdata/giraffe')\n+ * import {newTable, Plot} = from('@influxdata/giraffe')\n* ...\n* const queryApi = new InfluxDB({url, token}).getQueryApi(org)\n* const table = await queryTable(\n* {maxTableRows: 5000}\n* )\n* ...\n+ * <Plot config={{table, ...}}></Plot>\n+ * ...\n* ```\n*\n- * See also {@link https://github.com/influxdata/influxdb-client-js/tree/master/examples | examples} to know more.\n- * This package is **experimental**, the dependant `@influxdata/giraffe` package may change until its first GA release.\n+ * See also {@link https://github.com/influxdata/influxdb-client-js/tree/master/examples | client examples}\n+ * and {@link https://influxdata.github.io/giraffe/ | giraffe storybook }.\n*\n* @packageDocumentation\n*/\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/src/queryTable.ts", "new_path": "packages/giraffe/src/queryTable.ts", "diff": "@@ -20,26 +20,26 @@ export type GiraffeTableFactory = (length: number) => Table\n/**\n* Stores data and metadata of a result column.\n*/\n-interface ColumnStore {\n+interface Column {\n/** column name */\nname: string\n- /** column type */\n+ /** giraffe column type */\ntype: ColumnType\n/** flux data type */\nfluxDataType: FluxDataType\n/** column data */\ndata: ColumnData\n- /** converts string to column value */\n+ /** convert result row to column value */\ntoValue: (row: string[]) => number | string | boolean | null\n- /** marker to indicate that this column can have multiple keys */\n+ /** when true, it is a no-data column to indicate that multiple columns of the same label exist (distinguished also by column type) */\nmultipleTypes?: true\n- /** it this column part of the group key */\n+ /** group key membership of this column */\ngroup?: boolean\n}\nfunction createResult(\ntableLength: number,\n- columns: Record<string, ColumnStore>,\n+ columns: Record<string, Column>,\ntableFactory: GiraffeTableFactory,\ncomputeFluxGroupKeyUnion = false\n): FromFluxResult {\n@@ -71,7 +71,7 @@ function createResult(\n/**\n* AcceptRowFunction allows to accept/reject specific rows or terminate processing.\n* @param row - CSV result data row\n- * @param tableMeta - CSV table metadata including column definition\n+ * @param tableMeta - CSV table metadata with column descriptors\n* @returns true to accept row, false to skip row, undefined means stop processing\n**/\nexport type AcceptRowFunction = (\n@@ -100,22 +100,16 @@ export interface TableOptions {\n}\n/**\n- * QUERY_MAX_TABLE_LENGTH is a default max table length.\n+ * QUERY_MAX_TABLE_LENGTH is a default max table length,\n+ * it can be overriden in TableOptions.\n*/\nexport const QUERY_MAX_TABLE_LENGTH = 100_000\n/**\n- * DEFAULT_TABLE_OPTIONS allows to setup default maxTableLength.\n- */\n-export const DEFAULT_TABLE_OPTIONS: Pick<TableOptions, 'maxTableLength'> = {\n- maxTableLength: QUERY_MAX_TABLE_LENGTH,\n-}\n-\n-/**\n- * Create an accept function that stops processing\n+ * Creates an accept function that stops processing\n* if the table reaches the specified max rows.\n* @param size - maximum processed rows\n- * @returns AcceptRowFunction that enforces maximum\n+ * @returns AcceptRowFunction that enforces that most max rows are processed\n*/\nexport function acceptMaxTableLength(max: number): AcceptRowFunction {\nlet size = 0\n@@ -140,7 +134,7 @@ export function acceptMaxTableLength(max: number): AcceptRowFunction {\nfunction createAcceptRowFunction(options: TableOptions): AcceptRowFunction {\nconst maxTableLength =\noptions.maxTableLength === undefined\n- ? DEFAULT_TABLE_OPTIONS.maxTableLength\n+ ? QUERY_MAX_TABLE_LENGTH\n: options.maxTableLength\nconst acceptors: AcceptRowFunction[] = []\nif (options.accept) {\n@@ -150,9 +144,7 @@ function createAcceptRowFunction(options: TableOptions): AcceptRowFunction {\nacceptors.push(options.accept)\n}\n}\n- if (maxTableLength !== undefined) {\nacceptors.push(acceptMaxTableLength(maxTableLength))\n- }\nreturn (\nrow: string[],\n@@ -225,9 +217,9 @@ function toGiraffeColumnType(clientType: ClientColumnType): ColumnType {\n* @param resolve - called when the Table is collected\n* @param reject - called upon error\n* @param tableOptions - tableOptions allow to filter or even stop the processing of rows, or restrict the columns to collect\n- * @returns FluxResultObserver that collects rows to a table instance\n+ * @returns FluxResultObserver that collects table data from result rows\n*/\n-export function createFluxResultObserver(\n+export function createCollector(\nresolve: (value: FromFluxResult) => void,\nreject: (reason?: any) => void,\ntableFactory: GiraffeTableFactory,\n@@ -235,8 +227,8 @@ export function createFluxResultObserver(\n): FluxResultObserver<string[]> {\nconst {columns: onlyColumns} = tableOptions\nconst accept = createAcceptRowFunction(tableOptions)\n- const columns: Record<string, ColumnStore> = {}\n- let dataColumns: ColumnStore[]\n+ const columns: Record<string, Column> = {}\n+ let dataColumns: Column[]\nlet lastTableMeta: FluxTableMetaData | undefined = undefined\nlet tableSize = 0\nlet cancellable: Cancellable\n@@ -273,16 +265,12 @@ export function createFluxResultObserver(\ncolumns[\n`${existingColumn.name} (${existingColumn.type})`\n] = existingColumn\n- // occupy the column by a multiType virtual column\n+ // create a multiType (virtual) column\ncolumns[metaCol.label] = {\nname: metaCol.label,\n- type: existingColumn.type,\n- fluxDataType: existingColumn.fluxDataType,\n- data: [],\nmultipleTypes: true,\n- toValue: existingColumn.toValue, // not used\n- }\n- //\n+ // other values are not used\n+ } as Column\ncolumnKey = `${metaCol.label} (${type})`\nexistingColumn = columns[columnKey]\n}\n@@ -303,10 +291,11 @@ export function createFluxResultObserver(\n}\nfor (let i = 0; i < dataColumns.length; i++) {\nconst column = dataColumns[i]\n+ // cast is required because of wrong type definition in giraffe\ncolumn.data[tableSize] = column.toValue(row) as\n| string\n| number\n- | boolean // TODO wrong type definition in giraffe\n+ | boolean\n}\ntableSize++\n},\n@@ -342,14 +331,14 @@ export function createFluxResultObserver(\n}\n/**\n- * Executes a flux query and iterrativelly collects results into a giraffe's Table considering the TableOptions supplied.\n+ * Executes a flux query and collects results into a giraffe's Table.\n*\n* @param queryApi - InfluxDB client's QueryApi instance\n* @param query - query to execute\n- * @param tableOptions - tableOptions allows to filter or even stop the processing of rows, or restrict the columns to collect\n+ * @param tableOptions - tableOptions allows to filter or even stop the processing of rows, specify maximum rows or restrict the columns to collect.\n* @returns Promise with query results\n*/\n-export async function queryTable(\n+export async function queryToTable(\nqueryApi: QueryApi,\nquery: string | ParameterizedQuery,\ntableFactory: GiraffeTableFactory,\n@@ -358,21 +347,21 @@ export async function queryTable(\nconst result = await new Promise<FromFluxResult>((resolve, reject) => {\nqueryApi.queryRows(\nquery,\n- createFluxResultObserver(resolve, reject, tableFactory, tableOptions)\n+ createCollector(resolve, reject, tableFactory, tableOptions)\n)\n})\nreturn result.table\n}\n/**\n- * Executes a flux query and iterrativelly collects results into a giraffe's FromFluxResult considering the TableOptions supplied.\n+ * Executes a flux query and iterrativelly collects results into a giraffe's FromFluxResult.\n*\n* @param queryApi - InfluxDB client's QueryApi instance\n* @param query - query to execute\n- * @param tableOptions - tableOptions allows to filter or even stop the processing of rows, or restrict the columns to collect\n+ * @param tableOptions - tableOptions allows to filter or even stop the processing of rows, specify maximum rows or restrict the columns to collect\n* @returns a Promise with query results\n*/\n-export function queryFromFluxResult(\n+export function queryToFromFluxResult(\nqueryApi: QueryApi,\nquery: string | ParameterizedQuery,\ntableFactory: GiraffeTableFactory,\n@@ -381,7 +370,7 @@ export function queryFromFluxResult(\nreturn new Promise<FromFluxResult>((resolve, reject) => {\nqueryApi.queryRows(\nquery,\n- createFluxResultObserver(resolve, reject, tableFactory, {\n+ createCollector(resolve, reject, tableFactory, {\n...tableOptions,\ncomputeFluxGroupKeyUnion: true,\n})\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/test/unit/newTable.ts", "new_path": "packages/giraffe/test/unit/newTable.ts", "diff": "// WARNING: this simple table definition was taken from giraffe to ease testing that\n-// is impossible with a real giraffe (as of 0.41.0)\n+// is not feasible (inevitably complex) with a real giraffe (as of 0.41.0)\nimport {ColumnType, ColumnData, Table, FluxDataType} from '@influxdata/giraffe'\n// Don't export me!\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/test/unit/queryTable.test.ts", "new_path": "packages/giraffe/test/unit/queryTable.test.ts", "diff": "import {expect} from 'chai'\n-import {queryTable, DEFAULT_TABLE_OPTIONS, queryFromFluxResult} from '../../src'\n+import {queryToTable, queryToFromFluxResult} from '../../src'\n// @influxdata/influxdb-client uses node transport in tests (tests run in node), therefore nock is used to mock HTTP\nimport nock from 'nock'\nimport {Readable} from 'stream'\n@@ -8,7 +8,7 @@ import {newTable} from './newTable'\nconst url = 'http://test'\nconst queryApi = new InfluxDB({url}).getQueryApi('whatever')\n-describe('queryTable', () => {\n+describe('queryToTable', () => {\nbeforeEach(() => {\nnock.disableNetConnect()\n})\n@@ -39,7 +39,7 @@ describe('queryTable', () => {\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- const table = await queryTable(queryApi, 'ignored', newTable)\n+ const table = await queryToTable(queryApi, 'ignored', newTable)\nexpect(table.getColumn('result', 'string')).deep.equals([\n'_result',\n@@ -129,7 +129,7 @@ describe('queryTable', () => {\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- const actual = await queryTable(queryApi, 'ignored', newTable)\n+ const actual = await queryToTable(queryApi, 'ignored', newTable)\nexpect(actual.getColumn('result')).deep.equals(['_result', '_result'])\nexpect(actual.getColumn('a')).deep.equals(['usage_guest', 'usage_guest'])\n@@ -150,7 +150,7 @@ describe('queryTable', () => {\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- const table = await queryTable(queryApi, 'ignored', newTable)\n+ const table = await queryToTable(queryApi, 'ignored', newTable)\nexpect(table.getColumn('_value')).deep.equals([10, null])\n})\n@@ -179,7 +179,7 @@ there\",5\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- const table = await queryTable(queryApi, 'ignored', newTable)\n+ const table = await queryToTable(queryApi, 'ignored', newTable)\nexpect(table.getColumn('value')).deep.equals([5, 5, 6, 5, 5, 6])\n@@ -193,31 +193,19 @@ there\",5\n])\n})\ndescribe('tableOptions', () => {\n- let defaultMaxTableLength: number | undefined\n- beforeEach(() => {\n- defaultMaxTableLength = DEFAULT_TABLE_OPTIONS.maxTableLength\n- })\n- afterEach(() => {\n- DEFAULT_TABLE_OPTIONS.maxTableLength = defaultMaxTableLength\n- })\n- ;[\n- [0, undefined],\n- [1, 1],\n- [undefined, 3],\n- ].forEach(([length, wants]) => {\n+ ;[[1, 1]].forEach(([length, wants]) => {\nit(`uses default maxTableLength ${length}`, async () => {\nconst CSV = `#group,false\n#datatype,long\n#default,\n,result\n-,1\n-,2\n-,3`\n+,1`\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- DEFAULT_TABLE_OPTIONS.maxTableLength = length\n- const actual = await queryTable(queryApi, 'ignored', newTable)\n+ const actual = await queryToTable(queryApi, 'ignored', newTable, {\n+ maxTableLength: length,\n+ })\nexpect(actual.getColumn('result')?.length).deep.equals(wants)\n})\n@@ -225,7 +213,7 @@ there\",5\n;[\n[0, undefined],\n[1, 1],\n- [undefined, 2 /* because the default is set to 2 */],\n+ [undefined, 3 /* because the default is higher */],\n].forEach(([length, wants]) => {\nit(`uses custom maxTableLength ${length}`, async () => {\nconst CSV = `#group,false\n@@ -238,8 +226,7 @@ there\",5\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- DEFAULT_TABLE_OPTIONS.maxTableLength = 2\n- const actual = await queryTable(queryApi, 'ignored', newTable, {\n+ const actual = await queryToTable(queryApi, 'ignored', newTable, {\nmaxTableLength: length,\n})\n@@ -257,9 +244,9 @@ there\",5\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- DEFAULT_TABLE_OPTIONS.maxTableLength = 2\n- const actual = await queryTable(queryApi, 'ignored', newTable, {\n+ const actual = await queryToTable(queryApi, 'ignored', newTable, {\naccept: (row: string[]) => row[0] === '2',\n+ maxTableLength: 2,\n})\nexpect(actual.getColumn('result')).deep.equals([2])\n@@ -275,7 +262,7 @@ there\",5\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- const actual = await queryTable(queryApi, 'ignored', newTable, {\n+ const actual = await queryToTable(queryApi, 'ignored', newTable, {\naccept: [\n(row: string[]): boolean => Number(row[0]) < 3,\n(row: string[]): boolean => row[0] !== '1',\n@@ -295,7 +282,7 @@ there\",5\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- const actual = await queryTable(queryApi, 'ignored', newTable, {\n+ const actual = await queryToTable(queryApi, 'ignored', newTable, {\nmaxTableLength: 1,\naccept: (row: string[]) => Number(row[0]) > 1,\n})\n@@ -313,7 +300,7 @@ there\",5\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- const actual = await queryTable(queryApi, 'ignored', newTable, {\n+ const actual = await queryToTable(queryApi, 'ignored', newTable, {\ncolumns: ['a'],\n})\n@@ -323,7 +310,7 @@ there\",5\nnock(url)\n.post(/.*/)\n.reply(500, 'not ok')\n- await queryTable(queryApi, 'ignored', newTable)\n+ await queryToTable(queryApi, 'ignored', newTable)\n.then(() => {\nexpect.fail('must not succeed')\n})\n@@ -365,13 +352,13 @@ there\",5\n},\n},\n])\n- const actual = await queryTable(queryApi, 'ignored', newTable)\n+ const actual = await queryToTable(queryApi, 'ignored', newTable)\nexpect(actual.getColumn('result')).deep.equals([1, 2, 3])\n})\n})\n})\n-describe('queryFromFluxResult', () => {\n+describe('queryToFromFluxResult', () => {\nbeforeEach(() => {\nnock.disableNetConnect()\n})\n@@ -395,8 +382,8 @@ describe('queryFromFluxResult', () => {\nnock(url)\n.post(/.*/)\n.reply(200, CSV)\n- typeof queryFromFluxResult === 'function'\n- const {fluxGroupKeyUnion} = await queryFromFluxResult(\n+ typeof queryToFromFluxResult === 'function'\n+ const {fluxGroupKeyUnion} = await queryToFromFluxResult(\nqueryApi,\n'ignored',\nnewTable\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/tsconfig.json", "new_path": "packages/giraffe/tsconfig.json", "diff": "\"extends\": \"../../tsconfig.base.json\",\n\"compilerOptions\": {\n\"resolveJsonModule\": true,\n- \"lib\": [\"DOM\", \"es2015\"]\n+ \"lib\": [\"es2015\"]\n},\n\"include\": [\"src/**/*.ts\", \"test/**/*.ts\"],\n\"exclude\": [\"*.js\"]\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): review and improve code
305,159
03.11.2020 10:09:55
-3,600
251d0666a171ed0af9130acfc50367e4e33c6347
chore(core): rename tests for mocha to create valid junit xml
[ { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/pureJsChunkCombiner.test.ts", "new_path": "packages/core/test/unit/impl/pureJsChunkCombiner.test.ts", "diff": "@@ -33,7 +33,7 @@ describe('pureJsChunkCombiner', () => {\n['\\u{10348}', Uint8Array.from([0xf0, 0x90, 0x8d, 0x88])],\n]\nchunks.forEach(([str, chunk]) => {\n- it(`utf-8 encodes chunk ${str}`, () => {\n+ it(`utf-8 encodes chunk ${JSON.stringify(str)}`, () => {\n// console.log(Buffer.from(str as string, 'utf8'))\nconst encoded = pureJsChunkCombiner.toUtf8String(\nchunk as Uint8Array,\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): rename tests for mocha to create valid junit xml
305,159
03.11.2020 10:36:02
-3,600
7e6e770c6a35a47d6c946961eccbf13c77b2b6f8
chore(giraffe): improve comments and documentation
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -70,7 +70,7 @@ There are also more advanced [examples](./examples/README.md) that show\n- how to use this client in the browser\n- how to process InfluxDB query results with RX Observables\n- how to customize the way of how measurement points are written to InfluxDB\n-- how to visualize query results in giraffe\n+- how to visualize query results in [Giraffe](https://github.com/influxdata/giraffe)\nThe client API Reference Documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/README.md", "new_path": "packages/giraffe/README.md", "diff": "This package provides an efficient `queryToTable` function that queries\nInfluxDB (v2) and returns a Table that is then directly suitable as a data input\n-of various [giraffe](https://github.com/influxdata/giraffe) visualizations.\n+of various [Giraffe](https://github.com/influxdata/giraffe) visualizations.\n```js\n-import {InfluxDB} = from('@influxdata/influxdb-client')\n-import {queryTable} = from('@influxdata/influxdb-client-giraffe')\n-import {newTable} = from('@influxdata/giraffe')\n+import {InfluxDB} from '@influxdata/influxdb-client'\n+import {queryTable} from '@influxdata/influxdb-client-giraffe'\n+import {newTable, Plot} from '@influxdata/giraffe'\n...\nconst queryApi = new InfluxDB({url, token}).getQueryApi(org)\nconst table = await queryTable(\n@@ -16,7 +16,9 @@ const table = await queryTable(\nnewTable,\n{maxTableRows: 5000}\n)\n+...\n+<Plot config={{table, ...}}></Plot>\n+...\n```\nSee https://github.com/influxdata/influxdb-client-js to know more.\n-This package is **experimental**, `@influxdata/giraffe` package may change.\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/src/index.ts", "new_path": "packages/giraffe/src/index.ts", "diff": "/**\n* The `@influxdata/influxdb-client-giraffe` package transforms InfluxDB (Flux) query results\n- * to a format that is used by {@link https://github.com/influxdata/giraffe | giraffe } to visualize the data.\n+ * to a format that is used by {@link https://github.com/influxdata/giraffe | Giraffe } to visualize the data.\n*\n* @remarks\n* The main goal of this package is to provide an efficient {@link @influxdata/influxdb-client-giraffe#queryToTable}\n* function that executes a Flux query against InfluxDB (v2) and returns a Table that is then directly suitable\n- * as a data input of various giraffe visualizations.\n+ * as a data input of various Giraffe visualizations.\n*\n* ```js\n- * import {InfluxDB} = from('@influxdata/influxdb-client')\n- * import {queryTable} = from('@influxdata/influxdb-client-giraffe')\n- * import {newTable, Plot} = from('@influxdata/giraffe')\n+ * import {InfluxDB} from '@influxdata/influxdb-client'\n+ * import {queryTable} from '@influxdata/influxdb-client-giraffe'\n+ * import {newTable, Plot} from '@influxdata/giraffe'\n* ...\n* const queryApi = new InfluxDB({url, token}).getQueryApi(org)\n* const table = await queryTable(\n* ...\n* ```\n*\n- * See also {@link https://github.com/influxdata/influxdb-client-js/tree/master/examples | client examples}\n- * and {@link https://influxdata.github.io/giraffe/ | giraffe storybook }.\n+ * See also {@link https://github.com/influxdata/influxdb-client-js/tree/master/examples | InfluxDB v2 client examples}\n+ * and {@link https://influxdata.github.io/giraffe/ | Giraffe storybook }.\n*\n* @packageDocumentation\n*/\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/src/queryTable.ts", "new_path": "packages/giraffe/src/queryTable.ts", "diff": "@@ -291,7 +291,7 @@ export function createCollector(\n}\nfor (let i = 0; i < dataColumns.length; i++) {\nconst column = dataColumns[i]\n- // cast is required because of wrong type definition in giraffe\n+ // cast is required because of wrong type definition in Giraffe\ncolumn.data[tableSize] = column.toValue(row) as\n| string\n| number\n@@ -331,7 +331,7 @@ export function createCollector(\n}\n/**\n- * Executes a flux query and collects results into a giraffe's Table.\n+ * Executes a flux query and collects results into a Giraffe's Table.\n*\n* @param queryApi - InfluxDB client's QueryApi instance\n* @param query - query to execute\n@@ -354,7 +354,7 @@ export async function queryToTable(\n}\n/**\n- * Executes a flux query and iterrativelly collects results into a giraffe's FromFluxResult.\n+ * Executes a flux query and iterrativelly collects results into a Giraffe's FromFluxResult.\n*\n* @param queryApi - InfluxDB client's QueryApi instance\n* @param query - query to execute\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/test/unit/newTable.ts", "new_path": "packages/giraffe/test/unit/newTable.ts", "diff": "-// WARNING: this simple table definition was taken from giraffe to ease testing that\n-// is not feasible (inevitably complex) with a real giraffe (as of 0.41.0)\n+// WARNING: this simple table definition was taken from Giraffe to ease testing that\n+// is not feasible (inevitably complex) with a real Giraffe (as of 0.41.0)\nimport {ColumnType, ColumnData, Table, FluxDataType} from '@influxdata/giraffe'\n// Don't export me!\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): improve comments and documentation
305,159
03.11.2020 14:13:42
-3,600
bb0be98bd12a85d7569fb24cc07e4b92f5e1d649
chore(giraffe): repair readme
[ { "change_type": "MODIFY", "old_path": "examples/giraffe.html", "new_path": "examples/giraffe.html", "diff": "}\nconst influxDBClientGiraffe = window['@influxdata/influxdb-client-giraffe']\nfunction queryAndVisualize() {\n- influxDBClientGiraffe.queryTable(\n+ influxDBClientGiraffe.queryToTable(\nqueryApi,\nfluxQueryInput.value,\ngiraffe.newTable\n). then(table => {\n- console.log('queryTable returns', table)\n+ console.log('queryToTable returns', table)\nReactDOM.render(\nReact.createElement(RenderResults, {table}),\ndocument.getElementById('renderArea')\n);\n}). catch(error => {\n- console.log('queryTable fails', error)\n+ console.log('queryToTable fails', error)\nReactDOM.render(\nReact.createElement(RenderResults, {error}),\ndocument.getElementById('renderArea')\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/README.md", "new_path": "packages/giraffe/README.md", "diff": "@@ -10,7 +10,7 @@ import {queryTable} from '@influxdata/influxdb-client-giraffe'\nimport {newTable, Plot} from '@influxdata/giraffe'\n...\nconst queryApi = new InfluxDB({url, token}).getQueryApi(org)\n-const table = await queryTable(\n+const table = await queryToTable(\napi,\n'from(bucket: \"my-bucket\") |> range(start: -30d)',\nnewTable,\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/src/index.ts", "new_path": "packages/giraffe/src/index.ts", "diff": "* import {newTable, Plot} from '@influxdata/giraffe'\n* ...\n* const queryApi = new InfluxDB({url, token}).getQueryApi(org)\n- * const table = await queryTable(\n+ * const table = await queryToTable(\n* api,\n* 'from(bucket: \"my-bucket\") |> range(start: -30d)',\n* newTable,\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): repair readme
305,159
03.11.2020 14:21:05
-3,600
68a1d0df7a55172028ee5e12e798b2567be73fb7
chore(giraffe): repair example
[ { "change_type": "MODIFY", "old_path": "packages/giraffe/README.md", "new_path": "packages/giraffe/README.md", "diff": "@@ -6,7 +6,7 @@ of various [Giraffe](https://github.com/influxdata/giraffe) visualizations.\n```js\nimport {InfluxDB} from '@influxdata/influxdb-client'\n-import {queryTable} from '@influxdata/influxdb-client-giraffe'\n+import {queryToTable} from '@influxdata/influxdb-client-giraffe'\nimport {newTable, Plot} from '@influxdata/giraffe'\n...\nconst queryApi = new InfluxDB({url, token}).getQueryApi(org)\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/src/index.ts", "new_path": "packages/giraffe/src/index.ts", "diff": "*\n* ```js\n* import {InfluxDB} from '@influxdata/influxdb-client'\n- * import {queryTable} from '@influxdata/influxdb-client-giraffe'\n+ * import {queryToTable} from '@influxdata/influxdb-client-giraffe'\n* import {newTable, Plot} from '@influxdata/giraffe'\n* ...\n* const queryApi = new InfluxDB({url, token}).getQueryApi(org)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): repair example
305,159
03.11.2020 22:25:41
-3,600
de410cad08065f5b4e76589904cd016208a03c4f
chore(giraffe): use unpkg.com url
[ { "change_type": "MODIFY", "old_path": "examples/giraffe.html", "new_path": "examples/giraffe.html", "diff": "<script src=\"https://unpkg.com/[email protected]/umd/react-dom.development.js\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/@influxdata/[email protected]/dist/index.js\"></script>\n<script src=\"https://unpkg.com/@influxdata/influxdb-client/dist/index.browser.js\"></script>\n- <!-- TODO switch to https://unpkg.com/@influxdata/influxdb-client-giraffe/dist/index.js after the package is released -->\n- <script src=\"../packages/giraffe/dist/index.js\"></script>\n+ <script src=\"https://unpkg.com/@influxdata/influxdb-client-giraffe/dist/index.js\"></script>\n<script src=\"./env_browser.js\"></script>\n</head>\n<body>\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): use unpkg.com url
305,159
03.11.2020 17:36:38
-3,600
8d3f936e5d42d09bab2dbc1753a889a1e9868529
feat(giraffe): add csvToTable transformation
[ { "change_type": "ADD", "old_path": null, "new_path": "packages/giraffe/src/csvToTable.ts", "diff": "+import {Table, FromFluxResult} from '@influxdata/giraffe'\n+import {stringToLines, linesToTables} from '@influxdata/influxdb-client'\n+import {createCollector, GiraffeTableFactory, TableOptions} from './queryTable'\n+\n+/**\n+ * Transforms annotated CSV query response to Giraffe's FromFluxResult.\n+ *\n+ * @param csv - annotated CSV flux query response\n+ * @param tableFactory - creates a new Giraffe table\n+ * @param tableOptions - tableOptions allows to filter or even stop the processing of rows, specify maximum rows or restrict the columns to collect\n+ * @returns a new FromFluxResult instance\n+ * @throws Error when unable to parse\n+ */\n+export function csvToFromFluxResult(\n+ csv: string,\n+ tableFactory: GiraffeTableFactory,\n+ tableOptions?: TableOptions\n+): FromFluxResult {\n+ let result: FromFluxResult | undefined\n+ let error: Error | undefined = undefined\n+ const collector = createCollector(\n+ r => (result = r),\n+ e => (error = e),\n+ tableFactory,\n+ tableOptions\n+ )\n+ stringToLines(csv, linesToTables(collector))\n+ if (error) {\n+ throw error\n+ } else {\n+ return result as FromFluxResult\n+ }\n+}\n+\n+/**\n+ * Transforms annotated CSV query response to Giraffe's Table.\n+ *\n+ * @param csv - annotated CSV flux query response\n+ * @param tableFactory - creates a new Giraffe table\n+ * @param tableOptions - tableOptions allows to filter or even stop the processing of rows, specify maximum rows or restrict the columns to collect.\n+ * @returns a new Table instance\n+ * @throws Error when unable to parse\n+ */\n+export function csvToTable(\n+ csv: string,\n+ tableFactory: GiraffeTableFactory,\n+ tableOptions?: TableOptions\n+): Table {\n+ return csvToFromFluxResult(csv, tableFactory, tableOptions).table\n+}\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/src/index.ts", "new_path": "packages/giraffe/src/index.ts", "diff": "* @packageDocumentation\n*/\nexport * from './queryTable'\n+export * from './csvToTable'\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/src/queryTable.ts", "new_path": "packages/giraffe/src/queryTable.ts", "diff": "@@ -335,6 +335,7 @@ export function createCollector(\n*\n* @param queryApi - InfluxDB client's QueryApi instance\n* @param query - query to execute\n+ * @param tableFactory - creates a new Giraffe table\n* @param tableOptions - tableOptions allows to filter or even stop the processing of rows, specify maximum rows or restrict the columns to collect.\n* @returns Promise with query results\n*/\n@@ -358,6 +359,7 @@ export async function queryToTable(\n*\n* @param queryApi - InfluxDB client's QueryApi instance\n* @param query - query to execute\n+ * @param tableFactory - creates a new Giraffe table\n* @param tableOptions - tableOptions allows to filter or even stop the processing of rows, specify maximum rows or restrict the columns to collect\n* @returns a Promise with query results\n*/\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(giraffe): add csvToTable transformation
305,159
03.11.2020 17:42:34
-3,600
260c7e1c6691ab8db312b9c4346492f9cdfc6914
feat(giraffe): include csv processing parts into build
[ { "change_type": "MODIFY", "old_path": "packages/giraffe/package.json", "new_path": "packages/giraffe/package.json", "diff": "\"sinon\": \"^7.5.0\",\n\"ts-node\": \"^8.5.4\",\n\"typescript\": \"^3.7.4\"\n+ },\n+ \"dependencies\": {\n+ \"@rollup/plugin-node-resolve\": \"^10.0.0\"\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/rollup.config.js", "new_path": "packages/giraffe/rollup.config.js", "diff": "@@ -2,6 +2,7 @@ import {terser} from 'rollup-plugin-terser'\nimport gzip from 'rollup-plugin-gzip'\nimport typescript from 'rollup-plugin-typescript2'\nimport pkg from './package.json'\n+import resolve from '@rollup/plugin-node-resolve'\nconst tsBuildConfigPath = './tsconfig.build.json'\n@@ -19,6 +20,9 @@ function createConfig({format, out, name, target, noTerser}) {\n},\n},\n}),\n+ // @influxdata/influxdb-client (core) package uses `module:browser`\n+ // property in its package.json to point to a ES module build created for the browser\n+ resolve({mainFields: ['module:browser']}),\nnoTerser ? undefined : terser(),\ngzip(),\n],\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "dependencies:\n\"@types/node\" \">= 8\"\n+\"@rollup/plugin-node-resolve@^10.0.0\":\n+ version \"10.0.0\"\n+ resolved \"https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-10.0.0.tgz#44064a2b98df7530e66acf8941ff262fc9b4ead8\"\n+ integrity sha512-sNijGta8fqzwA1VwUEtTvWCx2E7qC70NMsDh4ZG13byAXYigBNZMxALhKUSycBks5gupJdq0lFrKumFrRZ8H3A==\n+ dependencies:\n+ \"@rollup/pluginutils\" \"^3.1.0\"\n+ \"@types/resolve\" \"1.17.1\"\n+ builtin-modules \"^3.1.0\"\n+ deepmerge \"^4.2.2\"\n+ is-module \"^1.0.0\"\n+ resolve \"^1.17.0\"\n+\n\"@rollup/plugin-replace@^2.3.0\":\nversion \"2.3.3\"\nresolved \"https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-2.3.3.tgz#cd6bae39444de119f5d905322b91ebd4078562e7\"\n\"@types/prop-types\" \"*\"\ncsstype \"^3.0.2\"\n+\"@types/[email protected]\":\n+ version \"1.17.1\"\n+ resolved \"https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6\"\n+ integrity sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==\n+ dependencies:\n+ \"@types/node\" \"*\"\n+\n\"@types/sinon@^7.5.1\":\nversion \"7.5.2\"\nresolved \"https://registry.yarnpkg.com/@types/sinon/-/sinon-7.5.2.tgz#5e2f1d120f07b9cda07e5dedd4f3bf8888fccdb9\"\n@@ -1757,6 +1776,11 @@ buffer-from@^1.0.0:\nresolved \"https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef\"\nintegrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==\n+builtin-modules@^3.1.0:\n+ version \"3.1.0\"\n+ resolved \"https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484\"\n+ integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==\n+\nbuiltins@^1.0.3:\nversion \"1.0.3\"\nresolved \"https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88\"\n@@ -2426,6 +2450,11 @@ deep-is@~0.1.3:\nresolved \"https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34\"\nintegrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=\n+deepmerge@^4.2.2:\n+ version \"4.2.2\"\n+ resolved \"https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955\"\n+ integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==\n+\ndefault-require-extensions@^3.0.0:\nversion \"3.0.0\"\nresolved \"https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-3.0.0.tgz#e03f93aac9b2b6443fc52e5e4a37b3ad9ad8df96\"\n@@ -3828,6 +3857,13 @@ is-ci@^2.0.0:\ndependencies:\nci-info \"^2.0.0\"\n+is-core-module@^2.0.0:\n+ version \"2.0.0\"\n+ resolved \"https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.0.0.tgz#58531b70aed1db7c0e8d4eb1a0a2d1ddd64bd12d\"\n+ integrity sha512-jq1AH6C8MuteOoBPwkxHafmByhL9j5q4OaPGdbuD+ZtQJVzH+i6E3BJDQcBA09k57i2Hh2yQbEG8yObZ0jdlWw==\n+ dependencies:\n+ has \"^1.0.3\"\n+\nis-data-descriptor@^0.1.4:\nversion \"0.1.4\"\nresolved \"https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56\"\n@@ -3923,6 +3959,11 @@ is-glob@^4.0.0, is-glob@^4.0.1:\ndependencies:\nis-extglob \"^2.1.1\"\n+is-module@^1.0.0:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591\"\n+ integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=\n+\nis-number@^3.0.0:\nversion \"3.0.0\"\nresolved \"https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195\"\n@@ -5955,6 +5996,14 @@ [email protected], resolve@^1.10.0, resolve@^1.3.2, resolve@~1.17.0:\ndependencies:\npath-parse \"^1.0.6\"\n+resolve@^1.17.0:\n+ version \"1.18.1\"\n+ resolved \"https://registry.yarnpkg.com/resolve/-/resolve-1.18.1.tgz#018fcb2c5b207d2a6424aee361c5a266da8f4130\"\n+ integrity sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==\n+ dependencies:\n+ is-core-module \"^2.0.0\"\n+ path-parse \"^1.0.6\"\n+\nresolve@~1.12.0:\nversion \"1.12.3\"\nresolved \"https://registry.yarnpkg.com/resolve/-/resolve-1.12.3.tgz#96d5253df8005ce19795c14338f2a013c38a8c15\"\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(giraffe): include csv processing parts into build
305,159
03.11.2020 19:06:35
-3,600
7b5a41230f2e37aae296d8e257928ba35d873d8e
chore(core): optimize for tree-shaking
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/Logger.ts", "new_path": "packages/core/src/impl/Logger.ts", "diff": "@@ -9,7 +9,7 @@ export interface Logger {\n/**\n* Logger that logs to console.out\n*/\n-export const consoleLogger: Logger = Object.freeze({\n+export const consoleLogger: Logger = {\nerror(message, error) {\n// eslint-disable-next-line no-console\nconsole.error('ERROR: ' + message, error ? error : '')\n@@ -18,7 +18,7 @@ export const consoleLogger: Logger = Object.freeze({\n// eslint-disable-next-line no-console\nconsole.warn('WARN: ' + message, error ? error : '')\n},\n-})\n+}\nlet provider: Logger = consoleLogger\nconst Logger: Logger = {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -72,22 +72,26 @@ export interface WriteOptions extends WriteRetryOptions {\n}\n/** default RetryDelayStrategyOptions */\n-export const DEFAULT_RetryDelayStrategyOptions = Object.freeze({\n+export const DEFAULT_RetryDelayStrategyOptions = {\nretryJitter: 200,\nminRetryDelay: 5000,\nmaxRetryDelay: 180000,\nexponentialBase: 5,\n-})\n+}\n/** default writeOptions */\n-export const DEFAULT_WriteOptions: WriteOptions = Object.freeze({\n+export const DEFAULT_WriteOptions: WriteOptions = {\nbatchSize: 1000,\nflushInterval: 60000,\nwriteFailed: function() {},\nmaxRetries: 3,\nmaxBufferLines: 32_000,\n- ...DEFAULT_RetryDelayStrategyOptions,\n-})\n+ // a copy of DEFAULT_RetryDelayStrategyOptions, so that DEFAULT_WriteOptions could be tree-shaken\n+ retryJitter: 200,\n+ minRetryDelay: 5000,\n+ maxRetryDelay: 180000,\n+ exponentialBase: 5,\n+}\n/**\n* Options used by {@link InfluxDB} .\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/results/LineSplitter.ts", "new_path": "packages/core/src/results/LineSplitter.ts", "diff": "-const SEPARATOR = ','\n-const WRAPPER = '\"'\n-\n/**\n* Optimized tokenizer of a single CSV line.\n*/\n@@ -49,7 +46,7 @@ export class LineSplitter {\nlet count = 0\nfor (let i = 0; i < line.length; i++) {\nconst c = line[i]\n- if (c === SEPARATOR) {\n+ if (c === ',') {\nif (quoteCount % 2 === 0) {\nconst val = this.getValue(line, startIndex, i, quoteCount)\nif (this._reuse) {\n@@ -60,7 +57,7 @@ export class LineSplitter {\nstartIndex = i + 1\nquoteCount = 0\n}\n- } else if (c === WRAPPER) {\n+ } else if (c === '\"') {\nquoteCount++\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/util/currentTime.ts", "new_path": "packages/core/src/util/currentTime.ts", "diff": "@@ -74,7 +74,7 @@ function seconds(): string {\n* can be used in the line protocol. Micro and nano timestamps are emulated\n* depending on the js platform in use.\n*/\n-export const currentTime = Object.freeze({\n+export const currentTime = {\ns: seconds as () => string,\nms: millis as () => string,\nus: micros as () => string,\n@@ -83,7 +83,7 @@ export const currentTime = Object.freeze({\nmillis: millis as () => string,\nmicros: micros as () => string,\nnanos: nanos as () => string,\n-})\n+}\n/**\n* dateToProtocolTimestamp provides converters for JavaScript Date to InfluxDB Write Protocol Timestamp. Keys are supported precisions.\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): optimize for tree-shaking
305,159
03.11.2020 21:40:01
-3,600
13b87f6cf3137db6bb1a3470b7db2a197ae0ed46
chore(giraffe): avoid __awaiter in generated typescript
[ { "change_type": "MODIFY", "old_path": "packages/giraffe/src/queryTable.ts", "new_path": "packages/giraffe/src/queryTable.ts", "diff": "@@ -339,19 +339,18 @@ export function createCollector(\n* @param tableOptions - tableOptions allows to filter or even stop the processing of rows, specify maximum rows or restrict the columns to collect.\n* @returns Promise with query results\n*/\n-export async function queryToTable(\n+export function queryToTable(\nqueryApi: QueryApi,\nquery: string | ParameterizedQuery,\ntableFactory: GiraffeTableFactory,\ntableOptions?: TableOptions\n): Promise<Table> {\n- const result = await new Promise<FromFluxResult>((resolve, reject) => {\n+ return new Promise<FromFluxResult>((resolve, reject) => {\nqueryApi.queryRows(\nquery,\ncreateCollector(resolve, reject, tableFactory, tableOptions)\n)\n- })\n- return result.table\n+ }).then(result => result.table)\n}\n/**\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): avoid __awaiter in generated typescript
305,159
03.11.2020 21:45:48
-3,600
61d4940a3cf684961e698b56f48ce0c30da0b079
chore(apis): improve doc
[ { "change_type": "MODIFY", "old_path": "packages/apis/src/index.ts", "new_path": "packages/apis/src/index.ts", "diff": "* token: \"my-token\"\n* })\n* ...\n- * async function getOrg(name) {\n+ * async function getOrg() {\n* const orgsAPI = new OrgsAPI(influxDB)\n* const organizations = await orgsAPI.getOrgs({\n* org: \"my-org\"\n* })\n* ...\n+ * }\n+ * ...\n* ```\n* Generated APIs that write or query InfluxDB are also herein, but it is recommended to use\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(apis): improve doc
305,159
03.11.2020 22:19:28
-3,600
5722631f6fd6ea54415ade04007fc17ae5143080
chore: increase timeout for async test
[ { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -196,12 +196,12 @@ describe('WriteApi', () => {\nit('flushes the records automatically', async () => {\nuseSubject({flushInterval: 5, maxRetries: 0, batchSize: 10})\nsubject.writeRecord('test value=1')\n- await new Promise(resolve => setTimeout(resolve, 10)) // wait for background flush and HTTP to finish\n+ await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush and HTTP to finish\nexpect(logs.error).to.length(1)\nsubject.writeRecord('test value=2')\n- await new Promise(resolve => setTimeout(resolve, 10)) // wait for background flush and HTTP to finish\n+ await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush and HTTP to finish\nexpect(logs.error).to.length(2)\n- await new Promise(resolve => setTimeout(resolve, 10)) // wait for background flush\n+ await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush\nawait subject.flush().then(() => {\nexpect(logs.error).to.length(2)\n})\n@@ -247,7 +247,7 @@ describe('WriteApi', () => {\n.floatField('value', 1)\n.timestamp('')\n)\n- await new Promise(resolve => setTimeout(resolve, 10)) // wait for background flush and HTTP to finish\n+ await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush and HTTP to finish\nexpect(logs.error).to.length(0)\nexpect(logs.warn).to.length(1)\nsubject.writePoint(new Point()) // ignored, since it generates no line\n@@ -262,7 +262,7 @@ describe('WriteApi', () => {\n.floatField('value', 7)\n.timestamp((false as any) as string), // server decides what to do with such values\n])\n- await new Promise(resolve => setTimeout(resolve, 10)) // wait for background flush and HTTP to finish\n+ await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush and HTTP to finish\nexpect(logs.error).to.length(0)\nexpect(logs.warn).to.length(2)\nexpect(messages).to.have.length(2)\n@@ -288,7 +288,7 @@ describe('WriteApi', () => {\n})\nit('fails on write response status not being exactly 204', async () => {\n// required because of https://github.com/influxdata/influxdb-client-js/issues/263\n- useSubject({flushInterval: 5, maxRetries: 0, batchSize: 10})\n+ useSubject({flushInterval: 2, maxRetries: 0, batchSize: 10})\nnock(clientOptions.url)\n.post(WRITE_PATH_NS)\n.reply((_uri, _requestBody) => {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: increase timeout for async test
305,159
04.11.2020 09:12:38
-3,600
bbfc44dab70d24f86eb21cddb5e2c5a8fa95f437
feat(giraffe): add csv response parsing to example
[ { "change_type": "MODIFY", "old_path": "examples/giraffe.html", "new_path": "examples/giraffe.html", "diff": "<script src=\"https://cdn.jsdelivr.net/npm/@influxdata/[email protected]/dist/index.js\"></script>\n<script src=\"https://unpkg.com/@influxdata/influxdb-client/dist/index.browser.js\"></script>\n<script src=\"https://unpkg.com/@influxdata/influxdb-client-giraffe/dist/index.js\"></script>\n+ <!-- <script src=\"../packages/giraffe/dist/index.js\"></script> -->\n<script src=\"./env_browser.js\"></script>\n</head>\n<body>\n</div>\n</fieldset>\n<button id=\"reloadButton\">Reload</button>\n+ <button id=\"sampleButton\">Show Sample Data</button>\n<button id=\"clientExamples\">Open InfluxDB JavaScript Client Examples</button>\n<script>\n// get query from request parameter or use default\nreturn React.createElement(giraffe.Plot, {config: plotConfig})\n} else {\n// render empty table recevied\n- return React.createElement('center', null, \"Empty Table Received\")\n+ return React.createElement('center', null, 'Empty Table Received')\n}\n}\nconst influxDBClientGiraffe = window['@influxdata/influxdb-client-giraffe']\n})\nconst clientExamples = document.getElementById('clientExamples')\nclientExamples.addEventListener('click', e => {\n- const target = \"./index.html?fluxQuery=\"+encodeURIComponent(fluxQueryInput.value)\n- window.open(target, \"_blank\")\n+ const target = './index.html?fluxQuery='+encodeURIComponent(fluxQueryInput.value)\n+ window.open(target, '_blank')\n+ })\n+ function sampleAndVisualize(){\n+ // create sample query response\n+ let queryResponseData = '#datatype,string,long,string,string,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double\\n'\n+ queryResponseData += '#group,false,false,true,true,true,true,false,false\\n'\n+ queryResponseData += '#default,_result,,,,,,,\\n'\n+ queryResponseData += ',result,table,_measurement,_field,_start,_stop,_time,_value\\n'\n+ const time = Math.trunc(Date.now()/60000) // start this second\n+ const sampleStart = ',,0,temperature,value,2010-01-01T00:00:00Z,2030-01-01T00:00:00Z,'\n+ const value = Math.random() * Math.PI\n+ for(let i=0; i<1000; i++){\n+ const _time = new Date((time + i) * 60000).toISOString()\n+ const _value = 20 + 15*Math.sin(value+(i/1000)*Math.PI)\n+ queryResponseData += sampleStart\n+ queryResponseData += `${_time},${_value}\\n`\n+ }\n+ // transform response to giraffe table and visualize\n+ const table = influxDBClientGiraffe.csvToTable(queryResponseData,giraffe.newTable)\n+ console.log('csvToTable returns', table)\n+ ReactDOM.render(\n+ React.createElement(RenderResults, {table}),\n+ document.getElementById('renderArea')\n+ );\n+ }\n+ document.getElementById('sampleButton').addEventListener('click', () => {\n+ sampleAndVisualize()\n})\n</script>\n</body>\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(giraffe): add csv response parsing to example
305,159
04.11.2020 13:49:31
-3,600
8f296de74121807c80a1b7b9d491d83e8350efbf
chore(giraffe): comment rollup build
[ { "change_type": "MODIFY", "old_path": "packages/giraffe/rollup.config.js", "new_path": "packages/giraffe/rollup.config.js", "diff": "@@ -21,7 +21,7 @@ function createConfig({format, out, name, target, noTerser}) {\n},\n}),\n// @influxdata/influxdb-client (core) package uses `module:browser`\n- // property in its package.json to point to a ES module build created for the browser\n+ // property in its package.json to point to an ES module created for the browser\nresolve({mainFields: ['module:browser']}),\nnoTerser ? undefined : terser(),\ngzip(),\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): comment rollup build
305,159
05.11.2020 12:01:04
-3,600
2f19d3b319a2305a58fe6d83471b7b70104ae2d6
feat(core): allow to notify about write success
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "1. [#275](https://github.com/influxdata/influxdb-client-js/pull/275): Export CSV results parser.\n1. [#275](https://github.com/influxdata/influxdb-client-js/pull/275): Export fuction to transform CSV string to giraffe table.\n1. [#275](https://github.com/influxdata/influxdb-client-js/pull/275): Add tree shaking optimizations.\n+1. [#276](https://github.com/influxdata/influxdb-client-js/pull/276): Allow to notify about write success.\n## 1.8.0 [2020-10-30]\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -134,7 +134,7 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nif (!this.closed && lines.length > 0) {\nreturn new Promise<void>((resolve, reject) => {\nlet responseStatusCode: number | undefined\n- this.transport.send(this.httpPath, lines.join('\\n'), this.sendOptions, {\n+ const callbacks = {\nresponseStarted(_headers: Headers, statusCode?: number): void {\nresponseStatusCode = statusCode\n},\n@@ -174,9 +174,10 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nreject(error)\n},\ncomplete(): void {\n- self.retryStrategy.success()\n// older implementations of transport do not report status code\nif (responseStatusCode == 204 || responseStatusCode == undefined) {\n+ self.writeOptions.writeSuccess.call(self, lines)\n+ self.retryStrategy.success()\nresolve()\n} else {\nconst error = new HttpError(\n@@ -185,11 +186,16 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nundefined,\n'0'\n)\n- Logger.error(`Write to InfluxDB failed.`, error)\n- reject(error)\n+ callbacks.error(error)\n}\n},\n- })\n+ }\n+ this.transport.send(\n+ this.httpPath,\n+ lines.join('\\n'),\n+ this.sendOptions,\n+ callbacks\n+ )\n})\n} else {\nreturn Promise.resolve()\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -39,7 +39,7 @@ export interface RetryDelayStrategyOptions {\n*/\nexport interface WriteRetryOptions extends RetryDelayStrategyOptions {\n/**\n- * writeFailed is called to inform about write error\n+ * WriteFailed is called to inform about write errors.\n* @param this - the instance of the API that failed\n* @param error - write error\n* @param lines - failed lines\n@@ -53,6 +53,14 @@ export interface WriteRetryOptions extends RetryDelayStrategyOptions {\nlines: Array<string>,\nattempts: number\n): Promise<void> | void\n+\n+ /**\n+ * WriteSuccess is informed about successfully written lines.\n+ * @param this - the instance of the API in use\n+ * @param lines - written lines\n+ */\n+ writeSuccess(this: WriteApi, lines: Array<string>): void\n+\n/** max number of retries when write fails */\nmaxRetries: number\n/** the maximum size of retry-buffer (in lines) */\n@@ -84,6 +92,7 @@ export const DEFAULT_WriteOptions: WriteOptions = {\nbatchSize: 1000,\nflushInterval: 60000,\nwriteFailed: function() {},\n+ writeSuccess: function() {},\nmaxRetries: 3,\nmaxBufferLines: 32_000,\n// a copy of DEFAULT_RetryDelayStrategyOptions, so that DEFAULT_WriteOptions could be tree-shaken\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -9,9 +9,11 @@ import {\nWriteApi,\nInfluxDB,\nWritePrecisionType,\n+ DEFAULT_WriteOptions,\n} from '../../src'\nimport {collectLogging, CollectedLogs} from '../util'\nimport Logger from '../../src/impl/Logger'\n+import {waitForCondition} from './util/waitForCondition'\nconst clientOptions: ClientOptions = {\nurl: 'http://fake:8086',\n@@ -35,6 +37,26 @@ function createApi(\n}).getWriteApi(org, bucket, precision)\n}\n+interface WriteListeners {\n+ successLineCount: number\n+ failedLineCount: number\n+ writeFailed(error: Error, lines: string[]): void\n+ writeSuccess(lines: string[]): void\n+}\n+function createWriteCounters(): WriteListeners {\n+ const retVal = {\n+ successLineCount: 0,\n+ failedLineCount: 0,\n+ writeFailed(_error: Error, lines: string[]): void {\n+ retVal.failedLineCount += lines.length\n+ },\n+ writeSuccess(lines: string[]): void {\n+ retVal.successLineCount += lines.length\n+ },\n+ }\n+ return retVal\n+}\n+\ndescribe('WriteApi', () => {\nbeforeEach(() => {\nnock.disableNetConnect()\n@@ -119,12 +141,11 @@ describe('WriteApi', () => {\nuseSubject({\nflushInterval: 0,\nbatchSize: 1,\n- maxRetries: 2,\n})\nsubject.writeRecord('test value=1')\nsubject.writeRecords(['test value=2', 'test value=3'])\n// wait for http calls to finish\n- await new Promise(resolve => setTimeout(resolve, 20))\n+ await waitForCondition(() => logs.warn.length >= 3)\nawait subject.close().then(() => {\nexpect(logs.error).to.length(1)\nexpect(logs.warn).length(3) // 3 warnings about write failure\n@@ -165,16 +186,26 @@ describe('WriteApi', () => {\nit('uses the pre-configured batchSize', async () => {\nuseSubject({flushInterval: 0, maxRetries: 0, batchSize: 2})\nsubject.writeRecords(['test value=1', 'test value=2', 'test value=3'])\n- await new Promise(resolve => setTimeout(resolve, 20)) // wait for HTTP to finish\n+ await waitForCondition(() => logs.error.length > 0) // wait for HTTP call to fail\nlet count = subject.dispose()\n- expect(logs.error).to.length(1)\n- expect(logs.warn).to.length(0)\n+ expect(logs.error).has.length(1)\n+ expect(logs.warn).has.length(0)\nexpect(count).equals(1)\ncount = subject.dispose() // dispose is idempotent\n- expect(logs.error).to.length(1) // no more errorrs\n- expect(logs.warn).to.length(0)\n+ expect(logs.error).has.length(1) // no more errorrs\n+ expect(logs.warn).has.length(0)\nexpect(count).equals(1)\n})\n+ it('implementation uses default notifiers', () => {\n+ useSubject({})\n+ const writeOptions = (subject as any).writeOptions as WriteOptions\n+ expect(writeOptions.writeFailed).equals(DEFAULT_WriteOptions.writeFailed)\n+ expect(writeOptions.writeSuccess).equals(\n+ DEFAULT_WriteOptions.writeSuccess\n+ )\n+ expect(writeOptions.writeSuccess).to.not.throw()\n+ expect(writeOptions.writeFailed).to.not.throw()\n+ })\n})\ndescribe('flush on background', () => {\nlet subject: WriteApi\n@@ -196,14 +227,13 @@ describe('WriteApi', () => {\nit('flushes the records automatically', async () => {\nuseSubject({flushInterval: 5, maxRetries: 0, batchSize: 10})\nsubject.writeRecord('test value=1')\n- await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush and HTTP to finish\n- expect(logs.error).to.length(1)\n+ await waitForCondition(() => logs.error.length >= 1) // wait for HTTP call to fail\n+ expect(logs.error).has.length(1)\nsubject.writeRecord('test value=2')\n- await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush and HTTP to finish\n- expect(logs.error).to.length(2)\n- await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush\n+ await waitForCondition(() => logs.error.length >= 2)\n+ expect(logs.error).has.length(2)\nawait subject.flush().then(() => {\n- expect(logs.error).to.length(2)\n+ expect(logs.error).has.length(2)\n})\n})\n})\n@@ -226,7 +256,13 @@ describe('WriteApi', () => {\ncollectLogging.after()\n})\nit('flushes the records without errors', async () => {\n- useSubject({flushInterval: 5, maxRetries: 1, batchSize: 10})\n+ const writeCounters = createWriteCounters()\n+ useSubject({\n+ flushInterval: 5,\n+ maxRetries: 1,\n+ batchSize: 10,\n+ writeSuccess: writeCounters.writeSuccess,\n+ })\nlet requests = 0\nconst messages: string[] = []\nnock(clientOptions.url)\n@@ -247,9 +283,9 @@ describe('WriteApi', () => {\n.floatField('value', 1)\n.timestamp('')\n)\n- await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush and HTTP to finish\n- expect(logs.error).to.length(0)\n- expect(logs.warn).to.length(1)\n+ await waitForCondition(() => writeCounters.successLineCount == 1)\n+ expect(logs.error).has.length(0)\n+ expect(logs.warn).has.length(1) // request was retried once\nsubject.writePoint(new Point()) // ignored, since it generates no line\nsubject.writePoints([\nnew Point('test'), // will be ignored + warning\n@@ -262,7 +298,7 @@ describe('WriteApi', () => {\n.floatField('value', 7)\n.timestamp((false as any) as string), // server decides what to do with such values\n])\n- await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush and HTTP to finish\n+ await waitForCondition(() => writeCounters.successLineCount == 7)\nexpect(logs.error).to.length(0)\nexpect(logs.warn).to.length(2)\nexpect(messages).to.have.length(2)\n@@ -287,8 +323,14 @@ describe('WriteApi', () => {\nexpect(lines[5]).to.be.equal('test,xtra=1 value=7 false')\n})\nit('fails on write response status not being exactly 204', async () => {\n+ const writeCounters = createWriteCounters()\n// required because of https://github.com/influxdata/influxdb-client-js/issues/263\n- useSubject({flushInterval: 2, maxRetries: 0, batchSize: 10})\n+ useSubject({\n+ flushInterval: 2,\n+ maxRetries: 0,\n+ batchSize: 10,\n+ writeFailed: writeCounters.writeFailed,\n+ })\nnock(clientOptions.url)\n.post(WRITE_PATH_NS)\n.reply((_uri, _requestBody) => {\n@@ -296,7 +338,7 @@ describe('WriteApi', () => {\n})\n.persist()\nsubject.writePoint(new Point('test').floatField('value', 1))\n- await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush and HTTP to finish\n+ await waitForCondition(() => writeCounters.failedLineCount == 1)\nexpect(logs.error).has.length(1)\nexpect(logs.error[0][0]).equals('Write to InfluxDB failed.')\nexpect(logs.error[0][1]).instanceOf(HttpError)\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/RetryBuffer.test.ts", "new_path": "packages/core/test/unit/impl/RetryBuffer.test.ts", "diff": "import {expect} from 'chai'\nimport RetryBuffer from '../../../src/impl/RetryBuffer'\nimport {CollectedLogs, collectLogging} from '../../util'\n+import {waitForCondition} from '../util/waitForCondition'\ndescribe('RetryBuffer', () => {\nlet logs: CollectedLogs\n@@ -22,9 +23,7 @@ describe('RetryBuffer', () => {\ninput.push([['a' + i], i])\nsubject.addLines(['a' + i], i, 2)\n}\n- await new Promise<void>((resolve, _reject) =>\n- setTimeout(() => resolve(), 10)\n- )\n+ await waitForCondition(() => output.length >= 10)\nexpect(output).length.is.greaterThan(0)\nsubject.addLines([], 1, 1) // shall be ignored\nsubject.close()\n@@ -43,9 +42,6 @@ describe('RetryBuffer', () => {\nif (i >= 5) input.push([['a' + i], i])\nsubject.addLines(['a' + i], i, 100)\n}\n- await new Promise<void>((resolve, _reject) =>\n- setTimeout(() => resolve(), 10)\n- )\nawait subject.flush()\nexpect(subject.close()).equals(0)\nexpect(logs.error).length.is.greaterThan(0) // 5 entries over limit\n" }, { "change_type": "ADD", "old_path": null, "new_path": "packages/core/test/unit/util/waitForCondition.ts", "diff": "+/**\n+ * Wait for the supplied `condition` to become truethy\n+ * for at most `timeout` milliseconds. The `condition`\n+ * every `step` milliseconds.\n+ * @param condition - condition to validate\n+ * @param timeout - maximum wait time\n+ * @param step - interval to validate the condition\n+ */\n+export async function waitForCondition(\n+ condition: () => any,\n+ timeout = 100,\n+ step = 5\n+): Promise<void> {\n+ for (;;) {\n+ await new Promise(resolve => setTimeout(resolve, step))\n+ timeout -= step\n+ if (timeout <= 0) {\n+ break\n+ }\n+ if (condition()) return\n+ }\n+ // eslint-disable-next-line no-console\n+ console.error('WARN:waitForCondition: timeouted')\n+}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): allow to notify about write success
305,159
10.11.2020 13:14:18
-3,600
12af4fb524197b0bf517a0e994f2056f2228baa0
chore(build): upgrade to node v14
[ { "change_type": "MODIFY", "old_path": ".circleci/config.yml", "new_path": ".circleci/config.yml", "diff": "@@ -38,7 +38,7 @@ jobs:\ncoverage:\nparameters:\ndocker:\n- - image: circleci/node:12\n+ - image: circleci/node:14\nsteps:\n- checkout\n- init-dependencies\n@@ -57,7 +57,7 @@ jobs:\ndeploy-preview:\nparameters:\ndocker:\n- - image: circleci/node:12\n+ - image: circleci/node:14\nsteps:\n- run:\nname: Early return if this build is from a forked repository\n@@ -79,7 +79,7 @@ workflows:\nbuild:\njobs:\n- tests:\n- version: '12'\n+ version: '14'\n- coverage\n- deploy-preview:\nrequires:\n" }, { "change_type": "MODIFY", "old_path": ".nvmrc", "new_path": ".nvmrc", "diff": "-v12.13.1\n+v14\n" }, { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "1. [#275](https://github.com/influxdata/influxdb-client-js/pull/275): Export fuction to transform CSV string to giraffe table.\n1. [#275](https://github.com/influxdata/influxdb-client-js/pull/275): Add tree shaking optimizations.\n1. [#276](https://github.com/influxdata/influxdb-client-js/pull/276): Allow to notify about write success.\n+1. [#280](https://github.com/influxdata/influxdb-client-js/pull/280): Upgrade to the latest node v14 LTS.\n## 1.8.0 [2020-10-30]\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -80,7 +80,7 @@ If you would like to contribute code you can do through GitHub by forking the re\nBuild Requirements:\n-- node v12.13.1 or higher\n+- node v14 LTS\n- yarn 1.9.4. or higher\nRun tests:\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(build): upgrade to node v14
305,159
11.11.2020 11:25:23
-3,600
f7f1afa3c51cefa45da84780cbba5827fe0b2a45
chote(core/write): add more tests for auto flush
[ { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -224,7 +224,7 @@ describe('WriteApi', () => {\nawait subject.close()\ncollectLogging.after()\n})\n- it('flushes the records automatically', async () => {\n+ it('flushes the records automatically in intervals', async () => {\nuseSubject({flushInterval: 5, maxRetries: 0, batchSize: 10})\nsubject.writeRecord('test value=1')\nawait waitForCondition(() => logs.error.length >= 1) // wait for HTTP call to fail\n@@ -236,6 +236,18 @@ describe('WriteApi', () => {\nexpect(logs.error).has.length(2)\n})\n})\n+ it('flushes the records automatically in batches', async () => {\n+ useSubject({flushInterval: 0, maxRetries: 0, batchSize: 1})\n+ subject.writeRecord('test value=1')\n+ await waitForCondition(() => logs.error.length >= 1) // wait for HTTP call to fail\n+ expect(logs.error).has.length(1)\n+ subject.writeRecord('test value=2')\n+ await waitForCondition(() => logs.error.length >= 2)\n+ expect(logs.error).has.length(2)\n+ await subject.flush().then(() => {\n+ expect(logs.error).has.length(2)\n+ })\n+ })\n})\ndescribe('usage of server API', () => {\nlet subject: WriteApi\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chote(core/write): add more tests for auto flush
305,159
18.11.2020 08:29:12
-3,600
eb3bbf264cc7e9172d4e65cc9be5b3dd74646186
feat(giraffe): update changelog
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "### Features\n+1. [#271](https://github.com/influxdata/influxdb-client-js/pull/271): Introduce `@influxdata/giraffe` package.\n1. [#272](https://github.com/influxdata/influxdb-client-js/pull/272): Optimize UTF8 processing in the browser.\n1. [#275](https://github.com/influxdata/influxdb-client-js/pull/275): Export CSV results parser.\n1. [#275](https://github.com/influxdata/influxdb-client-js/pull/275): Export fuction to transform CSV string to giraffe table.\n### Features\n-1. [#267](https://github.com/influxdata/influxdb-client-js/pull/267): Introduce `@influxdata/influxdb-client-browser` module.\n+1. [#267](https://github.com/influxdata/influxdb-client-js/pull/267): Introduce `@influxdata/influxdb-client-browser` package.\n### Bug Fixes\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(giraffe): update changelog
305,159
18.11.2020 16:57:51
-3,600
8dde03e2cccc893f4a7145b894dbfc807b2ee372
feat(core): allow to obtain QueryApi using QueryOptions
[ { "change_type": "MODIFY", "old_path": "packages/core/src/InfluxDB.ts", "new_path": "packages/core/src/InfluxDB.ts", "diff": "@@ -10,7 +10,7 @@ import {IllegalArgumentError} from './errors'\nimport {Transport} from './transport'\n// replaced by ./impl/browser/FetchTransport in browser builds\nimport TransportImpl from './impl/node/NodeHttpTransport'\n-import QueryApi from './QueryApi'\n+import QueryApi, {QueryOptions} from './QueryApi'\nimport QueryApiImpl from './impl/QueryApiImpl'\n/**\n@@ -82,10 +82,10 @@ export default class InfluxDB {\n* {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/rxjs-query.ts | rxjs-query.ts example},\n* and {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/index.html | browser example},\n*\n- * @param org - organization\n+ * @param org - organization or query options\n* @returns QueryApi instance\n*/\n- getQueryApi(org: string): QueryApi {\n+ getQueryApi(org: string | QueryOptions): QueryApi {\nreturn new QueryApiImpl(this.transport, org)\n}\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): allow to obtain QueryApi using QueryOptions
305,159
18.11.2020 17:31:43
-3,600
01dc30015906365ac40971af27dfc21d0188801e
feat(core): allow to specify custom headers in getQueryApi
[ { "change_type": "MODIFY", "old_path": "packages/core/src/QueryApi.ts", "new_path": "packages/core/src/QueryApi.ts", "diff": "@@ -32,6 +32,10 @@ export interface QueryOptions {\n* for example `new Date().toISOString()`.\n*/\nnow?: () => string\n+ /**\n+ * Extra HTTP headers that will be sent with every query request.\n+ */\n+ headers?: {[key: string]: string}\n}\n/** Wraps values and associated metadata of a query result row */\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/QueryApiImpl.ts", "new_path": "packages/core/src/impl/QueryApiImpl.ts", "diff": "@@ -111,7 +111,7 @@ export class QueryApiImpl implements QueryApi {\n}\nqueryRaw(query: string | ParameterizedQuery): Promise<string> {\n- const {org, type, gzip} = this.options\n+ const {org, type, gzip, headers} = this.options\nreturn this.transport.request(\n`/api/v2/query?org=${encodeURIComponent(org)}`,\nJSON.stringify(\n@@ -127,13 +127,14 @@ export class QueryApiImpl implements QueryApi {\naccept: 'text/csv',\n'accept-encoding': gzip ? 'gzip' : 'identity',\n'content-type': 'application/json; encoding=utf-8',\n+ ...headers,\n},\n}\n)\n}\nprivate createExecutor(query: string | ParameterizedQuery): QueryExecutor {\n- const {org, type, gzip} = this.options\n+ const {org, type, gzip, headers} = this.options\nreturn (consumer): void => {\nthis.transport.send(\n@@ -150,6 +151,7 @@ export class QueryApiImpl implements QueryApi {\nheaders: {\n'content-type': 'application/json; encoding=utf-8',\n'accept-encoding': gzip ? 'gzip' : 'identity',\n+ ...headers,\n},\n},\nchunksToLines(consumer, this.transport.chunkCombiner)\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/QueryApi.test.ts", "new_path": "packages/core/test/unit/QueryApi.test.ts", "diff": "@@ -169,34 +169,44 @@ describe('QueryApi', () => {\n},\n])\n})\n- it('sends custom now and type', async () => {\n+ it('sends custom now, type, or header', async () => {\nlet body: any\n+ let authorization: any\nnock(clientOptions.url)\n.post(QUERY_PATH)\n- .reply((_uri, requestBody) => {\n+ .reply(function(_uri, requestBody) {\nbody = requestBody\n+ authorization = this.req.headers.authorization\nreturn [200, '', {}]\n})\n.persist()\nconst query = 'from(bucket:\"my-bucket\") |> range(start: 0)'\n- const tests: Record<string, string | undefined>[] = [\n+ const tests: Record<string, any>[] = [\n{\nnow: undefined,\ntype: undefined,\n},\n+ {\n+ now: undefined,\n+ type: undefined,\n+ headers: {authorization: 'Token customToken'},\n+ },\n{\nnow: '2020-10-05T14:48:00.000Z',\ntype: 'whatever',\n},\n]\n- for (const pair of tests) {\n- let subject = new InfluxDB(clientOptions).getQueryApi(ORG)\n- if (pair.now) {\n- subject = subject.with({now: () => pair.now as string})\n+ for (const tc of tests) {\n+ let subject = new InfluxDB(clientOptions).getQueryApi({\n+ org: ORG,\n+ headers: {...tc.headers},\n+ })\n+ if (tc.now) {\n+ subject = subject.with({now: () => tc.now as string})\n}\n- if (pair.type) {\n- subject = subject.with({type: pair.type as any})\n+ if (tc.type) {\n+ subject = subject.with({type: tc.type as any})\n}\nawait new Promise((resolve, reject) =>\nsubject.queryRows(query, {\n@@ -209,9 +219,12 @@ describe('QueryApi', () => {\n},\n})\n)\n- expect(body?.type).to.deep.equal(pair.type ?? 'flux')\n- expect(body?.query).to.deep.equal(query)\n- expect(body?.now).to.deep.equal(pair.now)\n+ expect(body?.type).equals(tc.type ?? 'flux')\n+ expect(body?.query).deep.equals(query)\n+ expect(body?.now).equals(tc.now)\n+ expect(authorization).equals(\n+ tc.headers?.authorization || `Token ${clientOptions.token}`\n+ )\n}\n})\nit('collectLines collects lines', async () => {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): allow to specify custom headers in getQueryApi
305,159
18.11.2020 17:40:44
-3,600
b54a49f941abe1bce477aebe941dc584e7986e21
feat(core): allow to specify custom headers in getWriteApi
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "1. [#275](https://github.com/influxdata/influxdb-client-js/pull/275): Add tree shaking optimizations.\n1. [#276](https://github.com/influxdata/influxdb-client-js/pull/276): Allow to notify about write success.\n1. [#280](https://github.com/influxdata/influxdb-client-js/pull/280): Upgrade to the latest node v14 LTS.\n+1. [#283](https://github.com/influxdata/influxdb-client-js/pull/283): Allow to specify custom HTTP headers in WriteApi or QueryApi.\n## 1.8.0 [2020-10-30]\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/QueryApi.ts", "new_path": "packages/core/src/QueryApi.ts", "diff": "@@ -33,7 +33,7 @@ export interface QueryOptions {\n*/\nnow?: () => string\n/**\n- * Extra HTTP headers that will be sent with every query request.\n+ * HTTP headers that will be sent with every query request.\n*/\nheaders?: {[key: string]: string}\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -59,12 +59,7 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nprivate closed = false\nprivate httpPath: string\nprivate writeOptions: WriteOptions\n- private sendOptions: SendOptions = {\n- method: 'POST',\n- headers: {\n- 'content-type': 'text/plain; charset=utf-8',\n- },\n- }\n+ private sendOptions: SendOptions\nprivate _timeoutHandle: any = undefined\nprivate currentTime: () => string\nprivate dateToProtocolTimestamp: (d: Date) => string\n@@ -91,6 +86,13 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nif (this.writeOptions.defaultTags) {\nthis.useDefaultTags(this.writeOptions.defaultTags)\n}\n+ this.sendOptions = {\n+ method: 'POST',\n+ headers: {\n+ 'content-type': 'text/plain; charset=utf-8',\n+ ...writeOptions?.headers,\n+ },\n+ }\nconst scheduleNextSend = (): void => {\nif (this.writeOptions.flushInterval > 0) {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -77,6 +77,8 @@ export interface WriteOptions extends WriteRetryOptions {\nflushInterval: number\n/** default tags, unescaped */\ndefaultTags?: Record<string, string>\n+ /** HTTP headers that will be sent with every write request */\n+ headers?: {[key: string]: string}\n}\n/** default RetryDelayStrategyOptions */\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -343,9 +343,11 @@ describe('WriteApi', () => {\nbatchSize: 10,\nwriteFailed: writeCounters.writeFailed,\n})\n+ let authorization: any\nnock(clientOptions.url)\n.post(WRITE_PATH_NS)\n- .reply((_uri, _requestBody) => {\n+ .reply(function(_uri, _requestBody) {\n+ authorization = this.req.headers.authorization\nreturn [200, '', {}]\n})\n.persist()\n@@ -359,6 +361,25 @@ describe('WriteApi', () => {\n`204 HTTP response status code expected, but 200 returned`\n)\nexpect(logs.warn).deep.equals([])\n+ expect(authorization).equals(`Token ${clientOptions.token}`)\n+ })\n+ it('sends custom http header', async () => {\n+ useSubject({\n+ headers: {authorization: 'Token customToken'},\n+ })\n+ let authorization: any\n+ nock(clientOptions.url)\n+ .post(WRITE_PATH_NS)\n+ .reply(function(_uri, _requestBody) {\n+ authorization = this.req.headers.authorization\n+ return [204, '', {}]\n+ })\n+ .persist()\n+ subject.writePoint(new Point('test').floatField('value', 1))\n+ await subject.close()\n+ expect(logs.error).has.length(0)\n+ expect(logs.warn).deep.equals([])\n+ expect(authorization).equals(`Token customToken`)\n})\n})\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): allow to specify custom headers in getWriteApi
305,159
19.11.2020 17:53:22
-3,600
eb2f40151a4b9d8bee49814d6715580523f0d6a4
chore(core): add tests for custom errors
[ { "change_type": "MODIFY", "old_path": "packages/core/src/errors.ts", "new_path": "packages/core/src/errors.ts", "diff": "@@ -39,6 +39,7 @@ export class IllegalArgumentError extends Error {\n/* istanbul ignore next */\nconstructor(message: string) {\nsuper(message)\n+ this.name = 'IllegalArgumentError'\nObject.setPrototypeOf(this, IllegalArgumentError.prototype)\n}\n}\n@@ -63,6 +64,7 @@ export class HttpError extends Error implements RetriableDecision {\n} else {\nthis.message = `${statusCode} ${statusMessage}`\n}\n+ this.name = 'HttpError'\nthis.setRetryAfter(retryAfter)\n}\n@@ -141,6 +143,7 @@ export class RequestTimedOutError extends Error implements RetriableDecision {\nconstructor() {\nsuper()\nObject.setPrototypeOf(this, RequestTimedOutError.prototype)\n+ this.name = 'RequestTimedOutError'\nthis.message = 'Request timed out'\n}\ncanRetry(): boolean {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/errors.test.ts", "new_path": "packages/core/test/unit/errors.test.ts", "diff": "@@ -10,6 +10,33 @@ import {\n} from '../../src/errors'\ndescribe('errors', () => {\n+ describe('have standard error properties', () => {\n+ const pairs: {error: Error; name: string}[] = [\n+ {error: new HttpError(200, 'OK'), name: 'HttpError'},\n+ {error: new IllegalArgumentError('Not OK'), name: 'IllegalArgumentError'},\n+ {error: new RequestTimedOutError(), name: 'RequestTimedOutError'},\n+ {error: new AbortError(), name: 'AbortError'},\n+ ]\n+ pairs.forEach(({error, name}) => {\n+ describe(`${name}`, () => {\n+ it('has descriptive name property', () => {\n+ expect(error.name).equals(name)\n+ })\n+ it('has message property', () => {\n+ expect(error.message).is.not.empty\n+ })\n+ it('has expected toString', () => {\n+ expect(error.toString()).matches(new RegExp(`^${name}:.*`))\n+ })\n+ })\n+ })\n+ })\n+ describe('message property is defined', () => {\n+ expect(new HttpError(200, 'OK').message).is.not.empty\n+ expect(new IllegalArgumentError('Not OK').message).is.not.empty\n+ expect(new RequestTimedOutError().message).is.not.empty\n+ expect(new AbortError().message).is.not.empty\n+ })\ndescribe('retriable errors', () => {\nconst testSetOK = [\nnew HttpError(503, 'Service Unavailable'),\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): add tests for custom errors
305,159
19.11.2020 18:59:20
-3,600
cac73fb9863ec7608adb3ddf54a7b72e00754b56
feat(core): throw HttpError with code and message from response body
[ { "change_type": "MODIFY", "old_path": "packages/core/src/errors.ts", "new_path": "packages/core/src/errors.ts", "diff": "@@ -48,18 +48,37 @@ export class IllegalArgumentError extends Error {\n*/\nexport class HttpError extends Error implements RetriableDecision {\nprivate _retryAfter: number\n+ /** application error code, when available */\n+ public code: string | undefined // application-specific code\n+ /** json error response */\n+ public json: any\n/* istanbul ignore next because of super() not being covered*/\nconstructor(\nreadonly statusCode: number,\nreadonly statusMessage: string | undefined,\nreadonly body?: string,\n- retryAfter?: string | undefined | null\n+ retryAfter?: string | undefined | null,\n+ readonly contentType?: string | undefined | null,\n+ message?: string\n) {\nsuper()\nObject.setPrototypeOf(this, HttpError.prototype)\n- if (body) {\n+ if (message) {\n+ this.message = message\n+ } else if (body) {\n+ if (contentType?.startsWith('application/json')) {\n+ try {\n+ this.json = JSON.parse(body)\n+ this.message = this.json.message\n+ this.code = this.json.code\n+ } catch (e) {\n+ // never mind silently ignore\n+ }\n+ }\n+ if (!this.message) {\nthis.message = `${statusCode} ${statusMessage} : ${body}`\n+ }\n} else {\nthis.message = `${statusCode} ${statusMessage}`\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -182,12 +182,14 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nself.retryStrategy.success()\nresolve()\n} else {\n+ const message = `204 HTTP response status code expected, but ${responseStatusCode} returned`\nconst error = new HttpError(\nresponseStatusCode,\n- `204 HTTP response status code expected, but ${responseStatusCode} returned`,\n+ message,\nundefined,\n'0'\n)\n+ error.message = message\ncallbacks.error(error)\n}\n},\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -96,7 +96,8 @@ export default class FetchTransport implements Transport {\nresponse.status,\nresponse.statusText,\ntext,\n- response.headers.get('retry-after')\n+ response.headers.get('retry-after'),\n+ response.headers.get('content-type')\n)\n)\n})\n@@ -107,7 +108,8 @@ export default class FetchTransport implements Transport {\nresponse.status,\nresponse.statusText,\nundefined,\n- response.headers.get('retry-after')\n+ response.headers.get('retry-after'),\n+ response.headers.get('content-type')\n)\n)\n})\n@@ -152,7 +154,8 @@ export default class FetchTransport implements Transport {\nstatus,\nresponse.statusText,\ndata,\n- response.headers.get('retry-after')\n+ response.headers.get('retry-after'),\n+ response.headers.get('content-type')\n)\n}\nconst responseType = options.headers?.accept ?? responseContentType\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -228,9 +228,12 @@ export class NodeHttpTransport implements Transport {\nresponseData.on('error', listeners.error)\nif (statusCode >= 300) {\nlet body = ''\n+ const isJson = String(res.headers['content-type']).startsWith(\n+ 'application/json'\n+ )\nresponseData.on('data', s => {\nbody += s.toString()\n- if (body.length > 1000) {\n+ if (!isJson && body.length > 1000) {\nbody = body.slice(0, 1000)\nres.resume()\n}\n@@ -244,7 +247,8 @@ export class NodeHttpTransport implements Transport {\nstatusCode,\nres.statusMessage,\nbody,\n- res.headers['retry-after']\n+ res.headers['retry-after'],\n+ res.headers['content-type']\n)\n)\n})\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -357,7 +357,7 @@ describe('WriteApi', () => {\nexpect(logs.error[0][0]).equals('Write to InfluxDB failed.')\nexpect(logs.error[0][1]).instanceOf(HttpError)\nexpect(logs.error[0][1].statusCode).equals(200)\n- expect(logs.error[0][1].statusMessage).equals(\n+ expect(logs.error[0][1].message).equals(\n`204 HTTP response status code expected, but 200 returned`\n)\nexpect(logs.warn).deep.equals([])\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts", "new_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts", "diff": "@@ -192,6 +192,35 @@ describe('FetchTransport', () => {\n.equals('')\n)\n})\n+ it('throws error with json body', async () => {\n+ const body = '{\"code\":\"mycode\",\"message\":\"mymsg\"}'\n+ emulateFetchApi({\n+ headers: {'content-type': 'application/json'},\n+ body,\n+ status: 500,\n+ })\n+ await transport\n+ .request('/whatever', '', {\n+ method: 'GET',\n+ })\n+ .then(\n+ () => Promise.reject('client error expected'),\n+ (e: any) => {\n+ expect(e)\n+ .property('body')\n+ .equals(body)\n+ expect(e)\n+ .property('json')\n+ .deep.equals(JSON.parse(body))\n+ expect(e)\n+ .property('message')\n+ .equals('mymsg')\n+ expect(e)\n+ .property('code')\n+ .equals('mycode')\n+ }\n+ )\n+ })\n})\ndescribe('send', () => {\nconst transport = new FetchTransport({url: 'http://test:8086'})\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/node/NodeHttpTransport.test.ts", "new_path": "packages/core/test/unit/impl/node/NodeHttpTransport.test.ts", "diff": "@@ -355,6 +355,33 @@ describe('NodeHttpTransport', () => {\n.to.length(1000)\n})\n})\n+ it(`parses error responses`, async () => {\n+ let bigMessage = ',\"this is a big error message\"'\n+ while (bigMessage.length < 1001) bigMessage += bigMessage\n+ bigMessage = `{\"code\":\"mc\",\"message\":\"mymsg\",\"details\":[\"\"${bigMessage}]}`\n+ nock(transportOptions.url)\n+ .get('/test')\n+ .reply(400, bigMessage, {'content-type': 'application/json'})\n+ await sendTestData(transportOptions, {method: 'GET'}).then(\n+ () => {\n+ throw new Error('must not succeed')\n+ },\n+ (e: any) => {\n+ expect(e)\n+ .property('body')\n+ .to.length(bigMessage.length)\n+ expect(e)\n+ .property('json')\n+ .deep.equals(JSON.parse(bigMessage))\n+ expect(e)\n+ .property('code')\n+ .equals('mc')\n+ expect(e)\n+ .property('message')\n+ .equals('mymsg')\n+ }\n+ )\n+ })\nit(`uses X-Influxdb-Error header when no body is returned`, async () => {\nconst errorMessage = 'this is a header error message'\nnock(transportOptions.url)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): throw HttpError with code and message from response body
305,159
20.11.2020 13:38:11
-3,600
18bd7ebbcf9018d3893840a5f7547742e920d99e
chore(core): review
[ { "change_type": "MODIFY", "old_path": "packages/core/src/errors.ts", "new_path": "packages/core/src/errors.ts", "diff": "@@ -49,7 +49,7 @@ export class IllegalArgumentError extends Error {\nexport class HttpError extends Error implements RetriableDecision {\nprivate _retryAfter: number\n/** application error code, when available */\n- public code: string | undefined // application-specific code\n+ public code: string | undefined\n/** json error response */\npublic json: any\n@@ -73,7 +73,7 @@ export class HttpError extends Error implements RetriableDecision {\nthis.message = this.json.message\nthis.code = this.json.code\n} catch (e) {\n- // never mind silently ignore\n+ // silently ignore, body string is still available\n}\n}\nif (!this.message) {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): review
305,159
23.11.2020 11:19:14
-3,600
b156968f60863feb757c714caee50e6e4c2d5362
chore(build): declare types in package descriptors
[ { "change_type": "MODIFY", "old_path": "packages/apis/package.json", "new_path": "packages/apis/package.json", "diff": "\"main\": \"dist/index.js\",\n\"module\": \"dist/index.mjs\",\n\"browser\": \"dist/index.browser.js\",\n+ \"types\": \"dist/index.d.ts\",\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n" }, { "change_type": "MODIFY", "old_path": "packages/core-browser/package.json", "new_path": "packages/core-browser/package.json", "diff": "\"module\": \"dist/index.browser.mjs\",\n\"module:browser\": \"dist/index.browser.mjs\",\n\"browser\": \"dist/index.browser.js\",\n+ \"types\": \"dist/index.d.ts\",\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n" }, { "change_type": "MODIFY", "old_path": "packages/core/package.json", "new_path": "packages/core/package.json", "diff": "\"module\": \"dist/index.mjs\",\n\"module:browser\": \"dist/index.browser.mjs\",\n\"browser\": \"dist/index.browser.js\",\n+ \"types\": \"dist/index.d.ts\",\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/package.json", "new_path": "packages/giraffe/package.json", "diff": "},\n\"main\": \"dist/index.js\",\n\"module\": \"dist/index.mjs\",\n+ \"types\": \"dist/index.d.ts\",\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(build): declare types in package descriptors
305,159
23.11.2020 11:36:21
-3,600
37218399be464a4904c460f465d6ec11d89b0ffd
chore(build): upgrade typescript to 4.1
[ { "change_type": "MODIFY", "old_path": "packages/apis/package.json", "new_path": "packages/apis/package.json", "diff": "\"rollup-plugin-terser\": \"^7.0.0\",\n\"rollup-plugin-typescript2\": \"^0.27.2\",\n\"ts-node\": \"^8.5.4\",\n- \"typescript\": \"^3.7.4\"\n+ \"typescript\": \"^4.1.2\"\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/package.json", "new_path": "packages/core/package.json", "diff": "\"rxjs\": \"^6.5.5\",\n\"sinon\": \"^7.5.0\",\n\"ts-node\": \"^8.5.4\",\n- \"typescript\": \"^3.7.4\",\n+ \"typescript\": \"^4.1.2\",\n\"version-bump-prompt\": \"^5.0.6\"\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/QueryApi.test.ts", "new_path": "packages/core/test/unit/QueryApi.test.ts", "diff": "@@ -112,7 +112,7 @@ describe('QueryApi', () => {\nreject(error)\n},\ncomplete(): void {\n- resolve()\n+ resolve(undefined)\n},\n})\n)\n@@ -146,7 +146,7 @@ describe('QueryApi', () => {\nreject(error)\n},\ncomplete(): void {\n- resolve()\n+ resolve(undefined)\n},\n})\n)\n@@ -215,7 +215,7 @@ describe('QueryApi', () => {\nreject(error)\n},\ncomplete(): void {\n- resolve()\n+ resolve(undefined)\n},\n})\n)\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/package.json", "new_path": "packages/giraffe/package.json", "diff": "\"rxjs\": \"^6.5.5\",\n\"sinon\": \"^7.5.0\",\n\"ts-node\": \"^8.5.4\",\n- \"typescript\": \"^3.7.4\"\n+ \"typescript\": \"^4.1.2\"\n},\n\"dependencies\": {\n\"@rollup/plugin-node-resolve\": \"^10.0.0\"\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -6978,6 +6978,11 @@ typescript@^3.7.4, typescript@~3.9.5:\nresolved \"https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa\"\nintegrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==\n+typescript@^4.1.2:\n+ version \"4.1.2\"\n+ resolved \"https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9\"\n+ integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==\n+\ntypical@^4.0.0:\nversion \"4.0.0\"\nresolved \"https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4\"\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(build): upgrade typescript to 4.1
305,159
23.11.2020 13:28:27
-3,600
961f6c7737ba1a7ec774b64abbba96266df0b6f7
chore(doc): describe support of deno
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -41,7 +41,7 @@ $ yarn add @influxdata/influxdb-client\n$ pnpm add @influxdata/influxdb-client\n```\n-[@influxdata/influxdb-client](./packages/core/README.md) module primarily works in Node.js (main CJS and module ESM), but a browser (browser UMD) distribution is also available therein. If you need only a browser distribution, use [@influxdata/influxdb-client-browser](./packages/core-browser/README.md) that targets browser environment (main UMD and module ESM).\n+[@influxdata/influxdb-client](./packages/core/README.md) module primarily works in Node.js (main CJS and module ESM), but a browser (browser UMD) distribution is also available therein. If you target browser or [deno](https://deno.land/), use [@influxdata/influxdb-client-browser](./packages/core-browser/README.md).\nTo use InfluxDB management APIs in your project, add also `@influxdata/influxdb-client-apis` dependency to your project.\n" }, { "change_type": "MODIFY", "old_path": "packages/core-browser/README.md", "new_path": "packages/core-browser/README.md", "diff": "# @influxdata/influxdb-client-browser\n-The reference javascript browser client for InfluxDB 2.0. The package.json\n+The reference InfluxDB 2.0 javascript client for browser and [deno](https://deno.land/) environments. The package.json\n- **main** points to browser UMD distribution of @influxdata/influxdb-client\n- **module** points to browser ESM distribution of @influxdata/influxdb-client\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(doc): describe support of deno
305,159
23.11.2020 15:28:09
-3,600
6a393b286136b673f1c36e356bd7baccfba3ed22
chore(core): repair docs typo
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -129,7 +129,7 @@ export default class Point {\n/**\n* Creates an InfluxDB protocol line out of this instance.\n* @param settings - settings define the exact representation of point time and can also add default tags\n- * @returns an InfxluDB protocol line out of this instance\n+ * @returns an InfluxDB protocol line out of this instance\n*/\npublic toLineProtocol(settings?: PointSettings): string | undefined {\nif (!this.name) return undefined\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): repair docs typo
305,159
23.11.2020 15:39:59
-3,600
7e542fe838b0390ada5b5dbbc97b4bf285efc49f
chore(build): avoid circular dependencies in d.ts files
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "import {escape} from './util/escape'\n-import {PointSettings} from './options'\n+\n+/**\n+ * Settings that control the way of how a {@link Point} is serialized\n+ * to a protocol line.\n+ */\n+export interface PointSettings {\n+ defaultTags?: {[key: string]: string}\n+ convertTime?: (\n+ value: string | number | Date | undefined\n+ ) => string | undefined\n+}\n+\n/**\n* Point defines values of a single measurement.\n*/\n-export default class Point {\n+export class Point {\nprivate name: string\nprivate tags: {[key: string]: string} = {}\nprivate fields: {[key: string]: string} = {}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/WriteApi.ts", "new_path": "packages/core/src/WriteApi.ts", "diff": "-import Point from './Point'\n+import {Point} from './Point'\n/**\n* The asynchronous buffering API to Write time-series data into InfluxDB 2.0.\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "import WriteApi from '../WriteApi'\nimport {\nDEFAULT_WriteOptions,\n- PointSettings,\nWriteOptions,\nWritePrecisionType,\n} from '../options'\n@@ -9,7 +8,7 @@ import {Transport, SendOptions} from '../transport'\nimport {Headers} from '../results'\nimport Logger from './Logger'\nimport {HttpError, RetryDelayStrategy} from '../errors'\n-import Point from '../Point'\n+import {Point, PointSettings} from '../Point'\nimport {escape} from '../util/escape'\nimport {currentTime, dateToProtocolTimestamp} from '../util/currentTime'\nimport {createRetryDelayStrategy} from './retryStrategy'\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/index.ts", "new_path": "packages/core/src/index.ts", "diff": "@@ -34,7 +34,7 @@ export * from './util/currentTime'\nexport * from './query'\nexport * from './transport'\nexport * from './observable'\n-export {default as Point} from './Point'\n+export * from './Point'\nexport {default as InfluxDB} from './InfluxDB'\nexport {default as QueryApi, Row, QueryOptions} from './QueryApi'\nexport {default as WriteApi} from './WriteApi'\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -129,14 +129,3 @@ export const enum WritePrecision {\ns = 's',\n}\nexport type WritePrecisionType = keyof typeof WritePrecision | WritePrecision\n-\n-/**\n- * Settings that control the way of how a {@link Point} is serialized\n- * to a protocol line.\n- */\n-export interface PointSettings {\n- defaultTags?: {[key: string]: string}\n- convertTime?: (\n- value: string | number | Date | undefined\n- ) => string | undefined\n-}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/results/FluxResultObserver.ts", "new_path": "packages/core/src/results/FluxResultObserver.ts", "diff": "-import {Cancellable} from '../results'\n+import {Cancellable} from '../results/Cancellable'\nimport {FluxTableMetaData} from './FluxTableMetaData'\n/**\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/Point.test.ts", "new_path": "packages/core/test/unit/Point.test.ts", "diff": "import {expect} from 'chai'\n-import Point from '../../src/Point'\nimport pointTables from '../fixture/pointTables.json'\n-import {PointSettings} from '../../src'\n+import {Point, PointSettings} from '../../src'\ninterface PointTest {\nname?: string\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(build): avoid circular dependencies in d.ts files
305,159
23.11.2020 16:02:23
-3,600
a5aee339741b7d9f6b596f48308cc7c69a36626e
feat(build): generate one d.ts file
[ { "change_type": "MODIFY", "old_path": "packages/apis/package.json", "new_path": "packages/apis/package.json", "diff": "\"main\": \"dist/index.js\",\n\"module\": \"dist/index.mjs\",\n\"browser\": \"dist/index.browser.js\",\n- \"types\": \"dist/index.d.ts\",\n+ \"types\": \"dist/all.d.ts\",\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n\"prettier\": \"^1.19.1\",\n\"rimraf\": \"^3.0.0\",\n\"rollup\": \"^2.33.3\",\n+ \"rollup-plugin-dts\": \"^2.0.0\",\n\"rollup-plugin-gzip\": \"^2.2.0\",\n\"rollup-plugin-terser\": \"^7.0.0\",\n\"rollup-plugin-typescript2\": \"^0.27.2\",\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/rollup.config.js", "new_path": "packages/apis/rollup.config.js", "diff": "@@ -2,6 +2,7 @@ import {terser} from 'rollup-plugin-terser'\nimport gzip from 'rollup-plugin-gzip'\nimport typescript from 'rollup-plugin-typescript2'\nimport pkg from './package.json'\n+import dts from 'rollup-plugin-dts'\nconst tsBuildConfigPath = './tsconfig.build.json'\n@@ -52,4 +53,9 @@ export default [\ntarget: 'es5',\nnoTerser: true,\n}),\n+ {\n+ input: './dist/index.d.ts',\n+ output: [{file: './dist/all.d.ts', format: 'es'}],\n+ plugins: [dts()],\n+ },\n]\n" }, { "change_type": "MODIFY", "old_path": "packages/core-browser/package.json", "new_path": "packages/core-browser/package.json", "diff": "\"module\": \"dist/index.browser.mjs\",\n\"module:browser\": \"dist/index.browser.mjs\",\n\"browser\": \"dist/index.browser.js\",\n- \"types\": \"dist/index.d.ts\",\n+ \"types\": \"dist/all.d.ts\",\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n" }, { "change_type": "MODIFY", "old_path": "packages/core/package.json", "new_path": "packages/core/package.json", "diff": "\"module\": \"dist/index.mjs\",\n\"module:browser\": \"dist/index.browser.mjs\",\n\"browser\": \"dist/index.browser.js\",\n- \"types\": \"dist/index.d.ts\",\n+ \"types\": \"dist/all.d.ts\",\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n\"prettier\": \"^1.19.1\",\n\"rimraf\": \"^3.0.0\",\n\"rollup\": \"^2.33.3\",\n+ \"rollup-plugin-dts\": \"^2.0.0\",\n\"rollup-plugin-gzip\": \"^2.2.0\",\n\"rollup-plugin-terser\": \"^7.0.0\",\n\"rollup-plugin-typescript2\": \"^0.27.2\",\n" }, { "change_type": "MODIFY", "old_path": "packages/core/rollup.config.js", "new_path": "packages/core/rollup.config.js", "diff": "@@ -3,6 +3,7 @@ import gzip from 'rollup-plugin-gzip'\nimport typescript from 'rollup-plugin-typescript2'\nimport pkg from './package.json'\nimport replace from '@rollup/plugin-replace'\n+import dts from 'rollup-plugin-dts'\nconst tsBuildConfigPath = './tsconfig.build.json'\nconst externalNodeModules = ['buffer', 'http', 'https', 'url', 'zlib']\n@@ -70,4 +71,9 @@ export default [\ntarget: 'es5',\nnoTerser: true,\n}),\n+ {\n+ input: './dist/index.d.ts',\n+ output: [{file: './dist/all.d.ts', format: 'es'}],\n+ plugins: [dts()],\n+ },\n]\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/package.json", "new_path": "packages/giraffe/package.json", "diff": "},\n\"main\": \"dist/index.js\",\n\"module\": \"dist/index.mjs\",\n- \"types\": \"dist/index.d.ts\",\n+ \"types\": \"dist/all.d.ts\",\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n\"react-dom\": \"^16.8.0\",\n\"rimraf\": \"^3.0.0\",\n\"rollup\": \"^2.33.3\",\n+ \"rollup-plugin-dts\": \"^2.0.0\",\n\"rollup-plugin-gzip\": \"^2.2.0\",\n\"rollup-plugin-terser\": \"^7.0.0\",\n\"rollup-plugin-typescript2\": \"^0.27.2\",\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/rollup.config.js", "new_path": "packages/giraffe/rollup.config.js", "diff": "@@ -3,6 +3,7 @@ import gzip from 'rollup-plugin-gzip'\nimport typescript from 'rollup-plugin-typescript2'\nimport pkg from './package.json'\nimport resolve from '@rollup/plugin-node-resolve'\n+import dts from 'rollup-plugin-dts'\nconst tsBuildConfigPath = './tsconfig.build.json'\n@@ -38,4 +39,9 @@ function createConfig({format, out, name, target, noTerser}) {\nexport default [\ncreateConfig({format: 'umd', out: pkg.main}),\ncreateConfig({format: 'esm', out: pkg.module}),\n+ {\n+ input: './dist/index.d.ts',\n+ output: [{file: './dist/all.d.ts', format: 'es'}],\n+ plugins: [dts()],\n+ },\n]\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -4492,7 +4492,7 @@ macos-release@^2.2.0:\nresolved \"https://registry.yarnpkg.com/macos-release/-/macos-release-2.4.1.tgz#64033d0ec6a5e6375155a74b1a1eba8e509820ac\"\nintegrity sha512-H/QHeBIN1fIGJX517pvK8IEK53yQOW7YcEI55oYtgjDdoCQQz7eJS94qt5kNrscReEyuD/JcdFCm2XBEcGOITg==\n-magic-string@^0.25.5:\n+magic-string@^0.25.5, magic-string@^0.25.7:\nversion \"0.25.7\"\nresolved \"https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051\"\nintegrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==\n@@ -6063,6 +6063,15 @@ rimraf@^3.0.0:\ndependencies:\nglob \"^7.1.3\"\n+rollup-plugin-dts@^2.0.0:\n+ version \"2.0.0\"\n+ resolved \"https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-2.0.0.tgz#9acc9b8320587cd5f0fafa1d9062833064e899e1\"\n+ integrity sha512-kDicSNT9m2z6swvJVqYnkgcVBusnlRD5qCtloqWlalmi4T/gS6mQqICYAEs+YzeBw0sn+9ZIrwu2UeDpV3uyLQ==\n+ dependencies:\n+ magic-string \"^0.25.7\"\n+ optionalDependencies:\n+ \"@babel/code-frame\" \"^7.10.4\"\n+\nrollup-plugin-gzip@^2.2.0:\nversion \"2.5.0\"\nresolved \"https://registry.yarnpkg.com/rollup-plugin-gzip/-/rollup-plugin-gzip-2.5.0.tgz#786650e7bddf86d7f723c205c3e3018ea727388c\"\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(build): generate one d.ts file
305,159
23.11.2020 17:28:09
-3,600
35e608f23e5678030edd6d199967782876319e97
feat(build): add exports section to package.json to describe various build types
[ { "change_type": "MODIFY", "old_path": "packages/apis/package.json", "new_path": "packages/apis/package.json", "diff": "\"module\": \"dist/index.mjs\",\n\"browser\": \"dist/index.browser.js\",\n\"types\": \"dist/all.d.ts\",\n+ \"exports\": {\n+ \".\": {\n+ \"import\": \"./dist/index.mjs\",\n+ \"require\": \"./dist/index.js\",\n+ \"deno\": \"./dist/index.mjs\",\n+ \"browser\": {\n+ \"import\": \"./dist/index.mjs\",\n+ \"require\": \"./dist/index.js\",\n+ \"umd\": \"./dist/index.browser.js\",\n+ \"script\": \"./dist/influxdbApis.js\"\n+ }\n+ }\n+ },\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n" }, { "change_type": "MODIFY", "old_path": "packages/core-browser/package.json", "new_path": "packages/core-browser/package.json", "diff": "\"module:browser\": \"dist/index.browser.mjs\",\n\"browser\": \"dist/index.browser.js\",\n\"types\": \"dist/all.d.ts\",\n+ \"exports\": {\n+ \".\": {\n+ \"import\": \"./dist/index.browser.mjs\",\n+ \"require\": \"./dist/index.browser.js\",\n+ \"deno\": \"./dist/index.browser.mjs\",\n+ \"node\": {\n+ \"import\": \"./dist/index.mjs\",\n+ \"require\": \"./dist/index.js\"\n+ },\n+ \"browser\": {\n+ \"import\": \"./dist/index.browser.mjs\",\n+ \"require\": \"./dist/index.browser.js\",\n+ \"script\": \"./dist/influxdb.js\",\n+ \"umd\": \"./dist/index.browser.js\"\n+ }\n+ }\n+ },\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n" }, { "change_type": "MODIFY", "old_path": "packages/core/package.json", "new_path": "packages/core/package.json", "diff": "\"module:browser\": \"dist/index.browser.mjs\",\n\"browser\": \"dist/index.browser.js\",\n\"types\": \"dist/all.d.ts\",\n+ \"exports\": {\n+ \".\": {\n+ \"import\": \"./dist/index.mjs\",\n+ \"require\": \"./dist/index.js\",\n+ \"deno\": \"./dist/index.browser.mjs\",\n+ \"browser\": {\n+ \"import\": \"./dist/index.browser.mjs\",\n+ \"require\": \"./dist/index.browser.js\",\n+ \"script\": \"./dist/influxdb.js\",\n+ \"default\": \"./dist/index.browser.js\"\n+ }\n+ }\n+ },\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n" }, { "change_type": "MODIFY", "old_path": "packages/giraffe/package.json", "new_path": "packages/giraffe/package.json", "diff": "\"main\": \"dist/index.js\",\n\"module\": \"dist/index.mjs\",\n\"types\": \"dist/all.d.ts\",\n+ \"exports\": {\n+ \".\": {\n+ \"import\": \"./dist/index.mjs\",\n+ \"require\": \"./dist/index.js\",\n+ \"default\": \"./dist/index.js\"\n+ }\n+ },\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n\"type\": \"git\",\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(build): add exports section to package.json to describe various build types
305,159
25.11.2020 10:05:20
-3,600
a231ece810675c983c23d4124015965fbef6b76d
fix(core): remove WritePrecision enum
[ { "change_type": "MODIFY", "old_path": "packages/core/src/InfluxDB.ts", "new_path": "packages/core/src/InfluxDB.ts", "diff": "import WriteApi from './WriteApi'\n-import {\n- ClientOptions,\n- WritePrecision,\n- WriteOptions,\n- WritePrecisionType,\n-} from './options'\n+import {ClientOptions, WriteOptions, WritePrecisionType} from './options'\nimport WriteApiImpl from './impl/WriteApiImpl'\nimport {IllegalArgumentError} from './errors'\nimport {Transport} from './transport'\n@@ -61,7 +56,7 @@ export default class InfluxDB {\ngetWriteApi(\norg: string,\nbucket: string,\n- precision: WritePrecisionType = WritePrecision.ns,\n+ precision: WritePrecisionType = 'ns',\nwriteOptions?: Partial<WriteOptions>\n): WriteApi {\nreturn new WriteApiImpl(\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -115,17 +115,7 @@ export interface ClientOptions extends ConnectionOptions {\n}\n/**\n- * Precission for write operations.\n+ * Timestamp precision used in write operations.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostWrite }\n*/\n-export const enum WritePrecision {\n- /** nanosecond */\n- ns = 'ns',\n- /* microsecond */\n- us = 'us',\n- /** millisecond */\n- ms = 'ms',\n- /* second */\n- s = 's',\n-}\n-export type WritePrecisionType = keyof typeof WritePrecision | WritePrecision\n+export type WritePrecisionType = 'ns' | 'us' | 'ms' | 's'\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/Influxdb.test.ts", "new_path": "packages/core/test/unit/Influxdb.test.ts", "diff": "import {expect} from 'chai'\n-import {InfluxDB, ClientOptions, WritePrecision} from '../../src'\n+import {InfluxDB, ClientOptions} from '../../src'\ndescribe('InfluxDB', () => {\ndescribe('constructor', () => {\n@@ -89,7 +89,6 @@ describe('InfluxDB', () => {\nconst influxDb = new InfluxDB('http://localhost:8086?token=a')\nit('serves queryApi writeApi without a pending schedule', () => {\nexpect(influxDb.getWriteApi('org', 'bucket')).to.be.ok\n- expect(influxDb.getWriteApi('org', 'bucket', WritePrecision.s)).to.be.ok\nexpect(influxDb.getWriteApi('org', 'bucket', 's')).to.be.ok\n})\nit('serves queryApi', () => {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -3,7 +3,6 @@ import nock from 'nock' // WARN: nock must be imported before NodeHttpTransport,\nimport {\nClientOptions,\nHttpError,\n- WritePrecision,\nWriteOptions,\nPoint,\nWriteApi,\n@@ -21,7 +20,7 @@ const clientOptions: ClientOptions = {\n}\nconst ORG = 'org'\nconst BUCKET = 'bucket'\n-const PRECISION = WritePrecision.s\n+const PRECISION: WritePrecisionType = 's'\nconst WRITE_PATH_NS = `/api/v2/write?org=${ORG}&bucket=${BUCKET}&precision=ns`\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core): remove WritePrecision enum
305,159
25.11.2020 11:24:21
-3,600
0186d5da7ec2dd7fb1c2a935ea59293ad56de458
feat(deno): add query.deno.ts example
[ { "change_type": "ADD", "old_path": null, "new_path": "examples/query.deno.ts", "diff": "+#!/usr/bin/env -S deno run --allow-net\n+//////////////////////////////////////////////////////\n+// A modified query.ts example that works with deno //\n+//////////////////////////////////////////////////////\n+\n+import {\n+ InfluxDB,\n+ FluxTableMetaData,\n+} from 'https://cdn.skypack.dev/@influxdata/[email protected]?dts'\n+\n+const url = 'http://localhost:8086'\n+const token = 'my-token'\n+const org = 'my-org'\n+\n+const queryApi = new InfluxDB({url, token}).getQueryApi(org)\n+const fluxQuery =\n+ 'from(bucket:\"my-bucket\" ) |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")'\n+\n+console.log('** QUERY ROWS ***')\n+queryApi.queryRows(fluxQuery, {\n+ next(row: string[], tableMeta: FluxTableMetaData) {\n+ const o = tableMeta.toObject(row)\n+ // console.log(JSON.stringify(o, null, 2))\n+ console.log(\n+ `${o._time} ${o._measurement} in '${o.location}' (${o.example}): ${o._field}=${o._value}`\n+ )\n+ },\n+ error(error: Error) {\n+ console.error(error)\n+ console.log('\\nFinished ERROR')\n+ },\n+ complete() {\n+ console.log('\\nFinished SUCCESS')\n+ },\n+})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(deno): add query.deno.ts example
305,159
25.11.2020 11:35:40
-3,600
b74cde976f7625631438bea9ec445935ba773618
chore(deno): apply deno fmt to query.deno.ts example
[ { "change_type": "MODIFY", "old_path": "examples/query.deno.ts", "new_path": "examples/query.deno.ts", "diff": "//////////////////////////////////////////////////////\nimport {\n- InfluxDB,\nFluxTableMetaData,\n-} from 'https://cdn.skypack.dev/@influxdata/[email protected]?dts'\n+ InfluxDB,\n+} from \"https://cdn.skypack.dev/@influxdata/[email protected]?dts\";\n-const url = 'http://localhost:8086'\n-const token = 'my-token'\n-const org = 'my-org'\n+const url = \"http://localhost:8086\";\n+const token = \"my-token\";\n+const org = \"my-org\";\n-const queryApi = new InfluxDB({url, token}).getQueryApi(org)\n+const queryApi = new InfluxDB({ url, token }).getQueryApi(org);\nconst fluxQuery =\n- 'from(bucket:\"my-bucket\" ) |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")'\n+ 'from(bucket:\"my-bucket\" ) |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")';\n-console.log('** QUERY ROWS ***')\n+console.log(\"** QUERY ROWS ***\");\nqueryApi.queryRows(fluxQuery, {\nnext(row: string[], tableMeta: FluxTableMetaData) {\n- const o = tableMeta.toObject(row)\n+ const o = tableMeta.toObject(row);\n// console.log(JSON.stringify(o, null, 2))\nconsole.log(\n- `${o._time} ${o._measurement} in '${o.location}' (${o.example}): ${o._field}=${o._value}`\n- )\n+ `${o._time} ${o._measurement} in '${o.location}' (${o.example}): ${o._field}=${o._value}`,\n+ );\n},\nerror(error: Error) {\n- console.error(error)\n- console.log('\\nFinished ERROR')\n+ console.error(error);\n+ console.log(\"\\nFinished ERROR\");\n},\ncomplete() {\n- console.log('\\nFinished SUCCESS')\n+ console.log(\"\\nFinished SUCCESS\");\n},\n-})\n+});\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(deno): apply deno fmt to query.deno.ts example
305,159
25.11.2020 11:41:56
-3,600
d76ef3ae118812ea9753001dcaafff3cf0c16eb2
chore(deno): disable prettier in deno example, deno fmt is used
[ { "change_type": "MODIFY", "old_path": "examples/.eslintrc.json", "new_path": "examples/.eslintrc.json", "diff": "\"rules\": {\n\"@typescript-eslint/explicit-function-return-type\": \"off\"\n}\n+ },\n+ {\n+ \"files\": [\"query.deno.ts\"],\n+ \"rules\": {\n+ \"prettier/prettier\": \"off\"\n+ }\n}\n]\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(deno): disable prettier in deno example, deno fmt is used
305,159
26.11.2020 11:32:42
-3,600
86782b25e887727210b759be4c06e456cda2c4f4
feat(deno): add deno query example
[ { "change_type": "MODIFY", "old_path": "examples/README.md", "new_path": "examples/README.md", "diff": "This directory contains javascript and typescript examples for node.js and browser environments.\n+- Node.js examples\n- Prerequisites\n- [node](https://nodejs.org/en/) installed\n- Run `npm install` in this directory\n-- Node.js examples\n- Change variables in [./env.js](env.js) to configure connection to your InfluxDB instance. The file can be used as-is against a new [docker InfluxDB v2.0 OSS GA installation](https://v2.docs.influxdata.com/v2.0/get-started/)\n- Examples are executable. If it does not work for you, run `npm run ts-node EXAMPLE.ts`.\n- [write.js](./write.js)\n@@ -35,3 +35,6 @@ This directory contains javascript and typescript examples for node.js and brows\nto a configured influxDB database, see [scripts/server.js](./scripts/server.js) for details.\n- Click `Visualize with Giraffe Line Chart` to open [giraffe.html](./giraffe.html) that\nshows how visualize query results with [@influxdata/giraffe](https://github.com/influxdata/giraffe).\n+- Deno examples\n+ - [query.deno.ts](./query.deno.ts) shows how to query InfluxDB with [Flux](https://v2.docs.influxdata.com/v2.0/query-data/get-started/).\n+ It is almost the same as node's [query.ts](./query.ts) example, the difference is the import statement that works in [deno](https://deno.land) and built-in typescript support.\n" }, { "change_type": "MODIFY", "old_path": "examples/query.deno.ts", "new_path": "examples/query.deno.ts", "diff": "import {\nFluxTableMetaData,\nInfluxDB,\n-} from \"https://cdn.skypack.dev/@influxdata/[email protected]?dts\";\n+} from 'https://cdn.skypack.dev/@influxdata/[email protected]?dts'\n-const url = \"http://localhost:8086\";\n-const token = \"my-token\";\n-const org = \"my-org\";\n+const url = 'http://localhost:8086'\n+const token = 'my-token'\n+const org = 'my-org'\n-const queryApi = new InfluxDB({ url, token }).getQueryApi(org);\n+const queryApi = new InfluxDB({url, token}).getQueryApi(org)\nconst fluxQuery =\n- 'from(bucket:\"my-bucket\" ) |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")';\n+ 'from(bucket:\"my-bucket\" ) |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")'\n-console.log(\"** QUERY ROWS ***\");\n+console.log('** QUERY ROWS ***')\nqueryApi.queryRows(fluxQuery, {\nnext(row: string[], tableMeta: FluxTableMetaData) {\n- const o = tableMeta.toObject(row);\n+ const o = tableMeta.toObject(row)\n// console.log(JSON.stringify(o, null, 2))\nconsole.log(\n- `${o._time} ${o._measurement} in '${o.location}' (${o.example}): ${o._field}=${o._value}`,\n- );\n+ `${o._time} ${o._measurement} in '${o.location}' (${o.example}): ${o._field}=${o._value}`\n+ )\n},\nerror(error: Error) {\n- console.error(error);\n- console.log(\"\\nFinished ERROR\");\n+ console.error(error)\n+ console.log('\\nFinished ERROR')\n},\ncomplete() {\n- console.log(\"\\nFinished SUCCESS\");\n+ console.log('\\nFinished SUCCESS')\n},\n-});\n+})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(deno): add deno query example
305,159
05.01.2021 10:43:50
-3,600
36ccf31a4c2a08676303cc11a1150eb4f09df061
feat(core): allow to access escaped field values
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -17,7 +17,8 @@ export interface PointSettings {\nexport class Point {\nprivate name: string\nprivate tags: {[key: string]: string} = {}\n- private fields: {[key: string]: string} = {}\n+ /** escaped field values */\n+ public fields: {[key: string]: string} = {}\nprivate time: string | number | Date | undefined\n/**\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): allow to access escaped field values
305,159
05.01.2021 10:46:14
-3,600
13571bcd4ee51dd4384b4eb2e85cb57afc4dc47c
feat(core): enhance WriteApi interface to extend PointSettings
[ { "change_type": "MODIFY", "old_path": "packages/core/src/WriteApi.ts", "new_path": "packages/core/src/WriteApi.ts", "diff": "-import {Point} from './Point'\n+import {Point, PointSettings} from './Point'\n/**\n* The asynchronous buffering API to Write time-series data into InfluxDB 2.0.\n@@ -9,7 +9,7 @@ import {Point} from './Point'\n* The data are formatted in [Line Protocol](https://bit.ly/2QL99fu).\n* <p>\n*/\n-export default interface WriteApi {\n+export default interface WriteApi extends PointSettings {\n/**\n* Instructs to use the following default tags when writing points.\n* Not applicable for writing records/lines.\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -8,7 +8,7 @@ import {Transport, SendOptions} from '../transport'\nimport {Headers} from '../results'\nimport Logger from './Logger'\nimport {HttpError, RetryDelayStrategy} from '../errors'\n-import {Point, PointSettings} from '../Point'\n+import {Point} from '../Point'\nimport {escape} from '../util/escape'\nimport {currentTime, dateToProtocolTimestamp} from '../util/currentTime'\nimport {createRetryDelayStrategy} from './retryStrategy'\n@@ -53,7 +53,7 @@ class WriteBuffer {\n}\n}\n-export default class WriteApiImpl implements WriteApi, PointSettings {\n+export default class WriteApiImpl implements WriteApi {\nprivate writeBuffer: WriteBuffer\nprivate closed = false\nprivate httpPath: string\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): enhance WriteApi interface to extend PointSettings
305,159
16.12.2020 14:20:20
-3,600
c3e4b48009fd1bacd38c525be1bcf2fd1a0e34af
feat(apis): regenerate APIs from swagger 2.0.3
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "### Features\n1. [#296](https://github.com/influxdata/influxdb-client-js/pull/296): Allow to specify escaped field values.\n+1. [#295](https://github.com/influxdata/influxdb-client-js/pull/295): Regenerate APIs from InfluxDB 2.0.3 swagger.\n## 1.9.0 [2020-12-04]\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/DEVELOPMENT.md", "new_path": "packages/apis/DEVELOPMENT.md", "diff": "@@ -12,7 +12,7 @@ $ yarn build\n- update local resources/swagger.yml to the latest version\n- `wget -O resources/swagger.yml https://raw.githubusercontent.com/influxdata/influxdb/master/http/swagger.yml`\n-- re-generate src/generated/types.ts and resources/operations.json\n+- re-generate src/generated/types.ts and resources/operations.json using [oats](https://github.com/influxdata/oats)\n- `rm -rf src/generated/*.ts`\n- `oats -i 'types' --storeOperations resources/operations.json resources/swagger.yml > src/generated/types.ts`\n- generate src/generated APIs from resources/operations.json\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/resources/operations.json", "new_path": "packages/apis/resources/operations.json", "diff": "\"server\": \"/api/v2\",\n\"path\": \"/delete\",\n\"operation\": \"post\",\n+ \"operationId\": \"PostDelete\",\n\"basicAuth\": false,\n\"summary\": \"Delete time series data from InfluxDB\",\n\"positionalParams\": [],\n\"operation\": \"post\",\n\"operationId\": \"PostSources\",\n\"basicAuth\": false,\n- \"summary\": \"Creates a source\",\n+ \"summary\": \"Create a source\",\n\"positionalParams\": [],\n\"headerParams\": [\n{\n\"operation\": \"get\",\n\"operationId\": \"GetDashboardsIDLabels\",\n\"basicAuth\": false,\n- \"summary\": \"list all labels for a dashboard\",\n+ \"summary\": \"List all labels for a dashboard\",\n\"positionalParams\": [\n{\n\"name\": \"dashboardID\",\n\"operation\": \"delete\",\n\"operationId\": \"DeleteAuthorizationsID\",\n\"basicAuth\": false,\n- \"summary\": \"Delete a authorization\",\n+ \"summary\": \"Delete an authorization\",\n\"positionalParams\": [\n{\n\"name\": \"authID\",\n\"operation\": \"delete\",\n\"operationId\": \"DeleteBucketsIDLabelsID\",\n\"basicAuth\": false,\n- \"summary\": \"delete a label from a bucket\",\n+ \"summary\": \"Delete a label from a bucket\",\n\"positionalParams\": [\n{\n\"name\": \"bucketID\",\n\"description\": \"Export resources as an InfluxDB template.\",\n\"required\": false,\n\"mediaType\": \"application/json\",\n- \"type\": \"TemplateExport\"\n+ \"type\": \"TemplateExportByID | TemplateExportByName\"\n},\n\"responses\": [\n{\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/resources/swagger.yml", "new_path": "packages/apis/resources/swagger.yml", "diff": "@@ -1873,6 +1873,7 @@ paths:\n$ref: \"#/components/schemas/Error\"\n/delete:\npost:\n+ operationId: PostDelete\nsummary: Delete time series data from InfluxDB\nrequestBody:\ndescription: Predicate delete request\n@@ -1990,7 +1991,7 @@ paths:\noperationId: PostSources\ntags:\n- Sources\n- summary: Creates a source\n+ summary: Create a source\nparameters:\n- $ref: \"#/components/parameters/TraceSpan\"\nrequestBody:\n@@ -2814,7 +2815,7 @@ paths:\noperationId: GetDashboardsIDLabels\ntags:\n- Dashboards\n- summary: list all labels for a dashboard\n+ summary: List all labels for a dashboard\nparameters:\n- $ref: \"#/components/parameters/TraceSpan\"\n- in: path\n@@ -3305,7 +3306,7 @@ paths:\noperationId: DeleteAuthorizationsID\ntags:\n- Authorizations\n- summary: Delete a authorization\n+ summary: Delete an authorization\nparameters:\n- $ref: \"#/components/parameters/TraceSpan\"\n- in: path\n@@ -3681,7 +3682,7 @@ paths:\noperationId: DeleteBucketsIDLabelsID\ntags:\n- Buckets\n- summary: delete a label from a bucket\n+ summary: Delete a label from a bucket\nparameters:\n- $ref: \"#/components/parameters/TraceSpan\"\n- in: path\n@@ -4602,7 +4603,9 @@ paths:\ncontent:\napplication/json:\nschema:\n- $ref: \"#/components/schemas/TemplateExport\"\n+ oneOf:\n+ - $ref: \"#/components/schemas/TemplateExportByID\"\n+ - $ref: \"#/components/schemas/TemplateExportByName\"\nresponses:\n\"200\":\ndescription: InfluxDB template created\n@@ -7022,15 +7025,15 @@ components:\nmaxLength: 1\nminLength: 1\nannotations:\n- description: Https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns\n+ description: https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns\ntype: array\n+ uniqueItems: true\nitems:\ntype: string\nenum:\n- \"group\"\n- \"datatype\"\n- \"default\"\n- uniqueItems: true\ncommentPrefix:\ndescription: Character prefixed to comment strings\ntype: string\n@@ -7126,7 +7129,7 @@ components:\ndescription: ID of org that authorization is scoped to.\npermissions:\ntype: array\n- minLength: 1\n+ minItems: 1\ndescription: List of permissions for an auth. An auth must have at least one Permission.\nitems:\n$ref: \"#/components/schemas/Permission\"\n@@ -7475,7 +7478,7 @@ components:\n- Task\n- Telegraf\n- Variable\n- TemplateExport:\n+ TemplateExportByID:\ntype: object\nproperties:\nstackID:\n@@ -7507,7 +7510,39 @@ components:\n$ref: \"#/components/schemas/TemplateKind\"\nname:\ntype: string\n+ description: \"if defined with id, name is used for resource exported by id. if defined independently, resources strictly matching name are exported\"\nrequired: [id, kind]\n+ TemplateExportByName:\n+ type: object\n+ properties:\n+ stackID:\n+ type: string\n+ orgIDs:\n+ type: array\n+ items:\n+ type: object\n+ properties:\n+ orgID:\n+ type: string\n+ resourceFilters:\n+ type: object\n+ properties:\n+ byLabel:\n+ type: array\n+ items:\n+ type: string\n+ byResourceKind:\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/TemplateKind\"\n+ resources:\n+ type: object\n+ properties:\n+ kind:\n+ $ref: \"#/components/schemas/TemplateKind\"\n+ name:\n+ type: string\n+ required: [name, kind]\nTemplate:\ntype: array\nitems:\n@@ -8445,45 +8480,6 @@ components:\nTaskStatusType:\ntype: string\nenum: [active, inactive]\n- Invite:\n- properties:\n- id:\n- description: the idpe id of the invite\n- readOnly: true\n- type: string\n- email:\n- type: string\n- role:\n- type: string\n- enum:\n- - member\n- - owner\n- expiresAt:\n- format: date-time\n- type: string\n- links:\n- type: object\n- readOnly: true\n- example:\n- self: \"/api/v2/invites/1\"\n- properties:\n- self:\n- type: string\n- format: uri\n- required: [id, email, role]\n- Invites:\n- type: object\n- properties:\n- links:\n- type: object\n- properties:\n- self:\n- type: string\n- format: uri\n- invites:\n- type: array\n- items:\n- $ref: \"#/components/schemas/Invite\"\nUser:\nproperties:\nid:\n@@ -8944,8 +8940,32 @@ components:\n$ref: \"#/components/schemas/Legend\"\nxColumn:\ntype: string\n+ generateXAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ xTotalTicks:\n+ type: integer\n+ xTickStart:\n+ type: number\n+ format: float\n+ xTickStep:\n+ type: number\n+ format: float\nyColumn:\ntype: string\n+ generateYAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ yTotalTicks:\n+ type: integer\n+ yTickStart:\n+ type: number\n+ format: float\n+ yTickStep:\n+ type: number\n+ format: float\nshadeBelow:\ntype: boolean\nhoverDimension:\n@@ -8956,6 +8976,13 @@ components:\nenum: [overlaid, stacked]\ngeom:\n$ref: \"#/components/schemas/XYGeom\"\n+ legendColorizeRows:\n+ type: boolean\n+ legendOpacity:\n+ type: number\n+ format: float\n+ legendOrientationThreshold:\n+ type: integer\nXYGeom:\ntype: string\nenum: [line, step, stacked, bar, monotoneX]\n@@ -9000,8 +9027,32 @@ components:\n$ref: \"#/components/schemas/Legend\"\nxColumn:\ntype: string\n+ generateXAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ xTotalTicks:\n+ type: integer\n+ xTickStart:\n+ type: number\n+ format: float\n+ xTickStep:\n+ type: number\n+ format: float\nyColumn:\ntype: string\n+ generateYAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ yTotalTicks:\n+ type: integer\n+ yTickStart:\n+ type: number\n+ format: float\n+ yTickStep:\n+ type: number\n+ format: float\nupperColumn:\ntype: string\nmainColumn:\n@@ -9013,6 +9064,13 @@ components:\nenum: [auto, x, y, xy]\ngeom:\n$ref: \"#/components/schemas/XYGeom\"\n+ legendColorizeRows:\n+ type: boolean\n+ legendOpacity:\n+ type: number\n+ format: float\n+ legendOrientationThreshold:\n+ type: integer\nLinePlusSingleStatProperties:\ntype: object\nrequired:\n@@ -9057,8 +9115,32 @@ components:\n$ref: \"#/components/schemas/Legend\"\nxColumn:\ntype: string\n+ generateXAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ xTotalTicks:\n+ type: integer\n+ xTickStart:\n+ type: number\n+ format: float\n+ xTickStep:\n+ type: number\n+ format: float\nyColumn:\ntype: string\n+ generateYAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ yTotalTicks:\n+ type: integer\n+ yTickStart:\n+ type: number\n+ format: float\n+ yTickStep:\n+ type: number\n+ format: float\nshadeBelow:\ntype: boolean\nhoverDimension:\n@@ -9073,6 +9155,13 @@ components:\ntype: string\ndecimalPlaces:\n$ref: \"#/components/schemas/DecimalPlaces\"\n+ legendColorizeRows:\n+ type: boolean\n+ legendOpacity:\n+ type: number\n+ format: float\n+ legendOrientationThreshold:\n+ type: integer\nMosaicViewProperties:\ntype: object\nrequired:\n@@ -9118,6 +9207,18 @@ components:\ntype: boolean\nxColumn:\ntype: string\n+ generateXAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ xTotalTicks:\n+ type: integer\n+ xTickStart:\n+ type: number\n+ format: float\n+ xTickStep:\n+ type: number\n+ format: float\nySeriesColumns:\ntype: array\nitems:\n@@ -9148,6 +9249,13 @@ components:\ntype: string\nySuffix:\ntype: string\n+ legendColorizeRows:\n+ type: boolean\n+ legendOpacity:\n+ type: number\n+ format: float\n+ legendOrientationThreshold:\n+ type: integer\nScatterViewProperties:\ntype: object\nrequired:\n@@ -9194,8 +9302,32 @@ components:\ntype: boolean\nxColumn:\ntype: string\n+ generateXAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ xTotalTicks:\n+ type: integer\n+ xTickStart:\n+ type: number\n+ format: float\n+ xTickStep:\n+ type: number\n+ format: float\nyColumn:\ntype: string\n+ generateYAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ yTotalTicks:\n+ type: integer\n+ yTickStart:\n+ type: number\n+ format: float\n+ yTickStep:\n+ type: number\n+ format: float\nfillColumns:\ntype: array\nitems:\n@@ -9226,6 +9358,13 @@ components:\ntype: string\nySuffix:\ntype: string\n+ legendColorizeRows:\n+ type: boolean\n+ legendOpacity:\n+ type: number\n+ format: float\n+ legendOrientationThreshold:\n+ type: integer\nHeatmapViewProperties:\ntype: object\nrequired:\n@@ -9271,8 +9410,32 @@ components:\ntype: boolean\nxColumn:\ntype: string\n+ generateXAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ xTotalTicks:\n+ type: integer\n+ xTickStart:\n+ type: number\n+ format: float\n+ xTickStep:\n+ type: number\n+ format: float\nyColumn:\ntype: string\n+ generateYAxisTicks:\n+ type: array\n+ items:\n+ type: string\n+ yTotalTicks:\n+ type: integer\n+ yTickStart:\n+ type: number\n+ format: float\n+ yTickStep:\n+ type: number\n+ format: float\nxDomain:\ntype: array\nitems:\n@@ -9297,6 +9460,13 @@ components:\ntype: string\nbinSize:\ntype: number\n+ legendColorizeRows:\n+ type: boolean\n+ legendOpacity:\n+ type: number\n+ format: float\n+ legendOrientationThreshold:\n+ type: integer\nSingleStatViewProperties:\ntype: object\nrequired:\n@@ -9399,6 +9569,13 @@ components:\nenum: [overlaid, stacked]\nbinCount:\ntype: integer\n+ legendColorizeRows:\n+ type: boolean\n+ legendOpacity:\n+ type: number\n+ format: float\n+ legendOrientationThreshold:\n+ type: integer\nGaugeViewProperties:\ntype: object\nrequired:\n@@ -9561,6 +9738,13 @@ components:\ntype: array\nitems:\n$ref: \"#/components/schemas/DashboardColor\"\n+ legendColorizeRows:\n+ type: boolean\n+ legendOpacity:\n+ type: number\n+ format: float\n+ legendOrientationThreshold:\n+ type: integer\nAxes:\ndescription: The viewport for a View's visualizations\ntype: object\n@@ -10080,6 +10264,10 @@ components:\nbucketID:\ntype: string\ndescription: The ID of the bucket to write to.\n+ allowInsecure:\n+ type: boolean\n+ description: Skip TLS verification on endpoint.\n+ default: false\nScraperTargetResponse:\ntype: object\nallOf:\n@@ -10854,7 +11042,7 @@ components:\nexample: { \"color\": \"ffb3b3\", \"description\": \"this is a description\" }\nLabelCreateRequest:\ntype: object\n- required: [orgID]\n+ required: [orgID, name]\nproperties:\norgID:\ntype: string\n@@ -11625,12 +11813,7 @@ components:\ntype: string\nenum: [\"slack\", \"pagerduty\", \"http\", \"telegram\"]\nDBRP:\n- required:\n- - orgID\n- - org\n- - bucketID\n- - database\n- - retention_policy\n+ type: object\nproperties:\nid:\ntype: string\n@@ -11656,6 +11839,17 @@ components:\ndescription: Specify if this mapping represents the default retention policy for the database specificed.\nlinks:\n$ref: \"#/components/schemas/Links\"\n+ oneOf:\n+ - required:\n+ - orgID\n+ - bucketID\n+ - database\n+ - retention_policy\n+ - required:\n+ - org\n+ - bucketID\n+ - database\n+ - retention_policy\nDBRPs:\nproperties:\nnotificationEndpoints:\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/AuthorizationsAPI.ts", "new_path": "packages/apis/src/generated/AuthorizationsAPI.ts", "diff": "@@ -128,7 +128,7 @@ export class AuthorizationsAPI {\n)\n}\n/**\n- * Delete a authorization.\n+ * Delete an authorization.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/DeleteAuthorizationsID }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/BucketsAPI.ts", "new_path": "packages/apis/src/generated/BucketsAPI.ts", "diff": "@@ -244,7 +244,7 @@ export class BucketsAPI {\n)\n}\n/**\n- * delete a label from a bucket.\n+ * Delete a label from a bucket.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/DeleteBucketsIDLabelsID }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/DashboardsAPI.ts", "new_path": "packages/apis/src/generated/DashboardsAPI.ts", "diff": "@@ -382,7 +382,7 @@ export class DashboardsAPI {\n)\n}\n/**\n- * list all labels for a dashboard.\n+ * List all labels for a dashboard.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetDashboardsIDLabels }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/SourcesAPI.ts", "new_path": "packages/apis/src/generated/SourcesAPI.ts", "diff": "@@ -67,7 +67,7 @@ export class SourcesAPI {\n)\n}\n/**\n- * Creates a source.\n+ * Create a source.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostSources }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/TemplatesAPI.ts", "new_path": "packages/apis/src/generated/TemplatesAPI.ts", "diff": "import {InfluxDB} from '@influxdata/influxdb-client'\nimport {APIBase, RequestOptions} from '../APIBase'\n-import {Template, TemplateApply, TemplateExport, TemplateSummary} from './types'\n+import {\n+ Template,\n+ TemplateApply,\n+ TemplateExportByID,\n+ TemplateExportByName,\n+ TemplateSummary,\n+} from './types'\nexport interface ApplyTemplateRequest {\n/** entity body */\n@@ -8,7 +14,7 @@ export interface ApplyTemplateRequest {\n}\nexport interface ExportTemplateRequest {\n/** Export resources as an InfluxDB template. */\n- body: TemplateExport\n+ body: TemplateExportByID | TemplateExportByName\n}\n/**\n* Templates API\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/types.ts", "new_path": "packages/apis/src/generated/types.ts", "diff": "@@ -300,9 +300,9 @@ export interface DBRP {\n/** the mapping identifier */\nreadonly id?: string\n/** the organization ID that owns this mapping. */\n- orgID: string\n+ orgID?: string\n/** the organization that owns this mapping. */\n- org: string\n+ org?: string\n/** the bucket ID used as target for the translation. */\nbucketID: string\n/** InfluxDB v1 database */\n@@ -418,6 +418,8 @@ export interface ScraperTargetRequest {\norgID?: string\n/** The ID of the bucket to write to. */\nbucketID?: string\n+ /** Skip TLS verification on endpoint. */\n+ allowInsecure?: boolean\n}\nexport interface Variables {\n@@ -557,7 +559,7 @@ export interface Buckets {\nexport interface LabelCreateRequest {\norgID: string\n- name?: string\n+ name: string\n/** Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. */\nproperties?: any\n}\n@@ -668,13 +670,24 @@ export interface LinePlusSingleStatProperties {\naxes: Axes\nlegend: Legend\nxColumn?: string\n+ generateXAxisTicks?: string[]\n+ xTotalTicks?: number\n+ xTickStart?: number\n+ xTickStep?: number\nyColumn?: string\n+ generateYAxisTicks?: string[]\n+ yTotalTicks?: number\n+ yTickStart?: number\n+ yTickStep?: number\nshadeBelow?: boolean\nhoverDimension?: 'auto' | 'x' | 'y' | 'xy'\nposition: 'overlaid' | 'stacked'\nprefix: string\nsuffix: string\ndecimalPlaces: DecimalPlaces\n+ legendColorizeRows?: boolean\n+ legendOpacity?: number\n+ legendOrientationThreshold?: number\n}\nexport interface DashboardQuery {\n@@ -788,11 +801,22 @@ export interface XYViewProperties {\naxes: Axes\nlegend: Legend\nxColumn?: string\n+ generateXAxisTicks?: string[]\n+ xTotalTicks?: number\n+ xTickStart?: number\n+ xTickStep?: number\nyColumn?: string\n+ generateYAxisTicks?: string[]\n+ yTotalTicks?: number\n+ yTickStart?: number\n+ yTickStep?: number\nshadeBelow?: boolean\nhoverDimension?: 'auto' | 'x' | 'y' | 'xy'\nposition: 'overlaid' | 'stacked'\ngeom: XYGeom\n+ legendColorizeRows?: boolean\n+ legendOpacity?: number\n+ legendOrientationThreshold?: number\n}\nexport type XYGeom = 'line' | 'step' | 'stacked' | 'bar' | 'monotoneX'\n@@ -829,6 +853,9 @@ export interface HistogramViewProperties {\nxAxisLabel: string\nposition: 'overlaid' | 'stacked'\nbinCount: number\n+ legendColorizeRows?: boolean\n+ legendOpacity?: number\n+ legendOrientationThreshold?: number\n}\nexport interface GaugeViewProperties {\n@@ -899,6 +926,9 @@ export interface CheckViewProperties {\nqueries: DashboardQuery[]\n/** Colors define color encoding of data into a visualization */\ncolors: DashboardColor[]\n+ legendColorizeRows?: boolean\n+ legendOpacity?: number\n+ legendOrientationThreshold?: number\n}\nexport type Check = CheckDiscriminator\n@@ -1028,7 +1058,15 @@ export interface ScatterViewProperties {\n/** If true, will display note when empty */\nshowNoteWhenEmpty: boolean\nxColumn: string\n+ generateXAxisTicks?: string[]\n+ xTotalTicks?: number\n+ xTickStart?: number\n+ xTickStep?: number\nyColumn: string\n+ generateYAxisTicks?: string[]\n+ yTotalTicks?: number\n+ yTickStart?: number\n+ yTickStep?: number\nfillColumns: string[]\nsymbolColumns: string[]\nxDomain: number[]\n@@ -1039,6 +1077,9 @@ export interface ScatterViewProperties {\nxSuffix: string\nyPrefix: string\nySuffix: string\n+ legendColorizeRows?: boolean\n+ legendOpacity?: number\n+ legendOrientationThreshold?: number\n}\nexport interface HeatmapViewProperties {\n@@ -1052,7 +1093,15 @@ export interface HeatmapViewProperties {\n/** If true, will display note when empty */\nshowNoteWhenEmpty: boolean\nxColumn: string\n+ generateXAxisTicks?: string[]\n+ xTotalTicks?: number\n+ xTickStart?: number\n+ xTickStep?: number\nyColumn: string\n+ generateYAxisTicks?: string[]\n+ yTotalTicks?: number\n+ yTickStart?: number\n+ yTickStep?: number\nxDomain: number[]\nyDomain: number[]\nxAxisLabel: string\n@@ -1062,6 +1111,9 @@ export interface HeatmapViewProperties {\nyPrefix: string\nySuffix: string\nbinSize: number\n+ legendColorizeRows?: boolean\n+ legendOpacity?: number\n+ legendOrientationThreshold?: number\n}\nexport interface MosaicViewProperties {\n@@ -1075,6 +1127,10 @@ export interface MosaicViewProperties {\n/** If true, will display note when empty */\nshowNoteWhenEmpty: boolean\nxColumn: string\n+ generateXAxisTicks?: string[]\n+ xTotalTicks?: number\n+ xTickStart?: number\n+ xTickStep?: number\nySeriesColumns: string[]\nfillColumns: string[]\nxDomain: number[]\n@@ -1085,6 +1141,9 @@ export interface MosaicViewProperties {\nxSuffix: string\nyPrefix: string\nySuffix: string\n+ legendColorizeRows?: boolean\n+ legendOpacity?: number\n+ legendOrientationThreshold?: number\n}\nexport interface BandViewProperties {\n@@ -1100,12 +1159,23 @@ export interface BandViewProperties {\naxes: Axes\nlegend: Legend\nxColumn?: string\n+ generateXAxisTicks?: string[]\n+ xTotalTicks?: number\n+ xTickStart?: number\n+ xTickStep?: number\nyColumn?: string\n+ generateYAxisTicks?: string[]\n+ yTotalTicks?: number\n+ yTickStart?: number\n+ yTickStep?: number\nupperColumn?: string\nmainColumn?: string\nlowerColumn?: string\nhoverDimension?: 'auto' | 'x' | 'y' | 'xy'\ngeom: XYGeom\n+ legendColorizeRows?: boolean\n+ legendOpacity?: number\n+ legendOrientationThreshold?: number\n}\nexport interface CreateCell {\n@@ -1558,7 +1628,7 @@ export interface Dialect {\nheader?: boolean\n/** Separator between cells; the default is , */\ndelimiter?: string\n- /** Https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns */\n+ /** https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns */\nannotations?: Array<'group' | 'datatype' | 'default'>\n/** Character prefixed to comment strings */\ncommentPrefix?: string\n@@ -2092,7 +2162,7 @@ export type TelegramNotificationEndpoint = NotificationEndpointBase & {\nchannel: string\n}\n-export interface TemplateExport {\n+export interface TemplateExportByID {\nstackID?: string\norgIDs?: Array<{\norgID?: string\n@@ -2104,10 +2174,26 @@ export interface TemplateExport {\nresources?: {\nid: string\nkind: TemplateKind\n+ /** if defined with id, name is used for resource exported by id. if defined independently, resources strictly matching name are exported */\nname?: string\n}\n}\n+export interface TemplateExportByName {\n+ stackID?: string\n+ orgIDs?: Array<{\n+ orgID?: string\n+ resourceFilters?: {\n+ byLabel?: string[]\n+ byResourceKind?: TemplateKind[]\n+ }\n+ }>\n+ resources?: {\n+ kind: TemplateKind\n+ name: string\n+ }\n+}\n+\nexport interface Tasks {\nreadonly links?: Links\ntasks?: Task[]\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(apis): regenerate APIs from swagger 2.0.3
305,159
12.01.2021 21:27:03
-3,600
1083579a6ac3c9fe4915835ae7e0b1f55c9bfbe7
chore: add lgtm project badge
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "[![CircleCI](https://circleci.com/gh/influxdata/influxdb-client-js.svg?style=svg)](https://circleci.com/gh/influxdata/influxdb-client-js)\n[![codecov](https://codecov.io/gh/influxdata/influxdb-client-js/branch/master/graph/badge.svg)](https://codecov.io/gh/influxdata/influxdb-client-js)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n+[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/influxdata/influxdb-client-js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/influxdata/influxdb-client-js/context:javascript)\n[![License](https://img.shields.io/github/license/influxdata/influxdb-client-js.svg)](https://github.com/influxdata/influxdb-client-js/blob/master/LICENSE)\n[![npm](https://img.shields.io/npm/v/@influxdata/influxdb-client)](https://www.npmjs.com/package/@influxdata/influxdb-client)\n[![GitHub issues](https://img.shields.io/github/issues-raw/influxdata/influxdb-client-js.svg)](https://github.com/influxdata/influxdb-client-js/issues)\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/generator/logger.ts", "new_path": "packages/apis/generator/logger.ts", "diff": "@@ -4,18 +4,14 @@ import {yellow} from 'chalk'\nconst logger = {\nwarn(message: string, ...otherParameters: any[]): void {\nmessage = yellow(message)\n- if (otherParameters && otherParameters.length) {\n- console.warn(message)\n- } else {\n+ if (otherParameters.length) {\nconsole.warn(message, ...otherParameters)\n+ } else {\n+ console.warn(message)\n}\n},\ninfo(message: string, ...otherParameters: any[]): void {\n- if (otherParameters && otherParameters.length) {\n- console.info(message)\n- } else {\nconsole.info(message, ...otherParameters)\n- }\n},\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/retryStrategy.ts", "new_path": "packages/core/src/impl/retryStrategy.ts", "diff": "@@ -22,10 +22,9 @@ export class RetryStrategyImpl implements RetryDelayStrategy {\nif (delay && delay > 0) {\nreturn delay + Math.round(Math.random() * this.options.retryJitter)\n} else {\n- let delay = this.currentDelay\nif (failedAttempts && failedAttempts > 0) {\n// compute delay\n- delay = this.options.minRetryDelay\n+ let delay = this.options.minRetryDelay\nfor (let i = 1; i < failedAttempts; i++) {\ndelay = delay * this.options.exponentialBase\nif (delay >= this.options.maxRetryDelay) {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/flux.ts", "new_path": "packages/core/src/query/flux.ts", "diff": "@@ -231,7 +231,7 @@ export function flux(\nstrings: TemplateStringsArray,\n...values: any\n): ParameterizedQuery {\n- if (strings.length == 1 && (!values || values.length === 0)) {\n+ if (strings.length == 1 && values.length === 0) {\nreturn fluxExpression(strings[0]) // the simplest case\n}\nconst parts = new Array<string>(strings.length + values.length)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: add lgtm project badge
305,159
12.01.2021 21:43:01
-3,600
4855fc3259c427aa5f47eda60a6f289837b63ef8
chore: remove github badges from Readme
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/influxdata/influxdb-client-js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/influxdata/influxdb-client-js/context:javascript)\n[![License](https://img.shields.io/github/license/influxdata/influxdb-client-js.svg)](https://github.com/influxdata/influxdb-client-js/blob/master/LICENSE)\n[![npm](https://img.shields.io/npm/v/@influxdata/influxdb-client)](https://www.npmjs.com/package/@influxdata/influxdb-client)\n-[![GitHub issues](https://img.shields.io/github/issues-raw/influxdata/influxdb-client-js.svg)](https://github.com/influxdata/influxdb-client-js/issues)\n-[![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/influxdata/influxdb-client-js.svg)](https://github.com/influxdata/influxdb-client-js/pulls)\n[![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://www.influxdata.com/slack)\nThis repository contains the reference javascript client for InfluxDB 2.0. Both node and browser environments are supported.\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: remove github badges from Readme
305,159
15.01.2021 12:03:06
-3,600
bf419cd401974c06b06f8f6b1d6efa934cb45538
feat(examples): add example node.js application monitoring
[ { "change_type": "MODIFY", "old_path": "examples/package.json", "new_path": "examples/package.json", "diff": "\"express\": \"^4.17.1\",\n\"express-http-proxy\": \"^1.6.0\",\n\"open\": \"^7.0.0\",\n+ \"response-time\": \"^2.3.2\",\n\"rxjs\": \"^6.5.5\",\n\"ts-node\": \"^8.5.4\",\n\"typescript\": \"^3.7.4\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "examples/scripts/monitor.js", "diff": "+const {InfluxDB, Point} = require('@influxdata/influxdb-client')\n+const {url, token, org, bucket} = require('../env')\n+const responseTime = require('response-time')\n+\n+// create Influx Write API to report application monitoring data\n+const writeAPI = new InfluxDB({url, token}).getWriteApi(org, bucket, 'ns', {\n+ defaultTags: {\n+ service: 'influxdb_client_example_app',\n+ host: require('os').hostname(),\n+ },\n+})\n+// write node resource/cpu/memory usage\n+function writeProcessUsage() {\n+ function createPoint(measurement, usage) {\n+ const point = new Point(measurement)\n+ for (const key of Object.keys(usage)) {\n+ point.floatField(key, usage[key])\n+ }\n+ return point\n+ }\n+\n+ // https://nodejs.org/api/process.html#process_process_memoryusage\n+ writeAPI.writePoint(createPoint('node_memory_usage', process.memoryUsage()))\n+ // https://nodejs.org/api/process.html#process_process_cpuusage_previousvalue\n+ writeAPI.writePoint(createPoint('node_cpu_usage', process.cpuUsage()))\n+ // https://nodejs.org/api/process.html#process_process_resourceusage\n+ writeAPI.writePoint(\n+ createPoint('node_resource_usage', process.resourceUsage())\n+ )\n+}\n+// write process usage now and then every 10 seconds\n+writeProcessUsage()\n+const nodeUsageTimer = setInterval(writeProcessUsage, 10_000).unref()\n+\n+// on shutdown\n+// - clear reporting of node usage\n+// - flush unwritten points and cancel retries\n+async function onShutdown() {\n+ clearInterval(nodeUsageTimer)\n+ try {\n+ await writeAPI.close()\n+ } catch (error) {\n+ console.error('ERROR: Application monitoring', error)\n+ }\n+ // eslint-disable-next-line no-process-exit\n+ process.exit(0)\n+}\n+process.on('SIGINT', onShutdown)\n+process.on('SIGTERM', onShutdown)\n+\n+// export a monitoring function for express.js response time monitoring\n+module.exports = function(app) {\n+ app.use(\n+ responseTime((req, res, time) => {\n+ // print out request basics\n+ console.info(\n+ `${req.method} ${req.path} ${res.statusCode} ${Math.round(time * 100) /\n+ 100}ms`\n+ )\n+ // write response time to InfluxDB\n+ const point = new Point('express_http_server')\n+ .tag('uri', req.path)\n+ .tag('method', req.method)\n+ .tag('status', String(res.statusCode))\n+ .floatField('response_time', time)\n+ writeAPI.writePoint(point)\n+ })\n+ )\n+}\n" }, { "change_type": "MODIFY", "old_path": "examples/scripts/server.js", "new_path": "examples/scripts/server.js", "diff": "@@ -3,13 +3,17 @@ const path = require('path')\nconst proxy = require('express-http-proxy')\nconst open = require('open')\nconst {url} = require('../env')\n+const monitor = require('./monitor')\nconst port = 3001\nconst proxyPath = '/influx'\nconst app = express()\n+// monitor express response time in InfluxDB\n+monitor(app)\n// serve all files of the git repository\napp.use(express.static(path.join(__dirname, '..', '..'), {index: false}))\n+// create also proxy to InfluxDB\napp.use(proxyPath, proxy(url))\napp.listen(port, () => {\nconsole.log(`listening on http://localhost:${port}`)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(examples): add example node.js application monitoring
305,159
19.01.2021 06:22:43
-3,600
7a29cb6dba61fb12cc012fbae5b76c4be40fac7d
chore(ci): ignore gh-pages branch in CI workflows
[ { "change_type": "MODIFY", "old_path": ".circleci/config.yml", "new_path": ".circleci/config.yml", "diff": "@@ -80,7 +80,13 @@ workflows:\njobs:\n- tests:\nversion: '14'\n- - coverage\n+ filters:\n+ branches:\n+ ignore: gh-pages\n+ - coverage:\n+ filters:\n+ branches:\n+ ignore: gh-pages\n- deploy-preview:\nrequires:\n- tests\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(ci): ignore gh-pages branch in CI workflows
305,159
19.01.2021 13:19:30
-3,600
c51ef95d3212d19715c46cd2fd347a1d1262ff31
chore(giraffe): improve documentation example to render well with jekyll
[ { "change_type": "MODIFY", "old_path": "packages/giraffe/src/index.ts", "new_path": "packages/giraffe/src/index.ts", "diff": "* function that executes a Flux query against InfluxDB (v2) and returns a Table that is then directly suitable\n* as a data input of various Giraffe visualizations.\n*\n- * ```js\n+ * ```jsx\n* import {InfluxDB} from '@influxdata/influxdb-client'\n* import {queryToTable} from '@influxdata/influxdb-client-giraffe'\n* import {newTable, Plot} from '@influxdata/giraffe'\n* )\n* ...\n* const config = {table, ...}\n- * <Plot config={config} />\n+ * <Plot config={config} >\n* ...\n* ```\n*\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): improve documentation example to render well with jekyll
305,159
01.02.2021 11:50:14
-3,600
0c7aeb8101f981d4e48bab2285c7d5438a3ba663
fix(apis): correct basic auth header
[ { "change_type": "MODIFY", "old_path": "packages/apis/src/APIBase.ts", "new_path": "packages/apis/src/APIBase.ts", "diff": "@@ -63,7 +63,7 @@ export class APIBase {\nconst value = `${request.auth.user}:${request.auth.password}`\n;(sendOptions.headers || (sendOptions.headers = {}))[\n'authorization'\n- ] = base64(value)\n+ ] = `Basic ${base64(value)}`\n}\nreturn this.transport.request(\npath,\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(apis): correct basic auth header
305,159
01.02.2021 12:11:58
-3,600
093250d920b1f3382cd18cf0eb3ea43031c3b280
feat(core): allow to receive response headers also in transport.request method
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -9,8 +9,24 @@ import {\nCommunicationObserver,\ncreateTextDecoderCombiner,\nHeaders,\n+ ResponseStartedFn,\n} from '../../results'\n+function getResponseHeaders(response: Response): Headers {\n+ const headers: Headers = {}\n+ response.headers.forEach((value: string, key: string) => {\n+ const previous = headers[key]\n+ if (previous === undefined) {\n+ headers[key] = value\n+ } else if (Array.isArray(previous)) {\n+ previous.push(value)\n+ } else {\n+ headers[key] = [previous, value]\n+ }\n+ })\n+ return headers\n+}\n+\n/**\n* Transport layer that use browser fetch.\n*/\n@@ -68,18 +84,10 @@ export default class FetchTransport implements Transport {\nthis.fetch(path, body, options)\n.then(async response => {\nif (callbacks?.responseStarted) {\n- const headers: Headers = {}\n- response.headers.forEach((value: string, key: string) => {\n- const previous = headers[key]\n- if (previous === undefined) {\n- headers[key] = value\n- } else if (Array.isArray(previous)) {\n- previous.push(value)\n- } else {\n- headers[key] = [previous, value]\n- }\n- })\n- observer.responseStarted(headers, response.status)\n+ observer.responseStarted(\n+ getResponseHeaders(response),\n+ response.status\n+ )\n}\nif (response.status >= 300) {\nreturn response\n@@ -137,10 +145,18 @@ export default class FetchTransport implements Transport {\n})\n.finally(() => observer.complete())\n}\n- async request(path: string, body: any, options: SendOptions): Promise<any> {\n+ async request(\n+ path: string,\n+ body: any,\n+ options: SendOptions,\n+ responseStarted?: ResponseStartedFn\n+ ): Promise<any> {\nconst response = await this.fetch(path, body, options)\nconst {status, headers} = response\nconst responseContentType = headers.get('content-type') || ''\n+ if (responseStarted) {\n+ responseStarted(getResponseHeaders(response), response.status)\n+ }\nif (status >= 300) {\nlet data = await response.text()\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -10,6 +10,7 @@ import {\nChunkCombiner,\nCommunicationObserver,\nHeaders,\n+ ResponseStartedFn,\n} from '../../results'\nimport nodeChunkCombiner from './nodeChunkCombiner'\nimport zlib from 'zlib'\n@@ -118,7 +119,12 @@ export class NodeHttpTransport implements Transport {\n* @param options - send options\n* @returns Promise of response body\n*/\n- request(path: string, body: any, options: SendOptions): Promise<any> {\n+ request(\n+ path: string,\n+ body: any,\n+ options: SendOptions,\n+ responseStarted?: ResponseStartedFn\n+ ): Promise<any> {\nif (!body) {\nbody = ''\n} else if (typeof body !== 'string') {\n@@ -128,7 +134,10 @@ export class NodeHttpTransport implements Transport {\nlet contentType: string\nreturn new Promise((resolve, reject) => {\nthis.send(path, body as string, options, {\n- responseStarted(headers: Headers) {\n+ responseStarted(headers: Headers, statusCode?: number) {\n+ if (responseStarted) {\n+ responseStarted(headers, statusCode)\n+ }\ncontentType = String(headers['content-type'])\n},\nnext: (data: Uint8Array): void => {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/results/CommunicationObserver.ts", "new_path": "packages/core/src/results/CommunicationObserver.ts", "diff": "@@ -3,6 +3,14 @@ import {Cancellable} from './Cancellable'\n* Type of HTTP headers.\n*/\nexport type Headers = {[header: string]: string | string[] | undefined}\n+\n+/**\n+ * Informs about a start of response processing.\n+ * @param headers - response HTTP headers\n+ * @param statusCode - response status code\n+ */\n+export type ResponseStartedFn = (headers: Headers, statusCode?: number) => void\n+\n/**\n* Observes communication with the server.\n*/\n@@ -22,10 +30,8 @@ export interface CommunicationObserver<T> {\ncomplete(): void\n/**\n* Informs about a start of response processing.\n- * @param headers - response HTTP headers\n- * @param statusCode - response status code\n*/\n- responseStarted?: (headers: Headers, statusCode?: number) => void\n+ responseStarted?: ResponseStartedFn\n/**\n* Setups cancelllable for this communication.\n*/\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/transport.ts", "new_path": "packages/core/src/transport.ts", "diff": "-import {CommunicationObserver} from './results'\n+import {CommunicationObserver, ResponseStartedFn} from './results'\nimport {ChunkCombiner} from './results/chunkCombiner'\n/**\n* Options for sending a request message.\n*/\nexport interface SendOptions {\n+ /** HTTP method (POST, PUT, GET, PATCH ...) */\nmethod: string\n+ /** Request HTTP headers. */\nheaders?: {[key: string]: string}\n}\n@@ -35,7 +37,12 @@ export interface Transport {\n* @param requestBody - request body\n* @param options - send options\n*/\n- request(path: string, body: any, options: SendOptions): Promise<any>\n+ request(\n+ path: string,\n+ body: any,\n+ options: SendOptions,\n+ responseStarted?: ResponseStartedFn\n+ ): Promise<any>\n/**\n* Combines response chunks to create a single response object.\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts", "new_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts", "diff": "@@ -89,6 +89,28 @@ describe('FetchTransport', () => {\n})\nexpect(response).is.deep.equal('{}')\n})\n+ it('receives also response headers', async () => {\n+ emulateFetchApi({\n+ headers: {'content-type': 'application/json'},\n+ body: '{}',\n+ })\n+ let responseMeta: any\n+ const response = await transport.request(\n+ '/whatever',\n+ {anything: 'here'},\n+ {\n+ method: 'POST',\n+ },\n+ function(headers, status) {\n+ responseMeta = [headers, status]\n+ }\n+ )\n+ expect(response).is.deep.equal({})\n+ expect(responseMeta).is.deep.equal([\n+ {'content-type': 'application/json'},\n+ 200,\n+ ])\n+ })\nit('receives text data for application/csv', async () => {\nemulateFetchApi({\nheaders: {'content-type': 'application/csv'},\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/node/NodeHttpTransport.test.ts", "new_path": "packages/core/test/unit/impl/node/NodeHttpTransport.test.ts", "diff": "@@ -618,6 +618,34 @@ describe('NodeHttpTransport', () => {\n})\nexpect(data).equals('..')\n})\n+ it(`returns response headers and status code `, async () => {\n+ nock(transportOptions.url)\n+ .get('/test')\n+ .reply(202, '', {\n+ 'content-type': 'application/text',\n+ 'custom-header': 'custom-val',\n+ })\n+ .persist()\n+ let responseCustomHeader: string | undefined\n+ let responseStatus: number | undefined\n+ const data = await new NodeHttpTransport({\n+ ...transportOptions,\n+ timeout: 10000,\n+ }).request(\n+ '/test',\n+ '',\n+ {\n+ method: 'GET',\n+ },\n+ (headers, status) => {\n+ responseCustomHeader = String(headers['custom-header'])\n+ responseStatus = status\n+ }\n+ )\n+ expect(data).equals('')\n+ expect(responseCustomHeader).equals('custom-val')\n+ expect(responseStatus).equals(202)\n+ })\nit(`return text for CSV response`, async () => {\nnock(transportOptions.url)\n.get('/test')\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): allow to receive response headers also in transport.request method
305,159
01.02.2021 12:14:06
-3,600
4a223cc62a34c2e9954a03fc035677cb37528f5c
feat(apis): allow to receive response headers from all APIs using an optional responseStarted callback
[ { "change_type": "MODIFY", "old_path": "packages/apis/src/APIBase.ts", "new_path": "packages/apis/src/APIBase.ts", "diff": "// this is effectively a clone of\n-import {InfluxDB, Transport, SendOptions} from '@influxdata/influxdb-client'\n+import {\n+ InfluxDB,\n+ Transport,\n+ SendOptions,\n+ Headers,\n+} from '@influxdata/influxdb-client'\n// used only in browser builds\ndeclare function btoa(plain: string): string\nexport interface RequestOptions {\n+ /** HTTP request headers */\nheaders?: {[key: string]: string}\n+ /**\n+ * Informs about a start of response processing.\n+ * @param headers - response HTTP headers\n+ * @param statusCode - response status code\n+ */\n+ responseStarted?: (headers: Headers, statusCode?: number) => void\n}\nfunction base64(value: string): string {\n@@ -68,7 +80,8 @@ export class APIBase {\nreturn this.transport.request(\npath,\nrequest.body ? request.body : '',\n- sendOptions\n+ sendOptions,\n+ requestOptions?.responseStarted\n)\n}\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(apis): allow to receive response headers from all APIs using an optional responseStarted callback
305,159
01.02.2021 19:02:53
-3,600
e402adb7b389421bb917f8dd758fe14582fad859
feat(examples): add sessionAuth example
[ { "change_type": "ADD", "old_path": null, "new_path": "examples/sessionAuth.js", "diff": "+#!/usr/bin/env node\n+/*\n+This example shows how to use `username + password` authentication\n+against InfluxDB v2 OSS. This type of authentication shall be avoided\n+in favor of a token authentication, which is preferred for programmatic\n+access to InfluxDB v2, tokens can be easily managed in InfluxDB UI.\n+`username + password` authentication might be required for creating\n+a first token.\n+*/\n+\n+const {InfluxDB} = require('@influxdata/influxdb-client')\n+const {\n+ AuthorizationsAPI,\n+ SigninAPI,\n+ SignoutAPI,\n+} = require('@influxdata/influxdb-client-apis')\n+const {url, username, password} = require('./env')\n+\n+async function signInDemo() {\n+ const influxDB = new InfluxDB({url})\n+ // sign in using user name and password, remember session cookie(s)\n+ console.log('*** Signin ***')\n+ const signinApi = new SigninAPI(influxDB)\n+ const cookies = []\n+ await signinApi.postSignin(\n+ {auth: {user: username, password}},\n+ {\n+ responseStarted: (headers, status) => {\n+ if (status < 300) {\n+ const setCookie = headers['set-cookie']\n+ if (typeof setCookie === 'string') {\n+ cookies.push(setCookie.split(';').shift())\n+ } else if (Array.isArray(setCookie)) {\n+ setCookie.forEach(c => cookies.push(c.split(';').shift()))\n+ }\n+ }\n+ },\n+ }\n+ )\n+ // authorize communication with session cookies\n+ const session = {headers: {cookie: cookies.join('; ')}}\n+ // get all authorization tokens\n+ console.log('*** GetAuthorizations ***')\n+ const authorizationAPI = new AuthorizationsAPI(influxDB)\n+ const authorizations = await authorizationAPI.getAuthorizations({}, session)\n+ // console.log(JSON.stringify(authorizations?.authorizations, null, 2))\n+ ;(authorizations.authorizations || []).forEach(auth => {\n+ console.log(auth.token)\n+ console.log(' ', auth.description)\n+ })\n+ console.log('\\nFinished SUCCESS')\n+ // invalidate the session\n+ const signoutAPI = new SignoutAPI(influxDB)\n+ await signoutAPI.postSignout(undefined, session)\n+ console.log('Signout SUCCESS')\n+}\n+\n+signInDemo().catch(error => {\n+ console.error(error)\n+ console.log('\\nFinished ERROR')\n+})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(examples): add sessionAuth example
305,159
02.02.2021 06:58:20
-3,600
532b521e35a6336709409070bd2350eff5bde6a4
feat(example): show how to create example token
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "### Features\n1. [#302](https://github.com/influxdata/influxdb-client-js/pull/302): Expose response headers in all APIs.\n-1. [#302](https://github.com/influxdata/influxdb-client-js/pull/302): Add `sessionAuth.js` example.\n+1. [#302](https://github.com/influxdata/influxdb-client-js/pull/302): Add `tokens.js` example.\n## 1.10.0 [2021-01-29]\n" }, { "change_type": "RENAME", "old_path": "examples/sessionAuth.js", "new_path": "examples/tokens.js", "diff": "#!/usr/bin/env node\n/*\nThis example shows how to use `username + password` authentication\n-against InfluxDB v2 OSS. This type of authentication shall be avoided\n-in favor of a token authentication, which is preferred for programmatic\n-access to InfluxDB v2, tokens can be easily managed in InfluxDB UI.\n-`username + password` authentication might be required for creating\n-a first token.\n+against InfluxDB v2 OSS in order to get/create authorization tokens.\n+\n+All other examples use token authentication, which is preferred\n+for programmatic access to InfluxDB v2. `username + password`\n+authentication might be used to automate management of tokens.\n*/\nconst {InfluxDB} = require('@influxdata/influxdb-client')\nconst {\nAuthorizationsAPI,\n+ OrgsAPI,\nSigninAPI,\nSignoutAPI,\n} = require('@influxdata/influxdb-client-apis')\n-const {url, username, password} = require('./env')\n+const {url, username, password, org} = require('./env')\nasync function signInDemo() {\nconst influxDB = new InfluxDB({url})\n@@ -44,10 +45,43 @@ async function signInDemo() {\nconst authorizationAPI = new AuthorizationsAPI(influxDB)\nconst authorizations = await authorizationAPI.getAuthorizations({}, session)\n// console.log(JSON.stringify(authorizations?.authorizations, null, 2))\n+ let hasMyToken = false\n;(authorizations.authorizations || []).forEach(auth => {\nconsole.log(auth.token)\nconsole.log(' ', auth.description)\n+ hasMyToken = hasMyToken || auth.description === 'example token'\n})\n+ if (!hasMyToken) {\n+ console.log('*** GetOrganization ***')\n+ const orgsResponse = await new OrgsAPI(influxDB).getOrgs({org}, session)\n+ if (!orgsResponse.orgs || orgsResponse.orgs.length === 0) {\n+ throw new Error(`No organization named ${org} found!`)\n+ }\n+ const orgID = orgsResponse.orgs[0].id\n+ console.log(' ', org, orgID)\n+ console.log('*** CreateAuthorization ***')\n+ const auth = await authorizationAPI.postAuthorizations(\n+ {\n+ body: {\n+ description: 'example token',\n+ orgID,\n+ permissions: [\n+ {\n+ action: 'read',\n+ resource: {type: 'buckets', orgID},\n+ },\n+ {\n+ action: 'write',\n+ resource: {type: 'buckets', orgID},\n+ },\n+ ],\n+ },\n+ },\n+ session\n+ )\n+ console.log(auth.token)\n+ console.log(' ', auth.description)\n+ }\nconsole.log('\\nFinished SUCCESS')\n// invalidate the session\nconst signoutAPI = new SignoutAPI(influxDB)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(example): show how to create example token
305,159
10.02.2021 07:46:41
-3,600
c42f90a8bf437b4ad8a27f60dd176d6342ac3ced
chore(core): remove deprecated zlib constants
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -19,8 +19,8 @@ import {CLIENT_LIB_VERSION} from '../version'\nimport Logger from '../Logger'\nconst zlibOptions = {\n- flush: zlib.Z_SYNC_FLUSH,\n- finishFlush: zlib.Z_SYNC_FLUSH,\n+ flush: zlib.constants.Z_SYNC_FLUSH,\n+ finishFlush: zlib.constants.Z_SYNC_FLUSH,\n}\nconst emptyBuffer = Buffer.allocUnsafe(0)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): remove deprecated zlib constants
305,159
10.02.2021 07:35:33
-3,600
626818e008bcfb6d0ca36afdaa30ad4de33d05ec
fix(examples): Use the latest client in query.deno.ts
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "### Bug Fixes\n+1. [#304](https://github.com/influxdata/influxdb-client-js/pull/304): Use the latest client in query.deno.ts example.\n1. [#305](https://github.com/influxdata/influxdb-client-js/pull/305): Remove deprecated zlib constants.\n## 1.10.0 [2021-01-29]\n" }, { "change_type": "MODIFY", "old_path": "examples/query.deno.ts", "new_path": "examples/query.deno.ts", "diff": "import {\nFluxTableMetaData,\nInfluxDB,\n-} from 'https://cdn.skypack.dev/@influxdata/[email protected]?dts'\n+} from 'https://cdn.skypack.dev/@influxdata/influxdb-client-browser?dts'\nconst url = 'http://localhost:8086'\nconst token = 'my-token'\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(examples): Use the latest client in query.deno.ts
305,159
10.02.2021 14:25:02
-3,600
b723cc502752ed316288f909314c8d66fd5b9ff2
feat(apis): update APIs from swagger 2021-02-10
[ { "change_type": "MODIFY", "old_path": "packages/apis/DEVELOPMENT.md", "new_path": "packages/apis/DEVELOPMENT.md", "diff": "@@ -12,7 +12,7 @@ $ yarn build\n- update local resources/swagger.yml to the latest version\n- `wget -O resources/swagger.yml https://raw.githubusercontent.com/influxdata/influxdb/master/http/swagger.yml`\n-- re-generate src/generated/types.ts and resources/operations.json using [oats](https://github.com/influxdata/oats)\n+- re-generate src/generated/types.ts and resources/operations.json using [oats](https://github.com/bonitoo/oats)\n- `rm -rf src/generated/*.ts`\n- `oats -i 'types' --storeOperations resources/operations.json resources/swagger.yml > src/generated/types.ts`\n- generate src/generated APIs from resources/operations.json\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/resources/swagger.yml", "new_path": "packages/apis/resources/swagger.yml", "diff": "@@ -6749,6 +6749,7 @@ components:\nExpression:\noneOf:\n- $ref: \"#/components/schemas/ArrayExpression\"\n+ - $ref: \"#/components/schemas/DictExpression\"\n- $ref: \"#/components/schemas/FunctionExpression\"\n- $ref: \"#/components/schemas/BinaryExpression\"\n- $ref: \"#/components/schemas/CallExpression\"\n@@ -6781,6 +6782,27 @@ components:\ntype: array\nitems:\n$ref: \"#/components/schemas/Expression\"\n+ DictExpression:\n+ description: Used to create and directly specify the elements of a dictionary\n+ type: object\n+ properties:\n+ type:\n+ $ref: \"#/components/schemas/NodeType\"\n+ elements:\n+ description: Elements of the dictionary\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/DictItem\"\n+ DictItem:\n+ description: A key/value pair in a dictionary\n+ type: object\n+ properties:\n+ type:\n+ $ref: \"#/components/schemas/NodeType\"\n+ key:\n+ $ref: \"#/components/schemas/Expression\"\n+ val:\n+ $ref: \"#/components/schemas/Expression\"\nFunctionExpression:\ndescription: Function expression\ntype: object\n@@ -9745,6 +9767,167 @@ components:\nformat: float\nlegendOrientationThreshold:\ntype: integer\n+ GeoViewLayer:\n+ type: object\n+ oneOf:\n+ - $ref: \"#/components/schemas/GeoCircleViewLayer\"\n+ - $ref: \"#/components/schemas/GeoHeatMapViewLayer\"\n+ - $ref: \"#/components/schemas/GeoPointMapViewLayer\"\n+ - $ref: \"#/components/schemas/GeoTrackMapViewLayer\"\n+ GeoViewLayerProperties:\n+ type: object\n+ required: [type]\n+ properties:\n+ type:\n+ type: string\n+ enum: [heatmap, circleMap, pointMap, trackMap]\n+ GeoCircleViewLayer:\n+ allOf:\n+ - $ref: \"#/components/schemas/GeoViewLayerProperties\"\n+ - type: object\n+ required: [radiusField, radiusDimension, colorField, colorDimension, colors]\n+ properties:\n+ radiusField:\n+ type: string\n+ description: Radius field\n+ radiusDimension:\n+ $ref: '#/components/schemas/Axis'\n+ colorField:\n+ type: string\n+ description: Circle color field\n+ colorDimension:\n+ $ref: '#/components/schemas/Axis'\n+ colors:\n+ description: Colors define color encoding of data into a visualization\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/DashboardColor\"\n+ radius:\n+ description: Maximum radius size in pixels\n+ type: integer\n+ interpolateColors:\n+ description: Interpolate circle color based on displayed value\n+ type: boolean\n+ GeoPointMapViewLayer:\n+ allOf:\n+ - $ref: \"#/components/schemas/GeoViewLayerProperties\"\n+ - type: object\n+ required: [colorField, colorDimension, colors]\n+ properties:\n+ colorField:\n+ type: string\n+ description: Marker color field\n+ colorDimension:\n+ $ref: '#/components/schemas/Axis'\n+ colors:\n+ description: Colors define color encoding of data into a visualization\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/DashboardColor\"\n+ isClustered:\n+ description: Cluster close markers together\n+ type: boolean\n+ GeoTrackMapViewLayer:\n+ allOf:\n+ - $ref: \"#/components/schemas/GeoViewLayerProperties\"\n+ - type: object\n+ required: [trackWidth, speed, randomColors, trackPointVisualization]\n+ properties:\n+ trackWidth:\n+ description: Width of the track\n+ type: integer\n+ speed:\n+ description: Speed of the track animation\n+ type: integer\n+ randomColors:\n+ description: Assign different colors to different tracks\n+ type: boolean\n+ colors:\n+ description: Colors define color encoding of data into a visualization\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/DashboardColor\"\n+ GeoHeatMapViewLayer:\n+ allOf:\n+ - $ref: \"#/components/schemas/GeoViewLayerProperties\"\n+ - type: object\n+ required: [intensityField, intensityDimension, radius, blur, colors]\n+ properties:\n+ intensityField:\n+ type: string\n+ description: Intensity field\n+ intensityDimension:\n+ $ref: '#/components/schemas/Axis'\n+ radius:\n+ description: Radius size in pixels\n+ type: integer\n+ blur:\n+ description: Blur for heatmap points\n+ type: integer\n+ colors:\n+ description: Colors define color encoding of data into a visualization\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/DashboardColor\"\n+ GeoViewProperties:\n+ type: object\n+ required: [type, shape, queries, note, showNoteWhenEmpty, center, zoom, allowPanAndZoom, detectCoordinateFields, layers]\n+ properties:\n+ type:\n+ type: string\n+ enum: [geo]\n+ queries:\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/DashboardQuery\"\n+ shape:\n+ type: string\n+ enum: ['chronograf-v2']\n+ center:\n+ description: Coordinates of the center of the map\n+ type: object\n+ required: [lat, lon]\n+ properties:\n+ lat:\n+ description: Latitude of the center of the map\n+ type: number\n+ format: double\n+ lon:\n+ description: Longitude of the center of the map\n+ type: number\n+ format: double\n+ zoom:\n+ description: Zoom level used for initial display of the map\n+ type: number\n+ format: double\n+ minimum: 1\n+ maximum: 28\n+ allowPanAndZoom:\n+ description: If true, map zoom and pan controls are enabled on the dashboard view\n+ type: boolean\n+ default: true\n+ detectCoordinateFields:\n+ description: If true, search results get automatically regroupped so that lon,lat and value are treated as columns\n+ type: boolean\n+ default: true\n+ mapStyle:\n+ description: Define map type - regular, satellite etc.\n+ type: string\n+ note:\n+ type: string\n+ showNoteWhenEmpty:\n+ description: If true, will display note when empty\n+ type: boolean\n+ colors:\n+ description: Colors define color encoding of data into a visualization\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/DashboardColor\"\n+ layers:\n+ description: List of individual layers shown in the map\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/GeoViewLayer\"\nAxes:\ndescription: The viewport for a View's visualizations\ntype: object\n@@ -9916,6 +10099,7 @@ components:\n- $ref: \"#/components/schemas/HeatmapViewProperties\"\n- $ref: \"#/components/schemas/MosaicViewProperties\"\n- $ref: \"#/components/schemas/BandViewProperties\"\n+ - $ref: \"#/components/schemas/GeoViewProperties\"\nView:\nrequired:\n- name\n@@ -11852,12 +12036,10 @@ components:\n- retention_policy\nDBRPs:\nproperties:\n- notificationEndpoints:\n+ content:\ntype: array\nitems:\n$ref: \"#/components/schemas/DBRP\"\n- links:\n- $ref: \"#/components/schemas/Links\"\nDBRPUpdate:\nproperties:\ndatabase:\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/types.ts", "new_path": "packages/apis/src/generated/types.ts", "diff": "@@ -292,8 +292,7 @@ export interface LabelResponse {\n}\nexport interface DBRPs {\n- notificationEndpoints?: DBRP[]\n- links?: Links\n+ content?: DBRP[]\n}\nexport interface DBRP {\n@@ -656,6 +655,7 @@ export type ViewProperties =\n| HeatmapViewProperties\n| MosaicViewProperties\n| BandViewProperties\n+ | GeoViewProperties\nexport interface LinePlusSingleStatProperties {\ntimeFormat?: string\n@@ -1178,6 +1178,92 @@ export interface BandViewProperties {\nlegendOrientationThreshold?: number\n}\n+export interface GeoViewProperties {\n+ type: 'geo'\n+ queries: DashboardQuery[]\n+ shape: 'chronograf-v2'\n+ /** Coordinates of the center of the map */\n+ center: {\n+ /** Latitude of the center of the map */\n+ lat: number\n+ /** Longitude of the center of the map */\n+ lon: number\n+ }\n+ /** Zoom level used for initial display of the map */\n+ zoom: number\n+ /** If true, map zoom and pan controls are enabled on the dashboard view */\n+ allowPanAndZoom: boolean\n+ /** If true, search results get automatically regroupped so that lon,lat and value are treated as columns */\n+ detectCoordinateFields: boolean\n+ /** Define map type - regular, satellite etc. */\n+ mapStyle?: string\n+ note: string\n+ /** If true, will display note when empty */\n+ showNoteWhenEmpty: boolean\n+ /** Colors define color encoding of data into a visualization */\n+ colors?: DashboardColor[]\n+ /** List of individual layers shown in the map */\n+ layers: GeoViewLayer[]\n+}\n+\n+export type GeoViewLayer =\n+ | GeoCircleViewLayer\n+ | GeoHeatMapViewLayer\n+ | GeoPointMapViewLayer\n+ | GeoTrackMapViewLayer\n+\n+export type GeoCircleViewLayer = GeoViewLayerProperties & {\n+ /** Radius field */\n+ radiusField: string\n+ radiusDimension: Axis\n+ /** Circle color field */\n+ colorField: string\n+ colorDimension: Axis\n+ /** Colors define color encoding of data into a visualization */\n+ colors: DashboardColor[]\n+ /** Maximum radius size in pixels */\n+ radius?: number\n+ /** Interpolate circle color based on displayed value */\n+ interpolateColors?: boolean\n+}\n+\n+export interface GeoViewLayerProperties {\n+ type: 'heatmap' | 'circleMap' | 'pointMap' | 'trackMap'\n+}\n+\n+export type GeoHeatMapViewLayer = GeoViewLayerProperties & {\n+ /** Intensity field */\n+ intensityField: string\n+ intensityDimension: Axis\n+ /** Radius size in pixels */\n+ radius: number\n+ /** Blur for heatmap points */\n+ blur: number\n+ /** Colors define color encoding of data into a visualization */\n+ colors: DashboardColor[]\n+}\n+\n+export type GeoPointMapViewLayer = GeoViewLayerProperties & {\n+ /** Marker color field */\n+ colorField: string\n+ colorDimension: Axis\n+ /** Colors define color encoding of data into a visualization */\n+ colors: DashboardColor[]\n+ /** Cluster close markers together */\n+ isClustered?: boolean\n+}\n+\n+export interface GeoTrackMapViewLayer {\n+ /** Width of the track */\n+ trackWidth?: number\n+ /** Speed of the track animation */\n+ speed?: number\n+ /** Assign different colors to different tracks */\n+ randomColors?: boolean\n+ /** Colors define color encoding of data into a visualization */\n+ colors?: DashboardColor[]\n+}\n+\nexport interface CreateCell {\nname?: string\nx?: number\n@@ -1314,6 +1400,7 @@ export interface VariableAssignment {\nexport type Expression =\n| ArrayExpression\n+ | DictExpression\n| FunctionExpression\n| BinaryExpression\n| CallExpression\n@@ -1345,6 +1432,24 @@ export interface ArrayExpression {\nelements?: Expression[]\n}\n+/**\n+ * Used to create and directly specify the elements of a dictionary\n+ */\n+export interface DictExpression {\n+ type?: NodeType\n+ /** Elements of the dictionary */\n+ elements?: DictItem[]\n+}\n+\n+/**\n+ * A key/value pair in a dictionary\n+ */\n+export interface DictItem {\n+ type?: NodeType\n+ key?: Expression\n+ val?: Expression\n+}\n+\n/**\n* Function expression\n*/\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(apis): update APIs from swagger 2021-02-10
305,159
13.02.2021 18:07:45
-3,600
cf69ed3aefa8328a2bee5f37ea4223b93ff69e93
feat(core): refactor logger
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/RetryBuffer.ts", "new_path": "packages/core/src/impl/RetryBuffer.ts", "diff": "-import Logger from './Logger'\n+import {Logger} from '../util/logger'\n/* interval between successful retries */\nconst RETRY_INTERVAL = 1\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -6,7 +6,7 @@ import {\n} from '../options'\nimport {Transport, SendOptions} from '../transport'\nimport {Headers} from '../results'\n-import Logger from './Logger'\n+import {Logger} from '../util/logger'\nimport {HttpError, RetryDelayStrategy} from '../errors'\nimport {Point} from '../Point'\nimport {escape} from '../util/escape'\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -3,7 +3,7 @@ import {Transport, SendOptions} from '../../transport'\nimport {ConnectionOptions} from '../../options'\nimport {HttpError} from '../../errors'\nimport completeCommunicationObserver from '../completeCommunicationObserver'\n-import Logger from '../Logger'\n+import {Logger} from '../../util/logger'\nimport {\nChunkCombiner,\nCommunicationObserver,\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -16,7 +16,7 @@ import nodeChunkCombiner from './nodeChunkCombiner'\nimport zlib from 'zlib'\nimport completeCommunicationObserver from '../completeCommunicationObserver'\nimport {CLIENT_LIB_VERSION} from '../version'\n-import Logger from '../Logger'\n+import {Logger} from '../../util/logger'\nconst zlibOptions = {\nflush: zlib.constants.Z_SYNC_FLUSH,\n" }, { "change_type": "RENAME", "old_path": "packages/core/src/impl/Logger.ts", "new_path": "packages/core/src/util/logger.ts", "diff": "@@ -21,7 +21,7 @@ export const consoleLogger: Logger = {\n}\nlet provider: Logger = consoleLogger\n-const Logger: Logger = {\n+export const Logger: Logger = {\nerror(message, error) {\nprovider.error(message, error)\n},\n@@ -40,5 +40,3 @@ export function setLogger(logger: Logger): Logger {\nprovider = logger\nreturn previous\n}\n-\n-export default Logger\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -11,7 +11,7 @@ import {\nDEFAULT_WriteOptions,\n} from '../../src'\nimport {collectLogging, CollectedLogs} from '../util'\n-import Logger from '../../src/impl/Logger'\n+import {Logger} from '../../src/util/logger'\nimport {waitForCondition} from './util/waitForCondition'\nconst clientOptions: ClientOptions = {\n" }, { "change_type": "RENAME", "old_path": "packages/core/test/unit/impl/Logger.test.ts", "new_path": "packages/core/test/unit/util/logger.test.ts", "diff": "import {expect} from 'chai'\n-import Logger, {setLogger, consoleLogger} from '../../../src/impl/Logger'\n+import {Logger, setLogger, consoleLogger} from '../../../src/util/logger'\ndescribe('Logger', () => {\n;[{message: ' hey', error: 'you'}, {message: ' hey'}].forEach(data => {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/util.ts", "new_path": "packages/core/test/util.ts", "diff": "/* eslint-disable prefer-rest-params */\n-import {setLogger} from '../src/impl/Logger'\n+import {setLogger} from '../src/util/logger'\nlet previous: any\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): refactor logger
305,159
13.02.2021 18:08:13
-3,600
b6c3f9f949236f235b9bad4ee303ff11a1023457
feat(core): allow to customize logger
[ { "change_type": "MODIFY", "old_path": "packages/core/src/index.ts", "new_path": "packages/core/src/index.ts", "diff": "@@ -31,6 +31,7 @@ export * from './options'\nexport * from './errors'\nexport * from './util/escape'\nexport * from './util/currentTime'\n+export * from './util/logger'\nexport * from './query'\nexport * from './transport'\nexport * from './observable'\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): allow to customize logger
305,159
15.02.2021 07:41:00
-3,600
85e83bf885a72ac920c704a787f33f9a0b281e5f
chore(giraffe): don't require skipLibCheck for api-extractor
[ { "change_type": "MODIFY", "old_path": "packages/giraffe/api-extractor.json", "new_path": "packages/giraffe/api-extractor.json", "diff": "{\n\"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n\"extends\": \"../../scripts/api-extractor-base.json\",\n- \"mainEntryPointFilePath\": \"<projectFolder>/dist/index.d.ts\",\n- \"compiler\": {\n- /*\n- * A lot of warnings are issued from giraffe, they must be suppressed.\n- */\n- \"skipLibCheck\": false\n- }\n+ \"mainEntryPointFilePath\": \"<projectFolder>/dist/index.d.ts\"\n+ // \"compiler\": {\n+ // /*\n+ // * A lot of warnings are issued from giraffe, they must be suppressed.\n+ // */\n+ // \"skipLibCheck\": true\n+ // }\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): don't require skipLibCheck for api-extractor
305,159
15.02.2021 09:11:53
-3,600
5d793366ecfe3de58ce1c9b787347a66117a204d
chore(tests): prefer-rest-params
[ { "change_type": "MODIFY", "old_path": "packages/core/test/util.ts", "new_path": "packages/core/test/util.ts", "diff": "-/* eslint-disable prefer-rest-params */\nimport {setLogger} from '../src/util/logger'\nlet previous: any\n@@ -15,11 +14,11 @@ export const collectLogging = {\nwarn: [],\n}\nprevious = setLogger({\n- error: function() {\n- retVal.error.push(Array.from(arguments))\n+ error: function(...args) {\n+ retVal.error.push(args)\n},\n- warn: function() {\n- retVal.warn.push(Array.from(arguments))\n+ warn: function(...args) {\n+ retVal.warn.push(args)\n},\n})\nreturn retVal\n@@ -30,13 +29,13 @@ export const collectLogging = {\nwarn: [],\n}\nconst previous = setLogger({\n- error: function() {\n- ;(previous.error as any).apply(previous, Array.from(arguments))\n- retVal.error.push(Array.from(arguments))\n+ error: function(...args) {\n+ ;(previous.error as any).apply(previous, args)\n+ retVal.error.push(args)\n},\n- warn: function() {\n- ;(previous.warn as any).apply(previous, Array.from(arguments))\n- retVal.warn.push(Array.from(arguments))\n+ warn: function(...args) {\n+ ;(previous.warn as any).apply(previous, args)\n+ retVal.warn.push(args)\n},\n})\nreturn retVal\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(tests): prefer-rest-params
305,159
22.02.2021 07:06:38
-3,600
7986464ee8b11031220c16f27d4e7875dfebe0af
feat(examples): add queryRaw example
[ { "change_type": "MODIFY", "old_path": "examples/query.ts", "new_path": "examples/query.ts", "diff": "@@ -30,7 +30,20 @@ queryApi.queryRows(fluxQuery, {\n},\n})\n-// // Execute query and collect all results in a Promise.\n+// // Execute query and return the whole result as a string.\n+// // Use with caution, it copies the whole stream of results into memory.\n+// queryApi\n+// .queryRaw(fluxQuery)\n+// .then(result => {\n+// console.log(result)\n+// console.log('\\nQueryRaw SUCCESS')\n+// })\n+// .catch(error => {\n+// console.error(error)\n+// console.log('\\nQueryRaw ERROR')\n+// })\n+\n+// // Execute query and collect result rows in a Promise.\n// // Use with caution, it copies the whole stream of results into memory.\n// queryApi\n// .collectRows(fluxQuery /*, you can specify a row mapper as a second arg */)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(examples): add queryRaw example
305,159
22.02.2021 13:31:54
-3,600
3a37c3fff248c0f403820ef3b7f17b5eaa65877e
fix(examples): report process.resourceUsage only if available
[ { "change_type": "MODIFY", "old_path": "examples/scripts/monitor.js", "new_path": "examples/scripts/monitor.js", "diff": "@@ -24,10 +24,13 @@ function writeProcessUsage() {\n// https://nodejs.org/api/process.html#process_process_cpuusage_previousvalue\nwriteAPI.writePoint(createPoint('node_cpu_usage', process.cpuUsage()))\n// https://nodejs.org/api/process.html#process_process_resourceusage\n+ // available since node v12.6\n+ if (process.resourceUsage) {\nwriteAPI.writePoint(\ncreatePoint('node_resource_usage', process.resourceUsage())\n)\n}\n+}\n// write process usage now and then every 10 seconds\nwriteProcessUsage()\nconst nodeUsageTimer = setInterval(writeProcessUsage, 10_000).unref()\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(examples): report process.resourceUsage only if available
305,159
18.03.2021 08:17:31
-3,600
aafa60e6e250b877c7e362a32279426e07ef926a
feat(apis): update APIs from swagger as of 2021-03-18
[ { "change_type": "MODIFY", "old_path": "packages/apis/resources/swagger.yml", "new_path": "packages/apis/resources/swagger.yml", "diff": "@@ -7297,9 +7297,13 @@ components:\n- expire\neverySeconds:\ntype: integer\n- description: Duration in seconds for how long data will be kept in the database.\n+ description: Duration in seconds for how long data will be kept in the database. 0 means infinite.\nexample: 86400\n- minimum: 1\n+ minimum: 0\n+ shardGroupDurationSeconds:\n+ type: integer\n+ format: int64\n+ description: Shard duration measured in seconds.\nrequired: [type, everySeconds]\nLink:\ntype: string\n@@ -9241,6 +9245,12 @@ components:\nxTickStep:\ntype: number\nformat: float\n+ yLabelColumnSeparator:\n+ type: string\n+ yLabelColumns:\n+ type: array\n+ items:\n+ type: string\nySeriesColumns:\ntype: array\nitems:\n@@ -9271,6 +9281,9 @@ components:\ntype: string\nySuffix:\ntype: string\n+ hoverDimension:\n+ type: string\n+ enum: [auto, x, y, xy]\nlegendColorizeRows:\ntype: boolean\nlegendOpacity:\n@@ -11134,8 +11147,14 @@ components:\ntype: string\nbucket:\ntype: string\n+ retentionPeriodSeconds:\n+ type: integer\nretentionPeriodHrs:\ntype: integer\n+ deprecated: true\n+ description: >\n+ Retention period *in nanoseconds* for the new bucket. This key's name has been misleading since OSS 2.0 GA,\n+ please transition to use `retentionPeriodSeconds`\nrequired:\n- username\n- org\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/types.ts", "new_path": "packages/apis/src/generated/types.ts", "diff": "@@ -62,6 +62,9 @@ export interface OnboardingRequest {\npassword?: string\norg: string\nbucket: string\n+ retentionPeriodSeconds?: number\n+ /** Retention period *in nanoseconds* for the new bucket. This key's name has been misleading since OSS 2.0 GA, please transition to use `retentionPeriodSeconds`\n+ */\nretentionPeriodHrs?: number\n}\n@@ -142,8 +145,10 @@ export type RetentionRules = RetentionRule[]\nexport interface RetentionRule {\ntype: 'expire'\n- /** Duration in seconds for how long data will be kept in the database. */\n+ /** Duration in seconds for how long data will be kept in the database. 0 means infinite. */\neverySeconds: number\n+ /** Shard duration measured in seconds. */\n+ shardGroupDurationSeconds?: number\n}\nexport type Labels = Label[]\n@@ -1131,6 +1136,8 @@ export interface MosaicViewProperties {\nxTotalTicks?: number\nxTickStart?: number\nxTickStep?: number\n+ yLabelColumnSeparator?: string\n+ yLabelColumns?: string[]\nySeriesColumns: string[]\nfillColumns: string[]\nxDomain: number[]\n@@ -1141,6 +1148,7 @@ export interface MosaicViewProperties {\nxSuffix: string\nyPrefix: string\nySuffix: string\n+ hoverDimension?: 'auto' | 'x' | 'y' | 'xy'\nlegendColorizeRows?: boolean\nlegendOpacity?: number\nlegendOrientationThreshold?: number\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(apis): update APIs from swagger as of 2021-03-18
305,159
21.03.2021 15:39:53
-3,600
84c3accdc8d35cb834da1f787a4b0023f675fbf7
fix(core): support negative numbers in flux tagged template
[ { "change_type": "MODIFY", "old_path": "packages/core/src/query/flux.ts", "new_path": "packages/core/src/query/flux.ts", "diff": "@@ -105,17 +105,6 @@ export function fluxString(value: any): FluxParameterLike {\nreturn new FluxParameter(`\"${sanitizeString(value)}\"`)\n}\n-/**\n- * Creates a flux integer literal.\n- */\n-export function fluxInteger(value: any): FluxParameterLike {\n- const val = String(value)\n- for (const c of val) {\n- if (c < '0' || c > '9') throw new Error(`not a flux integer: ${val}`)\n- }\n- return new FluxParameter(val)\n-}\n-\n/**\n* Sanitizes float value to avoid injections.\n* @param value - InfluxDB float literal\n@@ -123,14 +112,21 @@ export function fluxInteger(value: any): FluxParameterLike {\n* @throws Error if the the value cannot be sanitized\n*/\nexport function sanitizeFloat(value: any): string {\n+ if (typeof value === 'number') {\n+ if (!isFinite(value)) {\n+ throw new Error(`not a flux float: ${value}`)\n+ }\n+ return value.toString()\n+ }\nconst val = String(value)\nlet dot = false\nfor (const c of val) {\nif (c === '.') {\nif (dot) throw new Error(`not a flux float: ${val}`)\ndot = !dot\n+ continue\n}\n- if (c !== '.' && (c < '0' || c > '9'))\n+ if (!(c === '.' || (c >= '0' && c <= '9') || c === '-'))\nthrow new Error(`not a flux float: ${val}`)\n}\nreturn val\n@@ -142,6 +138,19 @@ export function fluxFloat(value: any): FluxParameterLike {\nreturn new FluxParameter(sanitizeFloat(value))\n}\n+/**\n+ * Creates a flux integer literal.\n+ */\n+export function fluxInteger(value: any): FluxParameterLike {\n+ const val = sanitizeFloat(value)\n+ for (const c of val) {\n+ if (c === '.') {\n+ throw new Error(`not a flux integer: ${val}`)\n+ }\n+ }\n+ return new FluxParameter(val)\n+}\n+\nfunction sanitizeDateTime(value: any): string {\nreturn `time(v: \"${sanitizeString(value)}\")`\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/query/flux.test.ts", "new_path": "packages/core/test/unit/query/flux.test.ts", "diff": "@@ -24,7 +24,13 @@ describe('Flux Values', () => {\nconst subject = fluxInteger(123)\nexpect(subject.toString()).equals('123')\nexpect((subject as any)[FLUX_VALUE]()).equals('123')\n+ expect(fluxInteger(123).toString()).equals('123')\n+ expect(fluxInteger(-123).toString()).equals('-123')\n+ expect(() => fluxInteger('-1.1')).to.throw()\nexpect(() => fluxInteger('123a')).to.throw()\n+ expect(() => fluxInteger(NaN)).to.throw()\n+ expect(() => fluxInteger(Infinity)).to.throw()\n+ expect(() => fluxInteger(-Infinity)).to.throw()\n})\nit('creates fluxBool', () => {\nexpect(fluxBool('true').toString()).equals('true')\n@@ -44,8 +50,12 @@ describe('Flux Values', () => {\nconst subject = fluxFloat(123.456)\nexpect(subject.toString()).equals('123.456')\nexpect((subject as any)[FLUX_VALUE]()).equals('123.456')\n+ expect(fluxFloat('-123').toString()).equals('-123')\nexpect(() => fluxFloat('123..')).to.throw()\nexpect(() => fluxFloat('123.a')).to.throw()\n+ expect(() => fluxFloat(NaN)).to.throw()\n+ expect(() => fluxFloat(Infinity)).to.throw()\n+ expect(() => fluxFloat(-Infinity)).to.throw()\n})\nit('creates fluxDuration', () => {\nconst subject = fluxDuration('1ms')\n@@ -81,6 +91,7 @@ describe('Flux Values', () => {\n{value: false, flux: 'false'},\n{value: 1, flux: '1'},\n{value: 1.1, flux: '1.1'},\n+ {value: -1.1, flux: '-1.1'},\n{value: 'a', flux: '\"a\"'},\n{value: new Date(1589521447471), flux: '2020-05-15T05:44:07.471Z'},\n{value: /abc/, flux: 'regexp.compile(v: \"/abc/\")'},\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core): support negative numbers in flux tagged template
305,159
26.03.2021 13:50:22
-3,600
aa7c65261373e4763ffd8d0db28aa3f6b4caed14
chore: improve documentation of transportOptions
[ { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -11,7 +11,7 @@ export interface ConnectionOptions {\ntoken?: string\n/** socket timeout */\ntimeout?: number\n- /** extra options for the transport layer */\n+ /** extra options for the transport layer, they can setup a proxy agent or an abort signal in node.js transport that relies upon {@link https://nodejs.org/api/http.html#http_http_request_url_options_callback }*/\ntransportOptions?: {[key: string]: any}\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve documentation of transportOptions #319
305,159
08.04.2021 15:31:37
-7,200
72c6fca27d0700a0afa69329ad3b81e476e1f21e
chore: upgrade lib to es2018
[ { "change_type": "MODIFY", "old_path": "packages/core/tsconfig.json", "new_path": "packages/core/tsconfig.json", "diff": "\"extends\": \"../../tsconfig.base.json\",\n\"compilerOptions\": {\n\"resolveJsonModule\": true,\n- \"lib\": [\"DOM\", \"es2015\"]\n+ \"lib\": [\"DOM\", \"es2018\"]\n},\n\"include\": [\"src/**/*.ts\", \"test/**/*.ts\"],\n\"exclude\": [\"*.js\"]\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: upgrade lib to es2018
305,159
08.04.2021 15:43:47
-7,200
bc3a2e29380bb329c3421e47213f270a371a97d5
feat(core): introduce gzipThreshold sendOption
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -103,11 +103,16 @@ export class NodeHttpTransport implements Transport {\noptions: SendOptions,\ncallbacks?: Partial<CommunicationObserver<any>>\n): void {\n- const message = this.createRequestMessage(path, body, options)\nconst cancellable = new CancellableImpl()\nif (callbacks && callbacks.useCancellable)\ncallbacks.useCancellable(cancellable)\n+ this.createRequestMessage(path, body, options).then(\n+ (message: {[key: string]: any}) => {\nthis._request(message, cancellable, callbacks)\n+ },\n+ /* istanbul ignore next - hard to simulate failure, manually reviewed */\n+ (err: Error) => callbacks?.error && callbacks.error(err)\n+ )\n}\n/**\n@@ -180,7 +185,7 @@ export class NodeHttpTransport implements Transport {\npath: string,\nbody: string,\nsendOptions: SendOptions\n- ): {[key: string]: any} {\n+ ): Promise<{[key: string]: any}> {\nconst bodyBuffer = Buffer.from(body, 'utf-8')\nconst headers: {[key: string]: any} = {\n'content-type': 'application/json; charset=utf-8',\n@@ -189,6 +194,7 @@ export class NodeHttpTransport implements Transport {\nif (this.connectionOptions.token) {\nheaders.authorization = 'Token ' + this.connectionOptions.token\n}\n+ let bodyPromise = Promise.resolve(bodyBuffer)\nconst options: {[key: string]: any} = {\n...this.defaultOptions,\npath: this.contextPath + path,\n@@ -197,11 +203,29 @@ export class NodeHttpTransport implements Transport {\n...headers,\n...sendOptions.headers,\n},\n- body: bodyBuffer,\n}\n- options.headers['content-length'] = bodyBuffer.length\n+ if (\n+ sendOptions.gzipThreshold !== undefined &&\n+ sendOptions.gzipThreshold > bodyBuffer.length\n+ ) {\n+ bodyPromise = bodyPromise.then(body => {\n+ return new Promise((resolve, reject) => {\n+ zlib.gzip(body, zlibOptions, (err, res) => {\n+ /* istanbul ignore next - hard to simulate failure, manually reviewed */\n+ if (err) {\n+ return reject(err)\n+ }\n+ return resolve(res)\n+ })\n+ })\n+ })\n+ }\n+ return bodyPromise.then(bodyBuffer => {\n+ options.body = bodyBuffer\n+ options.headers['content-length'] = bodyBuffer.length\nreturn options\n+ })\n}\nprivate _request(\n@@ -215,6 +239,7 @@ export class NodeHttpTransport implements Transport {\nreturn\n}\nconst req = this.requestApi(requestMessage, (res: http.IncomingMessage) => {\n+ /* istanbul ignore next - hard to simulate failure, manually reviewed */\nif (cancellable.isCancelled()) {\nres.resume()\nlisteners.complete()\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/transport.ts", "new_path": "packages/core/src/transport.ts", "diff": "@@ -8,6 +8,8 @@ export interface SendOptions {\nmethod: string\n/** Request HTTP headers. */\nheaders?: {[key: string]: string}\n+ /** When specified, message body larger than the treshold will is gzipped */\n+ gzipThreshold?: number\n}\n/**\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -157,6 +157,7 @@ describe('WriteApi', () => {\nit('does not retry write when configured to do so', async () => {\nuseSubject({maxRetries: 0, batchSize: 1})\nsubject.writeRecord('test value=1')\n+ await waitForCondition(() => logs.error.length > 0)\nawait subject.close().then(() => {\nexpect(logs.error).to.length(1)\nexpect(logs.warn).is.deep.equal([])\n@@ -175,6 +176,7 @@ describe('WriteApi', () => {\n},\n})\nsubject.writeRecord('test value=1')\n+ await waitForCondition(() => logs.warn.length > 0)\nawait subject.close().then(() => {\nexpect(logs.error).length(0)\nexpect(logs.warn).is.deep.equal([\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): introduce gzipThreshold sendOption
305,159
08.04.2021 15:47:58
-7,200
23b5956e4a51efa3f56464e9ef466840f47d382a
feat(core): add content-encoding gzip
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -215,6 +215,7 @@ export class NodeHttpTransport implements Transport {\nif (err) {\nreturn reject(err)\n}\n+ options.headers['content-encoding'] = 'gzip'\nreturn resolve(res)\n})\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): add content-encoding gzip
305,159
08.04.2021 15:48:41
-7,200
42817df58a5b407a19884e7052be2eb047c16add
feat(core/write): add gzipThreshold with 1000 default
[ { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -79,6 +79,8 @@ export interface WriteOptions extends WriteRetryOptions {\ndefaultTags?: Record<string, string>\n/** HTTP headers that will be sent with every write request */\nheaders?: {[key: string]: string}\n+ /** When specified, write bodies larger than the threshold are gzipped */\n+ gzipThreshold?: number\n}\n/** default RetryDelayStrategyOptions */\n@@ -102,6 +104,7 @@ export const DEFAULT_WriteOptions: WriteOptions = {\nminRetryDelay: 5000,\nmaxRetryDelay: 180000,\nexponentialBase: 5,\n+ gzipThreshold: 1000,\n}\n/**\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core/write): add gzipThreshold with 1000 default
305,159
08.04.2021 15:50:06
-7,200
d0aedd01e6151094b8f3c624261a2d38ce913bda
feat(core): apply gzipThreshold in WriteApi
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -91,6 +91,7 @@ export default class WriteApiImpl implements WriteApi {\n'content-type': 'text/plain; charset=utf-8',\n...writeOptions?.headers,\n},\n+ gzipThreshold: this.writeOptions.gzipThreshold,\n}\nconst scheduleNextSend = (): void => {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): apply gzipThreshold in WriteApi
305,159
08.04.2021 16:03:59
-7,200
aace70de5130ba8a4d586b261d2fbdb8f974c5c9
feat(core): apply gzip when greater than sendOptions.gzipThreshold
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -206,7 +206,7 @@ export class NodeHttpTransport implements Transport {\n}\nif (\nsendOptions.gzipThreshold !== undefined &&\n- sendOptions.gzipThreshold > bodyBuffer.length\n+ sendOptions.gzipThreshold < bodyBuffer.length\n) {\nbodyPromise = bodyPromise.then(body => {\nreturn new Promise((resolve, reject) => {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): apply gzip when greater than sendOptions.gzipThreshold
305,159
08.04.2021 22:26:52
-7,200
10d17b0df121fa650b732627c46f5117912d5a02
feat(core/write): add test for gzipped write
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -210,7 +210,7 @@ export class NodeHttpTransport implements Transport {\n) {\nbodyPromise = bodyPromise.then(body => {\nreturn new Promise((resolve, reject) => {\n- zlib.gzip(body, zlibOptions, (err, res) => {\n+ zlib.gzip(body, (err, res) => {\n/* istanbul ignore next - hard to simulate failure, manually reviewed */\nif (err) {\nreturn reject(err)\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -13,6 +13,7 @@ import {\nimport {collectLogging, CollectedLogs} from '../util'\nimport {Logger} from '../../src/util/logger'\nimport {waitForCondition} from './util/waitForCondition'\n+import zlib from 'zlib'\nconst clientOptions: ClientOptions = {\nurl: 'http://fake:8086',\n@@ -335,6 +336,79 @@ describe('WriteApi', () => {\nexpect(lines[4]).to.be.equal('test,xtra=1 value=6 3000000')\nexpect(lines[5]).to.be.equal('test,xtra=1 value=7 false')\n})\n+ it('flushes gzipped line protocol', async () => {\n+ const writeCounters = createWriteCounters()\n+ useSubject({\n+ flushInterval: 5,\n+ maxRetries: 1,\n+ batchSize: 10,\n+ writeSuccess: writeCounters.writeSuccess,\n+ gzipThreshold: 0,\n+ })\n+ let requests = 0\n+ const messages: string[] = []\n+ nock(clientOptions.url)\n+ .post(WRITE_PATH_NS)\n+ .reply(function(_uri, _requestBody) {\n+ requests++\n+ if (requests % 2) {\n+ return [429, '', {'retry-after': '1'}]\n+ } else {\n+ if (this.req.headers['content-encoding'] == 'gzip') {\n+ const plain = zlib.gunzipSync(\n+ Buffer.from(_requestBody as string, 'hex')\n+ )\n+ messages.push(plain.toString())\n+ }\n+ return [204, '', {'retry-after': '1'}]\n+ }\n+ })\n+ .persist()\n+ subject.writePoint(\n+ new Point('test')\n+ .tag('t', ' ')\n+ .floatField('value', 1)\n+ .timestamp('')\n+ )\n+ await waitForCondition(() => writeCounters.successLineCount == 1)\n+ expect(logs.error).has.length(0)\n+ expect(logs.warn).has.length(1) // request was retried once\n+ subject.writePoint(new Point()) // ignored, since it generates no line\n+ subject.writePoints([\n+ new Point('test'), // will be ignored + warning\n+ new Point('test').floatField('value', 2),\n+ new Point('test').floatField('value', 3),\n+ new Point('test').floatField('value', 4).timestamp('1'),\n+ new Point('test').floatField('value', 5).timestamp(2.1),\n+ new Point('test').floatField('value', 6).timestamp(new Date(3)),\n+ new Point('test')\n+ .floatField('value', 7)\n+ .timestamp((false as any) as string), // server decides what to do with such values\n+ ])\n+ await waitForCondition(() => writeCounters.successLineCount == 7)\n+ expect(logs.error).to.length(0)\n+ expect(logs.warn).to.length(2)\n+ expect(messages).to.have.length(2)\n+ expect(messages[0]).to.equal('test,t=\\\\ ,xtra=1 value=1')\n+ const lines = messages[1].split('\\n')\n+ expect(lines).has.length(6)\n+ expect(lines[0]).to.satisfy((line: string) =>\n+ line.startsWith('test,xtra=1 value=2')\n+ )\n+ expect(lines[0].substring(lines[0].lastIndexOf(' ') + 1)).to.have.length(\n+ String(Date.now()).length + 6 // nanosecond precision\n+ )\n+ expect(lines[1]).to.satisfy((line: string) =>\n+ line.startsWith('test,xtra=1 value=3')\n+ )\n+ expect(lines[0].substring(lines[0].lastIndexOf(' ') + 1)).to.have.length(\n+ String(Date.now()).length + 6 // nanosecond precision\n+ )\n+ expect(lines[2]).to.be.equal('test,xtra=1 value=4 1')\n+ expect(lines[3]).to.be.equal('test,xtra=1 value=5 2')\n+ expect(lines[4]).to.be.equal('test,xtra=1 value=6 3000000')\n+ expect(lines[5]).to.be.equal('test,xtra=1 value=7 false')\n+ })\nit('fails on write response status not being exactly 204', async () => {\nconst writeCounters = createWriteCounters()\n// required because of https://github.com/influxdata/influxdb-client-js/issues/263\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core/write): add test for gzipped write
305,159
09.04.2021 06:03:15
-7,200
98be77e9d5c414d102191d96ea3aeb23cbf22600
chore(giraffe): move dependency to dev
[ { "change_type": "MODIFY", "old_path": "packages/giraffe/package.json", "new_path": "packages/giraffe/package.json", "diff": "\"@influxdata/influxdb-client\": \"^1.12.0\",\n\"@microsoft/api-extractor\": \"^7.13.1\",\n\"@rollup/plugin-replace\": \"^2.3.0\",\n+ \"@rollup/plugin-node-resolve\": \"^10.0.0\",\n\"@types/chai\": \"^4.2.5\",\n\"@types/mocha\": \"^5.2.7\",\n\"@types/react\": \"^16.9.55\",\n\"sinon\": \"^7.5.0\",\n\"ts-node\": \"^8.5.4\",\n\"typescript\": \"^4.1.2\"\n- },\n- \"dependencies\": {\n- \"@rollup/plugin-node-resolve\": \"^10.0.0\"\n}\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(giraffe): move dependency to dev
305,159
09.04.2021 07:27:36
-7,200
b7c75a0998e9675b7b76a88e91b95ad7615dbe01
feat(core/browser): allow to modify body before sending
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "-/* eslint-disable @typescript-eslint/no-unused-vars */\nimport {Transport, SendOptions} from '../../transport'\nimport {ConnectionOptions} from '../../options'\nimport {HttpError} from '../../errors'\n@@ -191,7 +190,8 @@ export default class FetchTransport implements Transport {\noptions: SendOptions\n): Promise<Response> {\nconst {method, headers, ...other} = options\n- return fetch(`${this.url}${path}`, {\n+ const url = `${this.url}${path}`\n+ const request: RequestInit = {\nmethod: method,\nbody:\nmethod === 'GET' || method === 'HEAD'\n@@ -206,6 +206,17 @@ export default class FetchTransport implements Transport {\ncredentials: 'omit' as 'omit',\n// allow to specify custom options, such as signal, in SendOptions\n...other,\n- })\n}\n+ this.modifyFetchRequest(request, options, url)\n+ return fetch(url, request)\n+ }\n+\n+ /**\n+ * ModifyFetchRequest allows to modify requests before sending.\n+ */\n+ public modifyFetchRequest: (\n+ request: RequestInit,\n+ options: SendOptions,\n+ url: string\n+ ) => void = function() {}\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core/browser): allow to modify body before sending
305,159
09.04.2021 07:28:29
-7,200
4e210dc125ecdb7fd2b4c0b86de9c022c1191d87
feat(core/browser): add an example that shows gzip body compression
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -213,6 +213,23 @@ export default class FetchTransport implements Transport {\n/**\n* ModifyFetchRequest allows to modify requests before sending.\n+ * The following example shows a function that adds gzip\n+ * compression of requests using pako.js.\n+ *\n+ * ```ts\n+ * function(request: RequestInit, options: SendOptions) {\n+ * const body = request.body\n+ * if (\n+ * typeof body === 'string' &&\n+ * options.gzipThreshold !== undefined &&\n+ * body.length > options.gzipThreshold\n+ * ) {\n+ * // gzip request, used in write API\n+ * ;(request.headers as Record<string, string>)['content-encoding'] = 'gzip'\n+ * request.body = pako.gzip(body, {to: 'string'})\n+ * }\n+ * }\n+ * ```\n*/\npublic modifyFetchRequest: (\nrequest: RequestInit,\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core/browser): add an example that shows gzip body compression
305,159
09.04.2021 07:29:46
-7,200
cff9f52d9526a20f38ed76e74b2f9b87ebe843df
feat(core/browser): test fetch transport request customization
[ { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts", "new_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts", "diff": "@@ -89,6 +89,26 @@ describe('FetchTransport', () => {\n})\nexpect(response).is.deep.equal('{}')\n})\n+ it('allows to transform requests', async () => {\n+ let lastRequest: any\n+ emulateFetchApi(\n+ {\n+ headers: {'content-type': 'text/plain'},\n+ body: '{}',\n+ },\n+ req => (lastRequest = req)\n+ )\n+ const transport = new FetchTransport({url: 'http://test:8086'})\n+ transport.modifyFetchRequest = (request): void => {\n+ request.body = 'modified'\n+ }\n+ await transport.request('/whatever', '', {\n+ method: 'POST',\n+ })\n+ expect(lastRequest)\n+ .property('body')\n+ .equals('modified')\n+ })\nit('receives also response headers', async () => {\nemulateFetchApi({\nheaders: {'content-type': 'application/json'},\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/browser/emulateBrowser.ts", "new_path": "packages/core/test/unit/impl/browser/emulateBrowser.ts", "diff": "@@ -79,8 +79,12 @@ let beforeEmulation:\n| {fetch: any; AbortController: any; TextEncoder: any}\n| undefined\n-export function emulateFetchApi(spec: ResponseSpec): void {\n- function fetch(url: string, _options: any): Promise<any> {\n+export function emulateFetchApi(\n+ spec: ResponseSpec,\n+ onRequest?: (options: any) => void\n+): void {\n+ function fetch(url: string, options: any): Promise<any> {\n+ if (onRequest) onRequest(options)\nreturn url.indexOf('error') !== -1\n? Promise.reject(new Error(url))\n: Promise.resolve(createResponse(spec))\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core/browser): test fetch transport request customization
305,159
09.04.2021 07:31:53
-7,200
73daab4cf779bdbe0a58a2d092461cf11b66330c
chore(core/browser): refactor to requestDecorator
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -207,12 +207,12 @@ export default class FetchTransport implements Transport {\n// allow to specify custom options, such as signal, in SendOptions\n...other,\n}\n- this.modifyFetchRequest(request, options, url)\n+ this.requestDecorator(request, options, url)\nreturn fetch(url, request)\n}\n/**\n- * ModifyFetchRequest allows to modify requests before sending.\n+ * RequestDecorator allows to modify requests before sending.\n* The following example shows a function that adds gzip\n* compression of requests using pako.js.\n*\n@@ -231,7 +231,7 @@ export default class FetchTransport implements Transport {\n* }\n* ```\n*/\n- public modifyFetchRequest: (\n+ public requestDecorator: (\nrequest: RequestInit,\noptions: SendOptions,\nurl: string\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts", "new_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts", "diff": "@@ -99,7 +99,7 @@ describe('FetchTransport', () => {\nreq => (lastRequest = req)\n)\nconst transport = new FetchTransport({url: 'http://test:8086'})\n- transport.modifyFetchRequest = (request): void => {\n+ transport.requestDecorator = (request): void => {\nrequest.body = 'modified'\n}\nawait transport.request('/whatever', '', {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core/browser): refactor to requestDecorator
305,159
09.04.2021 08:30:40
-7,200
22fd165b7e8875971bf49dda78818bed4b9bfa2b
chore(core): improve example of browser gzip customization
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -213,20 +213,21 @@ export default class FetchTransport implements Transport {\n/**\n* RequestDecorator allows to modify requests before sending.\n+ *\n* The following example shows a function that adds gzip\n* compression of requests using pako.js.\n*\n* ```ts\n- * function(request: RequestInit, options: SendOptions) {\n+ * const client = new InfluxDB({url: 'http://a'})\n+ * client.transport.requestDecorator = function(request, options) {\n* const body = request.body\n* if (\n* typeof body === 'string' &&\n* options.gzipThreshold !== undefined &&\n* body.length > options.gzipThreshold\n* ) {\n- * // gzip request, used in write API\n- * ;(request.headers as Record<string, string>)['content-encoding'] = 'gzip'\n- * request.body = pako.gzip(body, {to: 'string'})\n+ * request.headers['content-encoding'] = 'gzip'\n+ * request.body = pako.gzip(body)\n* }\n* }\n* ```\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): improve example of browser gzip customization
305,159
10.04.2021 20:05:40
-7,200
8a8b314c05580ea2c168b7da920ffcc74699b0fb
chore: improve Point documentation,
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -7,7 +7,7 @@ import {escape} from './util/escape'\nexport interface PointSettings {\ndefaultTags?: {[key: string]: string}\nconvertTime?: (\n- value: string | number | Date | undefined\n+ value: string | number | Date | unknown | undefined\n) => string | undefined\n}\n@@ -19,7 +19,7 @@ export class Point {\nprivate tags: {[key: string]: string} = {}\n/** escaped field values */\npublic fields: {[key: string]: string} = {}\n- private time: string | number | Date | undefined\n+ private time: string | number | Date | unknown | undefined\n/**\n* Create a new Point with specified a measurement name.\n@@ -123,17 +123,19 @@ export class Point {\n}\n/**\n- * Sets point time. A string or number value can be used\n- * to carry an int64 value of a precision that depends\n- * on WriteApi, nanoseconds by default. An undefined value\n- * generates a local timestamp using the client's clock.\n- * An empty string can be used to let the server assign\n- * the timestamp.\n+ * Sets point timestamp. Timestamp can be specified as a Date, number, string,\n+ * bigint or undefined value. A number or a string (base-10) value\n+ * represents time as a count of time units since epoch. The time unit\n+ * is specified in a WriteApi precision, nanosecond by default.\n+ * An undefined value instructs to assign a local timestamp using\n+ * the client's clock. An empty string can be used to let the server assign\n+ * the timestamp. Bigint (or any other value type) can be also passed, its\n+ * toString() value is used.\n*\n* @param value - point time\n* @returns this\n*/\n- public timestamp(value: Date | number | string | undefined): Point {\n+ public timestamp(value: Date | number | string | unknown | undefined): Point {\nthis.time = value\nreturn this\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve Point documentation,
305,159
10.04.2021 20:06:20
-7,200
93d2936202c30ab6defe24e0383fb1660f60d9c4
feat(core): support any value (bigint including) in Point.timestamp
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -279,7 +279,9 @@ export default class WriteApiImpl implements WriteApi {\n})\nreturn this\n}\n- convertTime(value: string | number | Date | undefined): string | undefined {\n+ convertTime(\n+ value: string | number | Date | unknown | undefined\n+ ): string | undefined {\nif (value === undefined) {\nreturn this.currentTime()\n} else if (typeof value === 'string') {\n@@ -289,7 +291,6 @@ export default class WriteApiImpl implements WriteApi {\n} else if (typeof value === 'number') {\nreturn String(Math.floor(value))\n} else {\n- // Logger.warn(`unsupported timestamp value: ${value}`)\nreturn String(value)\n}\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): support any value (bigint including) in Point.timestamp
305,159
10.04.2021 20:06:50
-7,200
6a41002dc6efb3cfa7893607413df4b90b2e617b
feat(core): test all Point.timestamp value types with WriteApi implementation
[ { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -9,6 +9,7 @@ import {\nInfluxDB,\nWritePrecisionType,\nDEFAULT_WriteOptions,\n+ PointSettings,\n} from '../../src'\nimport {collectLogging, CollectedLogs} from '../util'\nimport {Logger} from '../../src/util/logger'\n@@ -209,6 +210,41 @@ describe('WriteApi', () => {\nexpect(writeOptions.writeFailed).to.not.throw()\n})\n})\n+ describe('convert point time to line protocol', () => {\n+ const writeAPI = createApi(ORG, BUCKET, 'ms', {\n+ retryJitter: 0,\n+ }) as PointSettings\n+ it('converts empty string to no timestamp', () => {\n+ const p = new Point('a').floatField('b', 1).timestamp('')\n+ expect(p.toLineProtocol(writeAPI)).equals('a b=1')\n+ })\n+ it('converts number to timestamp', () => {\n+ const p = new Point('a').floatField('b', 1).timestamp(1.2)\n+ expect(p.toLineProtocol(writeAPI)).equals('a b=1 1')\n+ })\n+ it('converts number to timestamp', () => {\n+ const d = new Date()\n+ const p = new Point('a').floatField('b', 1).timestamp(d)\n+ expect(p.toLineProtocol(writeAPI)).equals(`a b=1 ${d.getTime()}`)\n+ })\n+ it('converts undefined to local timestamp', () => {\n+ const p = new Point('a').floatField('b', 1)\n+ expect(p.toLineProtocol(writeAPI)).satisfies((x: string) => {\n+ return x.startsWith('a b=1')\n+ }, `does not start with 'a b=1'`)\n+ expect(p.toLineProtocol(writeAPI)).satisfies((x: string) => {\n+ return Date.now() - Number.parseInt(x.substring('a b=1 '.length)) < 1000\n+ })\n+ })\n+ it('converts any value to a timestamp using value.toString', () => {\n+ const p = new Point('a').floatField('b', 1).timestamp({\n+ toString() {\n+ return '123'\n+ },\n+ })\n+ expect(p.toLineProtocol(writeAPI)).equals('a b=1 123')\n+ })\n+ })\ndescribe('flush on background', () => {\nlet subject: WriteApi\nlet logs: CollectedLogs\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): test all Point.timestamp value types with WriteApi implementation
305,159
10.04.2021 20:10:28
-7,200
cae648a74dd3b6ceb853bb89c71d64050cb5b05f
chore: add note that the point timestamp must fit into int64
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -130,7 +130,8 @@ export class Point {\n* An undefined value instructs to assign a local timestamp using\n* the client's clock. An empty string can be used to let the server assign\n* the timestamp. Bigint (or any other value type) can be also passed, its\n- * toString() value is used.\n+ * toString() value is used. Note that InfluxDB requires the timestamp to fit into\n+ * int64 data type.\n*\n* @param value - point time\n* @returns this\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: add note that the point timestamp must fit into int64
305,159
12.04.2021 05:21:04
-7,200
f774ebdf4b876fdb8574903afe4f3661150dbf24
chore: improve WriteApi.test.ts
[ { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -222,7 +222,7 @@ describe('WriteApi', () => {\nconst p = new Point('a').floatField('b', 1).timestamp(1.2)\nexpect(p.toLineProtocol(writeAPI)).equals('a b=1 1')\n})\n- it('converts number to timestamp', () => {\n+ it('converts Date to timestamp', () => {\nconst d = new Date()\nconst p = new Point('a').floatField('b', 1).timestamp(d)\nexpect(p.toLineProtocol(writeAPI)).equals(`a b=1 ${d.getTime()}`)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve WriteApi.test.ts Co-authored-by: Micah Zoltu <[email protected]>
305,159
12.04.2021 06:24:50
-7,200
5eef8658c411315f92a1f1e58e31e11eaf58e4b7
feat(core): better document bigint support
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -7,7 +7,7 @@ import {escape} from './util/escape'\nexport interface PointSettings {\ndefaultTags?: {[key: string]: string}\nconvertTime?: (\n- value: string | number | Date | unknown | undefined\n+ value: string | number | Date | undefined\n) => string | undefined\n}\n@@ -19,7 +19,7 @@ export class Point {\nprivate tags: {[key: string]: string} = {}\n/** escaped field values */\npublic fields: {[key: string]: string} = {}\n- private time: string | number | Date | unknown | undefined\n+ private time: string | number | Date | undefined\n/**\n* Create a new Point with specified a measurement name.\n@@ -123,20 +123,21 @@ export class Point {\n}\n/**\n- * Sets point timestamp. Timestamp can be specified as a Date, number, string,\n- * bigint or undefined value. A number or a string (base-10) value\n- * represents time as a count of time units since epoch. The time unit\n- * is specified in a WriteApi precision, nanosecond by default.\n- * An undefined value instructs to assign a local timestamp using\n+ * Sets point timestamp. Timestamp can be specified as a Date (preferred), number, string\n+ * or an undefined value. An undefined value instructs to assign a local timestamp using\n* the client's clock. An empty string can be used to let the server assign\n- * the timestamp. Bigint (or any other value type) can be also passed, its\n- * toString() value is used. Note that InfluxDB requires the timestamp to fit into\n- * int64 data type.\n+ * the timestamp. A number value represents time as a count of time units since epoch.\n+ * The current time in nanoseconds can't precisely fit into a JS number, which\n+ * can hold at most 2^53 integer number. Nanosecond precision numbers are thus supplied as\n+ * a (base-10) string. An application can use ES2020 BigInt to represent nanoseconds,\n+ * BigInt's `toString()` returns the required high-precision string.\n+ *\n+ * Note that InfluxDB requires the timestamp to fit into int64 data type.\n*\n* @param value - point time\n* @returns this\n*/\n- public timestamp(value: Date | number | string | unknown | undefined): Point {\n+ public timestamp(value: Date | number | string | undefined): Point {\nthis.time = value\nreturn this\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -279,9 +279,7 @@ export default class WriteApiImpl implements WriteApi {\n})\nreturn this\n}\n- convertTime(\n- value: string | number | Date | unknown | undefined\n- ): string | undefined {\n+ convertTime(value: string | number | Date | undefined): string | undefined {\nif (value === undefined) {\nreturn this.currentTime()\n} else if (typeof value === 'string') {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -236,14 +236,6 @@ describe('WriteApi', () => {\nreturn Date.now() - Number.parseInt(x.substring('a b=1 '.length)) < 1000\n})\n})\n- it('converts any value to a timestamp using value.toString', () => {\n- const p = new Point('a').floatField('b', 1).timestamp({\n- toString() {\n- return '123'\n- },\n- })\n- expect(p.toLineProtocol(writeAPI)).equals('a b=1 123')\n- })\n})\ndescribe('flush on background', () => {\nlet subject: WriteApi\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): better document bigint support
305,159
22.04.2021 07:35:25
-7,200
513f57f56206cf16e5832bdd19f5e240e30502c5
feat(apis): update APIs from swagger as of 2021-04-22
[ { "change_type": "MODIFY", "old_path": "packages/apis/resources/operations.json", "new_path": "packages/apis/resources/operations.json", "diff": "\"name\": \"org\",\n\"description\": \"Only show authorizations that belong to a organization name.\",\n\"type\": \"string\"\n+ },\n+ {\n+ \"name\": \"token\",\n+ \"description\": \"Find a token by value.\",\n+ \"type\": \"string\"\n}\n],\n\"bodyParam\": null,\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/resources/swagger.yml", "new_path": "packages/apis/resources/swagger.yml", "diff": "@@ -3196,6 +3196,11 @@ paths:\nschema:\ntype: string\ndescription: Only show authorizations that belong to a organization name.\n+ - in: query\n+ name: token\n+ schema:\n+ type: string\n+ description: Find a token by value.\nresponses:\n\"200\":\ndescription: A list of authorizations\n@@ -8933,7 +8938,6 @@ components:\n- shape\n- axes\n- colors\n- - legend\n- note\n- showNoteWhenEmpty\n- position\n@@ -8962,8 +8966,8 @@ components:\ntype: boolean\naxes:\n$ref: \"#/components/schemas/Axes\"\n- legend:\n- $ref: \"#/components/schemas/Legend\"\n+ staticLegend:\n+ $ref: \"#/components/schemas/StaticLegend\"\nxColumn:\ntype: string\ngenerateXAxisTicks:\n@@ -9021,7 +9025,6 @@ components:\n- shape\n- axes\n- colors\n- - legend\n- note\n- showNoteWhenEmpty\nproperties:\n@@ -9049,8 +9052,8 @@ components:\ntype: boolean\naxes:\n$ref: \"#/components/schemas/Axes\"\n- legend:\n- $ref: \"#/components/schemas/Legend\"\n+ staticLegend:\n+ $ref: \"#/components/schemas/StaticLegend\"\nxColumn:\ntype: string\ngenerateXAxisTicks:\n@@ -9105,7 +9108,6 @@ components:\n- shape\n- axes\n- colors\n- - legend\n- note\n- showNoteWhenEmpty\n- prefix\n@@ -9137,8 +9139,8 @@ components:\ntype: boolean\naxes:\n$ref: \"#/components/schemas/Axes\"\n- legend:\n- $ref: \"#/components/schemas/Legend\"\n+ staticLegend:\n+ $ref: \"#/components/schemas/StaticLegend\"\nxColumn:\ntype: string\ngenerateXAxisTicks:\n@@ -9515,7 +9517,6 @@ components:\n- tickPrefix\n- suffix\n- tickSuffix\n- - legend\n- decimalPlaces\nproperties:\ntype:\n@@ -9546,8 +9547,6 @@ components:\ntype: string\ntickSuffix:\ntype: string\n- legend:\n- $ref: \"#/components/schemas/Legend\"\ndecimalPlaces:\n$ref: \"#/components/schemas/DecimalPlaces\"\nHistogramViewProperties:\n@@ -9625,7 +9624,6 @@ components:\ntickPrefix,\nsuffix,\ntickSuffix,\n- legend,\ndecimalPlaces,\n]\nproperties:\n@@ -9657,8 +9655,6 @@ components:\ntype: string\ntickSuffix:\ntype: string\n- legend:\n- $ref: \"#/components/schemas/Legend\"\ndecimalPlaces:\n$ref: \"#/components/schemas/DecimalPlaces\"\nTableViewProperties:\n@@ -9950,25 +9946,25 @@ components:\n$ref: \"#/components/schemas/Axis\"\n\"y\": # Quoted to prevent YAML parser from interpreting y as shorthand for true.\n$ref: \"#/components/schemas/Axis\"\n- Legend:\n- description: Legend define encoding of data into a view's legend\n+ StaticLegend:\n+ description: The options specific to the static legend\ntype: object\nproperties:\n- type:\n- description: The style of the legend.\n- type: string\n- enum:\n- - static\n- orientation:\n- description: >-\n- orientation is the location of the legend with respect to the view\n- graph\n+ colorizeRows:\n+ type: boolean\n+ heightRatio:\n+ type: number\n+ format: float\n+ opacity:\n+ type: number\n+ format: float\n+ orientationThreshold:\n+ type: integer\n+ valueAxis:\ntype: string\n- enum:\n- - top\n- - bottom\n- - left\n- - right\n+ widthRatio:\n+ type: number\n+ format: float\nDecimalPlaces:\ndescription: Indicates whether decimal places should be enforced, and how many digits it should show.\ntype: object\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/AuthorizationsAPI.ts", "new_path": "packages/apis/src/generated/AuthorizationsAPI.ts", "diff": "@@ -15,6 +15,8 @@ export interface GetAuthorizationsRequest {\norgID?: string\n/** Only show authorizations that belong to a organization name. */\norg?: string\n+ /** Find a token by value. */\n+ token?: string\n}\nexport interface PostAuthorizationsRequest {\n/** Authorization to create */\n@@ -66,6 +68,7 @@ export class AuthorizationsAPI {\n'user',\n'orgID',\n'org',\n+ 'token',\n])}`,\nrequest,\nrequestOptions\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/types.ts", "new_path": "packages/apis/src/generated/types.ts", "diff": "@@ -673,7 +673,7 @@ export interface LinePlusSingleStatProperties {\n/** If true, will display note when empty */\nshowNoteWhenEmpty: boolean\naxes: Axes\n- legend: Legend\n+ staticLegend?: StaticLegend\nxColumn?: string\ngenerateXAxisTicks?: string[]\nxTotalTicks?: number\n@@ -774,13 +774,15 @@ export interface Axis {\nexport type AxisScale = 'log' | 'linear'\n/**\n- * Legend define encoding of data into a view's legend\n+ * The options specific to the static legend\n*/\n-export interface Legend {\n- /** The style of the legend. */\n- type?: 'static'\n- /** orientation is the location of the legend with respect to the view graph */\n- orientation?: 'top' | 'bottom' | 'left' | 'right'\n+export interface StaticLegend {\n+ colorizeRows?: boolean\n+ heightRatio?: number\n+ opacity?: number\n+ orientationThreshold?: number\n+ valueAxis?: string\n+ widthRatio?: number\n}\n/**\n@@ -804,7 +806,7 @@ export interface XYViewProperties {\n/** If true, will display note when empty */\nshowNoteWhenEmpty: boolean\naxes: Axes\n- legend: Legend\n+ staticLegend?: StaticLegend\nxColumn?: string\ngenerateXAxisTicks?: string[]\nxTotalTicks?: number\n@@ -839,7 +841,6 @@ export interface SingleStatViewProperties {\ntickPrefix: string\nsuffix: string\ntickSuffix: string\n- legend: Legend\ndecimalPlaces: DecimalPlaces\n}\n@@ -876,7 +877,6 @@ export interface GaugeViewProperties {\ntickPrefix: string\nsuffix: string\ntickSuffix: string\n- legend: Legend\ndecimalPlaces: DecimalPlaces\n}\n@@ -1165,7 +1165,7 @@ export interface BandViewProperties {\n/** If true, will display note when empty */\nshowNoteWhenEmpty: boolean\naxes: Axes\n- legend: Legend\n+ staticLegend?: StaticLegend\nxColumn?: string\ngenerateXAxisTicks?: string[]\nxTotalTicks?: number\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(apis): update APIs from swagger as of 2021-04-22
305,159
24.04.2021 06:22:53
-7,200
9b60f4aa24f6db64f806b1d08ac17b853c6008fa
chore: document new location of the swagger file
[ { "change_type": "MODIFY", "old_path": "packages/apis/DEVELOPMENT.md", "new_path": "packages/apis/DEVELOPMENT.md", "diff": "@@ -11,7 +11,7 @@ $ yarn build\n## Re-generate APIs code\n- update local resources/swagger.yml to the latest version\n- - `wget -O resources/swagger.yml https://raw.githubusercontent.com/influxdata/influxdb/master/http/swagger.yml`\n+ - `wget -O resources/swagger.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/oss.yml`\n- re-generate src/generated/types.ts and resources/operations.json using [oats](https://github.com/bonitoo/oats)\n- `rm -rf src/generated/*.ts`\n- `oats -i 'types' --storeOperations resources/operations.json resources/swagger.yml > src/generated/types.ts`\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: document new location of the swagger file
305,159
13.05.2021 05:37:04
-7,200
ffee4824fa9e796775256c2701e29512a491656c
chore: improve PointSettings docs
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -5,7 +5,9 @@ import {escape} from './util/escape'\n* to a protocol line.\n*/\nexport interface PointSettings {\n+ /** default tags to add to every point */\ndefaultTags?: {[key: string]: string}\n+ /** convertTime serializes of Point's timestamp to a string */\nconvertTime?: (\nvalue: string | number | Date | undefined\n) => string | undefined\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve PointSettings docs
305,159
13.05.2021 05:38:34
-7,200
de2b0d6a7ecfca1ca85d56c3500b04682879b341
feat(core): add convertTimeToNanos fn
[ { "change_type": "MODIFY", "old_path": "packages/core/src/util/currentTime.ts", "new_path": "packages/core/src/util/currentTime.ts", "diff": "@@ -94,3 +94,24 @@ export const dateToProtocolTimestamp = {\nus: (d: Date): string => `${d.getTime()}000`,\nns: (d: Date): string => `${d.getTime()}000000`,\n}\n+\n+/**\n+ * convertTimeToNanos converts of Point's timestamp to a string\n+ * @param value - supported timestamp value\n+ * @returns line protocol value\n+ */\n+export function convertTimeToNanos(\n+ value: string | number | Date | undefined\n+): string | undefined {\n+ if (value === undefined) {\n+ return nanos()\n+ } else if (typeof value === 'string') {\n+ return value.length > 0 ? value : undefined\n+ } else if (value instanceof Date) {\n+ return `${value.getTime()}000000`\n+ } else if (typeof value === 'number') {\n+ return String(Math.floor(value))\n+ } else {\n+ return String(value)\n+ }\n+}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): add convertTimeToNanos fn
305,159
13.05.2021 05:39:47
-7,200
4166f2294979d5b72fd5be1c6cda7bc3021d44d5
feat(core): serialize Point timestamp with nanosecond precision by default
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "+import {convertTimeToNanos} from './util/currentTime'\nimport {escape} from './util/escape'\n/**\n@@ -181,6 +182,8 @@ export class Point {\nlet time = this.time\nif (settings && settings.convertTime) {\ntime = settings.convertTime(time)\n+ } else {\n+ time = convertTimeToNanos(time)\n}\nreturn `${escape.measurement(this.name)}${tagsLine} ${fieldsLine}${\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): serialize Point timestamp with nanosecond precision by default
305,159
13.05.2021 06:03:22
-7,200
12c74feab654b649db5cd0054e1ad8f1aa9baa3d
feat(ui): test default Point's line protocol serialization
[ { "change_type": "MODIFY", "old_path": "packages/core/test/unit/Point.test.ts", "new_path": "packages/core/test/unit/Point.test.ts", "diff": "@@ -51,6 +51,8 @@ function createPoint(test: PointTest): Point {\n})\nif (test.time) {\npoint.timestamp(test.time)\n+ } else {\n+ point.timestamp('')\n}\nreturn point\n}\n@@ -98,10 +100,48 @@ describe('Point', () => {\nit('creates line with JSON double encoded field #241', () => {\nconst fieldValue = JSON.stringify({prop: JSON.stringify({str: 'test'})})\nconst point = new Point('tst')\n- point.stringField('a', fieldValue)\n+ point.stringField('a', fieldValue).timestamp('')\nexpect(point.toLineProtocol()).equals(\n'tst a=\"{X\"propX\":X\"{XXX\"strXXX\":XXX\"testXXX\"}X\"}\"'.replace(/X/g, '\\\\')\n)\n})\n+ it('serializes Point with current time nanosecond OOTB', () => {\n+ const point = new Point('tst').floatField('a', 1)\n+ const lpParts = point.toLineProtocol()?.split(' ') as string[]\n+ expect(lpParts).has.length(3)\n+ expect(lpParts[0]).equals('tst')\n+ expect(lpParts[1]).equals('a=1')\n+ // expect current time in nanoseconds\n+ const nowMillisStr = String(Date.now())\n+ expect(lpParts[2]).has.length(nowMillisStr.length + 6)\n+ expect(\n+ Number.parseInt(lpParts[2].substring(0, nowMillisStr.length)) - 1\n+ ).lte(Date.now())\n+ })\n+ it(\"serializes Point's Date timestamp with nanosecond precision OOTB\", () => {\n+ const point = new Point('tst').floatField('a', 1).timestamp(new Date())\n+ const lpParts = point.toLineProtocol()?.split(' ') as string[]\n+ expect(lpParts).has.length(3)\n+ expect(lpParts[0]).equals('tst')\n+ expect(lpParts[1]).equals('a=1')\n+ // expect current time in nanoseconds\n+ const nowMillisStr = String(Date.now())\n+ expect(lpParts[2]).has.length(nowMillisStr.length + 6)\n+ expect(\n+ Number.parseInt(lpParts[2].substring(0, nowMillisStr.length)) - 1\n+ ).lte(Date.now())\n+ })\n+ it(\"serializes Point's number timestamp as-is OOTB\", () => {\n+ const point = new Point('tst').floatField('a', 1).timestamp(1)\n+ expect(point.toLineProtocol()).equals('tst a=1 1')\n+ })\n+ it(\"serializes Point's unknown timestamp as-is OOTB\", () => {\n+ const point = new Point('tst').floatField('a', 1).timestamp(({\n+ toString() {\n+ return 'any'\n+ },\n+ } as unknown) as undefined)\n+ expect(point.toLineProtocol()).equals('tst a=1 any')\n+ })\n})\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(ui): test default Point's line protocol serialization
305,159
14.05.2021 04:13:15
-7,200
81c9c8b9288a44bd68a21359931d5f581e2c37e1
chore: improve Point's timestamp docs
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -8,7 +8,7 @@ import {escape} from './util/escape'\nexport interface PointSettings {\n/** default tags to add to every point */\ndefaultTags?: {[key: string]: string}\n- /** convertTime serializes of Point's timestamp to a string */\n+ /** convertTime serializes Point's timestamp to a line protocol value */\nconvertTime?: (\nvalue: string | number | Date | undefined\n) => string | undefined\n@@ -129,10 +129,13 @@ export class Point {\n* Sets point timestamp. Timestamp can be specified as a Date (preferred), number, string\n* or an undefined value. An undefined value instructs to assign a local timestamp using\n* the client's clock. An empty string can be used to let the server assign\n- * the timestamp. A number value represents time as a count of time units since epoch.\n- * The current time in nanoseconds can't precisely fit into a JS number, which\n- * can hold at most 2^53 integer number. Nanosecond precision numbers are thus supplied as\n- * a (base-10) string. An application can use ES2020 BigInt to represent nanoseconds,\n+ * the timestamp. A number value represents time as a count of time units since epoch, the\n+ * exact time unit then depends on the {@link InfluxDB.getWriteApi | precision} of the API\n+ * that writes the point.\n+ *\n+ * Beware that the current time in nanoseconds can't precisely fit into a JS number,\n+ * which can hold at most 2^53 integer number. Nanosecond precision numbers are thus supplied as\n+ * a (base-10) string. An application can also use ES2020 BigInt to represent nanoseconds,\n* BigInt's `toString()` returns the required high-precision string.\n*\n* Note that InfluxDB requires the timestamp to fit into int64 data type.\n@@ -147,7 +150,8 @@ export class Point {\n/**\n* Creates an InfluxDB protocol line out of this instance.\n- * @param settings - settings define the exact representation of point time and can also add default tags\n+ * @param settings - settings control serialization of a point timestamp and can also add default tags,\n+ * nanosecond timestamp precision is used when no settings are supplied.\n* @returns an InfluxDB protocol line out of this instance\n*/\npublic toLineProtocol(settings?: PointSettings): string | undefined {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve Point's timestamp docs
305,159
14.05.2021 04:14:52
-7,200
d435ec7032a515dddda3d8eecb4968e3c0bb859b
feat(core): allow partial point settings
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -154,7 +154,7 @@ export class Point {\n* nanosecond timestamp precision is used when no settings are supplied.\n* @returns an InfluxDB protocol line out of this instance\n*/\n- public toLineProtocol(settings?: PointSettings): string | undefined {\n+ public toLineProtocol(settings?: Partial<PointSettings>): string | undefined {\nif (!this.name) return undefined\nlet fieldsLine = ''\nObject.keys(this.fields)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): allow partial point settings
305,159
14.05.2021 04:31:49
-7,200
e59ebc8501c56ebeefb156f88640ebcbee0fb61b
chore: improve docs about partial settings
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -151,7 +151,7 @@ export class Point {\n/**\n* Creates an InfluxDB protocol line out of this instance.\n* @param settings - settings control serialization of a point timestamp and can also add default tags,\n- * nanosecond timestamp precision is used when no settings are supplied.\n+ * nanosecond timestamp precision is used when no `settings` or `settings.convertTime` is supplied.\n* @returns an InfluxDB protocol line out of this instance\n*/\npublic toLineProtocol(settings?: Partial<PointSettings>): string | undefined {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve docs about partial settings
305,159
16.05.2021 07:30:01
-7,200
18973b61542ccd18de8020e5b7a0d793835d1f16
chore: proofread doc
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -151,7 +151,7 @@ export class Point {\n/**\n* Creates an InfluxDB protocol line out of this instance.\n* @param settings - settings control serialization of a point timestamp and can also add default tags,\n- * nanosecond timestamp precision is used when no `settings` or `settings.convertTime` is supplied.\n+ * nanosecond timestamp precision is used when no `settings` or no `settings.convertTime` is supplied.\n* @returns an InfluxDB protocol line out of this instance\n*/\npublic toLineProtocol(settings?: Partial<PointSettings>): string | undefined {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: proofread doc
305,159
21.06.2021 07:25:40
-7,200
f76ac6593d860f08db46a7ca3020fcf8b2399ead
feat(core): add uintField fn to Point
[ { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -89,6 +89,41 @@ export class Point {\nreturn this\n}\n+ /**\n+ * Adds an unsigned integer field.\n+ *\n+ * @param name - field name\n+ * @param value - field value\n+ * @returns this\n+ */\n+ public uintField(name: string, value: number | any): Point {\n+ if (typeof value === 'number') {\n+ if (value < 0 || value > Number.MAX_SAFE_INTEGER) {\n+ throw new Error(`uint value out of js unsigned integer range: ${value}`)\n+ }\n+ this.fields[name] = `${Math.floor(value as number)}u`\n+ } else {\n+ const strVal = String(value)\n+ for (let i = 0; i < strVal.length; i++) {\n+ const code = strVal.charCodeAt(i)\n+ if (code < 48 || code > 57) {\n+ throw new Error(\n+ `uint value has an unsupported character at pos ${i}: ${value}`\n+ )\n+ }\n+ }\n+ if (\n+ strVal.length > 20 ||\n+ (strVal.length === 20 &&\n+ strVal.localeCompare('18446744073709551615') > 0)\n+ ) {\n+ throw new Error(`uint value out of range: ${strVal}`)\n+ }\n+ this.fields[name] = `${strVal}u`\n+ }\n+ return this\n+ }\n+\n/**\n* Adds a number field.\n*\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/fixture/pointTables.json", "new_path": "packages/core/test/fixture/pointTables.json", "diff": "\"name\": \"m11\",\n\"fields\": [[\"f\", \"s\", \"\\\\\\\"\"]],\n\"line\": \"m11 f=\\\"\\\\\\\\\\\\\\\"\\\"\"\n+ },\n+ {\n+ \"name\": \"uint1zero\",\n+ \"fields\": [[\"f\", \"u\", 0]],\n+ \"line\": \"uint1zero f=0u\"\n+ },\n+ {\n+ \"name\": \"uint2maxInt\",\n+ \"fields\": [[\"f\", \"u\", 9007199254740991]],\n+ \"line\": \"uint2maxInt f=9007199254740991u\"\n+ },\n+ {\n+ \"name\": \"uint3fraction\",\n+ \"fields\": [[\"f\", \"u\", 55.4]],\n+ \"line\": \"uint3fraction f=55u\"\n+ },\n+ {\n+ \"name\": \"uint4maxStr\",\n+ \"fields\": [[\"f\", \"u\", \"18446744073709551615\"]],\n+ \"line\": \"uint4maxStr f=18446744073709551615u\"\n+ },\n+ {\n+ \"name\": \"uintNegativeNumber\",\n+ \"fields\": [[\"f\", \"u\", -1]],\n+ \"throws\": \"uint value out of js unsigned integer range: -1\"\n+ },\n+ {\n+ \"name\": \"uintTooLargeNumber\",\n+ \"fields\": [[\"f\", \"u\", 9007199254740992]],\n+ \"throws\": \"uint value out of js unsigned integer range: 9007199254740992\"\n+ },\n+ {\n+ \"name\": \"uintNegativeString\",\n+ \"fields\": [[\"f\", \"u\", \"-1\"]],\n+ \"throws\": \"uint value has an unsupported character at pos 0: -1\"\n+ },\n+ {\n+ \"name\": \"uintTooLargeString\",\n+ \"fields\": [[\"f\", \"u\", \"18446744073709551616\"]],\n+ \"throws\": \"uint value out of range: 18446744073709551616\"\n}\n]\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/Point.test.ts", "new_path": "packages/core/test/unit/Point.test.ts", "diff": "@@ -5,7 +5,7 @@ import {Point, PointSettings} from '../../src'\ninterface PointTest {\nname?: string\ntags?: Array<[string, string]>\n- fields?: Array<[string, 'n' | 's' | 'b' | 'i', any]>\n+ fields?: Array<[string, 'n' | 's' | 'b' | 'i' | 'u', any]>\ntime?: string\nline: string | undefined\ntoString: string | undefined\n@@ -29,7 +29,7 @@ function createPoint(test: PointTest): Point {\n? new Point().measurement(test.name)\n: new Point()\n;(test.fields ?? []).forEach(\n- (field: [string, 'n' | 's' | 'b' | 'i', any]) => {\n+ (field: [string, 'n' | 's' | 'b' | 'i' | 'u', any]) => {\nswitch (field[1]) {\ncase 'n':\npoint.floatField(field[0], field[2])\n@@ -43,6 +43,9 @@ function createPoint(test: PointTest): Point {\ncase 'i':\npoint.intField(field[0], field[2])\nbreak\n+ case 'u':\n+ point.uintField(field[0], field[2])\n+ break\n}\n}\n)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): add uintField fn to Point
305,159
01.07.2021 06:04:23
-7,200
2c5a2d2aa1beb85941057ef227b997568b2be010
feat(core): implement random retry strategy
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/retryStrategy.ts", "new_path": "packages/core/src/impl/retryStrategy.ts", "diff": "@@ -24,17 +24,36 @@ export class RetryStrategyImpl implements RetryDelayStrategy {\n} else {\nif (failedAttempts && failedAttempts > 0) {\n// compute delay\n- let delay = this.options.minRetryDelay\n+ if (this.options.randomize) {\n+ // random delay between deterministic delays\n+ let delay = Math.max(this.options.minRetryDelay, 1)\n+ let nextDelay = delay * this.options.exponentialBase\nfor (let i = 1; i < failedAttempts; i++) {\n- delay = delay * this.options.exponentialBase\n- if (delay >= this.options.maxRetryDelay) {\n+ delay = nextDelay\n+ nextDelay = nextDelay * this.options.exponentialBase\n+ if (nextDelay >= this.options.maxRetryDelay) {\n+ nextDelay = this.options.maxRetryDelay\nbreak\n}\n}\nreturn (\n- Math.min(Math.max(delay, 1), this.options.maxRetryDelay) +\n- Math.round(Math.random() * this.options.retryJitter)\n+ delay +\n+ Math.round(\n+ Math.random() * (nextDelay - delay) +\n+ Math.random() * this.options.retryJitter\n)\n+ )\n+ }\n+ // deterministric delay otherwise\n+ let delay = Math.max(this.options.minRetryDelay, 1)\n+ for (let i = 1; i < failedAttempts; i++) {\n+ delay = delay * this.options.exponentialBase\n+ if (delay >= this.options.maxRetryDelay) {\n+ delay = this.options.maxRetryDelay\n+ break\n+ }\n+ }\n+ return delay + Math.round(Math.random() * this.options.retryJitter)\n} else if (this.currentDelay) {\nthis.currentDelay = Math.min(\nMath.max(this.currentDelay * this.options.exponentialBase, 1) +\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -24,14 +24,22 @@ export const DEFAULT_ConnectionOptions: Partial<ConnectionOptions> = {\n* Options that configure strategy for retrying failed requests.\n*/\nexport interface RetryDelayStrategyOptions {\n- /** include random milliseconds when retrying HTTP calls */\n+ /** add `random(retryJitter)` milliseconds when retrying HTTP calls */\nretryJitter: number\n/** minimum delay when retrying write (milliseconds) */\nminRetryDelay: number\n/** maximum delay when retrying write (milliseconds) */\nmaxRetryDelay: number\n- /** base for the exponential retry delay, the next delay is computed as `minRetryDelay * exponentialBase^(attempts-1) + random(retryJitter)` */\n+ /** base for the exponential retry delay */\nexponentialBase: number\n+ /**\n+ * Randomize indicates whether the next retry delay is deterministic (false) or random (true).\n+ * The deterministic delay starts with `minRetryDelay * exponentialBase` and it is multiplied\n+ * by `exponentialBase` until it exceeds `maxRetryDelay`.\n+ * When random is `true`, the next delay is computed as a random number between next retry attempt (upper)\n+ * and the lower number in the deterministic sequence. `random(retryJitter)` is added to every returned value.\n+ */\n+ randomize: boolean\n}\n/**\n@@ -89,6 +97,7 @@ export const DEFAULT_RetryDelayStrategyOptions = {\nminRetryDelay: 5000,\nmaxRetryDelay: 180000,\nexponentialBase: 5,\n+ randomize: false,\n}\n/** default writeOptions */\n@@ -105,6 +114,7 @@ export const DEFAULT_WriteOptions: WriteOptions = {\nmaxRetryDelay: 180000,\nexponentialBase: 5,\ngzipThreshold: 1000,\n+ randomize: false,\n}\n/**\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/retryStrategy.test.ts", "new_path": "packages/core/test/unit/impl/retryStrategy.test.ts", "diff": "@@ -17,12 +17,60 @@ describe('RetryStrategyImpl', () => {\n.property('options')\n.is.deep.equal(DEFAULT_RetryDelayStrategyOptions)\n})\n- it('generates exponential data from min to max for unknown delays', () => {\n+ it('generates the delays according to errors', () => {\n+ const subject = new RetryStrategyImpl({\n+ minRetryDelay: 100,\n+ maxRetryDelay: 1000,\n+ retryJitter: 0,\n+ })\n+ const values = [1, 2, 3, 4, 5, 6].reduce((acc, val) => {\n+ acc.push(subject.nextDelay(new HttpError(503, '', '', String(val))))\n+ return acc\n+ }, [] as number[])\n+ expect(values).to.be.deep.equal([1, 2, 3, 4, 5, 6])\n+ })\n+ it('generates jittered delays according to error delay', () => {\n+ const subject = new RetryStrategyImpl({\n+ minRetryDelay: 100,\n+ maxRetryDelay: 1000,\n+ retryJitter: 10,\n+ })\n+ const values = [1, 2, 3, 4, 5, 6].reduce((acc, val) => {\n+ acc.push(subject.nextDelay(new HttpError(503, '', '', String(val))))\n+ return acc\n+ }, [] as number[])\n+ expect(values).to.have.length(6)\n+ values.forEach((x, i) => {\n+ expect(x).to.not.be.lessThan(i + 1)\n+ expect(x).to.not.be.greaterThan(1000)\n+ })\n+ })\n+ it('generates default jittered delays', () => {\n+ const subject = new RetryStrategyImpl({\n+ minRetryDelay: 100,\n+ maxRetryDelay: 1000,\n+ retryJitter: 10,\n+ })\n+ const values = [1, 2, 3, 4, 5, 6].reduce((acc, _val) => {\n+ acc.push(subject.nextDelay())\n+ return acc\n+ }, [] as number[])\n+ expect(values).to.have.length(6)\n+ values.forEach((x, i) => {\n+ expect(x).to.not.be.lessThan(i)\n+ expect(x).to.not.be.greaterThan(1000)\n+ if (i > 0) {\n+ expect(x).to.not.be.lessThan(values[i - 1])\n+ }\n+ })\n+ })\n+ it('generates exponential data from min to max for state data', () => {\nconst subject = new RetryStrategyImpl({\nminRetryDelay: 100,\nmaxRetryDelay: 1000,\nretryJitter: 0,\nexponentialBase: 2,\n+ randomize: false,\n})\nconst values = [1, 2, 3, 4, 5, 6].reduce((acc, _val) => {\nacc.push(subject.nextDelay())\n@@ -32,12 +80,14 @@ describe('RetryStrategyImpl', () => {\nsubject.success()\nexpect(subject.nextDelay()).equals(100)\n})\n- it('generates exponential data from min to max for unknown delays', () => {\n+ describe('deterministic interval', () => {\n+ it('generates exponential data from min to max', () => {\nconst subject = new RetryStrategyImpl({\nminRetryDelay: 100,\nmaxRetryDelay: 2000,\nretryJitter: 20,\n// exponentialBase: 5, 5 by default\n+ randomize: false,\n})\nconst values = [1, 2, 3, 4, 5, 6].reduce((acc, _val, index) => {\nacc.push(subject.nextDelay(undefined, index + 1))\n@@ -55,39 +105,12 @@ describe('RetryStrategyImpl', () => {\nsubject.success()\nexpect(Math.trunc(subject.nextDelay() / 100) * 100).equals(100)\n})\n- it('generates the delays according to errors', () => {\n- const subject = new RetryStrategyImpl({\n- minRetryDelay: 100,\n- maxRetryDelay: 1000,\n- retryJitter: 0,\n- })\n- const values = [1, 2, 3, 4, 5, 6].reduce((acc, val) => {\n- acc.push(subject.nextDelay(new HttpError(503, '', '', String(val))))\n- return acc\n- }, [] as number[])\n- expect(values).to.be.deep.equal([1, 2, 3, 4, 5, 6])\n- })\n- it('generates jittered delays according to error delay', () => {\n- const subject = new RetryStrategyImpl({\n- minRetryDelay: 100,\n- maxRetryDelay: 1000,\n- retryJitter: 10,\n- })\n- const values = [1, 2, 3, 4, 5, 6].reduce((acc, val) => {\n- acc.push(subject.nextDelay(new HttpError(503, '', '', String(val))))\n- return acc\n- }, [] as number[])\n- expect(values).to.have.length(6)\n- values.forEach((x, i) => {\n- expect(x).to.not.be.lessThan(i + 1)\n- expect(x).to.not.be.greaterThan(1000)\n- })\n- })\nit('generates exponential delays with failedAttempts', () => {\nconst subject = new RetryStrategyImpl({\nminRetryDelay: 100,\nmaxRetryDelay: 1000,\nretryJitter: 10,\n+ randomize: false,\n})\nconst values = [1, 2, 3, 4, 5, 6].reduce((acc, val) => {\nacc.push(subject.nextDelay(new Error(), val))\n@@ -103,23 +126,39 @@ describe('RetryStrategyImpl', () => {\nexpect(x).to.not.be.greaterThan(1000 + 10)\n})\n})\n- it('generates default jittered delays', () => {\n+ })\n+ describe('random interval', () => {\n+ it('generates exponential data from randomized windows', () => {\nconst subject = new RetryStrategyImpl({\nminRetryDelay: 100,\nmaxRetryDelay: 1000,\n- retryJitter: 10,\n+ retryJitter: 100,\n+ exponentialBase: 2,\n+ randomize: true,\n})\n- const values = [1, 2, 3, 4, 5, 6].reduce((acc, _val) => {\n- acc.push(subject.nextDelay())\n+ const values = [1, 2, 3, 4, 5].reduce((acc, _val, index) => {\n+ acc.push(subject.nextDelay(undefined, index + 1))\nreturn acc\n}, [] as number[])\n- expect(values).to.have.length(6)\n- values.forEach((x, i) => {\n- expect(x).to.not.be.lessThan(i)\n- expect(x).to.not.be.greaterThan(1000)\n- if (i > 0) {\n- expect(x).to.not.be.lessThan(values[i - 1])\n+ const intervals = [\n+ [100, 200],\n+ [200, 400],\n+ [400, 800],\n+ [800, 1000],\n+ [800, 1000],\n+ ]\n+ for (let i = 0; i < values.length; i++) {\n+ expect(values[i]).is.gte(\n+ intervals[i][0],\n+ `${i} number ${values[i]} failed`\n+ )\n+ expect(values[i]).is.lte(\n+ intervals[i][1] + subject.options.retryJitter,\n+ `${i} number ${values[i]} failed`\n+ )\n}\n+ subject.success()\n+ expect(Math.trunc(subject.nextDelay() / 100) * 100).equals(100)\n})\n})\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): implement random retry strategy
305,159
01.07.2021 06:21:57
-7,200
d5d330873fe2b8c330b6d316c3be9d782298f147
feat(core): adjust defaults to a random retry strategy
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/retryStrategy.ts", "new_path": "packages/core/src/impl/retryStrategy.ts", "diff": "@@ -24,7 +24,7 @@ export class RetryStrategyImpl implements RetryDelayStrategy {\n} else {\nif (failedAttempts && failedAttempts > 0) {\n// compute delay\n- if (this.options.randomize) {\n+ if (this.options.randomRetry) {\n// random delay between deterministic delays\nlet delay = Math.max(this.options.minRetryDelay, 1)\nlet nextDelay = delay * this.options.exponentialBase\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -33,13 +33,13 @@ export interface RetryDelayStrategyOptions {\n/** base for the exponential retry delay */\nexponentialBase: number\n/**\n- * Randomize indicates whether the next retry delay is deterministic (false) or random (true).\n+ * randomRetry indicates whether the next retry delay is deterministic (false) or random (true).\n* The deterministic delay starts with `minRetryDelay * exponentialBase` and it is multiplied\n* by `exponentialBase` until it exceeds `maxRetryDelay`.\n* When random is `true`, the next delay is computed as a random number between next retry attempt (upper)\n* and the lower number in the deterministic sequence. `random(retryJitter)` is added to every returned value.\n*/\n- randomize: boolean\n+ randomRetry: boolean\n}\n/**\n@@ -97,7 +97,7 @@ export const DEFAULT_RetryDelayStrategyOptions = {\nminRetryDelay: 5000,\nmaxRetryDelay: 180000,\nexponentialBase: 5,\n- randomize: false,\n+ randomRetry: true,\n}\n/** default writeOptions */\n@@ -106,15 +106,15 @@ export const DEFAULT_WriteOptions: WriteOptions = {\nflushInterval: 60000,\nwriteFailed: function() {},\nwriteSuccess: function() {},\n- maxRetries: 3,\n+ maxRetries: 5,\nmaxBufferLines: 32_000,\n// a copy of DEFAULT_RetryDelayStrategyOptions, so that DEFAULT_WriteOptions could be tree-shaken\nretryJitter: 200,\nminRetryDelay: 5000,\n- maxRetryDelay: 180000,\n- exponentialBase: 5,\n+ maxRetryDelay: 125000,\n+ exponentialBase: 2,\ngzipThreshold: 1000,\n- randomize: false,\n+ randomRetry: true,\n}\n/**\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -302,6 +302,7 @@ describe('WriteApi', () => {\nuseSubject({\nflushInterval: 5,\nmaxRetries: 1,\n+ randomRetry: false,\nbatchSize: 10,\nwriteSuccess: writeCounters.writeSuccess,\n})\n@@ -369,6 +370,7 @@ describe('WriteApi', () => {\nuseSubject({\nflushInterval: 5,\nmaxRetries: 1,\n+ randomRetry: false,\nbatchSize: 10,\nwriteSuccess: writeCounters.writeSuccess,\ngzipThreshold: 0,\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/retryStrategy.test.ts", "new_path": "packages/core/test/unit/impl/retryStrategy.test.ts", "diff": "@@ -64,13 +64,12 @@ describe('RetryStrategyImpl', () => {\n}\n})\n})\n- it('generates exponential data from min to max for state data', () => {\n+ it('generates exponential data from min to max from state data', () => {\nconst subject = new RetryStrategyImpl({\nminRetryDelay: 100,\nmaxRetryDelay: 1000,\nretryJitter: 0,\nexponentialBase: 2,\n- randomize: false,\n})\nconst values = [1, 2, 3, 4, 5, 6].reduce((acc, _val) => {\nacc.push(subject.nextDelay())\n@@ -86,8 +85,8 @@ describe('RetryStrategyImpl', () => {\nminRetryDelay: 100,\nmaxRetryDelay: 2000,\nretryJitter: 20,\n- // exponentialBase: 5, 5 by default\n- randomize: false,\n+ exponentialBase: 5,\n+ randomRetry: false,\n})\nconst values = [1, 2, 3, 4, 5, 6].reduce((acc, _val, index) => {\nacc.push(subject.nextDelay(undefined, index + 1))\n@@ -110,7 +109,7 @@ describe('RetryStrategyImpl', () => {\nminRetryDelay: 100,\nmaxRetryDelay: 1000,\nretryJitter: 10,\n- randomize: false,\n+ randomRetry: false,\n})\nconst values = [1, 2, 3, 4, 5, 6].reduce((acc, val) => {\nacc.push(subject.nextDelay(new Error(), val))\n@@ -134,7 +133,7 @@ describe('RetryStrategyImpl', () => {\nmaxRetryDelay: 1000,\nretryJitter: 100,\nexponentialBase: 2,\n- randomize: true,\n+ randomRetry: true,\n})\nconst values = [1, 2, 3, 4, 5].reduce((acc, _val, index) => {\nacc.push(subject.nextDelay(undefined, index + 1))\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): adjust defaults to a random retry strategy
305,159
01.07.2021 08:07:23
-7,200
6dc43c51c314653d1befb2f8de58e794e0f23377
feat(core): add maxRetryTime
[ { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -71,6 +71,8 @@ export interface WriteRetryOptions extends RetryDelayStrategyOptions {\n/** max number of retries when write fails */\nmaxRetries: number\n+ /** max time (millis) that can be spent with retries */\n+ maxRetryTime: number\n/** the maximum size of retry-buffer (in lines) */\nmaxBufferLines: number\n}\n@@ -95,7 +97,7 @@ export interface WriteOptions extends WriteRetryOptions {\nexport const DEFAULT_RetryDelayStrategyOptions = {\nretryJitter: 200,\nminRetryDelay: 5000,\n- maxRetryDelay: 180000,\n+ maxRetryDelay: 125000,\nexponentialBase: 5,\nrandomRetry: true,\n}\n@@ -107,6 +109,7 @@ export const DEFAULT_WriteOptions: WriteOptions = {\nwriteFailed: function() {},\nwriteSuccess: function() {},\nmaxRetries: 5,\n+ maxRetryTime: 180_000,\nmaxBufferLines: 32_000,\n// a copy of DEFAULT_RetryDelayStrategyOptions, so that DEFAULT_WriteOptions could be tree-shaken\nretryJitter: 200,\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): add maxRetryTime