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 | 01.07.2021 08:17:04 | -7,200 | bc5b5fce4fa70dc7017a5f0d534dbf7f53090539 | feat(core): add maxRetryTime to retry strategy | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/RetryBuffer.ts",
"new_path": "packages/core/src/impl/RetryBuffer.ts",
"diff": "@@ -6,6 +6,7 @@ const RETRY_INTERVAL = 1\ninterface RetryItem {\nlines: string[]\nretryCount: number\n+ expires: number\nnext?: RetryItem\n}\n@@ -24,14 +25,24 @@ export default class RetryBuffer {\nprivate maxLines: number,\nprivate retryLines: (\nlines: string[],\n- retryCountdown: number\n+ retryCountdown: number,\n+ started: number\n) => Promise<void>\n) {}\n- addLines(lines: string[], retryCount: number, delay: number): void {\n+ addLines(\n+ lines: string[],\n+ retryCount: number,\n+ delay: number,\n+ expires: number\n+ ): void {\nif (this.closed) return\nif (!lines.length) return\n- const retryTime = Date.now() + delay\n+ let retryTime = Date.now() + delay\n+ if (expires < retryTime) {\n+ delay = expires - Date.now()\n+ retryTime = expires\n+ }\nif (retryTime > this.nextRetryTime) this.nextRetryTime = retryTime\n// ensure at most maxLines are in the Buffer\nif (this.first && this.size + lines.length > this.maxLines) {\n@@ -40,7 +51,11 @@ export default class RetryBuffer {\ndo {\nconst newFirst = this.first.next as RetryItem\nthis.size -= this.first.lines.length\n+ this.first.next = undefined\nthis.first = newFirst\n+ if (!this.first) {\n+ this.last = undefined\n+ }\n} while (this.first && this.size + lines.length > newSize)\nLogger.error(\n`RetryBuffer: ${origSize -\n@@ -50,9 +65,10 @@ export default class RetryBuffer {\n} lines`\n)\n}\n- const toAdd = {\n+ const toAdd: RetryItem = {\nlines,\nretryCount,\n+ expires,\n}\nif (this.last) {\nthis.last.next = toAdd\n@@ -69,6 +85,7 @@ export default class RetryBuffer {\nif (this.first) {\nconst toRetry = this.first\nthis.first = this.first.next\n+ toRetry.next = undefined\nthis.size -= toRetry.lines.length\nif (!this.first) this.last = undefined\nreturn toRetry\n@@ -80,7 +97,7 @@ export default class RetryBuffer {\nthis._timeoutHandle = setTimeout(() => {\nconst toRetry = this.removeLines()\nif (toRetry) {\n- this.retryLines(toRetry.lines, toRetry.retryCount)\n+ this.retryLines(toRetry.lines, toRetry.retryCount, toRetry.expires)\n.then(() => {\n// continue with successfull retry\nthis.scheduleRetry(RETRY_INTERVAL)\n@@ -92,13 +109,13 @@ export default class RetryBuffer {\n} else {\nthis._timeoutHandle = undefined\n}\n- }, delay)\n+ }, Math.max(delay, 0))\n}\nasync flush(): Promise<void> {\nlet toRetry\nwhile ((toRetry = this.removeLines())) {\n- await this.retryLines(toRetry.lines, toRetry.retryCount)\n+ await this.retryLines(toRetry.lines, toRetry.retryCount, toRetry.expires)\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/WriteApiImpl.ts",
"new_path": "packages/core/src/impl/WriteApiImpl.ts",
"diff": "@@ -130,10 +130,23 @@ export default class WriteApiImpl implements WriteApi {\n)\n}\n- sendBatch(lines: string[], attempts: number): Promise<void> {\n+ sendBatch(\n+ lines: string[],\n+ attempts: number,\n+ expires: number = Date.now() + this.writeOptions.maxRetryTime\n+ ): Promise<void> {\n// eslint-disable-next-line @typescript-eslint/no-this-alias\nconst self: WriteApiImpl = this\n+ const failedAttempts = self.writeOptions.maxRetries + 2 - attempts\nif (!this.closed && lines.length > 0) {\n+ if (expires <= Date.now()) {\n+ const error = new Error('Max retry time exceeded.')\n+ Logger.error(\n+ `Write to InfluxDB failed (attempt: ${failedAttempts}).`,\n+ error\n+ )\n+ return Promise.reject(error)\n+ }\nreturn new Promise<void>((resolve, reject) => {\nlet responseStatusCode: number | undefined\nconst callbacks = {\n@@ -141,7 +154,6 @@ export default class WriteApiImpl implements WriteApi {\nresponseStatusCode = statusCode\n},\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,\n@@ -160,14 +172,14 @@ export default class WriteApiImpl implements WriteApi {\n(error as HttpError).statusCode >= 429)\n) {\nLogger.warn(\n- `Write to InfluxDB failed (remaining attempts: ${attempts -\n- 1}).`,\n+ `Write to InfluxDB failed (attempt: ${failedAttempts}).`,\nerror\n)\nself.retryBuffer.addLines(\nlines,\nattempts - 1,\n- self.retryStrategy.nextDelay(error, failedAttempts)\n+ self.retryStrategy.nextDelay(error, failedAttempts),\n+ expires\n)\nreject(error)\nreturn\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/WriteApi.test.ts",
"new_path": "packages/core/test/unit/WriteApi.test.ts",
"diff": "@@ -156,7 +156,7 @@ describe('WriteApi', () => {\n)\n})\n})\n- it('does not retry write when configured to do so', async () => {\n+ it('does not retry write when maxRetries is zero', async () => {\nuseSubject({maxRetries: 0, batchSize: 1})\nsubject.writeRecord('test value=1')\nawait waitForCondition(() => logs.error.length > 0)\n@@ -165,6 +165,25 @@ describe('WriteApi', () => {\nexpect(logs.warn).is.deep.equal([])\n})\n})\n+ it('does not retry write when maxRetryTime exceeds', async () => {\n+ useSubject({maxRetryTime: 5, batchSize: 1})\n+ subject.writeRecord('test value=1')\n+ // wait for first attempt to fail\n+ await waitForCondition(() => logs.warn.length > 0)\n+ // wait for retry attempt to fail on timeout\n+ await waitForCondition(() => logs.error.length > 0)\n+ await subject.close().then(() => {\n+ expect(logs.warn).to.length(1)\n+ expect(logs.warn[0][0]).contains(\n+ 'Write to InfluxDB failed (attempt: 1)'\n+ )\n+ expect(logs.error).to.length(1)\n+ expect(logs.error[0][0]).contains(\n+ 'Write to InfluxDB failed (attempt: 2)'\n+ )\n+ expect(logs.error[0][1].toString()).contains('Max retry time exceeded')\n+ })\n+ })\nit('does not retry write when writeFailed handler returns a Promise', async () => {\nuseSubject({\nmaxRetries: 3,\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/impl/RetryBuffer.test.ts",
"new_path": "packages/core/test/unit/impl/RetryBuffer.test.ts",
"diff": "@@ -21,13 +21,13 @@ describe('RetryBuffer', () => {\n})\nfor (let i = 0; i < 10; i++) {\ninput.push([['a' + i], i])\n- subject.addLines(['a' + i], i, 2)\n+ subject.addLines(['a' + i], i, 2, Date.now() + 1000)\n}\nawait waitForCondition(() => output.length >= 10)\nexpect(output).length.is.greaterThan(0)\n- subject.addLines([], 1, 1) // shall be ignored\n+ subject.addLines([], 1, 1, Date.now() + 1000) // shall be ignored\nsubject.close()\n- subject.addLines(['x'], 1, 1) // shall be ignored\n+ subject.addLines(['x'], 1, 1, Date.now() + 1000) // shall be ignored\nawait subject.flush()\nexpect(input).deep.equals(output)\n})\n@@ -40,20 +40,32 @@ describe('RetryBuffer', () => {\n})\nfor (let i = 0; i < 10; i++) {\nif (i >= 5) input.push([['a' + i], i])\n- subject.addLines(['a' + i], i, 100)\n+ subject.addLines(['a' + i], i, 100, Date.now() + 1000)\n}\nawait subject.flush()\nexpect(subject.close()).equals(0)\nexpect(logs.error).length.is.greaterThan(0) // 5 entries over limit\nexpect(output).length.is.lessThan(6) // at most 5 items will be written\n})\n+ it('ignores previous lines on big chunks', async () => {\n+ const output = [] as Array<[string[], number]>\n+ const subject = new RetryBuffer(2, (lines, countdown) => {\n+ output.push([lines, countdown])\n+ return Promise.resolve()\n+ })\n+ subject.addLines(['1', '2', '3'], 1, 100, Date.now() + 1000)\n+ subject.addLines(['4', '5', '6'], 1, 100, Date.now() + 1000)\n+ await subject.flush()\n+ expect(logs.error).length.is.greaterThan(0) // 3 entries over limit\n+ expect(output).deep.equals([[['4', '5', '6'], 1]]) // at most 5 items will be written\n+ })\nit('retries does not fail after flush', async () => {\nconst output = [] as Array<[string[], number]>\nconst subject = new RetryBuffer(5, (lines, countdown) => {\noutput.push([lines, countdown])\nreturn Promise.resolve()\n})\n- subject.addLines(['a'], 1, 20)\n+ subject.addLines(['a'], 1, 20, Date.now() + 1000)\nawait subject.flush()\nawait new Promise<void>(\n(resolve, _reject) => setTimeout(() => resolve(), 21) // let scheduled retry finish\n@@ -71,15 +83,15 @@ describe('RetryBuffer', () => {\n})\nfor (let i = 0; i < 10; i++) {\ninput.push([['a' + i], i])\n- subject.addLines(['a' + i], i, 2)\n+ subject.addLines(['a' + i], i, 2, Date.now() + 1000)\n}\nawait new Promise<void>((resolve, _reject) =>\nsetTimeout(() => resolve(), 10)\n)\nexpect(output).length.is.greaterThan(0)\n- subject.addLines([], 1, 1) // shall be ignored\n+ subject.addLines([], 1, 1, Date.now() + 1000) // shall be ignored\nsubject.close()\n- subject.addLines(['x'], 1, 1) // shall be ignored\n+ subject.addLines(['x'], 1, 1, Date.now() + 1000) // shall be ignored\nsucceed = true\nawait subject.flush()\nexpect(input).deep.equals(output)\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): add maxRetryTime to retry strategy |
305,159 | 01.07.2021 08:26:55 | -7,200 | 432183a8abaf041c38770a2e4c42e257839a6483 | feat(core): test default retry strategy | [
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/WriteApi.test.ts",
"new_path": "packages/core/test/unit/WriteApi.test.ts",
"diff": "@@ -218,7 +218,7 @@ describe('WriteApi', () => {\nexpect(logs.warn).has.length(0)\nexpect(count).equals(1)\n})\n- it('implementation uses default notifiers', () => {\n+ it('implementation uses expected defaults', () => {\nuseSubject({})\nconst writeOptions = (subject as any).writeOptions as WriteOptions\nexpect(writeOptions.writeFailed).equals(DEFAULT_WriteOptions.writeFailed)\n@@ -227,6 +227,7 @@ describe('WriteApi', () => {\n)\nexpect(writeOptions.writeSuccess).to.not.throw()\nexpect(writeOptions.writeFailed).to.not.throw()\n+ expect(writeOptions.randomRetry).equals(true)\n})\n})\ndescribe('convert point time to line protocol', () => {\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): test default retry strategy |
305,159 | 02.08.2021 06:36:53 | -7,200 | 6c301d5a67c63b05cda6c48645e1fd690db7826d | feat(core): upgrade typescript for rxjs7 | [
{
"change_type": "MODIFY",
"old_path": "packages/core/package.json",
"new_path": "packages/core/package.json",
"diff": "\"rxjs\": \"^7.2.0\",\n\"sinon\": \"^7.5.0\",\n\"ts-node\": \"^8.5.4\",\n- \"typescript\": \"^4.1.2\",\n+ \"typescript\": \"^4.3.5\",\n\"version-bump-prompt\": \"^5.0.6\"\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -4745,7 +4745,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@@ -7032,15 +7032,20 @@ typedarray@^0.0.6:\nintegrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=\ntypescript@^3.7.4:\n- version \"3.9.7\"\n- resolved \"https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa\"\n- integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==\n+ version \"3.9.10\"\n+ resolved \"https://registry.yarnpkg.com/typescript/-/typescript-3.9.10.tgz#70f3910ac7a51ed6bef79da7800690b19bf778b8\"\n+ integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==\ntypescript@^4.1.2:\nversion \"4.1.2\"\nresolved \"https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9\"\nintegrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==\n+typescript@^4.3.5:\n+ version \"4.3.5\"\n+ resolved \"https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4\"\n+ integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==\n+\ntypescript@~4.1.3:\nversion \"4.1.5\"\nresolved \"https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72\"\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): upgrade typescript for rxjs7 |
305,159 | 02.08.2021 06:37:08 | -7,200 | 4dbb8bc93e44b36c256c2445e65d0902e4a8b7fd | fix(core): add missing import | [
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/Influxdb.test.ts",
"new_path": "packages/core/test/unit/Influxdb.test.ts",
"diff": "import {expect} from 'chai'\n-import {InfluxDB, ClientOptions} from '../../src'\n+import {InfluxDB, ClientOptions, Transport} from '../../src'\ndescribe('InfluxDB', () => {\ndescribe('constructor', () => {\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(core): add missing import |
305,159 | 02.08.2021 06:37:57 | -7,200 | b0117e3bf303166181178bf8a6e26f3bac50e30b | fix(core): workaround | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/browser/FetchTransport.ts",
"new_path": "packages/core/src/impl/browser/FetchTransport.ts",
"diff": "@@ -123,7 +123,7 @@ export default class FetchTransport implements Transport {\n} else {\nif (response.body) {\nconst reader = response.body.getReader()\n- let chunk: ReadableStreamReadResult<Uint8Array>\n+ let chunk: ReadableStreamDefaultReadResult<Uint8Array>\ndo {\nchunk = await reader.read()\nobserver.next(chunk.value)\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(core): workaround https://github.com/microsoft/TypeScript/issues/42970 |
305,159 | 02.08.2021 07:11:02 | -7,200 | 7f81752bc8f8c025347475ff4de5f3d8bee1b6e0 | chore(docs): document default timeout | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/options.ts",
"new_path": "packages/core/src/options.ts",
"diff": "@@ -9,7 +9,10 @@ export interface ConnectionOptions {\nurl: string\n/** authentication token */\ntoken?: string\n- /** socket timeout */\n+ /**\n+ * socket timeout, 10000 milliseconds by default in node.js\n+ * @defaultValue 10000\n+ */\ntimeout?: number\n/** extra options for the transport layer, they can setup a proxy agent or an abort signal in node.js transport that relies upon {@link https://nodejs.org/api/http.html#http_http_request_url_options_callback } */\ntransportOptions?: {[key: string]: any}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(docs): document default timeout |
305,159 | 02.08.2021 07:31:23 | -7,200 | 1bc2be30fa17f85b30c87359713b56462e523705 | feat: upgrade to typescript 4.3.5 | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/package.json",
"new_path": "packages/apis/package.json",
"diff": "\"rollup-plugin-terser\": \"^7.0.0\",\n\"rollup-plugin-typescript2\": \"^0.27.2\",\n\"ts-node\": \"^8.5.4\",\n- \"typescript\": \"^4.1.2\"\n+ \"typescript\": \"^4.3.5\"\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/giraffe/package.json",
"new_path": "packages/giraffe/package.json",
"diff": "\"rollup-plugin-typescript2\": \"^0.27.2\",\n\"sinon\": \"^7.5.0\",\n\"ts-node\": \"^8.5.4\",\n- \"typescript\": \"^4.1.2\"\n+ \"typescript\": \"^4.3.5\"\n}\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat: upgrade to typescript 4.3.5 |
305,159 | 02.08.2021 07:41:05 | -7,200 | 0785b104719a7ecb22bd480493fad1f99af1c87a | chore: add doc upgrade to changelog | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "1. [#347](https://github.com/influxdata/influxdb-client-js/pull/347): Parsing infinite numbers\n+### Documentation\n+\n+1. [#351](https://github.com/influxdata/influxdb-client-js/pull/351): Upgrade api-extractor and api-documenter.\n+\n## 1.15.0 [2021-07-09]\n### Features\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore: add doc upgrade to changelog |
305,159 | 05.08.2021 15:41:48 | -7,200 | 55e5c9056623595fb278c13ef1dc517efa4b6465 | chore(doc): improve doc with tag name/value requirements | [
{
"change_type": "MODIFY",
"old_path": "examples/index.html",
"new_path": "examples/index.html",
"diff": "// import {InfluxDB, Point} from '../packages/core/dist/index.browser.mjs'\n// import {HealthAPI, SetupAPI} from '../packages/apis/dist/index.browser.mjs'\n- // import configuration from ./env_browser.js\n+ // ./env_browser.js defines window.INFLUX_ENV with client configuration variables\nimport './env_browser.js'\nconst {url, token, org, bucket, username, password} = window.INFLUX_ENV\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/Point.ts",
"new_path": "packages/core/src/Point.ts",
"diff": "@@ -45,7 +45,8 @@ export class Point {\n}\n/**\n- * Adds a tag.\n+ * Adds a tag. The caller has to ensure that both name and value are not empty\n+ * and do not end with backslash.\n*\n* @param name - tag name\n* @param value - tag value\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(doc): improve doc with tag name/value requirements |
305,167 | 13.08.2021 15:49:38 | 18,000 | aec44091317af9f3eae65c159fb384a816dcb610 | fix: explanation of bucket configuration in browser examples. | [
{
"change_type": "MODIFY",
"old_path": "examples/README.md",
"new_path": "examples/README.md",
"diff": "@@ -27,8 +27,7 @@ This directory contains javascript and typescript examples for node.js, browser,\n- [writeAdvanced.js](./writeAdvanced.js)\nShows how to control the way of how data points are written to InfluxDB.\n- Browser examples\n- - Change `url` in [env.js](./env.js) to match your influxDB instance\n- - Change `token, org, bucket, username, password` variables in [./env_browser.js](env_browser.js) to match your influxDB instance\n+ - Change `token, org, bucket, username, password` variables in [./env_browser.js](env_browser.js) to match your InfluxDB instance\n- Run `npm run browser`\nIt starts a local HTTP server and opens [index.html](./index.html) that contains client examples.\nThe local HTTP server serves all files from this git repository and also proxies requests\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/env_browser.js",
"new_path": "examples/env_browser.js",
"diff": "// eslint-disable-next-line no-undef\n+/**\n+ * The following configuration is used in the browser examples\n+ * (index.html and giraffe.html).\n+ *\n+ * Replace the values with your own InfluxDB values.\n+ */\nwindow.INFLUX_ENV = {\n/** InfluxDB v2 URL, '/influxdb' relies upon proxy to forward to the target influxDB */\n- url: '/influx', //'http://localhost:8086'\n+ url: '/influx', //'http://localhost:8086',\n/** InfluxDB authorization token */\ntoken: 'my-token',\n- /** Organization within InfluxDB */\n+ /** InfluxDB organization */\norg: 'my-org',\n- /**InfluxDB bucket used in examples */\n+ /** InfluxDB bucket used for onboarding and write requests. */\nbucket: 'my-bucket',\n- // ONLY onboarding example\n+\n+ /** The following properties are used ONLY in the onboarding example */\n/** InfluxDB user */\nusername: 'my-user',\n/** InfluxDB password */\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/index.html",
"new_path": "examples/index.html",
"diff": "// import {InfluxDB, Point} from '../packages/core/dist/index.browser.mjs'\n// import {HealthAPI, SetupAPI} from '../packages/apis/dist/index.browser.mjs'\n- // ./env_browser.js defines window.INFLUX_ENV with client configuration variables\n+ /**\n+ * Import the configuration from ./env_browser.js.\n+ * The property INFLUX_ENV.bucket is only used in onboardingExample() and writeExample().\n+ * To prevent SQL injection attacks, the variable is not used within the Flux query examples.\n+ * The query examples assume your InfluxDB bucket is named \"my-bucket\".\n+ */\nimport './env_browser.js'\nconst {url, token, org, bucket, username, password} = window.INFLUX_ENV\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix: explanation of bucket configuration in browser examples. |
305,167 | 13.08.2021 17:00:09 | 18,000 | 9b5a00d9a536f3654bd0e3f93305b9db7c7d86e1 | fix: clarify READMEs and example code comments
- expand comments and descriptions
- clarify differences among provided client distributions.
- explain client distribution used in browser example. | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "[](https://www.npmjs.com/package/@influxdata/influxdb-client)\n[](https://www.influxdata.com/slack)\n-This repository contains the reference javascript client for InfluxDB 2.0. Node, browser and deno environments are supported.\n+This repository contains the reference JavaScript client for InfluxDB 2.0. This client supports Node.js, browser, and Deno environments.\n#### Note: Use this client library with InfluxDB 2.x and InfluxDB 1.8+. For connecting to InfluxDB 1.7 or earlier instances, see the [node-influx](https://github.com/node-influx/node-influx) client library.\n@@ -41,7 +41,7 @@ InfluxDB 2.0 client consists of two main packages\n## Installation\n-To write or query InfluxDB, add `@influxdata/influxdb-client` dependency to your project using your favourite package manager.\n+To write or query InfluxDB, add `@influxdata/influxdb-client` as a dependency to your project using your favorite package manager.\n```\n$ npm install --save @influxdata/influxdb-client\n@@ -49,9 +49,9 @@ $ 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 target browser or [deno](https://deno.land/), use [@influxdata/influxdb-client-browser](./packages/core-browser/README.md).\n+[@influxdata/influxdb-client](./packages/core/README.md) module primarily works in Node.js (main CJS and module ESM), but also provides a bundled ESM distribution for browsers. If you target browsers or clients that don't support ESM, see [@influxdata/influxdb-client-browser](./packages/core-browser/README.md) for UMD distributions.\n-To use InfluxDB management APIs in your project, add also `@influxdata/influxdb-client-apis` dependency to your project.\n+To use InfluxDB management APIs in your project, also add `@influxdata/influxdb-client-apis` as a dependency to your project.\n```\n$ npm install --save @influxdata/influxdb-client-apis\n@@ -61,7 +61,7 @@ $ pnpm add @influxdata/influxdb-client-apis\n## Usage\n-The following examples help to start quickly with this client:\n+Use the following examples to get started with the JavaScript client for InfluxDB:\n- @influxdata/influxdb-client\n- [write points](./examples/write.js)\n@@ -71,25 +71,31 @@ The following examples help to start quickly with this client:\n- [create bucket](./examples/createBucket.js)\n- [health](./examples/health.js)\n-There are also more advanced [examples](./examples/README.md) that show\n+See [examples](./examples/README.md) for more advanced use case like the following:\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 or deno\n-- how to process InfluxDB query results with RX Observables\n-- how to customize the way of how measurement points are written to InfluxDB\n-- how to visualize query results in [Giraffe](https://github.com/influxdata/giraffe)\n+- Execute parameterized queries.\n+- Use the client library with InfluxDB 1.8+.\n+- Use the client library in the browser or Deno.\n+- Process InfluxDB query results with RX Observables.\n+- Customize the writing of measurement points to InfluxDB.\n+- Visualize query results in [Giraffe](https://github.com/influxdata/giraffe).\n-The client API Reference Documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n+JavaScript client API Reference Documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n## Contributing\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+To contribute code, fork the repository and submit a pull request in GitHub to the JavaScript client `master` branch.\nBuild Requirements:\n-- node v14 LTS\n+- Node.js v14 LTS\n+ ```bash\n+ node --version\n+ ```\n- yarn 1.9.4. or higher\n+ ```bash\n+ yarn -v\n+ ```\nRun tests:\n@@ -111,4 +117,4 @@ $ yarn build\n## License\n-The InfluxDB 2.0 javascript client is released under the [MIT License](https://opensource.org/licenses/MIT).\n+The InfluxDB 2.0 JavaScript client is released under the [MIT License](https://opensource.org/licenses/MIT).\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core-browser/README.md",
"new_path": "packages/core-browser/README.md",
"diff": "# @influxdata/influxdb-client-browser\n-The reference InfluxDB 2.0 javascript client for browser and [deno](https://deno.land/) environments. The package.json\n+The reference InfluxDB 2.0 JavaScript client for browser and [Deno](https://deno.land/) environments.\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+The package.json\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.\n+- **main** and **browser** point to the browser UMD distribution of @influxdata/influxdb-client\n+- **module** points to the browser ESM distribution of @influxdata/influxdb-client\n-See https://github.com/influxdata/influxdb-client-js to know more.\n+Browser distributions do not work in Node.js and vice versa because they use different APIs. See `@influxdata/influxdb-client` for a distribution that can be used in Node.js environments.\n+\n+For more information, see [influxdb-client-js](https://github.com/influxdata/influxdb-client-js).\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 | fix: clarify READMEs and example code comments
- expand comments and descriptions
- clarify differences among provided client distributions.
- explain client distribution used in browser example. |
305,167 | 16.08.2021 14:04:07 | 18,000 | e87075cfd149850ed131beafdb1b27a3f05b485d | fix: correct and clarify README
Fix previous changes based on discussion with | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -26,18 +26,18 @@ This section contains links to the client library documentation.\nInfluxDB 2.0 client consists of two main packages\n- @influxdata/influxdb-client\n- - Querying data using the Flux language\n- - Writing data\n- - batched in chunks on background\n- - automatic retries on write failures\n+ - Query data using the Flux language\n+ - Write data to InfluxDB\n+ - batch data as chunks in the background\n+ - retry automatically on failure\n- @influxdata/influxdb-client-apis\n- - provides all other InfluxDB 2.0 APIs for managing\n- - sources, buckets\n+ - Manage the following in InfluxDB:\n+ - sources\n+ - buckets\n- tasks\n- authorizations\n- health check\n- - ...\n- - built on top of @influxdata/influxdb-client\n+ - built on @influxdata/influxdb-client\n## Installation\n@@ -49,7 +49,11 @@ $ 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 also provides a bundled ESM distribution for browsers. If you target browsers or clients that don't support ESM, see [@influxdata/influxdb-client-browser](./packages/core-browser/README.md) for UMD distributions.\n+If you target Node.js, use [@influxdata/influxdb-client](./packages/core/README.md).\n+It provides main (CJS), module (ESM), and browser (UMD) exports.\n+\n+If you target browsers or [Deno](https://deno.land/), use [@influxdata/influxdb-client-browser](./packages/core-browser/README.md).\n+It provides main (UMD) and module (ESM) exports.\nTo use InfluxDB management APIs in your project, also add `@influxdata/influxdb-client-apis` as a dependency to your project.\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix: correct and clarify README
Fix previous changes based on discussion with @sranka. |
305,159 | 23.08.2021 14:25:12 | -7,200 | 32c573daf72ce6338c0363105c5210cbc715c771 | fix(examples): revert query.ts to 1.15 | [
{
"change_type": "MODIFY",
"old_path": "examples/query.ts",
"new_path": "examples/query.ts",
"diff": "#!./node_modules/.bin/ts-node\n-const {InfluxDB} = require('@influxdata/influxdb-client')\n+//////////////////////////////////////////\n+// Shows how to use InfluxDB query API. //\n+//////////////////////////////////////////\n-// You can generate a Token from the \"Tokens Tab\" in the UI\n-const token = 'my-token'\n-const org = 'my-org'\n+import {InfluxDB, FluxTableMetaData} from '@influxdata/influxdb-client'\n+import {url, token, org} from './env'\n-const client = new InfluxDB({url: 'http://localhost:8086', token: token})\n+const queryApi = new InfluxDB({url, token}).getQueryApi(org)\n+const fluxQuery =\n+ 'from(bucket:\"my-bucket\") |> range(start: -1d) |> filter(fn: (r) => r._measurement == \"temperature\")'\n-const queryApi = client.getQueryApi(org)\n-\n-const query = `option v = {timeRangeStart: -30d, timeRangeStop: now()}\n-\n-from(bucket: \"my-bucket\")\n- |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n- |> filter(fn: (r) =>\n- (r[\"_measurement\"] == \"m2m\"))\n- |> filter(fn: (r) =>\n- (r[\"_field\"] == \"field\"))`\n-queryApi.queryRows(query, {\n- next(row, tableMeta) {\n+console.log('*** QUERY ROWS ***')\n+// Execute query and receive table metadata and rows.\n+// https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/\n+queryApi.queryRows(fluxQuery, {\n+ next(row: string[], tableMeta: FluxTableMetaData) {\nconst o = tableMeta.toObject(row)\n- console.log(`${o._time} ${o._measurement}: ${o._field}=${o._value}`)\n+ // console.log(JSON.stringify(o, null, 2))\n+ console.log(\n+ `${o._time} ${o._measurement} in '${o.location}' (${o.example}): ${o._field}=${o._value}`\n+ )\n},\n- error(error) {\n+ error(error: Error) {\nconsole.error(error)\n- console.log('Finished ERROR')\n+ console.log('\\nFinished ERROR')\n},\ncomplete() {\n- console.log('Finished SUCCESS')\n+ console.log('\\nFinished SUCCESS')\n},\n})\n+\n+// // Execute query and return the whole result as a string.\n+// // Use with caution, it copies the whole stream of results into memory.\n+// queryApi\n+// .queryRaw(fluxQuery)\n+// .then(result => {\n+// console.log(result)\n+// console.log('\\nQueryRaw SUCCESS')\n+// })\n+// .catch(error => {\n+// console.error(error)\n+// console.log('\\nQueryRaw ERROR')\n+// })\n+\n+// // Execute query and collect result rows in a Promise.\n+// // Use with caution, it copies the whole stream of results into memory.\n+// queryApi\n+// .collectRows(fluxQuery /*, you can specify a row mapper as a second arg */)\n+// .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+// Execute query and receive result lines in annotated csv format\n+// queryApi.queryLines(\n+// fluxQuery,\n+// {\n+// error(error: Error) {\n+// console.error(error)\n+// console.log('\\nFinished ERROR')\n+// },\n+// next(line: string) {\n+// console.log(line)\n+// },\n+// complete() {\n+// console.log('\\nFinished SUCCESS')\n+// },\n+// }\n+// )\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(examples): revert query.ts to 1.15 |
305,159 | 23.08.2021 10:30:15 | -7,200 | cc86769f5dcaaf3e8a4508ca96f511dd691b7876 | chore(docs): document how to setup proxy | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -16,10 +16,10 @@ This repository contains the reference JavaScript client for InfluxDB 2.0. This\nThis section contains links to the client library documentation.\n-* [Product documentation](https://docs.influxdata.com/influxdb/v2.0/api-guide/client-libraries/nodejs/), [Getting Started](#usage)\n-* [Examples](examples#influxdb-client-examples)\n-* [API Reference](https://influxdata.github.io/influxdb-client-js/influxdb-client.html)\n-* [Changelog](CHANGELOG.md)\n+- [Product documentation](https://docs.influxdata.com/influxdb/v2.0/api-guide/client-libraries/nodejs/), [Getting Started](#usage)\n+- [Examples](examples#influxdb-client-examples)\n+- [API Reference](https://influxdata.github.io/influxdb-client-js/influxdb-client.html)\n+- [Changelog](CHANGELOG.md)\n## Features\n@@ -83,6 +83,7 @@ See [examples](./examples/README.md) for more advanced use case like the followi\n- Process InfluxDB query results with RX Observables.\n- Customize the writing of measurement points to InfluxDB.\n- Visualize query results in [Giraffe](https://github.com/influxdata/giraffe).\n+- [Setup HTTP/HTTPS proxy](https://github.com/influxdata/influxdb-client-js/issues/319#issuecomment-808154245) in communication with InfluxDB.\nJavaScript client API Reference Documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/options.ts",
"new_path": "packages/core/src/options.ts",
"diff": "@@ -14,7 +14,12 @@ export interface ConnectionOptions {\n* @defaultValue 10000\n*/\ntimeout?: number\n- /** extra options for the transport layer, they can setup a proxy agent or an abort signal in node.js transport that relies upon {@link https://nodejs.org/api/http.html#http_http_request_url_options_callback } */\n+ /**\n+ * TransportOptions supply extra options for the transport layer. It can contain an `agent` property to\n+ * {@link https://www.npmjs.com/package/proxy-http-agent | setup HTTP/HTTPS proxy }\n+ * in node.js, or a `signal` property that can stop ongoing requests using\n+ * {@link https://nodejs.org/api/http.html#http_http_request_url_options_callback }.\n+ */\ntransportOptions?: {[key: string]: any}\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(docs): document how to setup proxy |
305,159 | 24.08.2021 14:44:51 | -7,200 | a9cfe5e67b4c390a614acddcc088cec0f794c058 | feat(apis): repair ping endpoint address | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/generator/index.ts",
"new_path": "packages/apis/generator/index.ts",
"diff": "@@ -12,7 +12,11 @@ const operations: Array<Operation> = _operations\n// reduce operations to apis\nconst apis = operations.reduce(\n(acc: {[api: string]: Array<Operation>}, val: Operation) => {\n- if (val.path === '/ready' || val.path === '/health') {\n+ if (\n+ val.path === '/ready' ||\n+ val.path === '/health' ||\n+ val.path === '/ping'\n+ ) {\n// due to a bug in the swagger parser, we don't have correct server path's\nval.server = ''\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/PingAPI.ts",
"new_path": "packages/apis/src/generated/PingAPI.ts",
"diff": "@@ -27,6 +27,6 @@ export class PingAPI {\nrequest?: GetPingRequest,\nrequestOptions?: RequestOptions\n): Promise<void> {\n- return this.base.request('GET', `/api/v2/ping`, request, requestOptions)\n+ return this.base.request('GET', `/ping`, request, requestOptions)\n}\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(apis): repair ping endpoint address |
305,159 | 24.08.2021 14:56:09 | -7,200 | d824886d1c207ee79661052156ce721a48874b44 | chore(apis): repair API doc | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/BackupAPI.ts",
"new_path": "packages/apis/src/generated/BackupAPI.ts",
"diff": "@@ -25,7 +25,7 @@ export class BackupAPI {\nthis.base = new APIBase(influxDB)\n}\n/**\n- * Download snapshot of metadata stored in the server's embedded KV store. Should not be used in versions > 2.1.x, as it doesn't include metadata stored in embedded SQL.\n+ * Download snapshot of metadata stored in the server's embedded KV store. Should not be used in versions greater than 2.1.x, as it doesn't include metadata stored in embedded SQL.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetBackupKV }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): repair API doc |
305,159 | 24.08.2021 15:11:37 | -7,200 | e1ffae6aa02c7ff36f3bb405f5035aac9a9619a8 | feat(examples): replace health by ping example | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -36,7 +36,6 @@ InfluxDB 2.0 client consists of two main packages\n- buckets\n- tasks\n- authorizations\n- - health check\n- built on @influxdata/influxdb-client\n## Installation\n@@ -73,7 +72,6 @@ Use the following examples to get started with the JavaScript client for InfluxD\n- @influxdata/influxdb-client-apis\n- [setup / onboarding](./examples/onboarding.js)\n- [create bucket](./examples/createBucket.js)\n- - [health](./examples/health.js)\nSee [examples](./examples/README.md) for more advanced use case like the following:\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/README.md",
"new_path": "examples/README.md",
"diff": "@@ -14,8 +14,8 @@ This directory contains javascript and typescript examples for node.js, browser,\nQuery InfluxDB with [Flux](https://v2.docs.influxdata.com/v2.0/query-data/get-started/).\n- [queryWithParams.ts](./queryWithParams.ts)\nSupply parameters to a [Flux](https://v2.docs.influxdata.com/v2.0/query-data/get-started/) query.\n- - [health.js](./health.js)\n- Check health of InfluxDB server.\n+ - [ping.js](./ping.js)\n+ Check status of InfluxDB server.\n- [createBucket.js](./createBucket.js)\nCreates an example bucket.\n- [onboarding.js](./onboarding.js)\n"
},
{
"change_type": "DELETE",
"old_path": "examples/health.js",
"new_path": null,
"diff": "-#!/usr/bin/node\n-/*\n-This example shows how to use management/administration InfluxDB APIs.\n-All InfluxDB APIs are available through '@influxdata/influxdb-client-apis' package.\n-\n-See https://v2.docs.influxdata.com/v2.0/api/\n-*/\n-\n-const {InfluxDB} = require('@influxdata/influxdb-client')\n-const {HealthAPI} = require('@influxdata/influxdb-client-apis')\n-const {url, token} = require('./env')\n-const timeout = 10 * 1000 // timeout for health check\n-\n-console.log('*** HEALTH CHECK ***')\n-const influxDB = new InfluxDB({url, token, timeout})\n-const healthAPI = new HealthAPI(influxDB)\n-\n-healthAPI\n- .getHealth()\n- .then((result /* : HealthCheck */) => {\n- console.log(JSON.stringify(result, null, 2))\n- console.log('\\nHealth:', result.status === 'pass' ? 'OK' : 'NOT OK')\n- console.log('\\nFinished success')\n- })\n- .catch(error => {\n- console.error(error)\n- console.log('\\nFinished ERROR')\n- })\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "examples/ping.js",
"diff": "+#!/usr/bin/node\n+/*\n+This example shows how to check state InfluxDB instance.\n+InfluxDB OSS APIs are available through '@influxdata/influxdb-client-apis' package.\n+\n+See https://v2.docs.influxdata.com/v2.0/api/\n+*/\n+\n+const {InfluxDB} = require('@influxdata/influxdb-client')\n+// const {PingAPI} = require('@influxdata/influxdb-client-apis')\n+const {PingAPI} = require('../packages/apis')\n+const {url} = require('./env')\n+const timeout = 10 * 1000 // timeout for ping\n+\n+console.log('*** PING STATUS ***')\n+const influxDB = new InfluxDB({url, timeout})\n+const pingAPI = new PingAPI(influxDB)\n+\n+pingAPI\n+ .getPing()\n+ .then(() => {\n+ console.log('\\nPing SUCCESS')\n+ })\n+ .catch(error => {\n+ console.error(error)\n+ console.log('\\nFinished ERROR')\n+ })\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(examples): replace health by ping example |
305,159 | 24.08.2021 15:17:46 | -7,200 | bd65ee5d897b622ca2ca3bc65ad067b1bf27ecae | feat(examples/browser): offer ping in place of health | [
{
"change_type": "MODIFY",
"old_path": "examples/index.html",
"new_path": "examples/index.html",
"diff": "<script type=\"module\">\n// import latest release from npm repository\nimport {InfluxDB, Point} from 'https://unpkg.com/@influxdata/influxdb-client/dist/index.browser.mjs'\n- import {HealthAPI, SetupAPI} from 'https://unpkg.com/@influxdata/influxdb-client-apis/dist/index.browser.mjs'\n+ // import {PingAPI, SetupAPI} from 'https://unpkg.com/@influxdata/influxdb-client-apis/dist/index.browser.mjs'\n// or use the following imports to use local builds\n// import {InfluxDB, Point} from '../packages/core/dist/index.browser.mjs'\n- // import {HealthAPI, SetupAPI} from '../packages/apis/dist/index.browser.mjs'\n+ import {PingAPI, SetupAPI} from '../packages/apis/dist/index.browser.mjs'\n/**\n* Import the configuration from ./env_browser.js.\nlog('Onboarding FAILED',error)\n})\n}\n- function healthExample() {\n- log('\\n*** HEALTH ***')\n- const healthApi = new HealthAPI(influxDB)\n- healthApi\n- .getHealth()\n- .then((result) => {\n- log(JSON.stringify(result, null, 2))\n+ function pingExample() {\n+ log('\\n*** PING ***')\n+ const pingApi = new PingAPI(influxDB)\n+ pingApi\n+ .getPing()\n+ .then(() => {\n+ log('Ping SUCCESS')\n})\n.catch(error => {\n- log('Health FAILED', error)\n+ log('Ping FAILED', error)\n})\n}\ndocument.getElementById('onboardButton').addEventListener('click', () => {\nonboardingExample()\n})\n- document.getElementById('healthButton').addEventListener('click', () => {\n- healthExample()\n+ document.getElementById('pingButton').addEventListener('click', () => {\n+ pingExample()\n})\nconst visualizeInGiraffe = document.getElementById('visualizeInGiraffe')\nvisualizeInGiraffe.addEventListener('click', e => {\n<hr>\n<div>\n<button id=\"onboardButton\">InfluxDB Onboarding</button>\n- <button id=\"healthButton\">InfluxDB Health</button>\n+ <button id=\"pingButton\">InfluxDB Ping</button>\n</div>\n<hr>\n<div>\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(examples/browser): offer ping in place of health |
305,159 | 07.09.2021 09:08:54 | -7,200 | 7ba84ac9d29a3f4d66cb00cb8893aa711860526c | feat(core/node.js): allow to configure follow-redirects | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -78,9 +78,11 @@ export class NodeHttpTransport implements Transport {\n}\nif (url.protocol === 'http:') {\n- this.requestApi = http.request\n+ this.requestApi =\n+ this.defaultOptions['follow-redirects']?.http ?? http.request\n} else if (url.protocol === 'https:') {\n- this.requestApi = https.request\n+ this.requestApi =\n+ this.defaultOptions['follow-redirects']?.https ?? https.request\n} else {\nthrow new Error(\n`Unsupported protocol \"${url.protocol} in URL: \"${connectionOptions.url}\"`\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core/node.js): allow to configure follow-redirects |
305,159 | 07.09.2021 09:09:15 | -7,200 | 82d15edd750dc958c558eca4e4661d7483836a87 | chore(core/node.js): document follow-redirects option | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/options.ts",
"new_path": "packages/core/src/options.ts",
"diff": "@@ -19,6 +19,9 @@ export interface ConnectionOptions {\n* {@link https://www.npmjs.com/package/proxy-http-agent | setup HTTP/HTTPS proxy }\n* in node.js, or a `signal` property that can stop ongoing requests using\n* {@link https://nodejs.org/api/http.html#http_http_request_url_options_callback }.\n+ * {@link https://github.com/follow-redirects/follow-redirects | follow-redirects} property can be specified\n+ * in order to follow redirects in node.js. Redirects are followed OOTB in browser or deno,\n+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | redirect} property can customize it.\n*/\ntransportOptions?: {[key: string]: any}\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(core/node.js): document follow-redirects option |
305,159 | 07.09.2021 09:22:31 | -7,200 | 25ab61660adfa69a006977ef6036d2a4d1e506ee | chore(core): add follow-redirects to dev dependencies | [
{
"change_type": "MODIFY",
"old_path": "packages/core/package.json",
"new_path": "packages/core/package.json",
"diff": "\"eslint-config-prettier\": \"^6.7.0\",\n\"eslint-plugin-prettier\": \"^3.1.1\",\n\"eslint-plugin-tsdoc\": \"^0.2.6\",\n+ \"follow-redirects\": \"^1.14.3\",\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": "@@ -3162,6 +3162,11 @@ flush-write-stream@^1.0.0:\ninherits \"^2.0.3\"\nreadable-stream \"^2.3.6\"\n+follow-redirects@^1.14.3:\n+ version \"1.14.3\"\n+ resolved \"https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.3.tgz#6ada78118d8d24caee595595accdc0ac6abd022e\"\n+ integrity sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw==\n+\nfor-in@^1.0.2:\nversion \"1.0.2\"\nresolved \"https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80\"\n@@ -4773,7 +4778,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 | chore(core): add follow-redirects to dev dependencies |
305,159 | 07.09.2021 09:29:34 | -7,200 | 7e9e7973cfdf126c3634e60cbbd56b763098bf36 | feat(core/node.js): test follow-redirects for node.js | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -79,10 +79,10 @@ export class NodeHttpTransport implements Transport {\nif (url.protocol === 'http:') {\nthis.requestApi =\n- this.defaultOptions['follow-redirects']?.http ?? http.request\n+ this.defaultOptions['follow-redirects']?.http?.request ?? http.request\n} else if (url.protocol === 'https:') {\nthis.requestApi =\n- this.defaultOptions['follow-redirects']?.https ?? https.request\n+ this.defaultOptions['follow-redirects']?.https?.request ?? https.request\n} else {\nthrow new Error(\n`Unsupported protocol \"${url.protocol} in URL: \"${connectionOptions.url}\"`\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": "@@ -681,6 +681,46 @@ describe('NodeHttpTransport', () => {\n() => true // OK that it fails\n)\n})\n+ it(`does not follow redirects OOTB`, async () => {\n+ nock(transportOptions.url)\n+ .get('/test')\n+ .reply(301, '..', {\n+ location: '/redirected',\n+ })\n+ .persist()\n+ await new NodeHttpTransport({\n+ ...transportOptions,\n+ timeout: 10000,\n+ })\n+ .request('/test', '', {\n+ method: 'GET',\n+ headers: {'content-type': 'application/json'},\n+ })\n+ .then(\n+ () => expect.fail(`exception shall be thrown because of redirect`),\n+ () => true // OK that it fails\n+ )\n+ })\n+ it(`can be configured to follow redirects`, async () => {\n+ nock(transportOptions.url)\n+ .get('/test')\n+ .reply(301, '..', {\n+ location: '/redirected',\n+ })\n+ .get('/redirected')\n+ .reply(200, 'OK', {'content-type': 'text/plain'})\n+ .persist()\n+ const data = await new NodeHttpTransport({\n+ ...transportOptions,\n+ transportOptions: {\n+ 'follow-redirects': require('follow-redirects'),\n+ },\n+ timeout: 10000,\n+ }).request('/test', '', {\n+ method: 'GET',\n+ })\n+ expect(data).equals('OK')\n+ })\nit(`fails on communication error`, async () => {\nawait new NodeHttpTransport({\n...transportOptions,\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core/node.js): test follow-redirects for node.js |
305,159 | 07.09.2021 10:19:55 | -7,200 | eaf67c0a7caec27667e317abfa25031a1f28d600 | feat(examples): add follow-redirects.js example | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "examples/follow-redirects.js",
"diff": "+#!/usr/bin/env node\n+/////////////////////////////////////////////////////////////////////////\n+// Shows how to configure InfluxDB node.js client to follow redirects. //\n+/////////////////////////////////////////////////////////////////////////\n+\n+const {url: targetUrl, token, org} = require('./env')\n+// const {InfluxDB} = require('@influxdata/influxdb-client')\n+const {InfluxDB} = require('../packages/core')\n+\n+// start a simple HTTP server that always redirects to a configured InfluxDB\n+const http = require('http')\n+const server = http.createServer((req, res) => {\n+ const reqUrl = new URL(req.url, `http://${req.headers.host}`)\n+ console.info(`Redirecting ${req.method} ${reqUrl} to ${targetUrl + req.url}`)\n+ res.writeHead(307, {location: targetUrl + req.url})\n+ res.end()\n+})\n+server.listen(0, 'localhost', () => {\n+ const addressInfo = server.address()\n+ console.info('Redirection HTTP server started:', addressInfo)\n+\n+ const url = `http://localhost:${addressInfo.port}`\n+ console.info('Executing buckets() query against InfluxDB at', url)\n+ const queryApi = new InfluxDB({\n+ url,\n+ token,\n+ transportOptions: {\n+ // The following transport option is required in order to follow HTTP redirects in node.js.\n+ // Browsers and deno follow redirects OOTB.\n+ 'follow-redirects': require('follow-redirects'),\n+ },\n+ }).getQueryApi(org)\n+ queryApi\n+ .collectRows('buckets()')\n+ .then(data => {\n+ console.info('Available buckets:')\n+ data.forEach(x => console.info('', x.name))\n+ console.log('\\nQuery SUCCESS')\n+ })\n+ .catch(error => {\n+ console.error(error)\n+ console.log('\\nQuery ERROR')\n+ })\n+ .finally(() => {\n+ server.close()\n+ })\n+})\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/package.json",
"new_path": "examples/package.json",
"diff": "\"@types/express-http-proxy\": \"^1.5.12\",\n\"express\": \"^4.17.1\",\n\"express-http-proxy\": \"^1.6.0\",\n+ \"follow-redirects\": \"^1.14.3\",\n\"open\": \"^7.0.0\",\n\"response-time\": \"^2.3.2\",\n\"rxjs\": \"^6.5.5\",\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(examples): add follow-redirects.js example |
305,159 | 07.09.2021 10:22:28 | -7,200 | d5af086473c92aee741197ba7a839f54978d21be | chore(examples): document follow-redirects.js example | [
{
"change_type": "MODIFY",
"old_path": "examples/README.md",
"new_path": "examples/README.md",
"diff": "@@ -26,6 +26,8 @@ This directory contains javascript and typescript examples for node.js, browser,\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)\nShows how to control the way of how data points are written to InfluxDB.\n+ - [follow-redirects.js](./follow-redirects.js)\n+ Shows how to configure the client to follow HTTP redirects.\n- Browser examples\n- Change `token, org, bucket, username, password` variables in [./env_browser.js](env_browser.js) to match your InfluxDB instance\n- Run `npm run browser`\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(examples): document follow-redirects.js example |
305,159 | 07.09.2021 13:43:17 | -7,200 | 91ef850faa3514b982867143a403959557da7bbe | chore: test assignment of custom https request function | [
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/Influxdb.test.ts",
"new_path": "packages/core/test/unit/Influxdb.test.ts",
"diff": "@@ -84,6 +84,23 @@ describe('InfluxDB', () => {\n} as any) as ClientOptions)\n).has.property('transport')\n})\n+ it('creates instance with follow-redirects', () => {\n+ const request = (): void => {}\n+ const followRedirects = {\n+ https: {request},\n+ }\n+ expect(\n+ new InfluxDB({\n+ url: 'https://localhost:8086',\n+ transportOptions: {\n+ 'follow-redirects': followRedirects,\n+ },\n+ })\n+ )\n+ .has.property('transport')\n+ .has.property('requestApi')\n+ .is.equal(request)\n+ })\n})\ndescribe('apis', () => {\nconst influxDb = new InfluxDB('http://localhost:8086?token=a')\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore: test assignment of custom https request function |
305,160 | 13.09.2021 08:23:32 | -7,200 | f2471493d00cfd121d0bab3e510de19e9b4885d0 | chore(ci): switch to next-gen CircleCI's convenience images | [
{
"change_type": "MODIFY",
"old_path": ".circleci/config.yml",
"new_path": ".circleci/config.yml",
"diff": "@@ -6,23 +6,24 @@ commands:\n- restore_cache:\nname: Restore Yarn Package Cache\nkeys:\n- - yarn-packages-{{ checksum \"yarn.lock\" }}\n+ - yarn-packages-v2-{{ checksum \"yarn.lock\" }}\n- run:\nname: Install Dependencies\ncommand: yarn install --frozen-lockfile\n- save_cache:\nname: Save Yarn Package Cache\n- key: yarn-packages-{{ checksum \"yarn.lock\" }}\n+ key: yarn-packages-v2-{{ checksum \"yarn.lock\" }}\npaths:\n- ~/.cache/yarn\njobs:\ntests:\nparameters:\n- version:\n+ image:\ntype: string\n+ default: &default-image \"cimg/node:14.17.6\"\ndocker:\n- - image: circleci/node:<< parameters.version >>\n+ - image: << parameters.image >>\nsteps:\n- checkout\n- init-dependencies\n@@ -38,7 +39,7 @@ jobs:\ncoverage:\nparameters:\ndocker:\n- - image: circleci/node:14\n+ - image: *default-image\nsteps:\n- checkout\n- init-dependencies\n@@ -57,7 +58,7 @@ jobs:\ndeploy-preview:\nparameters:\ndocker:\n- - image: circleci/node:14\n+ - image: *default-image\nsteps:\n- run:\nname: Early return if this build is from a forked repository\n@@ -79,7 +80,6 @@ workflows:\nbuild:\njobs:\n- tests:\n- version: '14'\nfilters:\nbranches:\nignore: gh-pages\n"
},
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "1. [#365](https://github.com/influxdata/influxdb-client-js/pull/365): Allow following HTTP redirects in node.js.\n+### CI\n+1. [#366](https://github.com/influxdata/influxdb-client-js/pull/366): Switch to next-gen CircleCI's convenience images\n+\n## 1.17.0 [2021-08-25]\n### Features\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(ci): switch to next-gen CircleCI's convenience images (#366) |
305,159 | 14.09.2021 07:21:12 | -7,200 | aee5b704cb53d06746498d2f8fe56d272591f948 | chore(core): improve documentation of transport options | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/options.ts",
"new_path": "packages/core/src/options.ts",
"diff": "@@ -15,13 +15,16 @@ export interface ConnectionOptions {\n*/\ntimeout?: number\n/**\n- * TransportOptions supply extra options for the transport layer. It can contain an `agent` property to\n- * {@link https://www.npmjs.com/package/proxy-http-agent | setup HTTP/HTTPS proxy }\n- * in node.js, or a `signal` property that can stop ongoing requests using\n- * {@link https://nodejs.org/api/http.html#http_http_request_url_options_callback }.\n- * {@link https://github.com/follow-redirects/follow-redirects | follow-redirects} property can be specified\n- * in order to follow redirects in node.js. Redirects are followed OOTB in browser or deno,\n- * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | redirect} property can customize it.\n+ * TransportOptions supply extra options for the transport layer, they differ between node.js and browser/deno.\n+ * Node.js transport accepts options specified in {@link https://nodejs.org/api/http.html#http_http_request_options_callback | http.request } or\n+ * {@link https://nodejs.org/api/https.html#https_https_request_options_callback | https.request }. For example, an `agent` property can be set to\n+ * {@link https://www.npmjs.com/package/proxy-http-agent | setup HTTP/HTTPS proxy }, {@link https://nodejs.org/api/tls.html#tls_tls_connect_options_callback | rejectUnauthorized }\n+ * property can disable TLS server certificate verification. Additionally,\n+ * {@link https://github.com/follow-redirects/follow-redirects | follow-redirects } property can be also specified\n+ * in order to follow redirects in node.js.\n+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | fetch } is used under the hood in browser/deno.\n+ * For example,\n+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | redirect } property can be set to 'error' to abort request if a redirect occurs.\n*/\ntransportOptions?: {[key: string]: any}\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(core): improve documentation of transport options |
305,159 | 02.10.2021 06:47:54 | -7,200 | 4d9ec1c49715426cc9ac2d4f01a220dd2cc100db | fix(core): require finite Point.intField | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/Point.ts",
"new_path": "packages/core/src/Point.ts",
"diff": "@@ -77,16 +77,18 @@ export class Point {\n* @returns this\n*/\npublic intField(name: string, value: number | any): Point {\n- if (typeof value !== 'number') {\nlet val: number\n- if (isNaN((val = parseInt(String(value))))) {\n+ if (typeof value === 'number') {\n+ val = value\n+ } else {\n+ val = parseInt(String(value))\n+ }\n+ if (isNaN(val) || val <= -9223372036854776e3 || val >= 9223372036854776e3) {\nthrow new Error(\n- `Expected integer value for field ${name}, but got '${value}'!`\n+ `expected integer value for field ${name}, but got '${value}'!`\n)\n}\n- value = val\n- }\n- this.fields[name] = `${Math.floor(value as number)}i`\n+ this.fields[name] = `${Math.floor(val)}i`\nreturn this\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/fixture/pointTables.json",
"new_path": "packages/core/test/fixture/pointTables.json",
"diff": "{\n\"name\": \"m6\",\n\"fields\": [[\"a\", \"i\"]],\n- \"throws\": \"Expected integer\"\n+ \"throws\": \"expected integer\"\n},\n{\n\"name\": \"m7\",\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/Point.test.ts",
"new_path": "packages/core/test/unit/Point.test.ts",
"diff": "@@ -147,4 +147,11 @@ describe('Point', () => {\nexpect(point.toLineProtocol()).equals('tst a=1 any')\n})\n})\n+ it('throws when invalid intField is supplied', () => {\n+ expect(() => new Point().intField('a', NaN)).throws()\n+ expect(() => new Point().intField('a', Infinity)).throws()\n+ expect(() => new Point().intField('a', -Infinity)).throws()\n+ expect(() => new Point().intField('a', -9223372036854776e3)).throws()\n+ expect(() => new Point().intField('a', 9223372036854776e3)).throws()\n+ })\n})\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -4778,7 +4778,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 | fix(core): require finite Point.intField |
305,159 | 02.10.2021 06:54:16 | -7,200 | c0b4b6857dd94eda389a8979d9cd48af18f1d206 | fix(core): normalize Point error messages | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/Point.ts",
"new_path": "packages/core/src/Point.ts",
"diff": "@@ -85,7 +85,7 @@ export class Point {\n}\nif (isNaN(val) || val <= -9223372036854776e3 || val >= 9223372036854776e3) {\nthrow new Error(\n- `expected integer value for field ${name}, but got '${value}'!`\n+ `integer value for field '${name}' out of range: '${value}'!`\n)\n}\nthis.fields[name] = `${Math.floor(val)}i`\n@@ -102,7 +102,7 @@ export class Point {\npublic uintField(name: string, value: number | any): Point {\nif (typeof value === 'number') {\nif (value < 0 || value > Number.MAX_SAFE_INTEGER) {\n- throw new Error(`uint value out of js unsigned integer range: ${value}`)\n+ throw new Error(`uint value for field '${name}' out of range: ${value}`)\n}\nthis.fields[name] = `${Math.floor(value as number)}u`\n} else {\n@@ -120,7 +120,9 @@ export class Point {\n(strVal.length === 20 &&\nstrVal.localeCompare('18446744073709551615') > 0)\n) {\n- throw new Error(`uint value out of range: ${strVal}`)\n+ throw new Error(\n+ `uint value for field '${name}' out of range: ${strVal}`\n+ )\n}\nthis.fields[name] = `${strVal}u`\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/fixture/pointTables.json",
"new_path": "packages/core/test/fixture/pointTables.json",
"diff": "{\n\"name\": \"m6\",\n\"fields\": [[\"a\", \"i\"]],\n- \"throws\": \"expected integer\"\n+ \"throws\": \"out of range\"\n},\n{\n\"name\": \"m7\",\n{\n\"name\": \"uintNegativeNumber\",\n\"fields\": [[\"f\", \"u\", -1]],\n- \"throws\": \"uint value out of js unsigned integer range: -1\"\n+ \"throws\": \"uint value for field 'f' out of range: -1\"\n},\n{\n\"name\": \"uintTooLargeNumber\",\n\"fields\": [[\"f\", \"u\", 9007199254740992]],\n- \"throws\": \"uint value out of js unsigned integer range: 9007199254740992\"\n+ \"throws\": \"uint value for field 'f' out of range: 9007199254740992\"\n},\n{\n\"name\": \"uintNegativeString\",\n{\n\"name\": \"uintTooLargeString\",\n\"fields\": [[\"f\", \"u\", \"18446744073709551616\"]],\n- \"throws\": \"uint value out of range: 18446744073709551616\"\n+ \"throws\": \"uint value for field 'f' out of range: 18446744073709551616\"\n}\n]\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(core): normalize Point error messages |
305,159 | 02.10.2021 06:56:53 | -7,200 | 52704ef94e61246c9acbe8fe9d1b7059522ec3d6 | fix(core): require finite Point.uintField | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/Point.ts",
"new_path": "packages/core/src/Point.ts",
"diff": "@@ -101,7 +101,7 @@ export class Point {\n*/\npublic uintField(name: string, value: number | any): Point {\nif (typeof value === 'number') {\n- if (value < 0 || value > Number.MAX_SAFE_INTEGER) {\n+ if (isNaN(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) {\nthrow new Error(`uint value for field '${name}' out of range: ${value}`)\n}\nthis.fields[name] = `${Math.floor(value as number)}u`\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/Point.test.ts",
"new_path": "packages/core/test/unit/Point.test.ts",
"diff": "@@ -154,4 +154,11 @@ describe('Point', () => {\nexpect(() => new Point().intField('a', -9223372036854776e3)).throws()\nexpect(() => new Point().intField('a', 9223372036854776e3)).throws()\n})\n+ it('throws when invalid uintField is supplied', () => {\n+ expect(() => new Point().uintField('a', NaN)).throws()\n+ expect(() => new Point().uintField('a', Infinity)).throws()\n+ expect(() => new Point().uintField('a', -Infinity)).throws()\n+ expect(() => new Point().uintField('a', Number.MAX_VALUE)).throws()\n+ expect(() => new Point().uintField('a', -1)).throws()\n+ })\n})\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(core): require finite Point.uintField |
305,159 | 02.10.2021 07:05:34 | -7,200 | 356adf338a270472ab6006519b611d89d9ae6945 | fix(core): require finite Point.floatField | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/Point.ts",
"new_path": "packages/core/src/Point.ts",
"diff": "@@ -84,9 +84,7 @@ export class Point {\nval = parseInt(String(value))\n}\nif (isNaN(val) || val <= -9223372036854776e3 || val >= 9223372036854776e3) {\n- throw new Error(\n- `integer value for field '${name}' out of range: '${value}'!`\n- )\n+ throw new Error(`invalid integer value for field '${name}': '${value}'!`)\n}\nthis.fields[name] = `${Math.floor(val)}i`\nreturn this\n@@ -137,16 +135,17 @@ export class Point {\n* @returns this\n*/\npublic floatField(name: string, value: number | any): Point {\n- if (typeof value !== 'number') {\nlet val: number\n- if (isNaN((val = parseFloat(value)))) {\n- throw new Error(\n- `Expected float value for field ${name}, but got '${value}'!`\n- )\n+ if (typeof value === 'number') {\n+ val = value\n+ } else {\n+ val = parseFloat(value)\n}\n- value = val\n+ if (!isFinite(val)) {\n+ throw new Error(`invalid float value for field '${name}': ${value}`)\n}\n- this.fields[name] = String(value)\n+\n+ this.fields[name] = String(val)\nreturn this\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/fixture/pointTables.json",
"new_path": "packages/core/test/fixture/pointTables.json",
"diff": "{\n\"name\": \"m6\",\n\"fields\": [[\"a\", \"i\"]],\n- \"throws\": \"out of range\"\n+ \"throws\": \"invalid integer\"\n},\n{\n\"name\": \"m7\",\n\"fields\": [[\"a\", \"n\"]],\n- \"throws\": \"Expected float\"\n+ \"throws\": \"invalid float\"\n},\n{\n\"name\": \"m8\",\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/Point.test.ts",
"new_path": "packages/core/test/unit/Point.test.ts",
"diff": "@@ -161,4 +161,9 @@ describe('Point', () => {\nexpect(() => new Point().uintField('a', Number.MAX_VALUE)).throws()\nexpect(() => new Point().uintField('a', -1)).throws()\n})\n+ it('throws when invalid float is supplied', () => {\n+ expect(() => new Point().floatField('a', NaN)).throws()\n+ expect(() => new Point().floatField('a', Infinity)).throws()\n+ expect(() => new Point().floatField('a', -Infinity)).throws()\n+ })\n})\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(core): require finite Point.floatField |
305,159 | 02.10.2021 07:14:23 | -7,200 | 5b65e8c49df10b64c9ee4e18ce251858526f84e4 | chore: document thrown error | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/Point.ts",
"new_path": "packages/core/src/Point.ts",
"diff": "@@ -75,6 +75,7 @@ export class Point {\n* @param name - field name\n* @param value - field value\n* @returns this\n+ * @throws NaN or out of int64 range value is supplied\n*/\npublic intField(name: string, value: number | any): Point {\nlet val: number\n@@ -96,6 +97,7 @@ export class Point {\n* @param name - field name\n* @param value - field value\n* @returns this\n+ * @throws NaN out of range value is supplied\n*/\npublic uintField(name: string, value: number | any): Point {\nif (typeof value === 'number') {\n@@ -133,6 +135,7 @@ export class Point {\n* @param name - field name\n* @param value - field value\n* @returns this\n+ * @throws NaN/Infinity/-Infinity is supplied\n*/\npublic floatField(name: string, value: number | any): Point {\nlet val: number\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore: document thrown error |
305,159 | 18.10.2021 08:00:42 | -7,200 | d4440b2bdcfb66a5f631f53d52ac182273e68737 | chore(apis): regenerate oss apis | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/DashboardsAPI.ts",
"new_path": "packages/apis/src/generated/DashboardsAPI.ts",
"diff": "@@ -21,25 +21,6 @@ import {\nView,\n} from './types'\n-export interface GetDashboardsRequest {\n- offset?: number\n- limit?: number\n- descending?: any\n- /** A user identifier. Returns only dashboards where this user has the `owner` role. */\n- owner?: string\n- /** The column to sort by. */\n- sortBy?: string\n- /** A list of dashboard identifiers. Returns only the listed dashboards. If both `id` and `owner` are specified, only `id` is used. */\n- id?: any\n- /** The identifier of the organization. */\n- orgID?: string\n- /** The name of the organization. */\n- org?: string\n-}\n-export interface PostDashboardsRequest {\n- /** Dashboard to create */\n- body: CreateDashboardRequest\n-}\nexport interface GetDashboardsIDRequest {\n/** The ID of the dashboard to update. */\ndashboardID: string\n@@ -151,6 +132,25 @@ export interface DeleteDashboardsIDOwnersIDRequest {\n/** The dashboard ID. */\ndashboardID: string\n}\n+export interface GetDashboardsRequest {\n+ offset?: number\n+ limit?: number\n+ descending?: any\n+ /** A user identifier. Returns only dashboards where this user has the `owner` role. */\n+ owner?: string\n+ /** The column to sort by. */\n+ sortBy?: string\n+ /** A list of dashboard identifiers. Returns only the listed dashboards. If both `id` and `owner` are specified, only `id` is used. */\n+ id?: any\n+ /** The identifier of the organization. */\n+ orgID?: string\n+ /** The name of the organization. */\n+ org?: string\n+}\n+export interface PostDashboardsRequest {\n+ /** Dashboard to create */\n+ body: CreateDashboardRequest\n+}\n/**\n* Dashboards API\n*/\n@@ -165,52 +165,6 @@ export class DashboardsAPI {\nconstructor(influxDB: InfluxDB) {\nthis.base = new APIBase(influxDB)\n}\n- /**\n- * List all dashboards.\n- * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetDashboards }\n- * @param request - request parameters and body (if supported)\n- * @param requestOptions - optional transport options\n- * @returns promise of response\n- */\n- getDashboards(\n- request?: GetDashboardsRequest,\n- requestOptions?: RequestOptions\n- ): Promise<Dashboards> {\n- return 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- 'orgID',\n- 'org',\n- ])}`,\n- request,\n- requestOptions\n- )\n- }\n- /**\n- * Create a dashboard.\n- * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostDashboards }\n- * @param request - request parameters and body (if supported)\n- * @param requestOptions - optional transport options\n- * @returns promise of response\n- */\n- postDashboards(\n- request: PostDashboardsRequest,\n- requestOptions?: RequestOptions\n- ): Promise<Dashboard | DashboardWithViewProperties> {\n- return this.base.request(\n- 'POST',\n- `/api/v2/dashboards`,\n- request,\n- requestOptions,\n- 'application/json'\n- )\n- }\n/**\n* Retrieve a Dashboard.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetDashboardsID }\n@@ -546,4 +500,50 @@ export class DashboardsAPI {\nrequestOptions\n)\n}\n+ /**\n+ * List all dashboards.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetDashboards }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ getDashboards(\n+ request?: GetDashboardsRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<Dashboards> {\n+ return 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+ 'orgID',\n+ 'org',\n+ ])}`,\n+ request,\n+ requestOptions\n+ )\n+ }\n+ /**\n+ * Create a dashboard.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostDashboards }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ postDashboards(\n+ request: PostDashboardsRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<Dashboard | DashboardWithViewProperties> {\n+ return this.base.request(\n+ 'POST',\n+ `/api/v2/dashboards`,\n+ request,\n+ requestOptions,\n+ 'application/json'\n+ )\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/DbrpsAPI.ts",
"new_path": "packages/apis/src/generated/DbrpsAPI.ts",
"diff": "@@ -19,7 +19,7 @@ export interface GetDBRPsRequest {\nrp?: string\n}\nexport interface PostDBRPRequest {\n- /** The Database Retention Policy Mapping to add */\n+ /** The database retention policy mapping to add */\nbody: DBRPCreate\n}\nexport interface GetDBRPsIDRequest {\n@@ -63,7 +63,7 @@ export class DbrpsAPI {\nthis.base = new APIBase(influxDB)\n}\n/**\n- * List all database retention policy mappings.\n+ * List database retention policy mappings.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetDBRPs }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/DeleteAPI.ts",
"new_path": "packages/apis/src/generated/DeleteAPI.ts",
"diff": "@@ -3,7 +3,7 @@ import {APIBase, RequestOptions} from '../APIBase'\nimport {DeletePredicateRequest} from './types'\nexport interface PostDeleteRequest {\n- /** Predicate delete request */\n+ /** Deletes data from an InfluxDB bucket. */\nbody: DeletePredicateRequest\n/** Specifies the organization to delete data from. */\norg?: string\n@@ -29,7 +29,7 @@ export class DeleteAPI {\nthis.base = new APIBase(influxDB)\n}\n/**\n- * Delete time series data from InfluxDB.\n+ * Delete data.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostDelete }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/QueryAPI.ts",
"new_path": "packages/apis/src/generated/QueryAPI.ts",
"diff": "@@ -26,7 +26,7 @@ export interface PostQueryAnalyzeRequest {\nexport interface PostQueryRequest {\n/** Flux query or specification to execute */\nbody: Query | InfluxQLQuery\n- /** Specifies the name of the organization executing the query. Takes either the ID or Name interchangeably. If both `orgID` and `org` are specified, `org` takes precedence. */\n+ /** Specifies the name of the organization executing the query. Takes either the ID or Name. If both `orgID` and `org` are specified, `org` takes precedence. */\norg?: string\n/** Specifies the ID of the organization executing the query. If both `orgID` and `org` are specified, `org` takes precedence. */\norgID?: string\n@@ -120,7 +120,7 @@ export class QueryAPI {\n)\n}\n/**\n- * Query InfluxDB.\n+ * Query data.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostQuery }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/RestoreAPI.ts",
"new_path": "packages/apis/src/generated/RestoreAPI.ts",
"diff": "@@ -50,7 +50,10 @@ export class RestoreAPI {\npostRestoreKV(\nrequest: PostRestoreKVRequest,\nrequestOptions?: RequestOptions\n- ): Promise<void> {\n+ ): Promise<{\n+ /** token is the root token for the instance after restore (this is overwritten during the restore) */\n+ token?: string\n+ }> {\nreturn this.base.request(\n'POST',\n`/api/v2/restore/kv`,\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/SigninAPI.ts",
"new_path": "packages/apis/src/generated/SigninAPI.ts",
"diff": "@@ -19,7 +19,7 @@ export class SigninAPI {\nthis.base = new APIBase(influxDB)\n}\n/**\n- * Exchange basic auth credentials for session.\n+ * Create a user session.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostSignin }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/SignoutAPI.ts",
"new_path": "packages/apis/src/generated/SignoutAPI.ts",
"diff": "@@ -17,7 +17,7 @@ export class SignoutAPI {\nthis.base = new APIBase(influxDB)\n}\n/**\n- * Expire the current session.\n+ * Expire the current UI session.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostSignout }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/StacksAPI.ts",
"new_path": "packages/apis/src/generated/StacksAPI.ts",
"diff": "@@ -3,7 +3,7 @@ import {APIBase, RequestOptions} from '../APIBase'\nimport {Stack} from './types'\nexport interface ListStacksRequest {\n- /** The organization id of the stacks */\n+ /** The organization ID of the stacks */\norgID: string\n/** A collection of names to filter the list by. */\nname?: string\n@@ -11,7 +11,7 @@ export interface ListStacksRequest {\nstackID?: string\n}\nexport interface CreateStackRequest {\n- /** Stack to create. */\n+ /** The stack to create. */\nbody: {\norgID?: string\nname?: string\n@@ -26,7 +26,7 @@ export interface ReadStackRequest {\nexport interface UpdateStackRequest {\n/** The identifier of the stack. */\nstack_id: string\n- /** Influx stack to update. */\n+ /** The stack to update. */\nbody: {\nname?: string\ndescription?: string\n@@ -45,7 +45,7 @@ export interface DeleteStackRequest {\norgID: string\n}\nexport interface UninstallStackRequest {\n- /** The stack id */\n+ /** The identifier of the stack. */\nstack_id: string\n}\n/**\n@@ -63,7 +63,7 @@ export class StacksAPI {\nthis.base = new APIBase(influxDB)\n}\n/**\n- * List all installed InfluxDB templates.\n+ * List installed templates.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/ListStacks }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n@@ -124,7 +124,7 @@ export class StacksAPI {\n)\n}\n/**\n- * Update an InfluxDB Stack.\n+ * Update a stack.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/UpdateStack }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n@@ -163,7 +163,7 @@ export class StacksAPI {\n)\n}\n/**\n- * Uninstall an InfluxDB Stack.\n+ * Uninstall a stack.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/UninstallStack }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/TasksAPI.ts",
"new_path": "packages/apis/src/generated/TasksAPI.ts",
"diff": "@@ -19,26 +19,6 @@ import {\nTasks,\n} from './types'\n-export interface GetTasksRequest {\n- /** Returns task with a specific name. */\n- name?: string\n- /** Return tasks after a specified ID. */\n- after?: string\n- /** Filter tasks to a specific user ID. */\n- user?: string\n- /** Filter tasks to a specific organization name. */\n- org?: string\n- /** Filter tasks to a specific organization ID. */\n- orgID?: string\n- /** Filter tasks by a status--\"inactive\" or \"active\". */\n- status?: string\n- /** The number of tasks to return */\n- limit?: number\n-}\n-export interface PostTasksRequest {\n- /** Task to create */\n- body: TaskCreateRequest\n-}\nexport interface GetTasksIDRequest {\n/** The task ID. */\ntaskID: string\n@@ -148,6 +128,26 @@ export interface DeleteTasksIDOwnersIDRequest {\n/** The task ID. */\ntaskID: string\n}\n+export interface GetTasksRequest {\n+ /** Returns task with a specific name. */\n+ name?: string\n+ /** Return tasks after a specified ID. */\n+ after?: string\n+ /** Filter tasks to a specific user ID. */\n+ user?: string\n+ /** Filter tasks to a specific organization name. */\n+ org?: string\n+ /** Filter tasks to a specific organization ID. */\n+ orgID?: string\n+ /** Filter tasks by a status--\"inactive\" or \"active\". */\n+ status?: string\n+ /** The number of tasks to return */\n+ limit?: number\n+}\n+export interface PostTasksRequest {\n+ /** Task to create */\n+ body: TaskCreateRequest\n+}\n/**\n* Tasks API\n*/\n@@ -162,51 +162,6 @@ export class TasksAPI {\nconstructor(influxDB: InfluxDB) {\nthis.base = new APIBase(influxDB)\n}\n- /**\n- * List all tasks.\n- * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetTasks }\n- * @param request - request parameters and body (if supported)\n- * @param requestOptions - optional transport options\n- * @returns promise of response\n- */\n- getTasks(\n- request?: GetTasksRequest,\n- requestOptions?: RequestOptions\n- ): Promise<Tasks> {\n- return this.base.request(\n- 'GET',\n- `/api/v2/tasks${this.base.queryString(request, [\n- 'name',\n- 'after',\n- 'user',\n- 'org',\n- 'orgID',\n- 'status',\n- 'limit',\n- ])}`,\n- request,\n- requestOptions\n- )\n- }\n- /**\n- * Create a new task.\n- * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostTasks }\n- * @param request - request parameters and body (if supported)\n- * @param requestOptions - optional transport options\n- * @returns promise of response\n- */\n- postTasks(\n- request: PostTasksRequest,\n- requestOptions?: RequestOptions\n- ): Promise<Task> {\n- return this.base.request(\n- 'POST',\n- `/api/v2/tasks`,\n- request,\n- requestOptions,\n- 'application/json'\n- )\n- }\n/**\n* Retrieve a task.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetTasksID }\n@@ -560,4 +515,49 @@ export class TasksAPI {\nrequestOptions\n)\n}\n+ /**\n+ * List all tasks.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetTasks }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ getTasks(\n+ request?: GetTasksRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<Tasks> {\n+ return this.base.request(\n+ 'GET',\n+ `/api/v2/tasks${this.base.queryString(request, [\n+ 'name',\n+ 'after',\n+ 'user',\n+ 'org',\n+ 'orgID',\n+ 'status',\n+ 'limit',\n+ ])}`,\n+ request,\n+ requestOptions\n+ )\n+ }\n+ /**\n+ * Create a new task.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostTasks }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ postTasks(\n+ request: PostTasksRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<Task> {\n+ return this.base.request(\n+ 'POST',\n+ `/api/v2/tasks`,\n+ request,\n+ requestOptions,\n+ 'application/json'\n+ )\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/TemplatesAPI.ts",
"new_path": "packages/apis/src/generated/TemplatesAPI.ts",
"diff": "@@ -31,7 +31,7 @@ export class TemplatesAPI {\nthis.base = new APIBase(influxDB)\n}\n/**\n- * Apply or dry-run an InfluxDB Template.\n+ * Apply or dry-run a template.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/ApplyTemplate }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n@@ -50,7 +50,7 @@ export class TemplatesAPI {\n)\n}\n/**\n- * Export a new Influx Template.\n+ * Export a new template.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/ExportTemplate }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/WriteAPI.ts",
"new_path": "packages/apis/src/generated/WriteAPI.ts",
"diff": "@@ -2,11 +2,11 @@ import {InfluxDB} from '@influxdata/influxdb-client'\nimport {APIBase, RequestOptions} from '../APIBase'\nexport interface PostWriteRequest {\n- /** Line protocol body */\n+ /** Data in line protocol format. */\nbody: string\n- /** Specifies the destination organization for writes. Takes either the ID or Name interchangeably. If both `orgID` and `org` are specified, `org` takes precedence. */\n+ /** The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both `orgID` and `org` parameters, `org` takes precedence. */\norg: string\n- /** Specifies the ID of the destination organization for writes. If both `orgID` and `org` are specified, `org` takes precedence. */\n+ /** The parameter value specifies the ID of the destination organization for writes. If both `orgID` and `org` are specified, `org` takes precedence. */\norgID?: string\n/** The destination bucket for writes. */\nbucket: string\n@@ -28,7 +28,7 @@ export class WriteAPI {\nthis.base = new APIBase(influxDB)\n}\n/**\n- * Write time series data into InfluxDB.\n+ * Write data.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostWrite }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/types.ts",
"new_path": "packages/apis/src/generated/types.ts",
"diff": "@@ -265,34 +265,6 @@ export type ResourceOwner = UserResponse & {\nrole?: 'owner'\n}\n-export interface LineProtocolError {\n- /** Code is the machine-readable error code. */\n- readonly code:\n- | 'internal error'\n- | 'not found'\n- | 'conflict'\n- | 'invalid'\n- | 'empty value'\n- | 'unavailable'\n- /** Message is a human-readable message. */\n- readonly message: string\n- /** Op describes the logical code operation during error. Useful for debugging. */\n- readonly op: string\n- /** Err is a stack of errors that occurred during processing of the request. Useful for debugging. */\n- readonly err: string\n- /** First line within sent body containing malformed data */\n- readonly line?: number\n-}\n-\n-export interface LineProtocolLengthError {\n- /** Code is the machine-readable error code. */\n- readonly code: 'invalid'\n- /** Message is a human-readable message. */\n- readonly message: string\n- /** Max length in bytes for a body of line-protocol. */\n- readonly maxLength: number\n-}\n-\n/**\n* The delete predicate request.\n*/\n@@ -318,11 +290,6 @@ export interface LabelUpdate {\nproperties?: any\n}\n-export interface Dashboards {\n- links?: Links\n- dashboards?: Dashboard[]\n-}\n-\nexport type Dashboard = CreateDashboardRequest & {\nlinks?: {\nself?: Link\n@@ -398,6 +365,7 @@ export type ViewProperties =\n| HistogramViewProperties\n| GaugeViewProperties\n| TableViewProperties\n+ | SimpleTableViewProperties\n| MarkdownViewProperties\n| CheckViewProperties\n| ScatterViewProperties\n@@ -666,6 +634,16 @@ export interface RenamableField {\nvisible?: boolean\n}\n+export interface SimpleTableViewProperties {\n+ type: 'simple-table'\n+ showAll: boolean\n+ queries: DashboardQuery[]\n+ shape: 'chronograf-v2'\n+ note: string\n+ /** If true, will display note when empty */\n+ showNoteWhenEmpty: boolean\n+}\n+\nexport interface MarkdownViewProperties {\ntype: 'markdown'\nshape: 'chronograf-v2'\n@@ -2215,11 +2193,6 @@ export interface TemplateExportByName {\n}>\n}\n-export interface Tasks {\n- readonly links?: Links\n- tasks?: Task[]\n-}\n-\nexport interface Task {\nreadonly id: string\n/** The type of task, this can be used for filtering tasks on list actions. */\n@@ -2262,18 +2235,6 @@ export interface Task {\n}\n}\n-export interface TaskCreateRequest {\n- /** The ID of the organization that owns this Task. */\n- orgID?: string\n- /** The name of the organization that owns this Task. */\n- org?: string\n- status?: TaskStatusType\n- /** The Flux script to run for this task. */\n- flux: string\n- /** An optional description of the task. */\n- description?: string\n-}\n-\nexport interface TaskUpdateRequest {\nstatus?: TaskStatusType\n/** The Flux script to run for this task. */\n@@ -2868,12 +2829,13 @@ export interface Replication {\nid: string\nname: string\ndescription?: string\n+ orgID: string\nremoteID: string\nlocalBucketID: string\nremoteBucketID: string\n- maxQueueSizeBytes: any\n- currentQueueSizeBytes: any\n- latestResponseCode?: any\n+ maxQueueSizeBytes: number\n+ currentQueueSizeBytes: number\n+ latestResponseCode?: number\nlatestErrorMessage?: string\n}\n@@ -2882,9 +2844,9 @@ export interface ReplicationCreationRequest {\ndescription?: string\norgID: string\nremoteID: string\n- localBucketID?: string\n- remoteBucketID?: string\n- maxQueueSizeBytes: any\n+ localBucketID: string\n+ remoteBucketID: string\n+ maxQueueSizeBytes: number\n}\nexport interface ReplicationUpdateRequest {\n@@ -2892,5 +2854,55 @@ export interface ReplicationUpdateRequest {\ndescription?: string\nremoteID?: string\nremoteBucketID?: string\n- maxQueueSizeBytes?: any\n+ maxQueueSizeBytes?: number\n+}\n+\n+export interface Dashboards {\n+ links?: Links\n+ dashboards?: Dashboard[]\n+}\n+\n+export interface Tasks {\n+ readonly links?: Links\n+ tasks?: Task[]\n+}\n+\n+export interface TaskCreateRequest {\n+ /** The ID of the organization that owns this Task. */\n+ orgID?: string\n+ /** The name of the organization that owns this Task. */\n+ org?: string\n+ status?: TaskStatusType\n+ /** The Flux script to run for this task. */\n+ flux: string\n+ /** An optional description of the task. */\n+ description?: string\n+}\n+\n+export interface LineProtocolError {\n+ /** Code is the machine-readable error code. */\n+ readonly code:\n+ | 'internal error'\n+ | 'not found'\n+ | 'conflict'\n+ | 'invalid'\n+ | 'empty value'\n+ | 'unavailable'\n+ /** Message is a human-readable message. */\n+ readonly message: string\n+ /** Op describes the logical code operation during error. Useful for debugging. */\n+ readonly op: string\n+ /** Err is a stack of errors that occurred during processing of the request. Useful for debugging. */\n+ readonly err: string\n+ /** First line within sent body containing malformed data */\n+ readonly line?: number\n+}\n+\n+export interface LineProtocolLengthError {\n+ /** Code is the machine-readable error code. */\n+ readonly code: 'invalid'\n+ /** Message is a human-readable message. */\n+ readonly message: string\n+ /** Max length in bytes for a body of line-protocol. */\n+ readonly maxLength: number\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): regenerate oss apis |
305,159 | 18.10.2021 08:20:11 | -7,200 | 7312140c2bf0f9934d9278afc369fba66a425a7a | chore(apis): update development.md | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/DEVELOPMENT.md",
"new_path": "packages/apis/DEVELOPMENT.md",
"diff": "@@ -11,10 +11,10 @@ $ yarn build\n## Re-generate APIs code\n- update local resources/swagger.yml to the latest version\n- - `wget -O resources/swagger.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/oss.yml`\n+ - `wget -O resources/oss.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/oss.yml`\n- re-generate src/generated/types.ts and resources/operations.json using [oats](https://github.com/bonitoo/oats)\n- `rm -rf src/generated/*.ts`\n- - `oats -i 'types' --storeOperations resources/operations.json resources/swagger.yml > src/generated/types.ts`\n+ - `oats -i 'types' --storeOperations resources/operations.json resources/oss.yml > src/generated/types.ts`\n- generate src/generated APIs from resources/operations.json\n- `yarn generate`\n- validate\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): update development.md |
305,159 | 18.10.2021 08:22:54 | -7,200 | 93a17995e7518952f49534c979144a066618813b | chore(apis): update api generator | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/generator/index.ts",
"new_path": "packages/apis/generator/index.ts",
"diff": "@@ -11,7 +11,7 @@ const operations: Array<Operation> = JSON.parse(\n__dirname,\n'..',\n'resources',\n- process.argv[2] || 'operations_oss.json'\n+ process.argv[2] || 'operations.json'\n),\n'utf-8'\n)\n"
},
{
"change_type": "RENAME",
"old_path": "packages/apis/resources/operations_oss.json",
"new_path": "packages/apis/resources/operations.json",
"diff": ""
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): update api generator |
305,159 | 18.10.2021 09:08:29 | -7,200 | 9d6a59dc53d00242f1d092dd51cfdcbac4dbbbcd | feat(apis): use also managed-functions.yml | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/DEVELOPMENT.md",
"new_path": "packages/apis/DEVELOPMENT.md",
"diff": "@@ -10,11 +10,12 @@ $ yarn build\n## Re-generate APIs code\n-- update local resources/swagger.yml to the latest version\n+- fetch latest versions of openapi files\n- `wget -O resources/oss.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/oss.yml`\n+ - `wget -O resources/managed-functions.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/managed-functions.yml`\n- re-generate src/generated/types.ts and resources/operations.json using [oats](https://github.com/bonitoo/oats)\n- `rm -rf src/generated/*.ts`\n- - `oats -i 'types' --storeOperations resources/operations.json resources/oss.yml > src/generated/types.ts`\n+ - `oats -i 'types' --storeOperations resources/operations.json resources/oss.yml resources/managed-functions.yml > src/generated/types.ts`\n- generate src/generated APIs from resources/operations.json\n- `yarn generate`\n- validate\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/apis/resources/managed-functions.yml",
"diff": "+openapi: 3.0.0\n+info:\n+ title: Influxdata Managed Functions CRUD API\n+ version: 0.1.0\n+servers:\n+ - url: /api/v2\n+paths:\n+ /functions:\n+ get:\n+ operationId: GetFunctions\n+ tags:\n+ - Functions\n+ summary: List all Functions\n+ parameters:\n+ - in: query\n+ name: org\n+ description: The name of the organization.\n+ schema:\n+ type: string\n+ - in: query\n+ name: orgID\n+ description: The organization ID.\n+ schema:\n+ type: string\n+ - in: query\n+ name: limit\n+ description: The number of functions to return\n+ required: false\n+ schema:\n+ type: integer\n+ - in: query\n+ name: offset\n+ required: false\n+ description: Offset for pagination\n+ schema:\n+ type: integer\n+ responses:\n+ '200':\n+ description: A list of functions\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/Functions'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ post:\n+ operationId: PostFunctions\n+ tags:\n+ - Functions\n+ summary: Create a new function\n+ requestBody:\n+ description: Function to create\n+ required: true\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/FunctionCreateRequest'\n+ responses:\n+ '201':\n+ description: Function created\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/Function'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ /functions/trigger:\n+ post:\n+ operationId: PostFunctionsTrigger\n+ tags:\n+ - Functions\n+ summary: Manually trigger a function without creating an associated function resource\n+ requestBody:\n+ description: Function to be triggered\n+ required: true\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/FunctionTriggerRequest'\n+ responses:\n+ '200':\n+ description: Function successfully triggered\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/FunctionTriggerResponse'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ '/functions/{functionID}':\n+ get:\n+ operationId: GetFunctionsID\n+ tags:\n+ - Functions\n+ summary: Retrieve a function\n+ parameters:\n+ - in: path\n+ name: functionID\n+ schema:\n+ type: string\n+ required: true\n+ description: The function ID.\n+ responses:\n+ '200':\n+ description: Function details\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/Function'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ patch:\n+ operationId: PatchFunctionsID\n+ tags:\n+ - Functions\n+ summary: Update a function\n+ description: Update a function\n+ requestBody:\n+ description: Function update to apply\n+ required: true\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/FunctionUpdateRequest'\n+ parameters:\n+ - in: path\n+ name: functionID\n+ schema:\n+ type: string\n+ required: true\n+ description: The function ID.\n+ responses:\n+ '200':\n+ description: Updated function\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/Function'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ delete:\n+ operationId: DeleteFunctionsID\n+ tags:\n+ - Functions\n+ summary: Delete a function\n+ description: Deletes a function and all associated records\n+ parameters:\n+ - in: path\n+ name: functionID\n+ schema:\n+ type: string\n+ required: true\n+ description: The ID of the function to delete.\n+ responses:\n+ '204':\n+ description: Function deleted\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ '/functions/{functionID}/invoke':\n+ get:\n+ operationId: GetFunctionsIDInvoke\n+ tags:\n+ - Functions\n+ summary: Manually invoke a function with params in query\n+ parameters:\n+ - in: path\n+ name: functionID\n+ schema:\n+ type: string\n+ required: true\n+ - in: query\n+ name: params\n+ schema:\n+ type: object\n+ additionalProperties: true\n+ style: form\n+ explode: true\n+ responses:\n+ '200':\n+ description: Response defined by function\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/FunctionHTTPResponseData'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ post:\n+ operationId: PostFunctionsIDInvoke\n+ tags:\n+ - Functions\n+ summary: Manually invoke a function with params in request body\n+ parameters:\n+ - in: path\n+ name: functionID\n+ schema:\n+ type: string\n+ required: true\n+ requestBody:\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/FunctionInvocationParams'\n+ responses:\n+ '200':\n+ description: Response defined by function\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/FunctionHTTPResponseData'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ '/functions/{functionID}/runs':\n+ get:\n+ operationId: GetFunctionsIDRuns\n+ tags:\n+ - Functions\n+ summary: List runs for a function\n+ parameters:\n+ - in: path\n+ name: functionID\n+ schema:\n+ type: string\n+ required: true\n+ description: The ID of the function to get runs for.\n+ - in: query\n+ name: limit\n+ description: The number of functions to return\n+ required: false\n+ schema:\n+ type: integer\n+ - in: query\n+ name: offset\n+ required: false\n+ description: Offset for pagination\n+ schema:\n+ type: integer\n+ responses:\n+ '200':\n+ description: A list of function runs\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/FunctionRuns'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ '/functions/{functionID}/runs/{runID}':\n+ get:\n+ operationId: GetFunctionsIDRunsID\n+ tags:\n+ - Functions\n+ summary: Retrieve a single run for a function\n+ parameters:\n+ - in: path\n+ name: functionID\n+ schema:\n+ type: string\n+ required: true\n+ description: The function ID.\n+ - in: path\n+ name: runID\n+ schema:\n+ type: string\n+ required: true\n+ description: The run ID.\n+ responses:\n+ '200':\n+ description: The run record\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/FunctionRun'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+components:\n+ responses:\n+ ServerError:\n+ description: Non 2XX error response from server.\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/Error'\n+ schemas:\n+ Error:\n+ properties:\n+ code:\n+ description: code is the machine-readable error code.\n+ readOnly: true\n+ type: string\n+ enum:\n+ - internal error\n+ - not found\n+ - conflict\n+ - invalid\n+ - unprocessable entity\n+ - empty value\n+ - unavailable\n+ - forbidden\n+ - too many requests\n+ - unauthorized\n+ - method not allowed\n+ - request too large\n+ - unsupported media type\n+ message:\n+ readOnly: true\n+ description: message is a human-readable message.\n+ type: string\n+ op:\n+ readOnly: true\n+ description: op describes the logical code operation during error. Useful for debugging.\n+ type: string\n+ err:\n+ readOnly: true\n+ description: err is a stack of errors that occurred during processing of the request. Useful for debugging.\n+ type: string\n+ required:\n+ - code\n+ - message\n+ Function:\n+ properties:\n+ id:\n+ readOnly: true\n+ type: string\n+ name:\n+ type: string\n+ description:\n+ type: string\n+ orgID:\n+ type: string\n+ script:\n+ description: script is script to be executed\n+ type: string\n+ language:\n+ $ref: '#/components/schemas/FunctionLanguage'\n+ url:\n+ type: string\n+ description: invocation endpoint address\n+ createdAt:\n+ type: string\n+ format: date-time\n+ readOnly: true\n+ updatedAt:\n+ type: string\n+ format: date-time\n+ readOnly: true\n+ required:\n+ - name\n+ - orgID\n+ - script\n+ Functions:\n+ type: object\n+ properties:\n+ functions:\n+ type: array\n+ items:\n+ $ref: '#/components/schemas/Function'\n+ FunctionCreateRequest:\n+ type: object\n+ properties:\n+ name:\n+ type: string\n+ description:\n+ type: string\n+ orgID:\n+ type: string\n+ script:\n+ description: script is script to be executed\n+ type: string\n+ language:\n+ $ref: '#/components/schemas/FunctionLanguage'\n+ required:\n+ - name\n+ - orgID\n+ - script\n+ - language\n+ FunctionUpdateRequest:\n+ type: object\n+ properties:\n+ name:\n+ type: string\n+ description:\n+ type: string\n+ script:\n+ description: script is script to be executed\n+ type: string\n+ FunctionHTTPResponseData:\n+ description: The data sent to end user when a function is invoked using http. User defined and dynamic\n+ type: object\n+ FunctionHTTPResponse:\n+ description: The full response sent to end user when a function is invoked using http\n+ allOf:\n+ - $ref: '#/components/schemas/FunctionHTTPResponseNoData'\n+ - type: object\n+ properties:\n+ data:\n+ $ref: '#/components/schemas/FunctionHTTPResponseData'\n+ FunctionHTTPResponseNoData:\n+ description: The full response sent to end user when a function is invoked using http\n+ properties:\n+ type:\n+ type: string\n+ enum:\n+ - http\n+ dataType:\n+ type: string\n+ enum:\n+ - json\n+ headers:\n+ type: object\n+ statusCode:\n+ type: string\n+ enum:\n+ - 200\n+ - 500\n+ - 404\n+ FunctionRunBase:\n+ description: 'Function trigger response or function run base, response field varies.'\n+ type: object\n+ properties:\n+ id:\n+ readOnly: true\n+ type: string\n+ status:\n+ type: string\n+ enum:\n+ - ok\n+ - error\n+ error:\n+ type: string\n+ logs:\n+ type: array\n+ items:\n+ $ref: '#/components/schemas/FunctionRunLog'\n+ response:\n+ $ref: '#/components/schemas/FunctionHTTPResponseNoData'\n+ startedAt:\n+ type: string\n+ format: date-time\n+ readOnly: true\n+ FunctionTriggerResponse:\n+ description: The full response sent to end user when a function is invoked\n+ allOf:\n+ - $ref: '#/components/schemas/FunctionRunBase'\n+ - type: object\n+ properties:\n+ response:\n+ $ref: '#/components/schemas/FunctionHTTPResponse'\n+ FunctionRun:\n+ description: 'The record that is kept of a function run, does not include data returned to user'\n+ allOf:\n+ - $ref: '#/components/schemas/FunctionRunBase'\n+ - type: object\n+ properties:\n+ response:\n+ $ref: '#/components/schemas/FunctionHTTPResponseNoData'\n+ FunctionRuns:\n+ type: object\n+ properties:\n+ runs:\n+ type: array\n+ items:\n+ $ref: '#/components/schemas/FunctionRun'\n+ FunctionTriggerRequest:\n+ allOf:\n+ - $ref: '#/components/schemas/FunctionInvocationParams'\n+ - type: object\n+ properties:\n+ script:\n+ description: script is script to be executed\n+ type: string\n+ method:\n+ type: string\n+ enum:\n+ - GET\n+ - POST\n+ orgID:\n+ type: string\n+ org:\n+ type: string\n+ language:\n+ $ref: '#/components/schemas/FunctionLanguage'\n+ required:\n+ - language\n+ - script\n+ - method\n+ FunctionInvocationParams:\n+ type: object\n+ properties:\n+ params:\n+ type: object\n+ FunctionRunLog:\n+ type: object\n+ properties:\n+ message:\n+ type: string\n+ timestamp:\n+ type: string\n+ format: date-time\n+ severity:\n+ type: object\n+ enum:\n+ - DEBUG\n+ - INFO\n+ FunctionLanguage:\n+ type: string\n+ enum:\n+ - python\n+ - flux\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(apis): use also managed-functions.yml |
305,159 | 18.10.2021 09:10:07 | -7,200 | 7dcc296cf5a2c8c332ad3247b0027aeb37e17f7f | feat(apis): generate code for functions API | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/resources/operations.json",
"new_path": "packages/apis/resources/operations.json",
"diff": "]\n}\n]\n+ },\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/functions\",\n+ \"operation\": \"get\",\n+ \"operationId\": \"GetFunctions\",\n+ \"basicAuth\": false,\n+ \"summary\": \"List all Functions\",\n+ \"positionalParams\": [],\n+ \"headerParams\": [],\n+ \"queryParams\": [\n+ {\n+ \"name\": \"org\",\n+ \"description\": \"The name of the organization.\",\n+ \"type\": \"string\"\n+ },\n+ {\n+ \"name\": \"orgID\",\n+ \"description\": \"The organization ID.\",\n+ \"type\": \"string\"\n+ },\n+ {\n+ \"name\": \"limit\",\n+ \"description\": \"The number of functions to return\",\n+ \"required\": false,\n+ \"type\": \"number\"\n+ },\n+ {\n+ \"name\": \"offset\",\n+ \"description\": \"Offset for pagination\",\n+ \"required\": false,\n+ \"type\": \"number\"\n+ }\n+ ],\n+ \"bodyParam\": null,\n+ \"responses\": [\n+ {\n+ \"code\": \"200\",\n+ \"description\": \"A list of functions\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Functions\"\n+ }\n+ ]\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Non 2XX error response from server.\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n+ },\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/functions\",\n+ \"operation\": \"post\",\n+ \"operationId\": \"PostFunctions\",\n+ \"basicAuth\": false,\n+ \"summary\": \"Create a new function\",\n+ \"positionalParams\": [],\n+ \"headerParams\": [],\n+ \"queryParams\": [],\n+ \"bodyParam\": {\n+ \"description\": \"Function to create\",\n+ \"required\": true,\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"FunctionCreateRequest\"\n+ },\n+ \"responses\": [\n+ {\n+ \"code\": \"201\",\n+ \"description\": \"Function created\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Function\"\n+ }\n+ ]\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Non 2XX error response from server.\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n+ },\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/functions/trigger\",\n+ \"operation\": \"post\",\n+ \"operationId\": \"PostFunctionsTrigger\",\n+ \"basicAuth\": false,\n+ \"summary\": \"Manually trigger a function without creating an associated function resource\",\n+ \"positionalParams\": [],\n+ \"headerParams\": [],\n+ \"queryParams\": [],\n+ \"bodyParam\": {\n+ \"description\": \"Function to be triggered\",\n+ \"required\": true,\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"FunctionTriggerRequest\"\n+ },\n+ \"responses\": [\n+ {\n+ \"code\": \"200\",\n+ \"description\": \"Function successfully triggered\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"FunctionTriggerResponse\"\n+ }\n+ ]\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Non 2XX error response from server.\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n+ },\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/functions/{functionID}\",\n+ \"operation\": \"get\",\n+ \"operationId\": \"GetFunctionsID\",\n+ \"basicAuth\": false,\n+ \"summary\": \"Retrieve a function\",\n+ \"positionalParams\": [\n+ {\n+ \"name\": \"functionID\",\n+ \"description\": \"The function ID.\",\n+ \"required\": true,\n+ \"type\": \"string\"\n+ }\n+ ],\n+ \"headerParams\": [],\n+ \"queryParams\": [],\n+ \"bodyParam\": null,\n+ \"responses\": [\n+ {\n+ \"code\": \"200\",\n+ \"description\": \"Function details\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Function\"\n+ }\n+ ]\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Non 2XX error response from server.\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n+ },\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/functions/{functionID}\",\n+ \"operation\": \"patch\",\n+ \"operationId\": \"PatchFunctionsID\",\n+ \"basicAuth\": false,\n+ \"summary\": \"Update a function\",\n+ \"positionalParams\": [\n+ {\n+ \"name\": \"functionID\",\n+ \"description\": \"The function ID.\",\n+ \"required\": true,\n+ \"type\": \"string\"\n+ }\n+ ],\n+ \"headerParams\": [],\n+ \"queryParams\": [],\n+ \"bodyParam\": {\n+ \"description\": \"Function update to apply\",\n+ \"required\": true,\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"FunctionUpdateRequest\"\n+ },\n+ \"responses\": [\n+ {\n+ \"code\": \"200\",\n+ \"description\": \"Updated function\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Function\"\n+ }\n+ ]\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Non 2XX error response from server.\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n+ },\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/functions/{functionID}\",\n+ \"operation\": \"delete\",\n+ \"operationId\": \"DeleteFunctionsID\",\n+ \"basicAuth\": false,\n+ \"summary\": \"Delete a function\",\n+ \"positionalParams\": [\n+ {\n+ \"name\": \"functionID\",\n+ \"description\": \"The ID of the function to delete.\",\n+ \"required\": true,\n+ \"type\": \"string\"\n+ }\n+ ],\n+ \"headerParams\": [],\n+ \"queryParams\": [],\n+ \"bodyParam\": null,\n+ \"responses\": [\n+ {\n+ \"code\": \"204\",\n+ \"description\": \"Function deleted\",\n+ \"mediaTypes\": []\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Non 2XX error response from server.\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n+ },\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/functions/{functionID}/invoke\",\n+ \"operation\": \"get\",\n+ \"operationId\": \"GetFunctionsIDInvoke\",\n+ \"basicAuth\": false,\n+ \"summary\": \"Manually invoke a function with params in query\",\n+ \"positionalParams\": [\n+ {\n+ \"name\": \"functionID\",\n+ \"required\": true,\n+ \"type\": \"string\"\n+ }\n+ ],\n+ \"headerParams\": [],\n+ \"queryParams\": [\n+ {\n+ \"name\": \"params\",\n+ \"type\": \"any\"\n+ }\n+ ],\n+ \"bodyParam\": null,\n+ \"responses\": [\n+ {\n+ \"code\": \"200\",\n+ \"description\": \"Response defined by function\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"FunctionHTTPResponseData\"\n+ }\n+ ]\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Non 2XX error response from server.\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n+ },\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/functions/{functionID}/invoke\",\n+ \"operation\": \"post\",\n+ \"operationId\": \"PostFunctionsIDInvoke\",\n+ \"basicAuth\": false,\n+ \"summary\": \"Manually invoke a function with params in request body\",\n+ \"positionalParams\": [\n+ {\n+ \"name\": \"functionID\",\n+ \"required\": true,\n+ \"type\": \"string\"\n+ }\n+ ],\n+ \"headerParams\": [],\n+ \"queryParams\": [],\n+ \"bodyParam\": {\n+ \"required\": false,\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"FunctionInvocationParams\"\n+ },\n+ \"responses\": [\n+ {\n+ \"code\": \"200\",\n+ \"description\": \"Response defined by function\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"FunctionHTTPResponseData\"\n+ }\n+ ]\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Non 2XX error response from server.\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n+ },\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/functions/{functionID}/runs\",\n+ \"operation\": \"get\",\n+ \"operationId\": \"GetFunctionsIDRuns\",\n+ \"basicAuth\": false,\n+ \"summary\": \"List runs for a function\",\n+ \"positionalParams\": [\n+ {\n+ \"name\": \"functionID\",\n+ \"description\": \"The ID of the function to get runs for.\",\n+ \"required\": true,\n+ \"type\": \"string\"\n+ }\n+ ],\n+ \"headerParams\": [],\n+ \"queryParams\": [\n+ {\n+ \"name\": \"limit\",\n+ \"description\": \"The number of functions to return\",\n+ \"required\": false,\n+ \"type\": \"number\"\n+ },\n+ {\n+ \"name\": \"offset\",\n+ \"description\": \"Offset for pagination\",\n+ \"required\": false,\n+ \"type\": \"number\"\n+ }\n+ ],\n+ \"bodyParam\": null,\n+ \"responses\": [\n+ {\n+ \"code\": \"200\",\n+ \"description\": \"A list of function runs\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"FunctionRuns\"\n+ }\n+ ]\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Non 2XX error response from server.\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n+ },\n+ {\n+ \"server\": \"/api/v2\",\n+ \"path\": \"/functions/{functionID}/runs/{runID}\",\n+ \"operation\": \"get\",\n+ \"operationId\": \"GetFunctionsIDRunsID\",\n+ \"basicAuth\": false,\n+ \"summary\": \"Retrieve a single run for a function\",\n+ \"positionalParams\": [\n+ {\n+ \"name\": \"functionID\",\n+ \"description\": \"The function ID.\",\n+ \"required\": true,\n+ \"type\": \"string\"\n+ },\n+ {\n+ \"name\": \"runID\",\n+ \"description\": \"The run ID.\",\n+ \"required\": true,\n+ \"type\": \"string\"\n+ }\n+ ],\n+ \"headerParams\": [],\n+ \"queryParams\": [],\n+ \"bodyParam\": null,\n+ \"responses\": [\n+ {\n+ \"code\": \"200\",\n+ \"description\": \"The run record\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"FunctionRun\"\n+ }\n+ ]\n+ },\n+ {\n+ \"code\": \"default\",\n+ \"description\": \"Non 2XX error response from server.\",\n+ \"mediaTypes\": [\n+ {\n+ \"mediaType\": \"application/json\",\n+ \"type\": \"Error\"\n+ }\n+ ]\n+ }\n+ ]\n}\n]\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/apis/src/generated/FunctionsAPI.ts",
"diff": "+import {InfluxDB} from '@influxdata/influxdb-client'\n+import {APIBase, RequestOptions} from '../APIBase'\n+import {\n+ Function,\n+ FunctionCreateRequest,\n+ FunctionHTTPResponseData,\n+ FunctionInvocationParams,\n+ FunctionRun,\n+ FunctionRuns,\n+ FunctionTriggerRequest,\n+ FunctionTriggerResponse,\n+ FunctionUpdateRequest,\n+ Functions,\n+} from './types'\n+\n+export interface GetFunctionsRequest {\n+ /** The name of the organization. */\n+ org?: string\n+ /** The organization ID. */\n+ orgID?: string\n+ /** The number of functions to return */\n+ limit?: number\n+ /** Offset for pagination */\n+ offset?: number\n+}\n+export interface PostFunctionsRequest {\n+ /** Function to create */\n+ body: FunctionCreateRequest\n+}\n+export interface PostFunctionsTriggerRequest {\n+ /** Function to be triggered */\n+ body: FunctionTriggerRequest\n+}\n+export interface GetFunctionsIDRequest {\n+ /** The function ID. */\n+ functionID: string\n+}\n+export interface PatchFunctionsIDRequest {\n+ /** The function ID. */\n+ functionID: string\n+ /** Function update to apply */\n+ body: FunctionUpdateRequest\n+}\n+export interface DeleteFunctionsIDRequest {\n+ /** The ID of the function to delete. */\n+ functionID: string\n+}\n+export interface GetFunctionsIDInvokeRequest {\n+ functionID: string\n+ params?: any\n+}\n+export interface PostFunctionsIDInvokeRequest {\n+ functionID: string\n+ /** entity body */\n+ body: FunctionInvocationParams\n+}\n+export interface GetFunctionsIDRunsRequest {\n+ /** The ID of the function to get runs for. */\n+ functionID: string\n+ /** The number of functions to return */\n+ limit?: number\n+ /** Offset for pagination */\n+ offset?: number\n+}\n+export interface GetFunctionsIDRunsIDRequest {\n+ /** The function ID. */\n+ functionID: string\n+ /** The run ID. */\n+ runID: string\n+}\n+/**\n+ * Functions API\n+ */\n+export class FunctionsAPI {\n+ // internal\n+ private base: APIBase\n+\n+ /**\n+ * Creates FunctionsAPI\n+ * @param influxDB - an instance that knows how to communicate with InfluxDB server\n+ */\n+ constructor(influxDB: InfluxDB) {\n+ this.base = new APIBase(influxDB)\n+ }\n+ /**\n+ * List all Functions.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetFunctions }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ getFunctions(\n+ request?: GetFunctionsRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<Functions> {\n+ return this.base.request(\n+ 'GET',\n+ `/api/v2/functions${this.base.queryString(request, [\n+ 'org',\n+ 'orgID',\n+ 'limit',\n+ 'offset',\n+ ])}`,\n+ request,\n+ requestOptions\n+ )\n+ }\n+ /**\n+ * Create a new function.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostFunctions }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ postFunctions(\n+ request: PostFunctionsRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<Function> {\n+ return this.base.request(\n+ 'POST',\n+ `/api/v2/functions`,\n+ request,\n+ requestOptions,\n+ 'application/json'\n+ )\n+ }\n+ /**\n+ * Manually trigger a function without creating an associated function resource.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostFunctionsTrigger }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ postFunctionsTrigger(\n+ request: PostFunctionsTriggerRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<FunctionTriggerResponse> {\n+ return this.base.request(\n+ 'POST',\n+ `/api/v2/functions/trigger`,\n+ request,\n+ requestOptions,\n+ 'application/json'\n+ )\n+ }\n+ /**\n+ * Retrieve a function.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetFunctionsID }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ getFunctionsID(\n+ request: GetFunctionsIDRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<Function> {\n+ return this.base.request(\n+ 'GET',\n+ `/api/v2/functions/${request.functionID}`,\n+ request,\n+ requestOptions\n+ )\n+ }\n+ /**\n+ * Update a function.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PatchFunctionsID }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ patchFunctionsID(\n+ request: PatchFunctionsIDRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<Function> {\n+ return this.base.request(\n+ 'PATCH',\n+ `/api/v2/functions/${request.functionID}`,\n+ request,\n+ requestOptions,\n+ 'application/json'\n+ )\n+ }\n+ /**\n+ * Delete a function.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/DeleteFunctionsID }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ deleteFunctionsID(\n+ request: DeleteFunctionsIDRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<void> {\n+ return this.base.request(\n+ 'DELETE',\n+ `/api/v2/functions/${request.functionID}`,\n+ request,\n+ requestOptions\n+ )\n+ }\n+ /**\n+ * Manually invoke a function with params in query.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetFunctionsIDInvoke }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ getFunctionsIDInvoke(\n+ request: GetFunctionsIDInvokeRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<FunctionHTTPResponseData> {\n+ return this.base.request(\n+ 'GET',\n+ `/api/v2/functions/${\n+ request.functionID\n+ }/invoke${this.base.queryString(request, ['params'])}`,\n+ request,\n+ requestOptions\n+ )\n+ }\n+ /**\n+ * Manually invoke a function with params in request body.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostFunctionsIDInvoke }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ postFunctionsIDInvoke(\n+ request: PostFunctionsIDInvokeRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<FunctionHTTPResponseData> {\n+ return this.base.request(\n+ 'POST',\n+ `/api/v2/functions/${request.functionID}/invoke`,\n+ request,\n+ requestOptions,\n+ 'application/json'\n+ )\n+ }\n+ /**\n+ * List runs for a function.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetFunctionsIDRuns }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ getFunctionsIDRuns(\n+ request: GetFunctionsIDRunsRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<FunctionRuns> {\n+ return this.base.request(\n+ 'GET',\n+ `/api/v2/functions/${\n+ request.functionID\n+ }/runs${this.base.queryString(request, ['limit', 'offset'])}`,\n+ request,\n+ requestOptions\n+ )\n+ }\n+ /**\n+ * Retrieve a single run for a function.\n+ * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetFunctionsIDRunsID }\n+ * @param request - request parameters and body (if supported)\n+ * @param requestOptions - optional transport options\n+ * @returns promise of response\n+ */\n+ getFunctionsIDRunsID(\n+ request: GetFunctionsIDRunsIDRequest,\n+ requestOptions?: RequestOptions\n+ ): Promise<FunctionRun> {\n+ return this.base.request(\n+ 'GET',\n+ `/api/v2/functions/${request.functionID}/runs/${request.runID}`,\n+ request,\n+ requestOptions\n+ )\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/index.ts",
"new_path": "packages/apis/src/generated/index.ts",
"diff": "@@ -9,6 +9,7 @@ export * from './DbrpsAPI'\nexport * from './DeleteAPI'\nexport * from './DocumentsAPI'\nexport * from './FlagsAPI'\n+export * from './FunctionsAPI'\nexport * from './HealthAPI'\nexport * from './LabelsAPI'\nexport * from './LegacyAPI'\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/types.ts",
"new_path": "packages/apis/src/generated/types.ts",
"diff": "@@ -2906,3 +2906,110 @@ export interface LineProtocolLengthError {\n/** Max length in bytes for a body of line-protocol. */\nreadonly maxLength: number\n}\n+\n+export interface Functions {\n+ functions?: Function[]\n+}\n+\n+export interface Function {\n+ readonly id?: string\n+ name: string\n+ description?: string\n+ orgID: string\n+ /** script is script to be executed */\n+ script: string\n+ language?: FunctionLanguage\n+ /** invocation endpoint address */\n+ url?: string\n+ readonly createdAt?: string\n+ readonly updatedAt?: string\n+}\n+\n+export type FunctionLanguage = 'python' | 'flux'\n+\n+export interface FunctionCreateRequest {\n+ name: string\n+ description?: string\n+ orgID: string\n+ /** script is script to be executed */\n+ script: string\n+ language: FunctionLanguage\n+}\n+\n+export type FunctionTriggerRequest = FunctionInvocationParams & {\n+ /** script is script to be executed */\n+ script: string\n+ method: 'GET' | 'POST'\n+ orgID?: string\n+ org?: string\n+ language: FunctionLanguage\n+}\n+\n+export interface FunctionInvocationParams {\n+ params?: any\n+}\n+\n+/**\n+ * The full response sent to end user when a function is invoked\n+ */\n+export type FunctionTriggerResponse = FunctionRunBase & {\n+ response?: FunctionHTTPResponse\n+}\n+\n+/**\n+ * Function trigger response or function run base, response field varies.\n+ */\n+export interface FunctionRunBase {\n+ readonly id?: string\n+ status?: 'ok' | 'error'\n+ error?: string\n+ logs?: FunctionRunLog[]\n+ response?: FunctionHTTPResponseNoData\n+ readonly startedAt?: string\n+}\n+\n+export interface FunctionRunLog {\n+ message?: string\n+ timestamp?: string\n+ severity?: any\n+}\n+\n+/**\n+ * The full response sent to end user when a function is invoked using http\n+ */\n+export interface FunctionHTTPResponseNoData {\n+ type?: 'http'\n+ dataType?: 'json'\n+ headers?: any\n+ statusCode?: '200' | '500' | '404'\n+}\n+\n+/**\n+ * The full response sent to end user when a function is invoked using http\n+ */\n+export type FunctionHTTPResponse = FunctionHTTPResponseNoData & {\n+ data?: FunctionHTTPResponseData\n+}\n+\n+/**\n+ * The data sent to end user when a function is invoked using http. User defined and dynamic\n+ */\n+export type FunctionHTTPResponseData = any\n+\n+export interface FunctionUpdateRequest {\n+ name?: string\n+ description?: string\n+ /** script is script to be executed */\n+ script?: string\n+}\n+\n+export interface FunctionRuns {\n+ runs?: FunctionRun[]\n+}\n+\n+/**\n+ * The record that is kept of a function run, does not include data returned to user\n+ */\n+export type FunctionRun = FunctionRunBase & {\n+ response?: FunctionHTTPResponseNoData\n+}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(apis): generate code for functions API |
305,159 | 22.10.2021 18:09:17 | -7,200 | 7aa2c72999c60ae685fb2dd2b2598ee458a3e82e | chore(apis): update readme with invocable scripts | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/DEVELOPMENT.md",
"new_path": "packages/apis/DEVELOPMENT.md",
"diff": "@@ -12,7 +12,7 @@ $ yarn build\n- fetch latest versions of openapi files\n- `wget -O resources/oss.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/oss.yml`\n- - `wget -O resources/managed-functions.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/managed-functions.yml`\n+ - `wget -O resources/managed-functions.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/invocable-scripts.yml`\n- re-generate src/generated/types.ts and resources/operations.json using [oats](https://github.com/bonitoo/oats)\n- `rm -rf src/generated/*.ts`\n- `oats -i 'types' --storeOperations resources/operations.json resources/oss.yml resources/managed-functions.yml > src/generated/types.ts`\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/resources/managed-functions.yml",
"new_path": "packages/apis/resources/managed-functions.yml",
"diff": "-openapi: 3.0.0\n-info:\n- title: Influxdata Managed Functions CRUD API\n- version: 0.1.0\n-servers:\n- - url: /api/v2\n-paths:\n- /functions:\n- get:\n- operationId: GetFunctions\n- tags:\n- - Functions\n- summary: List all Functions\n- parameters:\n- - in: query\n- name: org\n- description: The name of the organization.\n- schema:\n- type: string\n- - in: query\n- name: orgID\n- description: The organization ID.\n- schema:\n- type: string\n- - in: query\n- name: limit\n- description: The number of functions to return\n- required: false\n- schema:\n- type: integer\n- - in: query\n- name: offset\n- required: false\n- description: Offset for pagination\n- schema:\n- type: integer\n- responses:\n- '200':\n- description: A list of functions\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Functions'\n- default:\n- description: Unexpected error\n- $ref: '#/components/responses/ServerError'\n- post:\n- operationId: PostFunctions\n- tags:\n- - Functions\n- summary: Create a new function\n- requestBody:\n- description: Function to create\n- required: true\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/FunctionCreateRequest'\n- responses:\n- '201':\n- description: Function created\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Function'\n- default:\n- description: Unexpected error\n- $ref: '#/components/responses/ServerError'\n- /functions/trigger:\n- post:\n- operationId: PostFunctionsTrigger\n- tags:\n- - Functions\n- summary: Manually trigger a function without creating an associated function resource\n- requestBody:\n- description: Function to be triggered\n- required: true\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/FunctionTriggerRequest'\n- responses:\n- '200':\n- description: Function successfully triggered\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/FunctionTriggerResponse'\n- default:\n- description: Unexpected error\n- $ref: '#/components/responses/ServerError'\n- '/functions/{functionID}':\n- get:\n- operationId: GetFunctionsID\n- tags:\n- - Functions\n- summary: Retrieve a function\n- parameters:\n- - in: path\n- name: functionID\n- schema:\n- type: string\n- required: true\n- description: The function ID.\n- responses:\n- '200':\n- description: Function details\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Function'\n- default:\n- description: Unexpected error\n- $ref: '#/components/responses/ServerError'\n- patch:\n- operationId: PatchFunctionsID\n- tags:\n- - Functions\n- summary: Update a function\n- description: Update a function\n- requestBody:\n- description: Function update to apply\n- required: true\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/FunctionUpdateRequest'\n- parameters:\n- - in: path\n- name: functionID\n- schema:\n- type: string\n- required: true\n- description: The function ID.\n- responses:\n- '200':\n- description: Updated function\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Function'\n- default:\n- description: Unexpected error\n- $ref: '#/components/responses/ServerError'\n- delete:\n- operationId: DeleteFunctionsID\n- tags:\n- - Functions\n- summary: Delete a function\n- description: Deletes a function and all associated records\n- parameters:\n- - in: path\n- name: functionID\n- schema:\n- type: string\n- required: true\n- description: The ID of the function to delete.\n- responses:\n- '204':\n- description: Function deleted\n- default:\n- description: Unexpected error\n- $ref: '#/components/responses/ServerError'\n- '/functions/{functionID}/invoke':\n- get:\n- operationId: GetFunctionsIDInvoke\n- tags:\n- - Functions\n- summary: Manually invoke a function with params in query\n- parameters:\n- - in: path\n- name: functionID\n- schema:\n- type: string\n- required: true\n- - in: query\n- name: params\n- schema:\n- type: object\n- additionalProperties: true\n- style: form\n- explode: true\n- responses:\n- '200':\n- description: Response defined by function\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/FunctionHTTPResponseData'\n- default:\n- description: Unexpected error\n- $ref: '#/components/responses/ServerError'\n- post:\n- operationId: PostFunctionsIDInvoke\n- tags:\n- - Functions\n- summary: Manually invoke a function with params in request body\n- parameters:\n- - in: path\n- name: functionID\n- schema:\n- type: string\n- required: true\n- requestBody:\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/FunctionInvocationParams'\n- responses:\n- '200':\n- description: Response defined by function\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/FunctionHTTPResponseData'\n- default:\n- description: Unexpected error\n- $ref: '#/components/responses/ServerError'\n- '/functions/{functionID}/runs':\n- get:\n- operationId: GetFunctionsIDRuns\n- tags:\n- - Functions\n- summary: List runs for a function\n- parameters:\n- - in: path\n- name: functionID\n- schema:\n- type: string\n- required: true\n- description: The ID of the function to get runs for.\n- - in: query\n- name: limit\n- description: The number of functions to return\n- required: false\n- schema:\n- type: integer\n- - in: query\n- name: offset\n- required: false\n- description: Offset for pagination\n- schema:\n- type: integer\n- responses:\n- '200':\n- description: A list of function runs\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/FunctionRuns'\n- default:\n- description: Unexpected error\n- $ref: '#/components/responses/ServerError'\n- '/functions/{functionID}/runs/{runID}':\n- get:\n- operationId: GetFunctionsIDRunsID\n- tags:\n- - Functions\n- summary: Retrieve a single run for a function\n- parameters:\n- - in: path\n- name: functionID\n- schema:\n- type: string\n- required: true\n- description: The function ID.\n- - in: path\n- name: runID\n- schema:\n- type: string\n- required: true\n- description: The run ID.\n- responses:\n- '200':\n- description: The run record\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/FunctionRun'\n- default:\n- description: Unexpected error\n- $ref: '#/components/responses/ServerError'\n-components:\n- responses:\n- ServerError:\n- description: Non 2XX error response from server.\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Error'\n- schemas:\n- Error:\n- properties:\n- code:\n- description: code is the machine-readable error code.\n- readOnly: true\n- type: string\n- enum:\n- - internal error\n- - not found\n- - conflict\n- - invalid\n- - unprocessable entity\n- - empty value\n- - unavailable\n- - forbidden\n- - too many requests\n- - unauthorized\n- - method not allowed\n- - request too large\n- - unsupported media type\n- message:\n- readOnly: true\n- description: message is a human-readable message.\n- type: string\n- op:\n- readOnly: true\n- description: op describes the logical code operation during error. Useful for debugging.\n- type: string\n- err:\n- readOnly: true\n- description: err is a stack of errors that occurred during processing of the request. Useful for debugging.\n- type: string\n- required:\n- - code\n- - message\n- Function:\n- properties:\n- id:\n- readOnly: true\n- type: string\n- name:\n- type: string\n- description:\n- type: string\n- orgID:\n- type: string\n- script:\n- description: script is script to be executed\n- type: string\n- language:\n- $ref: '#/components/schemas/FunctionLanguage'\n- url:\n- type: string\n- description: invocation endpoint address\n- createdAt:\n- type: string\n- format: date-time\n- readOnly: true\n- updatedAt:\n- type: string\n- format: date-time\n- readOnly: true\n- required:\n- - name\n- - orgID\n- - script\n- Functions:\n- type: object\n- properties:\n- functions:\n- type: array\n- items:\n- $ref: '#/components/schemas/Function'\n- FunctionCreateRequest:\n- type: object\n- properties:\n- name:\n- type: string\n- description:\n- type: string\n- orgID:\n- type: string\n- script:\n- description: script is script to be executed\n- type: string\n- language:\n- $ref: '#/components/schemas/FunctionLanguage'\n- required:\n- - name\n- - orgID\n- - script\n- - language\n- FunctionUpdateRequest:\n- type: object\n- properties:\n- name:\n- type: string\n- description:\n- type: string\n- script:\n- description: script is script to be executed\n- type: string\n- FunctionHTTPResponseData:\n- description: The data sent to end user when a function is invoked using http. User defined and dynamic\n- type: object\n- FunctionHTTPResponse:\n- description: The full response sent to end user when a function is invoked using http\n- allOf:\n- - $ref: '#/components/schemas/FunctionHTTPResponseNoData'\n- - type: object\n- properties:\n- data:\n- $ref: '#/components/schemas/FunctionHTTPResponseData'\n- FunctionHTTPResponseNoData:\n- description: The full response sent to end user when a function is invoked using http\n- properties:\n- type:\n- type: string\n- enum:\n- - http\n- dataType:\n- type: string\n- enum:\n- - json\n- headers:\n- type: object\n- statusCode:\n- type: string\n- enum:\n- - 200\n- - 500\n- - 404\n- FunctionRunBase:\n- description: 'Function trigger response or function run base, response field varies.'\n- type: object\n- properties:\n- id:\n- readOnly: true\n- type: string\n- status:\n- type: string\n- enum:\n- - ok\n- - error\n- error:\n- type: string\n- logs:\n- type: array\n- items:\n- $ref: '#/components/schemas/FunctionRunLog'\n- response:\n- $ref: '#/components/schemas/FunctionHTTPResponseNoData'\n- startedAt:\n- type: string\n- format: date-time\n- readOnly: true\n- FunctionTriggerResponse:\n- description: The full response sent to end user when a function is invoked\n- allOf:\n- - $ref: '#/components/schemas/FunctionRunBase'\n- - type: object\n- properties:\n- response:\n- $ref: '#/components/schemas/FunctionHTTPResponse'\n- FunctionRun:\n- description: 'The record that is kept of a function run, does not include data returned to user'\n- allOf:\n- - $ref: '#/components/schemas/FunctionRunBase'\n- - type: object\n- properties:\n- response:\n- $ref: '#/components/schemas/FunctionHTTPResponseNoData'\n- FunctionRuns:\n- type: object\n- properties:\n- runs:\n- type: array\n- items:\n- $ref: '#/components/schemas/FunctionRun'\n- FunctionTriggerRequest:\n- allOf:\n- - $ref: '#/components/schemas/FunctionInvocationParams'\n- - type: object\n- properties:\n- script:\n- description: script is script to be executed\n- type: string\n- method:\n- type: string\n- enum:\n- - GET\n- - POST\n- orgID:\n- type: string\n- org:\n- type: string\n- language:\n- $ref: '#/components/schemas/FunctionLanguage'\n- required:\n- - language\n- - script\n- - method\n- FunctionInvocationParams:\n- type: object\n- properties:\n- params:\n- type: object\n- FunctionRunLog:\n- type: object\n- properties:\n- message:\n- type: string\n- timestamp:\n- type: string\n- format: date-time\n- severity:\n- type: object\n- enum:\n- - DEBUG\n- - INFO\n- FunctionLanguage:\n- type: string\n- enum:\n- - python\n- - flux\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): update readme with invocable scripts |
305,159 | 22.10.2021 18:12:59 | -7,200 | 5e239b96458aeff8ad05dd52f7f4438715d869e4 | chore(apis): use invocable scripts | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/DEVELOPMENT.md",
"new_path": "packages/apis/DEVELOPMENT.md",
"diff": "@@ -12,10 +12,10 @@ $ yarn build\n- fetch latest versions of openapi files\n- `wget -O resources/oss.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/oss.yml`\n- - `wget -O resources/managed-functions.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/invocable-scripts.yml`\n+ - `wget -O resources/invocable-scripts.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/invocable-scripts.yml`\n- re-generate src/generated/types.ts and resources/operations.json using [oats](https://github.com/bonitoo/oats)\n- `rm -rf src/generated/*.ts`\n- - `oats -i 'types' --storeOperations resources/operations.json resources/oss.yml resources/managed-functions.yml > src/generated/types.ts`\n+ - `oats -i 'types' --storeOperations resources/operations.json resources/oss.yml resources/invocable-scripts.yml > src/generated/types.ts`\n- generate src/generated APIs from resources/operations.json\n- `yarn generate`\n- validate\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/apis/resources/invocable-scripts.yml",
"diff": "+openapi: 3.0.0\n+info:\n+ title: Influxdata API Invocable Scripts CRUD API\n+ version: 0.1.0\n+servers:\n+ - url: /api/v2\n+paths:\n+ /scripts:\n+ get:\n+ operationId: GetScripts\n+ tags:\n+ - Scripts\n+ summary: List all Scripts\n+ parameters:\n+ - in: query\n+ name: limit\n+ description: The number of scripts to return\n+ required: false\n+ schema:\n+ type: integer\n+ - in: query\n+ name: offset\n+ required: false\n+ description: Offset for pagination\n+ schema:\n+ type: integer\n+ responses:\n+ '200':\n+ description: A list of scripts\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/Scripts'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ post:\n+ operationId: PostScripts\n+ tags:\n+ - Scripts\n+ summary: Create a new script\n+ requestBody:\n+ description: Script to create\n+ required: true\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/ScriptCreateRequest'\n+ responses:\n+ '201':\n+ description: Script created\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/Script'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ '/scripts/{scriptID}':\n+ get:\n+ operationId: GetScriptsID\n+ tags:\n+ - Scripts\n+ summary: Retrieve a script\n+ parameters:\n+ - in: path\n+ name: scriptID\n+ schema:\n+ type: string\n+ required: true\n+ description: The script ID.\n+ responses:\n+ '200':\n+ description: Script details\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/Script'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ patch:\n+ operationId: PatchScriptsID\n+ tags:\n+ - Scripts\n+ summary: Update a script\n+ description: Update a script\n+ requestBody:\n+ description: Script update to apply\n+ required: true\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/ScriptUpdateRequest'\n+ parameters:\n+ - in: path\n+ name: scriptID\n+ schema:\n+ type: string\n+ required: true\n+ description: The script ID.\n+ responses:\n+ '200':\n+ description: Updated script\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/Script'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ delete:\n+ operationId: DeleteScriptsID\n+ tags:\n+ - Scripts\n+ summary: Delete a script\n+ description: Deletes a script and all associated records\n+ parameters:\n+ - in: path\n+ name: scriptID\n+ schema:\n+ type: string\n+ required: true\n+ description: The ID of the script to delete.\n+ responses:\n+ '204':\n+ description: Script deleted\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+ '/scripts/{scriptID}/invoke':\n+ post:\n+ operationId: PostScriptsIDInvoke\n+ tags:\n+ - Scripts\n+ summary: Manually invoke a script with params in request body\n+ parameters:\n+ - in: path\n+ name: scriptID\n+ schema:\n+ type: string\n+ required: true\n+ requestBody:\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/ScriptInvocationParams'\n+ responses:\n+ '200':\n+ description: Response defined by script\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/ScriptHTTPResponseData'\n+ default:\n+ description: Unexpected error\n+ $ref: '#/components/responses/ServerError'\n+components:\n+ responses:\n+ ServerError:\n+ description: Non 2XX error response from server.\n+ content:\n+ application/json:\n+ schema:\n+ $ref: '#/components/schemas/Error'\n+ schemas:\n+ Error:\n+ properties:\n+ code:\n+ description: code is the machine-readable error code.\n+ readOnly: true\n+ type: string\n+ enum:\n+ - internal error\n+ - not found\n+ - conflict\n+ - invalid\n+ - unprocessable entity\n+ - empty value\n+ - unavailable\n+ - forbidden\n+ - too many requests\n+ - unauthorized\n+ - method not allowed\n+ - request too large\n+ - unsupported media type\n+ message:\n+ readOnly: true\n+ description: message is a human-readable message.\n+ type: string\n+ op:\n+ readOnly: true\n+ description: op describes the logical code operation during error. Useful for debugging.\n+ type: string\n+ err:\n+ readOnly: true\n+ description: err is a stack of errors that occurred during processing of the request. Useful for debugging.\n+ type: string\n+ required:\n+ - code\n+ - message\n+ Script:\n+ properties:\n+ id:\n+ readOnly: true\n+ type: string\n+ name:\n+ type: string\n+ description:\n+ type: string\n+ orgID:\n+ type: string\n+ script:\n+ description: script to be executed\n+ type: string\n+ language:\n+ $ref: '#/components/schemas/ScriptLanguage'\n+ url:\n+ type: string\n+ description: invocation endpoint address\n+ createdAt:\n+ type: string\n+ format: date-time\n+ readOnly: true\n+ updatedAt:\n+ type: string\n+ format: date-time\n+ readOnly: true\n+ required:\n+ - name\n+ - orgID\n+ - script\n+ Scripts:\n+ type: object\n+ properties:\n+ scripts:\n+ type: array\n+ items:\n+ $ref: '#/components/schemas/Script'\n+ ScriptCreateRequest:\n+ type: object\n+ properties:\n+ name:\n+ type: string\n+ description:\n+ type: string\n+ script:\n+ description: script to be executed\n+ type: string\n+ language:\n+ $ref: '#/components/schemas/ScriptLanguage'\n+ required:\n+ - name\n+ - orgID\n+ - script\n+ - language\n+ - description\n+ ScriptUpdateRequest:\n+ type: object\n+ properties:\n+ name:\n+ type: string\n+ description:\n+ type: string\n+ script:\n+ description: script is script to be executed\n+ type: string\n+ ScriptHTTPResponseData:\n+ description: The data sent to end user when a script is invoked using http. User defined and dynamic\n+ type: string\n+ ScriptInvocationParams:\n+ type: object\n+ properties:\n+ params:\n+ type: object\n+ ScriptLanguage:\n+ type: string\n+ enum:\n+ - flux\n"
},
{
"change_type": "DELETE",
"old_path": "packages/apis/resources/managed-functions.yml",
"new_path": "packages/apis/resources/managed-functions.yml",
"diff": ""
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): use invocable scripts |
305,159 | 22.10.2021 18:13:26 | -7,200 | 5ac186e74eac84797ca1bbeeb1ced538e77df128 | chore(apis): update oss swagger | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/resources/oss.yml",
"new_path": "packages/apis/resources/oss.yml",
"diff": "@@ -221,241 +221,6 @@ paths:\napplication/json:\nschema:\n$ref: '#/components/schemas/Routes'\n- /documents/templates:\n- get:\n- operationId: GetDocumentsTemplates\n- tags:\n- - Templates\n- summary: List all templates\n- parameters:\n- - $ref: '#/components/parameters/TraceSpan'\n- - in: query\n- name: org\n- description: Specifies the name of the organization of the template.\n- schema:\n- type: string\n- - in: query\n- name: orgID\n- description: Specifies the organization ID of the template.\n- schema:\n- type: string\n- responses:\n- '200':\n- description: A list of template documents\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Documents'\n- default:\n- description: Unexpected error\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Error'\n- post:\n- operationId: PostDocumentsTemplates\n- tags:\n- - Templates\n- summary: Create a template\n- parameters:\n- - $ref: '#/components/parameters/TraceSpan'\n- requestBody:\n- description: Template that will be created\n- required: true\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/DocumentCreate'\n- responses:\n- '201':\n- description: Template created\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Document'\n- default:\n- description: Unexpected error\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Error'\n- '/documents/templates/{templateID}':\n- get:\n- operationId: GetDocumentsTemplatesID\n- tags:\n- - Templates\n- summary: Retrieve a template\n- parameters:\n- - $ref: '#/components/parameters/TraceSpan'\n- - in: path\n- name: templateID\n- schema:\n- type: string\n- required: true\n- description: The template ID.\n- responses:\n- '200':\n- description: The template requested\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Document'\n- default:\n- description: Unexpected error\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Error'\n- put:\n- operationId: PutDocumentsTemplatesID\n- tags:\n- - Templates\n- summary: Update a template\n- parameters:\n- - $ref: '#/components/parameters/TraceSpan'\n- - in: path\n- name: templateID\n- schema:\n- type: string\n- required: true\n- description: The template ID.\n- requestBody:\n- description: Template that will be updated\n- required: true\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/DocumentUpdate'\n- responses:\n- '200':\n- description: The newly updated template\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Document'\n- default:\n- description: Unexpected error\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Error'\n- delete:\n- operationId: DeleteDocumentsTemplatesID\n- tags:\n- - Templates\n- summary: Delete a template\n- parameters:\n- - $ref: '#/components/parameters/TraceSpan'\n- - in: path\n- name: templateID\n- schema:\n- type: string\n- required: true\n- description: The template ID.\n- responses:\n- '204':\n- description: Delete has been accepted\n- default:\n- description: Unexpected error\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Error'\n- '/documents/templates/{templateID}/labels':\n- get:\n- operationId: GetDocumentsTemplatesIDLabels\n- tags:\n- - Templates\n- summary: List all labels for a template\n- parameters:\n- - $ref: '#/components/parameters/TraceSpan'\n- - in: path\n- name: templateID\n- schema:\n- type: string\n- required: true\n- description: The template ID.\n- responses:\n- '200':\n- description: A list of all labels for a template\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/LabelsResponse'\n- default:\n- description: Unexpected error\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Error'\n- post:\n- operationId: PostDocumentsTemplatesIDLabels\n- tags:\n- - Templates\n- summary: Add a label to a template\n- parameters:\n- - $ref: '#/components/parameters/TraceSpan'\n- - in: path\n- name: templateID\n- schema:\n- type: string\n- required: true\n- description: The template ID.\n- requestBody:\n- description: Label to add\n- required: true\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/LabelMapping'\n- responses:\n- '201':\n- description: The label added to the template\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/LabelResponse'\n- default:\n- description: Unexpected error\n- content:\n- application/json:\n- schema:\n- $ref: '#/components/schemas/Error'\n- '/documents/templates/{templateID}/labels/{labelID}':\n- delete:\n- operationId: DeleteDocumentsTemplatesIDLabelsID\n- tags:\n- - Templates\n- summary: Delete a label from a template\n- parameters:\n- - $ref: '#/components/parameters/TraceSpan'\n- - in: path\n- name: templateID\n- schema:\n- type: string\n- required: true\n- description: The template ID.\n- - in: path\n- name: labelID\n- schema:\n- type: string\n- required: true\n- description: The label ID.\n- responses:\n- '204':\n- description: Delete has been accepted\n- '404':\n- description: Template 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/dbrps:\nget:\noperationId: GetDBRPs\n@@ -7280,6 +7045,16 @@ paths:\nmaximum: 500\ndefault: 100\ndescription: The number of tasks to return\n+ - in: query\n+ name: type\n+ description: 'Type of task, unset by default.'\n+ required: false\n+ schema:\n+ default: ''\n+ type: string\n+ enum:\n+ - basic\n+ - system\nresponses:\n'200':\ndescription: A list of tasks\n@@ -11455,112 +11230,6 @@ components:\ntype: array\nitems:\n$ref: '#/components/schemas/Dashboard'\n- DocumentMeta:\n- type: object\n- properties:\n- name:\n- type: string\n- type:\n- type: string\n- templateID:\n- type: string\n- description:\n- type: string\n- version:\n- type: string\n- createdAt:\n- type: string\n- format: date-time\n- readOnly: true\n- updatedAt:\n- type: string\n- format: date-time\n- readOnly: true\n- required:\n- - name\n- - version\n- Document:\n- type: object\n- properties:\n- id:\n- type: string\n- readOnly: true\n- meta:\n- $ref: '#/components/schemas/DocumentMeta'\n- content:\n- type: object\n- labels:\n- $ref: '#/components/schemas/Labels'\n- links:\n- type: object\n- readOnly: true\n- example:\n- self: /api/v2/documents/templates/1\n- properties:\n- self:\n- description: The document URL.\n- $ref: '#/components/schemas/Link'\n- required:\n- - id\n- - meta\n- - content\n- DocumentCreate:\n- type: object\n- properties:\n- meta:\n- $ref: '#/components/schemas/DocumentMeta'\n- content:\n- type: object\n- org:\n- type: string\n- description: The organization Name. Specify either `orgID` or `org`.\n- orgID:\n- type: string\n- description: The organization Name. Specify either `orgID` or `org`.\n- labels:\n- type: array\n- description: An array of label IDs to be added as labels to the document.\n- items:\n- type: string\n- required:\n- - meta\n- - content\n- DocumentUpdate:\n- type: object\n- properties:\n- meta:\n- $ref: '#/components/schemas/DocumentMeta'\n- content:\n- type: object\n- DocumentListEntry:\n- type: object\n- properties:\n- id:\n- type: string\n- readOnly: true\n- meta:\n- $ref: '#/components/schemas/DocumentMeta'\n- labels:\n- $ref: '#/components/schemas/Labels'\n- links:\n- type: object\n- readOnly: true\n- example:\n- self: /api/v2/documents/templates/1\n- properties:\n- self:\n- description: The document URL.\n- $ref: '#/components/schemas/Link'\n- required:\n- - id\n- - meta\n- Documents:\n- type: object\n- properties:\n- documents:\n- type: array\n- items:\n- $ref: '#/components/schemas/DocumentListEntry'\nTelegrafRequest:\ntype: object\nproperties:\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): update oss swagger |
305,159 | 25.10.2021 18:01:16 | -7,200 | 2aefed81f28b3cddf69b639a1a6a559b3bfd263e | chore(docs): precise 1.8 compatibility warning | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "This repository contains the reference JavaScript client for InfluxDB 2.0. This client supports Node.js, browser, and Deno environments.\n-#### Note: Use this client library with InfluxDB 2.x and InfluxDB 1.8+. For connecting to InfluxDB 1.7 or earlier instances, see the [node-influx](https://github.com/node-influx/node-influx) client library.\n+#### Note: Use this client library with InfluxDB 2.x. For connecting to InfluxDB 1.x see the [node-influx](https://github.com/node-influx/node-influx) client library. This library can also write/query [flux-enabled](https://docs.influxdata.com/influxdb/v1.8/administration/config/#flux-enabled--false) InfluxDB 1.8+.\n## Documentation\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(docs): precise 1.8 compatibility warning |
305,159 | 26.10.2021 14:20:53 | -7,200 | 3e8114f076c42c9fbb46ebd7e20268b402055fba | feat(apis): update invocable scripts API | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/resources/invocable-scripts.yml",
"new_path": "packages/apis/resources/invocable-scripts.yml",
"diff": "openapi: 3.0.0\ninfo:\n- title: Influxdata API Invocable Scripts CRUD API\n+ title: InfluxData Invocable Scripts API\nversion: 0.1.0\n+ description: |\n+ Manage and execute scripts in InfluxDB.\n+ An API Invocable Script assigns your custom Flux script to a new InfluxDB API endpoint for your organization.\n+ Invocable scripts let you execute your script with an HTTP request to the endpoint.\n+ You can reference parameters in your script as `params.myparameter`.\n+ When you invoke your script, InfluxDB substitutes your `params` references with key-value pairs that you send in the `params` object.\n+\n+ For more information and examples, see [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invocable-scripts).\nservers:\n- url: /api/v2\npaths:\n@@ -9,24 +17,24 @@ paths:\nget:\noperationId: GetScripts\ntags:\n- - Scripts\n- summary: List all Scripts\n+ - Invocable Scripts\n+ summary: List scripts\nparameters:\n- in: query\nname: limit\n- description: The number of scripts to return\n+ description: The number of scripts to return.\nrequired: false\nschema:\ntype: integer\n- in: query\nname: offset\nrequired: false\n- description: Offset for pagination\n+ description: The offset for pagination.\nschema:\ntype: integer\nresponses:\n'200':\n- description: A list of scripts\n+ description: The list of scripts.\ncontent:\napplication/json:\nschema:\n@@ -37,10 +45,10 @@ paths:\npost:\noperationId: PostScripts\ntags:\n- - Scripts\n- summary: Create a new script\n+ - Invocable Scripts\n+ summary: Create a script\nrequestBody:\n- description: Script to create\n+ description: The script to create.\nrequired: true\ncontent:\napplication/json:\n@@ -48,7 +56,7 @@ paths:\n$ref: '#/components/schemas/ScriptCreateRequest'\nresponses:\n'201':\n- description: Script created\n+ description: The created script.\ncontent:\napplication/json:\nschema:\n@@ -60,8 +68,9 @@ paths:\nget:\noperationId: GetScriptsID\ntags:\n- - Scripts\n+ - Invocable Scripts\nsummary: Retrieve a script\n+ description: Uses script ID to retrieve details of an invocable script.\nparameters:\n- in: path\nname: scriptID\n@@ -71,7 +80,7 @@ paths:\ndescription: The script ID.\nresponses:\n'200':\n- description: Script details\n+ description: The requested script object.\ncontent:\napplication/json:\nschema:\n@@ -82,9 +91,10 @@ paths:\npatch:\noperationId: PatchScriptsID\ntags:\n- - Scripts\n+ - Invocable Scripts\nsummary: Update a script\n- description: Update a script\n+ description: |\n+ Updates properties (`name`, `description`, and `script`) of an invocable script.\nrequestBody:\ndescription: Script update to apply\nrequired: true\n@@ -101,7 +111,7 @@ paths:\ndescription: The script ID.\nresponses:\n'200':\n- description: Updated script\n+ description: The updated script.\ncontent:\napplication/json:\nschema:\n@@ -112,9 +122,9 @@ paths:\ndelete:\noperationId: DeleteScriptsID\ntags:\n- - Scripts\n+ - Invocable Scripts\nsummary: Delete a script\n- description: Deletes a script and all associated records\n+ description: Deletes a script and all associated records.\nparameters:\n- in: path\nname: scriptID\n@@ -124,7 +134,7 @@ paths:\ndescription: The ID of the script to delete.\nresponses:\n'204':\n- description: Script deleted\n+ description: The script is deleted.\ndefault:\ndescription: Unexpected error\n$ref: '#/components/responses/ServerError'\n@@ -132,8 +142,9 @@ paths:\npost:\noperationId: PostScriptsIDInvoke\ntags:\n- - Scripts\n- summary: Manually invoke a script with params in request body\n+ - Invocable Scripts\n+ summary: Invoke a script\n+ description: Invokes a script and substitutes `params` keys referenced in the script with `params` key-values sent in the request body.\nparameters:\n- in: path\nname: scriptID\n@@ -147,7 +158,7 @@ paths:\n$ref: '#/components/schemas/ScriptInvocationParams'\nresponses:\n'200':\n- description: Response defined by script\n+ description: The result of the script execution.\ncontent:\napplication/json:\nschema:\n@@ -241,11 +252,14 @@ components:\ntype: object\nproperties:\nname:\n+ description: The name of the script. The name must be unique within the organization.\ntype: string\ndescription:\ntype: string\n+ orgID:\n+ type: string\nscript:\n- description: script to be executed\n+ description: The script to execute.\ntype: string\nlanguage:\n$ref: '#/components/schemas/ScriptLanguage'\n@@ -266,7 +280,7 @@ components:\ndescription: script is script to be executed\ntype: string\nScriptHTTPResponseData:\n- description: The data sent to end user when a script is invoked using http. User defined and dynamic\n+ description: The data sent in the response body when a script is invoked by an HTTP request. User defined and dynamic.\ntype: string\nScriptInvocationParams:\ntype: object\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/resources/operations.json",
"new_path": "packages/apis/resources/operations.json",
"diff": "\"operation\": \"get\",\n\"operationId\": \"GetScripts\",\n\"basicAuth\": false,\n- \"summary\": \"List all Scripts\",\n+ \"summary\": \"List scripts\",\n\"positionalParams\": [],\n\"headerParams\": [],\n\"queryParams\": [\n{\n\"name\": \"limit\",\n- \"description\": \"The number of scripts to return\",\n+ \"description\": \"The number of scripts to return.\",\n\"required\": false,\n\"type\": \"number\"\n},\n{\n\"name\": \"offset\",\n- \"description\": \"Offset for pagination\",\n+ \"description\": \"The offset for pagination.\",\n\"required\": false,\n\"type\": \"number\"\n}\n\"responses\": [\n{\n\"code\": \"200\",\n- \"description\": \"A list of scripts\",\n+ \"description\": \"The list of scripts.\",\n\"mediaTypes\": [\n{\n\"mediaType\": \"application/json\",\n\"operation\": \"post\",\n\"operationId\": \"PostScripts\",\n\"basicAuth\": false,\n- \"summary\": \"Create a new script\",\n+ \"summary\": \"Create a script\",\n\"positionalParams\": [],\n\"headerParams\": [],\n\"queryParams\": [],\n\"bodyParam\": {\n- \"description\": \"Script to create\",\n+ \"description\": \"The script to create.\",\n\"required\": true,\n\"mediaType\": \"application/json\",\n\"type\": \"ScriptCreateRequest\"\n\"responses\": [\n{\n\"code\": \"201\",\n- \"description\": \"Script created\",\n+ \"description\": \"The created script.\",\n\"mediaTypes\": [\n{\n\"mediaType\": \"application/json\",\n\"responses\": [\n{\n\"code\": \"200\",\n- \"description\": \"Script details\",\n+ \"description\": \"The requested script object.\",\n\"mediaTypes\": [\n{\n\"mediaType\": \"application/json\",\n\"responses\": [\n{\n\"code\": \"200\",\n- \"description\": \"Updated script\",\n+ \"description\": \"The updated script.\",\n\"mediaTypes\": [\n{\n\"mediaType\": \"application/json\",\n\"responses\": [\n{\n\"code\": \"204\",\n- \"description\": \"Script deleted\",\n+ \"description\": \"The script is deleted.\",\n\"mediaTypes\": []\n},\n{\n\"operation\": \"post\",\n\"operationId\": \"PostScriptsIDInvoke\",\n\"basicAuth\": false,\n- \"summary\": \"Manually invoke a script with params in request body\",\n+ \"summary\": \"Invoke a script\",\n\"positionalParams\": [\n{\n\"name\": \"scriptID\",\n\"responses\": [\n{\n\"code\": \"200\",\n- \"description\": \"Response defined by script\",\n+ \"description\": \"The result of the script execution.\",\n\"mediaTypes\": [\n{\n\"mediaType\": \"application/json\",\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/ScriptsAPI.ts",
"new_path": "packages/apis/src/generated/ScriptsAPI.ts",
"diff": "@@ -10,13 +10,13 @@ import {\n} from './types'\nexport interface GetScriptsRequest {\n- /** The number of scripts to return */\n+ /** The number of scripts to return. */\nlimit?: number\n- /** Offset for pagination */\n+ /** The offset for pagination. */\noffset?: number\n}\nexport interface PostScriptsRequest {\n- /** Script to create */\n+ /** The script to create. */\nbody: ScriptCreateRequest\n}\nexport interface GetScriptsIDRequest {\n@@ -53,7 +53,7 @@ export class ScriptsAPI {\nthis.base = new APIBase(influxDB)\n}\n/**\n- * List all Scripts.\n+ * List scripts.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/GetScripts }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n@@ -71,7 +71,7 @@ export class ScriptsAPI {\n)\n}\n/**\n- * Create a new script.\n+ * Create a script.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostScripts }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n@@ -145,7 +145,7 @@ export class ScriptsAPI {\n)\n}\n/**\n- * Manually invoke a script with params in request body.\n+ * Invoke a script.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostScriptsIDInvoke }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/types.ts",
"new_path": "packages/apis/src/generated/types.ts",
"diff": "@@ -2877,9 +2877,11 @@ export interface Script {\nexport type ScriptLanguage = 'flux'\nexport interface ScriptCreateRequest {\n+ /** The name of the script. The name must be unique within the organization. */\nname: string\ndescription: string\n- /** script to be executed */\n+ orgID: string\n+ /** The script to execute. */\nscript: string\nlanguage: ScriptLanguage\n}\n@@ -2896,6 +2898,6 @@ export interface ScriptInvocationParams {\n}\n/**\n- * The data sent to end user when a script is invoked using http. User defined and dynamic\n+ * The data sent in the response body when a script is invoked by an HTTP request. User defined and dynamic.\n*/\nexport type ScriptHTTPResponseData = string\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(apis): update invocable scripts API |
305,159 | 03.11.2021 19:47:02 | -3,600 | 3eb44511f69f4373c959018f80265efe7c357f63 | chore: add type assertion | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/chunksToLines.ts",
"new_path": "packages/core/src/results/chunksToLines.ts",
"diff": "@@ -58,7 +58,7 @@ export function chunksToLines(\ntry {\nbufferReceived(chunk)\n} catch (e) {\n- this.error(e)\n+ this.error(e as Error)\n}\n},\nerror(error: Error): void {\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore: add type assertion |
305,159 | 09.11.2021 21:44:37 | -3,600 | 4218e3266d649d45894df803f94a6db756e0a897 | chore(core): rename internal Logger to Log | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/RetryBuffer.ts",
"new_path": "packages/core/src/impl/RetryBuffer.ts",
"diff": "-import {Logger} from '../util/logger'\n+import {Log} from '../util/logger'\n/* interval between successful retries */\nconst RETRY_INTERVAL = 1\n@@ -57,7 +57,7 @@ export default class RetryBuffer {\nthis.last = undefined\n}\n} while (this.first && this.size + lines.length > newSize)\n- Logger.error(\n+ Log.error(\n`RetryBuffer: ${origSize -\nthis\n.size} oldest lines removed to keep buffer size under the limit of ${\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/WriteApiImpl.ts",
"new_path": "packages/core/src/impl/WriteApiImpl.ts",
"diff": "@@ -6,7 +6,7 @@ import {\n} from '../options'\nimport {Transport, SendOptions} from '../transport'\nimport {Headers} from '../results'\n-import {Logger} from '../util/logger'\n+import {Log} from '../util/logger'\nimport {HttpError, RetryDelayStrategy} from '../errors'\nimport {Point} from '../Point'\nimport {escape} from '../util/escape'\n@@ -141,7 +141,7 @@ export default class WriteApiImpl implements WriteApi {\nif (!this.closed && lines.length > 0) {\nif (expires <= Date.now()) {\nconst error = new Error('Max retry time exceeded.')\n- Logger.error(\n+ Log.error(\n`Write to InfluxDB failed (attempt: ${failedAttempts}).`,\nerror\n)\n@@ -171,7 +171,7 @@ export default class WriteApiImpl implements WriteApi {\n(!(error instanceof HttpError) ||\n(error as HttpError).statusCode >= 429)\n) {\n- Logger.warn(\n+ Log.warn(\n`Write to InfluxDB failed (attempt: ${failedAttempts}).`,\nerror\n)\n@@ -184,7 +184,7 @@ export default class WriteApiImpl implements WriteApi {\nreject(error)\nreturn\n}\n- Logger.error(`Write to InfluxDB failed.`, error)\n+ Log.error(`Write to InfluxDB failed.`, error)\nreject(error)\n},\ncomplete(): void {\n@@ -265,7 +265,7 @@ export default class WriteApiImpl implements WriteApi {\nconst retVal = this.writeBuffer.flush().finally(() => {\nconst remaining = this.retryBuffer.close()\nif (remaining) {\n- Logger.error(\n+ Log.error(\n`Retry buffer closed with ${remaining} items that were not written to InfluxDB!`,\nnull\n)\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/browser/FetchTransport.ts",
"new_path": "packages/core/src/impl/browser/FetchTransport.ts",
"diff": "@@ -2,7 +2,7 @@ import {Transport, SendOptions} from '../../transport'\nimport {ConnectionOptions} from '../../options'\nimport {HttpError} from '../../errors'\nimport completeCommunicationObserver from '../completeCommunicationObserver'\n-import {Logger} from '../../util/logger'\n+import {Log} from '../../util/logger'\nimport {\nChunkCombiner,\nCommunicationObserver,\n@@ -50,7 +50,7 @@ export default class FetchTransport implements Transport {\n// don't allow /api/v2 suffix to avoid future problems\nif (this.url.endsWith('/api/v2')) {\nthis.url = this.url.substring(0, this.url.length - '/api/v2'.length)\n- Logger.warn(\n+ Log.warn(\n`Please remove '/api/v2' context path from InfluxDB base url, using ${this.url} !`\n)\n}\n@@ -109,7 +109,7 @@ export default class FetchTransport implements Transport {\n)\n})\n.catch((e: Error) => {\n- Logger.warn('Unable to receive error body', e)\n+ Log.warn('Unable to receive error body', e)\nobserver.error(\nnew HttpError(\nresponse.status,\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -16,7 +16,7 @@ import nodeChunkCombiner from './nodeChunkCombiner'\nimport zlib from 'zlib'\nimport completeCommunicationObserver from '../completeCommunicationObserver'\nimport {CLIENT_LIB_VERSION} from '../version'\n-import {Logger} from '../../util/logger'\n+import {Log} from '../../util/logger'\nconst zlibOptions = {\nflush: zlib.constants.Z_SYNC_FLUSH,\n@@ -71,7 +71,7 @@ export class NodeHttpTransport implements Transport {\n// https://github.com/influxdata/influxdb-client-js/issues/263\n// don't allow /api/v2 suffix to avoid future problems\nif (this.contextPath == '/api/v2') {\n- Logger.warn(\n+ Log.warn(\n`Please remove '/api/v2' context path from InfluxDB base url, using ${url.protocol}//${url.hostname}:${url.port} !`\n)\nthis.contextPath = ''\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/util/logger.ts",
"new_path": "packages/core/src/util/logger.ts",
"diff": "@@ -21,7 +21,7 @@ export const consoleLogger: Logger = {\n}\nlet provider: Logger = consoleLogger\n-export const Logger: Logger = {\n+export const Log: Logger = {\nerror(message, error) {\nprovider.error(message, error)\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/WriteApi.test.ts",
"new_path": "packages/core/test/unit/WriteApi.test.ts",
"diff": "@@ -12,7 +12,7 @@ import {\nPointSettings,\n} from '../../src'\nimport {collectLogging, CollectedLogs} from '../util'\n-import {Logger} from '../../src/util/logger'\n+import {Log} from '../../src/util/logger'\nimport {waitForCondition} from './util/waitForCondition'\nimport zlib from 'zlib'\n@@ -189,7 +189,7 @@ describe('WriteApi', () => {\nmaxRetries: 3,\nbatchSize: 1,\nwriteFailed: (error: Error, lines: string[], attempts: number) => {\n- Logger.warn(\n+ Log.warn(\n`CUSTOMERRORHANDLING ${!!error} ${lines.length} ${attempts}`,\nundefined\n)\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/util/logger.test.ts",
"new_path": "packages/core/test/unit/util/logger.test.ts",
"diff": "import {expect} from 'chai'\n-import {Logger, setLogger, consoleLogger} from '../../../src/util/logger'\n+import {Log, setLogger, consoleLogger} from '../../../src/util/logger'\ndescribe('Logger', () => {\n;[{message: ' hey', error: 'you'}, {message: ' hey'}].forEach(data => {\n@@ -15,7 +15,7 @@ describe('Logger', () => {\nconsoleLogger.warn(message, error)\n},\n})\n- Logger.error.call(Logger, data.message, data.error)\n+ Log.error.call(Log, data.message, data.error)\nexpect(args).to.be.deep.equal([data.message, data.error])\n})\nit(`uses custom logger's warn (${Object.keys(data).length})`, () => {\n@@ -31,7 +31,7 @@ describe('Logger', () => {\n},\n})\n- Logger.warn.call(Logger, data.message, data.error)\n+ Log.warn.call(Log, data.message, data.error)\nexpect(args).to.be.deep.equal([data.message, data.error])\n})\n})\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(core): rename internal Logger to Log |
305,159 | 10.11.2021 08:47:23 | -3,600 | d7684bb015493032ba0c10c775e676a22ea9919b | fix(core): remove undefined fields from request options | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -68,6 +68,13 @@ export class NodeHttpTransport implements Transport {\nthis.contextPath.length - 1\n)\n}\n+ // remove all undefined field to avoid node validation errors\n+ // https://github.com/influxdata/influxdb-client-js/issues/380\n+ Object.keys(this.defaultOptions).forEach(\n+ key =>\n+ this.defaultOptions[key] === undefined &&\n+ delete this.defaultOptions[key]\n+ )\n// https://github.com/influxdata/influxdb-client-js/issues/263\n// don't allow /api/v2 suffix to avoid future problems\nif (this.contextPath == '/api/v2') {\n@@ -304,7 +311,7 @@ export class NodeHttpTransport implements Transport {\n// Support older Nodes which don't allow `timeout` in the\n// request options\n/* istanbul ignore else support older node versions */\n- if (typeof req.setTimeout === 'function') {\n+ if (typeof req.setTimeout === 'function' && requestMessage.timeout) {\nreq.setTimeout(requestMessage.timeout)\n}\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": "@@ -122,6 +122,19 @@ describe('NodeHttpTransport', () => {\n],\n])\n})\n+ it('ignores undefined values', () => {\n+ const transport: any = new NodeHttpTransport({\n+ url: 'http://test:8086',\n+ timeout: undefined,\n+ })\n+ expect(transport.defaultOptions).to.deep.equal({\n+ hostname: 'test',\n+ port: '8086',\n+ protocol: 'http:',\n+ url: 'http://test:8086',\n+ })\n+ expect(transport.requestApi).to.equal(http.request)\n+ })\n})\ndescribe('send', () => {\nbeforeEach(() => {\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(core): remove undefined fields from request options |
305,159 | 14.11.2021 20:13:35 | -3,600 | 81ad5b756bbf75fec5efd61558a818a2ede900d9 | chore: improve doc remarks | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/index.ts",
"new_path": "packages/apis/src/index.ts",
"diff": "* @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+ * operations return Promise of response data, the majority of them relies upon simple exchange of JSON data.\n* For example:\n*\n* ```\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore: improve doc remarks |
305,159 | 15.11.2021 09:39:21 | -3,600 | 29369a3fdb1fdf5293753f58059082215b609229 | fix(core): do not parse empty JSON response | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -161,7 +161,11 @@ export class NodeHttpTransport implements Transport {\nconst responseType = options.headers?.accept ?? contentType\ntry {\nif (responseType.includes('json')) {\n+ if (buffer.length) {\nresolve(JSON.parse(buffer.toString('utf8')))\n+ } else {\n+ resolve(undefined)\n+ }\n} else if (\nresponseType.includes('text') ||\nresponseType.startsWith('application/csv')\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/impl/node/NodeHttpTransport.test.ts",
"new_path": "packages/core/test/unit/impl/node/NodeHttpTransport.test.ts",
"diff": "@@ -751,5 +751,20 @@ describe('NodeHttpTransport', () => {\n() => true // OK that it fails\n)\n})\n+ it(`return undefined when empty JSON message is received`, async () => {\n+ nock(transportOptions.url)\n+ .get('/test')\n+ .reply(200, '', {\n+ 'content-type': 'application/json',\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(undefined)\n+ })\n})\n})\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(core): do not parse empty JSON response |
305,159 | 15.11.2021 10:07:43 | -3,600 | facdd3bc21c5b88e1ee2890982ef1aa05af85b0a | fix(core): ignore body of 204 response | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -146,6 +146,7 @@ export class NodeHttpTransport implements Transport {\n}\nlet buffer = emptyBuffer\nlet contentType: string\n+ let responseStatusCode: number | undefined\nreturn new Promise((resolve, reject) => {\nthis.send(path, body as string, options, {\nresponseStarted(headers: Headers, statusCode?: number) {\n@@ -153,6 +154,7 @@ export class NodeHttpTransport implements Transport {\nresponseStarted(headers, statusCode)\n}\ncontentType = String(headers['content-type'])\n+ responseStatusCode = statusCode\n},\nnext: (data: Uint8Array): void => {\nbuffer = Buffer.concat([buffer, data])\n@@ -160,6 +162,10 @@ export class NodeHttpTransport implements Transport {\ncomplete: (): void => {\nconst responseType = options.headers?.accept ?? contentType\ntry {\n+ if (responseStatusCode === 204) {\n+ // ignore body of NO_CONTENT response\n+ resolve(undefined)\n+ }\nif (responseType.includes('json')) {\nif (buffer.length) {\nresolve(JSON.parse(buffer.toString('utf8')))\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": "@@ -766,5 +766,20 @@ describe('NodeHttpTransport', () => {\n})\nexpect(data).equals(undefined)\n})\n+ it(`return undefined with 204 status code`, async () => {\n+ nock(transportOptions.url)\n+ .get('/test')\n+ .reply(204, 'whatever it is', {\n+ 'content-type': 'text/plain',\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(undefined)\n+ })\n})\n})\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(core): ignore body of 204 response |
305,159 | 15.11.2021 11:10:28 | -3,600 | b172d1b09b954622faebdf6a7e63f25f5001fe12 | feat(examples): add invocableScript.js example | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "examples/invocableScripts.js",
"diff": "+#!/usr/bin/env node\n+/*\n+This example shows how to use API invocable scripts. See also\n+https://docs.influxdata.com/influxdb/cloud/api-guide/api-invocable-scripts/ .\n+*/\n+\n+const {InfluxDB, HttpError} = require('@influxdata/influxdb-client')\n+const {ScriptsAPI} = require('@influxdata/influxdb-client-apis')\n+const {url, token} = require('./env')\n+\n+const influxDB = new InfluxDB({url, token})\n+const scriptsAPI = new ScriptsAPI(influxDB)\n+const scriptName = 'example_generate_values'\n+\n+async function listScripts() {\n+ console.log('*** List scripts ***')\n+ // current scripts\n+ const scripts = await scriptsAPI.getScripts()\n+ console.log(scripts.scripts)\n+ return scripts\n+}\n+async function createScript() {\n+ console.log('*** Create example script ***')\n+ // current scripts\n+ const script = await scriptsAPI.postScripts({\n+ body: {\n+ script: `import \"generate\"\n+\n+ generate.from(\n+ count: int(v: params.count),\n+ fn: (n) => (n + 1) * (n + 2),\n+ start: 2021-01-01T00:00:00Z,\n+ stop: 2021-01-02T00:00:00Z,\n+ )`,\n+ description:\n+ 'This is an example script generated by a javascript client.',\n+ name: scriptName,\n+ language: 'flux',\n+ },\n+ })\n+ console.log(script)\n+ return script\n+}\n+async function deleteScript(id) {\n+ console.log('*** Delete example script ***')\n+ if (!id) {\n+ const scripts = (await scriptsAPI.getScripts()).scripts\n+ id = scripts.find(x => x.name === scriptName)?.id\n+ }\n+ if (id) {\n+ await scriptsAPI.deleteScriptsID({scriptID: id})\n+ console.log(`Script 'scipt_name' was deleted!`)\n+ }\n+}\n+\n+async function executeScript(scriptID) {\n+ console.log('*** Execute example script ***')\n+\n+ // parse count as a first script argument or use 10\n+ const count = Number.parseInt(require('process').argv[2] || '10')\n+\n+ // execute script with count parameter\n+ const params = {count: count}\n+ console.log('Script parameters: ', params)\n+ const response = await scriptsAPI.postScriptsIDInvoke({\n+ scriptID,\n+ body: {params},\n+ })\n+ console.log('Response:')\n+ console.log(response)\n+}\n+\n+async function example() {\n+ await listScripts()\n+ await deleteScript()\n+ const {id} = await createScript()\n+ await executeScript(id)\n+}\n+\n+example()\n+ .then(() => console.log('\\nFinished SUCCESS'))\n+ .catch(error => {\n+ if (error instanceof HttpError && error.statusCode === 404) {\n+ console.error(\n+ `API invocable scripts are not available in InfluxDB running at ${url} .`\n+ )\n+ console.error('Modify env.js with InfluxDB Cloud URL and token.')\n+ } else {\n+ console.error(error)\n+ }\n+ console.log('\\nFinished ERROR')\n+ })\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(examples): add invocableScript.js example |
305,159 | 15.11.2021 23:37:11 | -3,600 | cca17591195bb295865a408ec13a3ac2862cb934 | fea(core): extract CSV response processing from QueryApiImpl to AnnotatedCSVResponse | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/InfluxDB.ts",
"new_path": "packages/core/src/InfluxDB.ts",
"diff": "@@ -7,6 +7,8 @@ import {Transport} from './transport'\nimport TransportImpl from './impl/node/NodeHttpTransport'\nimport QueryApi, {QueryOptions} from './QueryApi'\nimport QueryApiImpl from './impl/QueryApiImpl'\n+import {AnnotatedCSVResponse, APIExecutor} from './results'\n+import {AnnotatedCSVResponseImpl} from './results/AnnotatedCSVResponseImpl'\n/**\n* InfluxDB 2.0 entry point that configures communication with InfluxDB server\n@@ -15,6 +17,7 @@ import QueryApiImpl from './impl/QueryApiImpl'\nexport default class InfluxDB {\nprivate _options: ClientOptions\nreadonly transport: Transport\n+ readonly processCSVResponse: (executor: APIExecutor) => AnnotatedCSVResponse\n/**\n* Creates influxdb client options from an options object or url.\n@@ -33,6 +36,8 @@ export default class InfluxDB {\nthrow new IllegalArgumentError('No url specified!')\nif (url.endsWith('/')) this._options.url = url.substring(0, url.length - 1)\nthis.transport = this._options.transport ?? new TransportImpl(this._options)\n+ this.processCSVResponse = (executor: APIExecutor): AnnotatedCSVResponse =>\n+ new AnnotatedCSVResponseImpl(executor, this.transport.chunkCombiner)\n}\n/**\n@@ -81,6 +86,6 @@ export default class InfluxDB {\n* @returns QueryApi instance\n*/\ngetQueryApi(org: string | QueryOptions): QueryApi {\n- return new QueryApiImpl(this.transport, org)\n+ return new QueryApiImpl(this.transport, this.processCSVResponse, org)\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/QueryApi.ts",
"new_path": "packages/core/src/QueryApi.ts",
"diff": "@@ -4,15 +4,9 @@ import {\nCommunicationObserver,\nFluxResultObserver,\nFluxTableMetaData,\n+ Row,\n} from './results'\n-export function defaultRowMapping(\n- values: string[],\n- tableMeta: FluxTableMetaData\n-): Record<string, any> {\n- return tableMeta.toObject(values)\n-}\n-\n/** QueryOptions contains QueryApi configuration options. */\nexport interface QueryOptions {\n/**\n@@ -38,12 +32,6 @@ export interface QueryOptions {\nheaders?: {[key: string]: string}\n}\n-/** Wraps values and associated metadata of a query result row */\n-export interface Row {\n- values: string[]\n- tableMeta: FluxTableMetaData\n-}\n-\n/**\n* Query InfluxDB 2.0. Provides methods that notify abouts result lines of the executed query.\n* See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostQuery }\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'\n-import QueryApi, {QueryOptions, Row, defaultRowMapping} from '../QueryApi'\n+import QueryApi, {QueryOptions} from '../QueryApi'\nimport {Transport} from '../transport'\n-import {chunksToLines} from '../results'\nimport {\nCommunicationObserver,\nFluxResultObserver,\nFluxTableMetaData,\n- linesToTables,\n+ Row,\n+ AnnotatedCSVResponse,\n} from '../results'\n-import ObservableQuery, {QueryExecutor} from './ObservableQuery'\nimport {ParameterizedQuery} from '../query/flux'\n+import {APIExecutor} from '../results/ObservableQuery'\nconst DEFAULT_dialect: any = {\nheader: true,\n@@ -18,96 +18,62 @@ const DEFAULT_dialect: any = {\ncommentPrefix: '#',\nannotations: ['datatype', 'group', 'default'],\n}\n-const identity = <T>(value: T): T => value\nexport class QueryApiImpl implements QueryApi {\nprivate options: QueryOptions\n- constructor(private transport: Transport, org: string | QueryOptions) {\n+ constructor(\n+ private transport: Transport,\n+ private createCSVResponse: (executor: APIExecutor) => AnnotatedCSVResponse,\n+ org: string | QueryOptions\n+ ) {\nthis.options = typeof org === 'string' ? {org} : org\n}\nwith(options: Partial<QueryOptions>): QueryApi {\n- return new QueryApiImpl(this.transport, {...this.options, ...options})\n+ return new QueryApiImpl(this.transport, this.createCSVResponse, {\n+ ...this.options,\n+ ...options,\n+ })\n+ }\n+\n+ response(query: string | ParameterizedQuery): AnnotatedCSVResponse {\n+ return this.createCSVResponse(this.createExecutor(query))\n}\nlines(query: string | ParameterizedQuery): Observable<string> {\n- return new ObservableQuery(this.createExecutor(query), identity)\n+ return this.response(query).lines()\n}\nrows(query: string | ParameterizedQuery): Observable<Row> {\n- return new ObservableQuery(this.createExecutor(query), observer => {\n- return linesToTables({\n- next(values, tableMeta) {\n- observer.next({values, tableMeta})\n- },\n- error(e) {\n- observer.error(e)\n- },\n- complete() {\n- observer.complete()\n- },\n- })\n- })\n+ return this.response(query).rows()\n}\nqueryLines(\nquery: string | ParameterizedQuery,\nconsumer: CommunicationObserver<string>\n): void {\n- this.createExecutor(query)(consumer)\n+ return this.response(query).consumeLines(consumer)\n}\nqueryRows(\nquery: string | ParameterizedQuery,\nconsumer: FluxResultObserver<string[]>\n): void {\n- this.createExecutor(query)(linesToTables(consumer))\n+ return this.response(query).consumeRows(consumer)\n}\ncollectRows<T>(\nquery: string | ParameterizedQuery,\n- rowMapper: (\n- values: string[],\n- tableMeta: FluxTableMetaData\n- ) => T | undefined = defaultRowMapping as (\n+ rowMapper?: (\nvalues: string[],\ntableMeta: 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+ return this.response(query).collectRows(rowMapper)\n}\ncollectLines(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+ return this.response(query).collectLines()\n}\nqueryRaw(query: string | ParameterizedQuery): Promise<string> {\n@@ -133,7 +99,7 @@ export class QueryApiImpl implements QueryApi {\n)\n}\n- private createExecutor(query: string | ParameterizedQuery): QueryExecutor {\n+ private createExecutor(query: string | ParameterizedQuery): APIExecutor {\nconst {org, type, gzip, headers} = this.options\nreturn (consumer): void => {\n@@ -154,7 +120,7 @@ export class QueryApiImpl implements QueryApi {\n...headers,\n},\n},\n- chunksToLines(consumer, this.transport.chunkCombiner)\n+ consumer\n)\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/index.ts",
"new_path": "packages/core/src/index.ts",
"diff": "@@ -37,5 +37,5 @@ export * from './transport'\nexport * from './observable'\nexport * from './Point'\nexport {default as InfluxDB} from './InfluxDB'\n-export {default as QueryApi, Row, QueryOptions} from './QueryApi'\n+export {default as QueryApi, QueryOptions} from './QueryApi'\nexport {default as WriteApi} from './WriteApi'\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/core/src/results/AnnotatedCSVResponse.ts",
"diff": "+import {Observable} from '../observable'\n+import {FluxTableMetaData, Row} from './FluxTableMetaData'\n+import {CommunicationObserver} from './CommunicationObserver'\n+import {FluxResultObserver} from './FluxResultObserver'\n+\n+/**\n+ * AnnotatedCSVResponse represents an annotated CSV response,\n+ * which is returned as a result of a flux script execution.\n+ */\n+export interface AnnotatedCSVResponse {\n+ /**\n+ * Lines creates a cold observable of the CSV response lines.\n+ * @returns observable of CSV result lines\n+ */\n+ lines(): Observable<string>\n+ /**\n+ * Rows creates a cold observable of the CSV response rows.\n+ * @returns observable of CSV result rows\n+ */\n+ rows(): Observable<Row>\n+ /**\n+ * ConsumesLines consumes 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+ * @param consumer - csv result lines and error consumer\n+ */\n+ consumeLines(consumer: CommunicationObserver<string>): void\n+ /**\n+ * ConsumeRows consumes result rows through the supplied consumer.\n+ *\n+ * @param consumer - csv result lines and error consumer\n+ */\n+ consumeRows(consumer: FluxResultObserver<string[]>): void\n+ /**\n+ * CollectRows collects all the result rows 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 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+ */\n+ collectRows<T>(\n+ rowMapper?: (\n+ values: string[],\n+ tableMeta: FluxTableMetaData\n+ ) => T | undefined\n+ ): Promise<Array<T>>\n+\n+ /**\n+ * CollectLines 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+ * @returns Promise of returned csv lines\n+ */\n+ collectLines(): Promise<Array<string>>\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/core/src/results/AnnotatedCSVResponseImpl.ts",
"diff": "+import {\n+ CommunicationObserver,\n+ FluxResultObserver,\n+ FluxTableMetaData,\n+ Row,\n+ linesToTables,\n+ ChunkCombiner,\n+ chunksToLines,\n+} from '../results'\n+import {Observable} from '../observable'\n+import {AnnotatedCSVResponse} from './AnnotatedCSVResponse'\n+import ObservableQuery, {APIExecutor} from './ObservableQuery'\n+\n+export function defaultRowMapping(\n+ values: string[],\n+ tableMeta: FluxTableMetaData\n+): Record<string, any> {\n+ return tableMeta.toObject(values)\n+}\n+\n+/**\n+ * AnnotatedCsvResponseImpl is an implementation AnnotatedCsvResponse\n+ * that uses the supplied executor to parse results.\n+ */\n+export class AnnotatedCSVResponseImpl implements AnnotatedCSVResponse {\n+ constructor(\n+ private executor: APIExecutor,\n+ private chunkCombiner: ChunkCombiner\n+ ) {}\n+ lines(): Observable<string> {\n+ return new ObservableQuery(this.executor, observer =>\n+ chunksToLines(observer, this.chunkCombiner)\n+ )\n+ }\n+\n+ rows(): Observable<Row> {\n+ return new ObservableQuery(this.executor, observer => {\n+ return chunksToLines(\n+ linesToTables({\n+ next(values, tableMeta) {\n+ observer.next({values, tableMeta})\n+ },\n+ error(e) {\n+ observer.error(e)\n+ },\n+ complete() {\n+ observer.complete()\n+ },\n+ }),\n+ this.chunkCombiner\n+ )\n+ })\n+ }\n+\n+ consumeLines(consumer: CommunicationObserver<string>): void {\n+ this.executor(chunksToLines(consumer, this.chunkCombiner))\n+ }\n+\n+ consumeRows(consumer: FluxResultObserver<string[]>): void {\n+ this.executor(chunksToLines(linesToTables(consumer), this.chunkCombiner))\n+ }\n+\n+ collectRows<T>(\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.consumeRows({\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(): Promise<Array<string>> {\n+ const retVal: Array<string> = []\n+ return new Promise((resolve, reject) => {\n+ this.consumeLines({\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+}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/FluxTableMetaData.ts",
"new_path": "packages/core/src/results/FluxTableMetaData.ts",
"diff": "@@ -123,3 +123,9 @@ export function createFluxTableMetaData(\n): FluxTableMetaData {\nreturn new FluxTableMetaDataImpl(columns)\n}\n+\n+/** Wraps values and associated metadata of a query result row */\n+export interface Row {\n+ values: string[]\n+ tableMeta: FluxTableMetaData\n+}\n"
},
{
"change_type": "RENAME",
"old_path": "packages/core/src/impl/ObservableQuery.ts",
"new_path": "packages/core/src/results/ObservableQuery.ts",
"diff": "@@ -7,17 +7,19 @@ import {\nSubscription,\nsymbolObservable,\n} from '../observable'\n-import {Cancellable, CommunicationObserver} from '../results'\n+import {CommunicationObserver} from '../results/CommunicationObserver'\n+import {Cancellable} from '../results/Cancellable'\n-export type QueryExecutor = (consumer: CommunicationObserver<string>) => void\n+/** APIExecutor executes the API and passes its response to the supplied consumer */\n+export type APIExecutor = (consumer: CommunicationObserver<Uint8Array>) => void\n-type Decorator<T> = (observer: Observer<T>) => Observer<string>\n+type Decorator<T> = (observer: Observer<T>) => Observer<Uint8Array>\nclass QuerySubscription implements Subscription {\nprivate cancellable?: Cancellable\nprivate isClosed = false\n- public constructor(observer: Observer<string>, executor: QueryExecutor) {\n+ public constructor(observer: Observer<Uint8Array>, executor: APIExecutor) {\ntry {\nexecutor({\nnext: value => {\n@@ -65,7 +67,7 @@ function completeObserver<T>(observer: Partial<Observer<T>>): Observer<T> {\nexport default class ObservableQuery<T> implements Observable<T> {\npublic constructor(\n- private readonly executor: QueryExecutor,\n+ private readonly executor: APIExecutor,\nprivate readonly decorator: Decorator<T>\n) {}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/index.ts",
"new_path": "packages/core/src/results/index.ts",
"diff": "@@ -8,3 +8,5 @@ export * from './FluxTableMetaData'\nexport * from './FluxResultObserver'\nexport * from './FluxTableColumn'\nexport * from './stringToLines'\n+export * from './AnnotatedCSVResponse'\n+export {APIExecutor} from './ObservableQuery'\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/impl/ObservableQuery.test.ts",
"new_path": "packages/core/test/unit/impl/ObservableQuery.test.ts",
"diff": "import {expect} from 'chai'\n-import ObservableQuery from '../../../src/impl/ObservableQuery'\n-import {CommunicationObserver} from '../../../src'\n+import ObservableQuery from '../../../src/results/ObservableQuery'\n+import {chunksToLines, CommunicationObserver} from '../../../src'\nimport completeCommunicationObserver from '../../../src/impl/completeCommunicationObserver'\nimport {Observer} from '../../../src/observable'\n@@ -17,53 +17,55 @@ class TestSubscriber implements Observer<string> {\n}\n}\n+const encoder = new TextEncoder()\n+\ndescribe('ObservableQuery', () => {\nit('sequence complete', async () => {\n- let source: CommunicationObserver<string> = completeCommunicationObserver(\n+ let source: CommunicationObserver<Uint8Array> = completeCommunicationObserver(\n{}\n) // source is assigned by subject.subscribe\nconst subject = new ObservableQuery<string>(\nconsumer => (source = consumer),\n- x => x\n+ x => chunksToLines(x)\n)\nconst subscriber = new TestSubscriber()\nconst subscription = subject.subscribe(subscriber)\nexpect(subscription.closed).deep.equals(false)\n- source.next('next')\n- source.next('next')\n+ source.next(encoder.encode('next\\n'))\n+ source.next(encoder.encode('next\\n'))\nsource.complete()\nexpect(subscription.closed).equals(true)\nexpect(['next', 'next', 'complete']).deep.equals(subscriber.results)\n})\nit('sequence error', async () => {\n- let source: CommunicationObserver<string> = completeCommunicationObserver(\n+ let source: CommunicationObserver<Uint8Array> = completeCommunicationObserver(\n{}\n)\nconst subject = new ObservableQuery<string>(\nconsumer => (source = consumer),\n- x => x\n+ x => chunksToLines(x)\n)\nconst subscriber = new TestSubscriber()\nconst subscription = subject.subscribe(subscriber)\nexpect(subscription.closed).equals(false)\n- source.next('next')\n- source.next('next')\n+ source.next(encoder.encode('next\\n'))\n+ source.next(encoder.encode('next\\n'))\nsource.error(new Error())\nexpect(subscription.closed).equals(true)\nexpect(['next', 'next', 'error']).deep.equals(subscriber.results)\n})\nit('unsubscribed', async () => {\n- let source: CommunicationObserver<string> = completeCommunicationObserver(\n+ let source: CommunicationObserver<Uint8Array> = completeCommunicationObserver(\n{}\n)\nconst subject = new ObservableQuery<string>(\nconsumer => (source = consumer),\n- x => x\n+ x => chunksToLines(x)\n)\nconst subscriber = new TestSubscriber()\nconst subscription = subject.subscribe(subscriber)\nexpect(subscription.closed).equals(false)\n- source.next('next')\n+ source.next(encoder.encode('next\\n'))\nsubscription.unsubscribe()\nexpect(subscription.closed).equals(true)\nexpect(['next']).deep.equals(subscriber.results)\n@@ -73,7 +75,7 @@ describe('ObservableQuery', () => {\n() => {\nthrow new Error()\n},\n- x => x\n+ x => chunksToLines(x)\n)\nconst subscriber = new TestSubscriber()\nconst subscription = subject.subscribe(subscriber)\n@@ -81,26 +83,26 @@ describe('ObservableQuery', () => {\nexpect(['error']).deep.equals(subscriber.results)\n})\nit('subscriber methods are optional', async () => {\n- let source: CommunicationObserver<string> = completeCommunicationObserver(\n+ let source: CommunicationObserver<Uint8Array> = completeCommunicationObserver(\n{}\n) // source is assigned by subject.subscribe\nconst subject = new ObservableQuery<string>(\nconsumer => (source = consumer),\n- x => x\n+ x => chunksToLines(x)\n)\nconst s1 = subject.subscribe({})\n- source.next('next')\n+ source.next(encoder.encode('next\\n'))\nsource.complete()\nexpect(s1.closed).equals(true)\nconst s2 = subject.subscribe((null as any) as Observer<string>)\n- source.next('next')\n+ source.next(encoder.encode('next\\n'))\nsource.error(new Error())\nexpect(s2.closed).equals(true)\nlet called = false\nconst s3 = subject.subscribe(_ => (called = true))\n- source.next('next')\n+ source.next(encoder.encode('next\\n'))\nsource.complete()\nexpect(called).equals(true)\nexpect(s3.closed).equals(true)\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fea(core): extract CSV response processing from QueryApiImpl to AnnotatedCSVResponse |
305,159 | 15.11.2021 23:43:30 | -3,600 | 16753a4a6ef1963c2603ad389c9123842acfda6b | feat(api): introduce FluxScriptInvocationAPI | [
{
"change_type": "MODIFY",
"old_path": "examples/invocableScripts.js",
"new_path": "examples/invocableScripts.js",
"diff": "@@ -5,7 +5,10 @@ https://docs.influxdata.com/influxdb/cloud/api-guide/api-invocable-scripts/ .\n*/\nconst {InfluxDB, HttpError} = require('@influxdata/influxdb-client')\n-const {ScriptsAPI} = require('@influxdata/influxdb-client-apis')\n+const {\n+ ScriptsAPI,\n+ FluxScriptInvocationAPI,\n+} = require('@influxdata/influxdb-client-apis')\nconst {url, token} = require('./env')\nconst influxDB = new InfluxDB({url, token})\n@@ -49,12 +52,12 @@ async function deleteScript(id) {\n}\nif (id) {\nawait scriptsAPI.deleteScriptsID({scriptID: id})\n- console.log(`Script 'scipt_name' was deleted!`)\n+ console.log(`Script ${scriptName} was deleted!`)\n}\n}\n-async function executeScript(scriptID) {\n- console.log('*** Execute example script ***')\n+async function invokeScript(scriptID) {\n+ console.log('*** Invoke example script ***')\n// parse count as a first script argument or use 10\nconst count = Number.parseInt(require('process').argv[2] || '10')\n@@ -62,19 +65,42 @@ async function executeScript(scriptID) {\n// execute script with count parameter\nconst params = {count: count}\nconsole.log('Script parameters: ', params)\n- const response = await scriptsAPI.postScriptsIDInvoke({\n- scriptID,\n- body: {params},\n+ // Use FluxScriptInvocationAPI to execute a particular\n+ // script with specified parametes and process parsed results\n+ const invocationAPI = new FluxScriptInvocationAPI(influxDB)\n+ await new Promise((accept, reject) => {\n+ let count = 0\n+ invocationAPI.invoke(scriptID, params).consumeRows({\n+ complete: accept,\n+ error: reject,\n+ next(row, tableMetaData) {\n+ count++\n+ // console.log(tableMetaData.toObject(row))\n+ console.log(\n+ count,\n+ '*',\n+ count + 1,\n+ '=',\n+ row[tableMetaData.column('_value').index]\n+ )\n+ },\n+ })\n})\n- console.log('Response:')\n- console.log(response)\n+ // You can also receive the whole response body. Use with caution,\n+ // a possibly huge stream of results is copied to memory.\n+ // const response = await scriptsAPI.postScriptsIDInvoke({\n+ // scriptID,\n+ // body: {params},\n+ // })\n+ // console.log('Response:')\n+ // console.log(response)\n}\nasync function example() {\nawait listScripts()\nawait deleteScript()\nconst {id} = await createScript()\n- await executeScript(id)\n+ await invokeScript(id)\n}\nexample()\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/apis/src/custom/FluxScriptInvocationAPI.ts",
"diff": "+import {\n+ InfluxDB,\n+ Transport,\n+ AnnotatedCSVResponse,\n+ APIExecutor,\n+} from '@influxdata/influxdb-client'\n+\n+/** ExecutionOptions contains execution options for a flux script. */\n+export interface ExecutionOptions {\n+ /**\n+ * Requests gzip encoded response.\n+ */\n+ gzip?: boolean\n+ /**\n+ * HTTP headers that will be sent with every query request.\n+ */\n+ headers?: {[key: string]: string}\n+}\n+\n+/**\n+ * FluxScriptInvocationAPI executes flux 'API invocable script' and parses the result CSV annotated data.\n+ * See https://docs.influxdata.com/influxdb/cloud/api-guide/api-invocable-scripts/ .\n+ */\n+export class FluxScriptInvocationAPI {\n+ // internal\n+ private transport: Transport\n+ private processCSVResponse: (supplier: APIExecutor) => AnnotatedCSVResponse\n+ private options: ExecutionOptions\n+\n+ /**\n+ * Creates FluxScriptInvocationAPI with the supplied InfluxDB instance and a particular script identifier.\n+ * @param influxDB - an instance that knows how to communicate with InfluxDB server\n+ * @param options - script execution options\n+ */\n+ constructor(influxDB: InfluxDB, options?: ExecutionOptions) {\n+ this.transport = influxDB.transport\n+ this.processCSVResponse = influxDB.processCSVResponse\n+ this.options = {...options}\n+ }\n+\n+ /**\n+ * Invoke calls an API invocable script and returns a parsed response.\n+ * @param scriptID - script identified\n+ * @param params - script parameters\n+ * @returns annotated CSV response\n+ */\n+ invoke(scriptID: string, params?: Record<string, any>): AnnotatedCSVResponse {\n+ return this.processCSVResponse(this.createExecutor(scriptID, params))\n+ }\n+\n+ private createExecutor(\n+ scriptID: string,\n+ params: Record<string, any> | undefined\n+ ): APIExecutor {\n+ const {gzip, headers} = this.options\n+\n+ return (consumer): void => {\n+ this.transport.send(\n+ `/api/v2/scripts/${scriptID}/invoke`,\n+ JSON.stringify({\n+ params: {...params},\n+ }),\n+ {\n+ method: 'POST',\n+ headers: {\n+ 'content-type': 'application/json; encoding=utf-8',\n+ 'accept-encoding': gzip ? 'gzip' : 'identity',\n+ ...headers,\n+ },\n+ },\n+ consumer\n+ )\n+ }\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/apis/src/custom/index.ts",
"diff": "+export * from './FluxScriptInvocationAPI'\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/index.ts",
"new_path": "packages/apis/src/index.ts",
"diff": "*/\nexport * from './generated'\nexport {RequestOptions} from './APIBase'\n+export * from './custom'\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(api): introduce FluxScriptInvocationAPI |
305,159 | 16.11.2021 06:51:12 | -3,600 | 808f00b7727f5e4ebfaa8510be555b530f51fd0d | feat(core): add response method to QueryApi | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/QueryApi.ts",
"new_path": "packages/core/src/QueryApi.ts",
"diff": "import {Observable} from './observable'\nimport {ParameterizedQuery} from './query'\nimport {\n+ AnnotatedCSVResponse,\nCommunicationObserver,\nFluxResultObserver,\nFluxTableMetaData,\n@@ -44,6 +45,16 @@ export default interface QueryApi {\n*/\nwith(options: Partial<QueryOptions>): QueryApi\n+ /**\n+ * Response returns an AnnotatedCSVResponse instance that executes\n+ * the query and provides various ways of how to process data\n+ * from an annotated CSV response stream.\n+ *\n+ * @param query - query\n+ * @returns observable of result rows\n+ */\n+ response(query: string | ParameterizedQuery): AnnotatedCSVResponse\n+\n/**\n* Creates a cold observable of the lines returned by the given query.\n*\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/AnnotatedCSVResponse.ts",
"new_path": "packages/core/src/results/AnnotatedCSVResponse.ts",
"diff": "@@ -4,7 +4,8 @@ import {CommunicationObserver} from './CommunicationObserver'\nimport {FluxResultObserver} from './FluxResultObserver'\n/**\n- * AnnotatedCSVResponse represents an annotated CSV response,\n+ * AnnotatedCSVResponse provides various ways of how to\n+ * process data from an annotated CSV response stream,\n* which is returned as a result of a flux script execution.\n*/\nexport interface AnnotatedCSVResponse {\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/AnnotatedCSVResponseImpl.ts",
"new_path": "packages/core/src/results/AnnotatedCSVResponseImpl.ts",
"diff": "@@ -20,7 +20,7 @@ export function defaultRowMapping(\n/**\n* AnnotatedCsvResponseImpl is an implementation AnnotatedCsvResponse\n- * that uses the supplied executor to parse results.\n+ * that uses the supplied executor to supply a response data stream.\n*/\nexport class AnnotatedCSVResponseImpl implements AnnotatedCSVResponse {\nconstructor(\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): add response method to QueryApi |
305,159 | 16.11.2021 07:01:31 | -3,600 | 795f6593c28aa5e707e927ffa6d3f01a46592e3f | feat: expose QueryApi.response | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/custom/FluxScriptInvocationAPI.ts",
"new_path": "packages/apis/src/custom/FluxScriptInvocationAPI.ts",
"diff": "@@ -3,6 +3,7 @@ import {\nTransport,\nAnnotatedCSVResponse,\nAPIExecutor,\n+ CommunicationObserver,\n} from '@influxdata/influxdb-client'\n/** ExecutionOptions contains execution options for a flux script. */\n@@ -39,10 +40,12 @@ export class FluxScriptInvocationAPI {\n}\n/**\n- * Invoke calls an API invocable script and returns a parsed response.\n- * @param scriptID - script identified\n+ * Invoke returns a parsed response data stream that executes\n+ * the supplied script when asked for data.\n+ * @param scriptID - script identifier\n* @param params - script parameters\n- * @returns annotated CSV response\n+ * @returns response with various methods to process data from the returned annotated\n+ * CSV response data stream\n*/\ninvoke(scriptID: string, params?: Record<string, any>): AnnotatedCSVResponse {\nreturn this.processCSVResponse(this.createExecutor(scriptID, params))\n@@ -54,7 +57,7 @@ export class FluxScriptInvocationAPI {\n): APIExecutor {\nconst {gzip, headers} = this.options\n- return (consumer): void => {\n+ return (consumer: CommunicationObserver<Uint8Array>): void => {\nthis.transport.send(\n`/api/v2/scripts/${scriptID}/invoke`,\nJSON.stringify({\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/QueryApi.ts",
"new_path": "packages/core/src/QueryApi.ts",
"diff": "@@ -47,11 +47,11 @@ export default interface QueryApi {\n/**\n* Response returns an AnnotatedCSVResponse instance that executes\n- * the query and provides various ways of how to process data\n- * from an annotated CSV response stream.\n+ * the query when asked for data.\n*\n* @param query - query\n- * @returns observable of result rows\n+ * @returns response with various methods to process data from the returned annotated\n+ * CSV response data stream\n*/\nresponse(query: string | ParameterizedQuery): AnnotatedCSVResponse\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat: expose QueryApi.response |
305,159 | 16.11.2021 08:15:45 | -3,600 | c369b5d351a2690f23d1380ea148890becc4140b | feat(apis): add FluxScriptInvocationAPI tests | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/package.json",
"new_path": "packages/apis/package.json",
"diff": "\"eslint-plugin-prettier\": \"^3.1.1\",\n\"eslint-plugin-tsdoc\": \"^0.2.6\",\n\"mocha\": \"^6.2.2\",\n+ \"nock\": \"^11.7.0\",\n\"prettier\": \"^1.19.1\",\n\"rimraf\": \"^3.0.0\",\n\"rollup\": \"^2.33.3\",\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/apis/test/unit/custom/FluxScriptInvocationAPI.test.ts",
"diff": "+import {expect} from 'chai'\n+import nock from 'nock' // WARN: nock must be imported before NodeHttpTransport, since it modifies node's http\n+import {InfluxDB} from '@influxdata/influxdb-client'\n+import {FluxScriptInvocationAPI} from '../../../src/custom/FluxScriptInvocationAPI'\n+import {Readable} from 'stream'\n+import zlib from 'zlib'\n+\n+const fakeUrl = 'http://fake:8086'\n+const fakeToken = 'a'\n+const fakeResponseLines = [\n+ ',result,table,_time,_value',\n+ ',_result,0,2021-01-01T00:00:00Z,2',\n+ ',_result,0,2021-01-01T02:24:00Z,6',\n+]\n+const fakeResponse = fakeResponseLines.join('\\n')\n+const fakeScriptID = 'TEST_SCRIPT_ID'\n+const influxDB = new InfluxDB({url: fakeUrl, token: fakeToken})\n+\n+describe('FluxScriptInvocationAPI', () => {\n+ beforeEach(() => {\n+ nock.disableNetConnect()\n+ })\n+ afterEach(() => {\n+ nock.cleanAll()\n+ nock.enableNetConnect()\n+ })\n+ it('receives lines', async () => {\n+ const subject = new FluxScriptInvocationAPI(influxDB)\n+ let body, authorization: any\n+ nock(fakeUrl)\n+ .post(`/api/v2/scripts/${fakeScriptID}/invoke`)\n+ .reply(function(_uri, requestBody) {\n+ body = requestBody\n+ authorization = this.req.headers.authorization\n+ return [200, fakeResponse]\n+ })\n+ .persist()\n+ const lines = await subject.invoke(fakeScriptID, {hi: 'Bob'}).collectLines()\n+ expect(lines).to.deep.equal(fakeResponseLines)\n+ expect(body).to.deep.equal({params: {hi: 'Bob'}})\n+ expect(authorization).equals(`Token ${fakeToken}`)\n+ })\n+ it('can provide custom headers', async () => {\n+ const subject = new FluxScriptInvocationAPI(influxDB, {\n+ headers: {whatever: 'it is'},\n+ })\n+ let customHeader: any\n+ nock(fakeUrl)\n+ .post(`/api/v2/scripts/${fakeScriptID}/invoke`)\n+ .reply(function(_uri) {\n+ customHeader = this.req.headers.whatever\n+ return [200, fakeResponse, {'content-type': 'text/csv'}]\n+ })\n+ .persist()\n+ const lines = await subject.invoke(fakeScriptID).collectLines()\n+ expect(lines).to.deep.equal(fakeResponseLines)\n+ expect(customHeader).equals('it is')\n+ })\n+ it('can request gzip encoding', async () => {\n+ const subject = new FluxScriptInvocationAPI(influxDB, {\n+ gzip: true,\n+ })\n+ let acceptEncoding: any\n+ nock(fakeUrl)\n+ .post(`/api/v2/scripts/${fakeScriptID}/invoke`)\n+ .reply(function(_uri) {\n+ acceptEncoding = this.req.headers['accept-encoding']\n+ return [\n+ 200,\n+ Readable.from([Buffer.from(fakeResponse)]).pipe(zlib.createGzip()),\n+ {'content-encoding': 'gzip', 'content-type': 'text/csv'},\n+ ]\n+ })\n+ .persist()\n+ const lines = await subject.invoke(fakeScriptID).collectLines()\n+ expect(lines).to.deep.equal(fakeResponseLines)\n+ expect(acceptEncoding).equals('gzip')\n+ })\n+})\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(apis): add FluxScriptInvocationAPI tests |
305,159 | 16.11.2021 19:15:43 | -3,600 | 73053fff5ba13f4e21fa442161ed4fc642f6062a | chore(apis): update InfluxDB API version to 2.1 | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/DEVELOPMENT.md",
"new_path": "packages/apis/DEVELOPMENT.md",
"diff": "# influxdb-client-apis\n-Contains generated client APIs for InfluxDB v2.0. See https://github.com/influxdata/influxdb-client-js to know more.\n+Contains generated client APIs for InfluxDB v2.1. See https://github.com/influxdata/influxdb-client-js to know more.\n## Build\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/README.md",
"new_path": "packages/apis/README.md",
"diff": "# @influxdata/influxdb-client-apis\n-Contains client APIs for InfluxDB v2.0. See https://github.com/influxdata/influxdb-client-js to know more.\n+Contains client APIs for InfluxDB v2.1. See https://github.com/influxdata/influxdb-client-js to know more.\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): update InfluxDB API version to 2.1 |
305,159 | 16.11.2021 19:16:29 | -3,600 | bf0c357eafd25ab974431c9bd75c0818978b2793 | chore(apis): update API generator to create correct cloud/v2.1 links | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/generator/generateApi.ts",
"new_path": "packages/apis/generator/generateApi.ts",
"diff": "@@ -91,6 +91,14 @@ function requestRequired(operation: Operation): boolean {\nreturn false\n}\n+const CLOUD_APIS = ['ScriptsAPI']\n+function apiDocLink(apiName: string, opID: string): string {\n+ if (CLOUD_APIS.includes(apiName)) {\n+ return `https://docs.influxdata.com/influxdb/cloud/api/#operation/${opID}`\n+ }\n+ return `https://docs.influxdata.com/influxdb/v2.1/api/#operation/${opID}`\n+}\n+\nfunction generateClass(\napiKey: string,\napiName: string,\n@@ -127,7 +135,7 @@ export class ${apiName} {\nclassDef += '\\n /**'\n}\nclassDef += `\n- * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/${opId} }\n+ * See {@link ${apiDocLink(apiName, opId)} }\n* @param request - request parameters and body (if supported)\n* @param requestOptions - optional transport options\n* @returns promise of response\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): update API generator to create correct cloud/v2.1 links |
305,159 | 16.11.2021 19:23:01 | -3,600 | 74d92031fc4550648a0874cc2caec810271706f8 | chore(core): update links to point to v2.1 doc | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/InfluxDB.ts",
"new_path": "packages/core/src/InfluxDB.ts",
"diff": "@@ -11,7 +11,7 @@ import {AnnotatedCSVResponse, APIExecutor} from './results'\nimport {AnnotatedCSVResponseImpl} from './results/AnnotatedCSVResponseImpl'\n/**\n- * InfluxDB 2.0 entry point that configures communication with InfluxDB server\n+ * InfluxDB entry point that configures communication with InfluxDB server\n* and provide APIs to write and query data.\n*/\nexport default class InfluxDB {\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/QueryApi.ts",
"new_path": "packages/core/src/QueryApi.ts",
"diff": "@@ -34,8 +34,8 @@ export interface QueryOptions {\n}\n/**\n- * Query InfluxDB 2.0. Provides methods that notify abouts result lines of the executed query.\n- * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostQuery }\n+ * Query InfluxDB. Provides methods that notify about result lines of the executed query.\n+ * See {@link https://docs.influxdata.com/influxdb/v2.1/api/#operation/PostQuery }\n*/\nexport default interface QueryApi {\n/**\n@@ -73,7 +73,7 @@ export default interface QueryApi {\n/**\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+ * through the supplied consumer. See [annotated-csv](https://docs.influxdata.com/influxdb/v2.1/reference/syntax/annotated-csv/).\n*\n* @param query - query\n* @param consumer - csv result lines and error consumer\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/WriteApi.ts",
"new_path": "packages/core/src/WriteApi.ts",
"diff": "import {Point, PointSettings} from './Point'\n/**\n- * The asynchronous buffering API to Write time-series data into InfluxDB 2.0.\n+ * The asynchronous buffering API to Write time-series data into InfluxDB.\n* This API always buffers points/lines to create batches under the hood\n* to optimize data transfer to InfluxDB server, use `flush` to send\n* the buffered data to InfluxDB immediately.\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/QueryApiImpl.ts",
"new_path": "packages/core/src/impl/QueryApiImpl.ts",
"diff": "@@ -128,7 +128,7 @@ export class QueryApiImpl implements QueryApi {\nif (typeof this.options.now === 'function') {\nrequest.now = this.options.now()\n}\n- // https://v2.docs.influxdata.com/v2.0/api/#operation/PostQuery requires type\n+ // https://docs.influxdata.com/influxdb/v2.1/api/#operation/PostQuery requires type\nrequest.type = this.options.type ?? 'flux'\nreturn request\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/AnnotatedCSVResponse.ts",
"new_path": "packages/core/src/results/AnnotatedCSVResponse.ts",
"diff": "@@ -21,7 +21,7 @@ export interface AnnotatedCSVResponse {\nrows(): Observable<Row>\n/**\n* ConsumesLines consumes 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+ * through the supplied consumer. See [annotated-csv](https://docs.influxdata.com/influxdb/v2.1/reference/syntax/annotated-csv/).\n* @param consumer - csv result lines and error consumer\n*/\nconsumeLines(consumer: CommunicationObserver<string>): void\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/FluxTableColumn.ts",
"new_path": "packages/core/src/results/FluxTableColumn.ts",
"diff": "/**\n- * Type of query result column, see {@link https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/#valid-data-types }\n+ * Type of query result column, see {@link https://docs.influxdata.com/influxdb/v2.1/reference/syntax/annotated-csv/#data-types }\n*/\nexport type ColumnType =\n| 'boolean'\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/FluxTableMetaData.ts",
"new_path": "packages/core/src/results/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 {@link https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/#valid-data-types }\n+ * See {@link https://docs.influxdata.com/influxdb/v2.1/reference/syntax/annotated-csv/#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(core): update links to point to v2.1 doc |
305,159 | 16.11.2021 19:35:05 | -3,600 | 6ccd8e81f0d467423ce7fa583a6cbf67ced028fa | chore(apis): correct APIs documentation | [
{
"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+ * The `@influxdata/influxdb-client-apis` package provides InfluxDB APIs, which are\n+ * {@link https://github.com/influxdata/influxdb-client-js/blob/master/packages/apis/DEVELOPMENT.md | generated from OpenAPI specifications }.\n*\n* @remarks\n* These APIs allow to manage the domain objects of InfluxDB (such as buckets, sources, tasks, authorizations).\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): correct APIs documentation |
305,159 | 16.11.2021 19:46:23 | -3,600 | 7500202577cf173d820be88764e7880b424e2c40 | chore: update InfluxDB version to 2.1 or 2.x | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "[](https://www.npmjs.com/package/@influxdata/influxdb-client)\n[](https://www.influxdata.com/slack)\n-This repository contains the reference JavaScript client for InfluxDB 2.0. This client supports Node.js, browser, and Deno environments.\n+This repository contains the reference JavaScript client for InfluxDB 2.x. This client supports Node.js, browser, and Deno environments.\n#### Note: Use this client library with InfluxDB 2.x. For connecting to InfluxDB 1.x see the [node-influx](https://github.com/node-influx/node-influx) client library. This library can also write/query [flux-enabled](https://docs.influxdata.com/influxdb/v1.8/administration/config/#flux-enabled--false) InfluxDB 1.8+.\n@@ -16,14 +16,14 @@ This repository contains the reference JavaScript client for InfluxDB 2.0. This\nThis section contains links to the client library documentation.\n-- [Product documentation](https://docs.influxdata.com/influxdb/v2.0/api-guide/client-libraries/nodejs/), [Getting Started](#usage)\n+- [Product documentation](https://docs.influxdata.com/influxdb/v2.1/api-guide/client-libraries/nodejs/), [Getting Started](#usage)\n- [Examples](examples#influxdb-client-examples)\n- [API Reference](https://influxdata.github.io/influxdb-client-js/influxdb-client.html)\n- [Changelog](CHANGELOG.md)\n## Features\n-InfluxDB 2.0 client consists of two main packages\n+InfluxDB 2.x client consists of two main packages\n- @influxdata/influxdb-client\n- Query data using the Flux language\n@@ -120,4 +120,4 @@ $ yarn build\n## License\n-The InfluxDB 2.0 JavaScript client is released under the [MIT License](https://opensource.org/licenses/MIT).\n+The InfluxDB 2.x JavaScript client is released under the [MIT License](https://opensource.org/licenses/MIT).\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/README.md",
"new_path": "examples/README.md",
"diff": "@@ -6,14 +6,14 @@ This directory contains javascript and typescript examples for node.js, browser,\n- Prerequisites\n- [node](https://nodejs.org/en/) installed\n- Run `npm install` in this directory\n- - Change variables in [./env.js](env.js) to configure connection to your InfluxDB instance. The file can be used as-is against a new [docker InfluxDB v2.0 OSS GA installation](https://v2.docs.influxdata.com/v2.0/get-started/)\n+ - Change variables in [./env.js](env.js) to configure connection to your InfluxDB instance. The file can be used as-is against a new [docker InfluxDB v2.1 OSS GA installation](https://docs.influxdata.com/influxdb/v2.1/get-started/)\n- Examples are executable. If it does not work for you, run `npm run ts-node EXAMPLE.ts`.\n- [write.js](./write.js)\nWrite data points to InfluxDB.\n- [query.ts](./query.ts)\n- Query InfluxDB with [Flux](https://v2.docs.influxdata.com/v2.0/query-data/get-started/).\n+ Query InfluxDB with [Flux](https://docs.influxdata.com/influxdb/v2.1/get-started/).\n- [queryWithParams.ts](./queryWithParams.ts)\n- Supply parameters to a [Flux](https://v2.docs.influxdata.com/v2.0/query-data/get-started/) query.\n+ Supply parameters to a [Flux](https://docs.influxdata.com/influxdb/v2.1/get-started/) query.\n- [ping.js](./ping.js)\nCheck status of InfluxDB server.\n- [createBucket.js](./createBucket.js)\n@@ -23,7 +23,7 @@ This directory contains javascript and typescript examples for node.js, browser,\n- [influxdb-1.8.ts](./influxdb-1.8.ts)\nHow to use forward compatibility APIs from InfluxDB 1.8.\n- [rxjs-query.ts](./rxjs-query.ts)\n- Use [RxJS](https://rxjs.dev/) to query InfluxDB with [Flux](https://v2.docs.influxdata.com/v2.0/query-data/get-started/).\n+ Use [RxJS](https://rxjs.dev/) to query InfluxDB with [Flux](https://docs.influxdata.com/influxdb/v2.1/get-started/).\n- [writeAdvanced.js](./writeAdvanced.js)\nShows how to control the way of how data points are written to InfluxDB.\n- [follow-redirects.js](./follow-redirects.js)\n@@ -37,5 +37,5 @@ This directory contains javascript and typescript examples for node.js, browser,\n- Click `Visualize with Giraffe Line Chart` to open [giraffe.html](./giraffe.html) that\nshows how visualize query results with [@influxdata/giraffe](https://github.com/influxdata/giraffe).\n- Deno examples\n- - [query.deno.ts](./query.deno.ts) shows how to query InfluxDB with [Flux](https://v2.docs.influxdata.com/v2.0/query-data/get-started/).\n+ - [query.deno.ts](./query.deno.ts) shows how to query InfluxDB with [Flux](https://docs.influxdata.com/influxdb/v2.1/get-started/).\nIt is almost the same as node's [query.ts](./query.ts) example, the difference is the import statement that works in [deno](https://deno.land) and built-in typescript support.\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/influxdb-1.8.ts",
"new_path": "examples/influxdb-1.8.ts",
"diff": "// 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+// are part of the InfluxDB 1.x line since InfluxDB 1.8.0. This allows you to leverage InfluxDB 2.x 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\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/ping.js",
"new_path": "examples/ping.js",
"diff": "This example shows how to check state InfluxDB instance.\nInfluxDB OSS APIs are available through '@influxdata/influxdb-client-apis' package.\n-See https://v2.docs.influxdata.com/v2.0/api/\n+See https://docs.influxdata.com/influxdb/v2.1/api/\n*/\nconst {InfluxDB} = require('@influxdata/influxdb-client')\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/query.ts",
"new_path": "examples/query.ts",
"diff": "@@ -12,7 +12,7 @@ const fluxQuery =\nconsole.log('*** QUERY ROWS ***')\n// Execute query and receive table metadata and rows.\n-// https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/\n+// https://docs.influxdata.com/influxdb/v2.1/reference/syntax/annotated-csv/\nqueryApi.queryRows(fluxQuery, {\nnext(row: string[], tableMeta: FluxTableMetaData) {\nconst o = tableMeta.toObject(row)\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/rxjs-query.ts",
"new_path": "examples/rxjs-query.ts",
"diff": "@@ -15,7 +15,7 @@ const fluxQuery =\nconsole.log('*** QUERY ROWS ***')\n// performs query and receive line table metadata and rows\n-// https://v2.docs.influxdata.com/v2.0/reference/syntax/annotated-csv/\n+// https://docs.influxdata.com/influxdb/v2.1/reference/syntax/annotated-csv/\nfrom(queryApi.rows(fluxQuery))\n.pipe(map(({values, tableMeta}) => tableMeta.toObject(values)))\n.subscribe({\n@@ -34,5 +34,5 @@ from(queryApi.rows(fluxQuery))\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+// https://docs.influxdata.com/influxdb/v2.1/reference/syntax/annotated-csv/\n// from(queryApi.lines(fluxQuery)).forEach(console.log)\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "{\n\"private\": true,\n\"name\": \"@influxdata/influx\",\n- \"description\": \"InfluxDB 2.0 client\",\n+ \"description\": \"InfluxDB 2.1 client\",\n\"workspaces\": {\n\"packages\": [\n\"packages/core\",\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/package.json",
"new_path": "packages/apis/package.json",
"diff": "{\n\"name\": \"@influxdata/influxdb-client-apis\",\n\"version\": \"1.20.0\",\n- \"description\": \"InfluxDB 2.0 generated APIs\",\n+ \"description\": \"InfluxDB 2.1 generated APIs\",\n\"scripts\": {\n\"apidoc:extract\": \"api-extractor run\",\n\"build\": \"yarn run clean && yarn run lint && rollup -c\",\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core-browser/README.md",
"new_path": "packages/core-browser/README.md",
"diff": "# @influxdata/influxdb-client-browser\n-The reference InfluxDB 2.0 JavaScript client for browser and [Deno](https://deno.land/) environments.\n+The reference InfluxDB 2.x JavaScript client for browser and [Deno](https://deno.land/) environments.\nThe package.json\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core-browser/package.json",
"new_path": "packages/core-browser/package.json",
"diff": "{\n\"name\": \"@influxdata/influxdb-client-browser\",\n\"version\": \"1.20.0\",\n- \"description\": \"InfluxDB 2.0 client for browser\",\n+ \"description\": \"InfluxDB 2.1 client for browser\",\n\"scripts\": {\n\"apidoc:extract\": \"echo \\\"Nothing to do\\\"\",\n\"test\": \"echo \\\"Nothing to do\\\"\",\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/README.md",
"new_path": "packages/core/README.md",
"diff": "# @influxdata/influxdb-client\n-The reference javascript client for InfluxDB 2.0. Both node and browser environments are supported. The package.json\n+The reference javascript client for InfluxDB 2.x. Both node and browser environments are supported. The package.json\n- **main** points to node.js CJS distribution\n- **module** points to node.js ESM distribution\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/package.json",
"new_path": "packages/core/package.json",
"diff": "{\n\"name\": \"@influxdata/influxdb-client\",\n\"version\": \"1.20.0\",\n- \"description\": \"InfluxDB 2.0 client\",\n+ \"description\": \"InfluxDB 2.1 client\",\n\"scripts\": {\n\"apidoc:extract\": \"api-extractor run\",\n\"build\": \"yarn run clean && rollup -c\",\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/options.ts",
"new_path": "packages/core/src/options.ts",
"diff": "@@ -146,6 +146,6 @@ export interface ClientOptions extends ConnectionOptions {\n/**\n* Timestamp precision used in write operations.\n- * See {@link https://v2.docs.influxdata.com/v2.0/api/#operation/PostWrite }\n+ * See {@link https://docs.influxdata.com/influxdb/v2.1/api/#operation/PostWrite }\n*/\nexport type WritePrecisionType = 'ns' | 'us' | 'ms' | 's'\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/giraffe/package.json",
"new_path": "packages/giraffe/package.json",
"diff": "{\n\"name\": \"@influxdata/influxdb-client-giraffe\",\n\"version\": \"1.20.0\",\n- \"description\": \"InfluxDB 2.0 client - giraffe integration\",\n+ \"description\": \"InfluxDB 2.1 client - giraffe integration\",\n\"scripts\": {\n\"apidoc:extract\": \"api-extractor run\",\n\"build\": \"yarn run clean && rollup -c\",\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore: update InfluxDB version to 2.1 or 2.x |
305,159 | 18.11.2021 09:47:32 | -3,600 | bcc33121c86de06aa44c5ad868bb033846e17d3a | chore(docs): better describe module | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -31,11 +31,13 @@ InfluxDB 2.x client consists of two main packages\n- batch data in the background\n- retry automatically on failure\n- @influxdata/influxdb-client-apis\n- - Manage the following in InfluxDB:\n- - sources\n+ - Create/Modify/Delete/Manage\n- buckets\n- tasks\n- authorizations\n+ - sources\n+ - ... and other InfluxDB domain objects\n+ - Delete data from a bucket\n- built on @influxdata/influxdb-client\n## Installation\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(docs): better describe @influxdata/influxdb-client-apis module |
305,159 | 18.11.2021 10:22:41 | -3,600 | 5bb181b0e416ffbeeb82c0aa4fad52ed71b3c9b0 | feat: add delete example | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -78,6 +78,7 @@ Use the following examples to get started with the JavaScript client for InfluxD\nSee [examples](./examples/README.md) for more advanced use case like the following:\n- Execute parameterized queries.\n+- Delete bucket data.\n- Use the client library with InfluxDB 1.8+.\n- Use the client library in the browser or [Deno](./examples/query.deno.ts).\n- Process InfluxDB query results with RX Observables.\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/README.md",
"new_path": "examples/README.md",
"diff": "@@ -28,6 +28,8 @@ This directory contains javascript and typescript examples for node.js, browser,\nShows how to control the way of how data points are written to InfluxDB.\n- [follow-redirects.js](./follow-redirects.js)\nShows how to configure the client to follow HTTP redirects.\n+ - [delete.ts](./delete.ts)\n+ Shows how to delete data from a bucket.\n- Browser examples\n- Change `token, org, bucket, username, password` variables in [./env_browser.js](env_browser.js) to match your InfluxDB instance\n- Run `npm run browser`\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "examples/delete.ts",
"diff": "+#!./node_modules/.bin/ts-node\n+\n+///////////////////////////////////////////////////////////////////////\n+// Shows how to delete data from InfluxDB. See //\n+// https://docs.influxdata.com/influxdb/v2.1/write-data/delete-data/ //\n+///////////////////////////////////////////////////////////////////////\n+\n+import {InfluxDB} from '@influxdata/influxdb-client'\n+import {DeleteAPI} from '@influxdata/influxdb-client-apis'\n+import {url, token, org, bucket} from './env'\n+const influxDB = new InfluxDB({url, token})\n+\n+/*\n+The functionality of the DeleteAPI is fully demonstrated with\n+the following sequence of examples:\n+ - write.js\n+ - query.ts\n+ - delete.mjs\n+ - query.ts\n+\n+Note: You can also delete and re-create the whole bucket,\n+see ./createBucket.js example.\n+*/\n+\n+async function deleteData(): Promise<void> {\n+ console.log('*** DELETE DATA ***')\n+ const deleteAPI = new DeleteAPI(influxDB)\n+ // define time interval for delete operation\n+ const stop = new Date()\n+ const start = new Date(stop.getTime() - /* an hour */ 60 * 60 * 1000)\n+\n+ await deleteAPI.postDelete({\n+ org,\n+ bucket,\n+ // you can better specify orgID, bucketID in place or org, bucket if you already know them\n+ body: {\n+ start: start.toISOString(),\n+ stop: stop.toISOString(),\n+ // see https://docs.influxdata.com/influxdb/v2.1/reference/syntax/delete-predicate/\n+ predicate: '_measurement=\"temperature\"',\n+ },\n+ })\n+}\n+\n+deleteData()\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: add delete example |
305,159 | 18.11.2021 20:37:03 | -3,600 | 1caecb03f910427c0a9e1f6617ef9b7b1e6e20c8 | chore: apply review | [
{
"change_type": "MODIFY",
"old_path": "examples/delete.ts",
"new_path": "examples/delete.ts",
"diff": "@@ -15,7 +15,7 @@ The functionality of the DeleteAPI is fully demonstrated with\nthe following sequence of examples:\n- write.js\n- query.ts\n- - delete.mjs\n+ - delete.ts\n- query.ts\nNote: You can also delete and re-create the whole bucket,\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore: apply review |
305,159 | 22.11.2021 12:00:52 | -3,600 | d7640d191de1ed6b64e1043da7ae4ab3904ec569 | fix(core): repair double-escaping of default tags | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/WriteApiImpl.ts",
"new_path": "packages/core/src/impl/WriteApiImpl.ts",
"diff": "@@ -9,7 +9,6 @@ import {Headers} from '../results'\nimport {Log} from '../util/logger'\nimport {HttpError, RetryDelayStrategy} from '../errors'\nimport {Point} from '../Point'\n-import {escape} from '../util/escape'\nimport {currentTime, dateToProtocolTimestamp} from '../util/currentTime'\nimport {createRetryDelayStrategy} from './retryStrategy'\nimport RetryBuffer from './RetryBuffer'\n@@ -283,12 +282,7 @@ export default class WriteApiImpl implements WriteApi {\n// PointSettings\ndefaultTags: {[key: string]: string} | undefined\nuseDefaultTags(tags: {[key: string]: string}): WriteApi {\n- this.defaultTags = undefined\n- Object.keys(tags).forEach((key: string) => {\n- ;(this.defaultTags || (this.defaultTags = {}))[key] = escape.tag(\n- tags[key]\n- )\n- })\n+ this.defaultTags = tags\nreturn this\n}\nconvertTime(value: string | number | Date | undefined): string | undefined {\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/WriteApi.test.ts",
"new_path": "packages/core/test/unit/WriteApi.test.ts",
"diff": "@@ -257,6 +257,37 @@ describe('WriteApi', () => {\n})\n})\n})\n+ describe('convert default tags to line protocol', () => {\n+ it('works with tags OOTB', () => {\n+ const writeAPI = createApi(ORG, BUCKET, 'ms', {\n+ retryJitter: 0,\n+ })\n+ const p = new Point('a').floatField('b', 1).timestamp('')\n+ expect(p.toLineProtocol(writeAPI)).equals('a b=1')\n+ })\n+ it('setups tags using useDefaultTags ', () => {\n+ const writeAPI = createApi(ORG, BUCKET, 'ms', {\n+ retryJitter: 0,\n+ })\n+ const p = new Point('a').floatField('b', 1).timestamp('')\n+ writeAPI.useDefaultTags({\n+ x: 'y z',\n+ 'a b': 'c',\n+ })\n+ expect(p.toLineProtocol(writeAPI)).equals('a,a\\\\ b=c,x=y\\\\ z b=1')\n+ })\n+ it('setups tags from configuration', () => {\n+ const writeAPI = createApi(ORG, BUCKET, 'ms', {\n+ retryJitter: 0,\n+ defaultTags: {\n+ x: 'y z',\n+ 'a b': 'c',\n+ },\n+ })\n+ const p = new Point('a').floatField('b', 1).timestamp('')\n+ expect(p.toLineProtocol(writeAPI)).equals('a,a\\\\ b=c,x=y\\\\ z b=1')\n+ })\n+ })\ndescribe('flush on background', () => {\nlet subject: WriteApi\nlet logs: CollectedLogs\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(core): repair double-escaping of default tags |
305,159 | 03.12.2021 12:10:53 | -3,600 | 765a0b099a138a567716de10f5e486e32b5b143c | chore: document connection reuse in node.js | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -85,6 +85,7 @@ See [examples](./examples/README.md) for more advanced use case like the followi\n- Customize the writing of measurement points to InfluxDB.\n- Visualize query results in [Giraffe](https://github.com/influxdata/giraffe).\n- [Setup HTTP/HTTPS proxy](https://github.com/influxdata/influxdb-client-js/issues/319#issuecomment-808154245) in communication with InfluxDB.\n+- [Reuse connections](https://github.com/influxdata/influxdb-client-js/issues/393#issuecomment-985272866) in communication with InfluxDB.\nJavaScript client API Reference Documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore: document connection reuse in node.js |
305,159 | 03.12.2021 13:34:41 | -3,600 | a8ac7c3b0aba35280e4c63649eef337c033b68e2 | feat(core): isolate node transport options | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -47,16 +47,25 @@ export class NodeHttpTransport implements Transport {\ncallback: (res: http.IncomingMessage) => void\n) => http.ClientRequest\nprivate contextPath: string\n+ private token?: string\n+ private headers: Record<string, string>\n/**\n* Creates a node transport using for the client options supplied.\n* @param connectionOptions - connection options\n*/\n- constructor(private connectionOptions: ConnectionOptions) {\n- const url = parse(connectionOptions.url)\n+ constructor(connectionOptions: ConnectionOptions) {\n+ const {\n+ url: _url,\n+ token,\n+ transportOptions,\n+ ...nodeSupportedOptions\n+ } = connectionOptions\n+ const url = parse(_url)\n+ this.token = token\nthis.defaultOptions = {\n...DEFAULT_ConnectionOptions,\n- ...connectionOptions,\n- ...connectionOptions.transportOptions,\n+ ...nodeSupportedOptions,\n+ ...transportOptions,\nport: url.port,\nprotocol: url.protocol,\nhostname: url.hostname,\n@@ -77,7 +86,7 @@ export class NodeHttpTransport implements Transport {\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+ if (this.contextPath.endsWith('/api/v2')) {\nLog.warn(\n`Please remove '/api/v2' context path from InfluxDB base url, using ${url.protocol}//${url.hostname}:${url.port} !`\n)\n@@ -95,6 +104,9 @@ export class NodeHttpTransport implements Transport {\n`Unsupported protocol \"${url.protocol} in URL: \"${connectionOptions.url}\"`\n)\n}\n+ this.headers = {\n+ 'User-Agent': `influxdb-client-js/${CLIENT_LIB_VERSION}`,\n+ }\n}\n/**\n@@ -208,10 +220,10 @@ export class NodeHttpTransport implements Transport {\nconst bodyBuffer = Buffer.from(body, 'utf-8')\nconst headers: {[key: string]: any} = {\n'content-type': 'application/json; charset=utf-8',\n- 'User-Agent': `influxdb-client-js/${CLIENT_LIB_VERSION}`,\n+ ...this.headers,\n}\n- if (this.connectionOptions.token) {\n- headers.authorization = 'Token ' + this.connectionOptions.token\n+ if (this.token) {\n+ headers.authorization = 'Token ' + this.token\n}\nlet bodyPromise = Promise.resolve(bodyBuffer)\nconst options: {[key: string]: any} = {\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": "@@ -58,7 +58,6 @@ describe('NodeHttpTransport', () => {\nport: '8086',\nprotocol: 'http:',\ntimeout: 10000,\n- url: 'http://test:8086',\n})\nexpect(transport.requestApi).to.equal(http.request)\n})\n@@ -71,7 +70,6 @@ describe('NodeHttpTransport', () => {\nport: '8086',\nprotocol: 'https:',\ntimeout: 10000,\n- url: 'https://test:8086',\n})\nexpect(transport.requestApi).to.equal(https.request)\n})\n@@ -84,7 +82,6 @@ describe('NodeHttpTransport', () => {\nport: '8086',\nprotocol: 'http:',\ntimeout: 10000,\n- url: 'http://test:8086/influx',\n})\nexpect(transport.contextPath).equals('/influx')\n})\n@@ -97,7 +94,6 @@ describe('NodeHttpTransport', () => {\nport: '8086',\nprotocol: 'http:',\ntimeout: 10000,\n- url: 'http://test:8086/influx/',\n})\nexpect(transport.contextPath).equals('/influx')\n})\n@@ -131,7 +127,6 @@ describe('NodeHttpTransport', () => {\nhostname: 'test',\nport: '8086',\nprotocol: 'http:',\n- url: 'http://test:8086',\n})\nexpect(transport.requestApi).to.equal(http.request)\n})\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): isolate node transport options |
305,159 | 03.12.2021 14:33:32 | -3,600 | 6bbb00168dacef45b56db9b173716c60debe80d6 | feat(core): allow to set custom headers for all requests | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/browser/FetchTransport.ts",
"new_path": "packages/core/src/impl/browser/FetchTransport.ts",
"diff": "@@ -37,6 +37,7 @@ export default class FetchTransport implements Transport {\nthis.defaultHeaders = {\n'content-type': 'application/json; charset=utf-8',\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+ ...connectionOptions.headers,\n}\nif (this.connectionOptions.token) {\nthis.defaultHeaders['Authorization'] =\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -106,6 +106,7 @@ export class NodeHttpTransport implements Transport {\n}\nthis.headers = {\n'User-Agent': `influxdb-client-js/${CLIENT_LIB_VERSION}`,\n+ ...connectionOptions.headers,\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/options.ts",
"new_path": "packages/core/src/options.ts",
"diff": "@@ -27,6 +27,10 @@ export interface ConnectionOptions {\n* {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | redirect } property can be set to 'error' to abort request if a redirect occurs.\n*/\ntransportOptions?: {[key: string]: any}\n+ /**\n+ * Default HTTP headers to send with every request.\n+ */\n+ headers?: Record<string, string>\n}\n/** default connection options */\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts",
"new_path": "packages/core/test/unit/impl/browser/FetchTransport.test.ts",
"diff": "@@ -89,6 +89,27 @@ describe('FetchTransport', () => {\n})\nexpect(response).is.deep.equal('{}')\n})\n+ it('receives custom headers', async () => {\n+ const transport = new FetchTransport({\n+ url: 'http://test:8086',\n+ headers: {extra: 'yes'},\n+ })\n+ let options: any\n+ emulateFetchApi(\n+ {\n+ headers: {'content-type': 'text/plain'},\n+ body: '{}',\n+ },\n+ opts => {\n+ options = opts\n+ }\n+ )\n+ const response = await transport.request('/whatever', '', {\n+ method: 'GET',\n+ })\n+ expect(response).is.deep.equal('{}')\n+ expect(options?.headers?.extra).equals('yes')\n+ })\nit('allows to transform requests', async () => {\nlet lastRequest: any\nemulateFetchApi(\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": "@@ -776,5 +776,32 @@ describe('NodeHttpTransport', () => {\n})\nexpect(data).equals(undefined)\n})\n+ it(`uses custom headers set to transport`, async () => {\n+ let extra: any\n+ nock(transportOptions.url)\n+ .get('/test')\n+ .reply(\n+ 200,\n+ function(_uri, _body, callback) {\n+ extra = this.req.headers['extra']\n+ callback(null, '..')\n+ },\n+ {\n+ 'content-type': 'application/csv',\n+ }\n+ )\n+ .persist()\n+ const data = await new NodeHttpTransport({\n+ ...transportOptions,\n+ timeout: 10000,\n+ headers: {\n+ extra: 'yes',\n+ },\n+ }).request('/test', '', {\n+ method: 'GET',\n+ })\n+ expect(data).equals('..')\n+ expect(extra).equals('yes')\n+ })\n})\n})\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): allow to set custom headers for all requests |
305,159 | 03.12.2021 14:48:04 | -3,600 | 5610d693a6f7b9dc71cc7b83332ee09ba99ec47b | chore(core): remove unused property | [
{
"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": "@@ -254,7 +254,6 @@ describe('NodeHttpTransport', () => {\nconst transportOptions = {\nurl: TEST_URL,\ntimeout: 100,\n- maxRetries: 0,\n}\nit(`fails silently on server error`, async () => {\nnock(transportOptions.url)\n@@ -478,7 +477,6 @@ describe('NodeHttpTransport', () => {\nconst transportOptions = {\nurl: TEST_URL,\ntimeout: 100,\n- maxRetries: 0,\n}\nit(`is cancelled before the response arrives`, async () => {\nnock(transportOptions.url)\n@@ -543,7 +541,6 @@ describe('NodeHttpTransport', () => {\nconst transportOptions = {\nurl: TEST_URL,\ntimeout: 100,\n- maxRetries: 0,\n}\n;([\n[null, ''],\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(core): remove unused property |
305,159 | 03.12.2021 15:30:46 | -3,600 | 10b19a1ae80a26504de562133aeec88ecceaab8b | feat(core): allow to configure http proxy in node.js | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -56,11 +56,12 @@ export class NodeHttpTransport implements Transport {\nconstructor(connectionOptions: ConnectionOptions) {\nconst {\nurl: _url,\n+ proxyUrl,\ntoken,\ntransportOptions,\n...nodeSupportedOptions\n} = connectionOptions\n- const url = parse(_url)\n+ const url = parse(proxyUrl || _url)\nthis.token = token\nthis.defaultOptions = {\n...DEFAULT_ConnectionOptions,\n@@ -70,7 +71,7 @@ export class NodeHttpTransport implements Transport {\nprotocol: url.protocol,\nhostname: url.hostname,\n}\n- this.contextPath = url.path ?? ''\n+ this.contextPath = proxyUrl ? _url : url.path ?? ''\nif (this.contextPath.endsWith('/')) {\nthis.contextPath = this.contextPath.substring(\n0,\n@@ -108,6 +109,9 @@ export class NodeHttpTransport implements Transport {\n'User-Agent': `influxdb-client-js/${CLIENT_LIB_VERSION}`,\n...connectionOptions.headers,\n}\n+ if (proxyUrl) {\n+ this.headers['host'] = parse(_url).host as string\n+ }\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/options.ts",
"new_path": "packages/core/src/options.ts",
"diff": "@@ -31,6 +31,10 @@ export interface ConnectionOptions {\n* Default HTTP headers to send with every request.\n*/\nheaders?: Record<string, string>\n+ /**\n+ * HTTP proxy URL\n+ */\n+ proxyUrl?: string\n}\n/** default connection options */\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": "@@ -800,5 +800,33 @@ describe('NodeHttpTransport', () => {\nexpect(data).equals('..')\nexpect(extra).equals('yes')\n})\n+ it(`communicates through a proxy`, async () => {\n+ let headers: Record<string, string> = {}\n+ let requestPath = ''\n+ const targetUrl = 'http://behind.proxy.localhost:8080'\n+ nock(transportOptions.url)\n+ .get(/.*/)\n+ .reply(\n+ 200,\n+ function(uri, _body, callback) {\n+ requestPath = uri\n+ headers = {...this.req.headers}\n+ callback(null, '..')\n+ },\n+ {\n+ 'content-type': 'application/csv',\n+ }\n+ )\n+ .persist()\n+ const data = await new NodeHttpTransport({\n+ url: targetUrl,\n+ proxyUrl: transportOptions.url,\n+ }).request('/test', '', {\n+ method: 'GET',\n+ })\n+ expect(data).equals('..')\n+ expect(requestPath).equals(targetUrl + '/test')\n+ expect(headers?.host).equals('behind.proxy.localhost:8080')\n+ })\n})\n})\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): allow to configure http proxy in node.js |
305,159 | 03.12.2021 15:52:58 | -3,600 | 4cdb86ea6c099e492aac506aed45baa9b43c12a0 | feat(core): setup Host header when proxy | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -110,7 +110,7 @@ export class NodeHttpTransport implements Transport {\n...connectionOptions.headers,\n}\nif (proxyUrl) {\n- this.headers['host'] = parse(_url).host as string\n+ this.headers['Host'] = parse(_url).host as string\n}\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): setup Host header when proxy |
305,159 | 03.12.2021 15:57:32 | -3,600 | cd19aad560d60b12716c4a876fda03626bf4c85b | chore(core): improve proxyUrl doc | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/options.ts",
"new_path": "packages/core/src/options.ts",
"diff": "@@ -32,7 +32,7 @@ export interface ConnectionOptions {\n*/\nheaders?: Record<string, string>\n/**\n- * HTTP proxy URL\n+ * Full HTTP web proxy URL including schema, for example http://your-proxy:8080.\n*/\nproxyUrl?: string\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(core): improve proxyUrl doc |
305,159 | 03.12.2021 16:24:09 | -3,600 | 4d2fe1d5c889963728ed2a51e37c554f770e1244 | chore(docs): remove obsolete proxy setup | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -84,7 +84,6 @@ See [examples](./examples/README.md) for more advanced use case like the followi\n- Process InfluxDB query results with RX Observables.\n- Customize the writing of measurement points to InfluxDB.\n- Visualize query results in [Giraffe](https://github.com/influxdata/giraffe).\n-- [Setup HTTP/HTTPS proxy](https://github.com/influxdata/influxdb-client-js/issues/319#issuecomment-808154245) in communication with InfluxDB.\n- [Reuse connections](https://github.com/influxdata/influxdb-client-js/issues/393#issuecomment-985272866) in communication with InfluxDB.\nJavaScript client API Reference Documentation is available online at https://influxdata.github.io/influxdb-client-js/ .\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(docs): remove obsolete proxy setup |
305,159 | 13.01.2022 18:46:02 | -3,600 | 4522c8bd279c35cca9f475ade04394e8cbcd7b4d | chore(deps-dev): bump follow-redirects from 1.14.3 to 1.14.7 in package.json | [
{
"change_type": "MODIFY",
"old_path": "packages/core/package.json",
"new_path": "packages/core/package.json",
"diff": "\"eslint-config-prettier\": \"^6.7.0\",\n\"eslint-plugin-prettier\": \"^3.1.1\",\n\"eslint-plugin-tsdoc\": \"^0.2.6\",\n- \"follow-redirects\": \"^1.14.3\",\n+ \"follow-redirects\": \"^1.14.7\",\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": "@@ -3162,7 +3162,7 @@ flush-write-stream@^1.0.0:\ninherits \"^2.0.3\"\nreadable-stream \"^2.3.6\"\n-follow-redirects@^1.14.3:\n+follow-redirects@^1.14.7:\nversion \"1.14.7\"\nresolved \"https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685\"\nintegrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(deps-dev): bump follow-redirects from 1.14.3 to 1.14.7 in package.json |
305,159 | 21.01.2022 10:20:34 | -3,600 | 9594abc809a5feebba0071cbb06f04adcb282d36 | fix(core): repair handling of gzipped responses | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"new_path": "packages/core/src/impl/node/NodeHttpTransport.ts",
"diff": "@@ -348,7 +348,6 @@ export class NodeHttpTransport implements Transport {\nreq.on('error', error => {\nlisteners.error(error)\n})\n- req.on('close', listeners.complete)\n/* istanbul ignore else support older node versions */\nif (requestMessage.body) {\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(core): repair handling of gzipped responses |
305,159 | 21.01.2022 12:33:59 | -3,600 | 1b84eae193d85a0e9f2957acf6cc9f36ce121ddd | feat(core): add utf8Length function | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/core/src/util/utf8Length.ts",
"diff": "+/**\n+ * Utf8Length returns an expected length of a string when UTF-8 encoded.\n+ * @param s - input string\n+ * @returns expected count of bytes\n+ */\n+export default function utf8Length(s: string): number {\n+ let retVal = s.length\n+ // extends the size with code points (https://en.wikipedia.org/wiki/UTF-8#Encoding)\n+ for (let i = 0; i < s.length; i++) {\n+ const code = s.charCodeAt(i)\n+ /* istanbul ignore else - JS does not count with 4-bytes UNICODE characters at the moment */\n+ if (code < 0x80) {\n+ continue\n+ } else if (code >= 0x80 && code <= 0x7ff) {\n+ retVal++\n+ } else if (code >= 0x800 && code <= 0xffff) {\n+ if (code >= 0xd800 && code <= 0xdfff) {\n+ // node.js represents unicode characters above 0xffff by two UTF-16 surrogate halves\n+ // see https://en.wikipedia.org/wiki/UTF-8#Codepage_layout\n+ retVal++\n+ } else {\n+ retVal += 2\n+ }\n+ } else {\n+ // never happens in node.js 14, the situation can vary in the futures or in deno/browsers\n+ retVal += 3\n+ }\n+ }\n+ return retVal\n+}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): add utf8Length function |
305,159 | 21.01.2022 12:34:31 | -3,600 | 4586a72c0855fbff7922ddf0876f07d02dbaeb0e | feat(core): add maxBatchBytes write option with 50M default | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/options.ts",
"new_path": "packages/core/src/options.ts",
"diff": "@@ -103,7 +103,7 @@ export interface WriteRetryOptions extends RetryDelayStrategyOptions {\n* Options used by {@link WriteApi} .\n*/\nexport interface WriteOptions extends WriteRetryOptions {\n- /** max number of records to send in a batch */\n+ /** max number of records/lines to send in a batch */\nbatchSize: number\n/** delay between data flushes in milliseconds, at most `batch size` records are sent during flush */\nflushInterval: number\n@@ -113,6 +113,8 @@ export interface WriteOptions extends WriteRetryOptions {\nheaders?: {[key: string]: string}\n/** When specified, write bodies larger than the threshold are gzipped */\ngzipThreshold?: number\n+ /** max size of a batch in bytes */\n+ maxBatchBytes: number\n}\n/** default RetryDelayStrategyOptions */\n@@ -127,6 +129,7 @@ export const DEFAULT_RetryDelayStrategyOptions = {\n/** default writeOptions */\nexport const DEFAULT_WriteOptions: WriteOptions = {\nbatchSize: 1000,\n+ maxBatchBytes: 50_000_000, // default max batch size in the cloud\nflushInterval: 60000,\nwriteFailed: function() {},\nwriteSuccess: function() {},\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): add maxBatchBytes write option with 50M default |
305,159 | 21.01.2022 12:35:45 | -3,600 | b8e4d0b327acc60b1839da1b5c6b34aab229de2b | feat(core): flush batch when bigger than maxBatchBytes | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/WriteApiImpl.ts",
"new_path": "packages/core/src/impl/WriteApiImpl.ts",
"diff": "@@ -12,13 +12,16 @@ import {Point} from '../Point'\nimport {currentTime, dateToProtocolTimestamp} from '../util/currentTime'\nimport {createRetryDelayStrategy} from './retryStrategy'\nimport RetryBuffer from './RetryBuffer'\n+import utf8Length from '../util/utf8Length'\nclass WriteBuffer {\nlength = 0\n+ bytes = -1\nlines: string[]\nconstructor(\nprivate maxChunkRecords: number,\n+ private maxBatchBytes: number,\nprivate flushFn: (lines: string[]) => Promise<void>,\nprivate scheduleSend: () => void\n) {\n@@ -26,11 +29,18 @@ class WriteBuffer {\n}\nadd(record: string): void {\n+ const size = utf8Length(record)\nif (this.length === 0) {\nthis.scheduleSend()\n+ } else if (this.bytes + size + 1 >= this.maxBatchBytes) {\n+ // the new size already exceeds maxBatchBytes, send it\n+ this.flush().catch(_e => {\n+ // an error is logged in case of failure, avoid UnhandledPromiseRejectionWarning\n+ })\n}\nthis.lines[this.length] = record\nthis.length++\n+ this.bytes += size + 1\nif (this.length >= this.maxChunkRecords) {\nthis.flush().catch(_e => {\n// an error is logged in case of failure, avoid UnhandledPromiseRejectionWarning\n@@ -48,6 +58,7 @@ class WriteBuffer {\nreset(): string[] {\nconst retVal = this.lines.slice(0, this.length)\nthis.length = 0\n+ this.bytes = -1 // lines are joined with \\n\nreturn retVal\n}\n}\n@@ -114,6 +125,7 @@ export default class WriteApiImpl implements WriteApi {\n// write buffer\nthis.writeBuffer = new WriteBuffer(\nthis.writeOptions.batchSize,\n+ this.writeOptions.maxBatchBytes,\nlines => {\nthis._clearFlushTimeout()\nreturn this.sendBatch(lines, this.writeOptions.maxRetries + 1)\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): flush batch when bigger than maxBatchBytes |
305,159 | 21.01.2022 14:10:30 | -3,600 | a74389994b3f38b4725ebbb0603f46471b0400be | feat(core): test batch write when bytes exceed maximum | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/impl/WriteApiImpl.ts",
"new_path": "packages/core/src/impl/WriteApiImpl.ts",
"diff": "@@ -41,7 +41,10 @@ class WriteBuffer {\nthis.lines[this.length] = record\nthis.length++\nthis.bytes += size + 1\n- if (this.length >= this.maxChunkRecords) {\n+ if (\n+ this.length >= this.maxChunkRecords ||\n+ this.bytes >= this.maxBatchBytes\n+ ) {\nthis.flush().catch(_e => {\n// an error is logged in case of failure, avoid UnhandledPromiseRejectionWarning\n})\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/WriteApi.test.ts",
"new_path": "packages/core/test/unit/WriteApi.test.ts",
"diff": "@@ -292,7 +292,7 @@ describe('WriteApi', () => {\nlet subject: WriteApi\nlet logs: CollectedLogs\nfunction useSubject(writeOptions: Partial<WriteOptions>): void {\n- subject = createApi(ORG, BUCKET, PRECISION, {\n+ subject = createApi(ORG, BUCKET, 'ns', {\nretryJitter: 0,\n...writeOptions,\n})\n@@ -325,9 +325,40 @@ describe('WriteApi', () => {\nsubject.writeRecord('test value=2')\nawait waitForCondition(() => logs.error.length >= 2)\nexpect(logs.error).has.length(2)\n- await subject.flush().then(() => {\n+ await subject.flush()\nexpect(logs.error).has.length(2)\n})\n+ it('flushes the records automatically when size exceeds maxBatchBytes', async () => {\n+ useSubject({flushInterval: 0, maxRetries: 0, maxBatchBytes: 15})\n+ const messages: string[] = []\n+ nock(clientOptions.url)\n+ .post(WRITE_PATH_NS)\n+ .reply((_uri, _requestBody) => {\n+ messages.push(_requestBody.toString())\n+ return [204, '', {}]\n+ })\n+ .persist()\n+ subject.writeRecord('test value=1')\n+ expect(logs.error).has.length(0) // not flushed yet\n+ expect(messages).has.length(0) // not flushed yet\n+ subject.writeRecord('test value=2')\n+ await waitForCondition(() => messages.length == 1) // wait for background HTTP call\n+ expect(logs.error).has.length(0)\n+ expect(messages).has.length(1)\n+ expect(messages[0]).equals('test value=1')\n+ await subject.flush()\n+ expect(logs.error).has.length(0)\n+ expect(messages).has.length(2)\n+ expect(messages[1]).equals('test value=2')\n+ subject.writeRecord('test value=4321') // greater or equal to 15 bytes, it should be written immediatelly\n+ await waitForCondition(() => messages.length == 3) // wait for background HTTP call\n+ subject.writeRecord('t v=1')\n+ subject.writeRecord('t v=2')\n+ await subject.flush()\n+ expect(logs.error).has.length(0)\n+ expect(messages).has.length(4)\n+ expect(messages[2]).equals('test value=4321')\n+ expect(messages[3]).equals('t v=1\\nt v=2')\n})\n})\ndescribe('usage of server API', () => {\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): test batch write when bytes exceed maximum |
305,159 | 03.02.2022 09:28:17 | -3,600 | 4e361d53a9c3a523aa0a5bfebe29c8928960df45 | chore(apis): refactor and document swagger file patching | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/DEVELOPMENT.md",
"new_path": "packages/apis/DEVELOPMENT.md",
"diff": "@@ -16,7 +16,7 @@ $ yarn build\n- `wget -O resources/cloud.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/cloud.yml`\n- re-generate src/generated/types.ts and resources/operations.json using [oats](https://github.com/bonitoo-io/oats)\n- `rm -rf src/generated/*.ts`\n- - `oats -i 'types' --storeOperations resources/operations.json --patchScript $PWD/generator/append-cloud-definitions.js resources/oss.yml resources/invocable-scripts.yml > src/generated/types.ts`\n+ - `oats -i 'types' --storeOperations resources/operations.json --patchScript $PWD/scripts/patchSwagger.js resources/oss.yml resources/invocable-scripts.yml > src/generated/types.ts`\n- generate src/generated APIs from resources/operations.json\n- `yarn generate`\n- validate\n"
},
{
"change_type": "DELETE",
"old_path": "packages/apis/generator/append-cloud-definitions.js",
"new_path": null,
"diff": "-exports.patch = async (doc, swaggerParser) => {\n- const cloudApi = await swaggerParser('./resources/cloud.yml')\n- const cloudTypes =\n- cloudApi.components.schemas['Resource']['properties']['type']\n- const ossTypes = doc.components.schemas['Resource']['properties']['type']\n- ossTypes.enum = ossTypes.enum.concat(\n- cloudTypes.enum.filter(cloudType => !ossTypes.enum.includes(cloudType))\n- )\n-\n- return doc\n-}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/apis/scripts/patchSwagger.js",
"diff": "+// Patch function is used by oats tool to modify a swagger document before generating API code.\n+exports.patch = async (doc, SwaggerParser) => {\n+ // Merges Resource enum values so that the client contains also values from cloud spec\n+ const cloudApi = await SwaggerParser.bundle('./resources/cloud.yml')\n+ const cloudTypes =\n+ cloudApi.components.schemas['Resource']['properties']['type']\n+ const ossTypes = doc.components.schemas['Resource']['properties']['type']\n+ ossTypes.enum = ossTypes.enum.concat(\n+ cloudTypes.enum.filter(cloudType => !ossTypes.enum.includes(cloudType))\n+ )\n+\n+ return doc\n+}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(apis): refactor and document swagger file patching |
305,159 | 03.02.2022 10:12:16 | -3,600 | 568187dfe16045b54aa59ed759bbd8dd15af49dd | chore(apis): add script to fetch swagger files | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/DEVELOPMENT.md",
"new_path": "packages/apis/DEVELOPMENT.md",
"diff": "@@ -11,9 +11,7 @@ $ yarn build\n## Re-generate APIs code\n- fetch latest versions of openapi files\n- - `wget -O resources/oss.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/oss.yml`\n- - `wget -O resources/invocable-scripts.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/invocable-scripts.yml`\n- - `wget -O resources/cloud.yml https://raw.githubusercontent.com/influxdata/openapi/master/contracts/cloud.yml`\n+ - `yarn fetchSwaggerFiles`\n- re-generate src/generated/types.ts and resources/operations.json using [oats](https://github.com/bonitoo-io/oats)\n- `rm -rf src/generated/*.ts`\n- `oats -i 'types' --storeOperations resources/operations.json --patchScript $PWD/scripts/patchSwagger.js resources/oss.yml resources/invocable-scripts.yml > src/generated/types.ts`\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/package.json",
"new_path": "packages/apis/package.json",
"diff": "\"typecheck\": \"tsc --noEmit --pretty\",\n\"lint\": \"eslint 'src/**/*.ts'\",\n\"lint:ci\": \"yarn run lint --format junit --output-file ../../reports/apis_eslint/eslint.xml\",\n- \"lint:fix\": \"eslint --fix 'src/**/*.ts'\"\n+ \"lint:fix\": \"eslint --fix 'src/**/*.ts'\",\n+ \"fetchSwaggerFiles\": \"node ./scripts/fetchSwaggerFiles.js\"\n},\n\"main\": \"dist/index.js\",\n\"module\": \"dist/index.mjs\",\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/apis/scripts/fetchSwaggerFiles.js",
"diff": "+/* eslint-disable @typescript-eslint/no-var-requires */\n+/* eslint-disable no-console */\n+/* eslint-disable @typescript-eslint/explicit-function-return-type */\n+const https = require('https')\n+const path = require('path')\n+const {writeFile} = require('fs/promises')\n+\n+function downloadFile(url) {\n+ return new Promise((resolve, reject) => {\n+ https\n+ .get(url, function(res) {\n+ const data = []\n+ res\n+ .on('data', chunk => {\n+ data.push(chunk)\n+ })\n+ .on('end', () => {\n+ resolve(Buffer.concat(data))\n+ })\n+ })\n+ .on('error', reject)\n+ })\n+}\n+\n+const FILES = [\n+ {\n+ file: 'resources/oss.yml',\n+ url:\n+ 'https://raw.githubusercontent.com/influxdata/openapi/master/contracts/oss.yml',\n+ },\n+ {\n+ file: 'resources/invocable-scripts.yml',\n+ url:\n+ 'https://raw.githubusercontent.com/influxdata/openapi/master/contracts/invocable-scripts.yml',\n+ },\n+ {\n+ file: 'resources/cloud.yml',\n+ url:\n+ 'https://raw.githubusercontent.com/influxdata/openapi/master/contracts/cloud.yml',\n+ },\n+]\n+async function downloadFiles() {\n+ for (const {file, url} of FILES) {\n+ console.info(url)\n+ const content = await downloadFile(url)\n+ const fullPath = path.join(__dirname, '..', file)\n+ await writeFile(fullPath, content)\n+ console.log('=>', fullPath, content.length)\n+ }\n+}\n+\n+downloadFiles()\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 | chore(apis): add script to fetch swagger files |
305,159 | 03.02.2022 15:14:27 | -3,600 | 027bbc0969b1b45df6e468a2273f01b83a71ee0d | chore(core): improve code coverage | [
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/WriteApi.test.ts",
"new_path": "packages/core/test/unit/WriteApi.test.ts",
"diff": "@@ -525,9 +525,9 @@ describe('WriteApi', () => {\nconst writeCounters = createWriteCounters()\n// required because of https://github.com/influxdata/influxdb-client-js/issues/263\nuseSubject({\n- flushInterval: 2,\nmaxRetries: 0,\nbatchSize: 10,\n+ maxBatchBytes: 15,\nwriteFailed: writeCounters.writeFailed,\n})\nlet authorization: any\n@@ -538,7 +538,9 @@ describe('WriteApi', () => {\nreturn [200, '', {}]\n})\n.persist()\n- subject.writePoint(new Point('test').floatField('value', 1))\n+ subject.writeRecord('test value=1')\n+ // flushes the previous record by writiung a next one that exceeds maxBatchBytes\n+ subject.writeRecord('test value=2')\nawait waitForCondition(() => writeCounters.failedLineCount == 1)\nexpect(logs.error).has.length(1)\nexpect(logs.error[0][0]).equals('Write to InfluxDB failed.')\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(core): improve code coverage |
305,159 | 03.02.2022 15:32:24 | -3,600 | 4fb8788a30981e1db1dc4a3285f212f2ebdb0138 | chore(core): avoid UnhandlerPromiseRejection in tests | [
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/WriteApi.test.ts",
"new_path": "packages/core/test/unit/WriteApi.test.ts",
"diff": "@@ -77,7 +77,8 @@ describe('WriteApi', () => {\nlogs = collectLogging.replace()\n})\nafterEach(async () => {\n- await subject.close()\n+ // eslint-disable-next-line no-console\n+ await subject.close().catch(console.error)\ncollectLogging.after()\n})\nit('can be closed and flushed without any data', async () => {\n@@ -526,6 +527,7 @@ describe('WriteApi', () => {\n// required because of https://github.com/influxdata/influxdb-client-js/issues/263\nuseSubject({\nmaxRetries: 0,\n+ flushInterval: 2000, // do not flush automatically in the test\nbatchSize: 10,\nmaxBatchBytes: 15,\nwriteFailed: writeCounters.writeFailed,\n@@ -539,7 +541,7 @@ describe('WriteApi', () => {\n})\n.persist()\nsubject.writeRecord('test value=1')\n- // flushes the previous record by writiung a next one that exceeds maxBatchBytes\n+ // flushes the previous record by writing a next one so that batch is greater than maxBatchBytes\nsubject.writeRecord('test value=2')\nawait waitForCondition(() => writeCounters.failedLineCount == 1)\nexpect(logs.error).has.length(1)\n@@ -551,6 +553,7 @@ describe('WriteApi', () => {\n)\nexpect(logs.warn).deep.equals([])\nexpect(authorization).equals(`Token ${clientOptions.token}`)\n+ expect(subject.dispose()).equals(1) // the second record was not written\n})\nit('sends custom http header', async () => {\nuseSubject({\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(core): avoid UnhandlerPromiseRejection in tests |
305,159 | 03.02.2022 15:48:06 | -3,600 | bcc1d766b6e9f9f9078e7546bee2285d83109c99 | chore: update codecov | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"license\": \"MIT\",\n\"dependencies\": {\n\"@microsoft/api-documenter\": \"^7.13.34\",\n- \"codecov\": \"^3.6.1\",\n+ \"codecov\": \"^3.8.3\",\n\"gh-pages\": \"^3.1.0\",\n\"lerna\": \"^3.20.2\",\n\"prettier\": \"^1.19.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -2100,6 +2100,17 @@ codecov@^3.6.1:\nteeny-request \"6.0.1\"\nurlgrey \"0.4.4\"\n+codecov@^3.8.3:\n+ version \"3.8.3\"\n+ resolved \"https://registry.yarnpkg.com/codecov/-/codecov-3.8.3.tgz#9c3e364b8a700c597346ae98418d09880a3fdbe7\"\n+ integrity sha512-Y8Hw+V3HgR7V71xWH2vQ9lyS358CbGCldWlJFR0JirqoGtOoas3R3/OclRTvgUYFK29mmJICDPauVKmpqbwhOA==\n+ dependencies:\n+ argv \"0.0.2\"\n+ ignore-walk \"3.0.4\"\n+ js-yaml \"3.14.1\"\n+ teeny-request \"7.1.1\"\n+ urlgrey \"1.0.0\"\n+\ncollection-visit@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0\"\n@@ -3015,6 +3026,13 @@ fast-levenshtein@~2.0.6:\nresolved \"https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917\"\nintegrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=\n+fast-url-parser@^1.1.3:\n+ version \"1.1.3\"\n+ resolved \"https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d\"\n+ integrity sha1-9K8+qfNNiicc9YrSs3WfQx8LMY0=\n+ dependencies:\n+ punycode \"^1.3.2\"\n+\nfastq@^1.6.0:\nversion \"1.8.0\"\nresolved \"https://registry.yarnpkg.com/fastq/-/fastq-1.8.0.tgz#550e1f9f59bbc65fe185cb6a9b4d95357107f481\"\n@@ -3683,6 +3701,14 @@ https-proxy-agent@^4.0.0:\nagent-base \"5\"\ndebug \"4\"\n+https-proxy-agent@^5.0.0:\n+ version \"5.0.0\"\n+ resolved \"https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2\"\n+ integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==\n+ dependencies:\n+ agent-base \"6\"\n+ debug \"4\"\n+\nhumanize-ms@^1.2.1:\nversion \"1.2.1\"\nresolved \"https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed\"\n@@ -3724,6 +3750,13 @@ [email protected], ignore-walk@^3.0.1:\ndependencies:\nminimatch \"^3.0.4\"\[email protected]:\n+ version \"3.0.4\"\n+ resolved \"https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.4.tgz#c9a09f69b7c7b479a5d74ac1a3c0d4236d2a6335\"\n+ integrity sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==\n+ dependencies:\n+ minimatch \"^3.0.4\"\n+\nignore@^4.0.3, ignore@^4.0.6:\nversion \"4.0.6\"\nresolved \"https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc\"\n@@ -4232,6 +4265,14 @@ [email protected], js-yaml@~3.13.1:\nargparse \"^1.0.7\"\nesprima \"^4.0.0\"\[email protected]:\n+ version \"3.14.1\"\n+ resolved \"https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537\"\n+ integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==\n+ dependencies:\n+ argparse \"^1.0.7\"\n+ esprima \"^4.0.0\"\n+\njs-yaml@^3.13.1:\nversion \"3.14.0\"\nresolved \"https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482\"\n@@ -5020,7 +5061,7 @@ node-fetch-npm@^2.0.2:\njson-parse-better-errors \"^1.0.0\"\nsafe-buffer \"^5.1.1\"\n-node-fetch@^2.2.0, node-fetch@^2.3.0, node-fetch@^2.5.0:\n+node-fetch@^2.2.0, node-fetch@^2.3.0, node-fetch@^2.5.0, node-fetch@^2.6.1:\nversion \"2.6.7\"\nresolved \"https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad\"\nintegrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==\n@@ -5741,6 +5782,11 @@ pumpify@^1.3.3:\ninherits \"^2.0.3\"\npump \"^2.0.0\"\n+punycode@^1.3.2:\n+ version \"1.4.1\"\n+ resolved \"https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e\"\n+ integrity sha1-wNWmOycYgArY4esPpSachN1BhF4=\n+\npunycode@^2.1.0, punycode@^2.1.1:\nversion \"2.1.1\"\nresolved \"https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec\"\n@@ -6809,6 +6855,17 @@ [email protected]:\nstream-events \"^1.0.5\"\nuuid \"^3.3.2\"\[email protected]:\n+ version \"7.1.1\"\n+ resolved \"https://registry.yarnpkg.com/teeny-request/-/teeny-request-7.1.1.tgz#2b0d156f4a8ad81de44303302ba8d7f1f05e20e6\"\n+ integrity sha512-iwY6rkW5DDGq8hE2YgNQlKbptYpY5Nn2xecjQiNjOXWbKzPGUfmeUBCSQbbr306d7Z7U2N0TPl+/SwYRfua1Dg==\n+ dependencies:\n+ http-proxy-agent \"^4.0.0\"\n+ https-proxy-agent \"^5.0.0\"\n+ node-fetch \"^2.6.1\"\n+ stream-events \"^1.0.5\"\n+ uuid \"^8.0.0\"\n+\ntemp-dir@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d\"\n@@ -7180,6 +7237,13 @@ [email protected]:\nresolved \"https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f\"\nintegrity sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=\[email protected]:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/urlgrey/-/urlgrey-1.0.0.tgz#72d2f904482d0b602e3c7fa599343d699bbe1017\"\n+ integrity sha512-hJfIzMPJmI9IlLkby8QrsCykQ+SXDeO2W5Q9QTW3QpqZVTx4a/K7p8/5q+/isD8vsbVaFgql/gvAoQCRQ2Cb5w==\n+ dependencies:\n+ fast-url-parser \"^1.1.3\"\n+\nuse@^3.1.0:\nversion \"3.1.1\"\nresolved \"https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f\"\n@@ -7202,6 +7266,11 @@ uuid@^3.0.1, uuid@^3.3.2, uuid@^3.3.3:\nresolved \"https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee\"\nintegrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==\n+uuid@^8.0.0:\n+ version \"8.3.2\"\n+ resolved \"https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2\"\n+ integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==\n+\nv8-compile-cache@^2.0.3:\nversion \"2.1.1\"\nresolved \"https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745\"\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore: update codecov |
305,159 | 05.02.2022 09:40:59 | -3,600 | 0ed3db7e25a48a7c641b0f1f05626c8168b9e420 | fix(apis): change generator to make basic authentication optional | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/generator/generateApi.ts",
"new_path": "packages/apis/generator/generateApi.ts",
"diff": "@@ -52,7 +52,7 @@ function generateTypes(operation: Operation): string {\n}\nif (operation.basicAuth) {\n- retVal += ' auth: {user: string, password: string}\\n'\n+ retVal += ' auth?: {user: string, password: string}\\n'\n}\nif (operation.bodyParam) {\nif (operation.bodyParam.description) {\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(apis): change generator to make basic authentication optional |
305,159 | 05.02.2022 09:42:21 | -3,600 | 3ce44383adf838c2e2f79b15829198a881e01442 | fix(apis): make basic authentication optional | [
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/MeAPI.ts",
"new_path": "packages/apis/src/generated/MeAPI.ts",
"diff": "@@ -4,7 +4,7 @@ import {PasswordResetBody, UserResponse} from './types'\nexport interface GetMeRequest {}\nexport interface PutMePasswordRequest {\n- auth: {user: string; password: string}\n+ auth?: {user: string; password: string}\n/** New password */\nbody: PasswordResetBody\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/SigninAPI.ts",
"new_path": "packages/apis/src/generated/SigninAPI.ts",
"diff": "@@ -2,7 +2,7 @@ import {InfluxDB} from '@influxdata/influxdb-client'\nimport {APIBase, RequestOptions} from '../APIBase'\nexport interface PostSigninRequest {\n- auth: {user: string; password: string}\n+ auth?: {user: string; password: string}\n}\n/**\n* Signin API\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/apis/src/generated/UsersAPI.ts",
"new_path": "packages/apis/src/generated/UsersAPI.ts",
"diff": "@@ -5,7 +5,7 @@ import {PasswordResetBody, User, UserResponse, Users} from './types'\nexport interface PostUsersIDPasswordRequest {\n/** The user ID. */\nuserID: string\n- auth: {user: string; password: string}\n+ auth?: {user: string; password: string}\n/** New password */\nbody: PasswordResetBody\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(apis): make basic authentication optional |
305,159 | 18.02.2022 10:22:44 | -3,600 | 6c5a76281b4778d5b1fd219bbf60ff542c4cc94b | chore: revert removal of codecov | [
{
"change_type": "MODIFY",
"old_path": ".circleci/config.yml",
"new_path": ".circleci/config.yml",
"diff": "version: 2.1\n-orbs:\n- codecov: codecov/[email protected]\ncommands:\ninit-dependencies:\n@@ -23,7 +21,7 @@ jobs:\nparameters:\nimage:\ntype: string\n- default: &default-image 'cimg/node:14.17.6'\n+ default: &default-image \"cimg/node:14.17.6\"\ndocker:\n- image: << parameters.image >>\nsteps:\n@@ -51,7 +49,9 @@ jobs:\nyarn --version\nyarn run coverage:ci\nyarn run coverage:send\n- - codecov/upload\n+ - run:\n+ name: Report test results to codecov\n+ command: yarn run coverage:send\n- store_artifacts:\npath: ./packages/core/coverage\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"test:ci\": \"yarn workspaces run test:ci && yarn lint:examples:ci\",\n\"coverage\": \"cd packages/core && yarn build && yarn coverage && cd ../giraffe && yarn coverage\",\n\"coverage:ci\": \"cd packages/core && yarn build && yarn coverage:ci && cd ../giraffe && yarn coverage:ci\",\n+ \"coverage:send\": \"codecov\",\n\"lint:examples\": \"yarn eslint --ignore-pattern node_modules ./examples\",\n\"lint:examples:ci\": \"yarn lint:examples --format junit --output-file ./reports/examples_eslint/eslint.xml\"\n},\n\"license\": \"MIT\",\n\"dependencies\": {\n\"@microsoft/api-documenter\": \"^7.13.34\",\n+ \"codecov\": \"^3.8.3\",\n\"gh-pages\": \"^3.1.0\",\n\"lerna\": \"^3.20.2\",\n\"prettier\": \"^1.19.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/giraffe/package.json",
"new_path": "packages/giraffe/package.json",
"diff": "\"@typescript-eslint/eslint-plugin\": \"^2.9.0\",\n\"@typescript-eslint/parser\": \"^2.9.0\",\n\"chai\": \"^4.2.0\",\n+ \"codecov\": \"^3.6.1\",\n\"eslint\": \"^6.7.1\",\n\"eslint-config-prettier\": \"^6.7.0\",\n\"eslint-plugin-prettier\": \"^3.1.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "resolved \"https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz#8da5c6530915653f3a1f38fd5f101d8c3f8079c5\"\nintegrity sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==\n+\"@tootallnate/once@1\":\n+ version \"1.1.2\"\n+ resolved \"https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82\"\n+ integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==\n+\n\"@types/[email protected]\":\nversion \"1.0.38\"\nresolved \"https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9\"\n@@ -1435,6 +1440,18 @@ agent-base@4, agent-base@^4.3.0:\ndependencies:\nes6-promisify \"^5.0.0\"\n+agent-base@5:\n+ version \"5.1.1\"\n+ resolved \"https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c\"\n+ integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==\n+\n+agent-base@6:\n+ version \"6.0.1\"\n+ resolved \"https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.1.tgz#808007e4e5867decb0ab6ab2f928fbdb5a596db4\"\n+ integrity sha512-01q25QQDwLSsyfhrKbn8yuur+JNw0H+0Y4JiGIKd3z9aYk/w/2kxD/Upc+t2ZBBSUNff50VjPsSW2YxM8QYKVg==\n+ dependencies:\n+ debug \"4\"\n+\nagent-base@~4.2.1:\nversion \"4.2.1\"\nresolved \"https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9\"\n@@ -1576,6 +1593,11 @@ argparse@^1.0.7, argparse@~1.0.9:\ndependencies:\nsprintf-js \"~1.0.2\"\[email protected]:\n+ version \"0.0.2\"\n+ resolved \"https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab\"\n+ integrity sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=\n+\narr-diff@^4.0.0:\nversion \"4.0.0\"\nresolved \"https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520\"\n@@ -2067,6 +2089,28 @@ code-point-at@^1.0.0:\nresolved \"https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77\"\nintegrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=\n+codecov@^3.6.1:\n+ version \"3.7.2\"\n+ resolved \"https://registry.yarnpkg.com/codecov/-/codecov-3.7.2.tgz#998e68c8c1ef4b55cfcf11cd456866d35e13d693\"\n+ integrity sha512-fmCjAkTese29DUX3GMIi4EaKGflHa4K51EoMc29g8fBHawdk/+KEq5CWOeXLdd9+AT7o1wO4DIpp/Z1KCqCz1g==\n+ dependencies:\n+ argv \"0.0.2\"\n+ ignore-walk \"3.0.3\"\n+ js-yaml \"3.13.1\"\n+ teeny-request \"6.0.1\"\n+ urlgrey \"0.4.4\"\n+\n+codecov@^3.8.3:\n+ version \"3.8.3\"\n+ resolved \"https://registry.yarnpkg.com/codecov/-/codecov-3.8.3.tgz#9c3e364b8a700c597346ae98418d09880a3fdbe7\"\n+ integrity sha512-Y8Hw+V3HgR7V71xWH2vQ9lyS358CbGCldWlJFR0JirqoGtOoas3R3/OclRTvgUYFK29mmJICDPauVKmpqbwhOA==\n+ dependencies:\n+ argv \"0.0.2\"\n+ ignore-walk \"3.0.4\"\n+ js-yaml \"3.14.1\"\n+ teeny-request \"7.1.1\"\n+ urlgrey \"1.0.0\"\n+\ncollection-visit@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0\"\n@@ -2397,6 +2441,13 @@ [email protected], debug@^3.1.0:\ndependencies:\nms \"^2.1.1\"\n+debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:\n+ version \"4.1.1\"\n+ resolved \"https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791\"\n+ integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==\n+ dependencies:\n+ ms \"^2.1.1\"\n+\ndebug@^2.2.0, debug@^2.3.3:\nversion \"2.6.9\"\nresolved \"https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f\"\n@@ -2404,13 +2455,6 @@ debug@^2.2.0, debug@^2.3.3:\ndependencies:\nms \"2.0.0\"\n-debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:\n- version \"4.1.1\"\n- resolved \"https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791\"\n- integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==\n- dependencies:\n- ms \"^2.1.1\"\n-\ndebuglog@^1.0.1:\nversion \"1.0.1\"\nresolved \"https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492\"\n@@ -2982,6 +3026,13 @@ fast-levenshtein@~2.0.6:\nresolved \"https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917\"\nintegrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=\n+fast-url-parser@^1.1.3:\n+ version \"1.1.3\"\n+ resolved \"https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d\"\n+ integrity sha1-9K8+qfNNiicc9YrSs3WfQx8LMY0=\n+ dependencies:\n+ punycode \"^1.3.2\"\n+\nfastq@^1.6.0:\nversion \"1.8.0\"\nresolved \"https://registry.yarnpkg.com/fastq/-/fastq-1.8.0.tgz#550e1f9f59bbc65fe185cb6a9b4d95357107f481\"\n@@ -3616,6 +3667,15 @@ http-proxy-agent@^2.1.0:\nagent-base \"4\"\ndebug \"3.1.0\"\n+http-proxy-agent@^4.0.0:\n+ version \"4.0.1\"\n+ resolved \"https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a\"\n+ integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==\n+ dependencies:\n+ \"@tootallnate/once\" \"1\"\n+ agent-base \"6\"\n+ debug \"4\"\n+\nhttp-signature@~1.2.0:\nversion \"1.2.0\"\nresolved \"https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1\"\n@@ -3633,6 +3693,22 @@ https-proxy-agent@^2.2.3:\nagent-base \"^4.3.0\"\ndebug \"^3.1.0\"\n+https-proxy-agent@^4.0.0:\n+ version \"4.0.0\"\n+ resolved \"https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz#702b71fb5520a132a66de1f67541d9e62154d82b\"\n+ integrity sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==\n+ dependencies:\n+ agent-base \"5\"\n+ debug \"4\"\n+\n+https-proxy-agent@^5.0.0:\n+ version \"5.0.0\"\n+ resolved \"https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2\"\n+ integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==\n+ dependencies:\n+ agent-base \"6\"\n+ debug \"4\"\n+\nhumanize-ms@^1.2.1:\nversion \"1.2.1\"\nresolved \"https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed\"\n@@ -3667,13 +3743,20 @@ iferr@^0.1.5:\nresolved \"https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501\"\nintegrity sha1-xg7taebY/bazEEofy8ocGS3FtQE=\n-ignore-walk@^3.0.1:\[email protected], ignore-walk@^3.0.1:\nversion \"3.0.3\"\nresolved \"https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37\"\nintegrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==\ndependencies:\nminimatch \"^3.0.4\"\[email protected]:\n+ version \"3.0.4\"\n+ resolved \"https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.4.tgz#c9a09f69b7c7b479a5d74ac1a3c0d4236d2a6335\"\n+ integrity sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==\n+ dependencies:\n+ minimatch \"^3.0.4\"\n+\nignore@^4.0.3, ignore@^4.0.6:\nversion \"4.0.6\"\nresolved \"https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc\"\n@@ -4182,6 +4265,14 @@ [email protected], js-yaml@~3.13.1:\nargparse \"^1.0.7\"\nesprima \"^4.0.0\"\[email protected]:\n+ version \"3.14.1\"\n+ resolved \"https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537\"\n+ integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==\n+ dependencies:\n+ argparse \"^1.0.7\"\n+ esprima \"^4.0.0\"\n+\njs-yaml@^3.13.1:\nversion \"3.14.0\"\nresolved \"https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482\"\n@@ -4970,7 +5061,7 @@ node-fetch-npm@^2.0.2:\njson-parse-better-errors \"^1.0.0\"\nsafe-buffer \"^5.1.1\"\n-node-fetch@^2.3.0, node-fetch@^2.5.0:\n+node-fetch@^2.2.0, node-fetch@^2.3.0, node-fetch@^2.5.0, node-fetch@^2.6.1:\nversion \"2.6.7\"\nresolved \"https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad\"\nintegrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==\n@@ -5691,6 +5782,11 @@ pumpify@^1.3.3:\ninherits \"^2.0.3\"\npump \"^2.0.0\"\n+punycode@^1.3.2:\n+ version \"1.4.1\"\n+ resolved \"https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e\"\n+ integrity sha1-wNWmOycYgArY4esPpSachN1BhF4=\n+\npunycode@^2.1.0, punycode@^2.1.1:\nversion \"2.1.1\"\nresolved \"https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec\"\n@@ -6512,6 +6608,13 @@ stream-each@^1.1.0:\nend-of-stream \"^1.1.0\"\nstream-shift \"^1.0.0\"\n+stream-events@^1.0.5:\n+ version \"1.0.5\"\n+ resolved \"https://registry.yarnpkg.com/stream-events/-/stream-events-1.0.5.tgz#bbc898ec4df33a4902d892333d47da9bf1c406d5\"\n+ integrity sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==\n+ dependencies:\n+ stubs \"^3.0.0\"\n+\nstream-shift@^1.0.0:\nversion \"1.0.1\"\nresolved \"https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d\"\n@@ -6692,6 +6795,11 @@ strong-log-transformer@^2.0.0:\nminimist \"^1.2.0\"\nthrough \"^2.3.4\"\n+stubs@^3.0.0:\n+ version \"3.0.0\"\n+ resolved \"https://registry.yarnpkg.com/stubs/-/stubs-3.0.0.tgz#e8d2ba1fa9c90570303c030b6900f7d5f89abe5b\"\n+ integrity sha1-6NK6H6nJBXAwPAMLaQD31fiavls=\n+\[email protected]:\nversion \"6.0.0\"\nresolved \"https://registry.yarnpkg.com/supports-color/-/supports-color-6.0.0.tgz#76cfe742cf1f41bb9b1c29ad03068c05b4c0e40a\"\n@@ -6736,6 +6844,28 @@ tar@^4.4.10, tar@^4.4.12, tar@^4.4.8:\nsafe-buffer \"^5.2.1\"\nyallist \"^3.1.1\"\[email protected]:\n+ version \"6.0.1\"\n+ resolved \"https://registry.yarnpkg.com/teeny-request/-/teeny-request-6.0.1.tgz#9b1f512cef152945827ba7e34f62523a4ce2c5b0\"\n+ integrity sha512-TAK0c9a00ELOqLrZ49cFxvPVogMUFaWY8dUsQc/0CuQPGF+BOxOQzXfE413BAk2kLomwNplvdtMpeaeGWmoc2g==\n+ dependencies:\n+ http-proxy-agent \"^4.0.0\"\n+ https-proxy-agent \"^4.0.0\"\n+ node-fetch \"^2.2.0\"\n+ stream-events \"^1.0.5\"\n+ uuid \"^3.3.2\"\n+\[email protected]:\n+ version \"7.1.1\"\n+ resolved \"https://registry.yarnpkg.com/teeny-request/-/teeny-request-7.1.1.tgz#2b0d156f4a8ad81de44303302ba8d7f1f05e20e6\"\n+ integrity sha512-iwY6rkW5DDGq8hE2YgNQlKbptYpY5Nn2xecjQiNjOXWbKzPGUfmeUBCSQbbr306d7Z7U2N0TPl+/SwYRfua1Dg==\n+ dependencies:\n+ http-proxy-agent \"^4.0.0\"\n+ https-proxy-agent \"^5.0.0\"\n+ node-fetch \"^2.6.1\"\n+ stream-events \"^1.0.5\"\n+ uuid \"^8.0.0\"\n+\ntemp-dir@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d\"\n@@ -7102,6 +7232,18 @@ urix@^0.1.0:\nresolved \"https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72\"\nintegrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=\[email protected]:\n+ version \"0.4.4\"\n+ resolved \"https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f\"\n+ integrity sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=\n+\[email protected]:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/urlgrey/-/urlgrey-1.0.0.tgz#72d2f904482d0b602e3c7fa599343d699bbe1017\"\n+ integrity sha512-hJfIzMPJmI9IlLkby8QrsCykQ+SXDeO2W5Q9QTW3QpqZVTx4a/K7p8/5q+/isD8vsbVaFgql/gvAoQCRQ2Cb5w==\n+ dependencies:\n+ fast-url-parser \"^1.1.3\"\n+\nuse@^3.1.0:\nversion \"3.1.1\"\nresolved \"https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f\"\n@@ -7124,6 +7266,11 @@ uuid@^3.0.1, uuid@^3.3.2, uuid@^3.3.3:\nresolved \"https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee\"\nintegrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==\n+uuid@^8.0.0:\n+ version \"8.3.2\"\n+ resolved \"https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2\"\n+ integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==\n+\nv8-compile-cache@^2.0.3:\nversion \"2.1.1\"\nresolved \"https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745\"\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore: revert removal of codecov |
305,159 | 18.02.2022 10:44:03 | -3,600 | 5d15bbcb61e9a953cc0de4ab783222984355c56f | chore(ci): report coverage using codecov binary | [
{
"change_type": "MODIFY",
"old_path": ".circleci/config.yml",
"new_path": ".circleci/config.yml",
"diff": "@@ -51,7 +51,12 @@ jobs:\nyarn --version\nyarn run coverage:ci\nyarn run coverage:send\n- - codecov/upload\n+ - run:\n+ name: Report test results to codecov\n+ command: |\n+ curl -Os https://uploader.codecov.io/latest/linux/codecov\n+ chmod +x codecov\n+ codecov\n- store_artifacts:\npath: ./packages/core/coverage\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(ci): report coverage using codecov binary |
305,159 | 18.02.2022 10:52:05 | -3,600 | 38eabdd891770563ee643b69a170edaf675bd474 | chore(ci): remove yarn coverage:send | [
{
"change_type": "MODIFY",
"old_path": ".circleci/config.yml",
"new_path": ".circleci/config.yml",
"diff": "@@ -48,7 +48,6 @@ jobs:\ncommand: |\nyarn --version\nyarn run coverage:ci\n- yarn run coverage:send\n- run:\nname: Report test results to codecov\ncommand: |\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(ci): remove yarn coverage:send |
305,159 | 18.02.2022 10:54:11 | -3,600 | d47684296e6557d3e2ea623c54364cc776057393 | chore(ci): repair path to codecov binary | [
{
"change_type": "MODIFY",
"old_path": ".circleci/config.yml",
"new_path": ".circleci/config.yml",
"diff": "@@ -52,8 +52,8 @@ jobs:\nname: Report test results to codecov\ncommand: |\ncurl -Os https://uploader.codecov.io/latest/linux/codecov\n- chmod +x codecov\n- codecov\n+ chmod +x ./codecov\n+ ./codecov\n- store_artifacts:\npath: ./packages/core/coverage\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(ci): repair path to codecov binary |
305,159 | 18.02.2022 11:39:28 | -3,600 | b552f77cfbbc4a113cd1b9a1faa2ef53e9e94869 | chore(ci): validate integrity of codecov binary | [
{
"change_type": "MODIFY",
"old_path": ".circleci/config.yml",
"new_path": ".circleci/config.yml",
"diff": "@@ -52,6 +52,10 @@ jobs:\nname: Report test results to codecov\ncommand: |\ncurl -Os https://uploader.codecov.io/latest/linux/codecov\n+ curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM\n+ curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig\n+ gpgv codecov.SHA256SUM.sig codecov.SHA256SUM\n+ shasum -a 256 -c codecov.SHA256SUM\nchmod +x ./codecov\n./codecov\n- store_artifacts:\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(ci): validate integrity of codecov binary |
305,159 | 18.02.2022 11:54:33 | -3,600 | d0e09195ef9466b642c76bcbe6d5b2c0b306f8b0 | chore(ci): add trusted keys for gpg | [
{
"change_type": "MODIFY",
"old_path": ".circleci/config.yml",
"new_path": ".circleci/config.yml",
"diff": "@@ -54,6 +54,7 @@ jobs:\ncurl -Os https://uploader.codecov.io/latest/linux/codecov\ncurl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM\ncurl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig\n+ curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import\ngpgv codecov.SHA256SUM.sig codecov.SHA256SUM\nshasum -a 256 -c codecov.SHA256SUM\nchmod +x ./codecov\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(ci): add trusted keys for gpg |
305,159 | 01.03.2022 13:57:46 | -3,600 | 19709411805301a7fd9bcd6dd92917e16754f323 | feat(core): add FluxTableColumn.get(row) | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/FluxTableColumn.ts",
"new_path": "packages/core/src/results/FluxTableColumn.ts",
"diff": "@@ -13,7 +13,7 @@ export type ColumnType =\n| string\n/**\n- * Column metadata class of a {@link http://bit.ly/flux-spec#table | flux table} column.\n+ * FluxTableColumn describes {@link http://bit.ly/flux-spec#table | flux table} column.\n*/\nexport interface FluxTableColumn {\n/**\n@@ -40,6 +40,41 @@ export interface FluxTableColumn {\n* Index of this column in a row array.\n*/\nindex: number\n+\n+ /**\n+ * ToObject returns a JavaScript object of this columns in the supplied result row, using default deserializers.\n+ * @param row - a row with data for each available column\n+ * @returns column value\n+ */\n+ get: (row: string[]) => any\n+}\n+\n+const identity = (x: string): any => x\n+\n+/**\n+ * A dictionary of serializers of particular types returned by a flux query.\n+ * See {@link https://docs.influxdata.com/influxdb/v2.1/reference/syntax/annotated-csv/#data-types }\n+ */\n+export const typeSerializers: Record<ColumnType, (val: string) => any> = {\n+ boolean: (x: string): any => x === 'true',\n+ unsignedLong: (x: string): any => (x === '' ? null : +x),\n+ long: (x: string): any => (x === '' ? null : +x),\n+ double(x: string): any {\n+ switch (x) {\n+ case '':\n+ return null\n+ case '+Inf':\n+ return Number.POSITIVE_INFINITY\n+ case '-Inf':\n+ return Number.NEGATIVE_INFINITY\n+ default:\n+ return +x\n+ }\n+ },\n+ string: identity,\n+ base64Binary: identity,\n+ duration: (x: string): any => (x === '' ? null : x),\n+ 'dateTime:RFC3339': (x: string): any => (x === '' ? null : x),\n}\n/**\n@@ -51,6 +86,13 @@ class FluxTableColumnImpl implements FluxTableColumn {\ngroup: boolean\ndefaultValue: string\nindex: number\n+ public get(row: string[]): any {\n+ let val = row[this.index]\n+ if (val === '' && this.defaultValue) {\n+ val = this.defaultValue\n+ }\n+ return (typeSerializers[this.dataType] ?? identity)(val)\n+ }\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/FluxTableMetaData.ts",
"new_path": "packages/core/src/results/FluxTableMetaData.ts",
"diff": "-import {FluxTableColumn, ColumnType} from './FluxTableColumn'\n+import {FluxTableColumn, typeSerializers} from './FluxTableColumn'\nimport {IllegalArgumentError} from '../errors'\n-const identity = (x: string): any => x\n-/**\n- * A dictionary of serializers of particular types returned by a flux query.\n- * See {@link https://docs.influxdata.com/influxdb/v2.1/reference/syntax/annotated-csv/#data-types }\n- */\n-export const typeSerializers: Record<ColumnType, (val: string) => any> = {\n- boolean: (x: string): any => x === 'true',\n- unsignedLong: (x: string): any => (x === '' ? null : +x),\n- long: (x: string): any => (x === '' ? null : +x),\n- double(x: string): any {\n- switch (x) {\n- case '':\n- return null\n- case '+Inf':\n- return Number.POSITIVE_INFINITY\n- case '-Inf':\n- return Number.NEGATIVE_INFINITY\n- default:\n- return +x\n- }\n- },\n- string: identity,\n- base64Binary: identity,\n- duration: (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@@ -77,10 +50,10 @@ export interface FluxTableMetaData {\ncolumn(label: string): FluxTableColumn\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+ * Creates an object out of the supplied row values with the help of column descriptors.\n+ * @param row - a row with data for each column\n*/\n- toObject(values: string[]): {[key: string]: any}\n+ toObject(row: string[]): {[key: string]: any}\n}\n/**\n@@ -99,15 +72,11 @@ class FluxTableMetaDataImpl implements FluxTableMetaData {\n}\nthrow new IllegalArgumentError(`Column ${label} not found!`)\n}\n- toObject(values: string[]): {[key: string]: any} {\n+ toObject(row: string[]): {[key: string]: any} {\nconst acc: any = {}\n- for (let i = 0; i < this.columns.length && i < values.length; i++) {\n- let val = values[i]\n+ for (let i = 0; i < this.columns.length && i < row.length; i++) {\nconst column = this.columns[i]\n- if (val === '' && column.defaultValue) {\n- val = column.defaultValue\n- }\n- acc[column.label] = (typeSerializers[column.dataType] ?? identity)(val)\n+ acc[column.label] = column.get(row)\n}\nreturn acc\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): add FluxTableColumn.get(row) |
305,159 | 01.03.2022 16:04:03 | -3,600 | d0593bddac430e8b7bfb8bd2f079d3b6b17f550a | feat(core): allow to return unknown column | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/FluxTableColumn.ts",
"new_path": "packages/core/src/results/FluxTableColumn.ts",
"diff": "@@ -94,6 +94,14 @@ class FluxTableColumnImpl implements FluxTableColumn {\nreturn (typeSerializers[this.dataType] ?? identity)(val)\n}\n}\n+export const UNKNOWN_COLUMN: FluxTableColumn = Object.freeze({\n+ label: '',\n+ dataType: '',\n+ group: false,\n+ defaultValue: '',\n+ index: Number.MAX_SAFE_INTEGER,\n+ get: () => undefined,\n+})\n/**\n* Creates a new flux table column.\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/FluxTableMetaData.ts",
"new_path": "packages/core/src/results/FluxTableMetaData.ts",
"diff": "-import {FluxTableColumn, typeSerializers} from './FluxTableColumn'\n+import {\n+ FluxTableColumn,\n+ UNKNOWN_COLUMN,\n+ typeSerializers,\n+} from './FluxTableColumn'\nimport {IllegalArgumentError} from '../errors'\n/**\n@@ -44,10 +48,11 @@ export interface FluxTableMetaData {\n/**\n* Gets columns by name\n* @param label - column label\n+ * @param noErrorOnMissingColumn - throw error on missing column, true by default\n* @returns table column\n* @throws IllegalArgumentError if column is not found\n**/\n- column(label: string): FluxTableColumn\n+ column(label: string, errorOnMissingColumn?: boolean): FluxTableColumn\n/**\n* Creates an object out of the supplied row values with the help of column descriptors.\n@@ -65,13 +70,16 @@ class FluxTableMetaDataImpl implements FluxTableMetaData {\ncolumns.forEach((col, i) => (col.index = i))\nthis.columns = columns\n}\n- column(label: string): FluxTableColumn {\n+ column(label: string, errorOnMissingColumn = true): FluxTableColumn {\nfor (let i = 0; i < this.columns.length; i++) {\nconst col = this.columns[i]\nif (col.label === label) return col\n}\n+ if (errorOnMissingColumn) {\nthrow new IllegalArgumentError(`Column ${label} not found!`)\n}\n+ return UNKNOWN_COLUMN\n+ }\ntoObject(row: string[]): {[key: string]: any} {\nconst acc: any = {}\nfor (let i = 0; i < this.columns.length && i < row.length; i++) {\n@@ -80,6 +88,9 @@ class FluxTableMetaDataImpl implements FluxTableMetaData {\n}\nreturn acc\n}\n+ get(row: string[], column: string): any {\n+ return this.column(column, false).get(row)\n+ }\n}\n/**\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): allow to return unknown column |
305,159 | 01.03.2022 16:41:29 | -3,600 | 52ef9cf80f9de47cde8b99d1ef241148d5e76f0b | feat(exampled): use the same range in rxjs example | [
{
"change_type": "MODIFY",
"old_path": "examples/rxjs-query.ts",
"new_path": "examples/rxjs-query.ts",
"diff": "@@ -11,7 +11,7 @@ import {url, token, org} from './env'\nconst queryApi = new InfluxDB({url, token}).getQueryApi(org)\nconst fluxQuery =\n- 'from(bucket:\"my-bucket\") |> range(start: 0) |> filter(fn: (r) => r._measurement == \"temperature\")'\n+ 'from(bucket:\"my-bucket\") |> range(start: -1d) |> filter(fn: (r) => r._measurement == \"temperature\")'\nconsole.log('*** QUERY ROWS ***')\n// performs query and receive line table metadata and rows\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(exampled): use the same range in rxjs example |
305,159 | 01.03.2022 16:45:58 | -3,600 | 74b757f384299058279f7b816da164336d2e66c5 | feat(core): simplify retrieval of paricular row columns using a new get and toProxy methods | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/FluxTableMetaData.ts",
"new_path": "packages/core/src/results/FluxTableMetaData.ts",
"diff": "@@ -55,10 +55,25 @@ export interface FluxTableMetaData {\ncolumn(label: string, errorOnMissingColumn?: boolean): FluxTableColumn\n/**\n- * Creates an object out of the supplied row values with the help of column descriptors.\n+ * Creates an object out of the supplied row with the help of column descriptors.\n* @param row - a row with data for each column\n*/\ntoObject(row: string[]): {[key: string]: any}\n+\n+ /**\n+ * Creates a javascript Proxy out of the supplied row with the help of column descriptors.\n+ * @param row - a row with data for each column\n+ * @returns a proxy instance that returns column values, undefined is returned for unknown columns\n+ */\n+ toProxy(row: string[]): Record<string, any>\n+\n+ /**\n+ * Gets column values out of the supplied row.\n+ * @param row - a row with data for each column\n+ * @param column - column name\n+ * @returns column value, undefined for unknown column\n+ */\n+ get(row: string[], column: string): any\n}\n/**\n@@ -88,6 +103,9 @@ class FluxTableMetaDataImpl implements FluxTableMetaData {\n}\nreturn acc\n}\n+ toProxy(row: string[]): {[key: string]: any} {\n+ return new Proxy(row, this)\n+ }\nget(row: string[], column: string): any {\nreturn this.column(column, false).get(row)\n}\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): simplify retrieval of paricular row columns using a new get and toProxy methods |
305,159 | 01.03.2022 17:00:26 | -3,600 | 896b5d0197cd2ce8f77e28682d6e72e6487c2cdc | feat(core): test table.get and table.toProxy | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/FluxTableColumn.ts",
"new_path": "packages/core/src/results/FluxTableColumn.ts",
"diff": "@@ -88,7 +88,7 @@ class FluxTableColumnImpl implements FluxTableColumn {\nindex: number\npublic get(row: string[]): any {\nlet val = row[this.index]\n- if (val === '' && this.defaultValue) {\n+ if ((val === '' || val === undefined) && this.defaultValue) {\nval = this.defaultValue\n}\nreturn (typeSerializers[this.dataType] ?? identity)(val)\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/results/FluxTableMetaData.test.ts",
"new_path": "packages/core/test/unit/results/FluxTableMetaData.test.ts",
"diff": "@@ -49,6 +49,66 @@ describe('FluxTableMetaData', () => {\nexpect(subject.toObject(['3', 'y', 'z'])).to.deep.equal({a: 3, b: 'y'})\nexpect(subject.toObject(['4'])).to.deep.equal({a: 4})\n})\n+ it('get values', () => {\n+ const columns: FluxTableColumn[] = [\n+ createFluxTableColumn({\n+ label: 'a',\n+ defaultValue: '1',\n+ dataType: 'long',\n+ group: false,\n+ }),\n+ createFluxTableColumn({\n+ label: 'b',\n+ index: 2, // index can be possibly set, but it gets overriden during createFluxTableMetaData\n+ }),\n+ ]\n+ const subject = createFluxTableMetaData(columns)\n+ expect(subject.get(['', ''], 'a')).equals(1)\n+ expect(subject.get(['', ''], 'b')).equals('')\n+ expect(subject.get(['', ''], 'c')).is.undefined\n+ expect(subject.get(['2', 'y'], 'a')).equals(2)\n+ expect(subject.get(['2', 'y'], 'b')).equals('y')\n+ expect(subject.get(['2', 'y'], 'c')).is.undefined\n+ expect(subject.get(['3', 'y', 'z'], 'a')).equals(3)\n+ expect(subject.get(['3', 'y', 'z'], 'b')).equals('y')\n+ expect(subject.get(['3', 'y', 'z'], 'c')).is.undefined\n+ expect(subject.get(['4'], 'a')).equals(4)\n+ expect(subject.get(['4'], 'b')).is.undefined\n+ expect(subject.get(['4'], 'c')).is.undefined\n+ expect(subject.get([], 'a')).equals(1)\n+ })\n+ it('creates proxies', () => {\n+ const columns: FluxTableColumn[] = [\n+ createFluxTableColumn({\n+ label: 'a',\n+ defaultValue: '1',\n+ dataType: 'long',\n+ group: false,\n+ }),\n+ createFluxTableColumn({\n+ label: 'b',\n+ index: 2, // index can be possibly set, but it gets overriden during createFluxTableMetaData\n+ }),\n+ ]\n+ const subject = createFluxTableMetaData(columns)\n+ const fromProxy = (p: Record<string, any>): Record<string, any> =>\n+ ['a', 'b', 'c'].reduce((acc, val) => {\n+ if (p[val] !== undefined) {\n+ acc[val] = p[val]\n+ }\n+ return acc\n+ }, {} as Record<string, any>)\n+ expect(fromProxy(subject.toProxy(['', '']))).to.deep.equal({a: 1, b: ''})\n+ expect(fromProxy(subject.toObject(['2', 'y']))).to.deep.equal({\n+ a: 2,\n+ b: 'y',\n+ })\n+ expect(fromProxy(subject.toObject(['3', 'y', 'z']))).to.deep.equal({\n+ a: 3,\n+ b: 'y',\n+ })\n+ expect(fromProxy(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"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): test table.get and table.toProxy |
305,159 | 01.03.2022 17:11:36 | -3,600 | 0ddbf5dd4a5ebba997fe19045c8999113be33f49 | feat(examples/query): show table.get and table.toProxy | [
{
"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 '@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@@ -11,15 +12,29 @@ const fluxQuery =\n'from(bucket:\"my-bucket\") |> range(start: -1d) |> filter(fn: (r) => r._measurement == \"temperature\")'\nconsole.log('*** QUERY ROWS ***')\n-// Execute query and receive table metadata and rows.\n+// There are more ways of how to receive results,\n+// the essential ones are shown/commented below. See also rxjs-query.ts .\n+//\n+// Execute query and receive table metadata and rows as they arrive from the server.\n// https://docs.influxdata.com/influxdb/v2.1/reference/syntax/annotated-csv/\nqueryApi.queryRows(fluxQuery, {\nnext(row: string[], tableMeta: FluxTableMetaData) {\n+ // the following line creates an object for each row\nconst o = tableMeta.toObject(row)\n// console.log(JSON.stringify(o, null, 2))\nconsole.log(\n`${o._time} ${o._measurement} in '${o.location}' (${o.example}): ${o._field}=${o._value}`\n)\n+\n+ // alternatively, you can get only a specific column value without\n+ // the need to create an object for every row\n+ // console.log(tableMeta.get(row, '_time'))\n+\n+ // or you can create a proxy to get column values on demand\n+ // const p = tableMeta.toProxy(row)\n+ // console.log(\n+ // `${p._time} ${p._measurement} in '${p.location}' (${p.example}): ${p._field}=${p._value}`\n+ // )\n},\nerror(error: Error) {\nconsole.error(error)\n@@ -30,30 +45,30 @@ queryApi.queryRows(fluxQuery, {\n},\n})\n-// // Execute query and return the whole result as a string.\n+// // Execute query and collect result rows in a Promise.\n// // Use with caution, it copies the whole stream of results into memory.\n// queryApi\n-// .queryRaw(fluxQuery)\n-// .then(result => {\n-// console.log(result)\n-// console.log('\\nQueryRaw SUCCESS')\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('\\nQueryRaw ERROR')\n+// console.log('\\nCollect ROWS ERROR')\n// })\n-// // Execute query and collect result rows in a Promise.\n+// // Execute query and return the whole result as a string.\n// // Use with caution, it copies the whole stream of results into memory.\n// queryApi\n-// .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+// .queryRaw(fluxQuery)\n+// .then(result => {\n+// console.log(result)\n+// console.log('\\nQueryRaw SUCCESS')\n// })\n// .catch(error => {\n// console.error(error)\n-// console.log('\\nCollect ROWS ERROR')\n+// console.log('\\nQueryRaw ERROR')\n// })\n// Execute query and receive result lines in annotated csv format\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(examples/query): show table.get and table.toProxy |
305,159 | 01.03.2022 17:21:29 | -3,600 | 909c8fae0c8ddd9b7151639ab12de467f83f0e62 | feat(core): replace table.toProxy(row) by new Proxy(row,table) | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/results/FluxTableMetaData.ts",
"new_path": "packages/core/src/results/FluxTableMetaData.ts",
"diff": "@@ -60,13 +60,6 @@ export interface FluxTableMetaData {\n*/\ntoObject(row: string[]): {[key: string]: any}\n- /**\n- * Creates a javascript Proxy out of the supplied row with the help of column descriptors.\n- * @param row - a row with data for each column\n- * @returns a proxy instance that returns column values, undefined is returned for unknown columns\n- */\n- toProxy(row: string[]): Record<string, any>\n-\n/**\n* Gets column values out of the supplied row.\n* @param row - a row with data for each column\n@@ -103,9 +96,6 @@ class FluxTableMetaDataImpl implements FluxTableMetaData {\n}\nreturn acc\n}\n- toProxy(row: string[]): {[key: string]: any} {\n- return new Proxy(row, this)\n- }\nget(row: string[], column: string): any {\nreturn this.column(column, false).get(row)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "packages/core/test/unit/results/FluxTableMetaData.test.ts",
"new_path": "packages/core/test/unit/results/FluxTableMetaData.test.ts",
"diff": "@@ -77,7 +77,7 @@ describe('FluxTableMetaData', () => {\nexpect(subject.get(['4'], 'c')).is.undefined\nexpect(subject.get([], 'a')).equals(1)\n})\n- it('creates proxies', () => {\n+ it('works with proxies', () => {\nconst columns: FluxTableColumn[] = [\ncreateFluxTableColumn({\nlabel: 'a',\n@@ -91,23 +91,26 @@ describe('FluxTableMetaData', () => {\n}),\n]\nconst subject = createFluxTableMetaData(columns)\n- const fromProxy = (p: Record<string, any>): Record<string, any> =>\n- ['a', 'b', 'c'].reduce((acc, val) => {\n+ const useProxy = (row: string[]): Record<string, any> => {\n+ const p = new Proxy<Record<string, any>>(row, subject)\n+ return ['a', 'b', 'c'].reduce((acc, val) => {\nif (p[val] !== undefined) {\nacc[val] = p[val]\n}\nreturn acc\n}, {} as Record<string, any>)\n- expect(fromProxy(subject.toProxy(['', '']))).to.deep.equal({a: 1, b: ''})\n- expect(fromProxy(subject.toObject(['2', 'y']))).to.deep.equal({\n+ }\n+ expect(useProxy(['', ''])).to.deep.equal({a: 1, b: ''})\n+ expect(useProxy(['2', 'y'])).to.deep.equal({\na: 2,\nb: 'y',\n})\n- expect(fromProxy(subject.toObject(['3', 'y', 'z']))).to.deep.equal({\n+ expect(useProxy(['3', 'y', 'z'])).to.deep.equal({\na: 3,\nb: 'y',\n})\n- expect(fromProxy(subject.toObject(['4']))).to.deep.equal({a: 4})\n+ expect(useProxy(['4'])).to.deep.equal({a: 4})\n+ expect(useProxy([])).to.deep.equal({a: 1})\n})\nconst serializationTable: Array<[ColumnType | undefined, string, any]> = [\n['boolean', 'false', false],\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(core): replace table.toProxy(row) by new Proxy(row,table) |
305,159 | 01.03.2022 17:22:39 | -3,600 | c47fd9543d4ca24af7f3593d3545ad6249a2f75d | feat(example): demonstrate usage of Proxy when receiving rows | [
{
"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'\n+import {InfluxDB, FluxTableMetaData} from '@influxdata/influxdb-client'\nimport {url, token, org} from './env'\nconst queryApi = new InfluxDB({url, token}).getQueryApi(org)\n@@ -31,7 +30,7 @@ queryApi.queryRows(fluxQuery, {\n// console.log(tableMeta.get(row, '_time'))\n// or you can create a proxy to get column values on demand\n- // const p = tableMeta.toProxy(row)\n+ // const p = new Proxy<Record<string, any>>(row, tableMeta)\n// console.log(\n// `${p._time} ${p._measurement} in '${p.location}' (${p.example}): ${p._field}=${p._value}`\n// )\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | feat(example): demonstrate usage of Proxy when receiving rows |
305,159 | 03.03.2022 14:43:22 | -3,600 | 936fe78fda4c2c22bf0cd9b9b36f8e7f060a2e3b | fix(examples): fix browser example | [
{
"change_type": "MODIFY",
"old_path": "examples/index.html",
"new_path": "examples/index.html",
"diff": "<script type=\"module\">\n// import latest release from npm repository\nimport {InfluxDB, Point} from 'https://unpkg.com/@influxdata/influxdb-client/dist/index.browser.mjs'\n- // import {PingAPI, SetupAPI} from 'https://unpkg.com/@influxdata/influxdb-client-apis/dist/index.browser.mjs'\n+ import {PingAPI, SetupAPI} from 'https://unpkg.com/@influxdata/influxdb-client-apis/dist/index.browser.mjs'\n// or use the following imports to use local builds\n// import {InfluxDB, Point} from '../packages/core/dist/index.browser.mjs'\n- import {PingAPI, SetupAPI} from '../packages/apis/dist/index.browser.mjs'\n+ // import {PingAPI, SetupAPI} from '../packages/apis/dist/index.browser.mjs'\n/**\n* Import the configuration from ./env_browser.js.\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | fix(examples): fix browser example |
305,159 | 10.03.2022 08:09:20 | -3,600 | 04976dd7117f5670b670f838928072a80bbe2998 | chore(core): repair docs of maxRetries | [
{
"change_type": "MODIFY",
"old_path": "packages/core/src/options.ts",
"new_path": "packages/core/src/options.ts",
"diff": "@@ -91,7 +91,7 @@ export interface WriteRetryOptions extends RetryDelayStrategyOptions {\n*/\nwriteSuccess(this: WriteApi, lines: Array<string>): void\n- /** max number of retries when write fails */\n+ /** max number of write attempts when the write fails */\nmaxRetries: number\n/** max time (millis) that can be spent with retries */\nmaxRetryTime: number\n"
}
] | TypeScript | MIT License | influxdata/influxdb-client-js | chore(core): repair docs of maxRetries |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.