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
09.06.2020 14:56:23
-7,200
b153fd1097ecae7563b274eb7103a84d8cacc01a
feat(core/query): add collectRows and collectLines to query API
[ { "change_type": "MODIFY", "old_path": "examples/query.ts", "new_path": "examples/query.ts", "diff": "// Shows how to use InfluxDB query API. //\n//////////////////////////////////////////\n-import {InfluxDB, FluxTableMetaData} from '@influxdata/influxdb-client'\n+import {InfluxDB, FluxTableMetaData} from '../packages/core'\nimport {url, token, org} from './env'\nconst queryApi = new InfluxDB({url, token}).getQueryApi(org)\n@@ -30,6 +30,19 @@ queryApi.queryRows(fluxQuery, {\n},\n})\n+// // executes query and wait for all results 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+// .then(data => {\n+// data.forEach(x => console.log(JSON.stringify(x)))\n+// console.log('\\nCollect ROWS SUCCESS')\n+// })\n+// .catch(error => {\n+// console.error(error)\n+// console.log('\\nCollect ROWS ERROR')\n+// })\n+\n// performs query and receive line results in annotated csv format\n// https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/\n// queryApi.queryLines(\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/QueryApi.ts", "new_path": "packages/core/src/QueryApi.ts", "diff": "@@ -6,6 +6,13 @@ import {\n} from './query'\nimport {CommunicationObserver} from './transport'\n+export function defaultRowMapping(\n+ values: string[],\n+ tableMeta: FluxTableMetaData\n+): Record<string, any> {\n+ return tableMeta.toObject(values)\n+}\n+\nexport interface QueryOptions {\n/**\n* Specifies the name of the organization executing the query. Takes either the ID or Name interchangeably.\n@@ -47,14 +54,14 @@ export default interface QueryApi {\n/**\n* Creates a cold observable of the lines returned by the given query.\n*\n- * @param query the query text in the format specifed in `QueryOptions.type`\n+ * @param query query\n*/\nlines(query: string | ParameterizedQuery): Observable<string>\n/**\n* Creates a cold observable of the rows returned by the given query.\n*\n- * @param query the query text in the format specifed in `QueryOptions.type`\n+ * @param query query\n*/\nrows(query: string | ParameterizedQuery): Observable<Row>\n@@ -62,7 +69,7 @@ export default interface QueryApi {\n* Executes the query and receives result lines (including empty and annotation lines)\n* through the supplied consumer. See [annotated-csv](https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/).\n*\n- * @param record single line in the query result\n+ * @param query query\n* @param consumer data/error consumer\n*/\nqueryLines(\n@@ -73,11 +80,38 @@ export default interface QueryApi {\n/**\n* Executes the query and receives table metadata and rows through the supplied consumer.\n*\n- * @param record single line in the query result\n+ * @param query query\n* @param consumer data/error consumer\n*/\nqueryRows(\nquery: string | ParameterizedQuery,\nconsumer: FluxResultObserver<string[]>\n): void\n+\n+ /**\n+ * CollectRows executes the query and collects all the results in the returned Promise.\n+ * This method is suitable to collect simple results. Use with caution,\n+ * a possibly huge stream of results is copied to memory.\n+ *\n+ * @param query query\n+ * @param rowMapper maps the supplied row to an item that is then collected,\n+ * undefined return values are not collected. If no rowMapper is supplied,\n+ * `row => row.tableMeta.toObject(row.values)` is used.\n+ */\n+ collectRows<T>(\n+ query: string | ParameterizedQuery,\n+ rowMapper?: (\n+ values: string[],\n+ tableMeta: FluxTableMetaData\n+ ) => T | undefined\n+ ): Promise<Array<T>>\n+\n+ /**\n+ * CollectLines executes the query and collects all result lines in the returned Promise.\n+ * This method is suitable to collect simple results. Use with caution,\n+ * a possibly huge stream of lines is copied to memory.\n+ *\n+ * @param query query\n+ */\n+ collectLines(query: string | ParameterizedQuery): Promise<Array<string>>\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/QueryApiImpl.ts", "new_path": "packages/core/src/impl/QueryApiImpl.ts", "diff": "import {Observable} from '../observable'\nimport FluxResultObserver from '../query/FluxResultObserver'\n-import QueryApi, {QueryOptions, Row} from '../QueryApi'\n+import QueryApi, {QueryOptions, Row, defaultRowMapping} from '../QueryApi'\nimport {CommunicationObserver, Transport} from '../transport'\nimport ChunksToLines from './ChunksToLines'\nimport {toLineObserver} from './linesToTables'\nimport ObservableQuery, {QueryExecutor} from './ObservableQuery'\nimport {ParameterizedQuery} from '../query/flux'\n+import {FluxTableMetaData} from '../query'\nconst DEFAULT_dialect: any = {\nheader: true,\n@@ -61,6 +62,52 @@ export class QueryApiImpl implements QueryApi {\nthis.createExecutor(query)(toLineObserver(consumer))\n}\n+ collectRows<T>(\n+ query: string | ParameterizedQuery,\n+ rowMapper: (\n+ values: string[],\n+ tableMeta: FluxTableMetaData\n+ ) => T | undefined = defaultRowMapping as (\n+ values: string[],\n+ tableMeta: FluxTableMetaData\n+ ) => T | undefined\n+ ): Promise<Array<T>> {\n+ const retVal: Array<T> = []\n+ return new Promise((resolve, reject) => {\n+ this.queryRows(query, {\n+ next(values: string[], tableMeta: FluxTableMetaData): void {\n+ const toAdd = rowMapper.call(this, values, tableMeta)\n+ if (toAdd !== undefined) {\n+ retVal.push(toAdd)\n+ }\n+ },\n+ error(error: Error): void {\n+ reject(error)\n+ },\n+ complete(): void {\n+ resolve(retVal)\n+ },\n+ })\n+ })\n+ }\n+\n+ collectLines(query: string | ParameterizedQuery): Promise<Array<string>> {\n+ const retVal: Array<string> = []\n+ return new Promise((resolve, reject) => {\n+ this.queryLines(query, {\n+ next(line: string): void {\n+ retVal.push(line)\n+ },\n+ error(error: Error): void {\n+ reject(error)\n+ },\n+ complete(): void {\n+ resolve(retVal)\n+ },\n+ })\n+ })\n+ }\n+\nprivate createExecutor(query: string | ParameterizedQuery): QueryExecutor {\nconst {org, type, gzip} = this.options\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/QueryApi.test.ts", "new_path": "packages/core/test/unit/QueryApi.test.ts", "diff": "@@ -113,7 +113,7 @@ describe('QueryApi', () => {\n)\nexpect(values).to.deep.equal(['55', '55', '55'])\n})\n- it('https://github.com/influxdata/influxdb-client-js/issues/179', async () => {\n+ it('processes quoted lines properly influxdata/influxdb-client-js#179', async () => {\nconst subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\nnock(clientOptions.url)\n.post(QUERY_PATH)\n@@ -209,4 +209,99 @@ describe('QueryApi', () => {\nexpect(body?.now).to.deep.equal(pair.now)\n}\n})\n+ it('collectLines collects raw lines', async () => {\n+ const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n+ nock(clientOptions.url)\n+ .post(QUERY_PATH)\n+ .reply((_uri, _requestBody) => {\n+ return [\n+ 200,\n+ fs.createReadStream('test/fixture/query/simpleResponse.txt'),\n+ {'retry-after': '1'},\n+ ]\n+ })\n+ .persist()\n+ const data = await subject.collectLines(\n+ 'from(bucket:\"my-bucket\") |> range(start: 0)'\n+ )\n+ expect(data).to.deep.equal(simpleResponseLines)\n+ })\n+ it('collectLines fails on server error', async () => {\n+ const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n+ nock(clientOptions.url)\n+ .post(QUERY_PATH)\n+ .reply((_uri, _requestBody) => {\n+ return [\n+ 500,\n+ fs.createReadStream('test/fixture/query/simpleResponse.txt'),\n+ {'retry-after': '1'},\n+ ]\n+ })\n+ .persist()\n+ try {\n+ await subject.collectLines('from(bucket:\"my-bucket\") |> range(start: 0)')\n+ expect.fail('client error expected on server error')\n+ } catch (e) {\n+ // OK error is expected\n+ }\n+ })\n+ it('collectRows collects rows', async () => {\n+ const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n+ nock(clientOptions.url)\n+ .post(QUERY_PATH)\n+ .reply((_uri, _requestBody) => {\n+ return [\n+ 200,\n+ fs.createReadStream('test/fixture/query/simpleResponse.txt'),\n+ {'retry-after': '1'},\n+ ]\n+ })\n+ .persist()\n+ const data = await subject.collectRows(\n+ 'from(bucket:\"my-bucket\") |> range(start: 0)'\n+ )\n+ expect(data.length).equals(5)\n+ expect(data).to.be.an('array')\n+ expect(data[1]).to.be.an('object')\n+ })\n+ it('collectRows can collect every second row as string', async () => {\n+ const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n+ nock(clientOptions.url)\n+ .post(QUERY_PATH)\n+ .reply((_uri, _requestBody) => {\n+ return [\n+ 200,\n+ fs.createReadStream('test/fixture/query/simpleResponse.txt'),\n+ {'retry-after': '1'},\n+ ]\n+ })\n+ .persist()\n+ let i = 0\n+ const data = await subject.collectRows(\n+ 'from(bucket:\"my-bucket\") |> range(start: 0)',\n+ () => (i++ % 2 === 1 ? undefined : String(i))\n+ )\n+ expect(data.length).equals(3)\n+ expect(data).to.be.an('array')\n+ expect(data[2]).equals('5')\n+ })\n+ it('collectRows fails on server error', async () => {\n+ const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n+ nock(clientOptions.url)\n+ .post(QUERY_PATH)\n+ .reply((_uri, _requestBody) => {\n+ return [\n+ 500,\n+ fs.createReadStream('test/fixture/query/simpleResponse.txt'),\n+ {'retry-after': '1'},\n+ ]\n+ })\n+ .persist()\n+ try {\n+ await subject.collectRows('from(bucket:\"my-bucket\") |> range(start: 0)')\n+ expect.fail('client error expected on server error')\n+ } catch (e) {\n+ // OK error is expected\n+ }\n+ })\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core/query): add collectRows and collectLines to query API
305,159
09.06.2020 17:02:38
-7,200
54705918c59f7d7f108feceae4e02fd7bfbd9399
feat(core/write): allow to supply listener for write failures
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -131,6 +131,18 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nreturn new Promise<void>((resolve, reject) => {\nthis.transport.send(this.httpPath, lines.join('\\n'), this.sendOptions, {\nerror(error: Error): void {\n+ // call the writeFailed listener and check if we can retry\n+ if (\n+ self.writeOptions.writeFailed.call(\n+ self,\n+ error,\n+ lines,\n+ self.writeOptions.maxRetries + 2 - attempts\n+ ) === true\n+ ) {\n+ resolve()\n+ return\n+ }\nif (\n!self.closed &&\nattempts > 1 &&\n@@ -148,6 +160,7 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nself.retryStrategy.nextDelay(error)\n)\nreject(error)\n+ return\n} else {\nLogger.error(`Write to influx DB failed.`, error)\nreject(error)\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "import {Transport} from './transport'\n+import WriteApi from './WriteApi'\n/**\n* Option for the communication with InfluxDB server.\n@@ -35,6 +36,20 @@ export interface RetryDelayStrategyOptions {\n* Options that configure strategy for retrying failed InfluxDB write operations.\n*/\nexport interface WriteRetryOptions extends RetryDelayStrategyOptions {\n+ /*\n+ * writeFailed is called to inform about write error\n+ * @param this the instance of the API that failed\n+ * @param error write error\n+ * @param lines failed lines\n+ * @param attempts a number of failed attempts to write the lines\n+ * @return `true` forces the API to not retry again\n+ */\n+ writeFailed(\n+ this: WriteApi,\n+ error: Error,\n+ lines: Array<string>,\n+ attempts: number\n+ ): boolean | void\n/** max number of retries when write fails */\nmaxRetries: number\n/** the maximum size of retry-buffer (in lines) */\n@@ -62,6 +77,7 @@ export const DEFAULT_RetryDelayStrategyOptions = Object.freeze({\nexport const DEFAULT_WriteOptions: WriteOptions = Object.freeze({\nbatchSize: 1000,\nflushInterval: 60000,\n+ writeFailed: function() {},\nmaxRetries: 2,\nmaxBufferLines: 32_000,\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": "@@ -9,6 +9,7 @@ import {\nInfluxDB,\n} from '../../src'\nimport {collectLogging, CollectedLogs} from '../util'\n+import Logger from '../../src/impl/Logger'\nconst clientOptions: ClientOptions = {\nurl: 'http://fake:9999',\n@@ -124,6 +125,26 @@ describe('WriteApi', () => {\nexpect(logs.warn).is.deep.equal([])\n})\n})\n+ it('does not retry write when writeFailed handler returns true', async () => {\n+ useSubject({\n+ maxRetries: 3,\n+ batchSize: 1,\n+ writeFailed: (error: Error, lines: string[], attempts: number) => {\n+ Logger.warn(\n+ `CUSTOMERRORHANDLING ${!!error} ${lines.length} ${attempts}`,\n+ undefined\n+ )\n+ return true\n+ },\n+ })\n+ subject.writeRecord('test value=1')\n+ await subject.close().then(() => {\n+ expect(logs.error).length(0)\n+ expect(logs.warn).is.deep.equal([\n+ ['CUSTOMERRORHANDLING true 1 1', undefined],\n+ ])\n+ })\n+ })\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" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core/write): allow to supply listener for write failures
305,159
10.06.2020 17:18:59
-7,200
900e22676bd8011114892be026332a5f6907e237
feat(core/write): allow the write failure listener to return the result of the flush operation
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -132,15 +132,14 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nthis.transport.send(this.httpPath, lines.join('\\n'), this.sendOptions, {\nerror(error: Error): void {\n// call the writeFailed listener and check if we can retry\n- if (\n- self.writeOptions.writeFailed.call(\n+ const onRetry = self.writeOptions.writeFailed.call(\nself,\nerror,\nlines,\nself.writeOptions.maxRetries + 2 - attempts\n- ) === true\n- ) {\n- resolve()\n+ )\n+ if (onRetry) {\n+ onRetry.then(resolve, reject)\nreturn\n}\nif (\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -42,14 +42,15 @@ export interface WriteRetryOptions extends RetryDelayStrategyOptions {\n* @param error write error\n* @param lines failed lines\n* @param attempts a number of failed attempts to write the lines\n- * @return `true` forces the API to not retry again\n+ * @return a Promise to force the API to not retry again and use the promise as a result of the flush operation,\n+ * void/undefined to continue with default retry mechanism\n*/\nwriteFailed(\nthis: WriteApi,\nerror: Error,\nlines: Array<string>,\nattempts: number\n- ): boolean | void\n+ ): Promise<void> | void\n/** max number of retries when write fails */\nmaxRetries: number\n/** the maximum size of retry-buffer (in lines) */\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -125,7 +125,7 @@ describe('WriteApi', () => {\nexpect(logs.warn).is.deep.equal([])\n})\n})\n- it('does not retry write when writeFailed handler returns true', async () => {\n+ it('does not retry write when writeFailed handler returns a Promise', async () => {\nuseSubject({\nmaxRetries: 3,\nbatchSize: 1,\n@@ -134,7 +134,7 @@ describe('WriteApi', () => {\n`CUSTOMERRORHANDLING ${!!error} ${lines.length} ${attempts}`,\nundefined\n)\n- return true\n+ return Promise.resolve()\n},\n})\nsubject.writeRecord('test value=1')\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core/write): allow the write failure listener to return the result of the flush operation
305,159
10.06.2020 19:15:34
-7,200
ec915b7aa5d7bc3a7d29ac2a5f51a7ca4b5a2a8f
chore: avoid branching
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -160,10 +160,9 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\n)\nreject(error)\nreturn\n- } else {\n+ }\nLogger.error(`Write to influx DB failed.`, error)\nreject(error)\n- }\n},\ncomplete(): void {\nself.retryStrategy.success()\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: avoid branching
305,159
11.06.2020 14:50:52
-7,200
e261b8ee44cc832a4644f3858f5413cc63a71711
chore: improve CI tests
[ { "change_type": "MODIFY", "old_path": ".circleci/config.yml", "new_path": ".circleci/config.yml", "diff": "@@ -34,6 +34,7 @@ jobs:\nyarn lint:ci\nyarn build\ncd ../apis\n+ yarn test\nyarn build\n# Upload results\n- store_test_results:\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 test:all --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml\",\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:watch\": \"mocha --require ts-node/register 'test/unit/**/*.test.ts' --watch-extensions ts --watch\",\n\"typecheck\": \"tsc --noEmit --pretty\",\n\"typedoc\": \"typedoc --excludePrivate --excludeNotExported --mode file --out ./reports/apidoc --module es2015 --tsconfig ./tsconfig.json ./src\",\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve CI tests
305,159
11.06.2020 15:16:29
-7,200
219786c23c177a640aff8c60ab9b693218c36fdc
chore: improve README in the core package to include support of InfluxDB 1.8+
[ { "change_type": "MODIFY", "old_path": "packages/core/README.md", "new_path": "packages/core/README.md", "diff": "The reference javascript client for InfluxDB 2.0. Both node and browser environments are supported.\nSee https://github.com/influxdata/influxdb-client-js to know more.\n-**Note: This library is for use with InfluxDB 2.x. For connecting to InfluxDB 1.x instances, see [node-influx](https://github.com/node-influx/node-influx).**\n+**Note: This library is for use with InfluxDB 2.x or 1.8+. For connecting to InfluxDB 1.x instances, see [node-influx](https://github.com/node-influx/node-influx).**\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve README in the core package to include support of InfluxDB 1.8+
305,159
21.06.2020 20:40:36
-7,200
2f5103669c6bf8ac5d510f94a4e8752421146e02
feat(write): allow to supply default tags in write configuration
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -87,6 +87,9 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\n}\nthis.currentTime = currentTime[precision]\nthis.dateToProtocolTimestamp = dateToProtocolTimestamp[precision]\n+ if (this.writeOptions.defaultTags) {\n+ this.useDefaultTags(this.writeOptions.defaultTags)\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": "@@ -65,6 +65,8 @@ export interface WriteOptions extends WriteRetryOptions {\nbatchSize: number\n/** delay between data flushes in milliseconds, at most `batch size` records are sent during flush */\nflushInterval: number\n+ /** default tags, unescaped */\n+ defaultTags?: Record<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": "@@ -191,9 +191,9 @@ describe('WriteApi', () => {\nfunction useSubject(writeOptions: Partial<WriteOptions>): void {\nsubject = createApi(ORG, BUCKET, WritePrecision.ns, {\nretryJitter: 0,\n-\n+ defaultTags: {xtra: '1'},\n...writeOptions,\n- }).useDefaultTags({xtra: '1'})\n+ })\n}\nbeforeEach(() => {\n// logs = collectLogging.decorate()\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(write): allow to supply default tags in write configuration
305,159
27.06.2020 07:06:54
-7,200
09d3d440a9663562e10737f8a427bf9c349dbeab
chore: update write example with precision docs
[ { "change_type": "MODIFY", "old_path": "examples/write.js", "new_path": "examples/write.js", "diff": "@@ -8,6 +8,7 @@ const {url, token, org, bucket} = require('./env')\nconst {hostname} = require('os')\nconsole.log('*** WRITE POINTS ***')\n+// create a write API, expecting point timestamps in nanoseconds (can be also 's', 'ms', 'us')\nconst writeApi = new InfluxDB({url, token}).getWriteApi(org, bucket, 'ns')\n// setup default tags for all writes through this API\nwriteApi.useDefaultTags({location: hostname()})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: update write example with precision docs
305,160
29.06.2020 10:44:42
-7,200
6673bad377d9064154aea131766b2f19889a720d
fix: serialization of `\n`, `\r` and `\t` to Line Protocol
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "1. [#207](https://github.com/influxdata/influxdb-client-js/pull/207): Explain the significance of the precision argument in write example.\n+### Bug Fixes\n+\n+1. [#205](https://github.com/influxdata/influxdb-client-js/pull/205): Fixed serialization of `\\n`, `\\r` and `\\t` to Line Protocol\n+\n## 1.4.0 [2020-06-19]\n### Features\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/util/escape.ts", "new_path": "packages/core/src/util/escape.ts", "diff": "@@ -35,8 +35,13 @@ const escapeChar = '\\\\'\nclass Escaper {\nprivate _re: RegExp\n- constructor(chars: string[], private wrap: string = '') {\n- const patterns = chars.join('').replace(reEscape, '\\\\$&')\n+ constructor(\n+ private config: {[p: string]: EscaperConfig},\n+ private wrap: string = ''\n+ ) {\n+ const patterns = Object.keys(config)\n+ .join('|')\n+ .replace(reEscape, '\\\\$&')\nthis._re = new RegExp('[' + patterns + ']', 'g')\n}\n@@ -51,7 +56,11 @@ class Escaper {\nlet match = this._re.exec(val)\nwhile (match) {\n- escapedVal += val.slice(chunkIndex, match.index) + escapeChar + match[0]\n+ const matched = match[0]\n+ const toEscape = this.config[matched].escapeChar\n+ const toReplace = this.config[matched].replaceChar\n+ escapedVal += val.slice(chunkIndex, match.index)\n+ escapedVal += toReplace != undefined ? toReplace : toEscape + matched\nchunkIndex = this._re.lastIndex\nmatch = this._re.exec(val)\n}\n@@ -68,21 +77,58 @@ class Escaper {\n}\n}\n+class EscaperConfig {\n+ escapeChar?: string\n+ replaceChar?: string\n+\n+ constructor(escapeChar?: string, replaceChar?: string) {\n+ this.escapeChar = escapeChar\n+ this.replaceChar = replaceChar\n+ }\n+}\n+\n+const escaperConfig = new EscaperConfig(escapeChar)\n+\nconst bindEsc = (e: Escaper): ((val: string) => string) => e.escape.bind(e)\nexport const escape = {\n/**\n* Measurement escapes measurement names.\n*/\n- measurement: bindEsc(new Escaper([',', ' '])),\n+ measurement: bindEsc(\n+ new Escaper({\n+ ',': escaperConfig,\n+ ' ': escaperConfig,\n+ '\\n': new EscaperConfig(undefined, '\\\\n'),\n+ '\\r': new EscaperConfig(undefined, '\\\\r'),\n+ '\\t': new EscaperConfig(undefined, '\\\\t'),\n+ })\n+ ),\n/**\n* Quoted escapes quoted values, such as database names.\n*/\n- quoted: bindEsc(new Escaper(['\"', '\\\\\\\\'], '\"')),\n+ quoted: bindEsc(\n+ new Escaper(\n+ {\n+ '\"': escaperConfig,\n+ '\\\\\\\\': escaperConfig,\n+ },\n+ '\"'\n+ )\n+ ),\n/**\n* TagEscaper escapes tag keys, tag values, and field keys.\n*/\n- tag: bindEsc(new Escaper([',', '=', ' '])),\n+ tag: bindEsc(\n+ new Escaper({\n+ ',': escaperConfig,\n+ '=': escaperConfig,\n+ ' ': escaperConfig,\n+ '\\n': new EscaperConfig(undefined, '\\\\n'),\n+ '\\r': new EscaperConfig(undefined, '\\\\r'),\n+ '\\t': new EscaperConfig(undefined, '\\\\t'),\n+ })\n+ ),\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/fixture/escapeTables.json", "new_path": "packages/core/test/fixture/escapeTables.json", "diff": "[\"a=b\", \"a\\\\=b\"],\n[\"a b\", \"a\\\\ b\"],\n[\"a b=c\", \"a\\\\ b\\\\=c\"],\n- [\"'a' \\\\b=c\\\\,\\\\\\\\\\\"d\\\"\", \"'a'\\\\ \\\\b\\\\=c\\\\\\\\,\\\\\\\\\\\"d\\\"\"]\n+ [\"'a' \\\\b=c\\\\,\\\\\\\\\\\"d\\\"\", \"'a'\\\\ \\\\b\\\\=c\\\\\\\\,\\\\\\\\\\\"d\\\"\"],\n+ [\"new\\nline\", \"new\\\\nline\"],\n+ [\"carriage\\rreturn\", \"carriage\\\\rreturn\"],\n+ [\"t\\tab\", \"t\\\\tab\"]\n],\n\"measurement\": [\n[\"ab\", \"ab\"],\n[\"a,\", \"a\\\\,\"],\n[\"a,b\", \"a\\\\,b\"],\n[\"a b\", \"a\\\\ b\"],\n- [\"a b,c\", \"a\\\\ b\\\\,c\"]\n+ [\"a b,c\", \"a\\\\ b\\\\,c\"],\n+ [\"new\\nline\", \"new\\\\nline\"],\n+ [\"carriage\\rreturn\", \"carriage\\\\rreturn\"],\n+ [\"t\\tab\", \"t\\\\tab\"],\n+ [\"equ=al\", \"equ=al\"]\n],\n\"quoted\": [\n[\"ab\", \"\\\"ab\\\"\"],\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix: serialization of `\n`, `\r` and `\t` to Line Protocol (#205)
305,159
30.06.2020 12:35:58
-7,200
8b027e22d562d8fc6a9fea093ae4fdf2a1a4539c
fix(core/transport): fall back to 1.8 X-Influxdb-Error HTTP header value when no error body is available
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -124,6 +124,12 @@ export default class FetchTransport implements Transport {\nLogger.warn('Unable to read error body', _e)\n}\nif (status >= 300) {\n+ if (!data) {\n+ const headerError = headers.get('x-influxdb-error')\n+ if (headerError) {\n+ data = headerError\n+ }\n+ }\nthrow new HttpError(\nstatus,\nresponse.statusText,\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -214,7 +214,10 @@ export class NodeHttpTransport implements Transport {\nres.resume()\n}\n})\n- responseData.on('end', () =>\n+ responseData.on('end', () => {\n+ if (body === '' && !!res.headers['x-influxdb-error']) {\n+ body = res.headers['x-influxdb-error'].toString()\n+ }\nlisteners.error(\nnew HttpError(\nstatusCode,\n@@ -223,7 +226,7 @@ export class NodeHttpTransport implements Transport {\nres.headers['retry-after']\n)\n)\n- )\n+ })\n} else {\nresponseData.on('data', data => {\nif (cancellable.isCancelled()) {\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": "@@ -97,6 +97,44 @@ describe('FetchTransport', () => {\n// console.log(` OK, received ${_e}`)\n}\n})\n+ it('throws error with X-Influxdb-Error header body', async () => {\n+ const message = 'this is a header message'\n+ emulateFetchApi({\n+ headers: {\n+ 'content-type': 'application/json',\n+ 'x-influxdb-error': message,\n+ },\n+ body: '',\n+ status: 500,\n+ })\n+ try {\n+ await transport.request('/whatever', '', {\n+ method: 'GET',\n+ })\n+ expect.fail()\n+ } catch (e) {\n+ expect(e)\n+ .property('body')\n+ .equals(message)\n+ }\n+ })\n+ it('throws error with empty body', async () => {\n+ emulateFetchApi({\n+ headers: {'content-type': 'text/plain'},\n+ body: '',\n+ status: 500,\n+ })\n+ try {\n+ await transport.request('/whatever', '', {\n+ method: 'GET',\n+ })\n+ expect.fail()\n+ } catch (e) {\n+ expect(e)\n+ .property('body')\n+ .equals('')\n+ }\n+ })\n})\ndescribe('send', () => {\nconst transport = new FetchTransport({url: 'http://test:9999'})\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": "@@ -28,8 +28,10 @@ function createResponse({\n},\njson(): Promise<any> {\nif (typeof body === 'string') {\n- if (body == 'error') return Promise.reject(new Error('error data'))\n- return Promise.resolve(JSON.parse(body))\n+ if (body === 'error') return Promise.reject(new Error('error data'))\n+ return Promise.resolve(body).then(body =>\n+ body ? JSON.parse(body) : ''\n+ )\n} else {\nreturn Promise.reject(new Error('String body expected, but ' + body))\n}\n@@ -38,7 +40,7 @@ function createResponse({\nif (typeof body === 'string') {\nretVal.text = function(): Promise<string> {\nif (typeof body === 'string') {\n- if (body == 'error') return Promise.reject(new Error('error data'))\n+ if (body === 'error') return Promise.reject(new Error('error data'))\nreturn Promise.resolve(body)\n} else {\nreturn Promise.reject(new Error('String body expected, but ' + body))\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": "@@ -300,6 +300,21 @@ describe('NodeHttpTransport', () => {\n.to.length(1000)\n})\n})\n+ it(`uses X-Influxdb-Error header when no body is returned`, async () => {\n+ const errorMessage = 'this is a header error message'\n+ nock(transportOptions.url)\n+ .get('/test')\n+ .reply(500, '', {'X-Influxdb-Error': errorMessage})\n+ await sendTestData(transportOptions, {method: 'GET'})\n+ .then(() => {\n+ throw new Error('must not succeed')\n+ })\n+ .catch((e: any) => {\n+ expect(e)\n+ .property('body')\n+ .equals(errorMessage)\n+ })\n+ })\nit(`is aborted before the whole response arrives`, async () => {\nlet remainingChunks = 2\nlet res: any\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core/transport): fall back to 1.8 X-Influxdb-Error HTTP header value when no error body is available
305,159
30.06.2020 12:56:00
-7,200
b2271cf93af50d0def37ad8d963053c8937acd09
fix(core/transport): fall back to 1.8 X-Influxdb-Error HTTP header value also in fetch transport
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -67,6 +67,12 @@ export default class FetchTransport implements Transport {\nreturn response\n.text()\n.then((text: string) => {\n+ if (!text) {\n+ const headerError = response.headers.get('x-influxdb-error')\n+ if (headerError) {\n+ text = headerError\n+ }\n+ }\nobserver.error(\nnew HttpError(\nresponse.status,\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": "@@ -179,10 +179,38 @@ describe('FetchTransport', () => {\ncallbacks: fakeCallbacks(),\nstatus: 501,\n},\n- ].forEach(({body, callbacks, url = '/whatever', status = 200}, i) => {\n+ {\n+ body: '',\n+ callbacks: fakeCallbacks(),\n+ status: 500,\n+ headers: {'x-influxdb-error': 'header error'},\n+ errorBody: 'header error',\n+ },\n+ {\n+ body: '',\n+ callbacks: fakeCallbacks(),\n+ status: 500,\n+ errorBody: '',\n+ },\n+ ].forEach(\n+ (\n+ {\n+ body,\n+ callbacks,\n+ url = '/whatever',\n+ status = 200,\n+ headers = {},\n+ errorBody,\n+ },\n+ i\n+ ) => {\nit(`receives data in chunks ${i}`, async () => {\nemulateFetchApi({\n- headers: {'content-type': 'text/plain', duplicate: 'ok'},\n+ headers: {\n+ 'content-type': 'text/plain',\n+ duplicate: 'ok',\n+ ...headers,\n+ },\nstatus,\nbody,\n})\n@@ -229,11 +257,16 @@ describe('FetchTransport', () => {\n? body\n: [Buffer.isBuffer(body) ? body : Buffer.from(body)]\n).is.deep.equal(vals)\n+ } else if (errorBody) {\n+ expect(callbacks.error.args[0][0])\n+ .property('body')\n+ .equals(errorBody)\n}\n} else {\ntransport.send('/whatever', '', {method: 'POST'}, callbacks)\n}\n})\n- })\n+ }\n+ )\n})\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core/transport): fall back to 1.8 X-Influxdb-Error HTTP header value also in fetch transport
305,159
17.07.2020 16:56:56
-7,200
0008ee0a2ae02212a8fb86ec4b90a28aa9aa019d
chore(docs): repair main typedoc script
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"test\": \"cd packages/core && yarn test && cd ../apis && yarn test\",\n\"coverage\": \"cd packages/core && yarn coverage\",\n\"coverage:send\": \"cd packages/core && yarn coverage:send\",\n- \"typedoc\": \"cd packages/core && yarn typedoc && cd ../apis && yarn typedoc\"\n+ \"typedoc\": \"cd packages/core && yarn build && yarn typedoc && cd ../apis && yarn typedoc\"\n},\n\"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n\"repository\": {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(docs): repair main typedoc script
305,159
21.07.2020 13:42:56
-7,200
60fa53c2e189ef76a5122843fd9f7a65b20caf6e
feat(examples): add createBucket.js example
[ { "change_type": "MODIFY", "old_path": "examples/.eslintrc.json", "new_path": "examples/.eslintrc.json", "diff": "\"rules\": {\n\"no-console\": \"off\",\n\"@typescript-eslint/no-var-requires\": \"off\"\n+ },\n+ \"overrides\": [\n+ {\n+ \"files\": [\"*.js\"],\n+ \"rules\": {\n+ \"@typescript-eslint/explicit-function-return-type\": \"off\"\n+ }\n}\n+ ]\n}\n" }, { "change_type": "MODIFY", "old_path": "examples/README.md", "new_path": "examples/README.md", "diff": "@@ -16,6 +16,8 @@ This directory contains javascript and typescript examples for node.js and brows\nSupply parameters to a [Flux](https://v2.docs.influxdata.com/v2.0/query-data/get-started/) query.\n- [health.js](./health.js)\nCheck health of InfluxDB server.\n+ - [createBucket.js](./createBucket.js)\n+ Creates an example bucket.\n- [onboarding.js](./onboarding.js)\nPerforms onboarding of a new influxDB database. It creates a new organization, bucket and user that is then used in all examples.\n- [influxdb-1.8.ts](./influxdb-1.8.ts)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "examples/createBucket.js", "diff": "+#!/usr/bin/env node\n+/*\n+This example creates a new bucket or a supplied name. If a bucket of a supplied name already exists,\n+it is deleted and then created again.\n+*/\n+\n+const {InfluxDB, HttpError} = require('@influxdata/influxdb-client')\n+const {OrgsAPI, BucketsAPI} = require('@influxdata/influxdb-client-apis')\n+const {url, org, token} = require('./env')\n+const influxDB = new InfluxDB({url, token})\n+\n+async function recreateBucket(name) {\n+ console.log('*** Get organization by name ***')\n+ const orgsAPI = new OrgsAPI(influxDB)\n+ const organizations = await orgsAPI.getOrgs({org})\n+ if (!organizations || !organizations.orgs || !organizations.orgs.length) {\n+ console.error(`No organization named \"${org}\" found!`)\n+ }\n+ const orgID = organizations.orgs[0].id\n+ console.log(`Using organization \"${org}\" identified by \"${orgID}\"`)\n+\n+ console.log('*** Get buckets by name ***')\n+ const bucketsAPI = new BucketsAPI(influxDB)\n+ try {\n+ const buckets = await bucketsAPI.getBuckets({orgID, name})\n+ if (buckets && buckets.buckets && buckets.buckets.length) {\n+ console.log(`Bucket named \"${name}\" already exists\"`)\n+ const bucketID = buckets.buckets[0].id\n+ console.log(`*** Delete Bucket \"${name}\" identified by \"${bucketID}\" ***`)\n+ await bucketsAPI.deleteBucketsID({bucketID})\n+ }\n+ } catch (e) {\n+ if (e instanceof HttpError && e.statusCode == 404) {\n+ // OK, bucket not found\n+ } else {\n+ throw e\n+ }\n+ }\n+\n+ console.log(`*** Create Bucket \"${name}\" ***`)\n+ const bucket = await bucketsAPI.postBuckets({body: {orgID, name}})\n+ console.log(\n+ JSON.stringify(\n+ bucket,\n+ (key, value) => (key === 'links' ? undefined : value),\n+ 2\n+ )\n+ )\n+}\n+\n+recreateBucket('example-bucket')\n+ .then(() => console.log('\\nFinished SUCCESS'))\n+ .catch(error => {\n+ console.error(error)\n+ console.log('\\nFinished ERROR')\n+ })\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(examples): add createBucket.js example
305,159
23.07.2020 08:35:48
-7,200
ceec7a0f94e51fe938aa65f949e25c89f5eb5605
docs: add default documentation to body property in generated APIs
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "## 1.6.0 [unreleased]\n+### Documentation\n+\n+1. [#215](https://github.com/influxdata/influxdb-client-js/pull/215): Add createBucket.js example\n+1. [#218](https://github.com/influxdata/influxdb-client-js/pull/218): Add default documentation to body property in generated APIs\n+\n## 1.5.0 [2020-07-17]\n### Features\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/generator/generateApi.ts", "new_path": "packages/apis/generator/generateApi.ts", "diff": "@@ -57,6 +57,8 @@ function generateTypes(operation: Operation): string {\nif (operation.bodyParam) {\nif (operation.bodyParam.description) {\nretVal += ` /** ${operation.bodyParam.description} */\\n`\n+ } else {\n+ retVal += ` /** entity body */\\n`\n}\nconst bodyType = getBodyType(operation)\nretVal += ` body: ${bodyType}\\n`\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/DashboardsAPI.ts", "new_path": "packages/apis/src/generated/DashboardsAPI.ts", "diff": "@@ -68,6 +68,7 @@ export interface PostDashboardsIDCellsRequest {\nexport interface PutDashboardsIDCellsRequest {\n/** The ID of the dashboard to update. */\ndashboardID: string\n+ /** entity body */\nbody: Cells\n}\nexport interface PatchDashboardsIDCellsIDRequest {\n@@ -75,6 +76,7 @@ export interface PatchDashboardsIDCellsIDRequest {\ndashboardID: string\n/** The ID of the cell to update. */\ncellID: string\n+ /** entity body */\nbody: CellUpdate\n}\nexport interface DeleteDashboardsIDCellsIDRequest {\n@@ -94,6 +96,7 @@ export interface PatchDashboardsIDCellsIDViewRequest {\ndashboardID: string\n/** The ID of the cell to update. */\ncellID: string\n+ /** entity body */\nbody: View\n}\nexport interface GetDashboardsIDLabelsRequest {\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/PackagesAPI.ts", "new_path": "packages/apis/src/generated/PackagesAPI.ts", "diff": "@@ -6,6 +6,7 @@ export interface CreatePkgRequest {\nbody: PkgCreate\n}\nexport interface ApplyPkgRequest {\n+ /** entity body */\nbody: PkgApply\n}\nexport interface ListStacksRequest {\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/TasksAPI.ts", "new_path": "packages/apis/src/generated/TasksAPI.ts", "diff": "@@ -66,6 +66,7 @@ export interface GetTasksIDRunsRequest {\n}\nexport interface PostTasksIDRunsRequest {\ntaskID: string\n+ /** entity body */\nbody: RunManually\n}\nexport interface GetTasksIDRunsIDRequest {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: add default documentation to body property in generated APIs
305,159
23.07.2020 08:48:58
-7,200
96c8450d91e32320d16ec0e6ca5410634e418d26
feat(core/flux): sanitize arrays in parameterized flux queries
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "### Features\n+1. [#219](https://github.com/influxdata/influxdb-client-js/pull/219): Sanitize arrays in parameterized flux queries.\n+\n+### Features\n+\n1. [#204](https://github.com/influxdata/influxdb-client-js/pull/204): Allow to supply default tags in WriteOptions.\n1. [#209](https://github.com/influxdata/influxdb-client-js/pull/209): Better report errors when InfluxDB 1.8 returns empty body\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/flux.ts", "new_path": "packages/core/src/query/flux.ts", "diff": "@@ -201,6 +201,8 @@ export function toFluxValue(value: any): string {\nreturn value.toISOString()\n} else if (value instanceof RegExp) {\nreturn sanitizeRegExp(value)\n+ } else if (Array.isArray(value)) {\n+ return `[${value.map(toFluxValue).join(',')}]`\n}\nreturn toFluxValue(value.toString())\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": "@@ -112,6 +112,8 @@ describe('Flux Values', () => {\n{value: 'abc${val}def', flux: '\"abc\\\\${val}def\"'},\n{value: 'abc$', flux: '\"abc$\"'},\n{value: 'a\"$d', flux: '\"a\\\\\"$d\"'},\n+ {value: [], flux: '[]'},\n+ {value: ['a\"$d'], flux: '[\"a\\\\\"$d\"]'},\n]\npairs.forEach(pair => {\nit(`converts ${JSON.stringify(String(pair.value))} to '${\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core/flux): sanitize arrays in parameterized flux queries
305,159
24.07.2020 04:04:07
-7,200
e698f781afb0485231e43e7fb868c9814b18b108
chore: add more doc into examples
[ { "change_type": "MODIFY", "old_path": "examples/createBucket.js", "new_path": "examples/createBucket.js", "diff": "@@ -38,6 +38,7 @@ async function recreateBucket(name) {\n}\nconsole.log(`*** Create Bucket \"${name}\" ***`)\n+ // creates a bucket, entity properties are specified in the \"body\" property\nconst bucket = await bucketsAPI.postBuckets({body: {orgID, name}})\nconsole.log(\nJSON.stringify(\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: add more doc into examples
305,159
24.07.2020 12:03:21
-7,200
a98cb8fa210a76fb1f89a99eae4ccc0ec574a456
docs: improve main readme
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -33,46 +33,41 @@ InfluxDB 2.0 client consists of two packages\n## Installation\n-To use write or query InfluxDB in your project:\n+To write or query InfluxDB, add `@influxdata/influxdb-client` dependency to your project using your favourite package manager.\n```\n$npm install --save @influxdata/influxdb-client\n-```\n-\n-or\n-\n-```\n$yarn add @influxdata/influxdb-client\n+$pnpm add @influxdata/influxdb-client\n```\n-To use InfluxDB management APIs in your project:\n+To use InfluxDB management APIs in your project, add also `@influxdata/influxdb-client-apis` dependency to your project.\n```\n$npm install --save @influxdata/influxdb-client-apis\n-```\n-\n-or\n-\n-```\n$yarn add @influxdata/influxdb-client-apis\n+$pnpm add @influxdata/influxdb-client-apis\n```\n## Usage\n-See [examples](./examples/README.md)\n+The following examples helps to start quickly with this client:\n- @influxdata/influxdb-client\n- - [write points or lines](./examples/write.js)\n+ - [write points](./examples/write.js)\n- [query data](./examples/query.ts)\n- @influxdata/influxdb-client-apis\n- [setup / onboarding](./examples/onboarding.js)\n+ - [create bucket](./examples/createBucket.js)\n- [health](./examples/health.js)\n-[InfluxDB 2.0 API compatibility endpoints](https://docs.influxdata.com/influxdb/v1.8/tools/api/#influxdb-2-0-api-compatibility-endpoints) are part of the InfluxDB 1.x line since InfluxDB 1.8.0.\n-This allows you to leverage InfluxDB 2.0 client libraries for both writing and querying data with Flux. For more details, see\n+There are also more advanced [examples](./examples/README.md) that shows\n-- [InfluxDB 1.8 example](examples/influxdb-1.8.ts)\n-- https://docs.influxdata.com/influxdb/v1.8/about_the_project/releasenotes-changelog/#forward-compatibility\n+- how to create a bucket\n+- how to execute parameterized queries\n+- how to use this client with InfluxDB 1.8+\n+- how to use this client in the browser\n+- how to process InfluxDB query results with RX Observables\n## Build Requirements\n" }, { "change_type": "MODIFY", "old_path": "examples/.gitignore", "new_path": "examples/.gitignore", "diff": "@@ -11,3 +11,4 @@ reports\nyarn-error.log\npackage-lock.json\nyarn.lock\n+pnpm-lock.yaml\n" }, { "change_type": "MODIFY", "old_path": "examples/health.js", "new_path": "examples/health.js", "diff": "#!/usr/bin/node\n/*\n-This example shows how to use management/administration InfluxDB APIs\n+This example shows how to use management/administration InfluxDB APIs.\nAll InfluxDB APIs are available through '@influxdata/influxdb-client-apis' package.\nSee https://v2.docs.influxdata.com/v2.0/api/\n" }, { "change_type": "MODIFY", "old_path": "examples/influxdb-1.8.ts", "new_path": "examples/influxdb-1.8.ts", "diff": "////////////////////////////////////////////////////////////////////\n// Shows how to use forward compatibility APIs from InfluxDB 1.8. //\n////////////////////////////////////////////////////////////////////\n+// [InfluxDB 2.0 API compatibility endpoints](https://docs.influxdata.com/influxdb/v1.8/tools/api/#influxdb-2-0-api-compatibility-endpoints)\n+// are part of the InfluxDB 1.x line since InfluxDB 1.8.0. This allows you to leverage InfluxDB 2.0 client libraries for both writing and\n+// querying data with Flux.\n+// https://docs.influxdata.com/influxdb/v1.8/about_the_project/releasenotes-changelog/#forward-compatibility\nimport {ClientOptions, InfluxDB, Point} from '@influxdata/influxdb-client'\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: improve main readme
305,159
23.07.2020 13:31:51
-7,200
d6cdabfa8d36a955fcc0459981bc8f62edb14a75
chore(core/flux): do fewer comparisons during detection of flux parameter type
[ { "change_type": "MODIFY", "old_path": "packages/core/src/query/flux.ts", "new_path": "packages/core/src/query/flux.ts", "diff": "@@ -192,16 +192,18 @@ export function toFluxValue(value: any): string {\nreturn `\"${sanitizeString(value)}\"`\n} else if (typeof value === 'number') {\nreturn sanitizeFloat(value)\n- } else if (\n- typeof value === 'object' &&\n- typeof value[FLUX_VALUE] === 'function'\n- ) {\n+ } else if (typeof value === 'object') {\n+ if (typeof value[FLUX_VALUE] === 'function') {\nreturn value[FLUX_VALUE]()\n} else if (value instanceof Date) {\nreturn value.toISOString()\n} else if (value instanceof RegExp) {\nreturn sanitizeRegExp(value)\n+ } else if (Array.isArray(value)) {\n+ return `[${value.map(toFluxValue).join(',')}]`\n+ }\n}\n+ // use toString value for unrecognized object, bigint, symbol\nreturn toFluxValue(value.toString())\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core/flux): do fewer comparisons during detection of flux parameter type
305,159
24.07.2020 14:23:38
-7,200
315951fc54e011d1dea5bdba89edc82e080cf177
docs: validate tsdoc with lint
[ { "change_type": "MODIFY", "old_path": ".eslintrc.json", "new_path": ".eslintrc.json", "diff": "\"sourceType\": \"module\",\n\"ecmaFeatures\": {}\n},\n- \"plugins\": [\"@typescript-eslint\", \"prettier\"],\n+ \"plugins\": [\n+ \"@typescript-eslint/eslint-plugin\",\n+ \"prettier\",\n+ \"eslint-plugin-tsdoc\"\n+ ],\n\"env\": {\n\"node\": true,\n\"es6\": true,\n{\"varsIgnorePattern\": \"^_\", \"argsIgnorePattern\": \"^_\"}\n],\n\"@typescript-eslint/no-empty-function\": \"off\",\n- \"@typescript-eslint/no-empty-interface\": \"off\"\n+ \"@typescript-eslint/no-empty-interface\": \"off\",\n+ \"tsdoc/syntax\": \"warn\"\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/package.json", "new_path": "packages/apis/package.json", "diff": "\"eslint\": \"^6.7.1\",\n\"eslint-config-prettier\": \"^6.7.0\",\n\"eslint-plugin-prettier\": \"^3.1.1\",\n+ \"eslint-plugin-tsdoc\": \"^0.2.6\",\n\"mocha\": \"^6.2.2\",\n\"prettier\": \"^1.19.1\",\n\"rimraf\": \"^3.0.0\",\n" }, { "change_type": "MODIFY", "old_path": "packages/core/package.json", "new_path": "packages/core/package.json", "diff": "\"eslint\": \"^6.7.1\",\n\"eslint-config-prettier\": \"^6.7.0\",\n\"eslint-plugin-prettier\": \"^3.1.1\",\n+ \"eslint-plugin-tsdoc\": \"^0.2.6\",\n\"mocha\": \"^6.2.2\",\n\"mocha-junit-reporter\": \"^1.23.1\",\n\"nock\": \"^11.7.0\",\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "npmlog \"^4.1.2\"\nwrite-file-atomic \"^2.3.0\"\n+\"@microsoft/[email protected]\":\n+ version \"0.13.5\"\n+ resolved \"https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.13.5.tgz#2efeb27f5e4d191b8356aa4eb09e146c0813070c\"\n+ integrity sha512-KlnIdTRnPSsU9Coz9wzDAkT8JCLopP3ec1sgsgo7trwE6QLMKRpM4hZi2uzVX897SW49Q4f439auGBcQLnZQfA==\n+ dependencies:\n+ \"@microsoft/tsdoc\" \"0.12.20\"\n+ ajv \"~6.12.3\"\n+ jju \"~1.4.0\"\n+ resolve \"~1.12.0\"\n+\n+\"@microsoft/[email protected]\":\n+ version \"0.12.20\"\n+ resolved \"https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.20.tgz#4261285f666ee0c0378f810585dd4ec5bbfa8852\"\n+ integrity sha512-/b13m37QZYPV6nCOiqkFyvlQjlTNvAcQpgFZ6ZKIqtStJxNdqVo/frULubxMUMWi6p9Uo5f4BRlguv5ViFcL0A==\n+\n\"@mrmlnc/readdir-enhanced@^2.2.1\":\nversion \"2.2.1\"\nresolved \"https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde\"\n@@ -1201,6 +1216,16 @@ ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5:\njson-schema-traverse \"^0.4.1\"\nuri-js \"^4.2.2\"\n+ajv@~6.12.3:\n+ version \"6.12.3\"\n+ resolved \"https://registry.yarnpkg.com/ajv/-/ajv-6.12.3.tgz#18c5af38a111ddeb4f2697bd78d68abc1cabd706\"\n+ integrity sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==\n+ dependencies:\n+ fast-deep-equal \"^3.1.1\"\n+ fast-json-stable-stringify \"^2.0.0\"\n+ json-schema-traverse \"^0.4.1\"\n+ uri-js \"^4.2.2\"\n+\[email protected]:\nversion \"3.2.3\"\nresolved \"https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813\"\n@@ -2399,6 +2424,14 @@ eslint-plugin-prettier@^3.1.1:\ndependencies:\nprettier-linter-helpers \"^1.0.0\"\n+eslint-plugin-tsdoc@^0.2.6:\n+ version \"0.2.6\"\n+ resolved \"https://registry.yarnpkg.com/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.6.tgz#8e63aeff24708da5a01ac2bef1e46c4cd779ce09\"\n+ integrity sha512-pU6/VVEOlC85BrUjsqZGGSRy41N+PHfWXokqjpQRWT1LSpBsAEbRpsueNYSFS+93Sx9CFD0511kjLKVySRbLbg==\n+ dependencies:\n+ \"@microsoft/tsdoc\" \"0.12.20\"\n+ \"@microsoft/tsdoc-config\" \"0.13.5\"\n+\neslint-scope@^5.0.0:\nversion \"5.0.0\"\nresolved \"https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9\"\n@@ -3734,6 +3767,11 @@ jest-worker@^24.9.0:\nmerge-stream \"^2.0.0\"\nsupports-color \"^6.1.0\"\n+jju@~1.4.0:\n+ version \"1.4.0\"\n+ resolved \"https://registry.yarnpkg.com/jju/-/jju-1.4.0.tgz#a3abe2718af241a2b2904f84a625970f389ae32a\"\n+ integrity sha1-o6vicYryQaKykE+EpiWXDzia4yo=\n+\njs-tokens@^4.0.0:\nversion \"4.0.0\"\nresolved \"https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499\"\n@@ -4258,11 +4296,21 @@ minimist-options@^3.0.1:\narrify \"^1.0.1\"\nis-plain-obj \"^1.1.0\"\[email protected], minimist@>=1.2.2, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5, minimist@~0.0.1:\[email protected]:\n+ version \"0.0.8\"\n+ resolved \"https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d\"\n+ integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=\n+\n+minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5:\nversion \"1.2.5\"\nresolved \"https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602\"\nintegrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==\n+minimist@~0.0.1:\n+ version \"0.0.10\"\n+ resolved \"https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf\"\n+ integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=\n+\nminipass@^2.3.5, minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0:\nversion \"2.9.0\"\nresolved \"https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6\"\n@@ -5439,6 +5487,13 @@ resolve@^1.1.6, resolve@^1.10.0:\ndependencies:\npath-parse \"^1.0.6\"\n+resolve@~1.12.0:\n+ version \"1.12.3\"\n+ resolved \"https://registry.yarnpkg.com/resolve/-/resolve-1.12.3.tgz#96d5253df8005ce19795c14338f2a013c38a8c15\"\n+ integrity sha512-hF6+hAPlxjqHWrw4p1rF3Wztbgxd4AjA5VlUzY5zcTb4J8D3JK4/1RjU48pHz2PJWzGVsLB1VWZkvJzhK2CCOA==\n+ dependencies:\n+ path-parse \"^1.0.6\"\n+\nrestore-cursor@^2.0.0:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf\"\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: validate tsdoc with lint
305,159
24.07.2020 15:02:56
-7,200
6e722c2939b84ac5c18b25516f3f3c7ff13319ee
docs(core): repair and improve tsdoc comments
[ { "change_type": "MODIFY", "old_path": "packages/core/src/InfluxDB.ts", "new_path": "packages/core/src/InfluxDB.ts", "diff": "@@ -17,7 +17,7 @@ export default class InfluxDB {\n/**\n* Creates influxdb client options from an options object or url.\n- * @param options options\n+ * @param options - client options\n*/\nconstructor(options: ClientOptions | string) {\nif (typeof options === 'string') {\n@@ -38,10 +38,11 @@ export default class InfluxDB {\n* Creates [[WriteApi]] for the supplied organization and bucket. BEWARE that returned instances must be closed\n* in order to flush the remaining data and close already scheduled retry executions.\n*\n- * @param org Specifies the destination organization for writes. Takes either the ID or Name interchangeably.\n- * @param bucket The destination bucket for writes.\n- * @param precision Timestamp precision for line items.\n- * @param writeOptions Custom write options.\n+ * @param org - Specifies the destination organization for writes. Takes either the ID or Name interchangeably.\n+ * @param bucket - The destination bucket for writes.\n+ * @param precision - Timestamp precision for line items.\n+ * @param writeOptions - Custom write options.\n+ * @returns WriteAPI instance\n*/\ngetWriteApi(\norg: string,\n@@ -61,8 +62,8 @@ export default class InfluxDB {\n/**\n* Creates [[QueryAPI]] for the supplied organization .\n*\n- * @param org organization\n- * @return query api instance\n+ * @param org - organization\n+ * @returns query api instance\n*/\ngetQueryApi(org: string): QueryApi {\nreturn new QueryApiImpl(this.transport, org)\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "@@ -13,8 +13,7 @@ export default class Point {\n/**\n* Create a new Point with specified a measurement name.\n*\n- * @param measurementName the measurement name\n- * @return new instance of {@link Point}\n+ * @param measurementName - the measurement name\n*/\nconstructor(measurementName?: string) {\nif (measurementName) this.name = measurementName\n@@ -23,8 +22,8 @@ export default class Point {\n/**\n* Sets point's measurement.\n*\n- * @param name measurement name\n- * @return new instance of {@link Point}\n+ * @param name - measurement name\n+ * @returns this\n*/\npublic measurement(name: string): Point {\nthis.name = name\n@@ -34,9 +33,9 @@ export default class Point {\n/**\n* Adds a tag.\n*\n- * @param name tag name\n- * @param value tag value\n- * @return this\n+ * @param name - tag name\n+ * @param value - tag value\n+ * @returns this\n*/\npublic tag(name: string, value: string): Point {\nthis.tags[name] = value\n@@ -46,9 +45,9 @@ export default class Point {\n/**\n* Adds a boolean field.\n*\n- * @param field field name\n- * @param value field value\n- * @return this\n+ * @param field - field name\n+ * @param value - field value\n+ * @returns this\n*/\npublic booleanField(name: string, value: boolean | any): Point {\nthis.fields[name] = value ? 'T' : 'F'\n@@ -58,9 +57,9 @@ export default class Point {\n/**\n* Adds an integer field.\n*\n- * @param name field name\n- * @param value field value\n- * @return this\n+ * @param name - field name\n+ * @param value - field value\n+ * @returns this\n*/\npublic intField(name: string, value: number | any): Point {\nif (typeof value !== 'number') {\n@@ -79,9 +78,9 @@ export default class Point {\n/**\n* Adds a number field.\n*\n- * @param name field name\n- * @param value field value\n- * @return this\n+ * @param name - field name\n+ * @param value - field value\n+ * @returns this\n*/\npublic floatField(name: string, value: number | any): Point {\nif (typeof value !== 'number') {\n@@ -100,9 +99,9 @@ export default class Point {\n/**\n* Adds a string field.\n*\n- * @param name field name\n- * @param value field value\n- * @return this\n+ * @param name - field name\n+ * @param value - field value\n+ * @returns this\n*/\npublic stringField(name: string, value: string | any): Point {\nif (value !== null && value !== undefined) {\n@@ -120,14 +119,19 @@ export default class Point {\n* An empty string can be used to let the server assign\n* the timestamp.\n*\n- * @param value point time\n- * @return this\n+ * @param value - point time\n+ * @returns this\n*/\npublic timestamp(value: Date | number | string | undefined): Point {\nthis.time = value\nreturn this\n}\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+ */\npublic toLineProtocol(settings?: PointSettings): string | undefined {\nif (!this.name) return undefined\nlet fieldsLine = ''\n@@ -166,6 +170,7 @@ export default class Point {\ntime !== undefined ? ' ' + time : ''\n}`\n}\n+\ntoString(): string {\nconst line = this.toLineProtocol(undefined)\nreturn line ? line : `invalid point: ${JSON.stringify(this, undefined)}`\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/QueryApi.ts", "new_path": "packages/core/src/QueryApi.ts", "diff": "@@ -46,22 +46,24 @@ export interface Row {\nexport default interface QueryApi {\n/**\n* Adds extra options for this query API.\n- * @param options\n- * @return this\n+ * @param options - query options to use\n+ * @returns this\n*/\nwith(options: Partial<QueryOptions>): QueryApi\n/**\n* Creates a cold observable of the lines returned by the given query.\n*\n- * @param query query\n+ * @param query - query\n+ * @returns observable of CSV result lines\n*/\nlines(query: string | ParameterizedQuery): Observable<string>\n/**\n* Creates a cold observable of the rows returned by the given query.\n*\n- * @param query query\n+ * @param query - query\n+ * @returns observable of result rows\n*/\nrows(query: string | ParameterizedQuery): Observable<Row>\n@@ -69,8 +71,8 @@ export default interface QueryApi {\n* Executes the query and receives result lines (including empty and annotation lines)\n* through the supplied consumer. See [annotated-csv](https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/).\n*\n- * @param query query\n- * @param consumer data/error consumer\n+ * @param query - query\n+ * @param consumer - csv result lines and error consumer\n*/\nqueryLines(\nquery: string | ParameterizedQuery,\n@@ -80,8 +82,8 @@ export default interface QueryApi {\n/**\n* Executes the query and receives table metadata and rows through the supplied consumer.\n*\n- * @param query query\n- * @param consumer data/error consumer\n+ * @param query - query\n+ * @param consumer - result rows and error consumer\n*/\nqueryRows(\nquery: string | ParameterizedQuery,\n@@ -93,10 +95,11 @@ export default interface QueryApi {\n* This method is suitable to collect simple results. Use with caution,\n* a possibly huge stream of results is copied to memory.\n*\n- * @param query query\n- * @param rowMapper maps the supplied row to an item that is then collected,\n+ * @param query - query\n+ * @param rowMapper - maps the supplied row to an item that is then collected,\n* undefined return values are not collected. If no rowMapper is supplied,\n* `row => row.tableMeta.toObject(row.values)` is used.\n+ * @returns Promise of mapped results\n*/\ncollectRows<T>(\nquery: string | ParameterizedQuery,\n@@ -111,7 +114,8 @@ export default interface QueryApi {\n* This method is suitable to collect simple results. Use with caution,\n* a possibly huge stream of lines is copied to memory.\n*\n- * @param query query\n+ * @param query - query\n+ * @returns Promise of returned csv lines\n*/\ncollectLines(query: string | ParameterizedQuery): Promise<Array<string>>\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/WriteApi.ts", "new_path": "packages/core/src/WriteApi.ts", "diff": "@@ -13,47 +13,47 @@ export default interface WriteApi {\n/**\n* Instructs to use the following default tags when writing points.\n* Not applicable for writing records/lines.\n- * @param tags\n+ * @param tags - default tags\n*/\nuseDefaultTags(tags: {[key: string]: string}): WriteApi\n/**\n* Write a line of [Line Protocol](https://bit.ly/2QL99fu).\n*\n- * @param record line in InfluxDB Line Protocol.\n+ * @param record - line of InfluxDB Line Protocol\n*/\nwriteRecord(record: string): void\n/**\n* Write lines of [Line Protocol](https://bit.ly/2QL99fu).\n*\n- * @param records lines in InfluxDB Line Protocol\n+ * @param records - lines in InfluxDB Line Protocol\n*/\nwriteRecords(records: Array<string>): void\n/**\n* Write point.\n*\n- * @param point point to write\n+ * @param point - point to write\n*/\nwritePoint(point: Point): void\n/**\n* Write points.\n*\n- * @param points points to write\n+ * @param points - points to write\n*/\nwritePoints(points: ArrayLike<Point>): void\n/**\n* Flushes pending writes to the server.\n- * @return completition promise\n+ * @returns completition promise\n*/\nflush(): Promise<void>\n/**\n* Flushes this writer and cancels retries of write operations that failed.\n- * @return completition promise\n+ * @returns completition promise\n*/\nclose(): Promise<void>\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/errors.ts", "new_path": "packages/core/src/errors.ts", "diff": "export interface RetryDelayStrategy {\n/**\n* Returns delay for a next retry\n- * @param error reason for retrying\n- * @return milliseconds\n+ * @param error - reason for retrying\n+ * @returns milliseconds to wait before retrying\n*/\nnextDelay(error?: Error): number\n/** Implementation should reset its state, this is mandatory to call upon success. */\n@@ -22,7 +22,7 @@ export interface RetriableDecision {\ncanRetry(): boolean\n/**\n* Get the delay in milliseconds to retry the action.\n- * @return 0 to let the implementation decide, miliseconds delay otherwise\n+ * @returns 0 to let the implementation decide, miliseconds delay otherwise\n*/\nretryAfter(): number\n}\n@@ -96,8 +96,9 @@ const RETRY_CODES = [\n]\n/**\n- * Tests the error to know whether a possible HTTP call can be retried.\n- * @param error Test whether the givver e\n+ * Tests the error in order to know if an HTTP call can be retried.\n+ * @param error - error to test\n+ * @returns true for a retriable error\n*/\nexport function canRetryHttpCall(error: any): boolean {\nif (!error) {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/Logger.ts", "new_path": "packages/core/src/impl/Logger.ts", "diff": "@@ -32,8 +32,8 @@ const Logger: Logger = {\n/**\n* Sets custom logger.\n- * @param logger new logger\n- * @return previous logger\n+ * @param logger - logger to use\n+ * @returns previous logger\n*/\nexport function setLogger(logger: Logger): Logger {\nconst previous = provider\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -47,7 +47,7 @@ export class NodeHttpTransport implements Transport {\n) => http.ClientRequest\n/**\n* Creates a node transport using for the client options supplied.\n- * @param connectionOptions client options\n+ * @param connectionOptions - connection options\n*/\nconstructor(private connectionOptions: ConnectionOptions) {\nconst url = parse(connectionOptions.url)\n@@ -73,12 +73,11 @@ export class NodeHttpTransport implements Transport {\n/**\n* Sends data to server and receives communication events via communication callbacks.\n*\n- * @param path HTTP path\n- * @param body message body\n- * @param headers HTTP headers\n- * @param method HTTP method\n- * @param callbacks communication callbacks\n- * @return a handle that can cancel the communication\n+ * @param path - HTTP request path\n+ * @param body - message body\n+ * @param headers - HTTP headers\n+ * @param method - HTTP method\n+ * @param callbacks - communication callbacks\n*/\nsend(\npath: string,\n@@ -97,9 +96,10 @@ export class NodeHttpTransport implements Transport {\n* Sends data to the server and receives decoded result. The type of the result depends on\n* response's content-type (deserialized json, text).\n- * @param path HTTP path\n- * @param requestBody request body\n- * @param options send options\n+ * @param path - HTTP path\n+ * @param requestBody - request body\n+ * @param options - send options\n+ * @returns Promise of response body\n*/\nrequest(path: string, body: any, options: SendOptions): Promise<any> {\nif (!body) {\n@@ -140,11 +140,11 @@ export class NodeHttpTransport implements Transport {\n/**\n* Creates configuration for a specific request.\n*\n- * @param path API path starting with '/' and containing also query parameters\n- * @param headers HTTP headers to use\n- * @param method HTTP method\n- * @param body request body, will be utf-8 encoded\n- * @return configuration suitable for making the request\n+ * @param path - API path starting with '/' and containing also query parameters\n+ * @param headers - HTTP headers to use\n+ * @param method - HTTP method\n+ * @param body - request body, will be utf-8 encoded\n+ * @returns a configuration object that is suitable for making the request\n*/\nprivate createRequestMessage(\npath: string,\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/retryStrategy.ts", "new_path": "packages/core/src/impl/retryStrategy.ts", "diff": "@@ -45,8 +45,9 @@ export class RetryStrategyImpl implements RetryDelayStrategy {\n}\n/**\n- * Creates a new instance of retry strategy\n- * @param options retry options\n+ * Creates a new instance of retry strategy.\n+ * @param options - retry options\n+ * @returns retry strategy implementation\n*/\nexport function createRetryDelayStrategy(\noptions?: Partial<RetryDelayStrategyOptions>\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/observable/symbol.ts", "new_path": "packages/core/src/observable/symbol.ts", "diff": "@@ -7,7 +7,7 @@ declare global {\n}\n}\n-/** Symbol.observable or a string \"@@observable\". Used for interop */\n+/** Symbol.observable or a string \"\\@\\@observable\". Used for interop */\nexport const symbolObservable = (():\n| typeof Symbol.observable\n| '@@observable' =>\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableColumn.ts", "new_path": "packages/core/src/query/FluxTableColumn.ts", "diff": "@@ -58,13 +58,13 @@ export default class FluxTableColumn {\n/**\n* Index of this column in the row array\n- * @return index\n*/\nindex: number\n/**\n* Creates a flux table column from an object supplied.\n- * @param object\n+ * @param object - source object\n+ * @returns column instance\n*/\nstatic from(object: FluxTableColumnLike): FluxTableColumn {\nconst retVal = new FluxTableColumn()\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableMetaData.ts", "new_path": "packages/core/src/query/FluxTableMetaData.ts", "diff": "@@ -30,8 +30,10 @@ export default class FluxTableMetaData {\n}\n/**\n* Gets columns by name\n- * @param label table column or [[invalidColumn]]\n- */\n+ * @param label - column label\n+ * @returns table column\n+ * @throws IllegalArgumentError if column is not found\n+ **/\ncolumn(label: string): FluxTableColumn {\nfor (let i = 0; i < this.columns.length; i++) {\nconst col = this.columns[i]\n@@ -41,7 +43,7 @@ export default class FluxTableMetaData {\n}\n/**\n* Creates an object out of the supplied values with the help of columns .\n- * @param values values for each column\n+ * @param values - a row with data for each column\n*/\ntoObject(values: string[]): {[key: string]: any} {\nconst acc: any = {}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/flux.ts", "new_path": "packages/core/src/query/flux.ts", "diff": "@@ -30,8 +30,8 @@ class FluxParameter implements FluxParameterLike, ParameterizedQuery {\n/**\n* Escapes content of the supplied string so it can be wrapped into double qoutes\n* to become a [flux string literal](https://docs.influxdata.com/flux/v0.65/language/lexical-elements/#string-literals).\n- * @param value string value\n- * @return sanitized string\n+ * @param value - string value\n+ * @returns sanitized string\n*/\nfunction sanitizeString(value: any): string {\nif (value === null || value === undefined) return ''\n@@ -169,7 +169,7 @@ export function fluxBool(value: any): FluxParameterLike {\n/**\n* Assumes that the supplied value is flux expression or literal that does not need sanitizing.\n*\n- * @param value any value\n+ * @param value - any value\n* @returns the supplied value as-is\n*/\nexport function fluxExpression(value: any): FluxParameterLike {\n@@ -178,8 +178,8 @@ export function fluxExpression(value: any): FluxParameterLike {\n/**\n* Escapes content of the supplied parameter so that it can be safely embedded into flux query.\n- * @param value parameter value\n- * @return sanitized flux value or an empty string if it cannot be converted\n+ * @param value - parameter value\n+ * @returns sanitized flux value or an empty string if it cannot be converted\n*/\nexport function toFluxValue(value: any): string {\nif (value === undefined) {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/transport.ts", "new_path": "packages/core/src/transport.ts", "diff": "@@ -8,7 +8,7 @@ export type Headers = {[header: string]: string | string[] | undefined}\nexport interface CommunicationObserver<T> {\n/**\n* Data chunk received, can be called mupliple times.\n- * @param data data\n+ * @param data - data\n*/\nnext(data: T): void\n/**\n@@ -21,7 +21,7 @@ export interface CommunicationObserver<T> {\ncomplete(): void\n/**\n* Informs about a start of response processing.\n- * @param headers response HTTP headers\n+ * @param headers - response HTTP headers\n*/\nresponseStarted?: (headers: Headers) => void\n/**\n@@ -45,19 +45,27 @@ export interface SendOptions {\nexport interface ChunkCombiner {\n/**\n* Concatenates first and second chunk.\n- * @param first chunk\n- * @param second chunk\n- * @return first + second\n+ * @param first - first chunk\n+ * @param second - second chunk\n+ * @returns first + second\n*/\nconcat(first: Uint8Array, second: Uint8Array): Uint8Array\n/**\n* Converts chunk into a string.\n+ * @param chunk - chunk\n+ * @param start - start index\n+ * @param end - end index\n+ * @returns string representation of chunk slice\n*/\ntoUtf8String(chunk: Uint8Array, start: number, end: number): string\n/**\n* Creates a new chunk from the supplied chunk.\n+ * @param chunk - chunk to copy\n+ * @param start - start index\n+ * @param end - end index\n+ * @returns a copy of a chunk slice\n*/\ncopy(chunk: Uint8Array, start: number, end: number): Uint8Array\n}\n@@ -69,10 +77,10 @@ export interface Transport {\n/**\n* Send data to the server and receive communication events via callbacks.\n*\n- * @param path HTTP path\n- * @param requestBody request body\n- * @param options send options\n- * @param callbacks communication callbacks with chunks Uint8Array\n+ * @param path - HTTP request path\n+ * @param requestBody - HTTP request body\n+ * @param options - send options\n+ * @param callbacks - communication callbacks to received data in Uint8Array\n*/\nsend(\npath: string,\n@@ -85,9 +93,9 @@ export interface Transport {\n* Sends data to the server and receives decoded result. The type of the result depends on\n* response's content-type (deserialized json, text).\n- * @param path HTTP path\n- * @param requestBody request body\n- * @param options send options\n+ * @param path - HTTP request path\n+ * @param requestBody - request body\n+ * @param options - send options\n*/\nrequest(path: string, body: any, options: SendOptions): Promise<any>\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/util/LineSplitter.ts", "new_path": "packages/core/src/util/LineSplitter.ts", "diff": "@@ -26,7 +26,6 @@ export default class LineSplitter {\n/**\n* Sets the reuse flag and returns this.\n- * @param line\n*/\nwithReuse(): LineSplitter {\nthis.reuse = true\n@@ -36,8 +35,8 @@ export default class LineSplitter {\n/**\n* Splits the supplied line to elements that are separated by\n* comma with values possibly escaped within double quotes (\"value\")\n- * @param line line\n- * @return\n+ * @param line - line\n+ * @returns array of splitted parts\n*/\nsplitLine(line: string | undefined | null): string[] {\nif (line === null || line === undefined) {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs(core): repair and improve tsdoc comments
305,159
24.07.2020 15:37:32
-7,200
553ce8edf52d8ab10ce17cbd1e784497617a6d58
docs(apis): tsdoc lint issues are errors unless in generated code
[ { "change_type": "MODIFY", "old_path": ".eslintrc.json", "new_path": ".eslintrc.json", "diff": "],\n\"@typescript-eslint/no-empty-function\": \"off\",\n\"@typescript-eslint/no-empty-interface\": \"off\",\n- \"tsdoc/syntax\": \"warn\"\n+ \"tsdoc/syntax\": \"error\"\n}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "packages/apis/.eslintrc.json", "diff": "+{\n+ \"overrides\": [\n+ {\n+ \"files\": [\"src/generated/*.ts\"],\n+ \"excludedFiles\": \"*.test.js\",\n+ \"rules\": {\n+ \"tsdoc/syntax\": \"warn\"\n+ }\n+ }\n+ ]\n+}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs(apis): tsdoc lint issues are errors unless in generated code
305,159
26.07.2020 20:00:52
-7,200
92100d19dbdc2fc36c044595d6d44d35b1a3f20c
chore: support comments in JSON configurations
[ { "change_type": "ADD", "old_path": null, "new_path": ".gitattributes", "diff": "+# Rush's JSON config files use JavaScript-style code comments. The rule below prevents pedantic\n+# syntax highlighters such as GitHub's from highlighting these comments as errors. Your text editor\n+# may also require a special configuration to allow comments in JSON.\n+#\n+# For more information, see this issue: https://github.com/microsoft/rushstack/issues/1088\n+#\n+*.json linguist-language=JSON-with-Comments\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "@@ -10,3 +10,4 @@ doc\nreports\nyarn-error.log\n.idea/\n+temp\n" }, { "change_type": "MODIFY", "old_path": ".vscode/settings.json", "new_path": ".vscode/settings.json", "diff": "{\n// enforce prettier on save\n- \"editor.formatOnSave\": true\n+ \"editor.formatOnSave\": true,\n+ // comments in json files are OK\n+ \"files.associations\": {\"*.json\": \"jsonc\"}\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: support comments in JSON configurations
305,159
26.07.2020 20:59:50
-7,200
16e15d8dab4a39b31ccf8d494ad0f7acc04f36e3
chore(docs): simplify generated typings
[ { "change_type": "MODIFY", "old_path": "packages/core/src/util/currentTime.ts", "new_path": "packages/core/src/util/currentTime.ts", "diff": "@@ -77,14 +77,14 @@ function seconds(): string {\n* depending on the js platform in use.\n*/\nexport const currentTime = Object.freeze({\n- [String(WritePrecision.s)]: seconds,\n- [String(WritePrecision.ms)]: millis,\n- [String(WritePrecision.us)]: micros,\n- [String(WritePrecision.ns)]: nanos,\n- seconds,\n- millis,\n- micros,\n- nanos,\n+ [String(WritePrecision.s)]: seconds as () => string,\n+ [String(WritePrecision.ms)]: millis as () => string,\n+ [String(WritePrecision.us)]: micros as () => string,\n+ [String(WritePrecision.ns)]: nanos as () => string,\n+ seconds: seconds as () => string,\n+ millis: millis as () => string,\n+ micros: micros as () => string,\n+ nanos: nanos as () => string,\n})\nexport const dateToProtocolTimestamp = {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(docs): simplify generated typings
305,159
26.07.2020 21:04:06
-7,200
564d672f11032a196023ae54ea4a303ce74a6756
chore(docs): repair link
[ { "change_type": "MODIFY", "old_path": "packages/core/src/transport.ts", "new_path": "packages/core/src/transport.ts", "diff": "@@ -100,7 +100,7 @@ export interface Transport {\nrequest(path: string, body: any, options: SendOptions): Promise<any>\n/**\n- * Returns operations for chunks emitted to the {@link send} method communication observer.\n+ * Combines response chunks to create a single response object.\n*/\nreadonly chunkCombiner: ChunkCombiner\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(docs): repair link
305,159
26.07.2020 21:17:05
-7,200
1046bf6fd466e7889b8109efd4a2c3eb58e007fa
chore(typings): add forgotten exports
[ { "change_type": "MODIFY", "old_path": "packages/core/src/index.ts", "new_path": "packages/core/src/index.ts", "diff": "@@ -2,9 +2,11 @@ export * from './options'\nexport * from './errors'\nexport * from './util/escape'\nexport * from './util/currentTime'\n+export {default as Cancellable} from './util/Cancellable'\nexport * from './query'\nexport * from './transport'\n+export * from './observable'\nexport {default as Point} from './Point'\nexport {default as InfluxDB} from './InfluxDB'\n-export {default as QueryApi, Row} from './QueryApi'\n+export {default as QueryApi, Row, QueryOptions} from './QueryApi'\nexport {default as WriteApi} from './WriteApi'\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/index.ts", "new_path": "packages/core/src/query/index.ts", "diff": "@@ -3,5 +3,9 @@ export {\ntypeSerializers,\n} from './FluxTableMetaData'\nexport {default as FluxResultObserver} from './FluxResultObserver'\n-export {default as FluxTableColumn, ColumnType} from './FluxTableColumn'\n+export {\n+ default as FluxTableColumn,\n+ ColumnType,\n+ FluxTableColumnLike,\n+} from './FluxTableColumn'\nexport * from './flux'\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/transport.ts", "new_path": "packages/core/src/transport.ts", "diff": "import Cancellable from './util/Cancellable'\nexport type Headers = {[header: string]: string | string[] | undefined}\n-\n/**\n* Observes communication with the server.\n*/\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(typings): add forgotten exports
305,159
26.07.2020 21:33:53
-7,200
bd1909221dae7cfcbc3d47f0185cd495c6e4389f
docs: use api-extractor and api-generator to generate API documentation
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "@@ -10,4 +10,5 @@ doc\nreports\nyarn-error.log\n.idea/\n-temp\n+/temp\n+/docs\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "]\n},\n\"scripts\": {\n+ \"apidoc\": \"yarn clean && yarn build && yarn apidoc:extract && yarn apidoc:generate\",\n+ \"apidoc:extract\": \"yarn workspaces run apidoc:extract\",\n+ \"apidoc:generate\": \"api-documenter markdown -i docs -o docs/dist\",\n\"preinstall\": \"node ./scripts/require-yarn.js\",\n- \"clean\": \"yarn workspaces run clean\",\n+ \"clean\": \"rimraf temp docs && yarn workspaces run clean\",\n\"build\": \"cd packages/core && yarn build && cd ../apis && yarn build\",\n\"test\": \"cd packages/core && yarn test && cd ../apis && yarn test\",\n\"coverage\": \"cd packages/core && yarn coverage\",\n},\n\"license\": \"MIT\",\n\"dependencies\": {\n+ \"@microsoft/api-documenter\": \"^7.8.21\",\n\"lerna\": \"^3.20.2\",\n\"prettier\": \"^1.19.1\",\n\"rimraf\": \"^3.0.0\",\n" }, { "change_type": "ADD", "old_path": null, "new_path": "packages/apis/api-extractor.json", "diff": "+/**\n+ * Config file for API Extractor. For more info, please visit: https://api-extractor.com\n+ */\n+{\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+}\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/package.json", "new_path": "packages/apis/package.json", "diff": "\"version\": \"1.5.0\",\n\"description\": \"InfluxDB 2.0 generated APIs\",\n\"scripts\": {\n+ \"apidoc:extract\": \"api-extractor run\",\n\"build\": \"yarn run clean && yarn run lint && rollup -c\",\n\"build:doc\": \"yarn run clean && yarn typedoc\",\n\"clean\": \"rimraf build doc dist\",\n},\n\"devDependencies\": {\n\"@influxdata/influxdb-client\": \"^1.5.0\",\n+ \"@microsoft/api-extractor\": \"^7.9.2\",\n\"@typescript-eslint/eslint-plugin\": \"^2.9.0\",\n\"@typescript-eslint/parser\": \"^2.9.0\",\n\"chai\": \"^4.2.0\",\n" }, { "change_type": "ADD", "old_path": null, "new_path": "packages/core/api-extractor.json", "diff": "+/**\n+ * Config file for API Extractor. For more info, please visit: https://api-extractor.com\n+ */\n+{\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+}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/package.json", "new_path": "packages/core/package.json", "diff": "\"version\": \"1.5.0\",\n\"description\": \"InfluxDB 2.0 client\",\n\"scripts\": {\n+ \"apidoc:extract\": \"api-extractor run\",\n\"build\": \"yarn run clean && rollup -c\",\n\"build:doc\": \"yarn run clean && yarn typedoc\",\n\"clean\": \"rimraf dist build coverage .nyc_output doc *.lcov reports\",\n},\n\"license\": \"MIT\",\n\"devDependencies\": {\n+ \"@microsoft/api-extractor\": \"^7.9.2\",\n\"@rollup/plugin-replace\": \"^2.3.0\",\n\"@types/chai\": \"^4.2.5\",\n\"@types/mocha\": \"^5.2.7\",\n" }, { "change_type": "ADD", "old_path": null, "new_path": "scripts/api-extractor-base.json", "diff": "+/**\n+ * Config file for API Extractor. For more info, please visit: https://api-extractor.com\n+ */\n+{\n+ \"$schema\": \"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json\",\n+\n+ /**\n+ * Optionally specifies another JSON config file that this file extends from. This provides a way for\n+ * standard settings to be shared across multiple projects.\n+ *\n+ * If the path starts with \"./\" or \"../\", the path is resolved relative to the folder of the file that contains\n+ * the \"extends\" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be\n+ * resolved using NodeJS require().\n+ *\n+ * SUPPORTED TOKENS: none\n+ * DEFAULT VALUE: \"\"\n+ */\n+ // \"extends\": \"./shared/api-extractor-base.json\"\n+ // \"extends\": \"my-package/include/api-extractor-base.json\"\n+\n+ /**\n+ * Determines the \"<projectFolder>\" token that can be used with other config file settings. The project folder\n+ * typically contains the tsconfig.json and package.json config files, but the path is user-defined.\n+ *\n+ * The path is resolved relative to the folder of the config file that contains the setting.\n+ *\n+ * The default value for \"projectFolder\" is the token \"<lookup>\", which means the folder is determined by traversing\n+ * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder\n+ * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error\n+ * will be reported.\n+ *\n+ * SUPPORTED TOKENS: <lookup>\n+ * DEFAULT VALUE: \"<lookup>\"\n+ */\n+ //\"projectFolder\": \"..\",\n+\n+ /**\n+ * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor\n+ * analyzes the symbols exported by this module.\n+ *\n+ * The file extension must be \".d.ts\" and not \".ts\".\n+ *\n+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,\n+ * prepend a folder token such as \"<projectFolder>\".\n+ *\n+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>\n+ */\n+ \"mainEntryPointFilePath\": \"<projectFolder>/dist/index.d.ts\",\n+\n+ /**\n+ * A list of NPM package names whose exports should be treated as part of this package.\n+ *\n+ * For example, suppose that Webpack is used to generate a distributed bundle for the project \"library1\",\n+ * and another NPM package \"library2\" is embedded in this bundle. Some types from library2 may become part\n+ * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly\n+ * imports library2. To avoid this, we can specify:\n+ *\n+ * \"bundledPackages\": [ \"library2\" ],\n+ *\n+ * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been\n+ * local files for library1.\n+ */\n+ \"bundledPackages\": [],\n+\n+ /**\n+ * Determines how the TypeScript compiler engine will be invoked by API Extractor.\n+ */\n+ \"compiler\": {\n+ /**\n+ * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.\n+ *\n+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,\n+ * prepend a folder token such as \"<projectFolder>\".\n+ *\n+ * Note: This setting will be ignored if \"overrideTsconfig\" is used.\n+ *\n+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>\n+ * DEFAULT VALUE: \"<projectFolder>/tsconfig.json\"\n+ */\n+ // \"tsconfigFilePath\": \"<projectFolder>/tsconfig.json\",\n+ /**\n+ * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.\n+ * The object must conform to the TypeScript tsconfig schema:\n+ *\n+ * http://json.schemastore.org/tsconfig\n+ *\n+ * If omitted, then the tsconfig.json file will be read from the \"projectFolder\".\n+ *\n+ * DEFAULT VALUE: no overrideTsconfig section\n+ */\n+ // \"overrideTsconfig\": {\n+ // . . .\n+ // }\n+ /**\n+ * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended\n+ * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when\n+ * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses\n+ * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.\n+ *\n+ * DEFAULT VALUE: false\n+ */\n+ // \"skipLibCheck\": true,\n+ },\n+\n+ /**\n+ * Configures how the API report file (*.api.md) will be generated.\n+ */\n+ \"apiReport\": {\n+ /**\n+ * (REQUIRED) Whether to generate an API report.\n+ */\n+ \"enabled\": false\n+\n+ /**\n+ * The filename for the API report files. It will be combined with \"reportFolder\" or \"reportTempFolder\" to produce\n+ * a full file path.\n+ *\n+ * The file extension should be \".api.md\", and the string should not contain a path separator such as \"\\\" or \"/\".\n+ *\n+ * SUPPORTED TOKENS: <packageName>, <unscopedPackageName>\n+ * DEFAULT VALUE: \"<unscopedPackageName>.api.md\"\n+ */\n+ // \"reportFileName\": \"<unscopedPackageName>.api.md\",\n+\n+ /**\n+ * Specifies the folder where the API report file is written. The file name portion is determined by\n+ * the \"reportFileName\" setting.\n+ *\n+ * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,\n+ * e.g. for an API review.\n+ *\n+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,\n+ * prepend a folder token such as \"<projectFolder>\".\n+ *\n+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>\n+ * DEFAULT VALUE: \"<projectFolder>/etc/\"\n+ */\n+ // \"reportFolder\": \"<projectFolder>/etc/\",\n+\n+ /**\n+ * Specifies the folder where the temporary report file is written. The file name portion is determined by\n+ * the \"reportFileName\" setting.\n+ *\n+ * After the temporary file is written to disk, it is compared with the file in the \"reportFolder\".\n+ * If they are different, a production build will fail.\n+ *\n+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,\n+ * prepend a folder token such as \"<projectFolder>\".\n+ *\n+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>\n+ * DEFAULT VALUE: \"<projectFolder>/temp/\"\n+ */\n+ // \"reportTempFolder\": \"<projectFolder>/temp/\"\n+ },\n+\n+ /**\n+ * Configures how the doc model file (*.api.json) will be generated.\n+ */\n+ \"docModel\": {\n+ /**\n+ * (REQUIRED) Whether to generate a doc model file.\n+ */\n+ \"enabled\": true,\n+\n+ /**\n+ * The output path for the doc model file. The file extension should be \".api.json\".\n+ *\n+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,\n+ * prepend a folder token such as \"<projectFolder>\".\n+ *\n+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>\n+ * DEFAULT VALUE: \"<projectFolder>/temp/<unscopedPackageName>.api.json\"\n+ */\n+ \"apiJsonFilePath\": \"<projectFolder>/../../docs/<unscopedPackageName>.api.json\"\n+ },\n+\n+ /**\n+ * Configures how the .d.ts rollup file will be generated.\n+ */\n+ \"dtsRollup\": {\n+ /**\n+ * (REQUIRED) Whether to generate the .d.ts rollup file.\n+ */\n+ \"enabled\": false\n+\n+ /**\n+ * Specifies the output path for a .d.ts rollup file to be generated without any trimming.\n+ * This file will include all declarations that are exported by the main entry point.\n+ *\n+ * If the path is an empty string, then this file will not be written.\n+ *\n+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,\n+ * prepend a folder token such as \"<projectFolder>\".\n+ *\n+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>\n+ * DEFAULT VALUE: \"<projectFolder>/dist/<unscopedPackageName>.d.ts\"\n+ */\n+ // \"untrimmedFilePath\": \"<projectFolder>/dist/<unscopedPackageName>.d.ts\",\n+\n+ /**\n+ * Specifies the output path for a .d.ts rollup file to be generated with trimming for a \"beta\" release.\n+ * This file will include only declarations that are marked as \"@public\" or \"@beta\".\n+ *\n+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,\n+ * prepend a folder token such as \"<projectFolder>\".\n+ *\n+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>\n+ * DEFAULT VALUE: \"\"\n+ */\n+ // \"betaTrimmedFilePath\": \"<projectFolder>/dist/<unscopedPackageName>-beta.d.ts\",\n+\n+ /**\n+ * Specifies the output path for a .d.ts rollup file to be generated with trimming for a \"public\" release.\n+ * This file will include only declarations that are marked as \"@public\".\n+ *\n+ * If the path is an empty string, then this file will not be written.\n+ *\n+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,\n+ * prepend a folder token such as \"<projectFolder>\".\n+ *\n+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>\n+ * DEFAULT VALUE: \"\"\n+ */\n+ // \"publicTrimmedFilePath\": \"<projectFolder>/dist/<unscopedPackageName>-public.d.ts\",\n+\n+ /**\n+ * When a declaration is trimmed, by default it will be replaced by a code comment such as\n+ * \"Excluded from this release type: exampleMember\". Set \"omitTrimmingComments\" to true to remove the\n+ * declaration completely.\n+ *\n+ * DEFAULT VALUE: false\n+ */\n+ // \"omitTrimmingComments\": true\n+ },\n+\n+ /**\n+ * Configures how the tsdoc-metadata.json file will be generated.\n+ */\n+ \"tsdocMetadata\": {\n+ /**\n+ * Whether to generate the tsdoc-metadata.json file.\n+ *\n+ * DEFAULT VALUE: true\n+ */\n+ // \"enabled\": true,\n+ /**\n+ * Specifies where the TSDoc metadata file should be written.\n+ *\n+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,\n+ * prepend a folder token such as \"<projectFolder>\".\n+ *\n+ * The default value is \"<lookup>\", which causes the path to be automatically inferred from the \"tsdocMetadata\",\n+ * \"typings\" or \"main\" fields of the project's package.json. If none of these fields are set, the lookup\n+ * falls back to \"tsdoc-metadata.json\" in the package folder.\n+ *\n+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>\n+ * DEFAULT VALUE: \"<lookup>\"\n+ */\n+ // \"tsdocMetadataFilePath\": \"<projectFolder>/dist/tsdoc-metadata.json\"\n+ },\n+\n+ /**\n+ * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files\n+ * will be written with Windows-style newlines. To use POSIX-style newlines, specify \"lf\" instead.\n+ * To use the OS's default newline kind, specify \"os\".\n+ *\n+ * DEFAULT VALUE: \"crlf\"\n+ */\n+ // \"newlineKind\": \"crlf\",\n+\n+ /**\n+ * Configures how API Extractor reports error and warning messages produced during analysis.\n+ *\n+ * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.\n+ */\n+ \"messages\": {\n+ /**\n+ * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing\n+ * the input .d.ts files.\n+ *\n+ * TypeScript message identifiers start with \"TS\" followed by an integer. For example: \"TS2551\"\n+ *\n+ * DEFAULT VALUE: A single \"default\" entry with logLevel=warning.\n+ */\n+ \"compilerMessageReporting\": {\n+ /**\n+ * Configures the default routing for messages that don't match an explicit rule in this table.\n+ */\n+ \"default\": {\n+ /**\n+ * Specifies whether the message should be written to the the tool's output log. Note that\n+ * the \"addToApiReportFile\" property may supersede this option.\n+ *\n+ * Possible values: \"error\", \"warning\", \"none\"\n+ *\n+ * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail\n+ * and return a nonzero exit code. For a non-production build (e.g. when \"api-extractor run\" includes\n+ * the \"--local\" option), the warning is displayed but the build will not fail.\n+ *\n+ * DEFAULT VALUE: \"warning\"\n+ */\n+ \"logLevel\": \"warning\"\n+\n+ /**\n+ * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),\n+ * then the message will be written inside that file; otherwise, the message is instead logged according to\n+ * the \"logLevel\" option.\n+ *\n+ * DEFAULT VALUE: false\n+ */\n+ // \"addToApiReportFile\": false\n+ }\n+\n+ // \"TS2551\": {\n+ // \"logLevel\": \"warning\",\n+ // \"addToApiReportFile\": true\n+ // },\n+ //\n+ // . . .\n+ },\n+\n+ /**\n+ * Configures handling of messages reported by API Extractor during its analysis.\n+ *\n+ * API Extractor message identifiers start with \"ae-\". For example: \"ae-extra-release-tag\"\n+ *\n+ * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings\n+ */\n+ \"extractorMessageReporting\": {\n+ \"default\": {\n+ \"logLevel\": \"warning\"\n+ // \"addToApiReportFile\": false\n+ },\n+ \"ae-missing-release-tag\": {\n+ \"logLevel\": \"none\"\n+ }\n+ // \"ae-extra-release-tag\": {\n+ // \"logLevel\": \"warning\",\n+ // \"addToApiReportFile\": true\n+ // },\n+ //\n+ // . . .\n+ },\n+\n+ /**\n+ * Configures handling of messages reported by the TSDoc parser when analyzing code comments.\n+ *\n+ * TSDoc message identifiers start with \"tsdoc-\". For example: \"tsdoc-link-tag-unescaped-text\"\n+ *\n+ * DEFAULT VALUE: A single \"default\" entry with logLevel=warning.\n+ */\n+ \"tsdocMessageReporting\": {\n+ \"default\": {\n+ \"logLevel\": \"warning\"\n+ // \"addToApiReportFile\": false\n+ }\n+\n+ // \"tsdoc-link-tag-unescaped-text\": {\n+ // \"logLevel\": \"warning\",\n+ // \"addToApiReportFile\": true\n+ // },\n+ //\n+ // . . .\n+ }\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "npmlog \"^4.1.2\"\nwrite-file-atomic \"^2.3.0\"\n+\"@microsoft/api-documenter@^7.8.21\":\n+ version \"7.8.21\"\n+ resolved \"https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.8.21.tgz#96dba0c1b6b7db9c1acae9dd1e32e801cdecb853\"\n+ integrity sha512-ffrJEVNykhSVJL8W/fX95GOF8LsG1BjVjp1exGVdmKltrmpDAlFL6WVs24ii1WUY62lcIjMqgBK4F9DszFZ5UQ==\n+ dependencies:\n+ \"@microsoft/api-extractor-model\" \"7.8.12\"\n+ \"@microsoft/tsdoc\" \"0.12.19\"\n+ \"@rushstack/node-core-library\" \"3.25.0\"\n+ \"@rushstack/ts-command-line\" \"4.4.6\"\n+ colors \"~1.2.1\"\n+ js-yaml \"~3.13.1\"\n+ resolve \"~1.17.0\"\n+\n+\"@microsoft/[email protected]\":\n+ version \"7.8.12\"\n+ resolved \"https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.8.12.tgz#d089193ef29275b8b20802498c6bdfab80dcef59\"\n+ integrity sha512-lE9xcNStS2hf5K+ZQy4L9DQ9Xd62bNsMqW+SyPQWXuQ5HJqUBSXJ2yxCWXP/+rcAkFCvZrikbql9M8Z88nKvwQ==\n+ dependencies:\n+ \"@microsoft/tsdoc\" \"0.12.19\"\n+ \"@rushstack/node-core-library\" \"3.25.0\"\n+\n+\"@microsoft/api-extractor@^7.9.2\":\n+ version \"7.9.2\"\n+ resolved \"https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.9.2.tgz#3bb8c93f4280fcb94171e4214d714e1639f4fbd4\"\n+ integrity sha512-R4b3zXlYdicoS8bRLXEChTKLPyhUHrG1cb0GDtOX0zdoxlovU1p0JaPt97A/vC7N3Gm2E8gd2qsDWElKU3/wKQ==\n+ dependencies:\n+ \"@microsoft/api-extractor-model\" \"7.8.12\"\n+ \"@microsoft/tsdoc\" \"0.12.19\"\n+ \"@rushstack/node-core-library\" \"3.25.0\"\n+ \"@rushstack/ts-command-line\" \"4.4.6\"\n+ colors \"~1.2.1\"\n+ lodash \"~4.17.15\"\n+ resolve \"~1.17.0\"\n+ semver \"~7.3.0\"\n+ source-map \"~0.6.1\"\n+ typescript \"~3.9.5\"\n+\n\"@microsoft/[email protected]\":\nversion \"0.13.5\"\nresolved \"https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.13.5.tgz#2efeb27f5e4d191b8356aa4eb09e146c0813070c\"\njju \"~1.4.0\"\nresolve \"~1.12.0\"\n+\"@microsoft/[email protected]\":\n+ version \"0.12.19\"\n+ resolved \"https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.19.tgz#2173ccb92469aaf62031fa9499d21b16d07f9b57\"\n+ integrity sha512-IpgPxHrNxZiMNUSXqR1l/gePKPkfAmIKoDRP9hp7OwjU29ZR8WCJsOJ8iBKgw0Qk+pFwR+8Y1cy8ImLY6e9m4A==\n+\n\"@microsoft/[email protected]\":\nversion \"0.12.20\"\nresolved \"https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.20.tgz#4261285f666ee0c0378f810585dd4ec5bbfa8852\"\ndependencies:\nestree-walker \"^1.0.1\"\n+\"@rushstack/[email protected]\":\n+ version \"3.25.0\"\n+ resolved \"https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.25.0.tgz#ba40bc1b188ab5d31f5705999cd2b3b56b8a32cf\"\n+ integrity sha512-e2NCFtAu/eu14b8nlzRX6ZrE9Sb3J2wVt+pninQmTn/IgfnRLAtM0D4PzUO4+ktZwF9fCnpqrOGokLzw6RSVNw==\n+ dependencies:\n+ \"@types/node\" \"10.17.13\"\n+ colors \"~1.2.1\"\n+ fs-extra \"~7.0.1\"\n+ jju \"~1.4.0\"\n+ semver \"~7.3.0\"\n+ timsort \"~0.3.0\"\n+ z-schema \"~3.18.3\"\n+\n+\"@rushstack/[email protected]\":\n+ version \"4.4.6\"\n+ resolved \"https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.4.6.tgz#7818f19e444274e68564a756ef62a2b4e0ced0f8\"\n+ integrity sha512-ue3p2m773Yea/s4Ef2Q3gEyLd9T0NDjXCl+PlodGTrJHgxoiRwbROSWHAdYJL/LceGWa6Biqizu9qxUDEWFweQ==\n+ dependencies:\n+ \"@types/argparse\" \"1.0.38\"\n+ argparse \"~1.0.9\"\n+ colors \"~1.2.1\"\n+\n\"@sinonjs/commons@^1\", \"@sinonjs/commons@^1.3.0\", \"@sinonjs/commons@^1.4.0\", \"@sinonjs/commons@^1.7.0\":\nversion \"1.7.1\"\nresolved \"https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.7.1.tgz#da5fd19a5f71177a53778073978873964f49acf1\"\nresolved \"https://registry.yarnpkg.com/@tootallnate/once/-/once-1.0.0.tgz#9c13c2574c92d4503b005feca8f2e16cc1611506\"\nintegrity sha512-KYyTT/T6ALPkIRd2Ge080X/BsXvy9O0hcWTtMWkPvwAwF99+vn6Dv4GzrFT/Nn1LePr+FFDbRXXlqmsy9lw2zA==\n+\"@types/[email protected]\":\n+ version \"1.0.38\"\n+ resolved \"https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9\"\n+ integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==\n+\n\"@types/chai@^4.2.5\":\nversion \"4.2.10\"\nresolved \"https://registry.yarnpkg.com/@types/chai/-/chai-4.2.10.tgz#1122da40faabb81795580dc9f06c1e71e2ebbbe4\"\nresolved \"https://registry.yarnpkg.com/@types/node/-/node-13.7.7.tgz#1628e6461ba8cc9b53196dfeaeec7b07fa6eea99\"\nintegrity sha512-Uo4chgKbnPNlxQwoFmYIwctkQVkMMmsAoGGU4JKwLuvBefF0pCq4FybNSnfkfRCpC7ZW7kttcC/TrRtAJsvGtg==\n+\"@types/[email protected]\":\n+ version \"10.17.13\"\n+ resolved \"https://registry.yarnpkg.com/@types/node/-/node-10.17.13.tgz#ccebcdb990bd6139cd16e84c39dc2fb1023ca90c\"\n+ integrity sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg==\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@@ -1318,7 +1392,7 @@ arg@^4.1.0:\nresolved \"https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089\"\nintegrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==\n-argparse@^1.0.7:\n+argparse@^1.0.7, argparse@~1.0.9:\nversion \"1.0.10\"\nresolved \"https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911\"\nintegrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==\n@@ -1816,6 +1890,11 @@ color-name@~1.1.4:\nresolved \"https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2\"\nintegrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==\n+colors@~1.2.1:\n+ version \"1.2.5\"\n+ resolved \"https://registry.yarnpkg.com/colors/-/colors-1.2.5.tgz#89c7ad9a374bc030df8013241f68136ed8835afc\"\n+ integrity sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==\n+\ncolumnify@^1.5.4:\nversion \"1.5.4\"\nresolved \"https://registry.yarnpkg.com/columnify/-/columnify-1.5.4.tgz#4737ddf1c7b69a8a7c340570782e947eec8e78bb\"\n@@ -1841,7 +1920,7 @@ command-line-args@^5.1.1:\nlodash.camelcase \"^4.3.0\"\ntypical \"^4.0.0\"\n-commander@^2.20.0, commander@~2.20.3:\n+commander@^2.20.0, commander@^2.7.1, commander@~2.20.3:\nversion \"2.20.3\"\nresolved \"https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33\"\nintegrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==\n@@ -2866,6 +2945,15 @@ [email protected], fs-extra@^8.1.0:\njsonfile \"^4.0.0\"\nuniversalify \"^0.1.0\"\n+fs-extra@~7.0.1:\n+ version \"7.0.1\"\n+ resolved \"https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9\"\n+ integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==\n+ dependencies:\n+ graceful-fs \"^4.1.2\"\n+ jsonfile \"^4.0.0\"\n+ universalify \"^0.1.0\"\n+\nfs-minipass@^1.2.5:\nversion \"1.2.7\"\nresolved \"https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7\"\n@@ -3777,7 +3865,7 @@ js-tokens@^4.0.0:\nresolved \"https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499\"\nintegrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==\[email protected], js-yaml@^3.13.1:\[email protected], js-yaml@^3.13.1, js-yaml@~3.13.1:\nversion \"3.13.1\"\nresolved \"https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847\"\nintegrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==\n@@ -3978,11 +4066,16 @@ lodash.flattendeep@^4.4.0:\nresolved \"https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2\"\nintegrity sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=\n-lodash.get@^4.4.2:\n+lodash.get@^4.0.0, lodash.get@^4.4.2:\nversion \"4.4.2\"\nresolved \"https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99\"\nintegrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=\n+lodash.isequal@^4.0.0:\n+ version \"4.5.0\"\n+ resolved \"https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0\"\n+ integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA=\n+\nlodash.ismatch@^4.4.0:\nversion \"4.4.0\"\nresolved \"https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37\"\n@@ -4018,7 +4111,7 @@ lodash.uniq@^4.5.0:\nresolved \"https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773\"\nintegrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=\n-lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.2.1:\n+lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.2.1, lodash@~4.17.15:\nversion \"4.17.19\"\nresolved \"https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b\"\nintegrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==\n@@ -5484,6 +5577,13 @@ resolve@~1.12.0:\ndependencies:\npath-parse \"^1.0.6\"\n+resolve@~1.17.0:\n+ version \"1.17.0\"\n+ resolved \"https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444\"\n+ integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==\n+ dependencies:\n+ path-parse \"^1.0.6\"\n+\nrestore-cursor@^2.0.0:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf\"\n@@ -5656,6 +5756,11 @@ semver@^7.1.1:\nresolved \"https://registry.yarnpkg.com/semver/-/semver-7.1.3.tgz#e4345ce73071c53f336445cfc19efb1c311df2a6\"\nintegrity sha512-ekM0zfiA9SCBlsKa2X1hxyxiI4L3B6EbVJkkdgQXnSEEaHlGdvyodMruTiulSRWMMB4NeIuYNMC9rTKTz97GxA==\n+semver@~7.3.0:\n+ version \"7.3.2\"\n+ resolved \"https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938\"\n+ integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==\n+\nserialize-javascript@^2.1.2:\nversion \"2.1.2\"\nresolved \"https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61\"\n@@ -6262,6 +6367,11 @@ through@2, \"through@>=2.2.7 <3\", through@^2.3.4, through@^2.3.6:\nresolved \"https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5\"\nintegrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=\n+timsort@~0.3.0:\n+ version \"0.3.0\"\n+ resolved \"https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4\"\n+ integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=\n+\ntmp@^0.0.33:\nversion \"0.0.33\"\nresolved \"https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9\"\n@@ -6436,6 +6546,11 @@ typescript@^3.7.4:\nresolved \"https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061\"\nintegrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==\n+typescript@~3.9.5:\n+ version \"3.9.7\"\n+ resolved \"https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa\"\n+ integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==\n+\ntypical@^4.0.0:\nversion \"4.0.0\"\nresolved \"https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4\"\n@@ -6574,6 +6689,11 @@ validate-npm-package-name@^3.0.0:\ndependencies:\nbuiltins \"^1.0.3\"\n+validator@^8.0.0:\n+ version \"8.2.0\"\n+ resolved \"https://registry.yarnpkg.com/validator/-/validator-8.2.0.tgz#3c1237290e37092355344fef78c231249dab77b9\"\n+ integrity sha512-Yw5wW34fSv5spzTXNkokD6S6/Oq92d8q/t14TqsS3fAiA1RYnxSFSIZ+CY3n6PGGRCq5HhJTSepQvFUS2QUDxA==\n+\[email protected]:\nversion \"1.10.0\"\nresolved \"https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400\"\n@@ -6822,3 +6942,14 @@ [email protected]:\nversion \"3.1.1\"\nresolved \"https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50\"\nintegrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==\n+\n+z-schema@~3.18.3:\n+ version \"3.18.4\"\n+ resolved \"https://registry.yarnpkg.com/z-schema/-/z-schema-3.18.4.tgz#ea8132b279533ee60be2485a02f7e3e42541a9a2\"\n+ integrity sha512-DUOKC/IhbkdLKKiV89gw9DUauTV8U/8yJl1sjf6MtDmzevLKOF2duNJ495S3MFVjqZarr+qNGCPbkg4mu4PpLw==\n+ dependencies:\n+ lodash.get \"^4.0.0\"\n+ lodash.isequal \"^4.0.0\"\n+ validator \"^8.0.0\"\n+ optionalDependencies:\n+ commander \"^2.7.1\"\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: use api-extractor and api-generator to generate API documentation
305,159
26.07.2020 22:40:55
-7,200
89d6c22e60765674de738367f6d752eea8d009f4
chore: repair malformed doc in swagger.yml
[ { "change_type": "MODIFY", "old_path": "packages/apis/resources/operations.json", "new_path": "packages/apis/resources/operations.json", "diff": "},\n{\n\"name\": \"id\",\n- \"description\": \"List of dashboard IDs to return. If both `id and `owner` are specified, only `id` is used.\",\n+ \"description\": \"List of dashboard IDs to return. If both `id` and `owner` are specified, only `id` is used.\",\n\"type\": \"any\"\n},\n{\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/resources/swagger.yml", "new_path": "packages/apis/resources/swagger.yml", "diff": "@@ -2449,7 +2449,7 @@ paths:\n- \"UpdatedAt\"\n- in: query\nname: id\n- description: List of dashboard IDs to return. If both `id and `owner` are specified, only `id` is used.\n+ description: List of dashboard IDs to return. If both `id` and `owner` are specified, only `id` is used.\nschema:\ntype: array\nitems:\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: repair malformed doc in swagger.yml
305,159
26.07.2020 22:41:58
-7,200
cef682dab769a2d87c9d0048737c3faaf47968a6
chore(docs): add gh-pages
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"apidoc\": \"yarn clean && yarn build && yarn apidoc:extract && yarn apidoc:generate\",\n\"apidoc:extract\": \"yarn workspaces run apidoc:extract\",\n\"apidoc:generate\": \"api-documenter markdown -i docs -o docs/dist\",\n+ \"apidoc:gh-pages\": \"gh-pages -d docs/dist\",\n\"preinstall\": \"node ./scripts/require-yarn.js\",\n\"clean\": \"rimraf temp docs && yarn workspaces run clean\",\n\"build\": \"cd packages/core && yarn build && cd ../apis && yarn build\",\n\"license\": \"MIT\",\n\"dependencies\": {\n\"@microsoft/api-documenter\": \"^7.8.21\",\n+ \"gh-pages\": \"^3.1.0\",\n\"lerna\": \"^3.20.2\",\n\"prettier\": \"^1.19.1\",\n\"rimraf\": \"^3.0.0\",\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -1444,7 +1444,7 @@ array-ify@^1.0.0:\nresolved \"https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece\"\nintegrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=\n-array-union@^1.0.2:\n+array-union@^1.0.1, array-union@^1.0.2:\nversion \"1.0.2\"\nresolved \"https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39\"\nintegrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=\n@@ -1503,6 +1503,13 @@ astral-regex@^1.0.0:\nresolved \"https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9\"\nintegrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==\n+async@^2.6.1:\n+ version \"2.6.3\"\n+ resolved \"https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff\"\n+ integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==\n+ dependencies:\n+ lodash \"^4.17.14\"\n+\nasynckit@^0.4.0:\nversion \"0.4.0\"\nresolved \"https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79\"\n@@ -1920,7 +1927,7 @@ command-line-args@^5.1.1:\nlodash.camelcase \"^4.3.0\"\ntypical \"^4.0.0\"\n-commander@^2.20.0, commander@^2.7.1, commander@~2.20.3:\n+commander@^2.18.0, commander@^2.20.0, commander@^2.7.1, commander@~2.20.3:\nversion \"2.20.3\"\nresolved \"https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33\"\nintegrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==\n@@ -2395,6 +2402,11 @@ ecc-jsbn@~0.1.1:\njsbn \"~0.1.0\"\nsafer-buffer \"^2.1.0\"\n+email-addresses@^3.0.1:\n+ version \"3.1.0\"\n+ resolved \"https://registry.yarnpkg.com/email-addresses/-/email-addresses-3.1.0.tgz#cabf7e085cbdb63008a70319a74e6136188812fb\"\n+ integrity sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==\n+\nemoji-regex@^7.0.1:\nversion \"7.0.3\"\nresolved \"https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156\"\n@@ -2484,7 +2496,7 @@ es6-promisify@^5.0.0:\ndependencies:\nes6-promise \"^4.0.3\"\[email protected], escape-string-regexp@^1.0.5:\[email protected], escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:\nversion \"1.0.5\"\nresolved \"https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4\"\nintegrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=\n@@ -2793,6 +2805,28 @@ file-entry-cache@^5.0.1:\ndependencies:\nflat-cache \"^2.0.1\"\n+filename-reserved-regex@^1.0.0:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz#e61cf805f0de1c984567d0386dc5df50ee5af7e4\"\n+ integrity sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q=\n+\n+filenamify-url@^1.0.0:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/filenamify-url/-/filenamify-url-1.0.0.tgz#b32bd81319ef5863b73078bed50f46a4f7975f50\"\n+ integrity sha1-syvYExnvWGO3MHi+1Q9GpPeXX1A=\n+ dependencies:\n+ filenamify \"^1.0.0\"\n+ humanize-url \"^1.0.0\"\n+\n+filenamify@^1.0.0:\n+ version \"1.2.1\"\n+ resolved \"https://registry.yarnpkg.com/filenamify/-/filenamify-1.2.1.tgz#a9f2ffd11c503bed300015029272378f1f1365a5\"\n+ integrity sha1-qfL/0RxQO+0wABUCknI3jx8TZaU=\n+ dependencies:\n+ filename-reserved-regex \"^1.0.0\"\n+ strip-outer \"^1.0.0\"\n+ trim-repeated \"^1.0.0\"\n+\nfill-range@^4.0.0:\nversion \"4.0.0\"\nresolved \"https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7\"\n@@ -2828,6 +2862,15 @@ find-cache-dir@^3.0.0:\nmake-dir \"^3.0.2\"\npkg-dir \"^4.1.0\"\n+find-cache-dir@^3.3.1:\n+ version \"3.3.1\"\n+ resolved \"https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880\"\n+ integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==\n+ dependencies:\n+ commondir \"^1.0.1\"\n+ make-dir \"^3.0.2\"\n+ pkg-dir \"^4.1.0\"\n+\nfind-replace@^3.0.0:\nversion \"3.0.0\"\nresolved \"https://registry.yarnpkg.com/find-replace/-/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38\"\n@@ -3060,6 +3103,19 @@ getpass@^0.1.1:\ndependencies:\nassert-plus \"^1.0.0\"\n+gh-pages@^3.1.0:\n+ version \"3.1.0\"\n+ resolved \"https://registry.yarnpkg.com/gh-pages/-/gh-pages-3.1.0.tgz#ec3ed0f6a6e3fc3d888758fa018f08191c96bd55\"\n+ integrity sha512-3b1rly9kuf3/dXsT8+ZxP0UhNLOo1CItj+3e31yUVcaph/yDsJ9RzD7JOw5o5zpBTJVQLlJAASNkUfepi9fe2w==\n+ dependencies:\n+ async \"^2.6.1\"\n+ commander \"^2.18.0\"\n+ email-addresses \"^3.0.1\"\n+ filenamify-url \"^1.0.0\"\n+ find-cache-dir \"^3.3.1\"\n+ fs-extra \"^8.1.0\"\n+ globby \"^6.1.0\"\n+\[email protected]:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.0.tgz#d92addf74440c14bcc5c83ecce3fb7f8a79118b5\"\n@@ -3141,7 +3197,7 @@ [email protected]:\nonce \"^1.3.0\"\npath-is-absolute \"^1.0.0\"\n-glob@^7.0.0, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:\n+glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:\nversion \"7.1.6\"\nresolved \"https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6\"\nintegrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==\n@@ -3179,6 +3235,17 @@ globby@^10.0.1:\nmerge2 \"^1.2.3\"\nslash \"^3.0.0\"\n+globby@^6.1.0:\n+ version \"6.1.0\"\n+ resolved \"https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c\"\n+ integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=\n+ dependencies:\n+ array-union \"^1.0.1\"\n+ glob \"^7.0.3\"\n+ object-assign \"^4.0.1\"\n+ pify \"^2.0.0\"\n+ pinkie-promise \"^2.0.0\"\n+\nglobby@^9.2.0:\nversion \"9.2.0\"\nresolved \"https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d\"\n@@ -3378,6 +3445,14 @@ humanize-ms@^1.2.1:\ndependencies:\nms \"^2.0.0\"\n+humanize-url@^1.0.0:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/humanize-url/-/humanize-url-1.0.1.tgz#f4ab99e0d288174ca4e1e50407c55fbae464efff\"\n+ integrity sha1-9KuZ4NKIF0yk4eUEB8VfuuRk7/8=\n+ dependencies:\n+ normalize-url \"^1.0.0\"\n+ strip-url-auth \"^1.0.0\"\n+\niconv-lite@^0.4.24, iconv-lite@~0.4.13:\nversion \"0.4.24\"\nresolved \"https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b\"\n@@ -4669,6 +4744,16 @@ normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package-\nsemver \"2 || 3 || 4 || 5\"\nvalidate-npm-package-license \"^3.0.1\"\n+normalize-url@^1.0.0:\n+ version \"1.9.1\"\n+ resolved \"https://registry.yarnpkg.com/normalize-url/-/normalize-url-1.9.1.tgz#2cc0d66b31ea23036458436e3620d85954c66c3c\"\n+ integrity sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=\n+ dependencies:\n+ object-assign \"^4.0.1\"\n+ prepend-http \"^1.0.0\"\n+ query-string \"^4.1.0\"\n+ sort-keys \"^1.0.0\"\n+\nnormalize-url@^3.3.0:\nversion \"3.3.0\"\nresolved \"https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559\"\n@@ -5205,6 +5290,11 @@ prelude-ls@~1.1.2:\nresolved \"https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54\"\nintegrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=\n+prepend-http@^1.0.0:\n+ version \"1.0.4\"\n+ resolved \"https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc\"\n+ integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=\n+\nprettier-linter-helpers@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b\"\n@@ -5319,6 +5409,14 @@ qs@~6.5.2:\nresolved \"https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36\"\nintegrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==\n+query-string@^4.1.0:\n+ version \"4.3.4\"\n+ resolved \"https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb\"\n+ integrity sha1-u7aTucqRXCMlFbIosaArYJBD2+s=\n+ dependencies:\n+ object-assign \"^4.1.0\"\n+ strict-uri-encode \"^1.0.0\"\n+\nquick-lru@^1.0.0:\nversion \"1.1.0\"\nresolved \"https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8\"\n@@ -5914,6 +6012,13 @@ socks@~2.3.2:\nip \"1.1.5\"\nsmart-buffer \"^4.1.0\"\n+sort-keys@^1.0.0:\n+ version \"1.1.2\"\n+ resolved \"https://registry.yarnpkg.com/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad\"\n+ integrity sha1-RBttTTRnmPG05J6JIK37oOVD+a0=\n+ dependencies:\n+ is-plain-obj \"^1.0.0\"\n+\nsort-keys@^2.0.0:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/sort-keys/-/sort-keys-2.0.0.tgz#658535584861ec97d730d6cf41822e1f56684128\"\n@@ -6074,6 +6179,11 @@ stream-shift@^1.0.0:\nresolved \"https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d\"\nintegrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==\n+strict-uri-encode@^1.0.0:\n+ version \"1.1.0\"\n+ resolved \"https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713\"\n+ integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=\n+\nstring-argv@^0.3.1:\nversion \"0.3.1\"\nresolved \"https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da\"\n@@ -6211,6 +6321,18 @@ strip-json-comments@^3.0.1:\nresolved \"https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7\"\nintegrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==\n+strip-outer@^1.0.0:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/strip-outer/-/strip-outer-1.0.1.tgz#b2fd2abf6604b9d1e6013057195df836b8a9d631\"\n+ integrity sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==\n+ dependencies:\n+ escape-string-regexp \"^1.0.2\"\n+\n+strip-url-auth@^1.0.0:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/strip-url-auth/-/strip-url-auth-1.0.1.tgz#22b0fa3a41385b33be3f331551bbb837fa0cd7ae\"\n+ integrity sha1-IrD6OkE4WzO+PzMVUbu4N/oM164=\n+\nstrong-log-transformer@^2.0.0:\nversion \"2.1.0\"\nresolved \"https://registry.yarnpkg.com/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz#0f5ed78d325e0421ac6f90f7f10e691d6ae3ae10\"\n@@ -6446,6 +6568,13 @@ trim-off-newlines@^1.0.0:\nresolved \"https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3\"\nintegrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM=\n+trim-repeated@^1.0.0:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/trim-repeated/-/trim-repeated-1.0.0.tgz#e3646a2ea4e891312bf7eace6cfb05380bc01c21\"\n+ integrity sha1-42RqLqTokTEr9+rObPsFOAvAHCE=\n+ dependencies:\n+ escape-string-regexp \"^1.0.2\"\n+\nts-node@^8.5.4:\nversion \"8.6.2\"\nresolved \"https://registry.yarnpkg.com/ts-node/-/ts-node-8.6.2.tgz#7419a01391a818fbafa6f826a33c1a13e9464e35\"\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(docs): add gh-pages
305,159
26.07.2020 23:08:20
-7,200
91af5cc155824eeed83cd4eaf7831dee2e4b342b
chore(docs): use to generate links in API docs
[ { "change_type": "MODIFY", "old_path": "packages/core/src/InfluxDB.ts", "new_path": "packages/core/src/InfluxDB.ts", "diff": "@@ -9,7 +9,7 @@ import QueryApi from './QueryApi'\nimport QueryApiImpl from './impl/QueryApiImpl'\n/**\n- * InfluxDB 2.0 client that uses HTTP API described in https://v2.docs.influxdata.com/v2.0/reference/api/ .\n+ * InfluxDB 2.0 client that uses HTTP API described in {@link https://v2.docs.influxdata.com/v2.0/reference/api/ }.\n*/\nexport default class InfluxDB {\nprivate _options: ClientOptions\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/QueryApi.ts", "new_path": "packages/core/src/QueryApi.ts", "diff": "@@ -41,7 +41,7 @@ export interface Row {\n/**\n* Query InfluxDB 2.0. Provides methods that notify abouts result lines of the executed query.\n- * See https://v2.docs.influxdata.com/v2.0/api/#operation/PostQuery\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostQuery }\n*/\nexport default interface QueryApi {\n/**\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -98,7 +98,7 @@ export interface ClientOptions extends ConnectionOptions {\n/**\n* Precission for write operations.\n- * See https://v2.docs.influxdata.com/v2.0/api/#operation/PostWrite\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostWrite }\n*/\nexport const enum WritePrecision {\n/** nanosecond */\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableColumn.ts", "new_path": "packages/core/src/query/FluxTableColumn.ts", "diff": "/**\n- * Type of query result column, see https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/#valid-data-types\n+ * Type of query result column, see {@link https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/#valid-data-types }\n*/\nexport type ColumnType =\n| 'boolean'\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableMetaData.ts", "new_path": "packages/core/src/query/FluxTableMetaData.ts", "diff": "@@ -4,7 +4,7 @@ import {IllegalArgumentError} from '../errors'\nconst identity = (x: string): any => x\n/**\n* A dictionary of serializers of particular types returned by a flux query.\n- * See https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/#valid-data-types\n+ * See {@link https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/#valid-data-types }\n*/\nexport const typeSerializers: Record<ColumnType, (val: string) => any> = {\nboolean: (x: string): any => x === 'true',\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(docs): use @link to generate links in API docs
305,159
26.07.2020 23:47:43
-7,200
4f85c0b442d60af7584fdcd127cf5ffb09276b61
docs: add mising documentation to to-level core types
[ { "change_type": "MODIFY", "old_path": "packages/core/src/QueryApi.ts", "new_path": "packages/core/src/QueryApi.ts", "diff": "@@ -13,6 +13,7 @@ export function defaultRowMapping(\nreturn tableMeta.toObject(values)\n}\n+/** QueryOptions contains QueryApi configuration options. */\nexport interface QueryOptions {\n/**\n* Specifies the name of the organization executing the query. Takes either the ID or Name interchangeably.\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/errors.ts", "new_path": "packages/core/src/errors.ts", "diff": "@@ -28,10 +28,12 @@ export interface RetriableDecision {\n}\nconst retriableStatusCodes = [404, 408, 425, 429, 500, 502, 503, 504]\n+/** isStatusCodeRetriable checks whether the supplied HTTP status code is retriable. */\nexport function isStatusCodeRetriable(statusCode: number): boolean {\nreturn retriableStatusCodes.includes(statusCode)\n}\n+/** IllegalArgumentError is thrown when illegal argument is supplied. */\nexport class IllegalArgumentError extends Error {\n/* istanbul ignore next */\nconstructor(message: string) {\n@@ -132,6 +134,7 @@ export function getRetryDelay(error?: Error, retryJitter?: number): number {\n}\n}\n+/** RequestTimedOutError indicates request timeout in the communication with the server */\nexport class RequestTimedOutError extends Error implements RetriableDecision {\n/* istanbul ignore next because of super() not being covered */\nconstructor() {\n@@ -147,6 +150,7 @@ export class RequestTimedOutError extends Error implements RetriableDecision {\n}\n}\n+/** AbortError indicates that the communication with the server was aborted */\nexport class AbortError extends Error implements RetriableDecision {\n/* istanbul ignore next because of super() not being covered */\nconstructor() {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/observable/types.ts", "new_path": "packages/core/src/observable/types.ts", "diff": "@@ -2,6 +2,7 @@ export type ObserverNext<T> = (value: T) => void\nexport type ObserverError = (e: any) => void\nexport type ObserverComplete = () => void\n+/** Observer mimics Observer from ECMAScript TC39 Observable proposal */\nexport interface Observer<T> {\nnext: ObserverNext<T>\nerror: ObserverError\n@@ -28,6 +29,7 @@ export interface Observable<T> {\n/* [Symbol.observable](): Observable<T> */\n}\n+/** Subscription mimics Subscription from ECMAScript TC39 Observable proposal */\nexport interface Subscription {\nreadonly closed: boolean\nunsubscribe(): void\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableColumn.ts", "new_path": "packages/core/src/query/FluxTableColumn.ts", "diff": "@@ -11,6 +11,9 @@ export type ColumnType =\n| 'dateTime'\n| 'duration'\n+/**\n+ * FluxTableColumnLike provides metadata of a flux table column.\n+ */\nexport interface FluxTableColumnLike {\n/**\n* Label (e.g., \"_start\", \"_stop\", \"_time\").\n@@ -33,7 +36,7 @@ export interface FluxTableColumnLike {\ndefaultValue?: string\n}\n/**\n- * Column metadata of a [flux table](http://bit.ly/flux-spec#table).\n+ * Column metadata class of a [flux table](http://bit.ly/flux-spec#table) column.\n*/\nexport default class FluxTableColumn {\n/**\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/flux.ts", "new_path": "packages/core/src/query/flux.ts", "diff": "+/** Property that offers a function that returns flux-sanitized value of an object. */\nexport const FLUX_VALUE = Symbol('FLUX_VALUE')\n/**\n@@ -106,6 +107,12 @@ export function fluxInteger(value: any): FluxParameterLike {\nreturn new FluxParameter(val)\n}\n+/**\n+ * Sanitizes float value to avoid injections.\n+ * @param value - InfluxDB float literal\n+ * @returns sanitized float value\n+ * @throws Error if the the value cannot be sanitized\n+ */\nexport function sanitizeFloat(value: any): string {\nconst val = String(value)\nlet dot = false\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/util/currentTime.ts", "new_path": "packages/core/src/util/currentTime.ts", "diff": "-import {WritePrecision} from '../options'\n-\ndeclare let process: any\nconst zeroPadding = '000000000'\nlet useHrTime = false\n@@ -77,20 +75,22 @@ function seconds(): string {\n* depending on the js platform in use.\n*/\nexport const currentTime = Object.freeze({\n- [String(WritePrecision.s)]: seconds as () => string,\n- [String(WritePrecision.ms)]: millis as () => string,\n- [String(WritePrecision.us)]: micros as () => string,\n- [String(WritePrecision.ns)]: nanos as () => string,\n+ s: seconds as () => string,\n+ ms: millis as () => string,\n+ us: micros as () => string,\n+ ns: nanos as () => string,\nseconds: seconds as () => string,\nmillis: millis as () => string,\nmicros: micros as () => string,\nnanos: nanos as () => string,\n})\n+/**\n+ * dateToProtocolTimestamp provides converters for JavaScript Date to InfluxDB Write Protocol Timestamp. Keys are supported precisions.\n+ */\nexport const dateToProtocolTimestamp = {\n- [String(WritePrecision.s)]: (d: Date): string =>\n- `${Math.floor(d.getTime() / 1000)}`,\n- [String(WritePrecision.ms)]: (d: Date): string => `${d.getTime()}`,\n- [String(WritePrecision.us)]: (d: Date): string => `${d.getTime()}000`,\n- [String(WritePrecision.ns)]: (d: Date): string => `${d.getTime()}000000`,\n+ s: (d: Date): string => `${Math.floor(d.getTime() / 1000)}`,\n+ ms: (d: Date): string => `${d.getTime()}`,\n+ us: (d: Date): string => `${d.getTime()}000`,\n+ ns: (d: Date): string => `${d.getTime()}000000`,\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/util/escape.ts", "new_path": "packages/core/src/util/escape.ts", "diff": "@@ -91,6 +91,9 @@ const escaperConfig = new EscaperConfig(escapeChar)\nconst bindEsc = (e: Escaper): ((val: string) => string) => e.escape.bind(e)\n+/**\n+ * Provides functions escape specific parts in InfluxDB line protocol.\n+ */\nexport const escape = {\n/**\n* Measurement escapes measurement names.\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: add mising documentation to to-level core types
305,159
27.07.2020 05:50:12
-7,200
3f7b3f0508eff11d971cb1802aa85a1d3c05f016
feat(apidoc): correct cross references
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"scripts\": {\n\"apidoc\": \"yarn clean && yarn build && yarn apidoc:extract && yarn apidoc:generate\",\n- \"apidoc:extract\": \"yarn workspaces run apidoc:extract\",\n+ \"apidoc:extract\": \"yarn workspaces run apidoc:extract && node scripts/fix-extracted-api-files.js\",\n\"apidoc:generate\": \"api-documenter markdown -i docs -o docs/dist\",\n\"apidoc:gh-pages\": \"gh-pages -d docs/dist\",\n\"preinstall\": \"node ./scripts/require-yarn.js\",\n" }, { "change_type": "ADD", "old_path": null, "new_path": "scripts/fix-extracted-api-files.js", "diff": "+/* eslint-disable @typescript-eslint/explicit-function-return-type */\n+/* eslint-disable @typescript-eslint/no-var-requires */\n+const path = require('path')\n+const fs = require('fs')\n+\n+function replaceInExtractorFile(file) {\n+ console.log(`correct references in: ${file}`)\n+ const data = fs.readFileSync(file, 'utf8')\n+ const json = JSON.parse(data)\n+\n+ function replaceObject(obj) {\n+ if (typeof obj === 'object') {\n+ if (Array.isArray(obj)) {\n+ obj.forEach(replaceObject)\n+ } else {\n+ if (obj['kind'] === 'Reference') {\n+ const canonicalReference = obj['canonicalReference']\n+ if (canonicalReference.indexOf('!default:') > 0) {\n+ const text = obj['text']\n+ const replaced = canonicalReference.replace(\n+ /!(default):/,\n+ `!${text}:`\n+ )\n+ console.log(` ${canonicalReference} => ${replaced}`)\n+ obj.canonicalReference = replaced\n+ }\n+ } else {\n+ for (const key in obj) {\n+ replaceObject(obj[key])\n+ }\n+ }\n+ }\n+ }\n+ }\n+ replaceObject(json)\n+\n+ fs.writeFileSync(file, JSON.stringify(json, null, 2), 'utf8')\n+}\n+\n+const docsDir = path.resolve(__dirname, '..', 'docs')\n+const files = fs.readdirSync(docsDir).filter(x => /\\.api\\.json$/.test(x))\n+files.forEach(file => {\n+ replaceInExtractorFile(path.resolve(docsDir, file))\n+})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(apidoc): correct cross references
305,159
27.07.2020 07:46:52
-7,200
e275bc79c83f26d5a0eef3f632d0b893b44f01da
docs: add documentation and remarks to client packages
[ { "change_type": "MODIFY", "old_path": "packages/apis/src/index.ts", "new_path": "packages/apis/src/index.ts", "diff": "+/**\n+ * The `@influxdata/influxdb-client-apis` package provides all InfluxDB v2 APIs generated from its\n+ * {@link https://v2.docs.influxdata.com/v2.0/api/ | OpenAPI specification}.\n+ *\n+ * @remarks\n+ * These APIs allow to manage the domain objects of InfluxDB (such as buckets, sources, tasks, authorizations).\n+ * The APIs are constructed with `InfluxDB` instance that is populated with InfluxDB server parameters. All API\n+ * operations returns Promise of response data. And the majority of them relies upon simple exchange of JSON data.\n+ * For example:\n+ *\n+ * ```\n+ * ...\n+ * const {InfluxDB} = require('@influxdata/influxdb-client')\n+ * const {OrgsAPI} = require('@influxdata/influxdb-client-apis')\n+ * const influxDB = new InfluxDB({url: \"http://localhost:9999\", token: \"my-token\"})\n+ * ...\n+ * async function getOrg(name) {\n+ * const orgsAPI = new OrgsAPI(influxDB)\n+ * const organizations = await orgsAPI.getOrgs({org: \"my-org\"})\n+ * ...\n+ * ```\n+\n+ * Generated APIs that write or query InfluxDB are also herein, but it is recommended to use\n+ * {@link @influxdata/influxdb-client#WriteApi} and {@link @influxdata/influxdb-client#QueryApi}\n+ * from `@influxdata/influxdb-client`, they are much easier to use and offer specialized features\n+ * (write failover, line protocol serialization, flux results parsing, ...).\n+ *\n+ * See also {@link https://github.com/influxdata/influxdb-client-js/tree/master/examples | examples} to know more.\n+ *\n+ * @packageDocumentation\n+ */\nexport * from './generated'\nexport {RequestOptions} from './APIBase'\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/index.ts", "new_path": "packages/core/src/index.ts", "diff": "+/**\n+ * The `@influxdata/influxdb-client` package provides optimized APIs that write or query InfluxDB v2.\n+ *\n+ * @remarks\n+ * The entry point of this package is the {@link @influxdata/influxdb-client#InfluxDB } class. It is\n+ * initialized with options that tells how to communicate with InfluxDB. The simple usage pattern is:\n+ *\n+ * ```\n+ * import {InfluxDB} = from('@influxdata/influxdb-client')\n+ * const influxDB = new InfluxDB({url: \"http://localhost:9999\", token: \"your-api-token\"})\n+ * ```\n+ *\n+ * The influxDB object let you create two essential API instances, {@link @influxdata/influxdb-client#InfluxDB.getWriteApi }\n+ * and {@link @influxdata/influxdb-client#InfluxDB.getQueryApi }. The {@link @influxdata/influxdb-client#WriteApi}\n+ * asynchronously writes measurement points on background, in batches to optimize network traffic, and with retries\n+ * upon failures. The {@link @influxdata/influxdb-client#QueryApi} let you execute a flux query against InfluxDB\n+ * and offers several ways to stream query results.\n+ *\n+ * The influxDB object is also used to create more specialized InfluxDB management API instances in\n+ * {@link @influxdata/influxdb-client-apis# }\n+ *\n+ * See also {@link https://github.com/influxdata/influxdb-client-js/tree/master/examples | examples} to know more.\n+ *\n+ * @packageDocumentation\n+ */\nexport * from './options'\nexport * from './errors'\nexport * from './util/escape'\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: add documentation and remarks to client packages
305,159
27.07.2020 08:21:02
-7,200
e4523572426adb63974b29bcd2afe1d7b187d870
docs: add links to examples into InfluxDB docs
[ { "change_type": "MODIFY", "old_path": "packages/core/src/InfluxDB.ts", "new_path": "packages/core/src/InfluxDB.ts", "diff": "@@ -35,14 +35,21 @@ export default class InfluxDB {\n}\n/**\n- * Creates [[WriteApi]] for the supplied organization and bucket. BEWARE that returned instances must be closed\n+ * Creates WriteApi for the supplied organization and bucket. BEWARE that returned instances must be closed\n* in order to flush the remaining data and close already scheduled retry executions.\n*\n+ * @remarks\n+ * Inspect the {@link WriteOptions} to control also advanced options, such retries of failure, retry strategy options, data chunking\n+ * and flushing windows. See {@link DEFAULT_WriteOptions} to see the defaults.\n+ *\n+ * See also {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/write.js | write.js example},\n+ * and {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/index.html | browser example}.\n+ *\n* @param org - Specifies the destination organization for writes. Takes either the ID or Name interchangeably.\n* @param bucket - The destination bucket for writes.\n* @param precision - Timestamp precision for line items.\n* @param writeOptions - Custom write options.\n- * @returns WriteAPI instance\n+ * @returns WriteApi instance\n*/\ngetWriteApi(\norg: string,\n@@ -60,10 +67,16 @@ export default class InfluxDB {\n}\n/**\n- * Creates [[QueryAPI]] for the supplied organization .\n+ * Creates QueryApi for the supplied organization .\n+ *\n+ * @remarks\n+ * See also {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/query.ts | query.ts example},\n+ * {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/queryWithParams.ts | queryWithParams.ts example},\n+ * {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/index.html | browser example},\n+ * and {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/rxjs-query.ts | rxjs-query.ts example}.\n*\n* @param org - organization\n- * @returns query api instance\n+ * @returns QueryApi instance\n*/\ngetQueryApi(org: string): QueryApi {\nreturn new QueryApiImpl(this.transport, org)\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/index.ts", "new_path": "packages/core/src/index.ts", "diff": "* and offers several ways to stream query results.\n*\n* The influxDB object is also used to create more specialized InfluxDB management API instances in\n- * {@link @influxdata/influxdb-client-apis# }\n+ * {@link @influxdata/influxdb-client-apis# | @influxdata/influxdb-client-apis}\n*\n* See also {@link https://github.com/influxdata/influxdb-client-js/tree/master/examples | examples} to know more.\n*\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: add links to examples into InfluxDB docs
305,159
27.07.2020 08:22:40
-7,200
8c9bf247d14a6262c0d52d55a48033018700494a
docs: better indent code examples
[ { "change_type": "MODIFY", "old_path": "packages/apis/src/index.ts", "new_path": "packages/apis/src/index.ts", "diff": "* ...\n* const {InfluxDB} = require('@influxdata/influxdb-client')\n* const {OrgsAPI} = require('@influxdata/influxdb-client-apis')\n- * const influxDB = new InfluxDB({url: \"http://localhost:9999\", token: \"my-token\"})\n+ * const influxDB = new InfluxDB({\n+ * url: \"http://localhost:9999\",\n+ * token: \"my-token\"\n+ * })\n* ...\n* async function getOrg(name) {\n* const orgsAPI = new OrgsAPI(influxDB)\n- * const organizations = await orgsAPI.getOrgs({org: \"my-org\"})\n+ * const organizations = await orgsAPI.getOrgs({\n+ * org: \"my-org\"\n+ * })\n* ...\n* ```\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/index.ts", "new_path": "packages/core/src/index.ts", "diff": "*\n* ```\n* import {InfluxDB} = from('@influxdata/influxdb-client')\n- * const influxDB = new InfluxDB({url: \"http://localhost:9999\", token: \"your-api-token\"})\n+ * const influxDB = new InfluxDB({\n+ * url: \"http://localhost:9999\",\n+ * token: \"your-api-token\"\n+ * })\n* ```\n*\n* The influxDB object let you create two essential API instances, {@link @influxdata/influxdb-client#InfluxDB.getWriteApi }\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: better indent code examples
305,159
27.07.2020 14:47:56
-7,200
a156f2cf01ed3a128ed6f7449e83fe0516dc8713
chore: skip CI on gh-pages updates
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"apidoc\": \"yarn clean && yarn build && yarn apidoc:extract && yarn apidoc:generate\",\n\"apidoc:extract\": \"yarn workspaces run apidoc:extract && node scripts/fix-extracted-api-files.js\",\n\"apidoc:generate\": \"api-documenter markdown -i docs -o docs/dist\",\n- \"apidoc:gh-pages\": \"gh-pages -d docs/dist\",\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 ../apis && yarn build\",\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: skip CI on gh-pages updates
305,159
27.07.2020 14:48:15
-7,200
3502347b389b57bc9fa388cdeed058e87d5130f7
docs(core): improve links in api docs
[ { "change_type": "MODIFY", "old_path": "packages/core/src/InfluxDB.ts", "new_path": "packages/core/src/InfluxDB.ts", "diff": "@@ -9,7 +9,8 @@ import QueryApi from './QueryApi'\nimport QueryApiImpl from './impl/QueryApiImpl'\n/**\n- * InfluxDB 2.0 client that uses HTTP API described in {@link https://v2.docs.influxdata.com/v2.0/reference/api/ }.\n+ * InfluxDB 2.0 entry point that configures communication with InfluxDB server\n+ * and provide APIs to write and query data.\n*/\nexport default class InfluxDB {\nprivate _options: ClientOptions\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/Point.ts", "new_path": "packages/core/src/Point.ts", "diff": "import {escape} from './util/escape'\nimport {PointSettings} from './options'\n/**\n- * Point defines the values that will be written to the database.\n- * See [Go Implementation](http://bit.ly/influxdata-point)\n+ * Point defines values of a single measurement.\n*/\nexport default class Point {\nprivate name: string\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/observable/types.ts", "new_path": "packages/core/src/observable/types.ts", "diff": "+/** Type of {@link Observer.next} */\nexport type ObserverNext<T> = (value: T) => void\n+/** Type of {@link Observer.error} */\nexport type ObserverError = (e: any) => void\n+/** Type of {@link Observer.complete} */\nexport type ObserverComplete = () => void\n/** Observer mimics Observer from ECMAScript TC39 Observable proposal */\n@@ -11,10 +14,10 @@ export interface Observer<T> {\n/**\n* An observable that aligns with the\n- * [TC39 observable proposal](https://github.com/tc39/proposal-observable) and\n+ * {@link https://github.com/tc39/proposal-observable | TC39 observable proposal} and\n* can be consumed by other observable libraries like\n- * [rxjs](https://github.com/ReactiveX/rxjs) or\n- * [zen-observable](https://github.com/zenparsing/zen-observable).\n+ * {@link https://github.com/ReactiveX/rxjs | rx js} or\n+ * {@link https://github.com/zenparsing/zen-observable | zen-observable}.\n*/\nexport interface Observable<T> {\nsubscribe(): Subscription\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -58,7 +58,7 @@ export interface WriteRetryOptions extends RetryDelayStrategyOptions {\n}\n/**\n- * Options used by [[WriteApi]] .\n+ * Options used by {@link WriteApi} .\n*/\nexport interface WriteOptions extends WriteRetryOptions {\n/** max number of records to send in a batch */\n@@ -87,7 +87,7 @@ export const DEFAULT_WriteOptions: WriteOptions = Object.freeze({\n})\n/**\n- * Options used by [[InfluxDB]] .\n+ * Options used by {@link InfluxDB} .\n*/\nexport interface ClientOptions extends ConnectionOptions {\n/** supplies and overrides default writing options */\n@@ -112,7 +112,7 @@ export const enum WritePrecision {\n}\n/**\n- * Settings that control the way of how a [[Point]] is serialized\n+ * Settings that control the way of how a {@link Point} is serialized\n* to a protocol line.\n*/\nexport interface PointSettings {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableColumn.ts", "new_path": "packages/core/src/query/FluxTableColumn.ts", "diff": "@@ -36,7 +36,7 @@ export interface FluxTableColumnLike {\ndefaultValue?: string\n}\n/**\n- * Column metadata class of a [flux table](http://bit.ly/flux-spec#table) column.\n+ * Column metadata class of a {@link http://bit.ly/flux-spec#table | flux table} column.\n*/\nexport default class FluxTableColumn {\n/**\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableMetaData.ts", "new_path": "packages/core/src/query/FluxTableMetaData.ts", "diff": "@@ -17,7 +17,7 @@ export const typeSerializers: Record<ColumnType, (val: string) => any> = {\nduration: identity,\n}\n/**\n- * Represents metadata of a [flux table](http://bit.ly/flux-spec#table).\n+ * Represents metadata of a {@link http://bit.ly/flux-spec#table | flux table}.\n*/\nexport default class FluxTableMetaData {\n/**\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs(core): improve links in api docs
305,159
27.07.2020 16:33:19
-7,200
d6d5530d928cab7b99a8488681e87ca9625b18ef
docs: configure gh-pages theme
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"scripts\": {\n\"apidoc\": \"yarn clean && yarn build && yarn apidoc:extract && yarn apidoc:generate\",\n\"apidoc:extract\": \"yarn workspaces run apidoc:extract && node scripts/fix-extracted-api-files.js\",\n- \"apidoc:generate\": \"api-documenter markdown -i docs -o docs/dist\",\n+ \"apidoc:generate\": \"api-documenter markdown -i docs -o docs/dist && cp scripts/gh-pages_config.yml docs/dist/_config.yml\",\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" }, { "change_type": "ADD", "old_path": null, "new_path": "scripts/gh-pages_config.yml", "diff": "+theme: jekyll-theme-minimal\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: configure gh-pages theme
305,159
27.07.2020 17:07:50
-7,200
6230d439a23333ce3d52cd9b8ab533f79b1c52ea
chore: add link to API documentation to readme
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -69,6 +69,8 @@ There are also more advanced [examples](./examples/README.md) that shows\n- how to use this client in the browser\n- how to process InfluxDB query results with RX Observables\n+The client API documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n+\n## Build Requirements\n- node v12.13.1 or higher (older versions will work as well)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: add link to API documentation to readme
305,159
28.07.2020 08:12:35
-7,200
0e11f532eadd8a8b1e85a56379f6b8cfc69427dc
docs: enhance generated documentation with version and intro
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"scripts\": {\n\"apidoc\": \"yarn clean && yarn build && yarn apidoc:extract && yarn apidoc:generate\",\n\"apidoc:extract\": \"yarn workspaces run apidoc:extract && node scripts/fix-extracted-api-files.js\",\n- \"apidoc:generate\": \"api-documenter markdown -i docs -o docs/dist && cp scripts/gh-pages_config.yml docs/dist/_config.yml\",\n+ \"apidoc:generate\": \"api-documenter markdown -i docs -o docs/dist && cp scripts/gh-pages_config.yml docs/dist/_config.yml && node scripts/enhance-doc-index-md.js\",\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" }, { "change_type": "ADD", "old_path": null, "new_path": "scripts/enhance-doc-index-md.js", "diff": "+/* eslint-disable @typescript-eslint/explicit-function-return-type */\n+/* eslint-disable @typescript-eslint/no-var-requires */\n+const path = require('path')\n+const fs = require('fs')\n+const marker = '<!-- enhaced with enhance-doc-index.md.js -->'\n+const version = require('../lerna.json').version\n+\n+function enhanceIndexMD(file) {\n+ const data = fs.readFileSync(file, 'utf8')\n+ const lines = data.split('\\n')\n+ for (let i = 0; i < lines.length; i++) {\n+ if (lines[i].startsWith('<!--')) {\n+ if (lines[i].startsWith(marker)) {\n+ console.log(\n+ `skipped: ${file} - nothing to do, the file was already processed`\n+ )\n+ }\n+ continue\n+ }\n+ break\n+ }\n+ console.log(`enhance: ${file}`)\n+ const newLines = lines.reduce(\n+ (acc, line) => {\n+ acc.push(line)\n+ if (line.startsWith('## API Reference')) {\n+ acc.push('')\n+ acc.push(\n+ `The is the API Reference Documentation of InfluxDB v2 JavaScript client version **${version}**.`\n+ )\n+ acc.push('Use this client library with InfluxDB 2.x and InfluxDB 1.8+.')\n+ acc.push(\n+ 'For connecting to InfluxDB 1.7 or earlier instances, see the [node-influx](https://github.com/node-influx/node-influx) client library.'\n+ )\n+ }\n+ return acc\n+ },\n+ [marker]\n+ )\n+\n+ fs.writeFileSync(file, newLines.join('\\n'), 'utf8')\n+}\n+\n+const indexMD = path.resolve(__dirname, '..', 'docs', 'dist', 'index.md')\n+enhanceIndexMD(indexMD)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: enhance generated documentation with version and intro
305,159
28.07.2020 11:35:17
-7,200
0f508ea523c4f5ee3242359b8db8934d634b6792
docs: include documentation generation into CI test
[ { "change_type": "MODIFY", "old_path": ".circleci/config.yml", "new_path": ".circleci/config.yml", "diff": "@@ -17,7 +17,7 @@ commands:\n- ~/.cache/yarn\njobs:\n- unit-tests:\n+ tests:\nparameters:\nversion:\ntype: string\n@@ -29,13 +29,15 @@ jobs:\n- run:\nname: Run tests\ncommand: |\n+ yarn build\ncd ./packages/core\nyarn test:ci\nyarn lint:ci\nyarn build\ncd ../apis\nyarn test\n- yarn build\n+ cd ../..\n+ yarn apidoc:ci\n# Upload results\n- store_test_results:\npath: reports\n@@ -87,7 +89,7 @@ jobs:\nworkflows:\nbuild:\njobs:\n- - unit-tests:\n+ - tests:\nversion: '12'\n- coverage\n- deploy-preview:\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"scripts\": {\n\"apidoc\": \"yarn clean && yarn build && yarn apidoc:extract && yarn apidoc:generate\",\n+ \"apidoc:ci\": \"apidoc:extract && yarn apidoc:generate\",\n\"apidoc:extract\": \"yarn workspaces run apidoc:extract && node scripts/fix-extracted-api-files.js\",\n\"apidoc:generate\": \"api-documenter markdown -i docs -o docs/dist && cp scripts/gh-pages_config.yml docs/dist/_config.yml && node scripts/enhance-doc-index-md.js\",\n\"apidoc:gh-pages\": \"gh-pages -d docs/dist -m 'Updates [skip CI]'\",\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: include documentation generation into CI test
305,159
28.07.2020 11:39:19
-7,200
888b4bb702f344b8c42cddc3c8ea9220cdc20a83
docs: instruct to update API documentation in the release script
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "@@ -20,6 +20,7 @@ publish:\n@echo \"Publish successful\"\n@echo \"\"\n@echo \"Next steps:\"\n+ @echo \" - publish updated API documentation by: \\\"yarn apidoc && yarn apidoc:gh-pages\\\"\"\n@echo \" - add new version to CHANGELOG.md\"\n@echo \" - push changes to repository by : \\\"git commit -am 'chore(release): prepare to next development iteration [skip CI]' && git push\\\"\"\n@echo \"\"\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: instruct to update API documentation in the release script
305,159
28.07.2020 11:43:37
-7,200
7ede53d44beeba22bad825fb93def41e5ca40b3d
chore(ci): require tests in deploy-preview
[ { "change_type": "MODIFY", "old_path": ".circleci/config.yml", "new_path": ".circleci/config.yml", "diff": "@@ -94,7 +94,7 @@ workflows:\n- coverage\n- deploy-preview:\nrequires:\n- - unit-tests\n+ - tests\n- coverage\nfilters:\nbranches:\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n\"scripts\": {\n\"apidoc\": \"yarn clean && yarn build && yarn apidoc:extract && yarn apidoc:generate\",\n- \"apidoc:ci\": \"apidoc:extract && yarn apidoc:generate\",\n+ \"apidoc:ci\": \"yarn apidoc:extract && yarn apidoc:generate\",\n\"apidoc:extract\": \"yarn workspaces run apidoc:extract && node scripts/fix-extracted-api-files.js\",\n\"apidoc:generate\": \"api-documenter markdown -i docs -o docs/dist && cp scripts/gh-pages_config.yml docs/dist/_config.yml && node scripts/enhance-doc-index-md.js\",\n\"apidoc:gh-pages\": \"gh-pages -d docs/dist -m 'Updates [skip CI]'\",\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(ci): require tests in deploy-preview
305,159
28.07.2020 14:50:31
-7,200
3ca5bbed4d20469d96157689a0a4b2e19128670b
chore(core): improve flux test
[ { "change_type": "MODIFY", "old_path": "packages/core/test/unit/query/flux.test.ts", "new_path": "packages/core/test/unit/query/flux.test.ts", "diff": "@@ -112,6 +112,9 @@ describe('Flux Values', () => {\n{value: 'abc${val}def', flux: '\"abc\\\\${val}def\"'},\n{value: 'abc$', flux: '\"abc$\"'},\n{value: 'a\"$d', flux: '\"a\\\\\"$d\"'},\n+ {value: [], flux: '[]'},\n+ {value: ['a\"$d'], flux: '[\"a\\\\\"$d\"]'},\n+ {value: Symbol('thisSym'), flux: `\"${Symbol('thisSym').toString()}\"`},\n]\npairs.forEach(pair => {\nit(`converts ${JSON.stringify(String(pair.value))} to '${\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): improve flux test
305,159
28.07.2020 15:15:46
-7,200
66c5c40315eb582edc9c390a57a49fb326e09eea
feat(core): improve retry strategy and tests
[ { "change_type": "MODIFY", "old_path": "packages/core/src/errors.ts", "new_path": "packages/core/src/errors.ts", "diff": "@@ -5,9 +5,10 @@ export interface RetryDelayStrategy {\n/**\n* Returns delay for a next retry\n* @param error - reason for retrying\n+ * @param failedAttempts - a count of already failed attempts, 1 being the first\n* @returns milliseconds to wait before retrying\n*/\n- nextDelay(error?: Error): number\n+ nextDelay(error?: Error, failedAttempts?: number): number\n/** Implementation should reset its state, this is mandatory to call upon success. */\nsuccess(): void\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -134,12 +134,13 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nreturn new Promise<void>((resolve, reject) => {\nthis.transport.send(this.httpPath, lines.join('\\n'), this.sendOptions, {\nerror(error: Error): void {\n+ const failedAttempts = self.writeOptions.maxRetries + 2 - attempts\n// call the writeFailed listener and check if we can retry\nconst onRetry = self.writeOptions.writeFailed.call(\nself,\nerror,\nlines,\n- self.writeOptions.maxRetries + 2 - attempts\n+ failedAttempts\n)\nif (onRetry) {\nonRetry.then(resolve, reject)\n@@ -159,7 +160,7 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nself.retryBuffer.addLines(\nlines,\nattempts - 1,\n- self.retryStrategy.nextDelay(error)\n+ self.retryStrategy.nextDelay(error, failedAttempts)\n)\nreject(error)\nreturn\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/retryStrategy.ts", "new_path": "packages/core/src/impl/retryStrategy.ts", "diff": "@@ -17,7 +17,7 @@ export class RetryStrategyImpl implements RetryDelayStrategy {\nthis.success()\n}\n- nextDelay(error?: Error): number {\n+ nextDelay(error?: Error, failedAttempts?: number): number {\nconst delay = getRetryDelay(error)\nif (delay && delay > 0) {\nreturn Math.min(\n@@ -25,7 +25,21 @@ export class RetryStrategyImpl implements RetryDelayStrategy {\nthis.options.maxRetryDelay\n)\n} else {\n- if (this.currentDelay) {\n+ let delay = this.currentDelay\n+ if (failedAttempts && failedAttempts > 0) {\n+ // compute delay\n+ delay = this.options.minRetryDelay\n+ for (let i = 1; i < failedAttempts; i++) {\n+ delay = delay * 2\n+ if (delay >= this.options.maxRetryDelay) {\n+ break\n+ }\n+ }\n+ return (\n+ Math.min(Math.max(delay, 1), this.options.maxRetryDelay) +\n+ Math.round(Math.random() * this.options.retryJitter)\n+ )\n+ } else if (this.currentDelay) {\nthis.currentDelay = Math.min(\nMath.max(this.currentDelay * 2, 1) +\nMath.round(Math.random() * this.options.retryJitter),\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": "@@ -59,6 +59,26 @@ describe('RetryStrategyImpl', () => {\nexpect(x).to.not.be.greaterThan(1000)\n})\n})\n+ it('generates exponential delays with failedAttempts', () => {\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 Error(), val))\n+ return acc\n+ }, [] as number[])\n+ expect(values).to.have.length(6)\n+ values.forEach((x, i) => {\n+ if (i > 0) {\n+ expect(Math.max(Math.trunc(x / 100), 10)).to.not.be.lessThan(\n+ Math.max(Math.trunc(values[i - 1] / 100), 10)\n+ )\n+ }\n+ expect(x).to.not.be.greaterThan(1000 + 10)\n+ })\n+ })\nit('generates default jittered delays', () => {\nconst subject = new RetryStrategyImpl({\nminRetryDelay: 100,\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): improve retry strategy and tests
305,159
30.07.2020 11:04:35
-7,200
b90676790f2d87365a79ab44ed794fe845614ff7
fix(core): change default serializes to return null to represent empty value
[ { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableMetaData.ts", "new_path": "packages/core/src/query/FluxTableMetaData.ts", "diff": "@@ -8,13 +8,13 @@ const identity = (x: string): any => x\n*/\nexport const typeSerializers: Record<ColumnType, (val: string) => any> = {\nboolean: (x: string): any => x === 'true',\n- unsignedLong: identity,\n- long: identity,\n- double: (x: string): any => +x,\n+ unsignedLong: (x: string): any => (x === '' ? null : +x),\n+ long: (x: string): any => (x === '' ? null : +x),\n+ double: (x: string): any => (x === '' ? null : +x),\nstring: identity,\nbase64Binary: identity,\n- dateTime: identity,\n- duration: identity,\n+ dateTime: (x: string): any => (x === '' ? null : x),\n+ duration: (x: string): any => (x === '' ? null : x),\n}\n/**\n* Represents metadata of a {@link http://bit.ly/flux-spec#table | flux table}.\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/QueryApi.test.ts", "new_path": "packages/core/test/unit/QueryApi.test.ts", "diff": "@@ -148,7 +148,7 @@ describe('QueryApi', () => {\nexpect(values).to.deep.equal([\n{\nresult: '_result',\n- table: '0',\n+ table: 0,\nid: 'GO506_20_6431',\nst_length: 25.463641400535032,\nst_linestring: '-73.68691 40.820317, -73.690054 40.815413',\n@@ -156,7 +156,7 @@ describe('QueryApi', () => {\n},\n{\nresult: '_result',\n- table: '1',\n+ table: 1,\nid: 'GO506_20_6431',\nst_length: 25.463641400535032,\nst_linestring: '-73.68691 40.820317, -73.690054 40.815413',\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/query/FluxTableMetaData.test.ts", "new_path": "packages/core/test/unit/query/FluxTableMetaData.test.ts", "diff": "@@ -30,7 +30,7 @@ describe('FluxTableMetaData', () => {\nconst columns: FluxTableColumn[] = [\nFluxTableColumn.from({\nlabel: 'a',\n- defaultValue: 'def',\n+ defaultValue: '1',\ndataType: 'long',\ngroup: false,\n}),\n@@ -39,17 +39,20 @@ describe('FluxTableMetaData', () => {\n}),\n]\nconst subject = new FluxTableMetaData(columns)\n- expect(subject.toObject(['', ''])).to.deep.equal({a: 'def', b: ''})\n- expect(subject.toObject(['x', 'y'])).to.deep.equal({a: 'x', b: 'y'})\n- expect(subject.toObject(['x', 'y', 'z'])).to.deep.equal({a: 'x', b: 'y'})\n- expect(subject.toObject(['x'])).to.deep.equal({a: 'x'})\n+ expect(subject.toObject(['', ''])).to.deep.equal({a: 1, b: ''})\n+ expect(subject.toObject(['2', 'y'])).to.deep.equal({a: 2, b: 'y'})\n+ expect(subject.toObject(['3', 'y', 'z'])).to.deep.equal({a: 3, b: 'y'})\n+ expect(subject.toObject(['4'])).to.deep.equal({a: 4})\n})\nconst serializationTable: Array<[ColumnType | undefined, string, any]> = [\n['boolean', 'false', false],\n['boolean', 'true', true],\n- ['unsignedLong', '1', '1'],\n- ['long', '1', '1'],\n+ ['unsignedLong', '1', 1],\n+ ['unsignedLong', '', null],\n+ ['long', '1', 1],\n+ ['long', '', null],\n['double', '1', 1],\n+ ['double', '', null],\n['string', '1', '1'],\n['base64Binary', '1', '1'],\n['dateTime', '1', '1'],\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core): change default serializes to return null to represent empty value
305,159
01.08.2020 20:05:10
-7,200
67e95888e28204e989a13bcf270fe58d3c3e6bf9
chore(core): influx DB => InfluxDB
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -153,7 +153,7 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\n(error as HttpError).statusCode >= 429)\n) {\nLogger.warn(\n- `Write to influx DB failed (remaining attempts: ${attempts -\n+ `Write to InfluxDB failed (remaining attempts: ${attempts -\n1}).`,\nerror\n)\n@@ -165,7 +165,7 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nreject(error)\nreturn\n}\n- Logger.error(`Write to influx DB failed.`, error)\n+ Logger.error(`Write to InfluxDB failed.`, error)\nreject(error)\n},\ncomplete(): void {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): influx DB => InfluxDB
305,159
01.08.2020 20:56:23
-7,200
573d5d38cce8b14dff2de655d11f3725e0d95036
docs(core): document writeFailed fn
[ { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -36,13 +36,13 @@ export interface RetryDelayStrategyOptions {\n* Options that configure strategy for retrying failed InfluxDB write operations.\n*/\nexport interface WriteRetryOptions extends RetryDelayStrategyOptions {\n- /*\n+ /**\n* writeFailed is called to inform about write error\n- * @param this the instance of the API that failed\n- * @param error write error\n- * @param lines failed lines\n- * @param attempts a number of failed attempts to write the lines\n- * @return a Promise to force the API to not retry again and use the promise as a result of the flush operation,\n+ * @param this - the instance of the API that failed\n+ * @param error - write error\n+ * @param lines - failed lines\n+ * @param attempts - a number of failed attempts to write the lines\n+ * @returns a Promise to force the API to use it as a result of the flush operation,\n* void/undefined to continue with default retry mechanism\n*/\nwriteFailed(\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs(core): document writeFailed fn
305,159
01.08.2020 20:57:33
-7,200
22bd048893a58669691ee9ab0d4d712d1c36ecfd
feat(examples): add writeAdvanced example
[ { "change_type": "MODIFY", "old_path": "examples/README.md", "new_path": "examples/README.md", "diff": "@@ -24,6 +24,8 @@ This directory contains javascript and typescript examples for node.js and brows\nHow to use forward compatibility APIs from InfluxDB 1.8.\n- [rxjs-query.ts](./rxjs-query.ts)\nUse [RxJS](https://rxjs.dev/) to query InfluxDB with [Flux](https://v2.docs.influxdata.com/v2.0/query-data/get-started/).\n+ - [writeAdvanced.js](./writeAdvanced.js)\n+ Shows how to control the way of how data points are imported 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_type": "ADD", "old_path": null, "new_path": "examples/writeAdvanced.js", "diff": "+#!/usr/bin/env node\n+//////////////////////////////////////////////////////////////////////////\n+// Shows how to control the way of how points are written into InfluxDB //\n+//////////////////////////////////////////////////////////////////////////\n+/*\n+This example shows how to use the client's Write API to control the way of how points\n+are sent to InfluxDB server.\n+\n+It is based on the simpler write.js example, it assumes that you are familiar with it.\n+The write.js example asynchronously writes points to InfluxDB and assumes that the library\n+takes care about retries upon failures and optimizes networking to send points in\n+batches and on background. This approach is good for sending various metrics from your\n+application, but it does not scale well when you need to import bigger amount of data. See\n+https://github.com/influxdata/influxdb-client-js/issues/213 for details.\n+*/\n+\n+const {\n+ InfluxDB,\n+ Point,\n+ flux,\n+ fluxDuration,\n+ DEFAULT_WriteOptions,\n+} = require('@influxdata/influxdb-client')\n+const {url, token, org, bucket} = require('./env')\n+const {hostname} = require('os')\n+\n+console.log('*** WRITE POINTS ***')\n+/* points/lines are batched in order to minimize networking and increase performance */\n+const flushBatchSize = DEFAULT_WriteOptions.batchSize\n+/* count of demo data to import */\n+const demoCount = 10_000\n+\n+// explains all write options\n+const writeOptions = {\n+ /* the maximum points/line to send in a single batch to InfluxDB server */\n+ batchSize: flushBatchSize + 1, // don't let automatically flush data\n+ /* default tags to add to every point */\n+ defaultTags: {location: hostname},\n+ /* maximum time in millis to keep points in an unflushed batch, 0 means don't periodically flush */\n+ flushInterval: 0,\n+ /* maximum size of the retry buffer - it contains items that could not be sent for the first time */\n+ maxBufferLines: 30_000,\n+ /* the count of retries, the delays between retries follow an exponential backoff strategy if there is no Retry-After HTTP header */\n+ maxRetries: 3,\n+ /* maximum delay between retries in milliseconds */\n+ maxRetryDelay: 15000,\n+ /* minimum delay between retries in milliseconds */\n+ minRetryDelay: 1000, // minimum delay between retries\n+ /* a random value of up to retryJitter is added when scheduling next retry */\n+ retryJitter: 1000,\n+ // ... or you can customize what to do on write failures when using a writeFailed fn, see the API docs for details\n+ // writeFailed: function(error, lines, failedAttempts){/** return promise or void */},\n+}\n+\n+const influxDB = new InfluxDB({url, token})\n+\n+async function importData() {\n+ const writeApi = influxDB.getWriteApi(org, bucket, 'ns', writeOptions)\n+ // import a bigger count of items\n+ for (let i = 0; i < demoCount; i++) {\n+ const point = new Point('temperature2')\n+ .tag('example', 'writeAdvanced.ts')\n+ .floatField('value', 20 + Math.round(100 * Math.random()) / 10)\n+ writeApi.writePoint(point)\n+ // control the way of how data are flushed\n+ if ((i + 1) % flushBatchSize === 0) {\n+ console.log(`flush writeApi: chunk #${(i + 1) / flushBatchSize}`)\n+ try {\n+ await writeApi.flush()\n+ } catch (e) {\n+ console.error()\n+ }\n+ }\n+ }\n+\n+ // console.log('close writeApi: flush unwritten points, wait for retries')\n+ // await writeApi.flush()\n+ console.log('close writeApi: flush unwritten points, close retry buffer')\n+ await writeApi.close()\n+\n+ // print the count of items in the last 5 minutes\n+ const start = fluxDuration('-5m')\n+ const countQuery = flux`from(bucket: ${bucket})\n+ |> range(start: ${start})\n+ |> filter(fn: (r) => r._measurement == \"temperature2\")\n+ |> count(column: \"_value\")`\n+ const count = await influxDB\n+ .getQueryApi(org)\n+ .collectRows(\n+ countQuery,\n+ (row, tableMeta) => row[tableMeta.column('_value').index]\n+ )\n+ .then(results => results.reduce((acc, val) => acc + +val, 0))\n+ console.log(`Size of temperature2 measurement since '${start}': `, count)\n+}\n+\n+importData()\n+ .then(() => console.log('FINISHED'))\n+ .catch(e => console.error('FINISHED', e))\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/InfluxDB.ts", "new_path": "packages/core/src/InfluxDB.ts", "diff": "@@ -44,7 +44,8 @@ export default class InfluxDB {\n* and flushing windows. See {@link DEFAULT_WriteOptions} to see the defaults.\n*\n* See also {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/write.js | write.js example},\n- * and {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/index.html | browser example}.\n+ * {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/writeAdvanced.js | writeAdvanced.js example}\n+ * , and {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/index.html | browser example}.\n*\n* @param org - Specifies the destination organization for writes. Takes either the ID or Name interchangeably.\n* @param bucket - The destination bucket for writes.\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(examples): add writeAdvanced example
305,159
02.08.2020 06:16:40
-7,200
5b21c342d021ed267fc2fe62e36ef31e30c31b51
feat(core): enhance write API to optionally flush the retry buffer
[ { "change_type": "MODIFY", "old_path": "packages/core/src/WriteApi.ts", "new_path": "packages/core/src/WriteApi.ts", "diff": "@@ -47,9 +47,10 @@ export default interface WriteApi {\n/**\n* Flushes pending writes to the server.\n+ * @param withRetryBuffer - flush also all the scheduled retries\n* @returns completition promise\n*/\n- flush(): Promise<void>\n+ flush(withRetryBuffer?: boolean): Promise<void>\n/**\n* Flushes this writer and cancels retries of write operations that failed.\n@@ -60,6 +61,7 @@ export default interface WriteApi {\n/**\n* Unlike close, dispose simply quits without trying to flush\n* the buffered data.\n+ * @returns count of points that were not written to InfluxDB\n*/\n- dispose(): void\n+ dispose(): number\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -203,10 +203,12 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nthis.writePoint(points[i])\n}\n}\n- async flush(): Promise<void> {\n+ async flush(withRetryBuffer?: boolean): Promise<void> {\nawait this.writeBuffer.flush()\n+ if (withRetryBuffer) {\nreturn await this.retryBuffer.flush()\n}\n+ }\nclose(): Promise<void> {\nconst retVal = this.writeBuffer.flush().finally(() => {\nconst remaining = this.retryBuffer.close()\n@@ -220,9 +222,10 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\n})\nreturn retVal\n}\n- dispose(): void {\n+ dispose(): number {\nthis._clearFlushTimeout()\nthis.closed = true\n+ return this.retryBuffer.close() + this.writeBuffer.length\n}\n// PointSettings\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -57,7 +57,7 @@ describe('WriteApi', () => {\n})\nit('can be closed and flushed without any data', async () => {\nawait subject.close().catch(e => expect.fail('should not happen', e))\n- await subject.flush().catch(e => expect.fail('should not happen', e))\n+ await subject.flush(true).catch(e => expect.fail('should not happen', e))\n})\nit('fails on close without server connection', async () => {\nsubject.writeRecord('test value=1')\n@@ -149,9 +149,14 @@ describe('WriteApi', () => {\nuseSubject({flushInterval: 0, maxRetries: 0, batchSize: 2})\nsubject.writeRecords(['test value=1', 'test value=2', 'test value=3'])\nawait new Promise(resolve => setTimeout(resolve, 10)) // wait for HTTP to finish\n- subject.dispose()\n+ let count = subject.dispose()\nexpect(logs.error).to.length(1)\nexpect(logs.warn).to.length(0)\n+ expect(count).equals(1)\n+ count = subject.dispose() // dispose is idempotent\n+ expect(logs.error).to.length(1) // no more errorrs\n+ expect(logs.warn).to.length(0)\n+ expect(count).equals(1)\n})\n})\ndescribe('flush on background', () => {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): enhance write API to optionally flush the retry buffer
305,159
02.08.2020 06:18:35
-7,200
c62bb8a26ec88deeda0b7d74e0bc98bbe3ff9173
docs(examples): improve writeAdvanced example
[ { "change_type": "MODIFY", "old_path": "examples/writeAdvanced.js", "new_path": "examples/writeAdvanced.js", "diff": "@@ -29,6 +29,8 @@ console.log('*** WRITE POINTS ***')\nconst flushBatchSize = DEFAULT_WriteOptions.batchSize\n/* count of demo data to import */\nconst demoCount = 10_000\n+/* name of demo measurement */\n+const demoMeasurement = 'temperature2'\n// explains all write options\nconst writeOptions = {\n@@ -58,7 +60,7 @@ async function importData() {\nconst writeApi = influxDB.getWriteApi(org, bucket, 'ns', writeOptions)\n// import a bigger count of items\nfor (let i = 0; i < demoCount; i++) {\n- const point = new Point('temperature2')\n+ const point = new Point(demoMeasurement)\n.tag('example', 'writeAdvanced.ts')\n.floatField('value', 20 + Math.round(100 * Math.random()) / 10)\nwriteApi.writePoint(point)\n@@ -73,24 +75,23 @@ async function importData() {\n}\n}\n- // console.log('close writeApi: flush unwritten points, wait for retries')\n- // await writeApi.flush()\n- console.log('close writeApi: flush unwritten points, close retry buffer')\n+ console.log(\n+ 'close writeApi: flush unwritten points, cancel scheduled retries'\n+ )\nawait writeApi.close()\n// print the count of items in the last 5 minutes\nconst start = fluxDuration('-5m')\nconst countQuery = flux`from(bucket: ${bucket})\n|> range(start: ${start})\n- |> filter(fn: (r) => r._measurement == \"temperature2\")\n+ |> filter(fn: (r) => r._measurement == ${demoMeasurement})\n|> count(column: \"_value\")`\nconst count = await influxDB\n.getQueryApi(org)\n- .collectRows(\n- countQuery,\n- (row, tableMeta) => row[tableMeta.column('_value').index]\n+ .collectRows(countQuery, (row, tableMeta) =>\n+ Number.parseInt(row[tableMeta.column('_value').index])\n)\n- .then(results => results.reduce((acc, val) => acc + +val, 0))\n+ .then(results => results.reduce((acc, val) => acc + val, 0))\nconsole.log(`Size of temperature2 measurement since '${start}': `, count)\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/InfluxDB.ts", "new_path": "packages/core/src/InfluxDB.ts", "diff": "@@ -44,8 +44,8 @@ export default class InfluxDB {\n* and flushing windows. See {@link DEFAULT_WriteOptions} to see the defaults.\n*\n* See also {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/write.js | write.js example},\n- * {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/writeAdvanced.js | writeAdvanced.js example}\n- * , and {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/index.html | browser example}.\n+ * {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/writeAdvanced.js | writeAdvanced.js example},\n+ * and {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/index.html | browser example}.\n*\n* @param org - Specifies the destination organization for writes. Takes either the ID or Name interchangeably.\n* @param bucket - The destination bucket for writes.\n@@ -74,8 +74,8 @@ export default class InfluxDB {\n* @remarks\n* See also {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/query.ts | query.ts example},\n* {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/queryWithParams.ts | queryWithParams.ts example},\n- * {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/index.html | browser example},\n- * and {@link https://github.com/influxdata/influxdb-client-js/blob/master/examples/rxjs-query.ts | rxjs-query.ts example}.\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* @returns QueryApi instance\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs(examples): improve writeAdvanced example
305,159
02.08.2020 21:01:08
-7,200
c57fb3fa614634081bcf2d0ed844a784f7f2db75
chore: update main doc
[ { "change_type": "MODIFY", "old_path": "scripts/enhance-doc-index-md.js", "new_path": "scripts/enhance-doc-index-md.js", "diff": "@@ -26,7 +26,7 @@ function enhanceIndexMD(file) {\nif (line.startsWith('## API Reference')) {\nacc.push('')\nacc.push(\n- `The is the API Reference Documentation of InfluxDB v2 JavaScript client version **${version}**.`\n+ `Welcome to the API Reference Documentation of InfluxDB v2 JavaScript client version **${version}**.`\n)\nacc.push('Use this client library with InfluxDB 2.x and InfluxDB 1.8+.')\nacc.push(\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: update main doc
305,159
02.08.2020 21:46:18
-7,200
b985f1777878ab911be54ffecfbfd101ec5b3cec
docs: update intro text of API reference
[ { "change_type": "MODIFY", "old_path": "scripts/enhance-doc-index-md.js", "new_path": "scripts/enhance-doc-index-md.js", "diff": "@@ -26,7 +26,7 @@ function enhanceIndexMD(file) {\nif (line.startsWith('## API Reference')) {\nacc.push('')\nacc.push(\n- `Welcome to the API Reference Documentation of InfluxDB v2 JavaScript client version **${version}**.`\n+ `Welcome to the API Reference Documentation of InfluxDB v2 JavaScript client version **${version}** _(${new Date().toISOString()})_.`\n)\nacc.push('Use this client library with InfluxDB 2.x and InfluxDB 1.8+.')\nacc.push(\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
docs: update intro text of API reference
305,159
02.08.2020 21:55:23
-7,200
3afbe60db464b990605b7fbb7efa776dd26d399a
chore: update doc link description
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -69,7 +69,7 @@ There are also more advanced [examples](./examples/README.md) that shows\n- how to use this client in the browser\n- how to process InfluxDB query results with RX Observables\n-The client API documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n+The client API Reference Documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n## Build Requirements\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: update doc link description
305,159
11.08.2020 19:15:44
-7,200
17bc4e6f8ab0035cf1c083f4e6d4876ca1ac2b41
chore: use ts3.7+ nullish coleascing
[ { "change_type": "MODIFY", "old_path": "packages/core/src/InfluxDB.ts", "new_path": "packages/core/src/InfluxDB.ts", "diff": "@@ -32,7 +32,7 @@ export default class InfluxDB {\nif (typeof url !== 'string')\nthrow new IllegalArgumentError('No url specified!')\nif (url.endsWith('/')) this._options.url = url.substring(0, url.length - 1)\n- this.transport = this._options.transport || new TransportImpl(this._options)\n+ this.transport = this._options.transport ?? new TransportImpl(this._options)\n}\n/**\n@@ -64,7 +64,7 @@ export default class InfluxDB {\norg,\nbucket,\nprecision,\n- writeOptions || this._options.writeOptions\n+ writeOptions ?? this._options.writeOptions\n)\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/QueryApiImpl.ts", "new_path": "packages/core/src/impl/QueryApiImpl.ts", "diff": "@@ -137,7 +137,7 @@ export class QueryApiImpl implements QueryApi {\nrequest.now = this.options.now()\n}\n// https://v2.docs.influxdata.com/v2.0/api/#operation/PostQuery requires type\n- request.type = this.options.type || 'flux'\n+ request.type = this.options.type ?? 'flux'\nreturn request\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -195,7 +195,7 @@ export class NodeHttpTransport implements Transport {\n})\nlisteners.responseStarted(res.headers)\nconst statusCode =\n- res.statusCode || /* istanbul ignore next safety check */ 600\n+ res.statusCode ?? /* istanbul ignore next safety check */ 600\nconst contentEncoding = res.headers['content-encoding']\nlet responseData\nif (contentEncoding === 'gzip') {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableColumn.ts", "new_path": "packages/core/src/query/FluxTableColumn.ts", "diff": "@@ -74,7 +74,7 @@ export default class FluxTableColumn {\nretVal.label = object.label\nretVal.dataType = object.dataType as ColumnType\nretVal.group = Boolean(object.group)\n- retVal.defaultValue = object.defaultValue || ''\n+ retVal.defaultValue = object.defaultValue ?? ''\nreturn retVal\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableMetaData.ts", "new_path": "packages/core/src/query/FluxTableMetaData.ts", "diff": "@@ -53,7 +53,7 @@ export default class FluxTableMetaData {\nif (val === '' && column.defaultValue) {\nval = column.defaultValue\n}\n- acc[column.label] = (typeSerializers[column.dataType] || identity)(val)\n+ acc[column.label] = (typeSerializers[column.dataType] ?? identity)(val)\n}\nreturn acc\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/Point.test.ts", "new_path": "packages/core/test/unit/Point.test.ts", "diff": "@@ -29,7 +29,7 @@ function createPoint(test: PointTest): Point {\n: test.name\n? new Point().measurement(test.name)\n: new Point()\n- ;(test.fields || []).forEach(\n+ ;(test.fields ?? []).forEach(\n(field: [string, 'n' | 's' | 'b' | 'i', any]) => {\nswitch (field[1]) {\ncase 'n':\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/QueryApi.test.ts", "new_path": "packages/core/test/unit/QueryApi.test.ts", "diff": "@@ -204,7 +204,7 @@ describe('QueryApi', () => {\n},\n})\n)\n- expect(body?.type).to.deep.equal(pair.type || 'flux')\n+ expect(body?.type).to.deep.equal(pair.type ?? 'flux')\nexpect(body?.query).to.deep.equal(query)\nexpect(body?.now).to.deep.equal(pair.now)\n}\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": "@@ -14,7 +14,7 @@ function createResponse({\nstatusText: `X${status}X`,\nheaders: {\nget(key: string): string | undefined {\n- return headers[key] || headers[key.toLowerCase()]\n+ return headers[key] ?? headers[key.toLowerCase()]\n},\nforEach(fn: (value: string, key: string) => void): void {\nObject.keys(headers).forEach((key: string) => {\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": "@@ -118,7 +118,7 @@ describe('NodeHttpTransport', () => {\n200,\nnew Readable({\nread(): any {\n- const encode = !!(extras.headers || {})['accept-encoding']\n+ const encode = !!(extras.headers ?? {})['accept-encoding']\nif (encode) {\nthis.push(\nresponseRead ? null : zlib.gzipSync(responseData)\n@@ -135,7 +135,7 @@ describe('NodeHttpTransport', () => {\n_res: any,\n_body: any\n): string =>\n- (extras.headers || {})['accept-encoding'] || 'identity',\n+ (extras.headers ?? {})['accept-encoding'] ?? 'identity',\n},\n])\n.persist()\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: use ts3.7+ nullish coleascing
305,159
11.08.2020 19:17:19
-7,200
ba4ec21b8d490417c55ba082c0ff9506a0d5eb8b
chore: repair global test script
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"preinstall\": \"node ./scripts/require-yarn.js\",\n\"clean\": \"rimraf temp docs && yarn workspaces run clean\",\n\"build\": \"cd packages/core && yarn build && cd ../apis && yarn build\",\n- \"test\": \"cd packages/core && yarn test && cd ../apis && yarn test\",\n+ \"test\": \"cd packages/core && yarn test && yarn build && cd ../apis && yarn test\",\n\"coverage\": \"cd packages/core && yarn coverage\",\n\"coverage:send\": \"cd packages/core && yarn coverage:send\"\n},\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: repair global test script
305,159
11.08.2020 19:49:57
-7,200
dcbacb508b44464335408fe4aedc8e04303d92e5
chore: fix upgraded nyc coverage
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -194,8 +194,8 @@ export class NodeHttpTransport implements Transport {\nlisteners.error(new AbortError())\n})\nlisteners.responseStarted(res.headers)\n- const statusCode =\n- res.statusCode ?? /* istanbul ignore next safety check */ 600\n+ /* istanbul ignore next statusCode is optional in http.IncomingMessage */\n+ const statusCode = res.statusCode ?? 600\nconst contentEncoding = res.headers['content-encoding']\nlet responseData\nif (contentEncoding === 'gzip') {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/Influxdb.test.ts", "new_path": "packages/core/test/unit/Influxdb.test.ts", "diff": "@@ -60,11 +60,30 @@ describe('InfluxDB', () => {\nit('fails on unsupported protocol', () => {\nexpect(\n() =>\n- new InfluxDB(({\n+ new InfluxDB({\nurl: 'ws://localhost:9999?token=b',\n- } as ClientOptions) as ClientOptions)\n+ })\n).to.throw('Unsupported')\n})\n+ it('creates instance with transport initialized', () => {\n+ expect(\n+ new InfluxDB({\n+ url: 'http://localhost:9999',\n+ })\n+ ).has.property('transport')\n+ expect(\n+ new InfluxDB(({\n+ url: 'http://localhost:9999',\n+ transport: null,\n+ } as any) as ClientOptions)\n+ ).has.property('transport')\n+ expect(\n+ new InfluxDB(({\n+ url: 'http://localhost:9999',\n+ transport: {} as Transport,\n+ } as any) as ClientOptions)\n+ ).has.property('transport')\n+ })\n})\ndescribe('apis', () => {\nconst influxDb = new InfluxDB('http://localhost:9999?token=a')\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: fix upgraded nyc coverage
305,159
11.08.2020 15:22:21
-7,200
f0d5b4ecac3f422e543cd0f1321557e1c2dfe83a
feat(core): change min/max retry delay
[ { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -72,8 +72,8 @@ export interface WriteOptions extends WriteRetryOptions {\n/** default RetryDelayStrategyOptions */\nexport const DEFAULT_RetryDelayStrategyOptions = Object.freeze({\nretryJitter: 200,\n- minRetryDelay: 1000,\n- maxRetryDelay: 15000,\n+ minRetryDelay: 5000,\n+ maxRetryDelay: 180000,\n})\n/** default writeOptions */\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): change min/max retry delay
305,159
11.08.2020 15:22:41
-7,200
7abdedcc0ebadfe1023feffe0ef2529094c78468
feat(core): change max retry count to 3
[ { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -81,7 +81,7 @@ export const DEFAULT_WriteOptions: WriteOptions = Object.freeze({\nbatchSize: 1000,\nflushInterval: 60000,\nwriteFailed: function() {},\n- maxRetries: 2,\n+ maxRetries: 3,\nmaxBufferLines: 32_000,\n...DEFAULT_RetryDelayStrategyOptions,\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): change max retry count to 3
305,159
11.08.2020 15:43:14
-7,200
28d36b7e1c1f006c5c306d8026622b62eb96e603
feat(core): add exponentialBase retry stategy option
[ { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -26,10 +26,12 @@ export const DEFAULT_ConnectionOptions: Partial<ConnectionOptions> = {\nexport interface RetryDelayStrategyOptions {\n/** include random milliseconds when retrying HTTP calls */\nretryJitter: number\n- /** minimum delay when retrying write */\n+ /** minimum delay when retrying write (milliseconds) */\nminRetryDelay: number\n- /** maximum delay when retrying write */\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+ exponentialBase: number\n}\n/**\n@@ -74,6 +76,7 @@ export const DEFAULT_RetryDelayStrategyOptions = Object.freeze({\nretryJitter: 200,\nminRetryDelay: 5000,\nmaxRetryDelay: 180000,\n+ exponentialBase: 5,\n})\n/** default writeOptions */\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): add exponentialBase retry stategy option
305,159
11.08.2020 16:23:26
-7,200
7157e49811388c004ec215b1a847c83216d34d3e
feat(core): change exponential backoff base to 5 by default
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/retryStrategy.ts", "new_path": "packages/core/src/impl/retryStrategy.ts", "diff": "@@ -30,7 +30,7 @@ export class RetryStrategyImpl implements RetryDelayStrategy {\n// compute delay\ndelay = this.options.minRetryDelay\nfor (let i = 1; i < failedAttempts; i++) {\n- delay = delay * 2\n+ delay = delay * this.options.exponentialBase\nif (delay >= this.options.maxRetryDelay) {\nbreak\n}\n@@ -41,7 +41,7 @@ export class RetryStrategyImpl implements RetryDelayStrategy {\n)\n} else if (this.currentDelay) {\nthis.currentDelay = Math.min(\n- Math.max(this.currentDelay * 2, 1) +\n+ Math.max(this.currentDelay * this.options.exponentialBase, 1) +\nMath.round(Math.random() * this.options.retryJitter),\nthis.options.maxRetryDelay\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": "@@ -22,6 +22,7 @@ describe('RetryStrategyImpl', () => {\nminRetryDelay: 100,\nmaxRetryDelay: 1000,\nretryJitter: 0,\n+ exponentialBase: 2,\n})\nconst values = [1, 2, 3, 4, 5, 6].reduce((acc, _val) => {\nacc.push(subject.nextDelay())\n@@ -31,6 +32,29 @@ describe('RetryStrategyImpl', () => {\nsubject.success()\nexpect(subject.nextDelay()).equals(100)\n})\n+ it('generates exponential data from min to max for unknown delays', () => {\n+ const subject = new RetryStrategyImpl({\n+ minRetryDelay: 100,\n+ maxRetryDelay: 2000,\n+ retryJitter: 20,\n+ // exponentialBase: 5, 5 by default\n+ })\n+ const values = [1, 2, 3, 4, 5, 6].reduce((acc, _val, index) => {\n+ acc.push(subject.nextDelay(undefined, index + 1))\n+ return acc\n+ }, [] as number[])\n+ // truncate values to ignore jittering\n+ expect(values.map(x => Math.trunc(x / 100) * 100)).to.be.deep.equal([\n+ 100,\n+ 500,\n+ 2000,\n+ 2000,\n+ 2000,\n+ 2000,\n+ ])\n+ subject.success()\n+ expect(Math.trunc(subject.nextDelay() / 100) * 100).equals(100)\n+ })\nit('generates the delays according to errors', () => {\nconst subject = new RetryStrategyImpl({\nminRetryDelay: 100,\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): change exponential backoff base to 5 by default
305,159
12.08.2020 06:54:10
-7,200
15ebca22b69632cfed5af00b719e9d125fd3537f
feat(core): return requested delay when detected
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/retryStrategy.ts", "new_path": "packages/core/src/impl/retryStrategy.ts", "diff": "@@ -20,10 +20,7 @@ export class RetryStrategyImpl implements RetryDelayStrategy {\nnextDelay(error?: Error, failedAttempts?: number): number {\nconst delay = getRetryDelay(error)\nif (delay && delay > 0) {\n- return Math.min(\n- delay + Math.round(Math.random() * this.options.retryJitter),\n- this.options.maxRetryDelay\n- )\n+ return delay + Math.round(Math.random() * this.options.retryJitter)\n} else {\nlet delay = this.currentDelay\nif (failedAttempts && failedAttempts > 0) {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): return requested delay when detected
305,159
12.08.2020 09:07:26
-7,200
729873bbb308f2faeb72ffc966a2344c24e1cc52
chore: improve API doc intro
[ { "change_type": "MODIFY", "old_path": "scripts/enhance-doc-index-md.js", "new_path": "scripts/enhance-doc-index-md.js", "diff": "@@ -26,7 +26,7 @@ function enhanceIndexMD(file) {\nif (line.startsWith('## API Reference')) {\nacc.push('')\nacc.push(\n- `Welcome to the API Reference Documentation of InfluxDB v2 JavaScript client version **${version}** _(${new Date().toISOString()})_.`\n+ `Welcome to the API Reference Documentation of InfluxDB v2 JavaScript Client (version ${version} _${new Date().toISOString()}_).`\n)\nacc.push('Use this client library with InfluxDB 2.x and InfluxDB 1.8+.')\nacc.push(\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve API doc intro
305,159
12.08.2020 09:56:56
-7,200
88dd0e8640dcce564cc722c9e8bf2f84510d5bb3
chore: upgrade rollup to 2.23.1
[ { "change_type": "MODIFY", "old_path": "packages/apis/package.json", "new_path": "packages/apis/package.json", "diff": "\"mocha\": \"^6.2.2\",\n\"prettier\": \"^1.19.1\",\n\"rimraf\": \"^3.0.0\",\n- \"rollup\": \"^1.27.5\",\n+ \"rollup\": \"^2.23.1\",\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/package.json", "new_path": "packages/core/package.json", "diff": "\"nyc\": \"^15.1.0\",\n\"prettier\": \"^1.19.1\",\n\"rimraf\": \"^3.0.0\",\n- \"rollup\": \"^1.27.5\",\n+ \"rollup\": \"^2.23.1\",\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": "yarn.lock", "new_path": "yarn.lock", "diff": "resolved \"https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d\"\nintegrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==\n-\"@types/estree@*\":\n- version \"0.0.45\"\n- resolved \"https://registry.yarnpkg.com/@types/estree/-/estree-0.0.45.tgz#e9387572998e5ecdac221950dab3e8c3b16af884\"\n- integrity sha512-jnqIUKDUqJbDIUxm0Uj7bnlMnRm1T/eZ9N+AVMqhPgzrba2GhGG5o/jCTwmdPK709nEZsGoMzXEDUjcXHa3W0g==\n-\n\"@types/[email protected]\":\nversion \"0.0.39\"\nresolved \"https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f\"\n@@ -1372,7 +1367,7 @@ acorn-jsx@^5.2.0:\nresolved \"https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe\"\nintegrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==\n-acorn@^7.1.0, acorn@^7.1.1:\n+acorn@^7.1.1:\nversion \"7.4.0\"\nresolved \"https://registry.yarnpkg.com/acorn/-/acorn-7.4.0.tgz#e1ad486e6c54501634c6c397c5c121daa383607c\"\nintegrity sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==\n@@ -3158,6 +3153,11 @@ fs.realpath@^1.0.0:\nresolved \"https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f\"\nintegrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=\n+fsevents@~2.1.2:\n+ version \"2.1.3\"\n+ resolved \"https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e\"\n+ integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==\n+\nfunction-bind@^1.1.1:\nversion \"1.1.1\"\nresolved \"https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d\"\n@@ -5967,14 +5967,12 @@ rollup-plugin-typescript2@^0.27.2:\nresolve \"1.17.0\"\ntslib \"2.0.1\"\n-rollup@^1.27.5:\n- version \"1.32.1\"\n- resolved \"https://registry.yarnpkg.com/rollup/-/rollup-1.32.1.tgz#4480e52d9d9e2ae4b46ba0d9ddeaf3163940f9c4\"\n- integrity sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A==\n- dependencies:\n- \"@types/estree\" \"*\"\n- \"@types/node\" \"*\"\n- acorn \"^7.1.0\"\n+rollup@^2.23.1:\n+ version \"2.23.1\"\n+ resolved \"https://registry.yarnpkg.com/rollup/-/rollup-2.23.1.tgz#d458d28386dc7660c2e8a4978bea6f9494046c20\"\n+ integrity sha512-Heyl885+lyN/giQwxA8AYT2GY3U+gOlTqVLrMQYno8Z1X9lAOpfXPiKiZCyPc25e9BLJM3Zlh957dpTlO4pa8A==\n+ optionalDependencies:\n+ fsevents \"~2.1.2\"\nrun-async@^2.2.0, run-async@^2.4.0:\nversion \"2.4.1\"\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: upgrade rollup to 2.23.1
305,159
16.08.2020 14:07:18
-7,200
cdca1fb335e1474971c6de931bc0a3e12ab7913e
fix(core/query): repair wrong quote detection in chunks to lines transformation
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/ChunksToLines.ts", "new_path": "packages/core/src/impl/ChunksToLines.ts", "diff": "@@ -7,6 +7,7 @@ import Cancellable from '../util/Cancellable'\nexport default class ChunksToLines implements CommunicationObserver<any> {\nprevious?: Uint8Array\nfinished = false\n+ quoted = false\nconstructor(\nprivate target: CommunicationObserver<string>,\n@@ -51,18 +52,17 @@ export default class ChunksToLines implements CommunicationObserver<any> {\n} else {\nindex = 0\n}\n- let quoted = false\nwhile (index < chunk.length) {\nconst c = chunk[index]\nif (c === 10) {\n- if (!quoted) {\n+ if (!this.quoted) {\n/* do not emit CR+LR or LF line ending */\nconst end = index > 0 && chunk[index - 1] === 13 ? index - 1 : index\nthis.target.next(this.chunks.toUtf8String(chunk, start, end))\nstart = index + 1\n}\n} else if (c === 34 /* \" */) {\n- quoted = !quoted\n+ this.quoted = !this.quoted\n}\nindex++\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/fixture/chunksToLinesTables.json", "new_path": "packages/core/test/fixture/chunksToLinesTables.json", "diff": "\",result,table,id,st_length,st_linestring,trip_id\",\n\",,0,GO506_20_6431,25.463641400535032,\\\"-73.68691 40.820317, -73.690054 40.815413\\\",GO506_20_6431\"\n]\n+ },\n+ {\n+ \"name\": \"2 chunks breaks quoted data, 1 line\",\n+ \"chunks\": [\"ab\\\"\\ncd\\nef\", \"g\\\"h\"],\n+ \"lines\": [\"ab\\\"\\ncd\\nefg\\\"h\"]\n+ },\n+ {\n+ \"name\": \"2 chunks breaks quoted data, 2 lines\",\n+ \"chunks\": [\"ab\\\"\", \"c\\\"\\nd\"],\n+ \"lines\": [\"ab\\\"c\\\"\", \"d\"]\n}\n]\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core/query): repair wrong quote detection in chunks to lines transformation
305,159
17.08.2020 12:42:37
-7,200
8f6621b1bb35b30b3a4a66bab98e6665455e6e3f
feat(core): allow context path in node transport
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -45,6 +45,7 @@ export class NodeHttpTransport implements Transport {\noptions: http.RequestOptions,\ncallback: (res: http.IncomingMessage) => void\n) => http.ClientRequest\n+ private contextPath: string\n/**\n* Creates a node transport using for the client options supplied.\n* @param connectionOptions - connection options\n@@ -59,6 +60,13 @@ export class NodeHttpTransport implements Transport {\nprotocol: url.protocol,\nhostname: url.hostname,\n}\n+ this.contextPath = url.path ?? ''\n+ if (this.contextPath.endsWith('/')) {\n+ this.contextPath = this.contextPath.substring(\n+ 0,\n+ this.contextPath.length - 1\n+ )\n+ }\nif (url.protocol === 'http:') {\nthis.requestApi = http.request\n} else if (url.protocol === 'https:') {\n@@ -161,7 +169,7 @@ export class NodeHttpTransport implements Transport {\n}\nconst options: {[key: string]: any} = {\n...this.defaultOptions,\n- path,\n+ path: this.contextPath + path,\nmethod: sendOptions.method,\nheaders: {\n...headers,\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": "@@ -67,6 +67,32 @@ describe('NodeHttpTransport', () => {\n})\nexpect(transport.requestApi).to.equal(https.request)\n})\n+ it('creates the transport with contextPath', () => {\n+ const transport: any = new NodeHttpTransport({\n+ url: 'http://test:9999/influx',\n+ })\n+ expect(transport.defaultOptions).to.deep.equal({\n+ hostname: 'test',\n+ port: '9999',\n+ protocol: 'http:',\n+ timeout: 10000,\n+ url: 'http://test:9999/influx',\n+ })\n+ expect(transport.contextPath).equals('/influx')\n+ })\n+ it('creates the transport with contextPath/', () => {\n+ const transport: any = new NodeHttpTransport({\n+ url: 'http://test:9999/influx/',\n+ })\n+ expect(transport.defaultOptions).to.deep.equal({\n+ hostname: 'test',\n+ port: '9999',\n+ protocol: 'http:',\n+ timeout: 10000,\n+ url: 'http://test:9999/influx/',\n+ })\n+ expect(transport.contextPath).equals('/influx')\n+ })\nit('does not create the transport from other uri', () => {\nexpect(\n() =>\n@@ -100,6 +126,7 @@ describe('NodeHttpTransport', () => {\n'accept-encoding': 'gzip',\n},\n},\n+ {contextPath: '/context'},\n]\nfor (let i = 0; i < extraOptions.length; i++) {\nconst extras = extraOptions[i]\n@@ -113,7 +140,7 @@ describe('NodeHttpTransport', () => {\n)\nlet responseRead = false\nconst context = nock(transportOptions.url)\n- .post('/test')\n+ .post((extras.contextPath ?? '') + '/test')\n.reply((_uri, _requestBody) => [\n200,\nnew Readable({\n@@ -150,6 +177,7 @@ describe('NodeHttpTransport', () => {\nnew NodeHttpTransport({\n...extras,\n...transportOptions,\n+ url: transportOptions.url + (extras.contextPath ?? ''),\n}).send(\n'/test',\n'',\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): allow context path in node transport
305,159
19.08.2020 09:36:13
-7,200
1738998e1517cff67464dfdb6c18498ad028634c
fix(core): change ColumnType to include any string
[ { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableColumn.ts", "new_path": "packages/core/src/query/FluxTableColumn.ts", "diff": "@@ -8,8 +8,9 @@ export type ColumnType =\n| 'double'\n| 'string'\n| 'base64Binary'\n- | 'dateTime'\n+ | 'dateTime:RFC3339'\n| 'duration'\n+ | string\n/**\n* FluxTableColumnLike provides metadata of a flux table column.\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core): change ColumnType to include any string
305,159
19.08.2020 11:38:06
-7,200
fbcc5be10ecf077003f54dac62d43d7214984b45
feat(core): add helpers to let users choose how to deserialize dateTime:RFC3339 query response data type
[ { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableMetaData.ts", "new_path": "packages/core/src/query/FluxTableMetaData.ts", "diff": "@@ -13,9 +13,41 @@ export const typeSerializers: Record<ColumnType, (val: string) => any> = {\ndouble: (x: string): any => (x === '' ? null : +x),\nstring: identity,\nbase64Binary: identity,\n- dateTime: (x: string): any => (x === '' ? null : x),\nduration: (x: string): any => (x === '' ? null : x),\n+ 'dateTime:RFC3339': (x: string): any => (x === '' ? null : x),\n}\n+\n+/**\n+ * serializeDateTimeAsDate changes type serializers to return JavaScript Date instances\n+ * for 'dateTime:RFC3339' query result data type. Empty value is converted to null.\n+ * @remarks\n+ * Please note that the result has millisecond precision whereas InfluxDB returns dateTime\n+ * in nanosecond precision.\n+ */\n+export function serializeDateTimeAsDate(): void {\n+ typeSerializers['dateTime:RFC3339'] = (x: string): any =>\n+ x === '' ? null : new Date(Date.parse(x))\n+}\n+/**\n+ * serializeDateTimeAsNumber changes type serializers to return milliseconds since epoch\n+ * for 'dateTime:RFC3339' query result data type. Empty value is converted to null.\n+ * @remarks\n+ * Please note that the result has millisecond precision whereas InfluxDB returns dateTime\n+ * in nanosecond precision.\n+ */\n+export function serializeDateTimeAsNumber(): void {\n+ typeSerializers['dateTime:RFC3339'] = (x: string): any =>\n+ x === '' ? null : Date.parse(x)\n+}\n+/**\n+ * serializeDateTimeAsString changes type serializers to return string values\n+ * for `dateTime:RFC3339` query result data type. Empty value is converted to null.\n+ */\n+export function serializeDateTimeAsString(): void {\n+ typeSerializers['dateTime:RFC3339'] = (x: string): any =>\n+ x === '' ? null : x\n+}\n+\n/**\n* Represents metadata of a {@link http://bit.ly/flux-spec#table | flux table}.\n*/\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/index.ts", "new_path": "packages/core/src/query/index.ts", "diff": "export {\ndefault as FluxTableMetaData,\ntypeSerializers,\n+ serializeDateTimeAsDate,\n+ serializeDateTimeAsNumber,\n+ serializeDateTimeAsString,\n} from './FluxTableMetaData'\nexport {default as FluxResultObserver} from './FluxResultObserver'\nexport {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/query/FluxTableMetaData.test.ts", "new_path": "packages/core/test/unit/query/FluxTableMetaData.test.ts", "diff": "@@ -3,6 +3,9 @@ import {\nFluxTableMetaData,\nColumnType,\ntypeSerializers,\n+ serializeDateTimeAsDate,\n+ serializeDateTimeAsNumber,\n+ serializeDateTimeAsString,\n} from '../../../src'\nimport {expect} from 'chai'\n@@ -56,7 +59,7 @@ describe('FluxTableMetaData', () => {\n['string', '1', '1'],\n['base64Binary', '1', '1'],\n['dateTime', '1', '1'],\n- ['dateTime', '', null],\n+ ['dateTime:RFC3339', '', null],\n['duration', '1', '1'],\n['duration', '', null],\n[undefined, '1', '1'],\n@@ -74,16 +77,18 @@ describe('FluxTableMetaData', () => {\n})\n}\ndescribe('custom serialization', () => {\n- const type = 'long'\n- let original: (x: string) => any\n+ let originalLong: (x: string) => any\n+ let originalDateTime: (x: string) => any\nbeforeEach(() => {\n- original = typeSerializers[type]\n- typeSerializers[type] = (_x: string): any => []\n+ originalLong = typeSerializers['long']\n+ originalDateTime = typeSerializers['dateTime:RFC3339']\n})\nafterEach(() => {\n- typeSerializers[type] = original\n+ typeSerializers['long'] = originalLong\n+ typeSerializers['dateTime:RFC3339'] = originalDateTime\n})\n- it('cutomized srialization', () => {\n+ it('customizes serialization of long datatype', () => {\n+ typeSerializers['long'] = (_x: string): any => []\nconst columns: FluxTableColumn[] = [\nFluxTableColumn.from({\nlabel: 'a',\n@@ -94,5 +99,51 @@ describe('FluxTableMetaData', () => {\nconst subject = new FluxTableMetaData(columns)\nexpect(subject.toObject([''])).to.deep.equal({a: []})\n})\n+ it('customizes serialization using serializeDateTimeAsDate', () => {\n+ serializeDateTimeAsDate()\n+ const columns: FluxTableColumn[] = [\n+ FluxTableColumn.from({\n+ label: 'a',\n+ dataType: 'dateTime:RFC3339',\n+ group: false,\n+ }),\n+ ]\n+ const subject = new FluxTableMetaData(columns)\n+ expect(subject.toObject([''])).to.deep.equal({a: null})\n+ expect(\n+ subject.toObject(['2020-08-19T09:14:23.798594313Z'])\n+ ).to.deep.equal({a: new Date(1597828463798)})\n+ })\n+ it('customizes serialization using serializeDateTimeAsNumber', () => {\n+ serializeDateTimeAsNumber()\n+ const columns: FluxTableColumn[] = [\n+ FluxTableColumn.from({\n+ label: 'a',\n+ dataType: 'dateTime:RFC3339',\n+ group: false,\n+ }),\n+ ]\n+ const subject = new FluxTableMetaData(columns)\n+ expect(subject.toObject([''])).to.deep.equal({a: null})\n+ expect(\n+ subject.toObject(['2020-08-19T09:14:23.798594313Z'])\n+ ).to.deep.equal({a: 1597828463798})\n+ })\n+ it('customizes serialization using serializeDateTimeAsString', () => {\n+ serializeDateTimeAsDate()\n+ serializeDateTimeAsString()\n+ const columns: FluxTableColumn[] = [\n+ FluxTableColumn.from({\n+ label: 'a',\n+ dataType: 'dateTime:RFC3339',\n+ group: false,\n+ }),\n+ ]\n+ const subject = new FluxTableMetaData(columns)\n+ expect(subject.toObject([''])).to.deep.equal({a: null})\n+ expect(\n+ subject.toObject(['1970-01-01T00:26:16.063594313Z'])\n+ ).to.deep.equal({a: '1970-01-01T00:26:16.063594313Z'})\n+ })\n})\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): add helpers to let users choose how to deserialize dateTime:RFC3339 query response data type
305,159
19.08.2020 18:53:28
-7,200
ce8ffb1e0b6759abb3d892ff9810d31f06bcd4f4
fix(core): repair quoted escaping of backslash
[ { "change_type": "MODIFY", "old_path": "packages/core/src/util/escape.ts", "new_path": "packages/core/src/util/escape.ts", "diff": "@@ -115,7 +115,7 @@ export const escape = {\nnew Escaper(\n{\n'\"': escaperConfig,\n- '\\\\\\\\': escaperConfig,\n+ '\\\\': escaperConfig,\n},\n'\"'\n)\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/fixture/pointTables.json", "new_path": "packages/core/test/fixture/pointTables.json", "diff": "},\n\"convertTime\": \"11111\"\n}\n+ },\n+ {\n+ \"name\": \"m11\",\n+ \"fields\": [[\"f\", \"s\", \"\\\\\\\"\"]],\n+ \"line\": \"m11 f=\\\"\\\\\\\\\\\\\\\"\\\"\"\n}\n]\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core): repair quoted escaping of backslash
305,159
25.08.2020 08:05:58
-7,200
9a012ac67984d5f5add9a7732e1d2d81c820db4c
chore(examples): rename env vars
[ { "change_type": "MODIFY", "old_path": "examples/env.js", "new_path": "examples/env.js", "diff": "/** InfluxDB v2 URL */\n-const url = process.env['INFLUXDB_URL'] || 'http://localhost:9999'\n+const url = process.env['INFLUX_URL'] || 'http://localhost:9999'\n/** InfluxDB authorization token */\n-const token = process.env['INFLUXDB_TOKEN'] || 'my-token'\n-/** Organization within InfluxDB URL */\n-const org = process.env['INFLUXDB_ORG'] || 'my-org'\n+const token = process.env['INFLUX_TOKEN'] || 'my-token'\n+/** Organization within InfluxDB */\n+const org = process.env['INFLUX_ORG'] || 'my-org'\n/**InfluxDB bucket used in examples */\nconst bucket = 'my-bucket'\n// ONLY onboarding example\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(examples): rename env vars
305,159
26.08.2020 16:25:44
-7,200
504240d42ac86656d456470b2198291251e43dad
fix(core): throw exception when using closed writeApi
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -187,18 +187,30 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\n}\nwriteRecord(record: string): void {\n+ if (this.closed) {\n+ throw new Error('writeApi: already closed!')\n+ }\nthis.writeBuffer.add(record)\n}\nwriteRecords(records: ArrayLike<string>): void {\n+ if (this.closed) {\n+ throw new Error('writeApi: already closed!')\n+ }\nfor (let i = 0; i < records.length; i++) {\nthis.writeBuffer.add(records[i])\n}\n}\nwritePoint(point: Point): void {\n+ if (this.closed) {\n+ throw new Error('writeApi: already closed!')\n+ }\nconst line = point.toLineProtocol(this)\nif (line) this.writeBuffer.add(line)\n}\nwritePoints(points: ArrayLike<Point>): void {\n+ if (this.closed) {\n+ throw new Error('writeApi: already closed!')\n+ }\nfor (let i = 0; i < points.length; i++) {\nthis.writePoint(points[i])\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -81,6 +81,21 @@ describe('WriteApi', () => {\nexpect(e).to.be.ok\n})\n})\n+ it('fails on write if it is closed already', async () => {\n+ await subject.close()\n+ expect(() => subject.writeRecord('text value=1')).to.throw(\n+ 'writeApi: already closed!'\n+ )\n+ expect(() =>\n+ subject.writeRecords(['text value=1', 'text value=2'])\n+ ).to.throw('writeApi: already closed!')\n+ expect(() =>\n+ subject.writePoint(new Point('test').floatField('value', 1))\n+ ).to.throw('writeApi: already closed!')\n+ expect(() =>\n+ subject.writePoints([new Point('test').floatField('value', 1)])\n+ ).to.throw('writeApi: already closed!')\n+ })\n})\ndescribe('configuration', () => {\nlet subject: WriteApi\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core): throw exception when using closed writeApi
305,159
04.09.2020 07:26:50
-7,200
c429cdf10905ada790374a6f770556fee8b9f528
feat(core): simplify precision type during writeApi retrieval
[ { "change_type": "MODIFY", "old_path": "packages/core/src/InfluxDB.ts", "new_path": "packages/core/src/InfluxDB.ts", "diff": "import WriteApi from './WriteApi'\n-import {ClientOptions, WritePrecision, WriteOptions} from './options'\n+import {\n+ ClientOptions,\n+ WritePrecision,\n+ WriteOptions,\n+ WritePrecisionType,\n+} from './options'\nimport WriteApiImpl from './impl/WriteApiImpl'\nimport {IllegalArgumentError} from './errors'\nimport {Transport} from './transport'\n@@ -56,7 +61,7 @@ export default class InfluxDB {\ngetWriteApi(\norg: string,\nbucket: string,\n- precision: WritePrecision = WritePrecision.ns,\n+ precision: WritePrecisionType = WritePrecision.ns,\nwriteOptions?: Partial<WriteOptions>\n): WriteApi {\nreturn new WriteApiImpl(\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 {\n- WritePrecision,\nDEFAULT_WriteOptions,\nPointSettings,\nWriteOptions,\n+ WritePrecisionType,\n} from '../options'\nimport {Transport, SendOptions} from '../transport'\nimport Logger from './Logger'\n@@ -75,7 +75,7 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nprivate transport: Transport,\norg: string,\nbucket: string,\n- precision: WritePrecision,\n+ precision: WritePrecisionType,\nwriteOptions?: Partial<WriteOptions>\n) {\nthis.httpPath = `/api/v2/write?org=${encodeURIComponent(\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/options.ts", "new_path": "packages/core/src/options.ts", "diff": "@@ -113,6 +113,7 @@ export const enum WritePrecision {\n/* second */\ns = 's',\n}\n+export type WritePrecisionType = keyof typeof WritePrecision | WritePrecision\n/**\n* Settings that control the way of how a {@link Point} is serialized\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/Influxdb.test.ts", "new_path": "packages/core/test/unit/Influxdb.test.ts", "diff": "@@ -90,6 +90,7 @@ describe('InfluxDB', () => {\nit('serves queryApi writeApi without a pending schedule', () => {\nexpect(influxDb.getWriteApi('org', 'bucket')).to.be.ok\nexpect(influxDb.getWriteApi('org', 'bucket', WritePrecision.s)).to.be.ok\n+ expect(influxDb.getWriteApi('org', 'bucket', 's')).to.be.ok\n})\nit('serves queryApi', () => {\nexpect(influxDb.getQueryApi('my-org') as any)\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -7,6 +7,7 @@ import {\nPoint,\nWriteApi,\nInfluxDB,\n+ WritePrecisionType,\n} from '../../src'\nimport {collectLogging, CollectedLogs} from '../util'\nimport Logger from '../../src/impl/Logger'\n@@ -24,7 +25,7 @@ const WRITE_PATH_NS = `/api/v2/write?org=${ORG}&bucket=${BUCKET}&precision=ns`\nfunction createApi(\norg: string,\nbucket: string,\n- precision: WritePrecision,\n+ precision: WritePrecisionType,\noptions: Partial<WriteOptions>\n): WriteApi {\nreturn new InfluxDB({\n@@ -209,7 +210,7 @@ describe('WriteApi', () => {\nlet subject: WriteApi\nlet logs: CollectedLogs\nfunction useSubject(writeOptions: Partial<WriteOptions>): void {\n- subject = createApi(ORG, BUCKET, WritePrecision.ns, {\n+ subject = createApi(ORG, BUCKET, 'ns', {\nretryJitter: 0,\ndefaultTags: {xtra: '1'},\n...writeOptions,\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): simplify precision type during writeApi retrieval
305,159
09.09.2020 08:19:44
-7,200
adec4b786216722b0d90c9a5d5fec13da39ec779
fix(core): repair nesting of flux expressions
[ { "change_type": "MODIFY", "old_path": "packages/core/src/query/flux.ts", "new_path": "packages/core/src/query/flux.ts", "diff": "@@ -222,7 +222,9 @@ export function flux(\nstrings: TemplateStringsArray,\n...values: any\n): ParameterizedQuery {\n- if (strings.length == 1 && (!values || values.length === 0)) return strings[0] // the simplest case\n+ if (strings.length == 1 && (!values || values.length === 0)) {\n+ return fluxExpression(strings[0]) // the simplest case\n+ }\nconst parts = new Array<string>(strings.length + values.length)\nlet partIndex = 0\nfor (let i = 0; i < strings.length; i++) {\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": "@@ -127,37 +127,49 @@ describe('Flux Values', () => {\n})\ndescribe('Flux Tagged Template', () => {\n+ it('creates a string from string', () => {\nexpect(\n- flux`from(bucket:\"my-bucket\") |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")`.toString(),\n+ flux`from(bucket:\"my-bucket\") |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")`.toString()\n+ ).equals(\n'from(bucket:\"my-bucket\") |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")'\n)\n+ })\n+ it('interpolates a number', () => {\nexpect(\n- flux`from(bucket:\"my-bucket\") |> range(start: ${0}) |> filter(fn: (r) => r._measurement == ${'temperature'})`.toString(),\n+ flux`from(bucket:\"my-bucket\") |> range(start: ${0}) |> filter(fn: (r) => r._measurement == ${'temperature'})`.toString()\n+ ).equals(\n'from(bucket:\"my-bucket\") |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")'\n)\n+ })\n+ it('interpolates a string', () => {\nexpect(\n- flux`from(bucket:\"my-bucket\") |> range(start: ${0}) |> filter(fn: (r) => r._measurement == \"${'temperature'}\")`.toString(),\n+ flux`from(bucket:${'my-bucket'}) |> range(start: 0) |> filter(fn: (r) => r._measurement == ${'temperature'})`.toString()\n+ ).equals(\n'from(bucket:\"my-bucket\") |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")'\n)\n-\n+ })\n+ it('fails on undefined', () => {\ntry {\nflux`${undefined}`\nexpect.fail()\n} catch (_e) {\n// ok expected, undefined is not supported\n}\n-\n+ })\n+ it('fails on wrong usage of template', () => {\ntry {\nflux((['1', '2'] as any) as TemplateStringsArray)\nexpect.fail()\n} catch (_e) {\n// ok expected, too few arguments supplied to a tagged template\n}\n+ })\n+ it('processes a nested flux template', () => {\n// nested flux templates\nconst flux1 = flux`from(bucket:\"my-bucket\")`\n- expect(\n- flux`${flux1} |> range(start: ${0})\")`.toString(),\n+ expect(flux`${flux1} |> range(start: ${0})\")`.toString()).equals(\n'from(bucket:\"my-bucket\") |> range(start: 0)\")'\n)\n})\n+})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core): repair nesting of flux expressions
305,159
09.09.2020 08:28:54
-7,200
da64b54b4d1fdeee9a002b33444d7e629bf682c9
chore(core): improve flux template tests
[ { "change_type": "MODIFY", "old_path": "packages/core/test/unit/query/flux.test.ts", "new_path": "packages/core/test/unit/query/flux.test.ts", "diff": "@@ -127,7 +127,7 @@ describe('Flux Values', () => {\n})\ndescribe('Flux Tagged Template', () => {\n- it('creates a string from string', () => {\n+ it('creates a string from a simple string', () => {\nexpect(\nflux`from(bucket:\"my-bucket\") |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")`.toString()\n).equals(\n@@ -165,11 +165,18 @@ describe('Flux Tagged Template', () => {\n}\n})\n- it('processes a nested flux template', () => {\n+ it('processes a simple nested flux template', () => {\n// nested flux templates\nconst flux1 = flux`from(bucket:\"my-bucket\")`\nexpect(flux`${flux1} |> range(start: ${0})\")`.toString()).equals(\n'from(bucket:\"my-bucket\") |> range(start: 0)\")'\n)\n})\n+ it('processes a simple nested flux template', () => {\n+ // nested flux templates\n+ const flux1 = flux`from(bucket:${'my-bucket'})`\n+ expect(flux`${flux1} |> range(start: ${0})\")`.toString()).equals(\n+ 'from(bucket:\"my-bucket\") |> range(start: 0)\")'\n+ )\n+ })\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): improve flux template tests
305,159
09.09.2020 09:20:50
-7,200
4de106c33c1ef32572cbc12d237f3b2cee3f3e81
chore(core): allow empty nested flux template
[ { "change_type": "MODIFY", "old_path": "packages/core/src/query/flux.ts", "new_path": "packages/core/src/query/flux.ts", "diff": "@@ -28,6 +28,15 @@ class FluxParameter implements FluxParameterLike, ParameterizedQuery {\n}\n}\n+/**\n+ * Checks if the supplied object is FluxParameterLike\n+ * @param value - any value\n+ * @returns true if it is\n+ */\n+function isFluxParameterLike(value: any): boolean {\n+ return typeof value === 'object' && typeof value[FLUX_VALUE] === 'function'\n+}\n+\n/**\n* Escapes content of the supplied string so it can be wrapped into double qoutes\n* to become a [flux string literal](https://docs.influxdata.com/flux/v0.65/language/lexical-elements/#string-literals).\n@@ -243,11 +252,14 @@ export function flux(\n} else {\nsanitized = toFluxValue(val)\nif (sanitized === '') {\n+ // do not allow to insert empty strings, unless it is FluxParameterLike\n+ if (!isFluxParameterLike(val)) {\nthrow new Error(\n`Unsupported parameter literal '${val}' at index: ${i}, type: ${typeof val}`\n)\n}\n}\n+ }\nparts[partIndex++] = sanitized\n} else if (i < strings.length - 1) {\nthrow new Error('Too few parameters supplied!')\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": "@@ -148,6 +148,11 @@ describe('Flux Tagged Template', () => {\n'from(bucket:\"my-bucket\") |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")'\n)\n})\n+ it('interpolates a wrapped string', () => {\n+ expect(flux`from(bucket:\"${'my-bucket'}\")`.toString()).equals(\n+ 'from(bucket:\"my-bucket\")'\n+ )\n+ })\nit('fails on undefined', () => {\ntry {\nflux`${undefined}`\n@@ -156,6 +161,19 @@ describe('Flux Tagged Template', () => {\n// ok expected, undefined is not supported\n}\n})\n+ it('fails on empty toString', () => {\n+ try {\n+ const x = {\n+ toString(): string {\n+ return ''\n+ },\n+ }\n+ flux`${x}`\n+ expect.fail()\n+ } catch (_e) {\n+ // ok expected, undefined is not supported\n+ }\n+ })\nit('fails on wrong usage of template', () => {\ntry {\nflux((['1', '2'] as any) as TemplateStringsArray)\n@@ -166,17 +184,21 @@ describe('Flux Tagged Template', () => {\n})\nit('processes a simple nested flux template', () => {\n- // nested flux templates\nconst flux1 = flux`from(bucket:\"my-bucket\")`\nexpect(flux`${flux1} |> range(start: ${0})\")`.toString()).equals(\n'from(bucket:\"my-bucket\") |> range(start: 0)\")'\n)\n})\n- it('processes a simple nested flux template', () => {\n- // nested flux templates\n+ it('processes a parameterized nested flux template', () => {\nconst flux1 = flux`from(bucket:${'my-bucket'})`\nexpect(flux`${flux1} |> range(start: ${0})\")`.toString()).equals(\n'from(bucket:\"my-bucket\") |> range(start: 0)\")'\n)\n})\n+ it('processes an empty nested flux template', () => {\n+ const empty = flux``\n+ expect(flux`from(bucket:\"my-bucket\")${empty}`.toString()).equals(\n+ 'from(bucket:\"my-bucket\")'\n+ )\n+ })\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): allow empty nested flux template
305,159
09.09.2020 10:51:57
-7,200
c0e7b5341ef80cbbabb45bdefdc6471c85f14163
chore: improve flux template tests
[ { "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,12 +24,7 @@ describe('Flux Values', () => {\nconst subject = fluxInteger(123)\nexpect(subject.toString()).equals('123')\nexpect((subject as any)[FLUX_VALUE]()).equals('123')\n- try {\n- fluxInteger('123a')\n- expect.fail()\n- } catch (_e) {\n- // OK, this must happen\n- }\n+ expect(() => fluxInteger('123a')).to.throw()\n})\nit('creates fluxBool', () => {\nexpect(fluxBool('true').toString()).equals('true')\n@@ -49,18 +44,8 @@ describe('Flux Values', () => {\nconst subject = fluxFloat(123.456)\nexpect(subject.toString()).equals('123.456')\nexpect((subject as any)[FLUX_VALUE]()).equals('123.456')\n- try {\n- fluxFloat('123..')\n- expect.fail()\n- } catch (_e) {\n- // OK, this must happen\n- }\n- try {\n- fluxFloat('123.a')\n- expect.fail()\n- } catch (_e) {\n- // OK, this must happen\n- }\n+ expect(() => fluxFloat('123..')).to.throw()\n+ expect(() => fluxFloat('123.a')).to.throw()\n})\nit('creates fluxDuration', () => {\nconst subject = fluxDuration('1ms')\n@@ -154,25 +139,15 @@ describe('Flux Tagged Template', () => {\n)\n})\nit('fails on undefined', () => {\n- try {\n- flux`${undefined}`\n- expect.fail()\n- } catch (_e) {\n- // ok expected, undefined is not supported\n- }\n+ expect(() => flux`${undefined}`).to.throw()\n})\n- it('fails on empty toString', () => {\n- try {\n+ it('converts object with empty toString to \"\"', () => {\nconst x = {\ntoString(): string {\nreturn ''\n},\n}\n- flux`${x}`\n- expect.fail()\n- } catch (_e) {\n- // ok expected, undefined is not supported\n- }\n+ expect(flux`${x}`.toString()).equals('\"\"')\n})\nit('fails on wrong usage of template', () => {\ntry {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve flux template tests
305,159
09.09.2020 12:40:40
-7,200
763ec635247cb492acbbcdbac8d99882596165d2
feat(core/query): allow to receive the whole query response as text
[ { "change_type": "MODIFY", "old_path": "packages/core/src/QueryApi.ts", "new_path": "packages/core/src/QueryApi.ts", "diff": "@@ -119,4 +119,13 @@ export default interface QueryApi {\n* @returns Promise of returned csv lines\n*/\ncollectLines(query: string | ParameterizedQuery): Promise<Array<string>>\n+\n+ /**\n+ * Text executes the query and returns the full response body as a string.\n+ * Use with caution, a possibly huge stream is copied to memory.\n+ *\n+ * @param query - query\n+ * @returns Promise of response text\n+ */\n+ text(query: string | ParameterizedQuery): Promise<string>\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/QueryApiImpl.ts", "new_path": "packages/core/src/impl/QueryApiImpl.ts", "diff": "@@ -108,6 +108,28 @@ export class QueryApiImpl implements QueryApi {\n})\n}\n+ text(query: string | ParameterizedQuery): Promise<string> {\n+ const {org, type, gzip} = this.options\n+ return this.transport.request(\n+ `/api/v2/query?org=${encodeURIComponent(org)}`,\n+ JSON.stringify(\n+ this.decorateRequest({\n+ query: query.toString(),\n+ dialect: DEFAULT_dialect,\n+ type,\n+ })\n+ ),\n+ {\n+ method: 'POST',\n+ headers: {\n+ accept: 'text/csv',\n+ 'accept-encoding': gzip ? 'gzip' : 'identity',\n+ 'content-type': 'application/json; encoding=utf-8',\n+ },\n+ }\n+ )\n+ }\n+\nprivate createExecutor(query: string | ParameterizedQuery): QueryExecutor {\nconst {org, type, gzip} = this.options\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -118,18 +118,8 @@ export default class FetchTransport implements Transport {\nconst {status, headers} = response\nconst responseContentType = headers.get('content-type') || ''\n- let data = undefined\n- try {\n- if (responseContentType.includes('json')) {\n- data = await response.json()\n- } else if (responseContentType.includes('text')) {\n- data = await response.text()\n- }\n- } catch (_e) {\n- // ignore\n- Logger.warn('Unable to read error body', _e)\n- }\nif (status >= 300) {\n+ let data = await response.text()\nif (!data) {\nconst headerError = headers.get('x-influxdb-error')\nif (headerError) {\n@@ -143,7 +133,12 @@ export default class FetchTransport implements Transport {\nresponse.headers.get('retry-after')\n)\n}\n- return data\n+ const responseType = options.headers?.accept ?? responseContentType\n+ if (responseType.includes('json')) {\n+ return await response.json()\n+ } else if (responseType.includes('text')) {\n+ return await response.text()\n+ }\n}\nprivate fetch(\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -126,10 +126,11 @@ export class NodeHttpTransport implements Transport {\nbuffer = Buffer.concat([buffer, data])\n},\ncomplete: (): void => {\n+ const responseType = options.headers?.accept ?? contentType\ntry {\n- if (contentType.includes('json')) {\n+ if (responseType.includes('json')) {\nresolve(JSON.parse(buffer.toString('utf8')))\n- } else if (contentType.includes('text')) {\n+ } else if (responseType.includes('text')) {\nresolve(buffer.toString('utf8'))\n} else {\nresolve(buffer)\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/integration/rxjs/QueryApi.test.ts", "new_path": "packages/core/test/integration/rxjs/QueryApi.test.ts", "diff": "@@ -53,14 +53,13 @@ describe('RxJS QueryApi integration', () => {\n})\n.persist()\n- try {\nawait from(subject.rows('from(bucket:\"my-bucket\") |> range(start: 0)'))\n.pipe(toArray())\n.toPromise()\n- expect.fail('Server returned 500!')\n- } catch (_) {\n- // expected failure\n- }\n+ .then(\n+ () => expect.fail('Server returned 500!'),\n+ () => true // failure is expected\n+ )\n})\n;[\n['response2', undefined],\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/QueryApi.test.ts", "new_path": "packages/core/test/unit/QueryApi.test.ts", "diff": "@@ -238,12 +238,12 @@ describe('QueryApi', () => {\n]\n})\n.persist()\n- try {\n- await subject.collectLines('from(bucket:\"my-bucket\") |> range(start: 0)')\n- expect.fail('client error expected on server error')\n- } catch (e) {\n- // OK error is expected\n- }\n+ await subject\n+ .collectLines('from(bucket:\"my-bucket\") |> range(start: 0)')\n+ .then(\n+ () => expect.fail('client error expected on server error'),\n+ () => true // failure is expected\n+ )\n})\nit('collectRows collects rows', async () => {\nconst subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n@@ -297,11 +297,101 @@ describe('QueryApi', () => {\n]\n})\n.persist()\n- try {\n- await subject.collectRows('from(bucket:\"my-bucket\") |> range(start: 0)')\n- expect.fail('client error expected on server error')\n- } catch (e) {\n- // OK error is expected\n- }\n+ await subject\n+ .collectRows('from(bucket:\"my-bucket\") |> range(start: 0)')\n+ .then(\n+ () => expect.fail('client error expected on server error'),\n+ () => true // error is expected\n+ )\n+ })\n+ it('collectLines collects raw lines', async () => {\n+ const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n+ nock(clientOptions.url)\n+ .post(QUERY_PATH)\n+ .reply((_uri, _requestBody) => {\n+ return [\n+ 200,\n+ fs.createReadStream('test/fixture/query/simpleResponse.txt'),\n+ {'retry-after': '1'},\n+ ]\n+ })\n+ .persist()\n+ const data = await subject.collectLines(\n+ 'from(bucket:\"my-bucket\") |> range(start: 0)'\n+ )\n+ expect(data).to.deep.equal(simpleResponseLines)\n+ })\n+ it('text returns the whole response text', async () => {\n+ const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n+ const expected = fs\n+ .readFileSync('test/fixture/query/simpleResponse.txt')\n+ .toString()\n+ nock(clientOptions.url)\n+ .post(QUERY_PATH)\n+ .reply((_uri, _requestBody) => {\n+ return [200, expected, {'retry-after': '1', 'content-type': 'text/csv'}]\n+ })\n+ .persist()\n+ const data = await subject.text(\n+ 'from(bucket:\"my-bucket\") |> range(start: 0)'\n+ )\n+ expect(data).equals(expected)\n+ })\n+ it('text returns the whole response even if response content type is not text', async () => {\n+ const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n+ const expected = fs\n+ .readFileSync('test/fixture/query/simpleResponse.txt')\n+ .toString()\n+ nock(clientOptions.url)\n+ .post(QUERY_PATH)\n+ .reply((_uri, _requestBody) => {\n+ return [200, expected, {'retry-after': '1'}]\n+ })\n+ .persist()\n+ const data = await subject.text(\n+ 'from(bucket:\"my-bucket\") |> range(start: 0)'\n+ )\n+ expect(data).equals(expected)\n+ })\n+ it('text returns the plain response text even it is gzip encoded', async () => {\n+ const subject = new InfluxDB(clientOptions)\n+ .getQueryApi(ORG)\n+ .with({gzip: true})\n+ nock(clientOptions.url)\n+ .post(QUERY_PATH)\n+ .reply((_uri, _requestBody) => {\n+ return [\n+ 200,\n+ fs\n+ .createReadStream('test/fixture/query/simpleResponse.txt')\n+ .pipe(zlib.createGzip()),\n+ {'content-encoding': 'gzip', 'content-type': 'text/csv'},\n+ ]\n+ })\n+ .persist()\n+ const data = await subject.text(\n+ 'from(bucket:\"my-bucket\") |> range(start: 0)'\n+ )\n+ const expected = fs\n+ .readFileSync('test/fixture/query/simpleResponse.txt')\n+ .toString()\n+ expect(data).equals(expected)\n+ })\n+ it('text fails on server error', async () => {\n+ const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n+ nock(clientOptions.url)\n+ .post(QUERY_PATH)\n+ .reply((_uri, _requestBody) => {\n+ return [\n+ 500,\n+ fs.createReadStream('test/fixture/query/simpleResponse.txt'),\n+ {'retry-after': '1'},\n+ ]\n+ })\n+ .persist()\n+ await subject.text('from(bucket:\"my-bucket\") |> range(start: 0)').then(\n+ () => expect.fail('client error expected on server error'),\n+ () => true // error is expected\n+ )\n})\n})\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": "@@ -61,7 +61,18 @@ describe('FetchTransport', () => {\n})\nexpect(response).is.deep.equal('{}')\n})\n- it('receives no data', async () => {\n+ it('receives text data even if response is application/json', async () => {\n+ emulateFetchApi({\n+ headers: {'content-type': 'application/json; charset=utf-8'},\n+ body: '{}',\n+ })\n+ const response = await transport.request('/whatever', '', {\n+ method: 'GET',\n+ headers: {accept: 'text/plain'},\n+ })\n+ expect(response).is.deep.equal('{}')\n+ })\n+ it('receives no data for HEAD method', async () => {\nemulateFetchApi({\nheaders: {},\nbody: '{}',\n@@ -71,15 +82,22 @@ describe('FetchTransport', () => {\n})\nexpect(response).is.equal(undefined)\n})\n- it('receives no data', async () => {\n+ it('throws error when unable to read response body', async () => {\nemulateFetchApi({\nheaders: {'content-type': 'text/plain'},\nbody: 'error',\n})\n- const response = await transport.request('/whatever', '', {\n+ await transport\n+ .request('/whatever', '', {\nmethod: 'POST',\n})\n- expect(response).is.equal(undefined)\n+ .then(\n+ () => Promise.reject('client error expected'),\n+ (e: any) =>\n+ expect(e)\n+ .property('message')\n+ .equals('error data') //thrown by emulator\n+ )\n})\nit('throws error', async () => {\nemulateFetchApi({\n@@ -87,15 +105,14 @@ describe('FetchTransport', () => {\nbody: '{}',\nstatus: 500,\n})\n- try {\n- await transport.request('/whatever', '', {\n+ await transport\n+ .request('/whatever', '', {\nmethod: 'GET',\n})\n- expect.fail()\n- } catch (_e) {\n- // eslint-disable-next-line no-console\n- // console.log(` OK, received ${_e}`)\n- }\n+ .then(\n+ () => Promise.reject('client error expected'),\n+ () => true // OK error\n+ )\n})\nit('throws error with X-Influxdb-Error header body', async () => {\nconst message = 'this is a header message'\n@@ -107,16 +124,17 @@ describe('FetchTransport', () => {\nbody: '',\nstatus: 500,\n})\n- try {\n- await transport.request('/whatever', '', {\n+ await transport\n+ .request('/whatever', '', {\nmethod: 'GET',\n})\n- expect.fail()\n- } catch (e) {\n+ .then(\n+ () => Promise.reject('client error expected'),\n+ (e: any) =>\nexpect(e)\n.property('body')\n.equals(message)\n- }\n+ )\n})\nit('throws error with empty body', async () => {\nemulateFetchApi({\n@@ -124,16 +142,17 @@ describe('FetchTransport', () => {\nbody: '',\nstatus: 500,\n})\n- try {\n- await transport.request('/whatever', '', {\n+ await transport\n+ .request('/whatever', '', {\nmethod: 'GET',\n})\n- expect.fail()\n- } catch (e) {\n+ .then(\n+ () => Promise.reject('client error expected'),\n+ (e: any) =>\nexpect(e)\n.property('body')\n.equals('')\n- }\n+ )\n})\n})\ndescribe('send', () => {\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": "@@ -39,12 +39,8 @@ function createResponse({\n}\nif (typeof body === 'string') {\nretVal.text = function(): Promise<string> {\n- if (typeof body === 'string') {\nif (body === 'error') return Promise.reject(new Error('error data'))\nreturn Promise.resolve(body)\n- } else {\n- return Promise.reject(new Error('String body expected, but ' + body))\n- }\n}\n}\nif (body instanceof Uint8Array) {\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": "@@ -549,6 +549,21 @@ describe('NodeHttpTransport', () => {\nexpect(retVal).deep.equals(pair[1])\n})\n})\n+ it(`return text even without explicit request headers `, async () => {\n+ nock(transportOptions.url)\n+ .get('/test')\n+ .reply(200, '..', {\n+ 'content-type': 'application/text',\n+ })\n+ .persist()\n+ const data = await new NodeHttpTransport({\n+ ...transportOptions,\n+ timeout: 10000,\n+ }).request('/test', '', {\n+ method: 'GET',\n+ })\n+ expect(data).equals('..')\n+ })\nit(`fails on invalid json`, async () => {\nnock(transportOptions.url)\n.get('/test')\n@@ -556,32 +571,35 @@ describe('NodeHttpTransport', () => {\n'content-type': 'application/json',\n})\n.persist()\n- try {\nawait new NodeHttpTransport({\n...transportOptions,\ntimeout: 10000,\n- }).request('/test', '', {\n+ })\n+ .request('/test', '', {\nmethod: 'GET',\n- headers: {'content-type': 'applicaiton/json'},\n+ headers: {'content-type': 'application/json'},\n})\n- expect.fail(`exception shall be thrown because of wrong JSON`)\n- } catch (e) {\n- expect(e)\n- }\n+ .then(\n+ () => expect.fail(`exception shall be thrown because of wrong JSON`),\n+ () => true // OK that it fails\n+ )\n})\nit(`fails on communication error`, async () => {\n- try {\nawait new NodeHttpTransport({\n...transportOptions,\ntimeout: 10000,\n- }).request('/test', '', {\n+ })\n+ .request('/test', '', {\nmethod: 'GET',\n- headers: {'content-type': 'applicaiton/json'},\n+ headers: {'content-type': 'application/json'},\n})\n- expect.fail(`exception shall be thrown because of wrong JSON`)\n- } catch (e) {\n- expect(e)\n- }\n+ .then(\n+ () =>\n+ expect.fail(\n+ `exception shall be thrown because of communication error`\n+ ),\n+ () => true // OK that it fails\n+ )\n})\n})\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core/query): allow to receive the whole query response as text
305,159
09.09.2020 18:35:39
-7,200
9b32a55ffd5934f8ed304f722980df834040a5c2
chore(core/queryApi): rename text to queryRaw
[ { "change_type": "MODIFY", "old_path": "packages/core/src/QueryApi.ts", "new_path": "packages/core/src/QueryApi.ts", "diff": "@@ -91,6 +91,15 @@ export default interface QueryApi {\nconsumer: FluxResultObserver<string[]>\n): void\n+ /**\n+ * QueryRaw executes a query and returns the full response as a string.\n+ * Use with caution, a possibly huge stream is copied to memory.\n+ *\n+ * @param query - query\n+ * @returns Promise of response text\n+ */\n+ queryRaw(query: string | ParameterizedQuery): Promise<string>\n+\n/**\n* CollectRows executes the query and collects all the results in the returned Promise.\n* This method is suitable to collect simple results. Use with caution,\n@@ -119,13 +128,4 @@ export default interface QueryApi {\n* @returns Promise of returned csv lines\n*/\ncollectLines(query: string | ParameterizedQuery): Promise<Array<string>>\n-\n- /**\n- * Text executes a query and returns the full response as a string.\n- * Use with caution, a possibly huge stream is copied to memory.\n- *\n- * @param query - query\n- * @returns Promise of response text\n- */\n- text(query: string | ParameterizedQuery): Promise<string>\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/QueryApiImpl.ts", "new_path": "packages/core/src/impl/QueryApiImpl.ts", "diff": "@@ -108,7 +108,7 @@ export class QueryApiImpl implements QueryApi {\n})\n}\n- text(query: string | ParameterizedQuery): Promise<string> {\n+ queryRaw(query: string | ParameterizedQuery): Promise<string> {\nconst {org, type, gzip} = this.options\nreturn this.transport.request(\n`/api/v2/query?org=${encodeURIComponent(org)}`,\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/QueryApi.test.ts", "new_path": "packages/core/test/unit/QueryApi.test.ts", "diff": "@@ -24,7 +24,7 @@ describe('QueryApi', () => {\nnock.cleanAll()\nnock.enableNetConnect()\n})\n- it('receives raw lines', async () => {\n+ it('receives lines', async () => {\nconst subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\nnock(clientOptions.url)\n.post(QUERY_PATH)\n@@ -209,7 +209,7 @@ describe('QueryApi', () => {\nexpect(body?.now).to.deep.equal(pair.now)\n}\n})\n- it('collectLines collects raw lines', async () => {\n+ it('collectLines collects lines', async () => {\nconst subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\nnock(clientOptions.url)\n.post(QUERY_PATH)\n@@ -304,24 +304,7 @@ describe('QueryApi', () => {\n() => true // error is expected\n)\n})\n- it('collectLines collects raw lines', async () => {\n- const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n- nock(clientOptions.url)\n- .post(QUERY_PATH)\n- .reply((_uri, _requestBody) => {\n- return [\n- 200,\n- fs.createReadStream('test/fixture/query/simpleResponse.txt'),\n- {'retry-after': '1'},\n- ]\n- })\n- .persist()\n- const data = await subject.collectLines(\n- 'from(bucket:\"my-bucket\") |> range(start: 0)'\n- )\n- expect(data).to.deep.equal(simpleResponseLines)\n- })\n- it('text returns the whole response text', async () => {\n+ it('queryRaw returns the whole response text', async () => {\nconst subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\nconst expected = fs\n.readFileSync('test/fixture/query/simpleResponse.txt')\n@@ -332,12 +315,12 @@ describe('QueryApi', () => {\nreturn [200, expected, {'retry-after': '1', 'content-type': 'text/csv'}]\n})\n.persist()\n- const data = await subject.text(\n+ const data = await subject.queryRaw(\n'from(bucket:\"my-bucket\") |> range(start: 0)'\n)\nexpect(data).equals(expected)\n})\n- it('text returns the whole response even if response content type is not text', async () => {\n+ it('queryRaw returns the whole response even if response content type is not text', async () => {\nconst subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\nconst expected = fs\n.readFileSync('test/fixture/query/simpleResponse.txt')\n@@ -348,12 +331,12 @@ describe('QueryApi', () => {\nreturn [200, expected, {'retry-after': '1'}]\n})\n.persist()\n- const data = await subject.text(\n+ const data = await subject.queryRaw(\n'from(bucket:\"my-bucket\") |> range(start: 0)'\n)\nexpect(data).equals(expected)\n})\n- it('text returns the plain response text even it is gzip encoded', async () => {\n+ it('queryRaw returns the plain response text even it is gzip encoded', async () => {\nconst subject = new InfluxDB(clientOptions)\n.getQueryApi(ORG)\n.with({gzip: true})\n@@ -369,7 +352,7 @@ describe('QueryApi', () => {\n]\n})\n.persist()\n- const data = await subject.text(\n+ const data = await subject.queryRaw(\n'from(bucket:\"my-bucket\") |> range(start: 0)'\n)\nconst expected = fs\n@@ -377,7 +360,7 @@ describe('QueryApi', () => {\n.toString()\nexpect(data).equals(expected)\n})\n- it('text fails on server error', async () => {\n+ it('queryRaw fails on server error', async () => {\nconst subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\nnock(clientOptions.url)\n.post(QUERY_PATH)\n@@ -389,7 +372,7 @@ describe('QueryApi', () => {\n]\n})\n.persist()\n- await subject.text('from(bucket:\"my-bucket\") |> range(start: 0)').then(\n+ await subject.queryRaw('from(bucket:\"my-bucket\") |> range(start: 0)').then(\n() => expect.fail('client error expected on server error'),\n() => true // error is expected\n)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core/queryApi): rename text to queryRaw
305,159
11.09.2020 09:35:20
-7,200
d6cf7aaec7a95f9abf0015b6e12da3de0cfb3f9b
fix(core/transport): return text data also for application/csv content type
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -136,7 +136,10 @@ export default class FetchTransport implements Transport {\nconst responseType = options.headers?.accept ?? responseContentType\nif (responseType.includes('json')) {\nreturn await response.json()\n- } else if (responseType.includes('text')) {\n+ } else if (\n+ responseType.includes('text') ||\n+ responseType.startsWith('application/csv')\n+ ) {\nreturn await response.text()\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -130,7 +130,10 @@ export class NodeHttpTransport implements Transport {\ntry {\nif (responseType.includes('json')) {\nresolve(JSON.parse(buffer.toString('utf8')))\n- } else if (responseType.includes('text')) {\n+ } else if (\n+ responseType.includes('text') ||\n+ responseType.startsWith('application/csv')\n+ ) {\nresolve(buffer.toString('utf8'))\n} else {\nresolve(buffer)\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": "@@ -61,6 +61,16 @@ describe('FetchTransport', () => {\n})\nexpect(response).is.deep.equal('{}')\n})\n+ it('receives text data for application/csv', async () => {\n+ emulateFetchApi({\n+ headers: {'content-type': 'application/csv'},\n+ body: '{}',\n+ })\n+ const response = await transport.request('/whatever', '', {\n+ method: 'GET',\n+ })\n+ expect(response).is.deep.equal('{}')\n+ })\nit('receives text data even if response is application/json', async () => {\nemulateFetchApi({\nheaders: {'content-type': 'application/json; charset=utf-8'},\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": "@@ -564,6 +564,21 @@ describe('NodeHttpTransport', () => {\n})\nexpect(data).equals('..')\n})\n+ it(`return text for CSV response`, async () => {\n+ nock(transportOptions.url)\n+ .get('/test')\n+ .reply(200, '..', {\n+ 'content-type': 'application/csv',\n+ })\n+ .persist()\n+ const data = await new NodeHttpTransport({\n+ ...transportOptions,\n+ timeout: 10000,\n+ }).request('/test', '', {\n+ method: 'GET',\n+ })\n+ expect(data).equals('..')\n+ })\nit(`fails on invalid json`, async () => {\nnock(transportOptions.url)\n.get('/test')\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core/transport): return text data also for application/csv content type
305,159
14.09.2020 09:16:05
-7,200
fbe7cf9990ea036d7f5b6f660f35909a1abb494a
chore(core): repair type of ChunkToLines
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/ChunksToLines.ts", "new_path": "packages/core/src/impl/ChunksToLines.ts", "diff": "@@ -4,7 +4,8 @@ import Cancellable from '../util/Cancellable'\n/**\n* Converts lines to table calls\n*/\n-export default class ChunksToLines implements CommunicationObserver<any> {\n+export default class ChunksToLines\n+ implements CommunicationObserver<Uint8Array> {\nprevious?: Uint8Array\nfinished = false\nquoted = false\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): repair type of ChunkToLines
305,159
15.09.2020 07:15:58
-7,200
a7684e8ab26fb68ca4eeb6901655efd71194c907
feat(apis): regenerate APIs from swagger
[ { "change_type": "MODIFY", "old_path": "packages/apis/resources/operations.json", "new_path": "packages/apis/resources/operations.json", "diff": "}\n]\n},\n- {\n- \"server\": \"/api/v2\",\n- \"path\": \"/scrapers/{scraperTargetID}/labels/{labelID}\",\n- \"operation\": \"patch\",\n- \"operationId\": \"PatchScrapersIDLabelsID\",\n- \"basicAuth\": false,\n- \"summary\": \"Update a label on a scraper target\",\n- \"positionalParams\": [\n- {\n- \"name\": \"scraperTargetID\",\n- \"description\": \"The scraper target ID.\",\n- \"required\": true,\n- \"type\": \"string\"\n- },\n- {\n- \"name\": \"labelID\",\n- \"description\": \"The label ID.\",\n- \"required\": true,\n- \"type\": \"string\"\n- }\n- ],\n- \"headerParams\": [\n- {\n- \"name\": \"Zap-Trace-Span\",\n- \"description\": \"OpenTracing span context\",\n- \"required\": false,\n- \"type\": \"string\"\n- }\n- ],\n- \"queryParams\": [],\n- \"bodyParam\": {\n- \"description\": \"Label update to apply\",\n- \"required\": true,\n- \"mediaType\": \"application/json\",\n- \"type\": \"Label\"\n- },\n- \"responses\": [\n- {\n- \"code\": \"200\",\n- \"description\": \"Updated successfully\",\n- \"mediaTypes\": []\n- },\n- {\n- \"code\": \"404\",\n- \"description\": \"Scraper target not found\",\n- \"mediaTypes\": [\n- {\n- \"mediaType\": \"application/json\",\n- \"type\": \"Error\"\n- }\n- ]\n- },\n- {\n- \"code\": \"default\",\n- \"description\": \"Unexpected error\",\n- \"mediaTypes\": [\n- {\n- \"mediaType\": \"application/json\",\n- \"type\": \"Error\"\n- }\n- ]\n- }\n- ]\n- },\n{\n\"server\": \"/api/v2\",\n\"path\": \"/scrapers/{scraperTargetID}/labels/{labelID}\",\n}\n],\n\"queryParams\": [\n+ {\n+ \"name\": \"offset\",\n+ \"required\": false,\n+ \"type\": \"number\"\n+ },\n+ {\n+ \"name\": \"limit\",\n+ \"required\": false,\n+ \"type\": \"number\"\n+ },\n+ {\n+ \"name\": \"descending\",\n+ \"required\": false,\n+ \"type\": \"any\"\n+ },\n{\n\"name\": \"owner\",\n\"description\": \"The owner ID.\",\n\"required\": false,\n\"type\": \"number\"\n},\n+ {\n+ \"name\": \"after\",\n+ \"description\": \"The last resource ID from which to seek from (but not including). This is to be used instead of `offset`.\\n\",\n+ \"required\": false,\n+ \"type\": \"string\"\n+ },\n{\n\"name\": \"org\",\n\"description\": \"The organization name.\",\n}\n],\n\"queryParams\": [\n+ {\n+ \"name\": \"offset\",\n+ \"required\": false,\n+ \"type\": \"number\"\n+ },\n+ {\n+ \"name\": \"limit\",\n+ \"required\": false,\n+ \"type\": \"number\"\n+ },\n+ {\n+ \"name\": \"descending\",\n+ \"required\": false,\n+ \"type\": \"any\"\n+ },\n{\n\"name\": \"org\",\n\"description\": \"Filter organizations to a specific organization name.\",\n}\n]\n},\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/orgs/{orgID}/owners/{userID}\",\n+ \"operation\": \"delete\",\n+ \"operationId\": \"DeleteOrgsIDOwnersID\",\n+ \"basicAuth\": false,\n+ \"summary\": \"Remove an owner from an organization\",\n+ \"positionalParams\": [\n+ {\n+ \"name\": \"userID\",\n+ \"description\": \"The ID of the owner to remove.\",\n+ \"required\": true,\n+ \"type\": \"string\"\n+ },\n+ {\n+ \"name\": \"orgID\",\n+ \"description\": \"The organization ID.\",\n+ \"required\": true,\n+ \"type\": \"string\"\n+ }\n+ ],\n+ \"headerParams\": [\n+ {\n+ \"name\": \"Zap-Trace-Span\",\n+ \"description\": \"OpenTracing span context\",\n+ \"required\": false,\n+ \"type\": \"string\"\n+ }\n+ ],\n+ \"queryParams\": [],\n+ \"bodyParam\": null,\n+ \"responses\": [\n+ {\n+ \"code\": \"204\",\n+ \"description\": \"Owner removed\",\n+ \"mediaTypes\": []\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Unexpected error\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n+ },\n{\n\"server\": \"/api/v2\",\n\"path\": \"/stacks\",\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/resources/swagger.yml", "new_path": "packages/apis/resources/swagger.yml", "diff": "@@ -1283,47 +1283,6 @@ paths:\napplication/json:\nschema:\n$ref: \"#/components/schemas/Error\"\n- patch:\n- operationId: PatchScrapersIDLabelsID\n- tags:\n- - ScraperTargets\n- summary: Update a label on a scraper target\n- parameters:\n- - $ref: \"#/components/parameters/TraceSpan\"\n- - in: path\n- name: scraperTargetID\n- schema:\n- type: string\n- required: true\n- description: The scraper target ID.\n- - in: path\n- name: labelID\n- schema:\n- type: string\n- required: true\n- description: The label ID.\n- requestBody:\n- description: Label update to apply\n- required: true\n- content:\n- application/json:\n- schema:\n- $ref: \"#/components/schemas/Label\"\n- responses:\n- \"200\":\n- description: Updated successfully\n- \"404\":\n- description: Scraper target not found\n- content:\n- application/json:\n- schema:\n- $ref: \"#/components/schemas/Error\"\n- default:\n- description: Unexpected error\n- content:\n- application/json:\n- schema:\n- $ref: \"#/components/schemas/Error\"\n\"/scrapers/{scraperTargetID}/members\":\nget:\noperationId: GetScrapersIDMembers\n@@ -2433,6 +2392,9 @@ paths:\nsummary: Get all dashboards\nparameters:\n- $ref: \"#/components/parameters/TraceSpan\"\n+ - $ref: \"#/components/parameters/Offset\"\n+ - $ref: \"#/components/parameters/Limit\"\n+ - $ref: \"#/components/parameters/Descending\"\n- in: query\nname: owner\ndescription: The owner ID.\n@@ -3504,6 +3466,7 @@ paths:\n- $ref: \"#/components/parameters/TraceSpan\"\n- $ref: \"#/components/parameters/Offset\"\n- $ref: \"#/components/parameters/Limit\"\n+ - $ref: \"#/components/parameters/After\"\n- in: query\nname: org\ndescription: The organization name.\n@@ -3940,6 +3903,9 @@ paths:\nsummary: List all organizations\nparameters:\n- $ref: \"#/components/parameters/TraceSpan\"\n+ - $ref: \"#/components/parameters/Offset\"\n+ - $ref: \"#/components/parameters/Limit\"\n+ - $ref: \"#/components/parameters/Descending\"\n- in: query\nname: org\nschema:\n@@ -4338,6 +4304,36 @@ paths:\napplication/json:\nschema:\n$ref: \"#/components/schemas/Error\"\n+ \"/orgs/{orgID}/owners/{userID}\":\n+ delete:\n+ operationId: DeleteOrgsIDOwnersID\n+ tags:\n+ - Users\n+ - Organizations\n+ summary: Remove an owner from an organization\n+ parameters:\n+ - $ref: \"#/components/parameters/TraceSpan\"\n+ - in: path\n+ name: userID\n+ schema:\n+ type: string\n+ required: true\n+ description: The ID of the owner to remove.\n+ - in: path\n+ name: orgID\n+ schema:\n+ type: string\n+ required: true\n+ description: The organization ID.\n+ responses:\n+ \"204\":\n+ description: Owner removed\n+ default:\n+ description: Unexpected error\n+ content:\n+ application/json:\n+ schema:\n+ $ref: \"#/components/schemas/Error\"\n/stacks:\nget:\noperationId: ListStacks\n@@ -6520,6 +6516,15 @@ components:\nrequired: false\nschema:\ntype: string\n+ After:\n+ in: query\n+ name: after\n+ required: false\n+ schema:\n+ type: string\n+ description: >\n+ The last resource ID from which to seek from (but not including).\n+ This is to be used instead of `offset`.\nschemas:\nLanguageRequest:\ndescription: Flux query to be analyzed.\n@@ -7531,8 +7536,13 @@ components:\ntype: string\ndescription: Key identified as environment reference and is the key identified in the template\nvalue:\n- type: string\ndescription: Value provided to fulfill reference\n+ nullable: true\n+ oneOf:\n+ - type: string\n+ - type: integer\n+ - type: number\n+ - type: boolean\ndefaultValue:\ndescription: Default value that will be provided for the reference when no value is provided\nnullable: true\n@@ -8949,6 +8959,60 @@ components:\nXYGeom:\ntype: string\nenum: [line, step, stacked, bar, monotoneX]\n+ BandViewProperties:\n+ type: object\n+ required:\n+ - type\n+ - geom\n+ - queries\n+ - shape\n+ - axes\n+ - colors\n+ - legend\n+ - note\n+ - showNoteWhenEmpty\n+ properties:\n+ timeFormat:\n+ type: string\n+ type:\n+ type: string\n+ enum: [band]\n+ queries:\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/DashboardQuery\"\n+ colors:\n+ description: Colors define color encoding of data into a visualization\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/DashboardColor\"\n+ shape:\n+ type: string\n+ enum: [\"chronograf-v2\"]\n+ note:\n+ type: string\n+ showNoteWhenEmpty:\n+ description: If true, will display note when empty\n+ type: boolean\n+ axes:\n+ $ref: \"#/components/schemas/Axes\"\n+ legend:\n+ $ref: \"#/components/schemas/Legend\"\n+ xColumn:\n+ type: string\n+ yColumn:\n+ type: string\n+ upperColumn:\n+ type: string\n+ mainColumn:\n+ type: string\n+ lowerColumn:\n+ type: string\n+ hoverDimension:\n+ type: string\n+ enum: [auto, x, y, xy]\n+ geom:\n+ $ref: \"#/components/schemas/XYGeom\"\nLinePlusSingleStatProperties:\ntype: object\nrequired:\n@@ -9009,6 +9073,81 @@ components:\ntype: string\ndecimalPlaces:\n$ref: \"#/components/schemas/DecimalPlaces\"\n+ MosaicViewProperties:\n+ type: object\n+ required:\n+ - type\n+ - queries\n+ - colors\n+ - shape\n+ - note\n+ - showNoteWhenEmpty\n+ - xColumn\n+ - ySeriesColumns\n+ - fillColumns\n+ - xDomain\n+ - yDomain\n+ - xAxisLabel\n+ - yAxisLabel\n+ - xPrefix\n+ - yPrefix\n+ - xSuffix\n+ - ySuffix\n+ properties:\n+ timeFormat:\n+ type: string\n+ type:\n+ type: string\n+ enum: [mosaic]\n+ queries:\n+ type: array\n+ items:\n+ $ref: \"#/components/schemas/DashboardQuery\"\n+ colors:\n+ description: Colors define color encoding of data into a visualization\n+ type: array\n+ items:\n+ type: string\n+ shape:\n+ type: string\n+ enum: [\"chronograf-v2\"]\n+ note:\n+ type: string\n+ showNoteWhenEmpty:\n+ description: If true, will display note when empty\n+ type: boolean\n+ xColumn:\n+ type: string\n+ ySeriesColumns:\n+ type: array\n+ items:\n+ type: string\n+ fillColumns:\n+ type: array\n+ items:\n+ type: string\n+ xDomain:\n+ type: array\n+ items:\n+ type: number\n+ maxItems: 2\n+ yDomain:\n+ type: array\n+ items:\n+ type: number\n+ maxItems: 2\n+ xAxisLabel:\n+ type: string\n+ yAxisLabel:\n+ type: string\n+ xPrefix:\n+ type: string\n+ xSuffix:\n+ type: string\n+ yPrefix:\n+ type: string\n+ ySuffix:\n+ type: string\nScatterViewProperties:\ntype: object\nrequired:\n@@ -9591,6 +9730,8 @@ components:\n- $ref: \"#/components/schemas/CheckViewProperties\"\n- $ref: \"#/components/schemas/ScatterViewProperties\"\n- $ref: \"#/components/schemas/HeatmapViewProperties\"\n+ - $ref: \"#/components/schemas/MosaicViewProperties\"\n+ - $ref: \"#/components/schemas/BandViewProperties\"\nView:\nrequired:\n- name\n@@ -10625,7 +10766,6 @@ components:\ntype: integer\nrequired:\n- username\n- - password\n- org\n- bucket\nOnboardingResponse:\n@@ -11089,6 +11229,7 @@ components:\n- $ref: \"#/components/schemas/SMTPNotificationRule\"\n- $ref: \"#/components/schemas/PagerDutyNotificationRule\"\n- $ref: \"#/components/schemas/HTTPNotificationRule\"\n+ - $ref: \"#/components/schemas/TelegramNotificationRule\"\ndiscriminator:\npropertyName: type\nmapping:\n@@ -11096,6 +11237,7 @@ components:\nsmtp: \"#/components/schemas/SMTPNotificationRule\"\npagerduty: \"#/components/schemas/PagerDutyNotificationRule\"\nhttp: \"#/components/schemas/HTTPNotificationRule\"\n+ telegram: \"#/components/schemas/TelegramNotificationRule\"\nNotificationRule:\nallOf:\n- $ref: \"#/components/schemas/NotificationRuleDiscriminator\"\n@@ -11297,6 +11439,31 @@ components:\nenum: [pagerduty]\nmessageTemplate:\ntype: string\n+ TelegramNotificationRule:\n+ allOf:\n+ - $ref: \"#/components/schemas/NotificationRuleBase\"\n+ - $ref: \"#/components/schemas/TelegramNotificationRuleBase\"\n+ TelegramNotificationRuleBase:\n+ type: object\n+ required: [type, messageTemplate, channel]\n+ properties:\n+ type:\n+ description: The discriminator between other types of notification rules is \"telegram\".\n+ type: string\n+ enum: [telegram]\n+ messageTemplate:\n+ description: The message template as a flux interpolated string.\n+ type: string\n+ parseMode:\n+ description: Parse mode of the message text per https://core.telegram.org/bots/api#formatting-options . Defaults to \"MarkdownV2\" .\n+ type: string\n+ enum:\n+ - MarkdownV2\n+ - HTML\n+ - Markdown\n+ disableWebPagePreview:\n+ description: Disables preview of web links in the sent messages when \"true\". Defaults to \"false\" .\n+ type: boolean\nNotificationEndpointUpdate:\ntype: object\n@@ -11315,12 +11482,14 @@ components:\n- $ref: \"#/components/schemas/SlackNotificationEndpoint\"\n- $ref: \"#/components/schemas/PagerDutyNotificationEndpoint\"\n- $ref: \"#/components/schemas/HTTPNotificationEndpoint\"\n+ - $ref: \"#/components/schemas/TelegramNotificationEndpoint\"\ndiscriminator:\npropertyName: type\nmapping:\nslack: \"#/components/schemas/SlackNotificationEndpoint\"\npagerduty: \"#/components/schemas/PagerDutyNotificationEndpoint\"\nhttp: \"#/components/schemas/HTTPNotificationEndpoint\"\n+ telegram: \"#/components/schemas/TelegramNotificationEndpoint\"\nNotificationEndpoint:\nallOf:\n- $ref: \"#/components/schemas/NotificationEndpointDiscrimator\"\n@@ -11439,9 +11608,22 @@ components:\ndescription: Customized headers.\nadditionalProperties:\ntype: string\n+ TelegramNotificationEndpoint:\n+ type: object\n+ allOf:\n+ - $ref: \"#/components/schemas/NotificationEndpointBase\"\n+ - type: object\n+ required: [token, channel]\n+ properties:\n+ token:\n+ description: Specifies the Telegram bot token. See https://core.telegram.org/bots#creating-a-new-bot .\n+ type: string\n+ channel:\n+ description: ID of the telegram channel, a chat_id in https://core.telegram.org/bots/api#sendmessage .\n+ type: string\nNotificationEndpointType:\ntype: string\n- enum: [\"slack\", \"pagerduty\", \"http\"]\n+ enum: [\"slack\", \"pagerduty\", \"http\", \"telegram\"]\nDBRP:\nrequired:\n- orgID\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/BucketsAPI.ts", "new_path": "packages/apis/src/generated/BucketsAPI.ts", "diff": "@@ -17,6 +17,9 @@ import {\nexport interface GetBucketsRequest {\noffset?: number\nlimit?: number\n+ /** The last resource ID from which to seek from (but not including). This is to be used instead of `offset`.\n+ */\n+ after?: string\n/** The organization name. */\norg?: string\n/** The organization ID. */\n@@ -120,6 +123,7 @@ export class BucketsAPI {\n`/api/v2/buckets${this.base.queryString(request, [\n'offset',\n'limit',\n+ 'after',\n'org',\n'orgID',\n'name',\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/DashboardsAPI.ts", "new_path": "packages/apis/src/generated/DashboardsAPI.ts", "diff": "@@ -22,6 +22,9 @@ import {\n} from './types'\nexport interface GetDashboardsRequest {\n+ offset?: number\n+ limit?: number\n+ descending?: any\n/** The owner ID. */\nowner?: string\n/** The column to sort by. */\n@@ -176,6 +179,9 @@ export class DashboardsAPI {\nreturn this.base.request(\n'GET',\n`/api/v2/dashboards${this.base.queryString(request, [\n+ 'offset',\n+ 'limit',\n+ 'descending',\n'owner',\n'sortBy',\n'id',\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/OrgsAPI.ts", "new_path": "packages/apis/src/generated/OrgsAPI.ts", "diff": "@@ -14,6 +14,9 @@ import {\n} from './types'\nexport interface GetOrgsRequest {\n+ offset?: number\n+ limit?: number\n+ descending?: any\n/** Filter organizations to a specific organization name. */\norg?: string\n/** Filter organizations to a specific organization ID. */\n@@ -81,6 +84,12 @@ export interface PostOrgsIDOwnersRequest {\n/** User to add as owner */\nbody: AddResourceMemberRequestBody\n}\n+export interface DeleteOrgsIDOwnersIDRequest {\n+ /** The ID of the owner to remove. */\n+ userID: string\n+ /** The organization ID. */\n+ orgID: string\n+}\n/**\n* Orgs API\n*/\n@@ -109,6 +118,9 @@ export class OrgsAPI {\nreturn this.base.request(\n'GET',\n`/api/v2/orgs${this.base.queryString(request, [\n+ 'offset',\n+ 'limit',\n+ 'descending',\n'org',\n'orgID',\n'userID',\n@@ -339,4 +351,22 @@ export class OrgsAPI {\n'application/json'\n)\n}\n+ /**\n+ * Remove an owner from an organization.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/DeleteOrgsIDOwnersID }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ deleteOrgsIDOwnersID(\n+ request: DeleteOrgsIDOwnersIDRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<void> {\n+ return this.base.request(\n+ 'DELETE',\n+ `/api/v2/orgs/${request.orgID}/owners/${request.userID}`,\n+ request,\n+ requestOptions\n+ )\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/ScrapersAPI.ts", "new_path": "packages/apis/src/generated/ScrapersAPI.ts", "diff": "@@ -2,7 +2,6 @@ import {InfluxDB} from '@influxdata/influxdb-client'\nimport {APIBase, RequestOptions} from '../APIBase'\nimport {\nAddResourceMemberRequestBody,\n- Label,\nLabelMapping,\nLabelResponse,\nLabelsResponse,\n@@ -53,14 +52,6 @@ export interface PostScrapersIDLabelsRequest {\n/** Label to add */\nbody: LabelMapping\n}\n-export interface PatchScrapersIDLabelsIDRequest {\n- /** The scraper target ID. */\n- scraperTargetID: string\n- /** The label ID. */\n- labelID: string\n- /** Label update to apply */\n- body: Label\n-}\nexport interface DeleteScrapersIDLabelsIDRequest {\n/** The scraper target ID. */\nscraperTargetID: string\n@@ -247,25 +238,6 @@ export class ScrapersAPI {\n'application/json'\n)\n}\n- /**\n- * Update a label on a scraper target.\n- * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PatchScrapersIDLabelsID }\n- * @param request - request parameters and body (if supported)\n- * @param requestOptions - optional transport options\n- * @returns promise of response\n- */\n- patchScrapersIDLabelsID(\n- request: PatchScrapersIDLabelsIDRequest,\n- requestOptions?: RequestOptions\n- ): Promise<void> {\n- return this.base.request(\n- 'PATCH',\n- `/api/v2/scrapers/${request.scraperTargetID}/labels/${request.labelID}`,\n- request,\n- requestOptions,\n- 'application/json'\n- )\n- }\n/**\n* Delete a label from a scraper target.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/DeleteScrapersIDLabelsID }\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/generated/types.ts", "new_path": "packages/apis/src/generated/types.ts", "diff": "@@ -59,7 +59,7 @@ export interface IsOnboarding {\nexport interface OnboardingRequest {\nusername: string\n- password: string\n+ password?: string\norg: string\nbucket: string\nretentionPeriodHrs?: number\n@@ -652,6 +652,8 @@ export type ViewProperties =\n| CheckViewProperties\n| ScatterViewProperties\n| HeatmapViewProperties\n+ | MosaicViewProperties\n+ | BandViewProperties\nexport interface LinePlusSingleStatProperties {\ntimeFormat?: string\n@@ -1062,6 +1064,50 @@ export interface HeatmapViewProperties {\nbinSize: number\n}\n+export interface MosaicViewProperties {\n+ timeFormat?: string\n+ type: 'mosaic'\n+ queries: DashboardQuery[]\n+ /** Colors define color encoding of data into a visualization */\n+ colors: string[]\n+ shape: 'chronograf-v2'\n+ note: string\n+ /** If true, will display note when empty */\n+ showNoteWhenEmpty: boolean\n+ xColumn: string\n+ ySeriesColumns: string[]\n+ fillColumns: string[]\n+ xDomain: number[]\n+ yDomain: number[]\n+ xAxisLabel: string\n+ yAxisLabel: string\n+ xPrefix: string\n+ xSuffix: string\n+ yPrefix: string\n+ ySuffix: string\n+}\n+\n+export interface BandViewProperties {\n+ timeFormat?: string\n+ type: 'band'\n+ queries: DashboardQuery[]\n+ /** Colors define color encoding of data into a visualization */\n+ colors: DashboardColor[]\n+ shape: 'chronograf-v2'\n+ note: string\n+ /** If true, will display note when empty */\n+ showNoteWhenEmpty: boolean\n+ axes: Axes\n+ legend: Legend\n+ xColumn?: string\n+ yColumn?: string\n+ upperColumn?: string\n+ mainColumn?: string\n+ lowerColumn?: string\n+ hoverDimension?: 'auto' | 'x' | 'y' | 'xy'\n+ geom: XYGeom\n+}\n+\nexport interface CreateCell {\nname?: string\nx?: number\n@@ -1965,7 +2011,7 @@ export type TemplateEnvReferences = Array<{\n/** Key identified as environment reference and is the key identified in the template */\nenvRefKey: string\n/** Value provided to fulfill reference */\n- value?: string\n+ value?: string | number | number | boolean\n/** Default value that will be provided for the reference when no value is provided */\ndefaultValue?: string | number | number | boolean\n}>\n@@ -1982,6 +2028,7 @@ export type NotificationEndpointDiscrimator =\n| (SlackNotificationEndpoint & {type: string})\n| (PagerDutyNotificationEndpoint & {type: string})\n| (HTTPNotificationEndpoint & {type: string})\n+ | (TelegramNotificationEndpoint & {type: string})\nexport type SlackNotificationEndpoint = NotificationEndpointBase & {\n/** Specifies the URL of the Slack endpoint. Specify either `URL` or `Token`. */\n@@ -2015,7 +2062,11 @@ export interface NotificationEndpointBase {\ntype: NotificationEndpointType\n}\n-export type NotificationEndpointType = 'slack' | 'pagerduty' | 'http'\n+export type NotificationEndpointType =\n+ | 'slack'\n+ | 'pagerduty'\n+ | 'http'\n+ | 'telegram'\nexport type PagerDutyNotificationEndpoint = NotificationEndpointBase & {\nclientURL?: string\n@@ -2034,6 +2085,13 @@ export type HTTPNotificationEndpoint = NotificationEndpointBase & {\nheaders?: any\n}\n+export type TelegramNotificationEndpoint = NotificationEndpointBase & {\n+ /** Specifies the Telegram bot token. See https://core.telegram.org/bots#creating-a-new-bot . */\n+ token: string\n+ /** ID of the telegram channel, a chat_id in https://core.telegram.org/bots/api#sendmessage . */\n+ channel: string\n+}\n+\nexport interface TemplateExport {\nstackID?: string\norgIDs?: Array<{\n@@ -2207,6 +2265,7 @@ export type NotificationRuleDiscriminator =\n| (SMTPNotificationRule & {type: string})\n| (PagerDutyNotificationRule & {type: string})\n| (HTTPNotificationRule & {type: string})\n+ | (TelegramNotificationRule & {type: string})\nexport type SlackNotificationRule = NotificationRuleBase &\nSlackNotificationRuleBase\n@@ -2314,6 +2373,20 @@ export interface HTTPNotificationRuleBase {\nurl?: string\n}\n+export type TelegramNotificationRule = NotificationRuleBase &\n+ TelegramNotificationRuleBase\n+\n+export interface TelegramNotificationRuleBase {\n+ /** The discriminator between other types of notification rules is \"telegram\". */\n+ type: 'telegram'\n+ /** The message template as a flux interpolated string. */\n+ messageTemplate: string\n+ /** Parse mode of the message text per https://core.telegram.org/bots/api#formatting-options . Defaults to \"MarkdownV2\" . */\n+ parseMode?: 'MarkdownV2' | 'HTML' | 'Markdown'\n+ /** Disables preview of web links in the sent messages when \"true\". Defaults to \"false\" . */\n+ disableWebPagePreview?: boolean\n+}\n+\nexport type PostNotificationRule = NotificationRuleDiscriminator\n/**\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(apis): regenerate APIs from swagger
305,159
15.09.2020 22:34:47
-7,200
a514913c880d068dc612599df2e81382e689af84
feat(core): convert FluxTableColumn and FluxTableMetaData to interface
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/linesToTables.ts", "new_path": "packages/core/src/impl/linesToTables.ts", "diff": "@@ -2,8 +2,13 @@ import {CommunicationObserver} from '../transport'\nimport Cancellable from '../util/Cancellable'\nimport FluxResultObserver from '../query/FluxResultObserver'\nimport LineSplitter from '../util/LineSplitter'\n-import FluxTableColumn, {ColumnType} from '../query/FluxTableColumn'\n-import FluxTableMetaData from '../query/FluxTableMetaData'\n+import FluxTableColumn, {\n+ ColumnType,\n+ newFluxTableColumn,\n+} from '../query/FluxTableColumn'\n+import FluxTableMetaData, {\n+ createFluxTableMetaData,\n+} from '../query/FluxTableMetaData'\nexport function toLineObserver(\nconsumer: FluxResultObserver<string[]>\n@@ -43,7 +48,7 @@ export function toLineObserver(\nfor (let i = firstColumnIndex; i < size; i++) {\ncolumns[i - firstColumnIndex].label = values[i]\n}\n- lastMeta = new FluxTableMetaData(columns)\n+ lastMeta = createFluxTableMetaData(columns)\nexpectMeta = false\n} else if (values[0] === '#datatype') {\nfor (let i = 1; i < size; i++) {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableColumn.ts", "new_path": "packages/core/src/query/FluxTableColumn.ts", "diff": "@@ -13,9 +13,9 @@ export type ColumnType =\n| string\n/**\n- * FluxTableColumnLike provides metadata of a flux table column.\n+ * Column metadata class of a {@link http://bit.ly/flux-spec#table | flux table} column.\n*/\n-export interface FluxTableColumnLike {\n+export default interface FluxTableColumn {\n/**\n* Label (e.g., \"_start\", \"_stop\", \"_time\").\n*/\n@@ -24,58 +24,56 @@ export interface FluxTableColumnLike {\n/**\n* The data type of column (e.g., \"string\", \"long\", \"dateTime:RFC3339\").\n*/\n- dataType?: ColumnType\n+ dataType: ColumnType\n/**\n* Boolean flag indicating if the column is a part of the table's group key.\n*/\n- group?: boolean\n+ group: boolean\n/**\n* Default value to be used for rows whose string value is the empty string.\n*/\n- defaultValue?: string\n-}\n-/**\n- * Column metadata class of a {@link http://bit.ly/flux-spec#table | flux table} column.\n- */\n-export default class FluxTableColumn {\n- /**\n- * Label (e.g., \"_start\", \"_stop\", \"_time\").\n- */\n- label: string\n+ defaultValue: string\n/**\n- * The data type of column (e.g., \"string\", \"long\", \"dateTime:RFC3339\").\n+ * Index of this column in the row array\n*/\n- dataType: ColumnType\n+ index: number\n+}\n/**\n- * Boolean flag indicating if the column is a part of the table's group key.\n+ * FluxTableColumn implementation.\n*/\n+class FluxTableColumnImpl implements FluxTableColumn {\n+ label: string\n+ dataType: ColumnType\ngroup: boolean\n-\n- /**\n- * Default value to be used for rows whose string value is the empty string.\n- */\ndefaultValue: string\n+ index: number\n+}\n/**\n- * Index of this column in the row array\n+ * Creates a new flux table column.\n+ * @returns column instance\n*/\n- index: number\n+export function newFluxTableColumn(): FluxTableColumn {\n+ return new FluxTableColumnImpl()\n+}\n/**\n- * Creates a flux table column from an object supplied.\n+ * Creates a flux table column from a partial FluxTableColumn.\n* @param object - source object\n* @returns column instance\n*/\n- static from(object: FluxTableColumnLike): FluxTableColumn {\n- const retVal = new FluxTableColumn()\n- retVal.label = object.label\n+export function createFluxTableColumn(\n+ object: Partial<FluxTableColumn>\n+): FluxTableColumn {\n+ const retVal = new FluxTableColumnImpl()\n+ retVal.label = String(object.label)\nretVal.dataType = object.dataType as ColumnType\nretVal.group = Boolean(object.group)\nretVal.defaultValue = object.defaultValue ?? ''\n+ retVal.index = object.index ?? 0\nreturn retVal\n}\n-}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableMetaData.ts", "new_path": "packages/core/src/query/FluxTableMetaData.ts", "diff": "@@ -51,21 +51,36 @@ export function serializeDateTimeAsString(): void {\n/**\n* Represents metadata of a {@link http://bit.ly/flux-spec#table | flux table}.\n*/\n-export default class FluxTableMetaData {\n+export default interface FluxTableMetaData {\n/**\n* Table columns.\n*/\ncolumns: Array<FluxTableColumn>\n- constructor(columns: FluxTableColumn[]) {\n- columns.forEach((col, i) => (col.index = i))\n- this.columns = columns\n- }\n+\n/**\n* Gets columns by name\n* @param label - column label\n* @returns table column\n* @throws IllegalArgumentError if column is not found\n**/\n+ column(label: string): FluxTableColumn\n+\n+ /**\n+ * Creates an object out of the supplied values with the help of columns .\n+ * @param values - a row with data for each column\n+ */\n+ toObject(values: string[]): {[key: string]: any}\n+}\n+\n+/**\n+ * FluxTableMetaData Implementation.\n+ */\n+class FluxTableMetaDataImpl implements FluxTableMetaData {\n+ columns: Array<FluxTableColumn>\n+ constructor(columns: FluxTableColumn[]) {\n+ columns.forEach((col, i) => (col.index = i))\n+ this.columns = columns\n+ }\ncolumn(label: string): FluxTableColumn {\nfor (let i = 0; i < this.columns.length; i++) {\nconst col = this.columns[i]\n@@ -73,10 +88,6 @@ export default class FluxTableMetaData {\n}\nthrow new IllegalArgumentError(`Column ${label} not found!`)\n}\n- /**\n- * Creates an object out of the supplied values with the help of columns .\n- * @param values - a row with data for each column\n- */\ntoObject(values: string[]): {[key: string]: any} {\nconst acc: any = {}\nfor (let i = 0; i < this.columns.length && i < values.length; i++) {\n@@ -90,3 +101,14 @@ export default class FluxTableMetaData {\nreturn acc\n}\n}\n+\n+/**\n+ * Created FluxTableMetaData from the columns supplied.\n+ * @param columns - columns\n+ * @returns - instance\n+ */\n+export function createFluxTableMetaData(\n+ columns: FluxTableColumn[]\n+): FluxTableMetaData {\n+ return new FluxTableMetaDataImpl(columns)\n+}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/query/index.ts", "new_path": "packages/core/src/query/index.ts", "diff": "@@ -4,11 +4,12 @@ export {\nserializeDateTimeAsDate,\nserializeDateTimeAsNumber,\nserializeDateTimeAsString,\n+ createFluxTableMetaData,\n} from './FluxTableMetaData'\nexport {default as FluxResultObserver} from './FluxResultObserver'\nexport {\ndefault as FluxTableColumn,\nColumnType,\n- FluxTableColumnLike,\n+ createFluxTableColumn,\n} from './FluxTableColumn'\nexport * from './flux'\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/integration/rxjs/QueryApi.test.ts", "new_path": "packages/core/test/integration/rxjs/QueryApi.test.ts", "diff": "import {expect} from 'chai'\nimport nock from 'nock' // WARN: nock must be imported before NodeHttpTransport, since it modifies node's http\n-import {InfluxDB, ClientOptions, FluxTableMetaData} from '../../../src'\n+import {InfluxDB, ClientOptions} from '../../../src'\nimport fs from 'fs'\nimport simpleResponseLines from '../../fixture/query/simpleResponseLines.json'\nimport zlib from 'zlib'\n@@ -90,9 +90,7 @@ describe('RxJS QueryApi integration', () => {\nconcat(of(group.key), group.pipe(map(({values}) => values)))\n),\nmap((data, index) =>\n- data instanceof FluxTableMetaData\n- ? {index, meta: data}\n- : {index, row: data}\n+ Array.isArray(data) ? {index, row: data} : {index, meta: data}\n),\ngroupBy(value => 'meta' in value),\nflatMap(group => group.pipe(toArray())),\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/query/FluxTableMetaData.test.ts", "new_path": "packages/core/test/unit/query/FluxTableMetaData.test.ts", "diff": "import {\nFluxTableColumn,\n- FluxTableMetaData,\n+ createFluxTableMetaData,\nColumnType,\ntypeSerializers,\nserializeDateTimeAsDate,\nserializeDateTimeAsNumber,\nserializeDateTimeAsString,\n+ createFluxTableColumn,\n} from '../../../src'\nimport {expect} from 'chai'\ndescribe('FluxTableMetaData', () => {\nit('returns columns by name or id', () => {\nconst columns: FluxTableColumn[] = [\n- FluxTableColumn.from({\n+ createFluxTableColumn({\nlabel: 'a',\ndefaultValue: 'def',\ndataType: 'long',\ngroup: false,\n}),\n- FluxTableColumn.from({\n+ createFluxTableColumn({\nlabel: 'b',\n}),\n]\n- const subject = new FluxTableMetaData(columns)\n+ const subject = createFluxTableMetaData(columns)\nexpect(subject.column('a')).to.equals(columns[0])\nexpect(subject.column('b')).to.equals(columns[1])\nexpect(subject.columns[0]).to.equals(columns[0])\n@@ -31,17 +32,17 @@ describe('FluxTableMetaData', () => {\n})\nit('creates objects', () => {\nconst columns: FluxTableColumn[] = [\n- FluxTableColumn.from({\n+ createFluxTableColumn({\nlabel: 'a',\ndefaultValue: '1',\ndataType: 'long',\ngroup: false,\n}),\n- FluxTableColumn.from({\n+ createFluxTableColumn({\nlabel: 'b',\n}),\n]\n- const subject = new FluxTableMetaData(columns)\n+ const subject = createFluxTableMetaData(columns)\nexpect(subject.toObject(['', ''])).to.deep.equal({a: 1, b: ''})\nexpect(subject.toObject(['2', 'y'])).to.deep.equal({a: 2, b: 'y'})\nexpect(subject.toObject(['3', 'y', 'z'])).to.deep.equal({a: 3, b: 'y'})\n@@ -67,12 +68,12 @@ describe('FluxTableMetaData', () => {\nfor (const entry of serializationTable) {\nit(`serializes ${entry[0]}/${entry[1]}`, () => {\nconst columns: FluxTableColumn[] = [\n- FluxTableColumn.from({\n+ createFluxTableColumn({\nlabel: 'a',\ndataType: entry[0],\n}),\n]\n- const subject = new FluxTableMetaData(columns)\n+ const subject = createFluxTableMetaData(columns)\nexpect(subject.toObject([entry[1]])).to.deep.equal({a: entry[2]})\n})\n}\n@@ -90,25 +91,25 @@ describe('FluxTableMetaData', () => {\nit('customizes serialization of long datatype', () => {\ntypeSerializers['long'] = (_x: string): any => []\nconst columns: FluxTableColumn[] = [\n- FluxTableColumn.from({\n+ createFluxTableColumn({\nlabel: 'a',\ndataType: 'long',\ngroup: false,\n}),\n]\n- const subject = new FluxTableMetaData(columns)\n+ const subject = createFluxTableMetaData(columns)\nexpect(subject.toObject([''])).to.deep.equal({a: []})\n})\nit('customizes serialization using serializeDateTimeAsDate', () => {\nserializeDateTimeAsDate()\nconst columns: FluxTableColumn[] = [\n- FluxTableColumn.from({\n+ createFluxTableColumn({\nlabel: 'a',\ndataType: 'dateTime:RFC3339',\ngroup: false,\n}),\n]\n- const subject = new FluxTableMetaData(columns)\n+ const subject = createFluxTableMetaData(columns)\nexpect(subject.toObject([''])).to.deep.equal({a: null})\nexpect(\nsubject.toObject(['2020-08-19T09:14:23.798594313Z'])\n@@ -117,13 +118,13 @@ describe('FluxTableMetaData', () => {\nit('customizes serialization using serializeDateTimeAsNumber', () => {\nserializeDateTimeAsNumber()\nconst columns: FluxTableColumn[] = [\n- FluxTableColumn.from({\n+ createFluxTableColumn({\nlabel: 'a',\ndataType: 'dateTime:RFC3339',\ngroup: false,\n}),\n]\n- const subject = new FluxTableMetaData(columns)\n+ const subject = createFluxTableMetaData(columns)\nexpect(subject.toObject([''])).to.deep.equal({a: null})\nexpect(\nsubject.toObject(['2020-08-19T09:14:23.798594313Z'])\n@@ -133,13 +134,13 @@ describe('FluxTableMetaData', () => {\nserializeDateTimeAsDate()\nserializeDateTimeAsString()\nconst columns: FluxTableColumn[] = [\n- FluxTableColumn.from({\n+ createFluxTableColumn({\nlabel: 'a',\ndataType: 'dateTime:RFC3339',\ngroup: false,\n}),\n]\n- const subject = new FluxTableMetaData(columns)\n+ const subject = createFluxTableMetaData(columns)\nexpect(subject.toObject([''])).to.deep.equal({a: null})\nexpect(\nsubject.toObject(['1970-01-01T00:26:16.063594313Z'])\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): convert FluxTableColumn and FluxTableMetaData to interface
305,159
16.09.2020 11:40:22
-7,200
2e1faba58d4c7b9ab20ec2a2bdc1247efc16bdf2
chore(core): improve test coverage
[ { "change_type": "MODIFY", "old_path": "packages/core/test/unit/query/FluxTableMetaData.test.ts", "new_path": "packages/core/test/unit/query/FluxTableMetaData.test.ts", "diff": "@@ -40,6 +40,7 @@ describe('FluxTableMetaData', () => {\n}),\ncreateFluxTableColumn({\nlabel: 'b',\n+ index: 2, // index can be possibly set, but it gets overriden during createFluxTableMetaData\n}),\n]\nconst subject = createFluxTableMetaData(columns)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): improve test coverage
305,159
16.09.2020 13:58:21
-7,200
35d190204a638baf7738c37aaa87f966b23bcbe4
fix(core/FetchTransport): do not throw error on cancelled processing
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -35,11 +35,13 @@ export default class FetchTransport implements Transport {\ncallbacks?: Partial<CommunicationObserver<Uint8Array>> | undefined\n): void {\nconst observer = completeCommunicationObserver(callbacks)\n+ let cancelled = false\nif (callbacks && callbacks.useCancellable && !(options as any).signal) {\nconst controller = new AbortController()\nconst signal = controller.signal\ncallbacks.useCancellable({\ncancel() {\n+ cancelled = true\ncontroller.abort()\n},\nisCancelled() {\n@@ -110,7 +112,13 @@ export default class FetchTransport implements Transport {\n}\n}\n})\n- .catch(e => observer.error(e))\n+ .catch(e => {\n+ if (cancelled) {\n+ observer.complete()\n+ } else {\n+ observer.error(e)\n+ }\n+ })\n.finally(() => observer.complete())\n}\nasync request(path: string, body: any, options: SendOptions): Promise<any> {\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": "@@ -201,7 +201,37 @@ describe('FetchTransport', () => {\n{\nbody: 'a',\ncallbacks: fakeCallbacks(),\n- status: 500,\n+ },\n+ {\n+ url: 'customNext_canceled',\n+ body: [Buffer.from('a'), Buffer.from('b')],\n+ callbacks: ((): void => {\n+ const overriden = fakeCallbacks()\n+ return {\n+ ...overriden,\n+ next(...args: any): void {\n+ overriden.next.call(overriden, args)\n+ const cancellable = overriden.useCancellable.args[0][0]\n+ cancellable.cancel()\n+ throw new Error()\n+ },\n+ }\n+ })(),\n+ },\n+ {\n+ url: 'customNext_nextError',\n+ body: 'a',\n+ callbacks: ((): void => {\n+ const overriden = fakeCallbacks()\n+ return {\n+ ...overriden,\n+ next(...args: any): void {\n+ overriden.next.call(overriden, args)\n+ throw new Error('unexpected error')\n+ },\n+ }\n+ })(),\n+ status: 222, // value other than 200 instructs the test to check for error\n},\n{\nbody: 'error',\n@@ -221,6 +251,12 @@ describe('FetchTransport', () => {\nstatus: 500,\nerrorBody: '',\n},\n+ {\n+ body: 'this is error message',\n+ callbacks: fakeCallbacks(),\n+ status: 500,\n+ errorBody: 'this is error message',\n+ },\n].forEach(\n(\n{\n@@ -274,10 +310,13 @@ describe('FetchTransport', () => {\n)\nexpect(callbacks.complete.callCount).equals(isError ? 0 : 1)\nexpect(callbacks.error.callCount).equals(isError ? 1 : 0)\n+ const customNext = url.startsWith('customNext')\n+ if (!customNext) {\nexpect(callbacks.next.callCount).equals(\nisError ? 0 : Array.isArray(body) ? body.length : 1\n)\n- if (!isError) {\n+ }\n+ if (!customNext && !isError) {\nconst vals = callbacks.next.args.map((args: any) =>\nBuffer.from(args[0])\n)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core/FetchTransport): do not throw error on cancelled processing
305,159
16.09.2020 15:15:26
-7,200
ca1fcdc88b47043f9361b9cb3f886689afa22423
fix(core/query): do not emit new lines after being cancelled
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/ChunksToLines.ts", "new_path": "packages/core/src/impl/ChunksToLines.ts", "diff": "@@ -41,7 +41,22 @@ export default class ChunksToLines\n}\n}\nuseCancellable(cancellable: Cancellable): void {\n- this.target.useCancellable && this.target.useCancellable(cancellable)\n+ if (this.target.useCancellable) {\n+ // eslint-disable-next-line @typescript-eslint/no-this-alias\n+ const self = this\n+ let cancelled = false\n+ this.target.useCancellable({\n+ cancel(): void {\n+ cancellable.cancel()\n+ self.previous = undefined // do not emit more lines\n+ cancelled = true\n+ self.complete()\n+ },\n+ isCancelled(): boolean {\n+ return cancelled\n+ },\n+ })\n+ }\n}\nprivate bufferReceived(chunk: Uint8Array): void {\n@@ -59,6 +74,10 @@ export default class ChunksToLines\nif (!this.quoted) {\n/* do not emit CR+LR or LF line ending */\nconst end = index > 0 && chunk[index - 1] === 13 ? index - 1 : index\n+ // do not emmit more lines if the processing is already finished\n+ if (this.finished) {\n+ return\n+ }\nthis.target.next(this.chunks.toUtf8String(chunk, start, end))\nstart = index + 1\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -113,9 +113,7 @@ export default class FetchTransport implements Transport {\n}\n})\n.catch(e => {\n- if (cancelled) {\n- observer.complete()\n- } else {\n+ if (!cancelled) {\nobserver.error(e)\n}\n})\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/impl/ChunksToLines.test.ts", "new_path": "packages/core/test/unit/impl/ChunksToLines.test.ts", "diff": "@@ -56,4 +56,34 @@ describe('ChunksToLines', () => {\nsubject.next((1 as any) as Uint8Array)\nexpect(target.failed).to.be.equal(1)\n})\n+ it('do not emit lines after being cancelled', () => {\n+ let cancellable: Cancellable | undefined = undefined\n+ const lines: string[] = []\n+ const target = {\n+ next(line: string): void {\n+ if (line === 'cancel') {\n+ cancellable?.cancel()\n+ } else {\n+ lines.push(line)\n+ }\n+ },\n+ error: sinon.fake(),\n+ complete: sinon.fake(),\n+ useCancellable(c: Cancellable): void {\n+ cancellable = c\n+ },\n+ }\n+ const subject = new ChunksToLines(target, nodeChunkCombiner)\n+ const cancel = sinon.mock()\n+ subject.useCancellable({\n+ isCancelled: () => cancel.callCount > 0,\n+ cancel,\n+ })\n+ subject.next(Buffer.from('a\\ncancel\\nc\\nd', 'utf8'))\n+ subject.next(Buffer.from('gh', 'utf8'))\n+ expect(lines).deep.equals(['a'])\n+ expect(target.error.callCount).equals(0)\n+ expect((cancellable as any)?.isCancelled()).equals(true)\n+ expect(target.complete.callCount).equals(1)\n+ })\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core/query): do not emit new lines after being cancelled
305,159
16.09.2020 17:10:01
-7,200
cbf7f0198a43db9225af9b8c0ed282754ec57ecb
fix(core/FetchTransport): use signal to abort processing
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -36,16 +36,20 @@ export default class FetchTransport implements Transport {\n): void {\nconst observer = completeCommunicationObserver(callbacks)\nlet cancelled = false\n- if (callbacks && callbacks.useCancellable && !(options as any).signal) {\n+ let signal = (options as any).signal\n+ if (callbacks && callbacks.useCancellable) {\nconst controller = new AbortController()\n- const signal = controller.signal\n+ if (!signal) {\n+ signal = controller.signal\n+ options = {...(options as object), ...signal} as SendOptions\n+ }\ncallbacks.useCancellable({\ncancel() {\ncancelled = true\ncontroller.abort()\n},\nisCancelled() {\n- return signal.aborted\n+ return cancelled || signal.aborted\n},\n})\n}\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": "@@ -3,6 +3,7 @@ import {expect} from 'chai'\nimport {removeFetchApi, emulateFetchApi} from './emulateBrowser'\nimport sinon from 'sinon'\nimport {CLIENT_LIB_VERSION} from '../../../../src/impl/version'\n+import {SendOptions, Cancellable} from '../../../../src'\ndescribe('FetchTransport', () => {\nafterEach(() => {\n@@ -172,7 +173,9 @@ describe('FetchTransport', () => {\nnext: sinon.fake(),\nerror: sinon.fake(),\ncomplete: sinon.fake(),\n- useCancellable: sinon.fake(),\n+ useCancellable: sinon.spy((c: Cancellable): void => {\n+ expect(c.isCancelled()).is.equal(false) // not cancelled\n+ }),\nresponseStarted: sinon.fake(),\n}\n}\n@@ -203,7 +206,7 @@ describe('FetchTransport', () => {\ncallbacks: fakeCallbacks(),\n},\n{\n- url: 'customNext_canceled',\n+ url: 'customNext_cancelledAndThenError',\nbody: [Buffer.from('a'), Buffer.from('b')],\ncallbacks: ((): void => {\nconst overriden = fakeCallbacks()\n@@ -218,6 +221,26 @@ describe('FetchTransport', () => {\n}\n})(),\n},\n+ {\n+ url: 'customNext_cancelledWithSignal',\n+ body: [Buffer.from('a'), Buffer.from('b')],\n+ signal: {aborted: true},\n+ callbacks: ((): void => {\n+ const overriden = fakeCallbacks()\n+ overriden.useCancellable = sinon.spy((c: Cancellable): void => {\n+ expect(c.isCancelled()).is.equal(true) // cancelled because of aborted signal\n+ })\n+ return {\n+ ...overriden,\n+ next(...args: any): void {\n+ overriden.next.call(overriden, args)\n+ const cancellable = overriden.useCancellable.args[0][0]\n+ cancellable.cancel()\n+ throw new Error()\n+ },\n+ }\n+ })(),\n+ },\n{\nurl: 'customNext_nextError',\nbody: 'a',\n@@ -266,10 +289,11 @@ describe('FetchTransport', () => {\nstatus = 200,\nheaders = {},\nerrorBody,\n+ signal,\n},\ni\n) => {\n- it(`receives data in chunks ${i}`, async () => {\n+ it(`receives data in chunks ${i} (${url})`, async () => {\nemulateFetchApi({\nheaders: {\n'content-type': 'text/plain',\n@@ -281,11 +305,7 @@ describe('FetchTransport', () => {\n})\nif (callbacks) {\nawait new Promise((resolve: any) =>\n- transport.send(\n- url,\n- '',\n- {method: 'POST'},\n- {\n+ transport.send(url, '', {method: 'POST', signal} as SendOptions, {\n...callbacks,\ncomplete() {\ncallbacks.complete && callbacks.complete()\n@@ -295,8 +315,7 @@ describe('FetchTransport', () => {\ncallbacks.error && callbacks.error(e)\nresolve()\n},\n- }\n- )\n+ })\n)\nif (callbacks.useCancellable) {\nexpect(callbacks.useCancellable.callCount).equals(1)\n@@ -308,8 +327,8 @@ describe('FetchTransport', () => {\nexpect(callbacks.responseStarted.callCount).equals(\nurl === 'error' ? 0 : 1\n)\n- expect(callbacks.complete.callCount).equals(isError ? 0 : 1)\nexpect(callbacks.error.callCount).equals(isError ? 1 : 0)\n+ expect(callbacks.complete.callCount).equals(isError ? 0 : 1)\nconst customNext = url.startsWith('customNext')\nif (!customNext) {\nexpect(callbacks.next.callCount).equals(\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core/FetchTransport): use signal to abort processing
305,159
03.09.2020 06:10:15
-7,200
f0c3764aef7910b829ad5aa851e5b09c4f90f95a
feat: change default InfluxDB port to 8086
[ { "change_type": "MODIFY", "old_path": "examples/env.js", "new_path": "examples/env.js", "diff": "/** InfluxDB v2 URL */\n-const url = process.env['INFLUX_URL'] || 'http://localhost:9999'\n+const url = process.env['INFLUX_URL'] || 'http://localhost:8086'\n/** InfluxDB authorization token */\nconst token = process.env['INFLUX_TOKEN'] || 'my-token'\n/** Organization within InfluxDB */\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/index.ts", "new_path": "packages/apis/src/index.ts", "diff": "* const {InfluxDB} = require('@influxdata/influxdb-client')\n* const {OrgsAPI} = require('@influxdata/influxdb-client-apis')\n* const influxDB = new InfluxDB({\n- * url: \"http://localhost:9999\",\n+ * url: \"http://localhost:8086\",\n* token: \"my-token\"\n* })\n* ...\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/index.ts", "new_path": "packages/core/src/index.ts", "diff": "* ```\n* import {InfluxDB} = from('@influxdata/influxdb-client')\n* const influxDB = new InfluxDB({\n- * url: \"http://localhost:9999\",\n+ * url: \"http://localhost:8086\",\n* token: \"your-api-token\"\n* })\n* ```\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/integration/rxjs/QueryApi.test.ts", "new_path": "packages/core/test/integration/rxjs/QueryApi.test.ts", "diff": "@@ -11,7 +11,7 @@ const ORG = `my-org`\nconst QUERY_PATH = `/api/v2/query?org=${ORG}`\nconst clientOptions: ClientOptions = {\n- url: 'http://fake:9999',\n+ url: 'http://fake:8086',\ntoken: 'a',\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/Influxdb.test.ts", "new_path": "packages/core/test/unit/Influxdb.test.ts", "diff": "@@ -5,41 +5,41 @@ describe('InfluxDB', () => {\ndescribe('constructor', () => {\nit('is created from string url', () => {\nexpect(\n- (new InfluxDB('http://localhost:9999') as any)._options\n+ (new InfluxDB('http://localhost:8086') as any)._options\n).to.deep.equal({\n- url: 'http://localhost:9999',\n+ url: 'http://localhost:8086',\n})\n})\nit('is created from configuration with url', () => {\nexpect(\n- (new InfluxDB({url: 'http://localhost:9999'}) as any)._options\n+ (new InfluxDB({url: 'http://localhost:8086'}) as any)._options\n).to.deep.equal({\n- url: 'http://localhost:9999',\n+ url: 'http://localhost:8086',\n})\n})\nit('is created from configuration with url and token', () => {\nexpect(\n(new InfluxDB({\n- url: 'https://localhost:9999?token=a',\n+ url: 'https://localhost:8086?token=a',\ntoken: 'b',\n}) as any)._options\n).to.deep.equal({\n- url: 'https://localhost:9999?token=a',\n+ url: 'https://localhost:8086?token=a',\ntoken: 'b',\n})\n})\nit('is created from string url with trailing slash', () => {\nexpect(\n- (new InfluxDB('http://localhost:9999/') as any)._options\n+ (new InfluxDB('http://localhost:8086/') as any)._options\n).to.deep.equal({\n- url: 'http://localhost:9999',\n+ url: 'http://localhost:8086',\n})\n})\nit('is created from configuration with url with trailing slash', () => {\nexpect(\n- (new InfluxDB({url: 'http://localhost:9999/'}) as any)._options\n+ (new InfluxDB({url: 'http://localhost:8086/'}) as any)._options\n).to.deep.equal({\n- url: 'http://localhost:9999',\n+ url: 'http://localhost:8086',\n})\n})\nit('fails on null arg', () => {\n@@ -61,32 +61,32 @@ describe('InfluxDB', () => {\nexpect(\n() =>\nnew InfluxDB({\n- url: 'ws://localhost:9999?token=b',\n+ url: 'ws://localhost:8086?token=b',\n})\n).to.throw('Unsupported')\n})\nit('creates instance with transport initialized', () => {\nexpect(\nnew InfluxDB({\n- url: 'http://localhost:9999',\n+ url: 'http://localhost:8086',\n})\n).has.property('transport')\nexpect(\nnew InfluxDB(({\n- url: 'http://localhost:9999',\n+ url: 'http://localhost:8086',\ntransport: null,\n} as any) as ClientOptions)\n).has.property('transport')\nexpect(\nnew InfluxDB(({\n- url: 'http://localhost:9999',\n+ url: 'http://localhost:8086',\ntransport: {} as Transport,\n} as any) as ClientOptions)\n).has.property('transport')\n})\n})\ndescribe('apis', () => {\n- const influxDb = new InfluxDB('http://localhost:9999?token=a')\n+ const influxDb = new InfluxDB('http://localhost:8086?token=a')\nit('serves queryApi writeApi without a pending schedule', () => {\nexpect(influxDb.getWriteApi('org', 'bucket')).to.be.ok\nexpect(influxDb.getWriteApi('org', 'bucket', WritePrecision.s)).to.be.ok\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/QueryApi.test.ts", "new_path": "packages/core/test/unit/QueryApi.test.ts", "diff": "@@ -12,7 +12,7 @@ const ORG = `my-org`\nconst QUERY_PATH = `/api/v2/query?org=${ORG}`\nconst clientOptions: ClientOptions = {\n- url: 'http://fake:9999',\n+ url: 'http://fake:8086',\ntoken: 'a',\n}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -13,7 +13,7 @@ import {collectLogging, CollectedLogs} from '../util'\nimport Logger from '../../src/impl/Logger'\nconst clientOptions: ClientOptions = {\n- url: 'http://fake:9999',\n+ url: 'http://fake:8086',\ntoken: 'a',\n}\nconst ORG = 'org'\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": "@@ -13,7 +13,7 @@ describe('FetchTransport', () => {\ndescribe('constructor', () => {\nit('creates the transport with url', () => {\nconst options = {\n- url: 'http://test:9999',\n+ url: 'http://test:8086',\n}\nconst transport: any = new FetchTransport(options)\nexpect(transport.defaultHeaders).to.deep.equal({\n@@ -24,7 +24,7 @@ describe('FetchTransport', () => {\n})\nit('creates the transport with url and token', () => {\nconst options = {\n- url: 'http://test:9999',\n+ url: 'http://test:8086',\ntoken: 'a',\n}\nconst transport: any = new FetchTransport(options)\n@@ -37,7 +37,7 @@ describe('FetchTransport', () => {\n})\n})\ndescribe('request', () => {\n- const transport = new FetchTransport({url: 'http://test:9999'})\n+ const transport = new FetchTransport({url: 'http://test:8086'})\nit('receives json data', async () => {\nemulateFetchApi({\nheaders: {'content-type': 'application/json'},\n@@ -167,7 +167,7 @@ describe('FetchTransport', () => {\n})\n})\ndescribe('send', () => {\n- const transport = new FetchTransport({url: 'http://test:9999'})\n+ const transport = new FetchTransport({url: 'http://test:8086'})\nfunction fakeCallbacks(): any {\nreturn {\nnext: sinon.fake(),\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": "@@ -37,59 +37,59 @@ function sendTestData(\n})\n})\n}\n-const TEST_URL = 'http://test:9999'\n+const TEST_URL = 'http://test:8086'\ndescribe('NodeHttpTransport', () => {\ndescribe('constructor', () => {\nit('creates the transport from http url', () => {\nconst transport: any = new NodeHttpTransport({\n- url: 'http://test:9999',\n+ url: 'http://test:8086',\n})\nexpect(transport.defaultOptions).to.deep.equal({\nhostname: 'test',\n- port: '9999',\n+ port: '8086',\nprotocol: 'http:',\ntimeout: 10000,\n- url: 'http://test:9999',\n+ url: 'http://test:8086',\n})\nexpect(transport.requestApi).to.equal(http.request)\n})\nit('creates the transport from https url', () => {\nconst transport: any = new NodeHttpTransport({\n- url: 'https://test:9999',\n+ url: 'https://test:8086',\n})\nexpect(transport.defaultOptions).to.deep.equal({\nhostname: 'test',\n- port: '9999',\n+ port: '8086',\nprotocol: 'https:',\ntimeout: 10000,\n- url: 'https://test:9999',\n+ url: 'https://test:8086',\n})\nexpect(transport.requestApi).to.equal(https.request)\n})\nit('creates the transport with contextPath', () => {\nconst transport: any = new NodeHttpTransport({\n- url: 'http://test:9999/influx',\n+ url: 'http://test:8086/influx',\n})\nexpect(transport.defaultOptions).to.deep.equal({\nhostname: 'test',\n- port: '9999',\n+ port: '8086',\nprotocol: 'http:',\ntimeout: 10000,\n- url: 'http://test:9999/influx',\n+ url: 'http://test:8086/influx',\n})\nexpect(transport.contextPath).equals('/influx')\n})\nit('creates the transport with contextPath/', () => {\nconst transport: any = new NodeHttpTransport({\n- url: 'http://test:9999/influx/',\n+ url: 'http://test:8086/influx/',\n})\nexpect(transport.defaultOptions).to.deep.equal({\nhostname: 'test',\n- port: '9999',\n+ port: '8086',\nprotocol: 'http:',\ntimeout: 10000,\n- url: 'http://test:9999/influx/',\n+ url: 'http://test:8086/influx/',\n})\nexpect(transport.contextPath).equals('/influx')\n})\n@@ -97,7 +97,7 @@ describe('NodeHttpTransport', () => {\nexpect(\n() =>\nnew NodeHttpTransport({\n- url: 'other://test:9999',\n+ url: 'other://test:8086',\n})\n).to.throw()\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat: change default InfluxDB port to 8086
305,159
03.09.2020 06:37:53
-7,200
e99cfd71fa65f9b957df35dccbfb5c1c2db49c9a
chore: validate examples with eslint in CI
[ { "change_type": "MODIFY", "old_path": ".circleci/config.yml", "new_path": ".circleci/config.yml", "diff": "@@ -33,9 +33,9 @@ jobs:\ncd ./packages/core\nyarn test:ci\nyarn lint:ci\n- yarn build\ncd ../apis\nyarn test\n+ yarn eslint ../../examples\ncd ../..\nyarn apidoc:ci\n# Upload results\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"preinstall\": \"node ./scripts/require-yarn.js\",\n\"clean\": \"rimraf temp docs && yarn workspaces run clean\",\n\"build\": \"cd packages/core && yarn build && cd ../apis && yarn build\",\n- \"test\": \"cd packages/core && yarn test && yarn build && cd ../apis && yarn test\",\n+ \"test\": \"cd packages/core && yarn test && yarn build && cd ../apis && yarn test && yarn eslint ../../examples\",\n\"coverage\": \"cd packages/core && yarn coverage\",\n\"coverage:send\": \"cd packages/core && yarn coverage:send\"\n},\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: validate examples with eslint in CI
305,159
02.10.2020 19:32:50
-7,200
500013c29bf7d0f17908d176b0839321a3da93e9
chore(core): improve FluxTableColumn doc
[ { "change_type": "MODIFY", "old_path": "packages/core/src/query/FluxTableColumn.ts", "new_path": "packages/core/src/query/FluxTableColumn.ts", "diff": "@@ -32,12 +32,12 @@ export default interface FluxTableColumn {\ngroup: boolean\n/**\n- * Default value to be used for rows whose string value is the empty string.\n+ * Default value to be used for rows whose string value is an empty string.\n*/\ndefaultValue: string\n/**\n- * Index of this column in the row array\n+ * Index of this column in a row array.\n*/\nindex: number\n}\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): improve FluxTableColumn doc
305,159
06.10.2020 17:56:36
-7,200
4ecac051d65dd60f32ab452aa089dcc83db245a8
feat(core): report also status code from transport layer
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -18,6 +18,7 @@ import {CLIENT_LIB_VERSION} from '../version'\nexport default class FetchTransport implements Transport {\nchunkCombiner = pureJsChunkCombiner\nprivate defaultHeaders: {[key: string]: string}\n+ private url: string\nconstructor(private connectionOptions: ConnectionOptions) {\nthis.defaultHeaders = {\n'content-type': 'application/json; charset=utf-8',\n@@ -27,6 +28,18 @@ export default class FetchTransport implements Transport {\nthis.defaultHeaders['Authorization'] =\n'Token ' + this.connectionOptions.token\n}\n+ this.url = String(this.connectionOptions.url)\n+ if (this.url.endsWith('/')) {\n+ this.url = this.url.substring(0, this.url.length - 1)\n+ }\n+ // https://github.com/influxdata/influxdb-client-js/issues/263\n+ // don't allow /api/v2 suffix to avoid future problems\n+ if (this.url.endsWith('/api/v2')) {\n+ this.url = this.url.substring(0, this.url.length - '/api/v2'.length)\n+ Logger.warn(\n+ `Please remove '/api/v2' context path from InfluxDB base url, using ${this.url} !`\n+ )\n+ }\n}\nsend(\npath: string,\n@@ -67,7 +80,7 @@ export default class FetchTransport implements Transport {\nheaders[key] = [previous, value]\n}\n})\n- observer.responseStarted(headers)\n+ observer.responseStarted(headers, response.status)\n}\nif (response.status >= 300) {\nreturn response\n@@ -160,7 +173,7 @@ export default class FetchTransport implements Transport {\noptions: SendOptions\n): Promise<Response> {\nconst {method, headers, ...other} = options\n- return fetch(`${this.connectionOptions.url}${path}`, {\n+ return fetch(`${this.url}${path}`, {\nmethod: method,\nbody:\nmethod === 'GET' || method === 'HEAD'\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/completeCommunicationObserver.ts", "new_path": "packages/core/src/impl/completeCommunicationObserver.ts", "diff": "@@ -30,8 +30,9 @@ export default function completeCommunicationObserver(\nif (callbacks.complete) callbacks.complete()\n}\n},\n- responseStarted: (headers: Headers): void => {\n- if (callbacks.responseStarted) callbacks.responseStarted(headers)\n+ responseStarted: (headers: Headers, statusCode?: number): void => {\n+ if (callbacks.responseStarted)\n+ callbacks.responseStarted(headers, statusCode)\n},\n}\nreturn retVal\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "new_path": "packages/core/src/impl/node/NodeHttpTransport.ts", "diff": "@@ -16,6 +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'\nconst zlibOptions = {\nflush: zlib.Z_SYNC_FLUSH,\n@@ -67,6 +68,15 @@ export class NodeHttpTransport implements Transport {\nthis.contextPath.length - 1\n)\n}\n+ // https://github.com/influxdata/influxdb-client-js/issues/263\n+ // don't allow /api/v2 suffix to avoid future problems\n+ if (this.contextPath == '/api/v2') {\n+ Logger.warn(\n+ `Please remove '/api/v2' context path from InfluxDB base url, using ${url.protocol}//${url.hostname}:${url.port} !`\n+ )\n+ this.contextPath = ''\n+ }\n+\nif (url.protocol === 'http:') {\nthis.requestApi = http.request\n} else if (url.protocol === 'https:') {\n@@ -205,7 +215,7 @@ export class NodeHttpTransport implements Transport {\nres.on('aborted', () => {\nlisteners.error(new AbortError())\n})\n- listeners.responseStarted(res.headers)\n+ listeners.responseStarted(res.headers, res.statusCode)\n/* istanbul ignore next statusCode is optional in http.IncomingMessage */\nconst statusCode = res.statusCode ?? 600\nconst contentEncoding = res.headers['content-encoding']\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/transport.ts", "new_path": "packages/core/src/transport.ts", "diff": "@@ -24,8 +24,9 @@ export interface CommunicationObserver<T> {\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) => void\n+ responseStarted?: (headers: Headers, statusCode?: number) => void\n/**\n* Setups cancelllable for this communication.\n*/\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": "@@ -4,6 +4,7 @@ import {removeFetchApi, emulateFetchApi} from './emulateBrowser'\nimport sinon from 'sinon'\nimport {CLIENT_LIB_VERSION} from '../../../../src/impl/version'\nimport {SendOptions, Cancellable} from '../../../../src'\n+import {CollectedLogs, collectLogging} from '../../../util'\ndescribe('FetchTransport', () => {\nafterEach(() => {\n@@ -11,6 +12,13 @@ describe('FetchTransport', () => {\n})\ndescribe('constructor', () => {\n+ let logs: CollectedLogs\n+ beforeEach(() => {\n+ logs = collectLogging.replace()\n+ })\n+ afterEach(async () => {\n+ collectLogging.after()\n+ })\nit('creates the transport with url', () => {\nconst options = {\nurl: 'http://test:8086',\n@@ -35,6 +43,28 @@ describe('FetchTransport', () => {\n})\nexpect(transport.connectionOptions).to.deep.equal(options)\n})\n+ it('ignore last slash / in url', () => {\n+ const options = {\n+ url: 'http://test:8086/',\n+ token: 'a',\n+ }\n+ const transport: any = new FetchTransport(options)\n+ expect(transport.url).equals('http://test:8086')\n+ })\n+ it('ignore /api/v2 suffix in url', () => {\n+ const options = {\n+ url: 'http://test:8086/api/v2',\n+ token: 'a',\n+ }\n+ const transport: any = new FetchTransport(options)\n+ expect(transport.url).equals('http://test:8086')\n+ expect(logs.warn).is.deep.equal([\n+ [\n+ \"Please remove '/api/v2' context path from InfluxDB base url, using http://test:8086 !\",\n+ undefined,\n+ ],\n+ ])\n+ })\n})\ndescribe('request', () => {\nconst transport = new FetchTransport({url: 'http://test:8086'})\n@@ -323,10 +353,13 @@ describe('FetchTransport', () => {\ncancellable.cancel()\nexpect(cancellable.isCancelled()).is.equal(true)\n}\n+ if (url === 'error') {\n+ expect(callbacks.responseStarted.callCount).equals(0)\n+ } else {\n+ expect(callbacks.responseStarted.callCount).equals(1)\n+ expect(callbacks.responseStarted.args[0][1]).equals(status)\n+ }\nconst isError = url === 'error' || status !== 200\n- expect(callbacks.responseStarted.callCount).equals(\n- url === 'error' ? 0 : 1\n- )\nexpect(callbacks.error.callCount).equals(isError ? 1 : 0)\nexpect(callbacks.complete.callCount).equals(isError ? 0 : 1)\nconst customNext = url.startsWith('customNext')\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": "@@ -10,6 +10,7 @@ import sinon from 'sinon'\nimport {Readable} from 'stream'\nimport zlib from 'zlib'\nimport {CLIENT_LIB_VERSION} from '../../../../src/impl/version'\n+import {CollectedLogs, collectLogging} from '../../../util'\nfunction sendTestData(\nconnectionOptions: ConnectionOptions,\n@@ -41,6 +42,13 @@ const TEST_URL = 'http://test:8086'\ndescribe('NodeHttpTransport', () => {\ndescribe('constructor', () => {\n+ let logs: CollectedLogs\n+ beforeEach(() => {\n+ logs = collectLogging.replace()\n+ })\n+ afterEach(async () => {\n+ collectLogging.after()\n+ })\nit('creates the transport from http url', () => {\nconst transport: any = new NodeHttpTransport({\nurl: 'http://test:8086',\n@@ -101,6 +109,19 @@ describe('NodeHttpTransport', () => {\n})\n).to.throw()\n})\n+ it('warn about unsupported /api/v2 context path', () => {\n+ const transport: any = new NodeHttpTransport({\n+ url: 'http://test:8086/api/v2',\n+ })\n+ // don;t use context path at all\n+ expect(transport.contextPath).equals('')\n+ expect(logs.warn).is.deep.equal([\n+ [\n+ \"Please remove '/api/v2' context path from InfluxDB base url, using http://test:8086 !\",\n+ undefined,\n+ ],\n+ ])\n+ })\n})\ndescribe('send', () => {\nbeforeEach(() => {\n@@ -133,6 +154,7 @@ describe('NodeHttpTransport', () => {\nconst responseData = 'yes'\nit(`works with options ${JSON.stringify(extras)}`, async () => {\nconst nextFn = sinon.fake()\n+ const responseStartedFn = sinon.fake()\nawait new Promise<void>((resolve, reject) => {\nconst timeout = setTimeout(\n() => reject(new Error('timeouted')),\n@@ -183,9 +205,8 @@ describe('NodeHttpTransport', () => {\n'',\n{...extras, method: 'POST'},\n{\n- next(data: any) {\n- nextFn(data)\n- },\n+ responseStarted: responseStartedFn,\n+ next: nextFn,\nerror(error: any) {\nclearTimeout(timeout)\nreject(new Error('No error expected!, but: ' + error))\n@@ -202,16 +223,22 @@ describe('NodeHttpTransport', () => {\nif (extras.cancel) {\ncancellable.cancel()\n}\n- })\n- .then(() => {\n- expect(nextFn.called)\n+ }).then(\n+ () => {\nif (!extras.cancel) {\n+ expect(nextFn.callCount).equals(1)\n+ expect(responseStartedFn.callCount).equals(1)\n+ expect(responseStartedFn.args[0][1]).equals(200)\nexpect(nextFn.args[0][0].toString()).to.equal(responseData)\n+ } else {\n+ expect(nextFn.callCount).equals(0)\n+ expect(responseStartedFn.callCount).equals(0)\n}\n- })\n- .catch(e => {\n+ },\n+ e => {\nexpect.fail(undefined, e, e.toString())\n- })\n+ }\n+ )\n})\n}\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): report also status code from transport layer
305,159
06.10.2020 17:57:40
-7,200
5b3cf99fefb594324552c959da46ee338464c9aa
feat(core): require write response to have status code 204
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/WriteApiImpl.ts", "new_path": "packages/core/src/impl/WriteApiImpl.ts", "diff": "@@ -5,7 +5,7 @@ import {\nWriteOptions,\nWritePrecisionType,\n} from '../options'\n-import {Transport, SendOptions} from '../transport'\n+import {Transport, SendOptions, Headers} from '../transport'\nimport Logger from './Logger'\nimport {HttpError, RetryDelayStrategy} from '../errors'\nimport Point from '../Point'\n@@ -132,7 +132,11 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nconst self: WriteApiImpl = this\nif (!this.closed && lines.length > 0) {\nreturn new Promise<void>((resolve, reject) => {\n+ let responseStatusCode: number | undefined\nthis.transport.send(this.httpPath, lines.join('\\n'), this.sendOptions, {\n+ responseStarted(_headers: Headers, statusCode?: number): void {\n+ responseStatusCode = statusCode\n+ },\nerror(error: Error): void {\nconst failedAttempts = self.writeOptions.maxRetries + 2 - attempts\n// call the writeFailed listener and check if we can retry\n@@ -170,7 +174,19 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\n},\ncomplete(): void {\nself.retryStrategy.success()\n+ // older implementations of transport do not report status code\n+ if (responseStatusCode == 204 || responseStatusCode == undefined) {\nresolve()\n+ } else {\n+ const error = new HttpError(\n+ responseStatusCode,\n+ `204 HTTP response status code expected, but ${responseStatusCode} returned`,\n+ undefined,\n+ '0'\n+ )\n+ Logger.error(`Write to InfluxDB failed.`, error)\n+ reject(error)\n+ }\n},\n})\n})\n@@ -212,7 +228,8 @@ export default class WriteApiImpl implements WriteApi, PointSettings {\nthrow new Error('writeApi: already closed!')\n}\nfor (let i = 0; i < points.length; i++) {\n- this.writePoint(points[i])\n+ const line = points[i].toLineProtocol(this)\n+ if (line) this.writeBuffer.add(line)\n}\n}\nasync flush(withRetryBuffer?: boolean): Promise<void> {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/WriteApi.test.ts", "new_path": "packages/core/test/unit/WriteApi.test.ts", "diff": "@@ -2,6 +2,7 @@ import {expect} from 'chai'\nimport nock from 'nock' // WARN: nock must be imported before NodeHttpTransport, since it modifies node's http\nimport {\nClientOptions,\n+ HttpError,\nWritePrecision,\nWriteOptions,\nPoint,\n@@ -123,7 +124,7 @@ describe('WriteApi', () => {\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, 10))\n+ await new Promise(resolve => setTimeout(resolve, 20))\nawait subject.close().then(() => {\nexpect(logs.error).to.length(1)\nexpect(logs.warn).length(3) // 3 warnings about write failure\n@@ -164,7 +165,7 @@ 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, 10)) // wait for HTTP to finish\n+ await new Promise(resolve => setTimeout(resolve, 20)) // wait for HTTP to finish\nlet count = subject.dispose()\nexpect(logs.error).to.length(1)\nexpect(logs.warn).to.length(0)\n@@ -236,7 +237,7 @@ describe('WriteApi', () => {\nreturn [429, '', {'retry-after': '1'}]\n} else {\nmessages.push(_requestBody.toString())\n- return [200, '', {'retry-after': '1'}]\n+ return [204, '', {'retry-after': '1'}]\n}\n})\n.persist()\n@@ -249,6 +250,7 @@ describe('WriteApi', () => {\nawait new Promise(resolve => setTimeout(resolve, 10)) // wait for background flush and HTTP to finish\nexpect(logs.error).to.length(0)\nexpect(logs.warn).to.length(1)\n+ subject.writePoint(new Point()) // ignored, since it generates no line\nsubject.writePoints([\nnew Point('test'), // will be ignored + warning\nnew Point('test').floatField('value', 2),\n@@ -284,5 +286,25 @@ 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('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+ nock(clientOptions.url)\n+ .post(WRITE_PATH_NS)\n+ .reply((_uri, _requestBody) => {\n+ return [200, '', {}]\n+ })\n+ .persist()\n+ subject.writePoint(new Point('test').floatField('value', 1))\n+ await new Promise(resolve => setTimeout(resolve, 20)) // wait for background flush and HTTP to finish\n+ expect(logs.error).has.length(1)\n+ expect(logs.error[0][0]).equals('Write to InfluxDB failed.')\n+ expect(logs.error[0][1]).instanceOf(HttpError)\n+ expect(logs.error[0][1].statusCode).equals(200)\n+ expect(logs.error[0][1].statusMessage).equals(\n+ `204 HTTP response status code expected, but 200 returned`\n+ )\n+ expect(logs.warn).deep.equals([])\n+ })\n})\n})\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core): require write response to have status code 204
305,159
09.10.2020 06:49:36
-7,200
c7f81bd248241a8fc3935cb0b29759af98d1cdcb
chore(core): make QueryApi instance immutable
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "### Bug Fixes\n1. [#264](https://github.com/influxdata/influxdb-client-js/pull/264): Require 204 status code in a write response.\n+1. [#265](https://github.com/influxdata/influxdb-client-js/pull/265): Make QueryApi instance immutable.\n## 1.7.0 [2020-10-02]\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/QueryApi.ts", "new_path": "packages/core/src/QueryApi.ts", "diff": "@@ -46,9 +46,9 @@ export interface Row {\n*/\nexport default interface QueryApi {\n/**\n- * Adds extra options for this query API.\n+ * Returns a new query API with extra options applied.\n* @param options - query options to use\n- * @returns this\n+ * @returns queryApi instance with the supplied options\n*/\nwith(options: Partial<QueryOptions>): QueryApi\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/WriteApi.ts", "new_path": "packages/core/src/WriteApi.ts", "diff": "@@ -14,6 +14,7 @@ export default interface WriteApi {\n* Instructs to use the following default tags when writing points.\n* Not applicable for writing records/lines.\n* @param tags - default tags\n+ * @returns this\n*/\nuseDefaultTags(tags: {[key: string]: string}): WriteApi\n" }, { "change_type": "MODIFY", "old_path": "packages/core/src/impl/QueryApiImpl.ts", "new_path": "packages/core/src/impl/QueryApiImpl.ts", "diff": "@@ -19,13 +19,12 @@ const identity = <T>(value: T): T => value\nexport class QueryApiImpl implements QueryApi {\nprivate options: QueryOptions\n- constructor(private transport: Transport, org: string) {\n- this.options = {org}\n+ constructor(private transport: Transport, org: string | QueryOptions) {\n+ this.options = typeof org === 'string' ? {org} : org\n}\nwith(options: Partial<QueryOptions>): QueryApi {\n- this.options = {...this.options, ...options}\n- return this\n+ return new QueryApiImpl(this.transport, {...this.options, ...options})\n}\nlines(query: string | ParameterizedQuery): Observable<string> {\n" }, { "change_type": "MODIFY", "old_path": "packages/core/test/unit/QueryApi.test.ts", "new_path": "packages/core/test/unit/QueryApi.test.ts", "diff": "@@ -24,8 +24,13 @@ describe('QueryApi', () => {\nnock.cleanAll()\nnock.enableNetConnect()\n})\n+ it('with function does not mutate this', () => {\n+ const first = new InfluxDB(clientOptions).getQueryApi(ORG)\n+ const second = first.with({gzip: true})\n+ expect(first).is.not.equal(second)\n+ })\nit('receives lines', async () => {\n- const subject = new InfluxDB(clientOptions).getQueryApi(ORG).with({})\n+ const subject = new InfluxDB(clientOptions).getQueryApi(ORG)\nnock(clientOptions.url)\n.post(QUERY_PATH)\n.reply((_uri, _requestBody) => {\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(core): make QueryApi instance immutable
305,159
10.10.2020 10:26:29
-7,200
474f07bb4695125d9c5e0b3c648994f1b7437dc6
chore(ci): simplify nightly build
[ { "change_type": "MODIFY", "old_path": ".circleci/deploy-nightly-version.sh", "new_path": ".circleci/deploy-nightly-version.sh", "diff": "@@ -10,11 +10,7 @@ git config user.email \"[email protected]\"\ngit commit -am \"chore(release): prepare to release influxdb-client-js-${VERSION}.nightly\"\n# Build Core\n-cd \"${SCRIPT_PATH}\"/../packages/core\n-yarn build\n-\n-# Build Apis\n-cd \"${SCRIPT_PATH}\"/../packages/apis\n+cd \"${SCRIPT_PATH}\"/..\nyarn build\n# Publish\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(ci): simplify nightly build
305,159
12.10.2020 12:50:18
-7,200
bc5fcab723e80e54cbfbc62e646247ab8b90efc8
feat(core-browser): introduce core-browser module
[ { "change_type": "ADD", "old_path": null, "new_path": "packages/core-browser/.npmignore", "diff": "+node_modules\n+build\n+.rpt2_cache\n+.DS_Store\n+.nyc_output\n+*.lcov\n+yarn-error.log\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "packages/core-browser/README.md", "diff": "+# @influxdata/influxdb-client-browser\n+\n+The reference javascript browser client for InfluxDB 2.0. The package.json\n+\n+- **main** points to browser UMD distribution\n+- **module** points to browser ESM distribution\n+- **browser** points to browser UMD distribution\n+\n+Browser distributions do not work in Node.js and vice versa, different APIs are used. See `@influxdata/influxdb-client` for a distribution that can be used in Node.js environment.\n+\n+See https://github.com/influxdata/influxdb-client-js to know more.\n+\n+**Note: This library is for use with InfluxDB 2.x or 1.8+. For connecting to InfluxDB 1.x instances, see [node-influx](https://github.com/node-influx/node-influx).**\n" }, { "change_type": "ADD", "old_path": null, "new_path": "packages/core-browser/package.json", "diff": "+{\n+ \"name\": \"@influxdata/influxdb-client-browser\",\n+ \"version\": \"1.7.0\",\n+ \"description\": \"InfluxDB 2.0 client for browser\",\n+ \"scripts\": {\n+ \"apidoc:extract\": \"echo \\\"Nothing to do\\\"\",\n+ \"build\": \"yarn run clean && cpr ../core/dist ./dist\",\n+ \"clean\": \"rimraf dist\"\n+ },\n+ \"main\": \"dist/index.browser.js\",\n+ \"module\": \"dist/index.browser.mjs\",\n+ \"browser\": \"dist/index.browser.js\",\n+ \"homepage\": \"https://github.com/influxdata/influxdb-client-js\",\n+ \"repository\": {\n+ \"type\": \"git\",\n+ \"url\": \"git+https://github.com/influxdata/influxdb-client-js\",\n+ \"directory\": \"packages/core-browser\"\n+ },\n+ \"keywords\": [\n+ \"influxdb\",\n+ \"influxdata\"\n+ ],\n+ \"author\": {\n+ \"name\": \"Pavel Zavora\"\n+ },\n+ \"license\": \"MIT\",\n+ \"devDependencies\": {\n+ \"cpr\": \"^3.0.1\",\n+ \"rimraf\": \"^3.0.0\"\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "packages/core/README.md", "new_path": "packages/core/README.md", "diff": "-# influxdb-client-javascript\n+# @influxdata/influxdb-client\n+\n+The reference javascript client for InfluxDB 2.0. Both node and browser environments are supported. The package.json\n+\n+- **main** points to node.js CJS distribution\n+- **module** points to node.js ESM distribution\n+- **browser** points to browser (UMD) distribution\n+\n+Node distributions do not work in browser and vice versa, because different platform APIs are used. See `@influxdata/influxdb-client-browser` that targets only browser.\n-The reference javascript client for InfluxDB 2.0. Both node and browser environments are supported.\nSee https://github.com/influxdata/influxdb-client-js to know more.\n**Note: This library is for use with InfluxDB 2.x or 1.8+. For connecting to InfluxDB 1.x instances, see [node-influx](https://github.com/node-influx/node-influx).**\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -2269,6 +2269,16 @@ cosmiconfig@^5.1.0:\njs-yaml \"^3.13.1\"\nparse-json \"^4.0.0\"\n+cpr@^3.0.1:\n+ version \"3.0.1\"\n+ resolved \"https://registry.yarnpkg.com/cpr/-/cpr-3.0.1.tgz#b9a55038b7cd81a35c17b9761895bd8496aef1e5\"\n+ integrity sha1-uaVQOLfNgaNcF7l2GJW9hJau8eU=\n+ dependencies:\n+ graceful-fs \"^4.1.5\"\n+ minimist \"^1.2.0\"\n+ mkdirp \"~0.5.1\"\n+ rimraf \"^2.5.4\"\n+\ncross-spawn@^6.0.0, cross-spawn@^6.0.5:\nversion \"6.0.5\"\nresolved \"https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4\"\n@@ -3409,7 +3419,7 @@ globby@^9.2.0:\npify \"^4.0.1\"\nslash \"^2.0.0\"\n-graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2:\n+graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.5, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2:\nversion \"4.2.4\"\nresolved \"https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb\"\nintegrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==\n@@ -4634,7 +4644,7 @@ minimist-options@^3.0.1:\narrify \"^1.0.1\"\nis-plain-obj \"^1.1.0\"\n-minimist@>=1.2.2, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5:\n+minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5:\nversion \"1.2.5\"\nresolved \"https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602\"\nintegrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(core-browser): introduce core-browser module
305,159
12.10.2020 12:52:02
-7,200
22ec57a6416a6e8b6e0dc3036639fcc8a403697c
feat(apis): use exactly the same code for browser and node.js, determine environemt at runtime
[ { "change_type": "MODIFY", "old_path": "packages/apis/rollup.config.js", "new_path": "packages/apis/rollup.config.js", "diff": "@@ -2,26 +2,14 @@ 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 replace from '@rollup/plugin-replace'\nconst tsBuildConfigPath = './tsconfig.build.json'\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- replace(\n- browser\n- ? {\n- 'process.env.ROLLUP_BROWSER': 'true',\n- delimiters: ['', ''],\n- }\n- : {\n- 'process.env.ROLLUP_BROWSER': 'false',\n- delimiters: ['', ''],\n- }\n- ),\ntypescript({\ntsconfig: tsBuildConfigPath,\ntsconfigOverride: {\n@@ -44,23 +32,20 @@ function createConfig({browser, format, out, name, target, noTerser}) {\n}\nexport default [\n- createConfig({browser: false, format: 'cjs', out: pkg.main}),\n- createConfig({browser: false, format: 'esm', out: pkg.module}),\n- createConfig({browser: true, format: 'umd', out: pkg.browser}),\n+ createConfig({format: 'cjs', out: pkg.main}),\n+ createConfig({format: 'esm', out: pkg.module}),\n+ createConfig({format: 'umd', out: pkg.browser}),\ncreateConfig({\n- browser: true,\nformat: 'esm',\nout: pkg.browser.replace('.js', '.mjs'),\n}),\ncreateConfig({\n- browser: true,\nformat: 'iife',\nname: 'influxdbApis',\nout: 'dist/influxdbApis.min.js',\ntarget: 'es5',\n}),\ncreateConfig({\n- browser: true,\nformat: 'iife',\nname: 'influxdbApis',\nout: 'dist/influxdbApis.js',\n" }, { "change_type": "MODIFY", "old_path": "packages/apis/src/APIBase.ts", "new_path": "packages/apis/src/APIBase.ts", "diff": "@@ -7,6 +7,12 @@ declare function btoa(plain: string): string\nexport interface RequestOptions {\nheaders?: {[key: string]: string}\n}\n+\n+function base64(value: string): string {\n+ return typeof btoa === 'function' // browser (window,worker) environment\n+ ? btoa(value)\n+ : Buffer.from(value, 'binary').toString('base64')\n+}\n/**\n* Base class for all apis.\n*/\n@@ -57,9 +63,7 @@ export class APIBase {\nconst value = `${request.auth.user}:${request.auth.password}`\n;(sendOptions.headers || (sendOptions.headers = {}))[\n'authorization'\n- ] = process.env.ROLLUP_BROWSER\n- ? btoa(value)\n- : Buffer.from(value, 'binary').toString('base64')\n+ ] = base64(value)\n}\nreturn this.transport.request(\npath,\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
feat(apis): use exactly the same code for browser and node.js, determine environemt at runtime
305,159
12.10.2020 12:55:22
-7,200
2b5d707ce9730ca9905888c67c25d9387580b7ad
chore(build): include core-browser into builds
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -41,6 +41,8 @@ $ 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+\nTo use InfluxDB management APIs in your project, add also `@influxdata/influxdb-client-apis` dependency to your project.\n```\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"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 ../apis && yarn build\",\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 ../../examples\",\n\"coverage\": \"cd packages/core && yarn coverage\",\n\"coverage:send\": \"cd packages/core && yarn coverage:send\"\n" }, { "change_type": "MODIFY", "old_path": "packages/core-browser/README.md", "new_path": "packages/core-browser/README.md", "diff": "The reference javascript browser client for InfluxDB 2.0. The package.json\n-- **main** points to browser UMD distribution\n-- **module** points to browser ESM distribution\n-- **browser** points to browser UMD distribution\n+- **main** points to browser UMD distribution of @influxdata/influxdb-client\n+- **module** points to browser ESM distribution of @influxdata/influxdb-client\n+- **browser** points to browser UMD distribution of @influxdata/influxdb-client\n-Browser distributions do not work in Node.js and vice versa, different APIs are used. See `@influxdata/influxdb-client` for a distribution that can be used in Node.js environment.\n+Browser distributions do not work in Node.js and vice versa, different APIs are used in Node.js. See `@influxdata/influxdb-client` for a distribution that can be used in Node.js environment.\nSee https://github.com/influxdata/influxdb-client-js to know more.\n" }, { "change_type": "MODIFY", "old_path": "packages/core/README.md", "new_path": "packages/core/README.md", "diff": "@@ -6,7 +6,7 @@ The reference javascript client for InfluxDB 2.0. Both node and browser environm\n- **module** points to node.js ESM distribution\n- **browser** points to browser (UMD) distribution\n-Node distributions do not work in browser and vice versa, because different platform APIs are used. See `@influxdata/influxdb-client-browser` that targets only browser.\n+Node.js distributions do not work in browser and vice versa, because different platform APIs are used. See `@influxdata/influxdb-client-browser` that targets only browser.\nSee https://github.com/influxdata/influxdb-client-js to know more.\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -4644,7 +4644,7 @@ minimist-options@^3.0.1:\narrify \"^1.0.1\"\nis-plain-obj \"^1.1.0\"\n-minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5:\n+minimist@>=1.2.2, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5:\nversion \"1.2.5\"\nresolved \"https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602\"\nintegrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore(build): include core-browser into builds
305,160
14.10.2020 12:41:52
-7,200
b2dd3215ab8b45e22180e7b75fac70baf428a58b
fix: deploying nightly packages
[ { "change_type": "MODIFY", "old_path": ".circleci/deploy-nightly-version.sh", "new_path": ".circleci/deploy-nightly-version.sh", "diff": "@@ -5,6 +5,7 @@ SCRIPT_PATH=\"$( cd \"$(dirname \"$0\")\" || exit ; pwd -P )\"\n# Update Version\nVERSION=$(cat packages/core/src/impl/version.ts | sed 's/[^0-9.]*//g' | awk -F. '{$2+=1; OFS=\".\"; print $1\".\"$2\".\"$3}')\nsed -i -e \"s/CLIENT_LIB_VERSION = '.*'/CLIENT_LIB_VERSION = '${VERSION}.nightly'/\" packages/core/src/impl/version.ts\n+yarn lerna version \"$VERSION\"-nightly.\"$CIRCLE_BUILD_NUM\" --no-git-tag-version --yes\ngit config user.name \"CircleCI Builder\"\ngit config user.email \"[email protected]\"\ngit commit -am \"chore(release): prepare to release influxdb-client-js-${VERSION}.nightly\"\n@@ -14,4 +15,4 @@ cd \"${SCRIPT_PATH}\"/..\nyarn build\n# Publish\n-yarn lerna publish --canary preminor --no-git-tag-version --force-publish --preid nightly --yes\n\\ No newline at end of file\n+yarn lerna publish --canary from-package --no-git-tag-version --force-publish --preid nightly --yes\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix: deploying nightly packages (#268)
305,159
19.10.2020 09:05:02
-7,200
eb40246a9b5a676c1f01693090a26114fc0016f2
chore: improve main readme
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "+# **Releasing a new version**\n+# Ensure that:\n+# - You have administrator access to this repo on GitHub\n+# - You have permissions to publish to the [influxdata](https://www.npmjs.com/org/influxdata) organization on npm\n+# - You are on `master` and the working tree is clean\n+# Then run the publish target with VERSION specified:\n+# ```\n+# make publish VERSION=1.8.0\n+# ```\n.DEFAULT_GOAL := help\nhelp:\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -73,43 +73,33 @@ There are also more advanced [examples](./examples/README.md) that shows\nThe client API Reference Documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n-## Build Requirements\n+## Contributing\n+\n+If you would like to contribute code you can do through GitHub by forking the repository and sending a pull request into the `master` branch.\n+\n+Build Requirements:\n-- node v12.13.1 or higher (older versions will work as well)\n-- yarn 1.9.4. or higher (older versions will work as well)\n+- node v12.13.1 or higher\n+- yarn 1.9.4. or higher\n-Run all unit tests:\n+Run tests:\n```bash\n-$ yarn test:unit\n+$ yarn test\n```\n-Check code coverage of unit tests:\n+Check code coverage:\n```bash\n$ yarn coverage\n```\n-## Development\n-\n-### Releasing a new version\n-\n-Ensure that:\n-\n-- You have administrator access to this repo on GitHub\n-- You have permissions to publish to the [influxdata](https://www.npmjs.com/org/influxdata) organization on npm\n-- You are on `master` and the working tree is clean\n+Build distributions:\n-Then run the publish script in the root of the repo:\n-\n-```\n-make publish VERSION=1.7.0\n+```bash\n+$ yarn build\n```\n-## Contributing\n-\n-If you would like to contribute code you can do through GitHub by forking the repository and sending a pull request into the `master` branch.\n-\n## License\nThe InfluxDB 2.0 javascript client is released under the [MIT License](https://opensource.org/licenses/MIT).\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: improve main readme
305,159
19.10.2020 12:11:02
-7,200
3ff6b46b1f0a26e9393ee43e37e0708926f6eb13
fix(core): don't set User-Agent header in browser
[ { "change_type": "MODIFY", "old_path": "packages/core/src/impl/browser/FetchTransport.ts", "new_path": "packages/core/src/impl/browser/FetchTransport.ts", "diff": "@@ -10,7 +10,6 @@ import {ConnectionOptions} from '../../options'\nimport {HttpError} from '../../errors'\nimport completeCommunicationObserver from '../completeCommunicationObserver'\nimport Logger from '../Logger'\n-import {CLIENT_LIB_VERSION} from '../version'\n/**\n* Transport layer that use browser fetch.\n@@ -22,7 +21,7 @@ export default class FetchTransport implements Transport {\nconstructor(private connectionOptions: ConnectionOptions) {\nthis.defaultHeaders = {\n'content-type': 'application/json; charset=utf-8',\n- 'User-Agent': `influxdb-client-js/${CLIENT_LIB_VERSION}`,\n+ // 'User-Agent': `influxdb-client-js/${CLIENT_LIB_VERSION}`, // user-agent can hardly be customized https://github.com/influxdata/influxdb-client-js/issues/262\n}\nif (this.connectionOptions.token) {\nthis.defaultHeaders['Authorization'] =\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": "@@ -2,7 +2,6 @@ import FetchTransport from '../../../../src/impl/browser/FetchTransport'\nimport {expect} from 'chai'\nimport {removeFetchApi, emulateFetchApi} from './emulateBrowser'\nimport sinon from 'sinon'\n-import {CLIENT_LIB_VERSION} from '../../../../src/impl/version'\nimport {SendOptions, Cancellable} from '../../../../src'\nimport {CollectedLogs, collectLogging} from '../../../util'\n@@ -26,7 +25,6 @@ describe('FetchTransport', () => {\nconst transport: any = new FetchTransport(options)\nexpect(transport.defaultHeaders).to.deep.equal({\n'content-type': 'application/json; charset=utf-8',\n- 'User-Agent': `influxdb-client-js/${CLIENT_LIB_VERSION}`,\n})\nexpect(transport.connectionOptions).to.deep.equal(options)\n})\n@@ -38,7 +36,6 @@ describe('FetchTransport', () => {\nconst transport: any = new FetchTransport(options)\nexpect(transport.defaultHeaders).to.deep.equal({\n'content-type': 'application/json; charset=utf-8',\n- 'User-Agent': `influxdb-client-js/${CLIENT_LIB_VERSION}`,\nAuthorization: 'Token a',\n})\nexpect(transport.connectionOptions).to.deep.equal(options)\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix(core): don't set User-Agent header in browser
305,159
19.10.2020 12:17:38
-7,200
13042472dc094394ae9838b4d77f71c86f547bf9
fix: repair main test target
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"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 ../../examples\",\n+ \"test\": \"cd packages/core && yarn test && yarn build && cd ../apis && yarn test && yarn eslint --ignore-pattern node_modules ../../examples\",\n\"coverage\": \"cd packages/core && yarn coverage\",\n\"coverage:send\": \"cd packages/core && yarn coverage:send\"\n},\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
fix: repair main test target
305,159
30.10.2020 14:46:29
-3,600
c1b43cf672a7e00e7906e3c3692d65bc5f1bf6db
chore: repair coverage data to send
[ { "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\": \"nyc report --reporter=text-lcov > coverage/coverage.lcov && codecov --root=../..\",\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\"test\": \"yarn run lint && yarn run typecheck && yarn run test:all\",\n\"test:all\": \"mocha --require ts-node/register 'test/**/*.test.ts' --exit\",\n" } ]
TypeScript
MIT License
influxdata/influxdb-client-js
chore: repair coverage data to send