@kronos-integration/service-influxdb 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: /
5
+ schedule:
6
+ interval: daily
7
+ commit-message:
8
+ prefix: "fix(deps):"
9
+ prefix-development: "chore(deps):"
10
+ labels:
11
+ - npm dependencies
12
+ - package-ecosystem: github-actions
13
+ directory: /
14
+ schedule:
15
+ interval: daily
16
+ commit-message:
17
+ prefix: "chore(action):"
18
+ labels:
19
+ - dependencies
@@ -0,0 +1,61 @@
1
+ ci:
2
+ - changed-files:
3
+ - any-glob-to-any-file:
4
+ - .github/workflows/*
5
+ - .travis.yml
6
+ dependencies:
7
+ - changed-files:
8
+ - any-glob-to-any-file:
9
+ - package-lock.json
10
+ - yarn.lockfile
11
+ deployment:
12
+ - changed-files:
13
+ - any-glob-to-any-file:
14
+ - netlify.toml
15
+ - _redirects
16
+ documentation:
17
+ - changed-files:
18
+ - any-glob-to-any-file:
19
+ - docs/**/*
20
+ - "**/*.md"
21
+ github:
22
+ - changed-files:
23
+ - any-glob-to-any-file:
24
+ - .github/**/*
25
+ git:
26
+ - changed-files:
27
+ - any-glob-to-any-file:
28
+ - .gitignore
29
+ labels:
30
+ - changed-files:
31
+ - any-glob-to-any-file:
32
+ - .github/pr_labeler.yml
33
+ lint:
34
+ - changed-files:
35
+ - any-glob-to-any-file:
36
+ - .stylelintrc.json
37
+ npm:
38
+ - changed-files:
39
+ - any-glob-to-any-file:
40
+ - .npmignore
41
+ - package.json
42
+ - package-lock.json
43
+ openapi:
44
+ - changed-files:
45
+ - any-glob-to-any-file:
46
+ - openapi/*
47
+ rollup:
48
+ - changed-files:
49
+ - any-glob-to-any-file:
50
+ - rollup.config.mjs
51
+ styling:
52
+ - changed-files:
53
+ - any-glob-to-any-file:
54
+ - "**/*.css"
55
+ test:
56
+ - changed-files:
57
+ - any-glob-to-any-file: tests/**/*
58
+ vscode:
59
+ - changed-files:
60
+ - any-glob-to-any-file:
61
+ - .vscode/*
@@ -0,0 +1,11 @@
1
+ name: Auto approve
2
+ on: pull_request_target
3
+ jobs:
4
+ auto-approve:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: hmarr/auto-approve-action@v4.0.0
8
+ if: github.actor == 'dependabot[bot]'
9
+ with:
10
+ github-token: ${{ secrets.GITHUB_TOKEN }}
11
+ review-message: Auto approved automated PR
@@ -0,0 +1,87 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ - next
7
+ pull_request:
8
+ branches:
9
+ - master
10
+ - next
11
+ permissions:
12
+ contents: read
13
+ jobs:
14
+ test-node:
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ os:
19
+ - ubuntu-latest
20
+ node-version:
21
+ - 24.4.1
22
+ steps:
23
+ - name: checkout
24
+ uses: actions/checkout@v4.2.2
25
+ # - name: Setup InfluxDB
26
+ # uses: influxdata/influxdb-action@v3
27
+ # with:
28
+ # influxdb_version: latest
29
+ # influxdb_org: influxdata
30
+ # influxdb_user: ci_user
31
+ # influxdb_password: password
32
+ # influxdb_bucket: dummy
33
+ - name: prepare node
34
+ uses: actions/setup-node@v4.4.0
35
+ with:
36
+ node-version: ${{ matrix.node-version }}
37
+ cache: npm
38
+ cache-dependency-path: package-lock.json
39
+ - name: install
40
+ run: npm ci
41
+ - name: test and coverage
42
+ run: npm run cover --if-present
43
+ - name: coveralls
44
+ uses: coverallsapp/github-action@v2
45
+ with:
46
+ github-token: ${{ secrets.GITHUB_TOKEN }}
47
+ flag-name: run-${{ matrix.test_number }}
48
+ path-to-lcov: build/coverage/lcov.info
49
+ parallel: true
50
+ continue-on-error: true
51
+ release:
52
+ needs:
53
+ - test-node
54
+ runs-on: ubuntu-latest
55
+ permissions:
56
+ contents: write
57
+ issues: write
58
+ pull-requests: write
59
+ id-token: write
60
+ steps:
61
+ - name: checkout
62
+ uses: actions/checkout@v4.2.2
63
+ - name: prepare node
64
+ uses: actions/setup-node@v4.4.0
65
+ with:
66
+ node-version: 22.17.1
67
+ cache: npm
68
+ cache-dependency-path: package-lock.json
69
+ - name: install
70
+ run: npm ci
71
+ - name: release
72
+ run: npx semantic-release
73
+ env:
74
+ CI: "true"
75
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
76
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77
+ finish:
78
+ needs:
79
+ - test-node
80
+ runs-on: ubuntu-latest
81
+ steps:
82
+ - name: finish coveralls
83
+ uses: coverallsapp/github-action@v2
84
+ with:
85
+ github-token: ${{ secrets.GITHUB_TOKEN }}
86
+ path-to-lcov: build/coverage/lcov.info
87
+ parallel-finished: true
@@ -0,0 +1,31 @@
1
+ name: CodeQL
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+ branches:
8
+ - master
9
+ jobs:
10
+ analyze:
11
+ name: Analyze
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: checkout
15
+ uses: actions/checkout@v4.2.2
16
+ - name: git checkout
17
+ run: git checkout
18
+ if: ${{ github.event_name == 'pull_request' }}
19
+ - name: initialize CodeQL
20
+ uses: github/codeql-action/init@v3
21
+ with:
22
+ languages: javascript
23
+ - name: prepare node
24
+ uses: actions/setup-node@v4.4.0
25
+ with:
26
+ node-version: 22.17.1
27
+ cache: npm
28
+ - name: install
29
+ run: npm ci
30
+ - name: perform CodeQL analysis
31
+ uses: github/codeql-action/analyze@v3
@@ -0,0 +1,14 @@
1
+ name: Pull Request Labeler
2
+ on: pull_request_target
3
+ jobs:
4
+ triage:
5
+ permissions:
6
+ contents: read
7
+ pull-requests: write
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/labeler@v5
11
+ with:
12
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
13
+ configuration-path: .github/pr_labeler.yml
14
+ sync-labels: false
@@ -0,0 +1,42 @@
1
+ name: Update package lock
2
+ on:
3
+ push:
4
+ paths:
5
+ - package.json
6
+ schedule:
7
+ - cron: 13 8 * * 6
8
+ jobs:
9
+ update_package_lock:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ node-version:
14
+ - 22.17.1
15
+ browser:
16
+ - chrome
17
+ steps:
18
+ - name: checkout
19
+ uses: actions/checkout@v4.2.2
20
+ - name: prepare node
21
+ uses: actions/setup-node@v4.4.0
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ - name: remove lock
25
+ run: rm package-lock.json
26
+ - name: install playwright
27
+ run: npx playwright install
28
+ - name: test
29
+ run: npm install-test
30
+ env:
31
+ BROWSER: ${{ matrix.browser }}
32
+ - name: create pull request
33
+ uses: gr2m/create-or-update-pull-request-action@v1.10.1
34
+ env:
35
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36
+ with:
37
+ path: package-lock.json
38
+ title: Regenerate package lock
39
+ body: bring lock in sync
40
+ branch: package-lock
41
+ labels: npm
42
+ commit-message: "chore(deps): lock"
@@ -0,0 +1,29 @@
1
+ name: API to readme
2
+ on:
3
+ schedule:
4
+ - cron: 31 14 * * 6
5
+ push:
6
+ paths:
7
+ - src/*
8
+ jobs:
9
+ update_readme_api:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: checkout
13
+ uses: actions/checkout@v4.2.2
14
+ - name: prepare node
15
+ uses: actions/setup-node@v4.4.0
16
+ with:
17
+ node-version: 22.17.1
18
+ - name: install
19
+ run: npm ci
20
+ - name: run docs
21
+ run: npm run docs
22
+ - uses: gr2m/create-or-update-pull-request-action@v1.10.1
23
+ env:
24
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25
+ with:
26
+ path: README.md
27
+ title: Sync API into README
28
+ branch: readme-api
29
+ commit-message: "docs(README): sync API"
package/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (C) 2025 by arlac77
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted.
5
+
6
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
8
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
9
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
10
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
11
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
12
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ [![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)
2
+ [![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\&label\&labelColor=blue\&color=555555)](https://typescriptlang.org)
3
+ [![GitHub Issues](https://img.shields.io/github/issues/Kronos-Integration/service-influxdb.svg?style=flat-square)](https://github.com/Kronos-Integration/service-influxdb/issues)
4
+ [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FKronos-Integration%2Fservice-influxdb%2Fbadge\&style=flat)](https://actions-badge.atrox.dev/Kronos-Integration/service-influxdb/goto)
5
+ [![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
6
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
7
+ [![Known Vulnerabilities](https://snyk.io/test/github/Kronos-Integration/service-influxdb/badge.svg)](https://snyk.io/test/github/Kronos-Integration/service-influxdb)
8
+ [![Coverage Status](https://coveralls.io/repos/Kronos-Integration/service-influxdb/badge.svg)](https://coveralls.io/github/Kronos-Integration/service-influxdb)
9
+
10
+ # @kronos-integration/service-influxdb
11
+
12
+ influxdb service
13
+
14
+ # API
15
+
16
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
17
+
18
+ ### Table of Contents
19
+
20
+ * [ServiceInfluxdb](#serviceinfluxdb)
21
+ * [extendetName](#extendetname)
22
+ * [name](#name)
23
+
24
+ ## ServiceInfluxdb
25
+
26
+ **Extends Service**
27
+
28
+ influxdb client.
29
+
30
+ ### extendetName
31
+
32
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name with url
33
+
34
+ ### name
35
+
36
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 'influxdb'
37
+
38
+ # install
39
+
40
+ With [npm](http://npmjs.org) do:
41
+
42
+ ```shell
43
+ npm install @kronos-integration/service-influxdb
44
+ ```
45
+
46
+ # license
47
+
48
+ BSD-2-Clause
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@kronos-integration/service-influxdb",
3
+ "version": "1.0.0",
4
+ "publishConfig": {
5
+ "access": "public",
6
+ "provenance": true
7
+ },
8
+ "types": "./types/service-influxdb.d.mts",
9
+ "exports": {
10
+ ".": {
11
+ "default": "./src/service-influxdb.mjs",
12
+ "types": "./types/service-influxdb.d.mts"
13
+ }
14
+ },
15
+ "description": "influxdb service",
16
+ "keywords": [
17
+ "influxdb",
18
+ "kronos-service"
19
+ ],
20
+ "contributors": [
21
+ {
22
+ "name": "Markus Felten",
23
+ "email": "markus.felten@gmx.de"
24
+ }
25
+ ],
26
+ "license": "BSD-2-Clause",
27
+ "scripts": {
28
+ "prepare": "node --run prepare:typescript",
29
+ "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
30
+ "test": "node --run test:ava",
31
+ "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
32
+ "cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
33
+ "docs": "documentation readme --section=API ./src/**/*.mjs",
34
+ "lint": "node --run lint:docs && node --run lint:typescript",
35
+ "lint:docs": "documentation lint ./src/**/*.mjs",
36
+ "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
37
+ },
38
+ "dependencies": {
39
+ "@influxdata/influxdb-client": "^1.35.0",
40
+ "@kronos-integration/service": "^13.0.0",
41
+ "pacc": "^3.8.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^24.0.15",
45
+ "ava": "^6.4.1",
46
+ "c8": "^10.1.3",
47
+ "documentation": "^14.0.3",
48
+ "got": "^14.4.7",
49
+ "network-address": "^1.1.2",
50
+ "semantic-release": "^24.2.7",
51
+ "typescript": "^5.8.3"
52
+ },
53
+ "engines": {
54
+ "node": ">=22.17.1"
55
+ },
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/Kronos-Integration/service-influxdb.git"
59
+ },
60
+ "template": {
61
+ "inheritFrom": [
62
+ "arlac77/template-arlac77-github",
63
+ "arlac77/template-kronos-component",
64
+ "arlac77/template-typescript"
65
+ ]
66
+ }
67
+ }
@@ -0,0 +1,55 @@
1
+ import { prepareAttributesDefinitions, url_attribute } from "pacc";
2
+ import { Service } from "@kronos-integration/service";
3
+ import { InfluxDB } from "@influxdata/influxdb-client";
4
+
5
+ /**
6
+ * influxdb client.
7
+ */
8
+ export class ServiceInfluxdb extends Service {
9
+ /**
10
+ * @return {string} 'influxdb'
11
+ */
12
+ static get name() {
13
+ return "influxdb";
14
+ }
15
+
16
+ static get description() {
17
+ return "influxdb client";
18
+ }
19
+
20
+ static attributes = prepareAttributesDefinitions({
21
+ url: {
22
+ ...url_attribute,
23
+ description: "url of the influxdb server",
24
+ needsRestart: true,
25
+ env: "INFLUXDB_URL"
26
+ },
27
+ token: {
28
+ type: "string",
29
+ private: true,
30
+ env: "INFLUXDB_TOKEN"
31
+ },
32
+ ...Service.attributes
33
+ });
34
+
35
+ /**
36
+ * @return {string} name with url
37
+ */
38
+ get extendetName() {
39
+ return `${this.name}(${this.url})`;
40
+ }
41
+
42
+ async _start() {
43
+ await super._start();
44
+
45
+ const client = new InfluxDB({ url: this.url, token: this.token });
46
+
47
+ this.client = client;
48
+ }
49
+
50
+ async _stop() {
51
+ return super._stop();
52
+ }
53
+ }
54
+
55
+ export default ServiceInfluxdb;
@@ -0,0 +1,19 @@
1
+ import test from "ava";
2
+
3
+ import { StandaloneServiceProvider } from "@kronos-integration/service";
4
+ import { ServiceInfluxdb } from "@kronos-integration/service-influxdb";
5
+
6
+ test("start / stop", async t => {
7
+ const sp = new StandaloneServiceProvider();
8
+
9
+ const influxdb = await sp.declareService({
10
+ type: ServiceInfluxdb,
11
+ url: "http://localhost:8086"
12
+ });
13
+
14
+ await influxdb.start();
15
+ t.is(influxdb.state, "running");
16
+
17
+ await influxdb.stop();
18
+ t.is(influxdb.state, "stopped");
19
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * influxdb client.
3
+ */
4
+ export class ServiceInfluxdb extends Service {
5
+ static attributes: any;
6
+ client: InfluxDB;
7
+ }
8
+ export default ServiceInfluxdb;
9
+ import { Service } from "@kronos-integration/service";
10
+ import { InfluxDB } from "@influxdata/influxdb-client";