@things-factory/integration-influxdb 6.2.134
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.
- package/CHANGELOG.md +8 -0
- package/README.md +0 -0
- package/client/bootstrap.ts +9 -0
- package/client/editors/property-editor.ts +20 -0
- package/client/editors/things-editor-influxdb-point-scheme.ts +304 -0
- package/client/index.ts +0 -0
- package/dist-server/engine/connector/index.js +4 -0
- package/dist-server/engine/connector/index.js.map +1 -0
- package/dist-server/engine/connector/influxdb.js +56 -0
- package/dist-server/engine/connector/influxdb.js.map +1 -0
- package/dist-server/engine/index.js +5 -0
- package/dist-server/engine/index.js.map +1 -0
- package/dist-server/engine/task/index.js +5 -0
- package/dist-server/engine/task/index.js.map +1 -0
- package/dist-server/engine/task/influxdb-query.js +59 -0
- package/dist-server/engine/task/influxdb-query.js.map +1 -0
- package/dist-server/engine/task/influxdb-write-point.js +70 -0
- package/dist-server/engine/task/influxdb-write-point.js.map +1 -0
- package/dist-server/index.js +4 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/helps/integration/connector/influxdb-connector.ja.md +17 -0
- package/helps/integration/connector/influxdb-connector.ko.md +17 -0
- package/helps/integration/connector/influxdb-connector.md +17 -0
- package/helps/integration/connector/influxdb-connector.ms.md +17 -0
- package/helps/integration/connector/influxdb-connector.zh.md +17 -0
- package/helps/integration/task/influxdb-query.ja.md +15 -0
- package/helps/integration/task/influxdb-query.ko.md +15 -0
- package/helps/integration/task/influxdb-query.md +15 -0
- package/helps/integration/task/influxdb-query.ms.md +15 -0
- package/helps/integration/task/influxdb-query.zh.md +15 -0
- package/helps/integration/task/influxdb-write-point.ja.md +28 -0
- package/helps/integration/task/influxdb-write-point.ko.md +28 -0
- package/helps/integration/task/influxdb-write-point.md +28 -0
- package/helps/integration/task/influxdb-write-point.ms.md +28 -0
- package/helps/integration/task/influxdb-write-point.zh.md +28 -0
- package/package.json +32 -0
- package/server/engine/connector/index.ts +1 -0
- package/server/engine/connector/influxdb.ts +66 -0
- package/server/engine/index.ts +2 -0
- package/server/engine/task/index.ts +2 -0
- package/server/engine/task/influxdb-query.ts +95 -0
- package/server/engine/task/influxdb-write-point.ts +89 -0
- package/server/index.ts +1 -0
- package/things-factory.config.js +5 -0
- package/translations/en.json +8 -0
- package/translations/ja.json +8 -0
- package/translations/ko.json +8 -0
- package/translations/ms.json +8 -0
- package/translations/zh.json +8 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
<!-- ## [Unreleased] -->
|
package/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import './things-editor-influxdb-point-scheme'
|
|
5
|
+
|
|
6
|
+
import { html } from 'lit'
|
|
7
|
+
|
|
8
|
+
import { OxPropertyEditor } from '@operato/property-editor'
|
|
9
|
+
|
|
10
|
+
export class PropertyEditorInfluxDBScheme extends OxPropertyEditor {
|
|
11
|
+
static get styles() {
|
|
12
|
+
return [...OxPropertyEditor.styles]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
editorTemplate(value, spec) {
|
|
16
|
+
return html` <things-editor-influxdb-point-scheme id="editor" .value=${value}></things-editor-influxdb-point-scheme> `
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
customElements.define('property-editor-influxdb-point-scheme', PropertyEditorInfluxDBScheme)
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@material/mwc-icon'
|
|
6
|
+
|
|
7
|
+
import '@operato/i18n/ox-i18n.js'
|
|
8
|
+
import { css, html } from 'lit'
|
|
9
|
+
import { customElement, property, queryAll } from 'lit/decorators.js'
|
|
10
|
+
|
|
11
|
+
import { OxFormField } from '@operato/input'
|
|
12
|
+
|
|
13
|
+
type InfluxDBPointScheme = {
|
|
14
|
+
name: string
|
|
15
|
+
type: string
|
|
16
|
+
val?: any
|
|
17
|
+
accessor?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
input component for influxdb point scheme
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
|
|
25
|
+
<things-editor-influxdb-point-scheme
|
|
26
|
+
value=${map}
|
|
27
|
+
</things-editor-influxdb-point-scheme>
|
|
28
|
+
*/
|
|
29
|
+
@customElement('things-editor-influxdb-point-scheme')
|
|
30
|
+
export class ThingsEditorProcedureParameters extends OxFormField {
|
|
31
|
+
static styles = [
|
|
32
|
+
css`
|
|
33
|
+
:host {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
gap: var(--margin-default);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
div {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-flow: row nowrap;
|
|
43
|
+
gap: var(--margin-default);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
button {
|
|
47
|
+
border: var(--button-border);
|
|
48
|
+
border-radius: var(--border-radius);
|
|
49
|
+
background-color: var(--button-background-color);
|
|
50
|
+
padding: var(--padding-narrow) var(--padding-default);
|
|
51
|
+
line-height: 0.8;
|
|
52
|
+
color: var(--button-color);
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
button + button {
|
|
57
|
+
margin-left: -5px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
button mwc-icon {
|
|
61
|
+
font-size: var(--fontsize-default);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
button:focus,
|
|
65
|
+
button:hover,
|
|
66
|
+
button:active {
|
|
67
|
+
border: var(--button-activ-border);
|
|
68
|
+
background-color: var(--button-background-focus-color);
|
|
69
|
+
color: var(--theme-white-color);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
input {
|
|
73
|
+
flex: 1;
|
|
74
|
+
border: 0;
|
|
75
|
+
border-bottom: var(--border-dark-color);
|
|
76
|
+
padding: var(--input-padding);
|
|
77
|
+
font: var(--input-font);
|
|
78
|
+
color: var(--primary-text-color);
|
|
79
|
+
min-width: 50px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
input:focus {
|
|
83
|
+
outline: none;
|
|
84
|
+
border-bottom: 1px solid var(--primary-color);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
button.hidden {
|
|
88
|
+
opacity: 0;
|
|
89
|
+
cursor: default;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
select,
|
|
93
|
+
ox-select,
|
|
94
|
+
input:not([type='checkbox']) {
|
|
95
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
96
|
+
border-radius: 4px;
|
|
97
|
+
}
|
|
98
|
+
`
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
@property({ type: Array }) value: InfluxDBPointScheme[] = []
|
|
102
|
+
|
|
103
|
+
private _changingNow: boolean = false
|
|
104
|
+
|
|
105
|
+
@queryAll('[data-record]') records!: NodeListOf<HTMLElement>
|
|
106
|
+
|
|
107
|
+
firstUpdated() {
|
|
108
|
+
this.renderRoot.addEventListener('change', this._onChange.bind(this))
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
render() {
|
|
112
|
+
const parameters = this.value || []
|
|
113
|
+
|
|
114
|
+
return html`
|
|
115
|
+
${parameters.map(
|
|
116
|
+
item => html`
|
|
117
|
+
<div data-record>
|
|
118
|
+
<input type="text" data-name placeholder="name" .value=${item.name} />
|
|
119
|
+
<select data-type placeholder="type" .value=${item.type}>
|
|
120
|
+
<option value="" ?selected=${item.type == ''}> </option>
|
|
121
|
+
<option value="Tag" ?selected=${item.type == 'Tag'}>Tag</option>
|
|
122
|
+
<option value="String" ?selected=${item.type == 'String'}>String</option>
|
|
123
|
+
<option value="Integer" ?selected=${item.type == 'Integer'}>Integer</option>
|
|
124
|
+
<option value="Unsigned" ?selected=${item.type == 'Unsigned'}>Unsigned</option>
|
|
125
|
+
<option value="Float" ?selected=${item.type == 'Float'}>Float</option>
|
|
126
|
+
<option value="Boolean" ?selected=${item.type == 'Boolean'}>Boolean</option>
|
|
127
|
+
</select>
|
|
128
|
+
|
|
129
|
+
<input type="text" data-accessor placeholder="accessor" .value=${item.accessor || ''} list="step-list" />
|
|
130
|
+
<input type="text" data-val placeholder="val" .value=${item.val || ''} />
|
|
131
|
+
|
|
132
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._delete(e)} tabindex="-1">
|
|
133
|
+
<mwc-icon>remove</mwc-icon>
|
|
134
|
+
</button>
|
|
135
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._up(e)} tabindex="-1">
|
|
136
|
+
<mwc-icon>arrow_upward</mwc-icon>
|
|
137
|
+
</button>
|
|
138
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._down(e)} tabindex="-1">
|
|
139
|
+
<mwc-icon>arrow_downward</mwc-icon>
|
|
140
|
+
</button>
|
|
141
|
+
</div>
|
|
142
|
+
`
|
|
143
|
+
)}
|
|
144
|
+
|
|
145
|
+
<div data-record-new>
|
|
146
|
+
<input type="text" data-name placeholder="name" value="" />
|
|
147
|
+
<select data-type placeholder="type" value="">
|
|
148
|
+
<option value="" selected> </option>
|
|
149
|
+
<option value="Tag">Tag</option>
|
|
150
|
+
<option value="String">String</option>
|
|
151
|
+
<option value="Integer">Integer</option>
|
|
152
|
+
<option value="Unsigned">Unsigned</option>
|
|
153
|
+
<option value="Float">Float</option>
|
|
154
|
+
<option value="Boolean">Boolean</option>
|
|
155
|
+
</select>
|
|
156
|
+
<input type="text" data-accessor placeholder="accessor" value="" list="step-list" />
|
|
157
|
+
<input type="text" data-val placeholder="val" value="" />
|
|
158
|
+
|
|
159
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
|
|
160
|
+
<mwc-icon>add</mwc-icon>
|
|
161
|
+
</button>
|
|
162
|
+
<button class="hidden"><mwc-icon>arrow_upward</mwc-icon></button>
|
|
163
|
+
<button class="hidden"><mwc-icon>arrow_downward</mwc-icon></button>
|
|
164
|
+
</div>
|
|
165
|
+
`
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
_onChange(e: Event) {
|
|
169
|
+
if (this._changingNow) {
|
|
170
|
+
return
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
this._changingNow = true
|
|
174
|
+
|
|
175
|
+
const input = e.target as HTMLInputElement
|
|
176
|
+
|
|
177
|
+
const record = (e.target as Element).closest('[data-record],[data-record-new]') as HTMLElement
|
|
178
|
+
|
|
179
|
+
if (record.hasAttribute('data-record')) {
|
|
180
|
+
this._build()
|
|
181
|
+
} else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-type')) {
|
|
182
|
+
this._add()
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
this._changingNow = false
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
_adjust({ name, type, val, accessor }: InfluxDBPointScheme): InfluxDBPointScheme {
|
|
189
|
+
const entry = {
|
|
190
|
+
name: name && String(name).trim(),
|
|
191
|
+
type,
|
|
192
|
+
accessor: accessor && String(accessor).trim(),
|
|
193
|
+
val
|
|
194
|
+
} as InfluxDBPointScheme
|
|
195
|
+
|
|
196
|
+
return entry
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
_build(includeNewRecord?: boolean) {
|
|
200
|
+
if (includeNewRecord) {
|
|
201
|
+
var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]') as NodeListOf<HTMLElement>
|
|
202
|
+
} else {
|
|
203
|
+
var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
var newmap: InfluxDBPointScheme[] = []
|
|
207
|
+
|
|
208
|
+
for (var i = 0; i < records.length; i++) {
|
|
209
|
+
var record = records[i]
|
|
210
|
+
|
|
211
|
+
const name = (record.querySelector('[data-name]') as HTMLInputElement).value
|
|
212
|
+
const type = (record.querySelector('[data-type]') as HTMLInputElement).value
|
|
213
|
+
const val = (record.querySelector('[data-val]') as HTMLInputElement).value
|
|
214
|
+
const accessor = (record.querySelector('[data-accessor]') as HTMLInputElement).value
|
|
215
|
+
|
|
216
|
+
const inputs = record.querySelectorAll('[data-type]:not([style*="display: none"])') as NodeListOf<HTMLInputElement>
|
|
217
|
+
|
|
218
|
+
if (!inputs || inputs.length == 0) {
|
|
219
|
+
continue
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (name) {
|
|
223
|
+
newmap.push(this._adjust({ name, type, val, accessor }))
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
this.value = newmap
|
|
228
|
+
this._updateValue()
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
_updateValue() {
|
|
232
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
_add() {
|
|
236
|
+
this._build(true)
|
|
237
|
+
|
|
238
|
+
const inputs = this.renderRoot.querySelectorAll('[data-record-new] input:not([style*="display: none"])') as NodeListOf<HTMLInputElement & { value: any }>
|
|
239
|
+
|
|
240
|
+
for (var i = 0; i < inputs.length; i++) {
|
|
241
|
+
let input = inputs[i]
|
|
242
|
+
|
|
243
|
+
input.value = ''
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
inputs[0].focus()
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
_delete(e: MouseEvent) {
|
|
250
|
+
const record = (e.target as Element).closest('[data-record]') as HTMLElement
|
|
251
|
+
|
|
252
|
+
;(record!.querySelector('[data-name]') as HTMLInputElement)!.value = ''
|
|
253
|
+
|
|
254
|
+
this._build()
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
_up(e: MouseEvent) {
|
|
258
|
+
const record = (e.target as Element).closest('[data-record]') as HTMLElement
|
|
259
|
+
const array = Array.from(this.records)
|
|
260
|
+
const index = array.indexOf(record) - 1
|
|
261
|
+
|
|
262
|
+
if (index < 0) {
|
|
263
|
+
return
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const deleted = array.splice(index, 1)
|
|
267
|
+
array.splice(index + 1, 0, ...deleted)
|
|
268
|
+
|
|
269
|
+
this.value = array.map(record => {
|
|
270
|
+
const name = (record.querySelector('[data-name]') as HTMLInputElement).value
|
|
271
|
+
const type = (record.querySelector('[data-type]') as HTMLInputElement).value
|
|
272
|
+
const val = (record.querySelector('[data-val]') as HTMLInputElement).value
|
|
273
|
+
const accessor = (record.querySelector('[data-accessor]') as HTMLInputElement).value
|
|
274
|
+
|
|
275
|
+
return this._adjust({ name, type, val, accessor })
|
|
276
|
+
})
|
|
277
|
+
|
|
278
|
+
this._updateValue()
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
_down(e: MouseEvent) {
|
|
282
|
+
const record = (e.target as Element).closest('[data-record]') as HTMLElement
|
|
283
|
+
const array = Array.from(this.records)
|
|
284
|
+
const index = array.indexOf(record)
|
|
285
|
+
|
|
286
|
+
if (index > array.length) {
|
|
287
|
+
return
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
array.splice(index, 1)
|
|
291
|
+
array.splice(index + 1, 0, record)
|
|
292
|
+
|
|
293
|
+
this.value = array.map(record => {
|
|
294
|
+
const name = (record.querySelector('[data-name]') as HTMLInputElement).value
|
|
295
|
+
const type = (record.querySelector('[data-type]') as HTMLInputElement).value
|
|
296
|
+
const val = (record.querySelector('[data-val]') as HTMLInputElement).value
|
|
297
|
+
const accessor = (record.querySelector('[data-accessor]') as HTMLInputElement).value
|
|
298
|
+
|
|
299
|
+
return this._adjust({ name, type, val, accessor })
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
this._updateValue()
|
|
303
|
+
}
|
|
304
|
+
}
|
package/client/index.ts
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/engine/connector/index.ts"],"names":[],"mappings":";;AAAA,sBAAmB","sourcesContent":["import './influxdb'\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InfluxDBConnector = void 0;
|
|
4
|
+
const influxdb_client_1 = require("@influxdata/influxdb-client");
|
|
5
|
+
const integration_base_1 = require("@things-factory/integration-base");
|
|
6
|
+
class InfluxDBConnector {
|
|
7
|
+
async ready(connectionConfigs) {
|
|
8
|
+
await Promise.all(connectionConfigs.map(this.connect.bind(this)));
|
|
9
|
+
integration_base_1.ConnectionManager.logger.info('influxdb connections are ready');
|
|
10
|
+
}
|
|
11
|
+
checkConnectionInstance(domain, connectionName) {
|
|
12
|
+
var _a;
|
|
13
|
+
try {
|
|
14
|
+
const connection = integration_base_1.ConnectionManager.getConnectionInstanceByName(domain, connectionName);
|
|
15
|
+
return !!(((_a = connection === null || connection === void 0 ? void 0 : connection.client) === null || _a === void 0 ? void 0 : _a.connectionState) !== 'online');
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async connect(connection) {
|
|
22
|
+
var { endpoint, params: { token } } = connection;
|
|
23
|
+
try {
|
|
24
|
+
const client = new influxdb_client_1.InfluxDB({ url: endpoint, token });
|
|
25
|
+
integration_base_1.ConnectionManager.addConnectionInstance(connection, client);
|
|
26
|
+
integration_base_1.ConnectionManager.logger.info(`influxdb connection(${connection.name}:${connection.endpoint}) is connected`);
|
|
27
|
+
}
|
|
28
|
+
catch (ex) {
|
|
29
|
+
integration_base_1.ConnectionManager.logger.info(`influxdb connection(${connection.name}:${connection.endpoint}) failed to connect`);
|
|
30
|
+
throw ex;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async disconnect(connection) {
|
|
34
|
+
var { client } = integration_base_1.ConnectionManager.removeConnectionInstance(connection);
|
|
35
|
+
client.close();
|
|
36
|
+
integration_base_1.ConnectionManager.logger.info(`influxdb connection(${connection.name}) is disconnected`);
|
|
37
|
+
}
|
|
38
|
+
get parameterSpec() {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
type: 'string',
|
|
42
|
+
name: 'token',
|
|
43
|
+
label: 'influxdb.token'
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
get taskPrefixes() {
|
|
48
|
+
return ['influxdb'];
|
|
49
|
+
}
|
|
50
|
+
get help() {
|
|
51
|
+
return 'integration/connector/influxdb-connector';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.InfluxDBConnector = InfluxDBConnector;
|
|
55
|
+
integration_base_1.ConnectionManager.registerConnector('influxdb-connector', new InfluxDBConnector());
|
|
56
|
+
//# sourceMappingURL=influxdb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influxdb.js","sourceRoot":"","sources":["../../../server/engine/connector/influxdb.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AAEtD,uEAA2F;AAE3F,MAAa,iBAAiB;IAC5B,KAAK,CAAC,KAAK,CAAC,iBAAiB;QAC3B,MAAM,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAEjE,oCAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAA;IACjE,CAAC;IAED,uBAA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;gBACd,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,gBAAgB;aACxB;SACF,CAAA;IACH,CAAC;IAED,IAAI,YAAY;QACd,OAAO,CAAC,UAAU,CAAC,CAAA;IACrB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,0CAA0C,CAAA;IACnD,CAAC;CACF;AA3DD,8CA2DC;AAED,oCAAiB,CAAC,iBAAiB,CAAC,oBAAoB,EAAE,IAAI,iBAAiB,EAAE,CAAC,CAAA","sourcesContent":["import { InfluxDB } from '@influxdata/influxdb-client'\n\nimport { Connection, ConnectionManager, Connector } from '@things-factory/integration-base'\n\nexport class InfluxDBConnector implements Connector {\n async ready(connectionConfigs) {\n await Promise.all(connectionConfigs.map(this.connect.bind(this)))\n\n ConnectionManager.logger.info('influxdb connections are ready')\n }\n\n checkConnectionInstance(domain, connectionName): boolean {\n try {\n const connection = ConnectionManager.getConnectionInstanceByName(domain, connectionName)\n\n return !!(connection?.client?.connectionState !== 'online')\n } catch (e) {\n return false\n }\n }\n\n async connect(connection) {\n var {\n endpoint,\n params: { token }\n } = connection\n\n try {\n const client = new InfluxDB({ url: endpoint, token })\n\n ConnectionManager.addConnectionInstance(connection, client)\n\n ConnectionManager.logger.info(`influxdb connection(${connection.name}:${connection.endpoint}) is connected`)\n } catch (ex) {\n ConnectionManager.logger.info(`influxdb connection(${connection.name}:${connection.endpoint}) failed to connect`)\n throw ex\n }\n }\n\n async disconnect(connection: Connection) {\n var { client } = ConnectionManager.removeConnectionInstance(connection)\n client.close()\n\n ConnectionManager.logger.info(`influxdb connection(${connection.name}) is disconnected`)\n }\n\n get parameterSpec() {\n return [\n {\n type: 'string',\n name: 'token',\n label: 'influxdb.token'\n }\n ]\n }\n\n get taskPrefixes() {\n return ['influxdb']\n }\n\n get help() {\n return 'integration/connector/influxdb-connector'\n }\n}\n\nConnectionManager.registerConnector('influxdb-connector', new InfluxDBConnector())\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/engine/index.ts"],"names":[],"mappings":";;AAAA,uBAAoB;AACpB,kBAAe","sourcesContent":["import './connector'\nimport './task'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/engine/task/index.ts"],"names":[],"mappings":";;AAAA,kCAA+B;AAC/B,4BAAyB","sourcesContent":["import './influxdb-write-point'\nimport './influxdb-query'\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const vm2_1 = require("vm2");
|
|
5
|
+
const integration_base_1 = require("@things-factory/integration-base");
|
|
6
|
+
const debug = require('debug')('things-factory:influxdb-query');
|
|
7
|
+
function processInfluxData(raws) {
|
|
8
|
+
var current;
|
|
9
|
+
var result = {};
|
|
10
|
+
raws.forEach(raw => {
|
|
11
|
+
const { _time, _field, _value, _measurement, _start, _stop, result: _result, table } = raw, tags = tslib_1.__rest(raw, ["_time", "_field", "_value", "_measurement", "_start", "_stop", "result", "table"]);
|
|
12
|
+
result[_time] || (result[_time] = {
|
|
13
|
+
timestamp: _time,
|
|
14
|
+
measurement: _measurement,
|
|
15
|
+
tags,
|
|
16
|
+
fields: {}
|
|
17
|
+
});
|
|
18
|
+
result[_time].fields[_field] = _value;
|
|
19
|
+
});
|
|
20
|
+
return Object.values(result);
|
|
21
|
+
}
|
|
22
|
+
async function influxdbQuery(step, { domain, user, data, variables, lng }) {
|
|
23
|
+
const { connection, params: { organization, query } } = step;
|
|
24
|
+
const client = integration_base_1.ConnectionManager.getConnectionInstanceByName(domain, connection);
|
|
25
|
+
if (!client) {
|
|
26
|
+
debug(`no connection : ${connection}`);
|
|
27
|
+
throw new Error(`no connection : ${connection}`);
|
|
28
|
+
}
|
|
29
|
+
const vm = new vm2_1.VM({
|
|
30
|
+
sandbox: {
|
|
31
|
+
domain,
|
|
32
|
+
user,
|
|
33
|
+
lng,
|
|
34
|
+
data,
|
|
35
|
+
variables
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const fluxQuery = vm.run('`' + query + '`');
|
|
39
|
+
const queryApi = client.getQueryApi(organization);
|
|
40
|
+
const result = await queryApi.collectRows(fluxQuery);
|
|
41
|
+
return {
|
|
42
|
+
data: processInfluxData(result)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
influxdbQuery.parameterSpec = [
|
|
46
|
+
{
|
|
47
|
+
type: 'string',
|
|
48
|
+
name: 'organization',
|
|
49
|
+
label: 'influxdb.organization'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'textarea',
|
|
53
|
+
name: 'query',
|
|
54
|
+
label: 'influxdb.query'
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
influxdbQuery.help = 'integration/task/influxdb-query';
|
|
58
|
+
integration_base_1.TaskRegistry.registerTaskHandler('influxdb-query', influxdbQuery);
|
|
59
|
+
//# sourceMappingURL=influxdb-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influxdb-query.js","sourceRoot":"","sources":["../../../server/engine/task/influxdb-query.ts"],"names":[],"mappings":";;;AACA,6BAAwB;AAExB,uEAA2F;AAE3F,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,+BAA+B,CAAC,CAAA;AAqB/D,SAAS,iBAAiB,CAAC,IAAiB;IAC1C,IAAI,OAAmB,CAAA;IACvB,IAAI,MAAM,GAAmC,EAAE,CAAA;IAE/C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,KAAc,GAAG,EAAZ,IAAI,kBAAK,GAAG,EAA7F,mFAAuF,CAAM,CAAA;QAEnG,MAAM,C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IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,uBAAuB;KAC/B;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,gBAAgB;KACxB;CACF,CAAA;AAED,aAAa,CAAC,IAAI,GAAG,iCAAiC,CAAA;AAEtD,+BAAY,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAA","sourcesContent":["import { InfluxDB, FluxTableMetaData } from '@influxdata/influxdb-client'\nimport { VM } from 'vm2'\n\nimport { ConnectionManager, Context, TaskRegistry } from '@things-factory/integration-base'\n\nconst debug = require('debug')('things-factory:influxdb-query')\n\ninterface InfluxData {\n measurement: string\n tags: { [key: string]: string }\n fields: { [key: string]: number | string | boolean }\n timestamp: string\n}\n\ninterface InfluxRaw {\n _time: string\n _start: string\n _stop: string\n _measurement: string\n _field: string\n _value: any\n table: any\n result: any\n [tag: string]: string\n}\n\nfunction processInfluxData(raws: InfluxRaw[]): InfluxData[] {\n var current: InfluxData\n var result: { [time: string]: InfluxData } = {}\n\n raws.forEach(raw => {\n const { _time, _field, _value, _measurement, _start, _stop, result: _result, table, ...tags } = raw\n\n result[_time] ||= {\n timestamp: _time,\n measurement: _measurement,\n tags,\n fields: {}\n }\n\n result[_time].fields[_field] = _value\n })\n\n return Object.values(result)\n}\n\nasync function influxdbQuery(step, { domain, user, data, variables, lng }: Context) {\n const {\n connection,\n params: { organization, query }\n } = step\n\n const client = ConnectionManager.getConnectionInstanceByName(domain, connection) as InfluxDB\n if (!client) {\n debug(`no connection : ${connection}`)\n throw new Error(`no connection : ${connection}`)\n }\n\n const vm = new VM({\n sandbox: {\n domain,\n user,\n lng,\n data,\n variables\n }\n })\n\n const fluxQuery = vm.run('`' + query + '`')\n\n const queryApi = client.getQueryApi(organization)\n\n const result = await queryApi.collectRows(fluxQuery)\n\n return {\n data: processInfluxData(result as InfluxRaw[])\n }\n}\n\ninfluxdbQuery.parameterSpec = [\n {\n type: 'string',\n name: 'organization',\n label: 'influxdb.organization'\n },\n {\n type: 'textarea',\n name: 'query',\n label: 'influxdb.query'\n }\n]\n\ninfluxdbQuery.help = 'integration/task/influxdb-query'\n\nTaskRegistry.registerTaskHandler('influxdb-query', influxdbQuery)\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const influxdb_client_1 = require("@influxdata/influxdb-client");
|
|
4
|
+
const utils_1 = require("@things-factory/utils");
|
|
5
|
+
const integration_base_1 = require("@things-factory/integration-base");
|
|
6
|
+
const debug = require('debug')('things-factory:influxdb-write-point');
|
|
7
|
+
async function influxdbWritePoint(step, { logger, domain, data }) {
|
|
8
|
+
const { connection, params: { organization, bucket, measurement, scheme } } = step;
|
|
9
|
+
const client = integration_base_1.ConnectionManager.getConnectionInstanceByName(domain, connection);
|
|
10
|
+
if (!client) {
|
|
11
|
+
debug(`no connection : ${connection}`);
|
|
12
|
+
throw new Error(`no connection : ${connection}`);
|
|
13
|
+
}
|
|
14
|
+
const writeClient = client.getWriteApi(organization, bucket, 'ns');
|
|
15
|
+
const point = new influxdb_client_1.Point(measurement);
|
|
16
|
+
scheme.forEach((field) => {
|
|
17
|
+
const { name, val, type, accessor } = field;
|
|
18
|
+
const calculated = accessor ? (0, utils_1.access)(accessor, data) || val : val;
|
|
19
|
+
switch (type) {
|
|
20
|
+
case 'Tag':
|
|
21
|
+
point.tag(name, calculated);
|
|
22
|
+
break;
|
|
23
|
+
case 'String':
|
|
24
|
+
point.stringField(name, calculated);
|
|
25
|
+
break;
|
|
26
|
+
case 'Integer':
|
|
27
|
+
point.intField(name, calculated);
|
|
28
|
+
break;
|
|
29
|
+
case 'Unsigned':
|
|
30
|
+
point.uintField(name, calculated);
|
|
31
|
+
break;
|
|
32
|
+
case 'Float':
|
|
33
|
+
point.floatField(name, calculated);
|
|
34
|
+
break;
|
|
35
|
+
case 'Boolean':
|
|
36
|
+
point.booleanField(name, calculated);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
await writeClient.writePoint(point);
|
|
41
|
+
await writeClient.close();
|
|
42
|
+
return {
|
|
43
|
+
data: point.fields
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
influxdbWritePoint.parameterSpec = [
|
|
47
|
+
{
|
|
48
|
+
type: 'string',
|
|
49
|
+
name: 'organization',
|
|
50
|
+
label: 'influxdb.organization'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'string',
|
|
54
|
+
name: 'bucket',
|
|
55
|
+
label: 'influxdb.bucket'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'string',
|
|
59
|
+
name: 'measurement',
|
|
60
|
+
label: 'influxdb.measurement'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'influxdb-point-scheme',
|
|
64
|
+
name: 'scheme',
|
|
65
|
+
label: 'influxdb.point-scheme'
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
influxdbWritePoint.help = 'integration/task/influxdb-write-point';
|
|
69
|
+
integration_base_1.TaskRegistry.registerTaskHandler('influxdb-write-point', influxdbWritePoint);
|
|
70
|
+
//# sourceMappingURL=influxdb-write-point.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influxdb-write-point.js","sourceRoot":"","sources":["../../../server/engine/task/influxdb-write-point.ts"],"names":[],"mappings":";;AAAA,iEAAmD;AAEnD,iDAA8C;AAC9C,uEAAkF;AAElF,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,qCAAqC,CAAC,CAAA;AASrE,KAAK,UAAU,kBAAkB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;IAC9D,MAAM,EACJ,UAAU,EACV,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAA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AU,CAAC,CAAA;gBACpC,MAAK;SACR;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IACnC,MAAM,WAAW,CAAC,KAAK,EAAE,CAAA;IAEzB,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,MAAM;KACnB,CAAA;AACH,CAAC;AAED,kBAAkB,CAAC,aAAa,GAAG;IACjC;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,uBAAuB;KAC/B;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,iBAAiB;KACzB;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,sBAAsB;KAC9B;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,uBAAuB;KAC/B;CACF,CAAA;AAED,kBAAkB,CAAC,IAAI,GAAG,uCAAuC,CAAA;AAEjE,+BAAY,CAAC,mBAAmB,CAAC,sBAAsB,EAAE,kBAAkB,CAAC,CAAA","sourcesContent":["import { Point } from '@influxdata/influxdb-client'\n\nimport { access } from '@things-factory/utils'\nimport { ConnectionManager, TaskRegistry } from '@things-factory/integration-base'\n\nconst debug = require('debug')('things-factory:influxdb-write-point')\n\ntype InfluxDBPointScheme = {\n name: string\n type: string\n val?: any\n accessor?: string\n}\n\nasync function influxdbWritePoint(step, { logger, domain, data }) {\n const {\n connection,\n params: { organization, bucket, measurement, scheme }\n } = step\n\n const client = ConnectionManager.getConnectionInstanceByName(domain, connection)\n if (!client) {\n debug(`no connection : ${connection}`)\n throw new Error(`no connection : ${connection}`)\n }\n\n const writeClient = client.getWriteApi(organization, bucket, 'ns')\n const point = new Point(measurement)\n\n scheme.forEach((field: InfluxDBPointScheme) => {\n const { name, val, type, accessor } = field\n const calculated = accessor ? access(accessor, data) || val : val\n\n switch (type) {\n case 'Tag':\n point.tag(name, calculated)\n break\n case 'String':\n point.stringField(name, calculated)\n break\n case 'Integer':\n point.intField(name, calculated)\n break\n case 'Unsigned':\n point.uintField(name, calculated)\n break\n case 'Float':\n point.floatField(name, calculated)\n break\n case 'Boolean':\n point.booleanField(name, calculated)\n break\n }\n })\n\n await writeClient.writePoint(point)\n await writeClient.close()\n\n return {\n data: point.fields\n }\n}\n\ninfluxdbWritePoint.parameterSpec = [\n {\n type: 'string',\n name: 'organization',\n label: 'influxdb.organization'\n },\n {\n type: 'string',\n name: 'bucket',\n label: 'influxdb.bucket'\n },\n {\n type: 'string',\n name: 'measurement',\n label: 'influxdb.measurement'\n },\n {\n type: 'influxdb-point-scheme',\n name: 'scheme',\n label: 'influxdb.point-scheme'\n }\n]\n\ninfluxdbWritePoint.help = 'integration/task/influxdb-write-point'\n\nTaskRegistry.registerTaskHandler('influxdb-write-point', influxdbWritePoint)\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;AAAA,oBAAiB","sourcesContent":["import './engine'\n"]}
|